From 18f3386a98e67f1c5b75c4cc47a0ebb898c59b9b Mon Sep 17 00:00:00 2001 From: "Y. Srinivas Ramakrishna" Date: Thu, 5 Jun 2008 15:57:56 -0700 Subject: [PATCH 001/267] 6711316: Open source the Garbage-First garbage collector First mercurial integration of the code for the Garbage-First garbage collector. Reviewed-by: apetrusenko, iveresov, jmasa, sgoldman, tonyp, ysr --- hotspot/make/linux/makefiles/top.make | 1 + hotspot/make/solaris/makefiles/top.make | 1 + hotspot/make/windows/makefiles/generated.make | 3 +- hotspot/make/windows/makefiles/makedeps.make | 2 + hotspot/make/windows/makefiles/vm.make | 5 + hotspot/src/cpu/sparc/vm/assembler_sparc.cpp | 649 +- hotspot/src/cpu/sparc/vm/assembler_sparc.hpp | 39 +- .../src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp | 51 + .../cpu/sparc/vm/c1_LIRAssembler_sparc.cpp | 6 +- .../cpu/sparc/vm/c1_LIRGenerator_sparc.cpp | 16 + .../src/cpu/sparc/vm/c1_Runtime1_sparc.cpp | 157 + .../src/cpu/sparc/vm/sharedRuntime_sparc.cpp | 4 +- .../src/cpu/sparc/vm/stubGenerator_sparc.cpp | 39 +- .../src/cpu/sparc/vm/templateTable_sparc.cpp | 100 +- hotspot/src/cpu/x86/vm/assembler_x86_32.cpp | 177 +- hotspot/src/cpu/x86/vm/assembler_x86_32.hpp | 15 +- hotspot/src/cpu/x86/vm/assembler_x86_64.cpp | 173 +- hotspot/src/cpu/x86/vm/assembler_x86_64.hpp | 15 + hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp | 45 + .../src/cpu/x86/vm/c1_LIRGenerator_x86.cpp | 9 +- hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp | 130 + hotspot/src/cpu/x86/vm/interp_masm_x86_64.cpp | 28 +- .../src/cpu/x86/vm/stubGenerator_x86_32.cpp | 14 +- .../src/cpu/x86/vm/stubGenerator_x86_64.cpp | 35 +- .../src/cpu/x86/vm/templateTable_x86_32.cpp | 117 +- .../src/cpu/x86/vm/templateTable_x86_64.cpp | 108 +- hotspot/src/os/linux/vm/os_linux.cpp | 11 + hotspot/src/os/solaris/vm/os_solaris.cpp | 36 +- hotspot/src/os/windows/vm/os_windows.cpp | 11 + hotspot/src/share/vm/adlc/formssel.cpp | 5 + hotspot/src/share/vm/c1/c1_CodeStubs.hpp | 78 + hotspot/src/share/vm/c1/c1_LIRAssembler.cpp | 1 + hotspot/src/share/vm/c1/c1_LIRAssembler.hpp | 2 + hotspot/src/share/vm/c1/c1_LIRGenerator.cpp | 169 +- hotspot/src/share/vm/c1/c1_LIRGenerator.hpp | 11 +- hotspot/src/share/vm/c1/c1_Runtime1.cpp | 2 + hotspot/src/share/vm/c1/c1_Runtime1.hpp | 2 + hotspot/src/share/vm/c1/c1_globals.hpp | 3 - .../src/share/vm/compiler/methodLiveness.cpp | 5 +- .../src/share/vm/compiler/methodLiveness.hpp | 2 +- .../compactibleFreeListSpace.cpp | 8 +- .../compactibleFreeListSpace.hpp | 2 +- .../concurrentMarkSweepGeneration.cpp | 43 +- .../concurrentMarkSweepGeneration.hpp | 9 +- .../g1/bufferingOopClosure.hpp | 195 + .../g1/collectionSetChooser.cpp | 409 ++ .../g1/collectionSetChooser.hpp | 138 + .../g1/concurrentG1Refine.cpp | 355 ++ .../g1/concurrentG1Refine.hpp | 132 + .../g1/concurrentG1RefineThread.cpp | 246 + .../g1/concurrentG1RefineThread.hpp | 104 + .../gc_implementation/g1/concurrentMark.cpp | 3957 ++++++++++++ .../gc_implementation/g1/concurrentMark.hpp | 1049 ++++ .../g1/concurrentMarkThread.cpp | 336 ++ .../g1/concurrentMarkThread.hpp | 84 + .../g1/concurrentMarkThread.inline.hpp | 33 + .../g1/concurrentZFThread.cpp | 191 + .../g1/concurrentZFThread.hpp | 85 + .../gc_implementation/g1/dirtyCardQueue.cpp | 307 + .../gc_implementation/g1/dirtyCardQueue.hpp | 152 + .../g1/g1BlockOffsetTable.cpp | 624 ++ .../g1/g1BlockOffsetTable.hpp | 487 ++ .../g1/g1BlockOffsetTable.inline.hpp | 153 + .../gc_implementation/g1/g1CollectedHeap.cpp | 5355 +++++++++++++++++ .../gc_implementation/g1/g1CollectedHeap.hpp | 1191 ++++ .../g1/g1CollectedHeap.inline.hpp | 91 + .../g1/g1CollectorPolicy.cpp | 3159 ++++++++++ .../g1/g1CollectorPolicy.hpp | 1199 ++++ .../vm/gc_implementation/g1/g1MMUTracker.cpp | 187 + .../vm/gc_implementation/g1/g1MMUTracker.hpp | 130 + .../vm/gc_implementation/g1/g1MarkSweep.cpp | 381 ++ .../vm/gc_implementation/g1/g1MarkSweep.hpp | 57 + .../vm/gc_implementation/g1/g1OopClosures.hpp | 202 + .../g1/g1OopClosures.inline.hpp | 112 + .../vm/gc_implementation/g1/g1RemSet.cpp | 1003 +++ .../vm/gc_implementation/g1/g1RemSet.hpp | 216 + .../gc_implementation/g1/g1RemSet.inline.hpp | 104 + .../g1/g1SATBCardTableModRefBS.cpp | 150 + .../g1/g1SATBCardTableModRefBS.hpp | 107 + .../vm/gc_implementation/g1/g1_globals.cpp | 31 + .../vm/gc_implementation/g1/g1_globals.hpp | 287 + .../g1/g1_specialized_oop_closures.hpp | 64 + .../vm/gc_implementation/g1/heapRegion.cpp | 874 +++ .../vm/gc_implementation/g1/heapRegion.hpp | 924 +++ .../g1/heapRegion.inline.hpp | 60 + .../gc_implementation/g1/heapRegionRemSet.cpp | 1443 +++++ .../gc_implementation/g1/heapRegionRemSet.hpp | 470 ++ .../vm/gc_implementation/g1/heapRegionSeq.cpp | 344 ++ .../vm/gc_implementation/g1/heapRegionSeq.hpp | 111 + .../g1/heapRegionSeq.inline.hpp | 40 + .../vm/gc_implementation/g1/ptrQueue.cpp | 208 + .../vm/gc_implementation/g1/ptrQueue.hpp | 229 + .../gc_implementation/g1/ptrQueue.inline.hpp | 41 + .../vm/gc_implementation/g1/satbQueue.cpp | 160 + .../vm/gc_implementation/g1/satbQueue.hpp | 105 + .../vm/gc_implementation/g1/sparsePRT.cpp | 530 ++ .../vm/gc_implementation/g1/sparsePRT.hpp | 308 + .../vm/gc_implementation/g1/survRateGroup.cpp | 264 + .../vm/gc_implementation/g1/survRateGroup.hpp | 102 + .../gc_implementation/g1/vm_operations_g1.cpp | 79 + .../gc_implementation/g1/vm_operations_g1.hpp | 114 + .../includeDB_gc_concurrentMarkSweep | 13 +- .../vm/gc_implementation/includeDB_gc_g1 | 349 ++ .../includeDB_gc_parallelScavenge | 2 - .../vm/gc_implementation/includeDB_gc_shared | 26 + .../parallelScavenge/parMarkBitMap.hpp | 14 +- .../parallelScavenge/parallelScavengeHeap.hpp | 14 + .../vm/gc_implementation/shared/coTracker.cpp | 189 + .../vm/gc_implementation/shared/coTracker.hpp | 181 + .../shared/concurrentGCThread.cpp | 314 + .../shared/concurrentGCThread.hpp | 167 + .../shared/gcOverheadReporter.cpp | 179 + .../shared/gcOverheadReporter.hpp | 141 + .../shared/vmGCOperations.cpp | 32 +- .../share/vm/gc_interface/collectedHeap.cpp | 7 - .../share/vm/gc_interface/collectedHeap.hpp | 12 +- .../vm/gc_interface/collectedHeap.inline.hpp | 2 +- hotspot/src/share/vm/gc_interface/gcCause.hpp | 4 + hotspot/src/share/vm/includeDB_compiler1 | 61 +- hotspot/src/share/vm/includeDB_compiler2 | 6 + hotspot/src/share/vm/includeDB_core | 32 +- hotspot/src/share/vm/includeDB_gc_parallel | 17 + hotspot/src/share/vm/includeDB_jvmti | 1 + .../share/vm/interpreter/templateTable.cpp | 3 + .../share/vm/interpreter/templateTable.hpp | 1 + hotspot/src/share/vm/memory/allocation.hpp | 6 + hotspot/src/share/vm/memory/barrierSet.cpp | 36 + hotspot/src/share/vm/memory/barrierSet.hpp | 50 +- .../src/share/vm/memory/barrierSet.inline.hpp | 8 + .../src/share/vm/memory/blockOffsetTable.cpp | 2 +- .../src/share/vm/memory/blockOffsetTable.hpp | 1 + .../src/share/vm/memory/cardTableModRefBS.cpp | 31 +- .../src/share/vm/memory/cardTableModRefBS.hpp | 81 +- hotspot/src/share/vm/memory/cardTableRS.cpp | 34 +- hotspot/src/share/vm/memory/cardTableRS.hpp | 22 +- .../src/share/vm/memory/collectorPolicy.cpp | 32 +- .../src/share/vm/memory/collectorPolicy.hpp | 16 +- .../src/share/vm/memory/defNewGeneration.cpp | 26 +- .../src/share/vm/memory/genCollectedHeap.hpp | 15 + hotspot/src/share/vm/memory/genMarkSweep.hpp | 1 + .../src/share/vm/memory/genOopClosures.hpp | 3 + .../share/vm/memory/genOopClosures.inline.hpp | 10 + hotspot/src/share/vm/memory/genRemSet.hpp | 9 +- .../src/share/vm/memory/heapInspection.cpp | 15 +- hotspot/src/share/vm/memory/iterator.hpp | 23 +- .../src/share/vm/memory/modRefBarrierSet.hpp | 13 +- .../share/vm/memory/referenceProcessor.cpp | 67 +- .../share/vm/memory/referenceProcessor.hpp | 26 +- hotspot/src/share/vm/memory/sharedHeap.cpp | 18 +- hotspot/src/share/vm/memory/sharedHeap.hpp | 21 +- hotspot/src/share/vm/memory/space.cpp | 68 +- hotspot/src/share/vm/memory/space.hpp | 129 +- hotspot/src/share/vm/memory/space.inline.hpp | 7 +- .../vm/memory/specialized_oop_closures.hpp | 54 +- hotspot/src/share/vm/memory/universe.cpp | 23 +- hotspot/src/share/vm/oops/generateOopMap.cpp | 52 +- hotspot/src/share/vm/oops/generateOopMap.hpp | 14 +- hotspot/src/share/vm/oops/instanceKlass.cpp | 35 +- hotspot/src/share/vm/oops/instanceKlass.hpp | 16 +- .../src/share/vm/oops/instanceRefKlass.cpp | 34 +- .../src/share/vm/oops/instanceRefKlass.hpp | 10 +- hotspot/src/share/vm/oops/klass.hpp | 36 +- hotspot/src/share/vm/oops/markOop.hpp | 18 +- hotspot/src/share/vm/oops/markOop.inline.hpp | 18 + hotspot/src/share/vm/oops/objArrayKlass.cpp | 24 +- hotspot/src/share/vm/oops/objArrayKlass.hpp | 2 +- hotspot/src/share/vm/oops/objArrayOop.cpp | 2 +- hotspot/src/share/vm/oops/objArrayOop.hpp | 4 +- hotspot/src/share/vm/oops/oop.hpp | 13 +- hotspot/src/share/vm/oops/oop.inline.hpp | 38 +- hotspot/src/share/vm/opto/graphKit.cpp | 262 + hotspot/src/share/vm/opto/graphKit.hpp | 22 + hotspot/src/share/vm/opto/lcm.cpp | 2 +- hotspot/src/share/vm/opto/macro.cpp | 36 +- hotspot/src/share/vm/opto/runtime.cpp | 31 + hotspot/src/share/vm/opto/runtime.hpp | 8 + hotspot/src/share/vm/prims/jvm.cpp | 6 +- hotspot/src/share/vm/prims/jvmtiExport.cpp | 28 +- hotspot/src/share/vm/prims/jvmtiTagMap.cpp | 30 +- hotspot/src/share/vm/prims/unsafe.cpp | 1 + hotspot/src/share/vm/runtime/aprofiler.hpp | 1 + hotspot/src/share/vm/runtime/arguments.cpp | 184 +- hotspot/src/share/vm/runtime/arguments.hpp | 6 +- hotspot/src/share/vm/runtime/globals.cpp | 3 + hotspot/src/share/vm/runtime/globals.hpp | 23 +- .../share/vm/runtime/globals_extension.hpp | 60 +- hotspot/src/share/vm/runtime/mutexLocker.cpp | 35 +- hotspot/src/share/vm/runtime/mutexLocker.hpp | 28 +- hotspot/src/share/vm/runtime/os.hpp | 12 + .../src/share/vm/runtime/sharedRuntime.cpp | 19 + .../src/share/vm/runtime/sharedRuntime.hpp | 6 + hotspot/src/share/vm/runtime/task.cpp | 1 - hotspot/src/share/vm/runtime/thread.cpp | 36 +- hotspot/src/share/vm/runtime/thread.hpp | 39 + hotspot/src/share/vm/runtime/virtualspace.cpp | 28 +- hotspot/src/share/vm/runtime/vmStructs.cpp | 7 +- .../src/share/vm/runtime/vm_operations.hpp | 5 + hotspot/src/share/vm/services/heapDumper.cpp | 11 +- .../src/share/vm/services/memoryService.cpp | 6 +- hotspot/src/share/vm/utilities/bitMap.cpp | 341 +- hotspot/src/share/vm/utilities/bitMap.hpp | 262 +- .../src/share/vm/utilities/bitMap.inline.hpp | 247 +- hotspot/src/share/vm/utilities/debug.cpp | 6 +- hotspot/src/share/vm/utilities/intHisto.cpp | 64 + hotspot/src/share/vm/utilities/intHisto.hpp | 70 + hotspot/src/share/vm/utilities/numberSeq.cpp | 243 + hotspot/src/share/vm/utilities/numberSeq.hpp | 117 + hotspot/src/share/vm/utilities/ostream.cpp | 11 + hotspot/src/share/vm/utilities/ostream.hpp | 4 + hotspot/src/share/vm/utilities/taskqueue.cpp | 6 +- hotspot/src/share/vm/utilities/taskqueue.hpp | 41 +- hotspot/src/share/vm/utilities/workgroup.cpp | 175 +- hotspot/src/share/vm/utilities/workgroup.hpp | 69 +- .../share/vm/utilities/yieldingWorkgroup.cpp | 4 +- .../share/vm/utilities/yieldingWorkgroup.hpp | 3 +- 215 files changed, 36088 insertions(+), 1249 deletions(-) create mode 100644 hotspot/src/share/vm/gc_implementation/g1/bufferingOopClosure.hpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.cpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.hpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.hpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/concurrentG1RefineThread.cpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/concurrentG1RefineThread.hpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.hpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.inline.hpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/concurrentZFThread.cpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/concurrentZFThread.hpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.hpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.inline.hpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/g1MMUTracker.cpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/g1MMUTracker.hpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.hpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.hpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/g1RemSet.inline.hpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/g1_globals.cpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/g1_specialized_oop_closures.hpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/heapRegion.inline.hpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.hpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.inline.hpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/ptrQueue.hpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/ptrQueue.inline.hpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/satbQueue.cpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/satbQueue.hpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/sparsePRT.cpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/sparsePRT.hpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/survRateGroup.cpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/survRateGroup.hpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp create mode 100644 hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.hpp create mode 100644 hotspot/src/share/vm/gc_implementation/includeDB_gc_g1 create mode 100644 hotspot/src/share/vm/gc_implementation/shared/coTracker.cpp create mode 100644 hotspot/src/share/vm/gc_implementation/shared/coTracker.hpp create mode 100644 hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp create mode 100644 hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.hpp create mode 100644 hotspot/src/share/vm/gc_implementation/shared/gcOverheadReporter.cpp create mode 100644 hotspot/src/share/vm/gc_implementation/shared/gcOverheadReporter.hpp create mode 100644 hotspot/src/share/vm/memory/barrierSet.cpp create mode 100644 hotspot/src/share/vm/utilities/intHisto.cpp create mode 100644 hotspot/src/share/vm/utilities/intHisto.hpp create mode 100644 hotspot/src/share/vm/utilities/numberSeq.cpp create mode 100644 hotspot/src/share/vm/utilities/numberSeq.hpp diff --git a/hotspot/make/linux/makefiles/top.make b/hotspot/make/linux/makefiles/top.make index f0aa13576d0..1e35f11bffe 100644 --- a/hotspot/make/linux/makefiles/top.make +++ b/hotspot/make/linux/makefiles/top.make @@ -64,6 +64,7 @@ Include_DBs/GC = $(VM)/includeDB_gc \ $(VM)/gc_implementation/includeDB_gc_parallelScavenge \ $(VM)/gc_implementation/includeDB_gc_concurrentMarkSweep \ $(VM)/gc_implementation/includeDB_gc_parNew \ + $(VM)/gc_implementation/includeDB_gc_g1 \ $(VM)/gc_implementation/includeDB_gc_serial \ $(VM)/gc_implementation/includeDB_gc_shared diff --git a/hotspot/make/solaris/makefiles/top.make b/hotspot/make/solaris/makefiles/top.make index 5a883565ada..c80734fd43e 100644 --- a/hotspot/make/solaris/makefiles/top.make +++ b/hotspot/make/solaris/makefiles/top.make @@ -54,6 +54,7 @@ Include_DBs/GC = $(VM)/includeDB_gc \ $(VM)/gc_implementation/includeDB_gc_parallelScavenge \ $(VM)/gc_implementation/includeDB_gc_concurrentMarkSweep \ $(VM)/gc_implementation/includeDB_gc_parNew \ + $(VM)/gc_implementation/includeDB_gc_g1 \ $(VM)/gc_implementation/includeDB_gc_serial \ $(VM)/gc_implementation/includeDB_gc_shared diff --git a/hotspot/make/windows/makefiles/generated.make b/hotspot/make/windows/makefiles/generated.make index 7eff90d1681..301dc58ddcc 100644 --- a/hotspot/make/windows/makefiles/generated.make +++ b/hotspot/make/windows/makefiles/generated.make @@ -50,7 +50,8 @@ IncludeDBs_gc= $(WorkSpace)/src/share/vm/includeDB_gc_parallel \ $(WorkSpace)/src/share/vm/gc_implementation/includeDB_gc_parallelScavenge \ $(WorkSpace)/src/share/vm/gc_implementation/includeDB_gc_shared \ $(WorkSpace)/src/share/vm/gc_implementation/includeDB_gc_parNew \ - $(WorkSpace)/src/share/vm/gc_implementation/includeDB_gc_concurrentMarkSweep + $(WorkSpace)/src/share/vm/gc_implementation/includeDB_gc_concurrentMarkSweep \ + $(WorkSpace)/src/share/vm/gc_implementation/includeDB_gc_g1 IncludeDBs_core=$(IncludeDBs_base) $(IncludeDBs_gc) \ $(WorkSpace)/src/share/vm/includeDB_features diff --git a/hotspot/make/windows/makefiles/makedeps.make b/hotspot/make/windows/makefiles/makedeps.make index e3164313d7e..8c2649f8da9 100644 --- a/hotspot/make/windows/makefiles/makedeps.make +++ b/hotspot/make/windows/makefiles/makedeps.make @@ -64,6 +64,7 @@ MakeDepsIncludesPRIVATE=\ -relativeInclude src\share\vm\gc_implementation\shared \ -relativeInclude src\share\vm\gc_implementation\parNew \ -relativeInclude src\share\vm\gc_implementation\concurrentMarkSweep \ + -relativeInclude src\share\vm\gc_implementation\g1 \ -relativeInclude src\share\vm\gc_interface \ -relativeInclude src\share\vm\asm \ -relativeInclude src\share\vm\memory \ @@ -115,6 +116,7 @@ MakeDepsIDEOptions=\ -additionalFile includeDB_gc_parallel \ -additionalFile includeDB_gc_parallelScavenge \ -additionalFile includeDB_gc_concurrentMarkSweep \ + -additionalFile includeDB_gc_g1 \ -additionalFile includeDB_gc_parNew \ -additionalFile includeDB_gc_shared \ -additionalFile includeDB_gc_serial \ diff --git a/hotspot/make/windows/makefiles/vm.make b/hotspot/make/windows/makefiles/vm.make index c911ab261f0..b1d4961b0e2 100644 --- a/hotspot/make/windows/makefiles/vm.make +++ b/hotspot/make/windows/makefiles/vm.make @@ -110,6 +110,7 @@ CPP_INCLUDE_DIRS=\ /I "$(WorkSpace)\src\share\vm\gc_implementation\shared"\ /I "$(WorkSpace)\src\share\vm\gc_implementation\parNew"\ /I "$(WorkSpace)\src\share\vm\gc_implementation\concurrentMarkSweep"\ + /I "$(WorkSpace)\src\share\vm\gc_implementation\g1"\ /I "$(WorkSpace)\src\share\vm\gc_interface"\ /I "$(WorkSpace)\src\share\vm\asm" \ /I "$(WorkSpace)\src\share\vm\memory" \ @@ -139,6 +140,7 @@ VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/gc_implementation/parallelScavenge VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/gc_implementation/shared VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/gc_implementation/parNew VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/gc_implementation/concurrentMarkSweep +VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/gc_implementation/g1 VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/gc_interface VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/asm VM_PATH=$(VM_PATH);$(WorkSpace)/src/share/vm/memory @@ -215,6 +217,9 @@ bytecodeInterpreterWithChecks.obj: ..\generated\jvmtifiles\bytecodeInterpreterWi {$(WorkSpace)\src\share\vm\gc_implementation\concurrentMarkSweep}.cpp.obj:: $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< +{$(WorkSpace)\src\share\vm\gc_implementation\g1}.cpp.obj:: + $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< + {$(WorkSpace)\src\share\vm\gc_interface}.cpp.obj:: $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $< diff --git a/hotspot/src/cpu/sparc/vm/assembler_sparc.cpp b/hotspot/src/cpu/sparc/vm/assembler_sparc.cpp index a4963c65078..c35420d63d9 100644 --- a/hotspot/src/cpu/sparc/vm/assembler_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/assembler_sparc.cpp @@ -130,6 +130,20 @@ int AbstractAssembler::code_fill_byte() { return 0x00; // illegal instruction 0x00000000 } +Assembler::Condition Assembler::reg_cond_to_cc_cond(Assembler::RCondition in) { + switch (in) { + case rc_z: return equal; + case rc_lez: return lessEqual; + case rc_lz: return less; + case rc_nz: return notEqual; + case rc_gz: return greater; + case rc_gez: return greaterEqual; + default: + ShouldNotReachHere(); + } + return equal; +} + // Generate a bunch 'o stuff (including v9's #ifndef PRODUCT void Assembler::test_v9() { @@ -1213,31 +1227,19 @@ void MacroAssembler::set_vm_result(Register oop_result) { } -void MacroAssembler::store_check(Register tmp, Register obj) { - // Use two shifts to clear out those low order two bits! (Cannot opt. into 1.) - - /* $$$ This stuff needs to go into one of the BarrierSet generator - functions. (The particular barrier sets will have to be friends of - MacroAssembler, I guess.) */ - BarrierSet* bs = Universe::heap()->barrier_set(); - assert(bs->kind() == BarrierSet::CardTableModRef, "Wrong barrier set kind"); - CardTableModRefBS* ct = (CardTableModRefBS*)bs; - assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code"); +void MacroAssembler::card_table_write(jbyte* byte_map_base, + Register tmp, Register obj) { #ifdef _LP64 srlx(obj, CardTableModRefBS::card_shift, obj); #else srl(obj, CardTableModRefBS::card_shift, obj); #endif assert( tmp != obj, "need separate temp reg"); - Address rs(tmp, (address)ct->byte_map_base); + Address rs(tmp, (address)byte_map_base); load_address(rs); stb(G0, rs.base(), obj); } -void MacroAssembler::store_check(Register tmp, Register obj, Register offset) { - store_check(tmp, obj); -} - // %%% Note: The following six instructions have been moved, // unchanged, from assembler_sparc.inline.hpp. // They will be refactored at a later date. @@ -1648,11 +1650,21 @@ void MacroAssembler::_verify_oop(Register reg, const char* msg, const char * fil if (reg == G0) return; // always NULL, which is always an oop - char buffer[16]; + char buffer[64]; +#ifdef COMPILER1 + if (CommentedAssembly) { + snprintf(buffer, sizeof(buffer), "verify_oop at %d", offset()); + block_comment(buffer); + } +#endif + + int len = strlen(file) + strlen(msg) + 1 + 4; sprintf(buffer, "%d", line); - int len = strlen(file) + strlen(msg) + 1 + 4 + strlen(buffer); + len += strlen(buffer); + sprintf(buffer, " at offset %d ", offset()); + len += strlen(buffer); char * real_msg = new char[len]; - sprintf(real_msg, "%s (%s:%d)", msg, file, line); + sprintf(real_msg, "%s%s(%s:%d)", msg, buffer, file, line); // Call indirectly to solve generation ordering problem Address a(O7, (address)StubRoutines::verify_oop_subroutine_entry_address()); @@ -2044,6 +2056,27 @@ void MacroAssembler::br_notnull( Register s1, bool a, Predict p, Label& L ) { #endif } +void MacroAssembler::br_on_reg_cond( RCondition rc, bool a, Predict p, + Register s1, address d, + relocInfo::relocType rt ) { + if (VM_Version::v9_instructions_work()) { + bpr(rc, a, p, s1, d, rt); + } else { + tst(s1); + br(reg_cond_to_cc_cond(rc), a, p, d, rt); + } +} + +void MacroAssembler::br_on_reg_cond( RCondition rc, bool a, Predict p, + Register s1, Label& L ) { + if (VM_Version::v9_instructions_work()) { + bpr(rc, a, p, s1, L); + } else { + tst(s1); + br(reg_cond_to_cc_cond(rc), a, p, L); + } +} + // instruction sequences factored across compiler & interpreter @@ -3226,68 +3259,74 @@ void MacroAssembler::eden_allocate( assert(0 <= con_size_in_bytes && Assembler::is_simm13(con_size_in_bytes), "illegal object size"); assert((con_size_in_bytes & MinObjAlignmentInBytesMask) == 0, "object size is not multiple of alignment"); - // get eden boundaries - // note: we need both top & top_addr! - const Register top_addr = t1; - const Register end = t2; - - CollectedHeap* ch = Universe::heap(); - set((intx)ch->top_addr(), top_addr); - intx delta = (intx)ch->end_addr() - (intx)ch->top_addr(); - ld_ptr(top_addr, delta, end); - ld_ptr(top_addr, 0, obj); - - // try to allocate - Label retry; - bind(retry); -#ifdef ASSERT - // make sure eden top is properly aligned - { - Label L; - btst(MinObjAlignmentInBytesMask, obj); - br(Assembler::zero, false, Assembler::pt, L); + if (CMSIncrementalMode || !Universe::heap()->supports_inline_contig_alloc()) { + // No allocation in the shared eden. + br(Assembler::always, false, Assembler::pt, slow_case); delayed()->nop(); - stop("eden top is not properly aligned"); - bind(L); - } -#endif // ASSERT - const Register free = end; - sub(end, obj, free); // compute amount of free space - if (var_size_in_bytes->is_valid()) { - // size is unknown at compile time - cmp(free, var_size_in_bytes); - br(Assembler::lessUnsigned, false, Assembler::pn, slow_case); // if there is not enough space go the slow case - delayed()->add(obj, var_size_in_bytes, end); } else { - // size is known at compile time - cmp(free, con_size_in_bytes); - br(Assembler::lessUnsigned, false, Assembler::pn, slow_case); // if there is not enough space go the slow case - delayed()->add(obj, con_size_in_bytes, end); - } - // Compare obj with the value at top_addr; if still equal, swap the value of - // end with the value at top_addr. If not equal, read the value at top_addr - // into end. - casx_under_lock(top_addr, obj, end, (address)StubRoutines::Sparc::atomic_memory_operation_lock_addr()); - // if someone beat us on the allocation, try again, otherwise continue - cmp(obj, end); - brx(Assembler::notEqual, false, Assembler::pn, retry); - delayed()->mov(end, obj); // nop if successfull since obj == end + // get eden boundaries + // note: we need both top & top_addr! + const Register top_addr = t1; + const Register end = t2; + + CollectedHeap* ch = Universe::heap(); + set((intx)ch->top_addr(), top_addr); + intx delta = (intx)ch->end_addr() - (intx)ch->top_addr(); + ld_ptr(top_addr, delta, end); + ld_ptr(top_addr, 0, obj); + + // try to allocate + Label retry; + bind(retry); +#ifdef ASSERT + // make sure eden top is properly aligned + { + Label L; + btst(MinObjAlignmentInBytesMask, obj); + br(Assembler::zero, false, Assembler::pt, L); + delayed()->nop(); + stop("eden top is not properly aligned"); + bind(L); + } +#endif // ASSERT + const Register free = end; + sub(end, obj, free); // compute amount of free space + if (var_size_in_bytes->is_valid()) { + // size is unknown at compile time + cmp(free, var_size_in_bytes); + br(Assembler::lessUnsigned, false, Assembler::pn, slow_case); // if there is not enough space go the slow case + delayed()->add(obj, var_size_in_bytes, end); + } else { + // size is known at compile time + cmp(free, con_size_in_bytes); + br(Assembler::lessUnsigned, false, Assembler::pn, slow_case); // if there is not enough space go the slow case + delayed()->add(obj, con_size_in_bytes, end); + } + // Compare obj with the value at top_addr; if still equal, swap the value of + // end with the value at top_addr. If not equal, read the value at top_addr + // into end. + casx_under_lock(top_addr, obj, end, (address)StubRoutines::Sparc::atomic_memory_operation_lock_addr()); + // if someone beat us on the allocation, try again, otherwise continue + cmp(obj, end); + brx(Assembler::notEqual, false, Assembler::pn, retry); + delayed()->mov(end, obj); // nop if successfull since obj == end #ifdef ASSERT - // make sure eden top is properly aligned - { - Label L; - const Register top_addr = t1; + // make sure eden top is properly aligned + { + Label L; + const Register top_addr = t1; - set((intx)ch->top_addr(), top_addr); - ld_ptr(top_addr, 0, top_addr); - btst(MinObjAlignmentInBytesMask, top_addr); - br(Assembler::zero, false, Assembler::pt, L); - delayed()->nop(); - stop("eden top is not properly aligned"); - bind(L); - } + set((intx)ch->top_addr(), top_addr); + ld_ptr(top_addr, 0, top_addr); + btst(MinObjAlignmentInBytesMask, top_addr); + br(Assembler::zero, false, Assembler::pt, L); + delayed()->nop(); + stop("eden top is not properly aligned"); + bind(L); + } #endif // ASSERT + } } @@ -3537,6 +3576,468 @@ void MacroAssembler::bang_stack_size(Register Rsize, Register Rtsp, } } +/////////////////////////////////////////////////////////////////////////////////// +#ifndef SERIALGC + +static uint num_stores = 0; +static uint num_null_pre_stores = 0; + +static void count_null_pre_vals(void* pre_val) { + num_stores++; + if (pre_val == NULL) num_null_pre_stores++; + if ((num_stores % 1000000) == 0) { + tty->print_cr(UINT32_FORMAT " stores, " UINT32_FORMAT " (%5.2f%%) with null pre-vals.", + num_stores, num_null_pre_stores, + 100.0*(float)num_null_pre_stores/(float)num_stores); + } +} + +static address satb_log_enqueue_with_frame = 0; +static u_char* satb_log_enqueue_with_frame_end = 0; + +static address satb_log_enqueue_frameless = 0; +static u_char* satb_log_enqueue_frameless_end = 0; + +static int EnqueueCodeSize = 128 DEBUG_ONLY( + 256); // Instructions? + +// The calls to this don't work. We'd need to do a fair amount of work to +// make it work. +static void check_index(int ind) { + assert(0 <= ind && ind <= 64*K && ((ind % oopSize) == 0), + "Invariants.") +} + +static void generate_satb_log_enqueue(bool with_frame) { + BufferBlob* bb = BufferBlob::create("enqueue_with_frame", EnqueueCodeSize); + CodeBuffer buf(bb->instructions_begin(), bb->instructions_size()); + MacroAssembler masm(&buf); + address start = masm.pc(); + Register pre_val; + + Label refill, restart; + if (with_frame) { + masm.save_frame(0); + pre_val = I0; // Was O0 before the save. + } else { + pre_val = O0; + } + int satb_q_index_byte_offset = + in_bytes(JavaThread::satb_mark_queue_offset() + + PtrQueue::byte_offset_of_index()); + int satb_q_buf_byte_offset = + in_bytes(JavaThread::satb_mark_queue_offset() + + PtrQueue::byte_offset_of_buf()); + assert(in_bytes(PtrQueue::byte_width_of_index()) == sizeof(intptr_t) && + in_bytes(PtrQueue::byte_width_of_buf()) == sizeof(intptr_t), + "check sizes in assembly below"); + + masm.bind(restart); + masm.ld_ptr(G2_thread, satb_q_index_byte_offset, L0); + + masm.br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pn, L0, refill); + // If the branch is taken, no harm in executing this in the delay slot. + masm.delayed()->ld_ptr(G2_thread, satb_q_buf_byte_offset, L1); + masm.sub(L0, oopSize, L0); + + masm.st_ptr(pre_val, L1, L0); // [_buf + index] := I0 + if (!with_frame) { + // Use return-from-leaf + masm.retl(); + masm.delayed()->st_ptr(L0, G2_thread, satb_q_index_byte_offset); + } else { + // Not delayed. + masm.st_ptr(L0, G2_thread, satb_q_index_byte_offset); + } + if (with_frame) { + masm.ret(); + masm.delayed()->restore(); + } + masm.bind(refill); + + address handle_zero = + CAST_FROM_FN_PTR(address, + &SATBMarkQueueSet::handle_zero_index_for_thread); + // This should be rare enough that we can afford to save all the + // scratch registers that the calling context might be using. + masm.mov(G1_scratch, L0); + masm.mov(G3_scratch, L1); + masm.mov(G4, L2); + // We need the value of O0 above (for the write into the buffer), so we + // save and restore it. + masm.mov(O0, L3); + // Since the call will overwrite O7, we save and restore that, as well. + masm.mov(O7, L4); + masm.call_VM_leaf(L5, handle_zero, G2_thread); + masm.mov(L0, G1_scratch); + masm.mov(L1, G3_scratch); + masm.mov(L2, G4); + masm.mov(L3, O0); + masm.br(Assembler::always, /*annul*/false, Assembler::pt, restart); + masm.delayed()->mov(L4, O7); + + if (with_frame) { + satb_log_enqueue_with_frame = start; + satb_log_enqueue_with_frame_end = masm.pc(); + } else { + satb_log_enqueue_frameless = start; + satb_log_enqueue_frameless_end = masm.pc(); + } +} + +static inline void generate_satb_log_enqueue_if_necessary(bool with_frame) { + if (with_frame) { + if (satb_log_enqueue_with_frame == 0) { + generate_satb_log_enqueue(with_frame); + assert(satb_log_enqueue_with_frame != 0, "postcondition."); + if (G1SATBPrintStubs) { + tty->print_cr("Generated with-frame satb enqueue:"); + Disassembler::decode((u_char*)satb_log_enqueue_with_frame, + satb_log_enqueue_with_frame_end, + tty); + } + } + } else { + if (satb_log_enqueue_frameless == 0) { + generate_satb_log_enqueue(with_frame); + assert(satb_log_enqueue_frameless != 0, "postcondition."); + if (G1SATBPrintStubs) { + tty->print_cr("Generated frameless satb enqueue:"); + Disassembler::decode((u_char*)satb_log_enqueue_frameless, + satb_log_enqueue_frameless_end, + tty); + } + } + } +} + +void MacroAssembler::g1_write_barrier_pre(Register obj, Register index, int offset, Register tmp, bool preserve_o_regs) { + assert(offset == 0 || index == noreg, "choose one"); + + if (G1DisablePreBarrier) return; + // satb_log_barrier(tmp, obj, offset, preserve_o_regs); + Label filtered; + // satb_log_barrier_work0(tmp, filtered); + if (in_bytes(PtrQueue::byte_width_of_active()) == 4) { + ld(G2, + in_bytes(JavaThread::satb_mark_queue_offset() + + PtrQueue::byte_offset_of_active()), + tmp); + } else { + guarantee(in_bytes(PtrQueue::byte_width_of_active()) == 1, + "Assumption"); + ldsb(G2, + in_bytes(JavaThread::satb_mark_queue_offset() + + PtrQueue::byte_offset_of_active()), + tmp); + } + // Check on whether to annul. + br_on_reg_cond(rc_z, /*annul*/false, Assembler::pt, tmp, filtered); + delayed() -> nop(); + + // satb_log_barrier_work1(tmp, offset); + if (index == noreg) { + if (Assembler::is_simm13(offset)) { + ld_ptr(obj, offset, tmp); + } else { + set(offset, tmp); + ld_ptr(obj, tmp, tmp); + } + } else { + ld_ptr(obj, index, tmp); + } + + // satb_log_barrier_work2(obj, tmp, offset); + + // satb_log_barrier_work3(tmp, filtered, preserve_o_regs); + + const Register pre_val = tmp; + + if (G1SATBBarrierPrintNullPreVals) { + save_frame(0); + mov(pre_val, O0); + // Save G-regs that target may use. + mov(G1, L1); + mov(G2, L2); + mov(G3, L3); + mov(G4, L4); + mov(G5, L5); + call(CAST_FROM_FN_PTR(address, &count_null_pre_vals)); + delayed()->nop(); + // Restore G-regs that target may have used. + mov(L1, G1); + mov(L2, G2); + mov(L3, G3); + mov(L4, G4); + mov(L5, G5); + restore(G0, G0, G0); + } + + // Check on whether to annul. + br_on_reg_cond(rc_z, /*annul*/false, Assembler::pt, pre_val, filtered); + delayed() -> nop(); + + // OK, it's not filtered, so we'll need to call enqueue. In the normal + // case, pre_val will be a scratch G-reg, but there's some cases in which + // it's an O-reg. In the first case, do a normal call. In the latter, + // do a save here and call the frameless version. + + guarantee(pre_val->is_global() || pre_val->is_out(), + "Or we need to think harder."); + if (pre_val->is_global() && !preserve_o_regs) { + generate_satb_log_enqueue_if_necessary(true); // with frame. + call(satb_log_enqueue_with_frame); + delayed()->mov(pre_val, O0); + } else { + generate_satb_log_enqueue_if_necessary(false); // with frameless. + save_frame(0); + call(satb_log_enqueue_frameless); + delayed()->mov(pre_val->after_save(), O0); + restore(); + } + + bind(filtered); +} + +static jint num_ct_writes = 0; +static jint num_ct_writes_filtered_in_hr = 0; +static jint num_ct_writes_filtered_null = 0; +static jint num_ct_writes_filtered_pop = 0; +static G1CollectedHeap* g1 = NULL; + +static Thread* count_ct_writes(void* filter_val, void* new_val) { + Atomic::inc(&num_ct_writes); + if (filter_val == NULL) { + Atomic::inc(&num_ct_writes_filtered_in_hr); + } else if (new_val == NULL) { + Atomic::inc(&num_ct_writes_filtered_null); + } else { + if (g1 == NULL) { + g1 = G1CollectedHeap::heap(); + } + if ((HeapWord*)new_val < g1->popular_object_boundary()) { + Atomic::inc(&num_ct_writes_filtered_pop); + } + } + if ((num_ct_writes % 1000000) == 0) { + jint num_ct_writes_filtered = + num_ct_writes_filtered_in_hr + + num_ct_writes_filtered_null + + num_ct_writes_filtered_pop; + + tty->print_cr("%d potential CT writes: %5.2f%% filtered\n" + " (%5.2f%% intra-HR, %5.2f%% null, %5.2f%% popular).", + num_ct_writes, + 100.0*(float)num_ct_writes_filtered/(float)num_ct_writes, + 100.0*(float)num_ct_writes_filtered_in_hr/ + (float)num_ct_writes, + 100.0*(float)num_ct_writes_filtered_null/ + (float)num_ct_writes, + 100.0*(float)num_ct_writes_filtered_pop/ + (float)num_ct_writes); + } + return Thread::current(); +} + +static address dirty_card_log_enqueue = 0; +static u_char* dirty_card_log_enqueue_end = 0; + +// This gets to assume that o0 contains the object address. +static void generate_dirty_card_log_enqueue(jbyte* byte_map_base) { + BufferBlob* bb = BufferBlob::create("dirty_card_enqueue", EnqueueCodeSize*2); + CodeBuffer buf(bb->instructions_begin(), bb->instructions_size()); + MacroAssembler masm(&buf); + address start = masm.pc(); + + Label not_already_dirty, restart, refill; + +#ifdef _LP64 + masm.srlx(O0, CardTableModRefBS::card_shift, O0); +#else + masm.srl(O0, CardTableModRefBS::card_shift, O0); +#endif + Address rs(O1, (address)byte_map_base); + masm.load_address(rs); // O1 := + masm.ldub(O0, O1, O2); // O2 := [O0 + O1] + + masm.br_on_reg_cond(Assembler::rc_nz, /*annul*/false, Assembler::pt, + O2, not_already_dirty); + // Get O1 + O2 into a reg by itself -- useful in the take-the-branch + // case, harmless if not. + masm.delayed()->add(O0, O1, O3); + + // We didn't take the branch, so we're already dirty: return. + // Use return-from-leaf + masm.retl(); + masm.delayed()->nop(); + + // Not dirty. + masm.bind(not_already_dirty); + // First, dirty it. + masm.stb(G0, O3, G0); // [cardPtr] := 0 (i.e., dirty). + int dirty_card_q_index_byte_offset = + in_bytes(JavaThread::dirty_card_queue_offset() + + PtrQueue::byte_offset_of_index()); + int dirty_card_q_buf_byte_offset = + in_bytes(JavaThread::dirty_card_queue_offset() + + PtrQueue::byte_offset_of_buf()); + masm.bind(restart); + masm.ld_ptr(G2_thread, dirty_card_q_index_byte_offset, L0); + + masm.br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pn, + L0, refill); + // If the branch is taken, no harm in executing this in the delay slot. + masm.delayed()->ld_ptr(G2_thread, dirty_card_q_buf_byte_offset, L1); + masm.sub(L0, oopSize, L0); + + masm.st_ptr(O3, L1, L0); // [_buf + index] := I0 + // Use return-from-leaf + masm.retl(); + masm.delayed()->st_ptr(L0, G2_thread, dirty_card_q_index_byte_offset); + + masm.bind(refill); + address handle_zero = + CAST_FROM_FN_PTR(address, + &DirtyCardQueueSet::handle_zero_index_for_thread); + // This should be rare enough that we can afford to save all the + // scratch registers that the calling context might be using. + masm.mov(G1_scratch, L3); + masm.mov(G3_scratch, L5); + // We need the value of O3 above (for the write into the buffer), so we + // save and restore it. + masm.mov(O3, L6); + // Since the call will overwrite O7, we save and restore that, as well. + masm.mov(O7, L4); + + masm.call_VM_leaf(L7_thread_cache, handle_zero, G2_thread); + masm.mov(L3, G1_scratch); + masm.mov(L5, G3_scratch); + masm.mov(L6, O3); + masm.br(Assembler::always, /*annul*/false, Assembler::pt, restart); + masm.delayed()->mov(L4, O7); + + dirty_card_log_enqueue = start; + dirty_card_log_enqueue_end = masm.pc(); + // XXX Should have a guarantee here about not going off the end! + // Does it already do so? Do an experiment... +} + +static inline void +generate_dirty_card_log_enqueue_if_necessary(jbyte* byte_map_base) { + if (dirty_card_log_enqueue == 0) { + generate_dirty_card_log_enqueue(byte_map_base); + assert(dirty_card_log_enqueue != 0, "postcondition."); + if (G1SATBPrintStubs) { + tty->print_cr("Generated dirty_card enqueue:"); + Disassembler::decode((u_char*)dirty_card_log_enqueue, + dirty_card_log_enqueue_end, + tty); + } + } +} + + +void MacroAssembler::g1_write_barrier_post(Register store_addr, Register new_val, Register tmp) { + + Label filtered; + MacroAssembler* post_filter_masm = this; + + if (new_val == G0) return; + if (G1DisablePostBarrier) return; + + G1SATBCardTableModRefBS* bs = (G1SATBCardTableModRefBS*) Universe::heap()->barrier_set(); + assert(bs->kind() == BarrierSet::G1SATBCT || + bs->kind() == BarrierSet::G1SATBCTLogging, "wrong barrier"); + if (G1RSBarrierRegionFilter) { + xor3(store_addr, new_val, tmp); +#ifdef _LP64 + srlx(tmp, HeapRegion::LogOfHRGrainBytes, tmp); +#else + srl(tmp, HeapRegion::LogOfHRGrainBytes, tmp); +#endif + if (G1PrintCTFilterStats) { + guarantee(tmp->is_global(), "Or stats won't work..."); + // This is a sleazy hack: I'm temporarily hijacking G2, which I + // promise to restore. + mov(new_val, G2); + save_frame(0); + mov(tmp, O0); + mov(G2, O1); + // Save G-regs that target may use. + mov(G1, L1); + mov(G2, L2); + mov(G3, L3); + mov(G4, L4); + mov(G5, L5); + call(CAST_FROM_FN_PTR(address, &count_ct_writes)); + delayed()->nop(); + mov(O0, G2); + // Restore G-regs that target may have used. + mov(L1, G1); + mov(L3, G3); + mov(L4, G4); + mov(L5, G5); + restore(G0, G0, G0); + } + // XXX Should I predict this taken or not? Does it mattern? + br_on_reg_cond(rc_z, /*annul*/false, Assembler::pt, tmp, filtered); + delayed()->nop(); + } + + // Now we decide how to generate the card table write. If we're + // enqueueing, we call out to a generated function. Otherwise, we do it + // inline here. + + if (G1RSBarrierUseQueue) { + // If the "store_addr" register is an "in" or "local" register, move it to + // a scratch reg so we can pass it as an argument. + bool use_scr = !(store_addr->is_global() || store_addr->is_out()); + // Pick a scratch register different from "tmp". + Register scr = (tmp == G1_scratch ? G3_scratch : G1_scratch); + // Make sure we use up the delay slot! + if (use_scr) { + post_filter_masm->mov(store_addr, scr); + } else { + post_filter_masm->nop(); + } + generate_dirty_card_log_enqueue_if_necessary(bs->byte_map_base); + save_frame(0); + call(dirty_card_log_enqueue); + if (use_scr) { + delayed()->mov(scr, O0); + } else { + delayed()->mov(store_addr->after_save(), O0); + } + restore(); + + } else { + +#ifdef _LP64 + post_filter_masm->srlx(store_addr, CardTableModRefBS::card_shift, store_addr); +#else + post_filter_masm->srl(store_addr, CardTableModRefBS::card_shift, store_addr); +#endif + assert( tmp != store_addr, "need separate temp reg"); + Address rs(tmp, (address)bs->byte_map_base); + load_address(rs); + stb(G0, rs.base(), store_addr); + } + + bind(filtered); + +} + +#endif // SERIALGC +/////////////////////////////////////////////////////////////////////////////////// + +void MacroAssembler::card_write_barrier_post(Register store_addr, Register new_val, Register tmp) { + // If we're writing constant NULL, we can skip the write barrier. + if (new_val == G0) return; + CardTableModRefBS* bs = (CardTableModRefBS*) Universe::heap()->barrier_set(); + assert(bs->kind() == BarrierSet::CardTableModRef || + bs->kind() == BarrierSet::CardTableExtension, "wrong barrier"); + card_table_write(bs->byte_map_base, tmp, store_addr); +} + void MacroAssembler::load_klass(Register s, Register d) { // The number of bytes in this code is used by // MachCallDynamicJavaNode::ret_addr_offset() diff --git a/hotspot/src/cpu/sparc/vm/assembler_sparc.hpp b/hotspot/src/cpu/sparc/vm/assembler_sparc.hpp index c1aae2e6620..a31619c7214 100644 --- a/hotspot/src/cpu/sparc/vm/assembler_sparc.hpp +++ b/hotspot/src/cpu/sparc/vm/assembler_sparc.hpp @@ -1439,7 +1439,11 @@ public: // pp 214 void save( Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(save_op3) | rs1(s1) | rs2(s2) ); } - void save( Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(save_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); } + void save( Register s1, int simm13a, Register d ) { + // make sure frame is at least large enough for the register save area + assert(-simm13a >= 16 * wordSize, "frame too small"); + emit_long( op(arith_op) | rd(d) | op3(save_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); + } void restore( Register s1 = G0, Register s2 = G0, Register d = G0 ) { emit_long( op(arith_op) | rd(d) | op3(restore_op3) | rs1(s1) | rs2(s2) ); } void restore( Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(restore_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); } @@ -1594,6 +1598,11 @@ public: inline void wrasi( Register d) { v9_only(); emit_long( op(arith_op) | rs1(d) | op3(wrreg_op3) | u_field(3, 29, 25)); } inline void wrfprs( Register d) { v9_only(); emit_long( op(arith_op) | rs1(d) | op3(wrreg_op3) | u_field(6, 29, 25)); } + // For a given register condition, return the appropriate condition code + // Condition (the one you would use to get the same effect after "tst" on + // the target register.) + Assembler::Condition reg_cond_to_cc_cond(RCondition in); + // Creation Assembler(CodeBuffer* code) : AbstractAssembler(code) { @@ -1630,6 +1639,8 @@ class RegistersForDebugging : public StackObj { // restore global registers in case C code disturbed them static void restore_registers(MacroAssembler* a, Register r); + + }; @@ -1722,6 +1733,12 @@ class MacroAssembler: public Assembler { void br_null ( Register s1, bool a, Predict p, Label& L ); void br_notnull( Register s1, bool a, Predict p, Label& L ); + // These versions will do the most efficient thing on v8 and v9. Perhaps + // this is what the routine above was meant to do, but it didn't (and + // didn't cover both target address kinds.) + void br_on_reg_cond( RCondition c, bool a, Predict p, Register s1, address d, relocInfo::relocType rt = relocInfo::none ); + void br_on_reg_cond( RCondition c, bool a, Predict p, Register s1, Label& L); + inline void bp( Condition c, bool a, CC cc, Predict p, address d, relocInfo::relocType rt = relocInfo::none ); inline void bp( Condition c, bool a, CC cc, Predict p, Label& L ); @@ -2055,9 +2072,23 @@ class MacroAssembler: public Assembler { #endif // ASSERT public: - // Stores - void store_check(Register tmp, Register obj); // store check for obj - register is destroyed afterwards - void store_check(Register tmp, Register obj, Register offset); // store check for obj - register is destroyed afterwards + + // Write to card table for - register is destroyed afterwards. + void card_table_write(jbyte* byte_map_base, Register tmp, Register obj); + + void card_write_barrier_post(Register store_addr, Register new_val, Register tmp); + +#ifndef SERIALGC + // Array store and offset + void g1_write_barrier_pre(Register obj, Register index, int offset, Register tmp, bool preserve_o_regs); + + void g1_write_barrier_post(Register store_addr, Register new_val, Register tmp); + + // May do filtering, depending on the boolean arguments. + void g1_card_table_write(jbyte* byte_map_base, + Register tmp, Register obj, Register new_val, + bool region_filter, bool null_filter); +#endif // SERIALGC // pushes double TOS element of FPU stack on CPU stack; pops from FPU stack void push_fTOS(); diff --git a/hotspot/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp b/hotspot/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp index b0caddae967..87a411da1d1 100644 --- a/hotspot/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp @@ -404,4 +404,55 @@ void ArrayCopyStub::emit_code(LIR_Assembler* ce) { } +/////////////////////////////////////////////////////////////////////////////////// +#ifndef SERIALGC + +void G1PreBarrierStub::emit_code(LIR_Assembler* ce) { + __ bind(_entry); + + assert(pre_val()->is_register(), "Precondition."); + + Register pre_val_reg = pre_val()->as_register(); + + ce->mem2reg(addr(), pre_val(), T_OBJECT, patch_code(), info(), false); + __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt, + pre_val_reg, _continuation); + __ delayed()->nop(); + + __ call(Runtime1::entry_for(Runtime1::Runtime1::g1_pre_barrier_slow_id)); + __ delayed()->mov(pre_val_reg, G4); + __ br(Assembler::always, false, Assembler::pt, _continuation); + __ delayed()->nop(); + +} + +jbyte* G1PostBarrierStub::_byte_map_base = NULL; + +jbyte* G1PostBarrierStub::byte_map_base_slow() { + BarrierSet* bs = Universe::heap()->barrier_set(); + assert(bs->is_a(BarrierSet::G1SATBCTLogging), + "Must be if we're using this."); + return ((G1SATBCardTableModRefBS*)bs)->byte_map_base; +} + +void G1PostBarrierStub::emit_code(LIR_Assembler* ce) { + __ bind(_entry); + + assert(addr()->is_register(), "Precondition."); + assert(new_val()->is_register(), "Precondition."); + Register addr_reg = addr()->as_pointer_register(); + Register new_val_reg = new_val()->as_register(); + __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pt, + new_val_reg, _continuation); + __ delayed()->nop(); + + __ call(Runtime1::entry_for(Runtime1::Runtime1::g1_post_barrier_slow_id)); + __ delayed()->mov(addr_reg, G4); + __ br(Assembler::always, false, Assembler::pt, _continuation); + __ delayed()->nop(); +} + +#endif // SERIALGC +/////////////////////////////////////////////////////////////////////////////////// + #undef __ diff --git a/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp b/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp index 8436fb8561b..49baaf67e65 100644 --- a/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp @@ -2093,7 +2093,11 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) { // the known type isn't loaded since the code sanity checks // in debug mode and the type isn't required when we know the exact type // also check that the type is an array type. - if (op->expected_type() == NULL) { + // We also, for now, always call the stub if the barrier set requires a + // write_ref_pre barrier (which the stub does, but none of the optimized + // cases currently does). + if (op->expected_type() == NULL || + Universe::heap()->barrier_set()->has_write_ref_pre_barrier()) { __ mov(src, O0); __ mov(src_pos, O1); __ mov(dst, O2); diff --git a/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp b/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp index 74bc5ecf3b4..d4b2d9574ed 100644 --- a/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp @@ -365,6 +365,10 @@ void LIRGenerator::do_StoreIndexed(StoreIndexed* x) { __ store_check(value.result(), array.result(), tmp1, tmp2, tmp3, store_check_info); } + if (obj_store) { + // Needs GC write barriers. + pre_barrier(LIR_OprFact::address(array_addr), false, NULL); + } __ move(value.result(), array_addr, null_check_info); if (obj_store) { // Is this precise? @@ -663,6 +667,10 @@ void LIRGenerator::do_CompareAndSwap(Intrinsic* x, ValueType* type) { __ add(obj.result(), offset.result(), addr); + if (type == objectType) { // Write-barrier needed for Object fields. + pre_barrier(obj.result(), false, NULL); + } + if (type == objectType) __ cas_obj(addr, cmp.result(), val.result(), t1, t2); else if (type == intType) @@ -677,7 +685,11 @@ void LIRGenerator::do_CompareAndSwap(Intrinsic* x, ValueType* type) { LIR_Opr result = rlock_result(x); __ cmove(lir_cond_equal, LIR_OprFact::intConst(1), LIR_OprFact::intConst(0), result); if (type == objectType) { // Write-barrier needed for Object fields. +#ifdef PRECISE_CARDMARK + post_barrier(addr, val.result()); +#else post_barrier(obj.result(), val.result()); +#endif // PRECISE_CARDMARK } } @@ -1153,6 +1165,10 @@ void LIRGenerator::put_Object_unsafe(LIR_Opr src, LIR_Opr offset, LIR_Opr data, addr = new LIR_Address(base_op, index_op, type); } + if (is_obj) { + pre_barrier(LIR_OprFact::address(addr), false, NULL); + // _bs->c1_write_barrier_pre(this, LIR_OprFact::address(addr)); + } __ move(data, addr); if (is_obj) { // This address is precise diff --git a/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp b/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp index 45c63228c64..489e84dd58c 100644 --- a/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp @@ -832,6 +832,163 @@ OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) { } break; +#ifndef SERIALGC + case g1_pre_barrier_slow_id: + { // G4: previous value of memory + BarrierSet* bs = Universe::heap()->barrier_set(); + if (bs->kind() != BarrierSet::G1SATBCTLogging) { + __ save_frame(0); + __ set((int)id, O1); + __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, unimplemented_entry), I0); + __ should_not_reach_here(); + break; + } + + __ set_info("g1_pre_barrier_slow_id", dont_gc_arguments); + + Register pre_val = G4; + Register tmp = G1_scratch; + Register tmp2 = G3_scratch; + + Label refill, restart; + bool with_frame = false; // I don't know if we can do with-frame. + int satb_q_index_byte_offset = + in_bytes(JavaThread::satb_mark_queue_offset() + + PtrQueue::byte_offset_of_index()); + int satb_q_buf_byte_offset = + in_bytes(JavaThread::satb_mark_queue_offset() + + PtrQueue::byte_offset_of_buf()); + __ bind(restart); + __ ld_ptr(G2_thread, satb_q_index_byte_offset, tmp); + + __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, + Assembler::pn, tmp, refill); + + // If the branch is taken, no harm in executing this in the delay slot. + __ delayed()->ld_ptr(G2_thread, satb_q_buf_byte_offset, tmp2); + __ sub(tmp, oopSize, tmp); + + __ st_ptr(pre_val, tmp2, tmp); // [_buf + index] := + // Use return-from-leaf + __ retl(); + __ delayed()->st_ptr(tmp, G2_thread, satb_q_index_byte_offset); + + __ bind(refill); + __ save_frame(0); + + __ mov(pre_val, L0); + __ mov(tmp, L1); + __ mov(tmp2, L2); + + __ call_VM_leaf(L7_thread_cache, + CAST_FROM_FN_PTR(address, + SATBMarkQueueSet::handle_zero_index_for_thread), + G2_thread); + + __ mov(L0, pre_val); + __ mov(L1, tmp); + __ mov(L2, tmp2); + + __ br(Assembler::always, /*annul*/false, Assembler::pt, restart); + __ delayed()->restore(); + } + break; + + case g1_post_barrier_slow_id: + { + BarrierSet* bs = Universe::heap()->barrier_set(); + if (bs->kind() != BarrierSet::G1SATBCTLogging) { + __ save_frame(0); + __ set((int)id, O1); + __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, unimplemented_entry), I0); + __ should_not_reach_here(); + break; + } + + __ set_info("g1_post_barrier_slow_id", dont_gc_arguments); + + Register addr = G4; + Register cardtable = G5; + Register tmp = G1_scratch; + Register tmp2 = G3_scratch; + jbyte* byte_map_base = ((CardTableModRefBS*)bs)->byte_map_base; + + Label not_already_dirty, restart, refill; + +#ifdef _LP64 + __ srlx(addr, CardTableModRefBS::card_shift, addr); +#else + __ srl(addr, CardTableModRefBS::card_shift, addr); +#endif + + Address rs(cardtable, (address)byte_map_base); + __ load_address(rs); // cardtable := + __ ldub(addr, cardtable, tmp); // tmp := [addr + cardtable] + + __ br_on_reg_cond(Assembler::rc_nz, /*annul*/false, Assembler::pt, + tmp, not_already_dirty); + // Get cardtable + tmp into a reg by itself -- useful in the take-the-branch + // case, harmless if not. + __ delayed()->add(addr, cardtable, tmp2); + + // We didn't take the branch, so we're already dirty: return. + // Use return-from-leaf + __ retl(); + __ delayed()->nop(); + + // Not dirty. + __ bind(not_already_dirty); + // First, dirty it. + __ stb(G0, tmp2, 0); // [cardPtr] := 0 (i.e., dirty). + + Register tmp3 = cardtable; + Register tmp4 = tmp; + + // these registers are now dead + addr = cardtable = tmp = noreg; + + int dirty_card_q_index_byte_offset = + in_bytes(JavaThread::dirty_card_queue_offset() + + PtrQueue::byte_offset_of_index()); + int dirty_card_q_buf_byte_offset = + in_bytes(JavaThread::dirty_card_queue_offset() + + PtrQueue::byte_offset_of_buf()); + __ bind(restart); + __ ld_ptr(G2_thread, dirty_card_q_index_byte_offset, tmp3); + + __ br_on_reg_cond(Assembler::rc_z, /*annul*/false, Assembler::pn, + tmp3, refill); + // If the branch is taken, no harm in executing this in the delay slot. + __ delayed()->ld_ptr(G2_thread, dirty_card_q_buf_byte_offset, tmp4); + __ sub(tmp3, oopSize, tmp3); + + __ st_ptr(tmp2, tmp4, tmp3); // [_buf + index] := + // Use return-from-leaf + __ retl(); + __ delayed()->st_ptr(tmp3, G2_thread, dirty_card_q_index_byte_offset); + + __ bind(refill); + __ save_frame(0); + + __ mov(tmp2, L0); + __ mov(tmp3, L1); + __ mov(tmp4, L2); + + __ call_VM_leaf(L7_thread_cache, + CAST_FROM_FN_PTR(address, + DirtyCardQueueSet::handle_zero_index_for_thread), + G2_thread); + + __ mov(L0, tmp2); + __ mov(L1, tmp3); + __ mov(L2, tmp4); + + __ br(Assembler::always, /*annul*/false, Assembler::pt, restart); + __ delayed()->restore(); + } + break; +#endif // !SERIALGC + default: { __ set_info("unimplemented entry", dont_gc_arguments); __ save_frame(0); diff --git a/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp b/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp index 7f5c4f81407..498be62ffe7 100644 --- a/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp @@ -699,17 +699,16 @@ Register AdapterGenerator::next_arg_slot(const int st_off){ // Stores long into offset pointed to by base void AdapterGenerator::store_c2i_long(Register r, Register base, const int st_off, bool is_stack) { -#ifdef COMPILER2 #ifdef _LP64 // In V9, longs are given 2 64-bit slots in the interpreter, but the // data is passed in only 1 slot. __ stx(r, base, next_arg_slot(st_off)); #else +#ifdef COMPILER2 // Misaligned store of 64-bit data __ stw(r, base, arg_slot(st_off)); // lo bits __ srlx(r, 32, r); __ stw(r, base, next_arg_slot(st_off)); // hi bits -#endif // _LP64 #else if (is_stack) { // Misaligned store of 64-bit data @@ -721,6 +720,7 @@ void AdapterGenerator::store_c2i_long(Register r, Register base, __ stw(r , base, next_arg_slot(st_off)); // hi bits } #endif // COMPILER2 +#endif // _LP64 tag_c2i_arg(frame::TagCategory2, base, st_off, r); } diff --git a/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp b/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp index 73e092d620c..9301d7cd89c 100644 --- a/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp @@ -1110,30 +1110,31 @@ class StubGenerator: public StubCodeGenerator { // The input registers are overwritten. // void gen_write_ref_array_pre_barrier(Register addr, Register count) { -#if 0 // G1 only BarrierSet* bs = Universe::heap()->barrier_set(); if (bs->has_write_ref_pre_barrier()) { assert(bs->has_write_ref_array_pre_opt(), "Else unsupported barrier set."); - assert(addr->is_global() && count->is_global(), - "If not, then we have to fix this code to handle more " - "general cases."); - // Get some new fresh output registers. __ save_frame(0); // Save the necessary global regs... will be used after. - __ mov(addr, L0); - __ mov(count, L1); - - __ mov(addr, O0); + if (addr->is_global()) { + __ mov(addr, L0); + } + if (count->is_global()) { + __ mov(count, L1); + } + __ mov(addr->after_save(), O0); // Get the count into O1 __ call(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_pre)); - __ delayed()->mov(count, O1); - __ mov(L0, addr); - __ mov(L1, count); + __ delayed()->mov(count->after_save(), O1); + if (addr->is_global()) { + __ mov(L0, addr); + } + if (count->is_global()) { + __ mov(L1, count); + } __ restore(); } -#endif // 0 } // // Generate post-write barrier for array. @@ -1150,22 +1151,17 @@ class StubGenerator: public StubCodeGenerator { BarrierSet* bs = Universe::heap()->barrier_set(); switch (bs->kind()) { -#if 0 // G1 - only case BarrierSet::G1SATBCT: case BarrierSet::G1SATBCTLogging: { - assert(addr->is_global() && count->is_global(), - "If not, then we have to fix this code to handle more " - "general cases."); // Get some new fresh output registers. __ save_frame(0); - __ mov(addr, O0); + __ mov(addr->after_save(), O0); __ call(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_post)); - __ delayed()->mov(count, O1); + __ delayed()->mov(count->after_save(), O1); __ restore(); } break; -#endif // 0 G1 - only case BarrierSet::CardTableModRef: case BarrierSet::CardTableExtension: { @@ -2412,8 +2408,7 @@ class StubGenerator: public StubCodeGenerator { StubCodeMark mark(this, "StubRoutines", name); address start = __ pc(); - gen_write_ref_array_pre_barrier(G1, G5); - + gen_write_ref_array_pre_barrier(O1, O2); #ifdef ASSERT // We sometimes save a frame (see partial_subtype_check below). diff --git a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp index a9bc2b9eff3..c0165c63ca4 100644 --- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp @@ -28,6 +28,79 @@ #ifndef CC_INTERP #define __ _masm-> +// Misc helpers + +// Do an oop store like *(base + index + offset) = val +// index can be noreg, +static void do_oop_store(InterpreterMacroAssembler* _masm, + Register base, + Register index, + int offset, + Register val, + Register tmp, + BarrierSet::Name barrier, + bool precise) { + assert(tmp != val && tmp != base && tmp != index, "register collision"); + assert(index == noreg || offset == 0, "only one offset"); + switch (barrier) { +#ifndef SERIALGC + case BarrierSet::G1SATBCT: + case BarrierSet::G1SATBCTLogging: + { + __ g1_write_barrier_pre( base, index, offset, tmp, /*preserve_o_regs*/true); + if (index == noreg ) { + assert(Assembler::is_simm13(offset), "fix this code"); + __ store_heap_oop(val, base, offset); + } else { + __ store_heap_oop(val, base, index); + } + + // No need for post barrier if storing NULL + if (val != G0) { + if (precise) { + if (index == noreg) { + __ add(base, offset, base); + } else { + __ add(base, index, base); + } + } + __ g1_write_barrier_post(base, val, tmp); + } + } + break; +#endif // SERIALGC + case BarrierSet::CardTableModRef: + case BarrierSet::CardTableExtension: + { + if (index == noreg ) { + assert(Assembler::is_simm13(offset), "fix this code"); + __ store_heap_oop(val, base, offset); + } else { + __ store_heap_oop(val, base, index); + } + // No need for post barrier if storing NULL + if (val != G0) { + if (precise) { + if (index == noreg) { + __ add(base, offset, base); + } else { + __ add(base, index, base); + } + } + __ card_write_barrier_post(base, val, tmp); + } + } + break; + case BarrierSet::ModRef: + case BarrierSet::Other: + ShouldNotReachHere(); + break; + default : + ShouldNotReachHere(); + + } +} + //---------------------------------------------------------------------------------------------------- // Platform-dependent initialization @@ -758,6 +831,8 @@ void TemplateTable::aastore() { // O4: array element klass // O5: value klass + // Address element(O1, 0, arrayOopDesc::base_offset_in_bytes(T_OBJECT)); + // Generate a fast subtype check. Branch to store_ok if no // failure. Throw if failure. __ gen_subtype_check( O5, O4, G3_scratch, G4_scratch, G1_scratch, store_ok ); @@ -767,18 +842,14 @@ void TemplateTable::aastore() { // Store is OK. __ bind(store_ok); - __ store_heap_oop(Otos_i, O1, arrayOopDesc::base_offset_in_bytes(T_OBJECT)); - // Quote from rememberedSet.hpp: For objArrays, the precise card - // corresponding to the pointer store is dirtied so we don't need to - // scavenge the entire array. - Address element(O1, 0, arrayOopDesc::base_offset_in_bytes(T_OBJECT)); - __ add(element, O1); // address the element precisely - __ store_check(G3_scratch, O1); + do_oop_store(_masm, O1, noreg, arrayOopDesc::base_offset_in_bytes(T_OBJECT), Otos_i, G3_scratch, _bs->kind(), true); + __ ba(false,done); __ delayed()->inc(Lesp, 3* Interpreter::stackElementSize()); // adj sp (pops array, index and value) __ bind(is_null); - __ store_heap_oop(Otos_i, element); + do_oop_store(_masm, O1, noreg, arrayOopDesc::base_offset_in_bytes(T_OBJECT), G0, G4_scratch, _bs->kind(), true); + __ profile_null_seen(G3_scratch); __ inc(Lesp, 3* Interpreter::stackElementSize()); // adj sp (pops array, index and value) __ bind(done); @@ -2449,8 +2520,9 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static) { // atos __ pop_ptr(); __ verify_oop(Otos_i); - __ store_heap_oop(Otos_i, Rclass, Roffset); - __ store_check(G1_scratch, Rclass, Roffset); + + do_oop_store(_masm, Rclass, Roffset, 0, Otos_i, G1_scratch, _bs->kind(), false); + __ ba(false, checkVolatile); __ delayed()->tst(Lscratch); @@ -2491,8 +2563,9 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static) { __ pop_ptr(); pop_and_check_object(Rclass); __ verify_oop(Otos_i); - __ store_heap_oop(Otos_i, Rclass, Roffset); - __ store_check(G1_scratch, Rclass, Roffset); + + do_oop_store(_masm, Rclass, Roffset, 0, Otos_i, G1_scratch, _bs->kind(), false); + patch_bytecode(Bytecodes::_fast_aputfield, G3_scratch, G4_scratch); __ ba(false, checkVolatile); __ delayed()->tst(Lscratch); @@ -2646,8 +2719,7 @@ void TemplateTable::fast_storefield(TosState state) { __ stf(FloatRegisterImpl::D, Ftos_d, Rclass, Roffset); break; case Bytecodes::_fast_aputfield: - __ store_heap_oop(Otos_i, Rclass, Roffset); - __ store_check(G1_scratch, Rclass, Roffset); + do_oop_store(_masm, Rclass, Roffset, 0, Otos_i, G1_scratch, _bs->kind(), false); break; default: ShouldNotReachHere(); diff --git a/hotspot/src/cpu/x86/vm/assembler_x86_32.cpp b/hotspot/src/cpu/x86/vm/assembler_x86_32.cpp index e68bf489309..3c8b89dc1b0 100644 --- a/hotspot/src/cpu/x86/vm/assembler_x86_32.cpp +++ b/hotspot/src/cpu/x86/vm/assembler_x86_32.cpp @@ -3372,13 +3372,142 @@ void MacroAssembler::call_VM_leaf(address entry_point, Register arg_1, Register call_VM_leaf(entry_point, 3); } - // Calls to C land // // When entering C land, the rbp, & rsp of the last Java frame have to be recorded // in the (thread-local) JavaThread object. When leaving C land, the last Java fp // has to be reset to 0. This is required to allow proper stack traversal. +////////////////////////////////////////////////////////////////////////////////// +#ifndef SERIALGC + +void MacroAssembler::g1_write_barrier_pre(Register obj, + Register thread, + Register tmp, + Register tmp2, + bool tosca_live) { + Address in_progress(thread, in_bytes(JavaThread::satb_mark_queue_offset() + + PtrQueue::byte_offset_of_active())); + + Address index(thread, in_bytes(JavaThread::satb_mark_queue_offset() + + PtrQueue::byte_offset_of_index())); + Address buffer(thread, in_bytes(JavaThread::satb_mark_queue_offset() + + PtrQueue::byte_offset_of_buf())); + + + Label done; + Label runtime; + + // if (!marking_in_progress) goto done; + if (in_bytes(PtrQueue::byte_width_of_active()) == 4) { + cmpl(in_progress, 0); + } else { + assert(in_bytes(PtrQueue::byte_width_of_active()) == 1, "Assumption"); + cmpb(in_progress, 0); + } + jcc(Assembler::equal, done); + + // if (x.f == NULL) goto done; + cmpl(Address(obj, 0), NULL_WORD); + jcc(Assembler::equal, done); + + // Can we store original value in the thread's buffer? + + movl(tmp2, Address(obj, 0)); + cmpl(index, 0); + jcc(Assembler::equal, runtime); + subl(index, wordSize); + movl(tmp, buffer); + addl(tmp, index); + movl(Address(tmp, 0), tmp2); + jmp(done); + bind(runtime); + // save the live input values + if(tosca_live) pushl(rax); + pushl(obj); + pushl(thread); + call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), tmp2, thread); + popl(thread); + popl(obj); + if(tosca_live) popl(rax); + bind(done); + +} + +void MacroAssembler::g1_write_barrier_post(Register store_addr, + Register new_val, + Register thread, + Register tmp, + Register tmp2) { + + Address queue_index(thread, in_bytes(JavaThread::dirty_card_queue_offset() + + PtrQueue::byte_offset_of_index())); + Address buffer(thread, in_bytes(JavaThread::dirty_card_queue_offset() + + PtrQueue::byte_offset_of_buf())); + BarrierSet* bs = Universe::heap()->barrier_set(); + CardTableModRefBS* ct = (CardTableModRefBS*)bs; + Label done; + Label runtime; + + // Does store cross heap regions? + + movl(tmp, store_addr); // ebx = edx + xorl(tmp, new_val); // ebx ^= eax + shrl(tmp, HeapRegion::LogOfHRGrainBytes); // ebx <<= 9 + jcc(Assembler::equal, done); + + // crosses regions, storing NULL? + + cmpl(new_val, NULL_WORD); + jcc(Assembler::equal, done); + + // storing region crossing non-NULL, is card already dirty? + + const Register card_index = tmp; + + movl(card_index, store_addr); // ebx = edx + shrl(card_index, CardTableModRefBS::card_shift); // ebx >>= 9 + assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code"); + + ExternalAddress cardtable((address)ct->byte_map_base); + Address index(noreg, card_index, Address::times_1); + const Register card_addr = tmp; + leal(card_addr, as_Address(ArrayAddress(cardtable, index))); + cmpb(Address(card_addr, 0), 0); + jcc(Assembler::equal, done); + + // storing a region crossing, non-NULL oop, card is clean. + // dirty card and log. + + movb(Address(card_addr, 0), 0); + + cmpl(queue_index, 0); + jcc(Assembler::equal, runtime); + subl(queue_index, wordSize); + movl(tmp2, buffer); + addl(tmp2, queue_index); + movl(Address(tmp2, 0), card_index); + jmp(done); + + bind(runtime); + // save the live input values + pushl(store_addr); + pushl(new_val); + pushl(thread); + call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post), card_addr, thread); + popl(thread); + popl(new_val); + popl(store_addr); + + bind(done); + + +} + +#endif // SERIALGC +////////////////////////////////////////////////////////////////////////////////// + + void MacroAssembler::store_check(Register obj) { // Does a store check for the oop in register obj. The content of // register obj is destroyed afterwards. @@ -4548,29 +4677,33 @@ void MacroAssembler::eden_allocate(Register obj, Register var_size_in_bytes, int Register t1, Label& slow_case) { assert(obj == rax, "obj must be in rax, for cmpxchg"); assert_different_registers(obj, var_size_in_bytes, t1); - Register end = t1; - Label retry; - bind(retry); - ExternalAddress heap_top((address) Universe::heap()->top_addr()); - movptr(obj, heap_top); - if (var_size_in_bytes == noreg) { - leal(end, Address(obj, con_size_in_bytes)); + if (CMSIncrementalMode || !Universe::heap()->supports_inline_contig_alloc()) { + jmp(slow_case); } else { - leal(end, Address(obj, var_size_in_bytes, Address::times_1)); + Register end = t1; + Label retry; + bind(retry); + ExternalAddress heap_top((address) Universe::heap()->top_addr()); + movptr(obj, heap_top); + if (var_size_in_bytes == noreg) { + leal(end, Address(obj, con_size_in_bytes)); + } else { + leal(end, Address(obj, var_size_in_bytes, Address::times_1)); + } + // if end < obj then we wrapped around => object too long => slow case + cmpl(end, obj); + jcc(Assembler::below, slow_case); + cmpptr(end, ExternalAddress((address) Universe::heap()->end_addr())); + jcc(Assembler::above, slow_case); + // Compare obj with the top addr, and if still equal, store the new top addr in + // end at the address of the top addr pointer. Sets ZF if was equal, and clears + // it otherwise. Use lock prefix for atomicity on MPs. + if (os::is_MP()) { + lock(); + } + cmpxchgptr(end, heap_top); + jcc(Assembler::notEqual, retry); } - // if end < obj then we wrapped around => object too long => slow case - cmpl(end, obj); - jcc(Assembler::below, slow_case); - cmpptr(end, ExternalAddress((address) Universe::heap()->end_addr())); - jcc(Assembler::above, slow_case); - // Compare obj with the top addr, and if still equal, store the new top addr in - // end at the address of the top addr pointer. Sets ZF if was equal, and clears - // it otherwise. Use lock prefix for atomicity on MPs. - if (os::is_MP()) { - lock(); - } - cmpxchgptr(end, heap_top); - jcc(Assembler::notEqual, retry); } diff --git a/hotspot/src/cpu/x86/vm/assembler_x86_32.hpp b/hotspot/src/cpu/x86/vm/assembler_x86_32.hpp index 02fb38d4056..3f88cef4eae 100644 --- a/hotspot/src/cpu/x86/vm/assembler_x86_32.hpp +++ b/hotspot/src/cpu/x86/vm/assembler_x86_32.hpp @@ -216,9 +216,11 @@ class Address VALUE_OBJ_CLASS_SPEC { #endif // ASSERT // accessors - bool uses(Register reg) const { - return _base == reg || _index == reg; - } + bool uses(Register reg) const { return _base == reg || _index == reg; } + Register base() const { return _base; } + Register index() const { return _index; } + ScaleFactor scale() const { return _scale; } + int disp() const { return _disp; } // Convert the raw encoding form into the form expected by the constructor for // Address. An index of 4 (rsp) corresponds to having no index, so convert @@ -990,7 +992,8 @@ class Assembler : public AbstractAssembler { // on arguments should also go in here. class MacroAssembler: public Assembler { - friend class LIR_Assembler; + friend class LIR_Assembler; + friend class Runtime1; // as_Address() protected: Address as_Address(AddressLiteral adr); @@ -1151,6 +1154,10 @@ class MacroAssembler: public Assembler { void store_check(Register obj); // store check for obj - register is destroyed afterwards void store_check(Register obj, Address dst); // same as above, dst is exact store location (reg. is destroyed) + void g1_write_barrier_pre(Register obj, Register thread, Register tmp, Register tmp2, bool tosca_live ); + void g1_write_barrier_post(Register store_addr, Register new_val, Register thread, Register tmp, Register tmp2); + + // split store_check(Register obj) to enhance instruction interleaving void store_check_part_1(Register obj); void store_check_part_2(Register obj); diff --git a/hotspot/src/cpu/x86/vm/assembler_x86_64.cpp b/hotspot/src/cpu/x86/vm/assembler_x86_64.cpp index f700fd71b5e..11771eb88a2 100644 --- a/hotspot/src/cpu/x86/vm/assembler_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/assembler_x86_64.cpp @@ -4405,6 +4405,129 @@ void MacroAssembler::call_VM_leaf(address entry_point, call_VM_leaf(entry_point, 3); } +///////////////////////////////////////////////////////////////////////////// +#ifndef SERIALGC + +void MacroAssembler::g1_write_barrier_pre(Register obj, Register tmp, Register tmp2, bool tosca_live ) { + Address in_progress(r15_thread, in_bytes(JavaThread::satb_mark_queue_offset() + + PtrQueue::byte_offset_of_active())); + + Address index(r15_thread, in_bytes(JavaThread::satb_mark_queue_offset() + + PtrQueue::byte_offset_of_index())); + Address buffer(r15_thread, in_bytes(JavaThread::satb_mark_queue_offset() + + PtrQueue::byte_offset_of_buf())); + + + Label done; + Label runtime; + + // if (!marking_in_progress) goto done; + if (in_bytes(PtrQueue::byte_width_of_active()) == 4) { + cmpl(in_progress, 0); + } else { + assert(in_bytes(PtrQueue::byte_width_of_active()) == 1, "Assumption"); + cmpb(in_progress, 0); + } + jcc(Assembler::equal, done); + + // if (x.f == NULL) goto done; + cmpq(Address(obj, 0), (int)NULL_WORD); + jcc(Assembler::equal, done); + + // Can we store original value in the thread's buffer? + + movslq(tmp, index); + movq(tmp2, Address(obj, 0)); + cmpq(tmp, 0); + jcc(Assembler::equal, runtime); + subq(tmp, wordSize); + movl(index, tmp); + addq(tmp, buffer); + movq(Address(tmp, 0), tmp2); + jmp(done); + bind(runtime); + // save live inputs + if (tosca_live) pushq(rax); + pushq(obj); + movq(c_rarg0, Address(obj, 0)); + call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), c_rarg0, r15_thread); + popq(obj); + if (tosca_live) popq(rax); + bind(done); +} + +void MacroAssembler::g1_write_barrier_post(Register store_addr, + Register new_val, + Register tmp, + Register tmp2) { + + Address index(r15_thread, in_bytes(JavaThread::dirty_card_queue_offset() + + PtrQueue::byte_offset_of_index())); + Address buffer(r15_thread, in_bytes(JavaThread::dirty_card_queue_offset() + + PtrQueue::byte_offset_of_buf())); + BarrierSet* bs = Universe::heap()->barrier_set(); + CardTableModRefBS* ct = (CardTableModRefBS*)bs; + Label done; + Label runtime; + + // Does store cross heap regions? + + movq(tmp, store_addr); + xorq(tmp, new_val); + shrq(tmp, HeapRegion::LogOfHRGrainBytes); + jcc(Assembler::equal, done); + + // crosses regions, storing NULL? + + cmpq(new_val, (int)NULL_WORD); + jcc(Assembler::equal, done); + + // storing region crossing non-NULL, is card already dirty? + const Register card_addr = tmp; + + movq(card_addr, store_addr); + shrq(card_addr, CardTableModRefBS::card_shift); + + ExternalAddress cardtable((address) ct->byte_map_base); + lea(tmp2, cardtable); + + // get the address of the card + addq(card_addr, tmp2); + + assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code"); + cmpb(Address(card_addr, 0), 0); + jcc(Assembler::equal, done); + + // storing region crossing non-NULL, card is clean. + // dirty card and log. + + movb(Address(card_addr, 0), 0); + + cmpl(index, 0); + jcc(Assembler::equal, runtime); + subl(index, wordSize); + movq(tmp2, buffer); + movslq(rscratch1, index); + addq(tmp2, rscratch1); + // log the card + movq(Address(tmp2, 0), card_addr); + jmp(done); + + bind(runtime); + // save live inputs + pushq(store_addr); + pushq(new_val); + call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post), card_addr, r15_thread); + popq(new_val); + popq(store_addr); + + bind(done); + + +} + +#endif // SERIALGC +///////////////////////////////////////////////////////////////////////////// // Calls to C land // @@ -4802,32 +4925,36 @@ void MacroAssembler::eden_allocate(Register obj, Label& slow_case) { assert(obj == rax, "obj must be in rax for cmpxchg"); assert_different_registers(obj, var_size_in_bytes, t1); - Register end = t1; - Label retry; - bind(retry); - ExternalAddress heap_top((address) Universe::heap()->top_addr()); - movptr(obj, heap_top); - if (var_size_in_bytes == noreg) { - leaq(end, Address(obj, con_size_in_bytes)); + if (CMSIncrementalMode || !Universe::heap()->supports_inline_contig_alloc()) { + jmp(slow_case); } else { - leaq(end, Address(obj, var_size_in_bytes, Address::times_1)); - } - // if end < obj then we wrapped around => object too long => slow case - cmpq(end, obj); - jcc(Assembler::below, slow_case); - cmpptr(end, ExternalAddress((address) Universe::heap()->end_addr())); + Register end = t1; + Label retry; + bind(retry); + ExternalAddress heap_top((address) Universe::heap()->top_addr()); + movptr(obj, heap_top); + if (var_size_in_bytes == noreg) { + leaq(end, Address(obj, con_size_in_bytes)); + } else { + leaq(end, Address(obj, var_size_in_bytes, Address::times_1)); + } + // if end < obj then we wrapped around => object too long => slow case + cmpq(end, obj); + jcc(Assembler::below, slow_case); + cmpptr(end, ExternalAddress((address) Universe::heap()->end_addr())); - jcc(Assembler::above, slow_case); - // Compare obj with the top addr, and if still equal, store the new - // top addr in end at the address of the top addr pointer. Sets ZF - // if was equal, and clears it otherwise. Use lock prefix for - // atomicity on MPs. - if (os::is_MP()) { - lock(); + jcc(Assembler::above, slow_case); + // Compare obj with the top addr, and if still equal, store the new + // top addr in end at the address of the top addr pointer. Sets ZF + // if was equal, and clears it otherwise. Use lock prefix for + // atomicity on MPs. + if (os::is_MP()) { + lock(); + } + cmpxchgptr(end, heap_top); + // if someone beat us on the allocation, try again, otherwise continue + jcc(Assembler::notEqual, retry); } - cmpxchgptr(end, heap_top); - // if someone beat us on the allocation, try again, otherwise continue - jcc(Assembler::notEqual, retry); } // Defines obj, preserves var_size_in_bytes, okay for t2 == var_size_in_bytes. diff --git a/hotspot/src/cpu/x86/vm/assembler_x86_64.hpp b/hotspot/src/cpu/x86/vm/assembler_x86_64.hpp index 9e1ccbfe59d..1065c27168a 100644 --- a/hotspot/src/cpu/x86/vm/assembler_x86_64.hpp +++ b/hotspot/src/cpu/x86/vm/assembler_x86_64.hpp @@ -222,6 +222,18 @@ class Address VALUE_OBJ_CLASS_SPEC { static Address make_raw(int base, int index, int scale, int disp); static Address make_array(ArrayAddress); + Register base() const { + return _base; + } + + Register index() const { + return _index; + } + + int disp() const { + return _disp; + } + private: bool base_needs_rex() const { @@ -1194,6 +1206,9 @@ class MacroAssembler : public Assembler { // location (reg. is // destroyed) + void g1_write_barrier_pre(Register obj, Register tmp, Register tmp2, bool tosca_live ); + void g1_write_barrier_post(Register store_addr, Register new_val, Register tmp, Register tmp2); + // split store_check(Register obj) to enhance instruction interleaving void store_check_part_1(Register obj); void store_check_part_2(Register obj); diff --git a/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp b/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp index 09419c95650..383f22e7fa8 100644 --- a/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp +++ b/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp @@ -455,5 +455,50 @@ void ArrayCopyStub::emit_code(LIR_Assembler* ce) { __ jmp(_continuation); } +///////////////////////////////////////////////////////////////////////////// +#ifndef SERIALGC + +void G1PreBarrierStub::emit_code(LIR_Assembler* ce) { + + // At this point we know that marking is in progress + + __ bind(_entry); + assert(pre_val()->is_register(), "Precondition."); + + Register pre_val_reg = pre_val()->as_register(); + + ce->mem2reg(addr(), pre_val(), T_OBJECT, patch_code(), info(), false); + + __ cmpl(pre_val_reg, NULL_WORD); + __ jcc(Assembler::equal, _continuation); + ce->store_parameter(pre_val()->as_register(), 0); + __ call(RuntimeAddress(Runtime1::entry_for(Runtime1::g1_pre_barrier_slow_id))); + __ jmp(_continuation); + +} + +jbyte* G1PostBarrierStub::_byte_map_base = NULL; + +jbyte* G1PostBarrierStub::byte_map_base_slow() { + BarrierSet* bs = Universe::heap()->barrier_set(); + assert(bs->is_a(BarrierSet::G1SATBCTLogging), + "Must be if we're using this."); + return ((G1SATBCardTableModRefBS*)bs)->byte_map_base; +} + +void G1PostBarrierStub::emit_code(LIR_Assembler* ce) { + __ bind(_entry); + assert(addr()->is_register(), "Precondition."); + assert(new_val()->is_register(), "Precondition."); + Register new_val_reg = new_val()->as_register(); + __ cmpl(new_val_reg, NULL_WORD); + __ jcc(Assembler::equal, _continuation); + ce->store_parameter(addr()->as_register(), 0); + __ call(RuntimeAddress(Runtime1::entry_for(Runtime1::g1_post_barrier_slow_id))); + __ jmp(_continuation); +} + +#endif // SERIALGC +///////////////////////////////////////////////////////////////////////////// #undef __ diff --git a/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp b/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp index 7c4861d614e..e44527f05e0 100644 --- a/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp +++ b/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp @@ -294,6 +294,8 @@ void LIRGenerator::do_StoreIndexed(StoreIndexed* x) { } if (obj_store) { + // Needs GC write barriers. + pre_barrier(LIR_OprFact::address(array_addr), false, NULL); __ move(value.result(), array_addr, null_check_info); // Seems to be a precise post_barrier(LIR_OprFact::address(array_addr), value.result()); @@ -745,7 +747,10 @@ void LIRGenerator::do_CompareAndSwap(Intrinsic* x, ValueType* type) { __ move(obj.result(), addr); __ add(addr, offset.result(), addr); - + if (type == objectType) { // Write-barrier needed for Object fields. + // Do the pre-write barrier, if any. + pre_barrier(addr, false, NULL); + } LIR_Opr ill = LIR_OprFact::illegalOpr; // for convenience if (type == objectType) @@ -1250,6 +1255,8 @@ void LIRGenerator::put_Object_unsafe(LIR_Opr src, LIR_Opr offset, LIR_Opr data, LIR_Address* addr = new LIR_Address(src, offset, type); bool is_obj = (type == T_ARRAY || type == T_OBJECT); if (is_obj) { + // Do the pre-write barrier, if any. + pre_barrier(LIR_OprFact::address(addr), false, NULL); __ move(data, addr); assert(src->is_register(), "must be register"); // Seems to be a precise address diff --git a/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp b/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp index be73c79365b..7865e6b5caf 100644 --- a/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp +++ b/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp @@ -1385,6 +1385,136 @@ OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) { } break; +#ifndef SERIALGC + case g1_pre_barrier_slow_id: + { + StubFrame f(sasm, "g1_pre_barrier", dont_gc_arguments); + // arg0 : previous value of memory + + BarrierSet* bs = Universe::heap()->barrier_set(); + if (bs->kind() != BarrierSet::G1SATBCTLogging) { + __ movl(rax, (int)id); + __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, unimplemented_entry), rax); + __ should_not_reach_here(); + break; + } + + __ pushl(rax); + __ pushl(rdx); + + const Register pre_val = rax; + const Register thread = rax; + const Register tmp = rdx; + + __ get_thread(thread); + + Address in_progress(thread, in_bytes(JavaThread::satb_mark_queue_offset() + + PtrQueue::byte_offset_of_active())); + + Address queue_index(thread, in_bytes(JavaThread::satb_mark_queue_offset() + + PtrQueue::byte_offset_of_index())); + Address buffer(thread, in_bytes(JavaThread::satb_mark_queue_offset() + + PtrQueue::byte_offset_of_buf())); + + + Label done; + Label runtime; + + // Can we store original value in the thread's buffer? + + __ cmpl(queue_index, 0); + __ jcc(Assembler::equal, runtime); + __ subl(queue_index, wordSize); + __ movl(tmp, buffer); + __ addl(tmp, queue_index); + // prev_val (rax) + f.load_argument(0, pre_val); + __ movl(Address(tmp, 0), pre_val); + __ jmp(done); + + __ bind(runtime); + // load the pre-value + __ pushl(rcx); + f.load_argument(0, rcx); + __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), rcx, thread); + __ popl(rcx); + + __ bind(done); + __ popl(rdx); + __ popl(rax); + } + break; + + case g1_post_barrier_slow_id: + { + StubFrame f(sasm, "g1_post_barrier", dont_gc_arguments); + + + // arg0: store_address + Address store_addr(rbp, 2*BytesPerWord); + + BarrierSet* bs = Universe::heap()->barrier_set(); + CardTableModRefBS* ct = (CardTableModRefBS*)bs; + Label done; + Label runtime; + + // At this point we know new_value is non-NULL and the new_value crosses regsion. + // Must check to see if card is already dirty + + const Register card_index = rdx; + + const Register thread = rax; + Address queue_index(thread, in_bytes(JavaThread::dirty_card_queue_offset() + + PtrQueue::byte_offset_of_index())); + Address buffer(thread, in_bytes(JavaThread::dirty_card_queue_offset() + + PtrQueue::byte_offset_of_buf())); + + __ pushl(rax); + __ pushl(rdx); + + __ movl(card_index, store_addr); + __ get_thread(rax); + __ shrl(card_index, CardTableModRefBS::card_shift); + assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code"); + + ExternalAddress cardtable((address)ct->byte_map_base); + Address index(noreg, card_index, Address::times_1); + const Register card_addr = rdx; + __ leal(card_addr, __ as_Address(ArrayAddress(cardtable, index))); + __ cmpb(Address(card_addr, 0), 0); + __ jcc(Assembler::equal, done); + + // storing region crossing non-NULL, card is clean. + // dirty card and log. + + __ movb(Address(card_addr, 0), 0); + + __ cmpl(queue_index, 0); + __ jcc(Assembler::equal, runtime); + __ subl(queue_index, wordSize); + + const Register buffer_addr = rbx; + __ pushl(rbx); + + __ movl(buffer_addr, buffer); + __ addl(buffer_addr, queue_index); + __ movl(Address(buffer_addr, 0), card_addr); + __ popl(rbx); + __ jmp(done); + + __ bind(runtime); + __ pushl(rcx); + __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post), card_addr, thread); + __ popl(rcx); + + __ bind(done); + __ popl(rdx); + __ popl(rax); + + } + break; +#endif // !SERIALGC + default: { StubFrame f(sasm, "unimplemented entry", dont_gc_arguments); __ movl(rax, (int)id); diff --git a/hotspot/src/cpu/x86/vm/interp_masm_x86_64.cpp b/hotspot/src/cpu/x86/vm/interp_masm_x86_64.cpp index 25611881bbc..64d2bce6bc5 100644 --- a/hotspot/src/cpu/x86/vm/interp_masm_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/interp_masm_x86_64.cpp @@ -35,8 +35,13 @@ void InterpreterMacroAssembler::call_VM_leaf_base(address entry_point, // Note: No need to save/restore bcp & locals (r13 & r14) pointer // since these are callee saved registers and no blocking/ // GC can happen in leaf calls. + // Further Note: DO NOT save/restore bcp/locals. If a caller has + // already saved them so that it can use esi/edi as temporaries + // then a save/restore here will DESTROY the copy the caller + // saved! There used to be a save_bcp() that only happened in + // the ASSERT path (no restore_bcp). Which caused bizarre failures + // when jvm built with ASSERTs. #ifdef ASSERT - save_bcp(); { Label L; cmpq(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int)NULL_WORD); @@ -49,24 +54,9 @@ void InterpreterMacroAssembler::call_VM_leaf_base(address entry_point, // super call MacroAssembler::call_VM_leaf_base(entry_point, number_of_arguments); // interpreter specific -#ifdef ASSERT - { - Label L; - cmpq(r13, Address(rbp, frame::interpreter_frame_bcx_offset * wordSize)); - jcc(Assembler::equal, L); - stop("InterpreterMacroAssembler::call_VM_leaf_base:" - " r13 not callee saved?"); - bind(L); - } - { - Label L; - cmpq(r14, Address(rbp, frame::interpreter_frame_locals_offset * wordSize)); - jcc(Assembler::equal, L); - stop("InterpreterMacroAssembler::call_VM_leaf_base:" - " r14 not callee saved?"); - bind(L); - } -#endif + // Used to ASSERT that r13/r14 were equal to frame's bcp/locals + // but since they may not have been saved (and we don't want to + // save thme here (see note above) the assert is invalid. } void InterpreterMacroAssembler::call_VM_base(Register oop_result, diff --git a/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp b/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp index 9d17fce5ff3..cbadaba9c20 100644 --- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp +++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp @@ -711,7 +711,6 @@ class StubGenerator: public StubCodeGenerator { // end - element count void gen_write_ref_array_pre_barrier(Register start, Register count) { assert_different_registers(start, count); -#if 0 // G1 only BarrierSet* bs = Universe::heap()->barrier_set(); switch (bs->kind()) { case BarrierSet::G1SATBCT: @@ -720,8 +719,8 @@ class StubGenerator: public StubCodeGenerator { __ pushad(); // push registers __ pushl(count); __ pushl(start); - __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_pre)); - __ addl(esp, wordSize * 2); + __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_pre))); + __ addl(rsp, wordSize * 2); __ popad(); } break; @@ -733,7 +732,6 @@ class StubGenerator: public StubCodeGenerator { ShouldNotReachHere(); } -#endif // 0 - G1 only } @@ -749,20 +747,18 @@ class StubGenerator: public StubCodeGenerator { BarrierSet* bs = Universe::heap()->barrier_set(); assert_different_registers(start, count); switch (bs->kind()) { -#if 0 // G1 only case BarrierSet::G1SATBCT: case BarrierSet::G1SATBCTLogging: { __ pushad(); // push registers __ pushl(count); __ pushl(start); - __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_post)); - __ addl(esp, wordSize * 2); + __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_post))); + __ addl(rsp, wordSize * 2); __ popad(); } break; -#endif // 0 G1 only case BarrierSet::CardTableModRef: case BarrierSet::CardTableExtension: @@ -1377,9 +1373,9 @@ class StubGenerator: public StubCodeGenerator { Address elem_klass_addr(elem, oopDesc::klass_offset_in_bytes()); // Copy from low to high addresses, indexed from the end of each array. + gen_write_ref_array_pre_barrier(to, count); __ leal(end_from, end_from_addr); __ leal(end_to, end_to_addr); - gen_write_ref_array_pre_barrier(to, count); assert(length == count, ""); // else fix next line: __ negl(count); // negate and test the length __ jccb(Assembler::notZero, L_load_element); diff --git a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp index 5cfbc09fe74..8cec3d56ed9 100644 --- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp @@ -1152,18 +1152,26 @@ class StubGenerator: public StubCodeGenerator { // Destroy no registers! // void gen_write_ref_array_pre_barrier(Register addr, Register count) { -#if 0 // G1 - only - assert_different_registers(addr, c_rarg1); - assert_different_registers(count, c_rarg0); BarrierSet* bs = Universe::heap()->barrier_set(); switch (bs->kind()) { case BarrierSet::G1SATBCT: case BarrierSet::G1SATBCTLogging: { __ pushaq(); // push registers - __ movq(c_rarg0, addr); - __ movq(c_rarg1, count); - __ call(RuntimeAddress(BarrierSet::static_write_ref_array_pre)); + if (count == c_rarg0) { + if (addr == c_rarg1) { + // exactly backwards!! + __ xchgq(c_rarg1, c_rarg0); + } else { + __ movq(c_rarg1, count); + __ movq(c_rarg0, addr); + } + + } else { + __ movq(c_rarg0, addr); + __ movq(c_rarg1, count); + } + __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_pre))); __ popaq(); } break; @@ -1171,11 +1179,10 @@ class StubGenerator: public StubCodeGenerator { case BarrierSet::CardTableExtension: case BarrierSet::ModRef: break; - default : + default: ShouldNotReachHere(); } -#endif // 0 G1 - only } // @@ -1192,7 +1199,6 @@ class StubGenerator: public StubCodeGenerator { assert_different_registers(start, end, scratch); BarrierSet* bs = Universe::heap()->barrier_set(); switch (bs->kind()) { -#if 0 // G1 - only case BarrierSet::G1SATBCT: case BarrierSet::G1SATBCTLogging: @@ -1205,11 +1211,10 @@ class StubGenerator: public StubCodeGenerator { __ shrq(scratch, LogBytesPerWord); __ movq(c_rarg0, start); __ movq(c_rarg1, scratch); - __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_post)); + __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_post))); __ popaq(); } break; -#endif // 0 G1 - only case BarrierSet::CardTableModRef: case BarrierSet::CardTableExtension: { @@ -1230,8 +1235,12 @@ class StubGenerator: public StubCodeGenerator { __ decrementq(count); __ jcc(Assembler::greaterEqual, L_loop); } - } - } + break; + default: + ShouldNotReachHere(); + + } + } // Copy big chunks forward // diff --git a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp index 79bcd92f2e4..ad4724b344d 100644 --- a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp +++ b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp @@ -107,6 +107,78 @@ static Assembler::Condition j_not(TemplateTable::Condition cc) { //---------------------------------------------------------------------------------------------------- // Miscelaneous helper routines +// Store an oop (or NULL) at the address described by obj. +// If val == noreg this means store a NULL + +static void do_oop_store(InterpreterMacroAssembler* _masm, + Address obj, + Register val, + BarrierSet::Name barrier, + bool precise) { + assert(val == noreg || val == rax, "parameter is just for looks"); + switch (barrier) { +#ifndef SERIALGC + case BarrierSet::G1SATBCT: + case BarrierSet::G1SATBCTLogging: + { + // flatten object address if needed + // We do it regardless of precise because we need the registers + if (obj.index() == noreg && obj.disp() == 0) { + if (obj.base() != rdx) { + __ movl(rdx, obj.base()); + } + } else { + __ leal(rdx, obj); + } + __ get_thread(rcx); + __ save_bcp(); + __ g1_write_barrier_pre(rdx, rcx, rsi, rbx, val != noreg); + + // Do the actual store + // noreg means NULL + if (val == noreg) { + __ movl(Address(rdx, 0), NULL_WORD); + // No post barrier for NULL + } else { + __ movl(Address(rdx, 0), val); + __ g1_write_barrier_post(rdx, rax, rcx, rbx, rsi); + } + __ restore_bcp(); + + } + break; +#endif // SERIALGC + case BarrierSet::CardTableModRef: + case BarrierSet::CardTableExtension: + { + if (val == noreg) { + __ movl(obj, NULL_WORD); + } else { + __ movl(obj, val); + // flatten object address if needed + if (!precise || (obj.index() == noreg && obj.disp() == 0)) { + __ store_check(obj.base()); + } else { + __ leal(rdx, obj); + __ store_check(rdx); + } + } + } + break; + case BarrierSet::ModRef: + case BarrierSet::Other: + if (val == noreg) { + __ movl(obj, NULL_WORD); + } else { + __ movl(obj, val); + } + break; + default : + ShouldNotReachHere(); + + } +} + Address TemplateTable::at_bcp(int offset) { assert(_desc->uses_bcp(), "inconsistent uses_bcp information"); return Address(rsi, offset); @@ -872,6 +944,8 @@ void TemplateTable::aastore() { __ movl(rax, at_tos()); // Value __ movl(rcx, at_tos_p1()); // Index __ movl(rdx, at_tos_p2()); // Array + + Address element_address(rdx, rcx, Address::times_4, arrayOopDesc::base_offset_in_bytes(T_OBJECT)); index_check_without_pop(rdx, rcx); // kills rbx, // do array store check - check for NULL value first __ testl(rax, rax); @@ -883,7 +957,7 @@ void TemplateTable::aastore() { __ movl(rax, Address(rdx, oopDesc::klass_offset_in_bytes())); __ movl(rax, Address(rax, sizeof(oopDesc) + objArrayKlass::element_klass_offset_in_bytes())); // Compress array+index*4+12 into a single register. Frees ECX. - __ leal(rdx, Address(rdx, rcx, Address::times_4, arrayOopDesc::base_offset_in_bytes(T_OBJECT))); + __ leal(rdx, element_address); // Generate subtype check. Blows ECX. Resets EDI to locals. // Superklass in EAX. Subklass in EBX. @@ -895,15 +969,20 @@ void TemplateTable::aastore() { // Come here on success __ bind(ok_is_subtype); - __ movl(rax, at_rsp()); // Value - __ movl(Address(rdx, 0), rax); - __ store_check(rdx); - __ jmpb(done); + + // Get the value to store + __ movl(rax, at_rsp()); + // and store it with appropriate barrier + do_oop_store(_masm, Address(rdx, 0), rax, _bs->kind(), true); + + __ jmp(done); // Have a NULL in EAX, EDX=array, ECX=index. Store NULL at ary[idx] __ bind(is_null); __ profile_null_seen(rbx); - __ movl(Address(rdx, rcx, Address::times_4, arrayOopDesc::base_offset_in_bytes(T_OBJECT)), rax); + + // Store NULL, (noreg means NULL to do_oop_store) + do_oop_store(_masm, element_address, noreg, _bs->kind(), true); // Pop stack arguments __ bind(done); @@ -1506,7 +1585,7 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) { // compute return address as bci in rax, __ leal(rax, at_bcp((is_wide ? 5 : 3) - in_bytes(constMethodOopDesc::codes_offset()))); __ subl(rax, Address(rcx, methodOopDesc::const_offset())); - // Adjust the bcp in ESI by the displacement in EDX + // Adjust the bcp in rsi by the displacement in EDX __ addl(rsi, rdx); // Push return address __ push_i(rax); @@ -1517,7 +1596,7 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) { // Normal (non-jsr) branch handling - // Adjust the bcp in ESI by the displacement in EDX + // Adjust the bcp in rsi by the displacement in EDX __ addl(rsi, rdx); assert(UseLoopCounter || !UseOnStackReplacement, "on-stack-replacement requires loop counters"); @@ -2426,11 +2505,12 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static) { __ pop(atos); if (!is_static) pop_and_check_object(obj); - __ movl(lo, rax ); - __ store_check(obj, lo); // Need to mark card + do_oop_store(_masm, lo, rax, _bs->kind(), false); + if (!is_static) { patch_bytecode(Bytecodes::_fast_aputfield, rcx, rbx); } + __ jmp(Done); __ bind(notObj); @@ -2638,14 +2718,18 @@ void TemplateTable::fast_storefield(TosState state) { case Bytecodes::_fast_lputfield: __ movl(hi, rdx); __ movl(lo, rax); break; case Bytecodes::_fast_fputfield: __ fstp_s(lo); break; case Bytecodes::_fast_dputfield: __ fstp_d(lo); break; - case Bytecodes::_fast_aputfield: __ movl(lo, rax); __ store_check(rcx, lo); break; + case Bytecodes::_fast_aputfield: { + do_oop_store(_masm, lo, rax, _bs->kind(), false); + break; + } default: ShouldNotReachHere(); } Label done; volatile_barrier( ); - __ jmpb(done); + // Barriers are so large that short branch doesn't reach! + __ jmp(done); // Same code as above, but don't need rdx to test for volatile. __ bind(notVolatile); @@ -2664,7 +2748,10 @@ void TemplateTable::fast_storefield(TosState state) { case Bytecodes::_fast_lputfield: __ movl(hi, rdx); __ movl(lo, rax); break; case Bytecodes::_fast_fputfield: __ fstp_s(lo); break; case Bytecodes::_fast_dputfield: __ fstp_d(lo); break; - case Bytecodes::_fast_aputfield: __ movl(lo, rax); __ store_check(rcx, lo); break; + case Bytecodes::_fast_aputfield: { + do_oop_store(_masm, lo, rax, _bs->kind(), false); + break; + } default: ShouldNotReachHere(); } @@ -3019,8 +3106,6 @@ void TemplateTable::_new() { Label initialize_object; // including clearing the fields Label allocate_shared; - ExternalAddress heap_top((address)Universe::heap()->top_addr()); - __ get_cpool_and_tags(rcx, rax); // get instanceKlass __ movl(rcx, Address(rcx, rdx, Address::times_4, sizeof(constantPoolOopDesc))); @@ -3077,6 +3162,8 @@ void TemplateTable::_new() { if (allow_shared_alloc) { __ bind(allocate_shared); + ExternalAddress heap_top((address)Universe::heap()->top_addr()); + Label retry; __ bind(retry); __ mov32(rax, heap_top); diff --git a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp index f84c8f8cc05..cb267a8c74f 100644 --- a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp @@ -113,6 +113,69 @@ static Assembler::Condition j_not(TemplateTable::Condition cc) { // Miscelaneous helper routines +// Store an oop (or NULL) at the address described by obj. +// If val == noreg this means store a NULL + +static void do_oop_store(InterpreterMacroAssembler* _masm, + Address obj, + Register val, + BarrierSet::Name barrier, + bool precise) { + assert(val == noreg || val == rax, "parameter is just for looks"); + switch (barrier) { +#ifndef SERIALGC + case BarrierSet::G1SATBCT: + case BarrierSet::G1SATBCTLogging: + { + // flatten object address if needed + if (obj.index() == noreg && obj.disp() == 0) { + if (obj.base() != rdx) { + __ movq(rdx, obj.base()); + } + } else { + __ leaq(rdx, obj); + } + __ g1_write_barrier_pre(rdx, r8, rbx, val != noreg); + if (val == noreg) { + __ store_heap_oop(Address(rdx, 0), NULL_WORD); + } else { + __ store_heap_oop(Address(rdx, 0), val); + __ g1_write_barrier_post(rdx, val, r8, rbx); + } + + } + break; +#endif // SERIALGC + case BarrierSet::CardTableModRef: + case BarrierSet::CardTableExtension: + { + if (val == noreg) { + __ store_heap_oop(obj, NULL_WORD); + } else { + __ store_heap_oop(obj, val); + // flatten object address if needed + if (!precise || (obj.index() == noreg && obj.disp() == 0)) { + __ store_check(obj.base()); + } else { + __ leaq(rdx, obj); + __ store_check(rdx); + } + } + } + break; + case BarrierSet::ModRef: + case BarrierSet::Other: + if (val == noreg) { + __ store_heap_oop(obj, NULL_WORD); + } else { + __ store_heap_oop(obj, val); + } + break; + default : + ShouldNotReachHere(); + + } +} Address TemplateTable::at_bcp(int offset) { assert(_desc->uses_bcp(), "inconsistent uses_bcp information"); @@ -558,8 +621,8 @@ void TemplateTable::aaload() { // rdx: array index_check(rdx, rax); // kills rbx __ load_heap_oop(rax, Address(rdx, rax, - UseCompressedOops ? Address::times_4 : Address::times_8, - arrayOopDesc::base_offset_in_bytes(T_OBJECT))); + UseCompressedOops ? Address::times_4 : Address::times_8, + arrayOopDesc::base_offset_in_bytes(T_OBJECT))); } void TemplateTable::baload() { @@ -864,6 +927,11 @@ void TemplateTable::aastore() { __ movq(rax, at_tos()); // value __ movl(rcx, at_tos_p1()); // index __ movq(rdx, at_tos_p2()); // array + + Address element_address(rdx, rcx, + UseCompressedOops? Address::times_4 : Address::times_8, + arrayOopDesc::base_offset_in_bytes(T_OBJECT)); + index_check(rdx, rcx); // kills rbx // do array store check - check for NULL value first __ testq(rax, rax); @@ -877,9 +945,7 @@ void TemplateTable::aastore() { sizeof(oopDesc) + objArrayKlass::element_klass_offset_in_bytes())); // Compress array + index*oopSize + 12 into a single register. Frees rcx. - __ leaq(rdx, Address(rdx, rcx, - UseCompressedOops ? Address::times_4 : Address::times_8, - arrayOopDesc::base_offset_in_bytes(T_OBJECT))); + __ leaq(rdx, element_address); // Generate subtype check. Blows rcx, rdi // Superklass in rax. Subklass in rbx. @@ -891,18 +957,20 @@ void TemplateTable::aastore() { // Come here on success __ bind(ok_is_subtype); - __ movq(rax, at_tos()); // Value - __ store_heap_oop(Address(rdx, 0), rax); - __ store_check(rdx); + + // Get the value we will store + __ movq(rax, at_tos()); + + // Now store using the appropriate barrier + do_oop_store(_masm, Address(rdx, 0), rax, _bs->kind(), true); __ jmp(done); // Have a NULL in rax, rdx=array, ecx=index. Store NULL at ary[idx] __ bind(is_null); __ profile_null_seen(rbx); - __ store_heap_oop(Address(rdx, rcx, - UseCompressedOops ? Address::times_4 : Address::times_8, - arrayOopDesc::base_offset_in_bytes(T_OBJECT)), - rax); + + // Store a NULL + do_oop_store(_masm, element_address, noreg, _bs->kind(), true); // Pop stack arguments __ bind(done); @@ -2394,8 +2462,10 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static) { // atos __ pop(atos); if (!is_static) pop_and_check_object(obj); - __ store_heap_oop(field, rax); - __ store_check(obj, field); // Need to mark card + + // Store into the field + do_oop_store(_masm, field, rax, _bs->kind(), false); + if (!is_static) { patch_bytecode(Bytecodes::_fast_aputfield, bc, rbx); } @@ -2582,8 +2652,7 @@ void TemplateTable::fast_storefield(TosState state) { // access field switch (bytecode()) { case Bytecodes::_fast_aputfield: - __ store_heap_oop(field, rax); - __ store_check(rcx, field); + do_oop_store(_masm, field, rax, _bs->kind(), false); break; case Bytecodes::_fast_lputfield: __ movq(field, rax); @@ -2789,7 +2858,7 @@ void TemplateTable::prepare_invoke(Register method, __ andl(recv, 0xFF); if (TaggedStackInterpreter) __ shll(recv, 1); // index*2 __ movq(recv, Address(rsp, recv, Address::times_8, - -Interpreter::expr_offset_in_bytes(1))); + -Interpreter::expr_offset_in_bytes(1))); __ verify_oop(recv); } @@ -3042,8 +3111,6 @@ void TemplateTable::_new() { Label initialize_header; Label initialize_object; // including clearing the fields Label allocate_shared; - ExternalAddress top((address)Universe::heap()->top_addr()); - ExternalAddress end((address)Universe::heap()->end_addr()); __ get_cpool_and_tags(rsi, rax); // get instanceKlass @@ -3104,6 +3171,9 @@ void TemplateTable::_new() { if (allow_shared_alloc) { __ bind(allocate_shared); + ExternalAddress top((address)Universe::heap()->top_addr()); + ExternalAddress end((address)Universe::heap()->end_addr()); + const Register RtopAddr = rscratch1; const Register RendAddr = rscratch2; diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp index d28700aab88..1d9a2bd5af5 100644 --- a/hotspot/src/os/linux/vm/os_linux.cpp +++ b/hotspot/src/os/linux/vm/os_linux.cpp @@ -1261,6 +1261,17 @@ jlong os::elapsed_frequency() { return (1000 * 1000); } +// For now, we say that linux does not support vtime. I have no idea +// whether it can actually be made to (DLD, 9/13/05). + +bool os::supports_vtime() { return false; } +bool os::enable_vtime() { return false; } +bool os::vtime_enabled() { return false; } +double os::elapsedVTime() { + // better than nothing, but not much + return elapsedTime(); +} + jlong os::javaTimeMillis() { timeval time; int status = gettimeofday(&time, NULL); diff --git a/hotspot/src/os/solaris/vm/os_solaris.cpp b/hotspot/src/os/solaris/vm/os_solaris.cpp index ce6765e8d50..8e5c56c4175 100644 --- a/hotspot/src/os/solaris/vm/os_solaris.cpp +++ b/hotspot/src/os/solaris/vm/os_solaris.cpp @@ -1691,6 +1691,40 @@ bool os::getTimesSecs(double* process_real_time, } } +bool os::supports_vtime() { return true; } + +bool os::enable_vtime() { + int fd = open("/proc/self/ctl", O_WRONLY); + if (fd == -1) + return false; + + long cmd[] = { PCSET, PR_MSACCT }; + int res = write(fd, cmd, sizeof(long) * 2); + close(fd); + if (res != sizeof(long) * 2) + return false; + + return true; +} + +bool os::vtime_enabled() { + int fd = open("/proc/self/status", O_RDONLY); + if (fd == -1) + return false; + + pstatus_t status; + int res = read(fd, (void*) &status, sizeof(pstatus_t)); + close(fd); + if (res != sizeof(pstatus_t)) + return false; + + return status.pr_flags & PR_MSACCT; +} + +double os::elapsedVTime() { + return (double)gethrvtime() / (double)hrtime_hz; +} + // Used internally for comparisons only // getTimeMillis guaranteed to not move backwards on Solaris jlong getTimeMillis() { @@ -2661,7 +2695,7 @@ size_t os::numa_get_leaf_groups(int *ids, size_t size) { return bottom; } -// Detect the topology change. Typically happens during CPU pluggin-unplugging. +// Detect the topology change. Typically happens during CPU plugging-unplugging. bool os::numa_topology_changed() { int is_stale = Solaris::lgrp_cookie_stale(Solaris::lgrp_cookie()); if (is_stale != -1 && is_stale) { diff --git a/hotspot/src/os/windows/vm/os_windows.cpp b/hotspot/src/os/windows/vm/os_windows.cpp index a114b894690..3ec0c21454e 100644 --- a/hotspot/src/os/windows/vm/os_windows.cpp +++ b/hotspot/src/os/windows/vm/os_windows.cpp @@ -737,6 +737,17 @@ FILETIME java_to_windows_time(jlong l) { return result; } +// For now, we say that Windows does not support vtime. I have no idea +// whether it can actually be made to (DLD, 9/13/05). + +bool os::supports_vtime() { return false; } +bool os::enable_vtime() { return false; } +bool os::vtime_enabled() { return false; } +double os::elapsedVTime() { + // better than nothing, but not much + return elapsedTime(); +} + jlong os::javaTimeMillis() { if (UseFakeTimers) { return fake_time++; diff --git a/hotspot/src/share/vm/adlc/formssel.cpp b/hotspot/src/share/vm/adlc/formssel.cpp index eab02499c2d..bfc4e4940c0 100644 --- a/hotspot/src/share/vm/adlc/formssel.cpp +++ b/hotspot/src/share/vm/adlc/formssel.cpp @@ -3767,6 +3767,10 @@ bool MatchRule::is_chain_rule(FormDict &globals) const { int MatchRule::is_ideal_copy() const { if( _rChild ) { const char *opType = _rChild->_opType; +#if 1 + if( strcmp(opType,"CastIP")==0 ) + return 1; +#else if( strcmp(opType,"CastII")==0 ) return 1; // Do not treat *CastPP this way, because it @@ -3786,6 +3790,7 @@ int MatchRule::is_ideal_copy() const { // return 1; //if( strcmp(opType,"CastP2X")==0 ) // return 1; +#endif } if( is_chain_rule(_AD.globalNames()) && _lChild && strncmp(_lChild->_opType,"stackSlot",9)==0 ) diff --git a/hotspot/src/share/vm/c1/c1_CodeStubs.hpp b/hotspot/src/share/vm/c1/c1_CodeStubs.hpp index 9009e0d8c72..4c47e777b2b 100644 --- a/hotspot/src/share/vm/c1/c1_CodeStubs.hpp +++ b/hotspot/src/share/vm/c1/c1_CodeStubs.hpp @@ -482,3 +482,81 @@ class ArrayCopyStub: public CodeStub { virtual void print_name(outputStream* out) const { out->print("ArrayCopyStub"); } #endif // PRODUCT }; + +////////////////////////////////////////////////////////////////////////////////////////// +#ifndef SERIALGC + +// Code stubs for Garbage-First barriers. +class G1PreBarrierStub: public CodeStub { + private: + LIR_Opr _addr; + LIR_Opr _pre_val; + LIR_PatchCode _patch_code; + CodeEmitInfo* _info; + + public: + // pre_val (a temporary register) must be a register; + // addr (the address of the field to be read) must be a LIR_Address + G1PreBarrierStub(LIR_Opr addr, LIR_Opr pre_val, LIR_PatchCode patch_code, CodeEmitInfo* info) : + _addr(addr), _pre_val(pre_val), _patch_code(patch_code), _info(info) + { + assert(_pre_val->is_register(), "should be temporary register"); + assert(_addr->is_address(), "should be the address of the field"); + } + + LIR_Opr addr() const { return _addr; } + LIR_Opr pre_val() const { return _pre_val; } + LIR_PatchCode patch_code() const { return _patch_code; } + CodeEmitInfo* info() const { return _info; } + + virtual void emit_code(LIR_Assembler* e); + virtual void visit(LIR_OpVisitState* visitor) { + // don't pass in the code emit info since it's processed in the fast + // path + if (_info != NULL) + visitor->do_slow_case(_info); + else + visitor->do_slow_case(); + visitor->do_input(_addr); + visitor->do_temp(_pre_val); + } +#ifndef PRODUCT + virtual void print_name(outputStream* out) const { out->print("G1PreBarrierStub"); } +#endif // PRODUCT +}; + +class G1PostBarrierStub: public CodeStub { + private: + LIR_Opr _addr; + LIR_Opr _new_val; + + static jbyte* _byte_map_base; + static jbyte* byte_map_base_slow(); + static jbyte* byte_map_base() { + if (_byte_map_base == NULL) { + _byte_map_base = byte_map_base_slow(); + } + return _byte_map_base; + } + + public: + // addr (the address of the object head) and new_val must be registers. + G1PostBarrierStub(LIR_Opr addr, LIR_Opr new_val): _addr(addr), _new_val(new_val) { } + + LIR_Opr addr() const { return _addr; } + LIR_Opr new_val() const { return _new_val; } + + virtual void emit_code(LIR_Assembler* e); + virtual void visit(LIR_OpVisitState* visitor) { + // don't pass in the code emit info since it's processed in the fast path + visitor->do_slow_case(); + visitor->do_input(_addr); + visitor->do_input(_new_val); + } +#ifndef PRODUCT + virtual void print_name(outputStream* out) const { out->print("G1PostBarrierStub"); } +#endif // PRODUCT +}; + +#endif // SERIALGC +////////////////////////////////////////////////////////////////////////////////////////// diff --git a/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp b/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp index a8ed3da18a7..32db0534ba9 100644 --- a/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp +++ b/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp @@ -74,6 +74,7 @@ void LIR_Assembler::patching_epilog(PatchingStub* patch, LIR_PatchCode patch_cod LIR_Assembler::LIR_Assembler(Compilation* c): _compilation(c) , _masm(c->masm()) + , _bs(Universe::heap()->barrier_set()) , _frame_map(c->frame_map()) , _current_block(NULL) , _pending_non_safepoint(NULL) diff --git a/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp b/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp index 3a64fe678fa..795c8932627 100644 --- a/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp +++ b/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp @@ -24,11 +24,13 @@ class Compilation; class ScopeValue; +class BarrierSet; class LIR_Assembler: public CompilationResourceObj { private: C1_MacroAssembler* _masm; CodeStubList* _slow_case_stubs; + BarrierSet* _bs; Compilation* _compilation; FrameMap* _frame_map; diff --git a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp index eb90b3fd2bc..9777b5c8b97 100644 --- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp +++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp @@ -285,16 +285,7 @@ jlong LIRItem::get_jlong_constant() const { void LIRGenerator::init() { - BarrierSet* bs = Universe::heap()->barrier_set(); - assert(bs->kind() == BarrierSet::CardTableModRef, "Wrong barrier set kind"); - CardTableModRefBS* ct = (CardTableModRefBS*)bs; - assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code"); - -#ifdef _LP64 - _card_table_base = new LIR_Const((jlong)ct->byte_map_base); -#else - _card_table_base = new LIR_Const((jint)ct->byte_map_base); -#endif + _bs = Universe::heap()->barrier_set(); } @@ -1239,8 +1230,37 @@ LIR_Opr LIRGenerator::load_constant(LIR_Const* c) { // Various barriers +void LIRGenerator::pre_barrier(LIR_Opr addr_opr, bool patch, CodeEmitInfo* info) { + // Do the pre-write barrier, if any. + switch (_bs->kind()) { +#ifndef SERIALGC + case BarrierSet::G1SATBCT: + case BarrierSet::G1SATBCTLogging: + G1SATBCardTableModRef_pre_barrier(addr_opr, patch, info); + break; +#endif // SERIALGC + case BarrierSet::CardTableModRef: + case BarrierSet::CardTableExtension: + // No pre barriers + break; + case BarrierSet::ModRef: + case BarrierSet::Other: + // No pre barriers + break; + default : + ShouldNotReachHere(); + + } +} + void LIRGenerator::post_barrier(LIR_OprDesc* addr, LIR_OprDesc* new_val) { - switch (Universe::heap()->barrier_set()->kind()) { + switch (_bs->kind()) { +#ifndef SERIALGC + case BarrierSet::G1SATBCT: + case BarrierSet::G1SATBCTLogging: + G1SATBCardTableModRef_post_barrier(addr, new_val); + break; +#endif // SERIALGC case BarrierSet::CardTableModRef: case BarrierSet::CardTableExtension: CardTableModRef_post_barrier(addr, new_val); @@ -1254,11 +1274,120 @@ void LIRGenerator::post_barrier(LIR_OprDesc* addr, LIR_OprDesc* new_val) { } } +//////////////////////////////////////////////////////////////////////// +#ifndef SERIALGC + +void LIRGenerator::G1SATBCardTableModRef_pre_barrier(LIR_Opr addr_opr, bool patch, CodeEmitInfo* info) { + if (G1DisablePreBarrier) return; + + // First we test whether marking is in progress. + BasicType flag_type; + if (in_bytes(PtrQueue::byte_width_of_active()) == 4) { + flag_type = T_INT; + } else { + guarantee(in_bytes(PtrQueue::byte_width_of_active()) == 1, + "Assumption"); + flag_type = T_BYTE; + } + LIR_Opr thrd = getThreadPointer(); + LIR_Address* mark_active_flag_addr = + new LIR_Address(thrd, + in_bytes(JavaThread::satb_mark_queue_offset() + + PtrQueue::byte_offset_of_active()), + flag_type); + // Read the marking-in-progress flag. + LIR_Opr flag_val = new_register(T_INT); + __ load(mark_active_flag_addr, flag_val); + + LabelObj* start_store = new LabelObj(); + + LIR_PatchCode pre_val_patch_code = + patch ? lir_patch_normal : lir_patch_none; + + LIR_Opr pre_val = new_register(T_OBJECT); + + __ cmp(lir_cond_notEqual, flag_val, LIR_OprFact::intConst(0)); + if (!addr_opr->is_address()) { + assert(addr_opr->is_register(), "must be"); + addr_opr = LIR_OprFact::address(new LIR_Address(addr_opr, 0, T_OBJECT)); + } + CodeStub* slow = new G1PreBarrierStub(addr_opr, pre_val, pre_val_patch_code, + info); + __ branch(lir_cond_notEqual, T_INT, slow); + __ branch_destination(slow->continuation()); +} + +void LIRGenerator::G1SATBCardTableModRef_post_barrier(LIR_OprDesc* addr, LIR_OprDesc* new_val) { + if (G1DisablePostBarrier) return; + + // If the "new_val" is a constant NULL, no barrier is necessary. + if (new_val->is_constant() && + new_val->as_constant_ptr()->as_jobject() == NULL) return; + + if (!new_val->is_register()) { + LIR_Opr new_val_reg = new_pointer_register(); + if (new_val->is_constant()) { + __ move(new_val, new_val_reg); + } else { + __ leal(new_val, new_val_reg); + } + new_val = new_val_reg; + } + assert(new_val->is_register(), "must be a register at this point"); + + if (addr->is_address()) { + LIR_Address* address = addr->as_address_ptr(); + LIR_Opr ptr = new_pointer_register(); + if (!address->index()->is_valid() && address->disp() == 0) { + __ move(address->base(), ptr); + } else { + assert(address->disp() != max_jint, "lea doesn't support patched addresses!"); + __ leal(addr, ptr); + } + addr = ptr; + } + assert(addr->is_register(), "must be a register at this point"); + + LIR_Opr xor_res = new_pointer_register(); + LIR_Opr xor_shift_res = new_pointer_register(); + + if (TwoOperandLIRForm ) { + __ move(addr, xor_res); + __ logical_xor(xor_res, new_val, xor_res); + __ move(xor_res, xor_shift_res); + __ unsigned_shift_right(xor_shift_res, + LIR_OprFact::intConst(HeapRegion::LogOfHRGrainBytes), + xor_shift_res, + LIR_OprDesc::illegalOpr()); + } else { + __ logical_xor(addr, new_val, xor_res); + __ unsigned_shift_right(xor_res, + LIR_OprFact::intConst(HeapRegion::LogOfHRGrainBytes), + xor_shift_res, + LIR_OprDesc::illegalOpr()); + } + + if (!new_val->is_register()) { + LIR_Opr new_val_reg = new_pointer_register(); + __ leal(new_val, new_val_reg); + new_val = new_val_reg; + } + assert(new_val->is_register(), "must be a register at this point"); + + __ cmp(lir_cond_notEqual, xor_shift_res, LIR_OprFact::intptrConst(NULL_WORD)); + + CodeStub* slow = new G1PostBarrierStub(addr, new_val); + __ branch(lir_cond_notEqual, T_INT, slow); + __ branch_destination(slow->continuation()); +} + +#endif // SERIALGC +//////////////////////////////////////////////////////////////////////// + void LIRGenerator::CardTableModRef_post_barrier(LIR_OprDesc* addr, LIR_OprDesc* new_val) { - BarrierSet* bs = Universe::heap()->barrier_set(); - assert(sizeof(*((CardTableModRefBS*)bs)->byte_map_base) == sizeof(jbyte), "adjust this code"); - LIR_Const* card_table_base = new LIR_Const(((CardTableModRefBS*)bs)->byte_map_base); + assert(sizeof(*((CardTableModRefBS*)_bs)->byte_map_base) == sizeof(jbyte), "adjust this code"); + LIR_Const* card_table_base = new LIR_Const(((CardTableModRefBS*)_bs)->byte_map_base); if (addr->is_address()) { LIR_Address* address = addr->as_address_ptr(); LIR_Opr ptr = new_register(T_OBJECT); @@ -1388,6 +1517,13 @@ void LIRGenerator::do_StoreField(StoreField* x) { __ membar_release(); } + if (is_oop) { + // Do the pre-write barrier, if any. + pre_barrier(LIR_OprFact::address(address), + needs_patching, + (info ? new CodeEmitInfo(info) : NULL)); + } + if (is_volatile) { assert(!needs_patching && x->is_loaded(), "how do we know it's volatile if it's not loaded"); @@ -1398,7 +1534,12 @@ void LIRGenerator::do_StoreField(StoreField* x) { } if (is_oop) { +#ifdef PRECISE_CARDMARK + // Precise cardmarks don't work + post_barrier(LIR_OprFact::address(address), value.result()); +#else post_barrier(object.result(), value.result()); +#endif // PRECISE_CARDMARK } if (is_volatile && os::is_MP()) { diff --git a/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp b/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp index 1b70887883f..1b8555b2055 100644 --- a/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp +++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp @@ -145,6 +145,7 @@ class PhiResolver: public CompilationResourceObj { // only the classes below belong in the same file class LIRGenerator: public InstructionVisitor, public BlockClosure { + private: Compilation* _compilation; ciMethod* _method; // method that we are compiling @@ -154,6 +155,7 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure { Values _instruction_for_operand; BitMap2D _vreg_flags; // flags which can be set on a per-vreg basis LIR_List* _lir; + BarrierSet* _bs; LIRGenerator* gen() { return this; @@ -174,8 +176,6 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure { LIR_OprList _reg_for_constants; Values _unpinned_constants; - LIR_Const* _card_table_base; - friend class PhiResolver; // unified bailout support @@ -196,8 +196,6 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure { LIR_Opr load_constant(Constant* x); LIR_Opr load_constant(LIR_Const* constant); - LIR_Const* card_table_base() const { return _card_table_base; } - void set_result(Value x, LIR_Opr opr) { assert(opr->is_valid(), "must set to valid value"); assert(x->operand()->is_illegal(), "operand should never change"); @@ -253,12 +251,17 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure { // generic interface + void pre_barrier(LIR_Opr addr_opr, bool patch, CodeEmitInfo* info); void post_barrier(LIR_OprDesc* addr, LIR_OprDesc* new_val); // specific implementations + // pre barriers + + void G1SATBCardTableModRef_pre_barrier(LIR_Opr addr_opr, bool patch, CodeEmitInfo* info); // post barriers + void G1SATBCardTableModRef_post_barrier(LIR_OprDesc* addr, LIR_OprDesc* new_val); void CardTableModRef_post_barrier(LIR_OprDesc* addr, LIR_OprDesc* new_val); diff --git a/hotspot/src/share/vm/c1/c1_Runtime1.cpp b/hotspot/src/share/vm/c1/c1_Runtime1.cpp index 8f42fe14327..ef357ac5ec1 100644 --- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp +++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp @@ -168,6 +168,8 @@ void Runtime1::generate_blob_for(StubID id) { switch (id) { // These stubs don't need to have an oopmap case dtrace_object_alloc_id: + case g1_pre_barrier_slow_id: + case g1_post_barrier_slow_id: case slow_subtype_check_id: case fpu2long_stub_id: case unwind_exception_id: diff --git a/hotspot/src/share/vm/c1/c1_Runtime1.hpp b/hotspot/src/share/vm/c1/c1_Runtime1.hpp index df6c03883f3..4380b72ee89 100644 --- a/hotspot/src/share/vm/c1/c1_Runtime1.hpp +++ b/hotspot/src/share/vm/c1/c1_Runtime1.hpp @@ -56,6 +56,8 @@ class StubAssembler; stub(access_field_patching) \ stub(load_klass_patching) \ stub(jvmti_exception_throw) \ + stub(g1_pre_barrier_slow) \ + stub(g1_post_barrier_slow) \ stub(fpu2long_stub) \ stub(counter_overflow) \ last_entry(number_of_ids) diff --git a/hotspot/src/share/vm/c1/c1_globals.hpp b/hotspot/src/share/vm/c1/c1_globals.hpp index 52a10b72490..87efd1b04da 100644 --- a/hotspot/src/share/vm/c1/c1_globals.hpp +++ b/hotspot/src/share/vm/c1/c1_globals.hpp @@ -213,9 +213,6 @@ develop(bool, UseFastLocking, true, \ "Use fast inlined locking code") \ \ - product(bool, FastTLABRefill, true, \ - "Use fast TLAB refill code") \ - \ develop(bool, UseSlowPath, false, \ "For debugging: test slow cases by always using them") \ \ diff --git a/hotspot/src/share/vm/compiler/methodLiveness.cpp b/hotspot/src/share/vm/compiler/methodLiveness.cpp index 92d60cfeca8..a9a90a07197 100644 --- a/hotspot/src/share/vm/compiler/methodLiveness.cpp +++ b/hotspot/src/share/vm/compiler/methodLiveness.cpp @@ -76,8 +76,9 @@ class BitCounter: public BitMapClosure { BitCounter() : _count(0) {} // Callback when bit in map is set - virtual void do_bit(size_t offset) { + virtual bool do_bit(size_t offset) { _count++; + return true; } int count() { @@ -467,7 +468,7 @@ MethodLivenessResult MethodLiveness::get_liveness_at(int entry_bci) { bci = 0; } - MethodLivenessResult answer(NULL,0); + MethodLivenessResult answer((uintptr_t*)NULL,0); if (_block_count > 0) { if (TimeLivenessAnalysis) _time_total.start(); diff --git a/hotspot/src/share/vm/compiler/methodLiveness.hpp b/hotspot/src/share/vm/compiler/methodLiveness.hpp index a679c34d007..705a36f762b 100644 --- a/hotspot/src/share/vm/compiler/methodLiveness.hpp +++ b/hotspot/src/share/vm/compiler/methodLiveness.hpp @@ -29,7 +29,7 @@ class MethodLivenessResult : public BitMap { bool _is_valid; public: - MethodLivenessResult(uintptr_t* map, idx_t size_in_bits) + MethodLivenessResult(BitMap::bm_word_t* map, idx_t size_in_bits) : BitMap(map, size_in_bits) , _is_valid(false) {} diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp index 09d0db5e02b..6428eb29318 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp @@ -790,7 +790,7 @@ CompactibleFreeListSpace::object_iterate_careful_m(MemRegion mr, } -HeapWord* CompactibleFreeListSpace::block_start(const void* p) const { +HeapWord* CompactibleFreeListSpace::block_start_const(const void* p) const { NOT_PRODUCT(verify_objects_initialized()); return _bt.block_start(p); } @@ -2285,9 +2285,9 @@ void CompactibleFreeListSpace::verifyIndexedFreeLists() const { } void CompactibleFreeListSpace::verifyIndexedFreeList(size_t size) const { - guarantee(size % 2 == 0, "Odd slots should be empty"); - for (FreeChunk* fc = _indexedFreeList[size].head(); fc != NULL; - fc = fc->next()) { + FreeChunk* fc = _indexedFreeList[size].head(); + guarantee((size % 2 == 0) || fc == NULL, "Odd slots should be empty"); + for (; fc != NULL; fc = fc->next()) { guarantee(fc->size() == size, "Size inconsistency"); guarantee(fc->isFree(), "!free?"); guarantee(fc->next() == NULL || fc->next()->prev() == fc, "Broken list"); diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp index 729556baecf..526688b84ac 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp @@ -502,7 +502,7 @@ class CompactibleFreeListSpace: public CompactibleSpace { void blk_iterate(BlkClosure* cl); void blk_iterate_careful(BlkClosureCareful* cl); - HeapWord* block_start(const void* p) const; + HeapWord* block_start_const(const void* p) const; HeapWord* block_start_careful(const void* p) const; size_t block_size(const HeapWord* p) const; size_t block_size_no_stall(HeapWord* p, const CMSCollector* c) const; diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp index 8ab7bdd1b58..b3988ddce0e 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp @@ -2751,13 +2751,14 @@ class VerifyMarkedClosure: public BitMapClosure { public: VerifyMarkedClosure(CMSBitMap* bm): _marks(bm), _failed(false) {} - void do_bit(size_t offset) { + bool do_bit(size_t offset) { HeapWord* addr = _marks->offsetToHeapWord(offset); if (!_marks->isMarked(addr)) { oop(addr)->print(); gclog_or_tty->print_cr(" ("INTPTR_FORMAT" should have been marked)", addr); _failed = true; } + return true; } bool failed() { return _failed; } @@ -4645,8 +4646,11 @@ size_t CMSCollector::preclean_card_table(ConcurrentMarkSweepGeneration* gen, startTimer(); sample_eden(); // Get and clear dirty region from card table - dirtyRegion = _ct->ct_bs()->dirty_card_range_after_preclean( - MemRegion(nextAddr, endAddr)); + dirtyRegion = _ct->ct_bs()->dirty_card_range_after_reset( + MemRegion(nextAddr, endAddr), + true, + CardTableModRefBS::precleaned_card_val()); + assert(dirtyRegion.start() >= nextAddr, "returned region inconsistent?"); } @@ -5414,8 +5418,8 @@ void CMSCollector::do_remark_non_parallel() { &mrias_cl); { TraceTime t("grey object rescan", PrintGCDetails, false, gclog_or_tty); - // Iterate over the dirty cards, marking them precleaned, and - // setting the corresponding bits in the mod union table. + // Iterate over the dirty cards, setting the corresponding bits in the + // mod union table. { ModUnionClosure modUnionClosure(&_modUnionTable); _ct->ct_bs()->dirty_card_iterate( @@ -6187,7 +6191,7 @@ HeapWord* CMSCollector::next_card_start_after_block(HeapWord* addr) const { // bit vector itself. That is done by a separate call CMSBitMap::allocate() // further below. CMSBitMap::CMSBitMap(int shifter, int mutex_rank, const char* mutex_name): - _bm(NULL,0), + _bm(), _shifter(shifter), _lock(mutex_rank >= 0 ? new Mutex(mutex_rank, mutex_name, true) : NULL) { @@ -6212,7 +6216,7 @@ bool CMSBitMap::allocate(MemRegion mr) { } assert(_virtual_space.committed_size() == brs.size(), "didn't reserve backing store for all of CMS bit map?"); - _bm.set_map((uintptr_t*)_virtual_space.low()); + _bm.set_map((BitMap::bm_word_t*)_virtual_space.low()); assert(_virtual_space.committed_size() << (_shifter + LogBitsPerByte) >= _bmWordSize, "inconsistency in bit map sizing"); _bm.set_size(_bmWordSize >> _shifter); @@ -6853,10 +6857,10 @@ void MarkFromRootsClosure::reset(HeapWord* addr) { // Should revisit to see if this should be restructured for // greater efficiency. -void MarkFromRootsClosure::do_bit(size_t offset) { +bool MarkFromRootsClosure::do_bit(size_t offset) { if (_skipBits > 0) { _skipBits--; - return; + return true; } // convert offset into a HeapWord* HeapWord* addr = _bitMap->startWord() + offset; @@ -6896,10 +6900,11 @@ void MarkFromRootsClosure::do_bit(size_t offset) { } // ...else the setting of klass will dirty the card anyway. } DEBUG_ONLY(}) - return; + return true; } } scanOopsInOop(addr); + return true; } // We take a break if we've been at this for a while, @@ -7033,10 +7038,10 @@ Par_MarkFromRootsClosure::Par_MarkFromRootsClosure(CMSConcMarkingTask* task, // Should revisit to see if this should be restructured for // greater efficiency. -void Par_MarkFromRootsClosure::do_bit(size_t offset) { +bool Par_MarkFromRootsClosure::do_bit(size_t offset) { if (_skip_bits > 0) { _skip_bits--; - return; + return true; } // convert offset into a HeapWord* HeapWord* addr = _bit_map->startWord() + offset; @@ -7051,10 +7056,11 @@ void Par_MarkFromRootsClosure::do_bit(size_t offset) { if (p->klass() == NULL || !p->is_parsable()) { // in the case of Clean-on-Enter optimization, redirty card // and avoid clearing card by increasing the threshold. - return; + return true; } } scan_oops_in_oop(addr); + return true; } void Par_MarkFromRootsClosure::scan_oops_in_oop(HeapWord* ptr) { @@ -7177,7 +7183,7 @@ void MarkFromRootsVerifyClosure::reset(HeapWord* addr) { // Should revisit to see if this should be restructured for // greater efficiency. -void MarkFromRootsVerifyClosure::do_bit(size_t offset) { +bool MarkFromRootsVerifyClosure::do_bit(size_t offset) { // convert offset into a HeapWord* HeapWord* addr = _verification_bm->startWord() + offset; assert(_verification_bm->endWord() && addr < _verification_bm->endWord(), @@ -7205,6 +7211,7 @@ void MarkFromRootsVerifyClosure::do_bit(size_t offset) { new_oop->oop_iterate(&_pam_verify_closure); } assert(_mark_stack->isEmpty(), "tautology, emphasizing post-condition"); + return true; } PushAndMarkVerifyClosure::PushAndMarkVerifyClosure( @@ -7448,8 +7455,12 @@ PushAndMarkClosure::PushAndMarkClosure(CMSCollector* collector, // Grey object rescan during pre-cleaning and second checkpoint phases -- // the non-parallel version (the parallel version appears further below.) void PushAndMarkClosure::do_oop(oop obj) { - // If _concurrent_precleaning, ignore mark word verification - assert(obj->is_oop_or_null(_concurrent_precleaning), + // Ignore mark word verification. If during concurrent precleaning, + // the object monitor may be locked. If during the checkpoint + // phases, the object may already have been reached by a different + // path and may be at the end of the global overflow list (so + // the mark word may be NULL). + assert(obj->is_oop_or_null(true /* ignore mark word */), "expected an oop or NULL"); HeapWord* addr = (HeapWord*)obj; // Check if oop points into the CMS generation diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp index 6d5546eeb95..40678c4ddfb 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp @@ -1325,7 +1325,7 @@ class MarkFromRootsClosure: public BitMapClosure { CMSMarkStack* markStack, CMSMarkStack* revisitStack, bool should_yield, bool verifying = false); - void do_bit(size_t offset); + bool do_bit(size_t offset); void reset(HeapWord* addr); inline void do_yield_check(); @@ -1361,7 +1361,7 @@ class Par_MarkFromRootsClosure: public BitMapClosure { CMSMarkStack* overflow_stack, CMSMarkStack* revisit_stack, bool should_yield); - void do_bit(size_t offset); + bool do_bit(size_t offset); inline void do_yield_check(); private: @@ -1409,7 +1409,7 @@ class MarkFromRootsVerifyClosure: public BitMapClosure { CMSBitMap* verification_bm, CMSBitMap* cms_bm, CMSMarkStack* mark_stack); - void do_bit(size_t offset); + bool do_bit(size_t offset); void reset(HeapWord* addr); }; @@ -1418,8 +1418,9 @@ class MarkFromRootsVerifyClosure: public BitMapClosure { // "empty" (i.e. the bit vector doesn't have any 1-bits). class FalseBitMapClosure: public BitMapClosure { public: - void do_bit(size_t offset) { + bool do_bit(size_t offset) { guarantee(false, "Should not have a 1 bit"); + return true; } }; diff --git a/hotspot/src/share/vm/gc_implementation/g1/bufferingOopClosure.hpp b/hotspot/src/share/vm/gc_implementation/g1/bufferingOopClosure.hpp new file mode 100644 index 00000000000..1124e5d799f --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/bufferingOopClosure.hpp @@ -0,0 +1,195 @@ +/* + * Copyright 2001-2007 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. + * + */ + +// A BufferingOops closure tries to separate out the cost of finding roots +// from the cost of applying closures to them. It maintains an array of +// ref-containing locations. Until the array is full, applying the closure +// to an oop* merely records that location in the array. Since this +// closure app cost is small, an elapsed timer can approximately attribute +// all of this cost to the cost of finding the roots. When the array fills +// up, the wrapped closure is applied to all elements, keeping track of +// this elapsed time of this process, and leaving the array empty. +// The caller must be sure to call "done" to process any unprocessed +// buffered entriess. + +class Generation; +class HeapRegion; + +class BufferingOopClosure: public OopClosure { +protected: + enum PrivateConstants { + BufferLength = 1024 + }; + + oop *_buffer[BufferLength]; + oop **_buffer_top; + oop **_buffer_curr; + + OopClosure *_oc; + double _closure_app_seconds; + + void process_buffer () { + + double start = os::elapsedTime(); + for (oop **curr = _buffer; curr < _buffer_curr; ++curr) { + _oc->do_oop(*curr); + } + _buffer_curr = _buffer; + _closure_app_seconds += (os::elapsedTime() - start); + } + +public: + virtual void do_oop(narrowOop* p) { + guarantee(false, "NYI"); + } + virtual void do_oop(oop *p) { + if (_buffer_curr == _buffer_top) { + process_buffer(); + } + + *_buffer_curr = p; + ++_buffer_curr; + } + void done () { + if (_buffer_curr > _buffer) { + process_buffer(); + } + } + double closure_app_seconds () { + return _closure_app_seconds; + } + BufferingOopClosure (OopClosure *oc) : + _oc(oc), + _buffer_curr(_buffer), _buffer_top(_buffer + BufferLength), + _closure_app_seconds(0.0) { } +}; + +class BufferingOopsInGenClosure: public OopsInGenClosure { + BufferingOopClosure _boc; + OopsInGenClosure* _oc; +public: + BufferingOopsInGenClosure(OopsInGenClosure *oc) : + _boc(oc), _oc(oc) {} + + virtual void do_oop(narrowOop* p) { + guarantee(false, "NYI"); + } + + virtual void do_oop(oop* p) { + assert(generation()->is_in_reserved(p), "Must be in!"); + _boc.do_oop(p); + } + + void done() { + _boc.done(); + } + + double closure_app_seconds () { + return _boc.closure_app_seconds(); + } + + void set_generation(Generation* gen) { + OopsInGenClosure::set_generation(gen); + _oc->set_generation(gen); + } + + void reset_generation() { + // Make sure we finish the current work with the current generation. + _boc.done(); + OopsInGenClosure::reset_generation(); + _oc->reset_generation(); + } + +}; + + +class BufferingOopsInHeapRegionClosure: public OopsInHeapRegionClosure { +private: + enum PrivateConstants { + BufferLength = 1024 + }; + + oop *_buffer[BufferLength]; + oop **_buffer_top; + oop **_buffer_curr; + + HeapRegion *_hr_buffer[BufferLength]; + HeapRegion **_hr_curr; + + OopsInHeapRegionClosure *_oc; + double _closure_app_seconds; + + void process_buffer () { + + assert((_hr_curr - _hr_buffer) == (_buffer_curr - _buffer), + "the two lengths should be the same"); + + double start = os::elapsedTime(); + HeapRegion **hr_curr = _hr_buffer; + HeapRegion *hr_prev = NULL; + for (oop **curr = _buffer; curr < _buffer_curr; ++curr) { + HeapRegion *region = *hr_curr; + if (region != hr_prev) { + _oc->set_region(region); + hr_prev = region; + } + _oc->do_oop(*curr); + ++hr_curr; + } + _buffer_curr = _buffer; + _hr_curr = _hr_buffer; + _closure_app_seconds += (os::elapsedTime() - start); + } + +public: + virtual void do_oop(narrowOop *p) { + guarantee(false, "NYI"); + } + + virtual void do_oop(oop *p) { + if (_buffer_curr == _buffer_top) { + assert(_hr_curr > _hr_buffer, "_hr_curr should be consistent with _buffer_curr"); + process_buffer(); + } + + *_buffer_curr = p; + ++_buffer_curr; + *_hr_curr = _from; + ++_hr_curr; + } + void done () { + if (_buffer_curr > _buffer) { + assert(_hr_curr > _hr_buffer, "_hr_curr should be consistent with _buffer_curr"); + process_buffer(); + } + } + double closure_app_seconds () { + return _closure_app_seconds; + } + BufferingOopsInHeapRegionClosure (OopsInHeapRegionClosure *oc) : + _oc(oc), + _buffer_curr(_buffer), _buffer_top(_buffer + BufferLength), + _hr_curr(_hr_buffer), + _closure_app_seconds(0.0) { } +}; diff --git a/hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.cpp b/hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.cpp new file mode 100644 index 00000000000..fbc5f4f151b --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.cpp @@ -0,0 +1,409 @@ +/* + * Copyright 2001-2007 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. + * + */ + +# include "incls/_precompiled.incl" +# include "incls/_collectionSetChooser.cpp.incl" + +CSetChooserCache::CSetChooserCache() { + for (int i = 0; i < CacheLength; ++i) + _cache[i] = NULL; + clear(); +} + +void CSetChooserCache::clear() { + _occupancy = 0; + _first = 0; + for (int i = 0; i < CacheLength; ++i) { + HeapRegion *hr = _cache[i]; + if (hr != NULL) + hr->set_sort_index(-1); + _cache[i] = NULL; + } +} + +#ifndef PRODUCT +bool CSetChooserCache::verify() { + int index = _first; + HeapRegion *prev = NULL; + for (int i = 0; i < _occupancy; ++i) { + guarantee(_cache[index] != NULL, "cache entry should not be empty"); + HeapRegion *hr = _cache[index]; + guarantee(!hr->is_young(), "should not be young!"); + if (prev != NULL) { + guarantee(prev->gc_efficiency() >= hr->gc_efficiency(), + "cache should be correctly ordered"); + } + guarantee(hr->sort_index() == get_sort_index(index), + "sort index should be correct"); + index = trim_index(index + 1); + prev = hr; + } + + for (int i = 0; i < (CacheLength - _occupancy); ++i) { + guarantee(_cache[index] == NULL, "cache entry should be empty"); + index = trim_index(index + 1); + } + + guarantee(index == _first, "we should have reached where we started from"); + return true; +} +#endif // PRODUCT + +void CSetChooserCache::insert(HeapRegion *hr) { + assert(!is_full(), "cache should not be empty"); + hr->calc_gc_efficiency(); + + int empty_index; + if (_occupancy == 0) { + empty_index = _first; + } else { + empty_index = trim_index(_first + _occupancy); + assert(_cache[empty_index] == NULL, "last slot should be empty"); + int last_index = trim_index(empty_index - 1); + HeapRegion *last = _cache[last_index]; + assert(last != NULL,"as the cache is not empty, last should not be empty"); + while (empty_index != _first && + last->gc_efficiency() < hr->gc_efficiency()) { + _cache[empty_index] = last; + last->set_sort_index(get_sort_index(empty_index)); + empty_index = last_index; + last_index = trim_index(last_index - 1); + last = _cache[last_index]; + } + } + _cache[empty_index] = hr; + hr->set_sort_index(get_sort_index(empty_index)); + + ++_occupancy; + assert(verify(), "cache should be consistent"); +} + +HeapRegion *CSetChooserCache::remove_first() { + if (_occupancy > 0) { + assert(_cache[_first] != NULL, "cache should have at least one region"); + HeapRegion *ret = _cache[_first]; + _cache[_first] = NULL; + ret->set_sort_index(-1); + --_occupancy; + _first = trim_index(_first + 1); + assert(verify(), "cache should be consistent"); + return ret; + } else { + return NULL; + } +} + +// this is a bit expensive... but we expect that it should not be called +// to often. +void CSetChooserCache::remove(HeapRegion *hr) { + assert(_occupancy > 0, "cache should not be empty"); + assert(hr->sort_index() < -1, "should already be in the cache"); + int index = get_index(hr->sort_index()); + assert(_cache[index] == hr, "index should be correct"); + int next_index = trim_index(index + 1); + int last_index = trim_index(_first + _occupancy - 1); + while (index != last_index) { + assert(_cache[next_index] != NULL, "should not be null"); + _cache[index] = _cache[next_index]; + _cache[index]->set_sort_index(get_sort_index(index)); + + index = next_index; + next_index = trim_index(next_index+1); + } + assert(index == last_index, "should have reached the last one"); + _cache[index] = NULL; + hr->set_sort_index(-1); + --_occupancy; + assert(verify(), "cache should be consistent"); +} + +static inline int orderRegions(HeapRegion* hr1, HeapRegion* hr2) { + if (hr1 == NULL) { + if (hr2 == NULL) return 0; + else return 1; + } else if (hr2 == NULL) { + return -1; + } + if (hr2->gc_efficiency() < hr1->gc_efficiency()) return -1; + else if (hr1->gc_efficiency() < hr2->gc_efficiency()) return 1; + else return 0; +} + +static int orderRegions(HeapRegion** hr1p, HeapRegion** hr2p) { + return orderRegions(*hr1p, *hr2p); +} + +CollectionSetChooser::CollectionSetChooser() : + // The line below is the worst bit of C++ hackery I've ever written + // (Detlefs, 11/23). You should think of it as equivalent to + // "_regions(100, true)": initialize the growable array and inform it + // that it should allocate its elem array(s) on the C heap. The first + // argument, however, is actually a comma expression (new-expr, 100). + // The purpose of the new_expr is to inform the growable array that it + // is *already* allocated on the C heap: it uses the placement syntax to + // keep it from actually doing any allocation. + _markedRegions((ResourceObj::operator new (sizeof(GrowableArray), + (void*)&_markedRegions, + ResourceObj::C_HEAP), + 100), + true), + _curMarkedIndex(0), + _numMarkedRegions(0), + _unmarked_age_1_returned_as_new(false), + _first_par_unreserved_idx(0) +{} + + + +#ifndef PRODUCT +bool CollectionSetChooser::verify() { + int index = 0; + guarantee(_curMarkedIndex <= _numMarkedRegions, + "_curMarkedIndex should be within bounds"); + while (index < _curMarkedIndex) { + guarantee(_markedRegions.at(index++) == NULL, + "all entries before _curMarkedIndex should be NULL"); + } + HeapRegion *prev = NULL; + while (index < _numMarkedRegions) { + HeapRegion *curr = _markedRegions.at(index++); + if (curr != NULL) { + int si = curr->sort_index(); + guarantee(!curr->is_young(), "should not be young!"); + guarantee(si > -1 && si == (index-1), "sort index invariant"); + if (prev != NULL) { + guarantee(orderRegions(prev, curr) != 1, "regions should be sorted"); + } + prev = curr; + } + } + return _cache.verify(); +} +#endif + +bool +CollectionSetChooser::addRegionToCache() { + assert(!_cache.is_full(), "cache should not be full"); + + HeapRegion *hr = NULL; + while (hr == NULL && _curMarkedIndex < _numMarkedRegions) { + hr = _markedRegions.at(_curMarkedIndex++); + } + if (hr == NULL) + return false; + assert(!hr->is_young(), "should not be young!"); + assert(hr->sort_index() == _curMarkedIndex-1, "sort_index invariant"); + _markedRegions.at_put(hr->sort_index(), NULL); + _cache.insert(hr); + assert(!_cache.is_empty(), "cache should not be empty"); + assert(verify(), "cache should be consistent"); + return false; +} + +void +CollectionSetChooser::fillCache() { + while (!_cache.is_full() && addRegionToCache()) { + } +} + +void +CollectionSetChooser::sortMarkedHeapRegions() { + guarantee(_cache.is_empty(), "cache should be empty"); + // First trim any unused portion of the top in the parallel case. + if (_first_par_unreserved_idx > 0) { + if (G1PrintParCleanupStats) { + gclog_or_tty->print(" Truncating _markedRegions from %d to %d.\n", + _markedRegions.length(), _first_par_unreserved_idx); + } + assert(_first_par_unreserved_idx <= _markedRegions.length(), + "Or we didn't reserved enough length"); + _markedRegions.trunc_to(_first_par_unreserved_idx); + } + _markedRegions.sort(orderRegions); + assert(_numMarkedRegions <= _markedRegions.length(), "Requirement"); + assert(_numMarkedRegions == 0 + || _markedRegions.at(_numMarkedRegions-1) != NULL, + "Testing _numMarkedRegions"); + assert(_numMarkedRegions == _markedRegions.length() + || _markedRegions.at(_numMarkedRegions) == NULL, + "Testing _numMarkedRegions"); + if (G1PrintParCleanupStats) { + gclog_or_tty->print_cr(" Sorted %d marked regions.", _numMarkedRegions); + } + for (int i = 0; i < _numMarkedRegions; i++) { + assert(_markedRegions.at(i) != NULL, "Should be true by sorting!"); + _markedRegions.at(i)->set_sort_index(i); + if (G1PrintRegionLivenessInfo > 0) { + if (i == 0) gclog_or_tty->print_cr("Sorted marked regions:"); + if (i < G1PrintRegionLivenessInfo || + (_numMarkedRegions-i) < G1PrintRegionLivenessInfo) { + HeapRegion* hr = _markedRegions.at(i); + size_t u = hr->used(); + gclog_or_tty->print_cr(" Region %d: %d used, %d max live, %5.2f%%.", + i, u, hr->max_live_bytes(), + 100.0*(float)hr->max_live_bytes()/(float)u); + } + } + } + if (G1PolicyVerbose > 1) + printSortedHeapRegions(); + assert(verify(), "should now be sorted"); +} + +void +printHeapRegion(HeapRegion *hr) { + if (hr->isHumongous()) + gclog_or_tty->print("H: "); + if (hr->in_collection_set()) + gclog_or_tty->print("CS: "); + if (hr->popular()) + gclog_or_tty->print("pop: "); + gclog_or_tty->print_cr("Region " PTR_FORMAT " (%s%s) " + "[" PTR_FORMAT ", " PTR_FORMAT"] " + "Used: " SIZE_FORMAT "K, garbage: " SIZE_FORMAT "K.", + hr, hr->is_young() ? "Y " : " ", + hr->is_marked()? "M1" : "M0", + hr->bottom(), hr->end(), + hr->used()/K, hr->garbage_bytes()/K); +} + +void +CollectionSetChooser::addMarkedHeapRegion(HeapRegion* hr) { + assert(!hr->isHumongous(), + "Humongous regions shouldn't be added to the collection set"); + assert(!hr->is_young(), "should not be young!"); + _markedRegions.append(hr); + _numMarkedRegions++; + hr->calc_gc_efficiency(); +} + +void +CollectionSetChooser:: +prepareForAddMarkedHeapRegionsPar(size_t n_regions, size_t chunkSize) { + _first_par_unreserved_idx = 0; + size_t max_waste = ParallelGCThreads * chunkSize; + // it should be aligned with respect to chunkSize + size_t aligned_n_regions = + (n_regions + (chunkSize - 1)) / chunkSize * chunkSize; + assert( aligned_n_regions % chunkSize == 0, "should be aligned" ); + _markedRegions.at_put_grow((int)(aligned_n_regions + max_waste - 1), NULL); +} + +jint +CollectionSetChooser::getParMarkedHeapRegionChunk(jint n_regions) { + jint res = Atomic::add(n_regions, &_first_par_unreserved_idx); + assert(_markedRegions.length() > res + n_regions - 1, + "Should already have been expanded"); + return res - n_regions; +} + +void +CollectionSetChooser::setMarkedHeapRegion(jint index, HeapRegion* hr) { + assert(_markedRegions.at(index) == NULL, "precondition"); + assert(!hr->is_young(), "should not be young!"); + _markedRegions.at_put(index, hr); + hr->calc_gc_efficiency(); +} + +void +CollectionSetChooser::incNumMarkedHeapRegions(jint inc_by) { + (void)Atomic::add(inc_by, &_numMarkedRegions); +} + +void +CollectionSetChooser::clearMarkedHeapRegions(){ + for (int i = 0; i < _markedRegions.length(); i++) { + HeapRegion* r = _markedRegions.at(i); + if (r != NULL) r->set_sort_index(-1); + } + _markedRegions.clear(); + _curMarkedIndex = 0; + _numMarkedRegions = 0; + _cache.clear(); +}; + +void +CollectionSetChooser::updateAfterFullCollection() { + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + clearMarkedHeapRegions(); +} + +void +CollectionSetChooser::printSortedHeapRegions() { + gclog_or_tty->print_cr("Printing %d Heap Regions sorted by amount of known garbage", + _numMarkedRegions); + for (int i = 0; i < _markedRegions.length(); i++) { + printHeapRegion(_markedRegions.at(i)); + } + gclog_or_tty->print_cr("Done sorted heap region print"); +} + +void CollectionSetChooser::removeRegion(HeapRegion *hr) { + int si = hr->sort_index(); + assert(si == -1 || hr->is_marked(), "Sort index not valid."); + if (si > -1) { + assert(_markedRegions.at(si) == hr, "Sort index not valid." ); + _markedRegions.at_put(si, NULL); + } else if (si < -1) { + assert(_cache.region_in_cache(hr), "should be in the cache"); + _cache.remove(hr); + assert(hr->sort_index() == -1, "sort index invariant"); + } + hr->set_sort_index(-1); +} + +// if time_remaining < 0.0, then this method should try to return +// a region, whether it fits within the remaining time or not +HeapRegion* +CollectionSetChooser::getNextMarkedRegion(double time_remaining, + double avg_prediction) { + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + G1CollectorPolicy* g1p = g1h->g1_policy(); + fillCache(); + if (_cache.is_empty()) { + assert(_curMarkedIndex == _numMarkedRegions, + "if cache is empty, list should also be empty"); + return NULL; + } + + HeapRegion *hr = _cache.get_first(); + assert(hr != NULL, "if cache not empty, first entry should be non-null"); + double predicted_time = g1h->predict_region_elapsed_time_ms(hr, false); + + if (g1p->adaptive_young_list_length()) { + if (time_remaining - predicted_time < 0.0) { + g1h->check_if_region_is_too_expensive(predicted_time); + return NULL; + } + } else { + if (predicted_time > 2.0 * avg_prediction) { + return NULL; + } + } + + HeapRegion *hr2 = _cache.remove_first(); + assert(hr == hr2, "cache contents should not have changed"); + + return hr; +} diff --git a/hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.hpp b/hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.hpp new file mode 100644 index 00000000000..60d8bf2057e --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/collectionSetChooser.hpp @@ -0,0 +1,138 @@ +/* + * Copyright 2001-2007 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. + * + */ + +// We need to sort heap regions by collection desirability. + +class CSetChooserCache { +private: + enum { + CacheLength = 16 + } PrivateConstants; + + HeapRegion* _cache[CacheLength]; + int _occupancy; // number of region in cache + int _first; // "first" region in the cache + + // adding CacheLength to deal with negative values + inline int trim_index(int index) { + return (index + CacheLength) % CacheLength; + } + + inline int get_sort_index(int index) { + return -index-2; + } + inline int get_index(int sort_index) { + return -sort_index-2; + } + +public: + CSetChooserCache(void); + + inline int occupancy(void) { return _occupancy; } + inline bool is_full() { return _occupancy == CacheLength; } + inline bool is_empty() { return _occupancy == 0; } + + void clear(void); + void insert(HeapRegion *hr); + HeapRegion *remove_first(void); + void remove (HeapRegion *hr); + inline HeapRegion *get_first(void) { + return _cache[_first]; + } + +#ifndef PRODUCT + bool verify (void); + bool region_in_cache(HeapRegion *hr) { + int sort_index = hr->sort_index(); + if (sort_index < -1) { + int index = get_index(sort_index); + guarantee(index < CacheLength, "should be within bounds"); + return _cache[index] == hr; + } else + return 0; + } +#endif // PRODUCT +}; + +class CollectionSetChooser: public CHeapObj { + + GrowableArray _markedRegions; + int _curMarkedIndex; + int _numMarkedRegions; + CSetChooserCache _cache; + + // True iff last collection pause ran of out new "age 0" regions, and + // returned an "age 1" region. + bool _unmarked_age_1_returned_as_new; + + jint _first_par_unreserved_idx; + +public: + + HeapRegion* getNextMarkedRegion(double time_so_far, double avg_prediction); + + CollectionSetChooser(); + + void printSortedHeapRegions(); + + void sortMarkedHeapRegions(); + void fillCache(); + bool addRegionToCache(void); + void addMarkedHeapRegion(HeapRegion *hr); + + // Must be called before calls to getParMarkedHeapRegionChunk. + // "n_regions" is the number of regions, "chunkSize" the chunk size. + void prepareForAddMarkedHeapRegionsPar(size_t n_regions, size_t chunkSize); + // Returns the first index in a contiguous chunk of "n_regions" indexes + // that the calling thread has reserved. These must be set by the + // calling thread using "setMarkedHeapRegion" (to NULL if necessary). + jint getParMarkedHeapRegionChunk(jint n_regions); + // Set the marked array entry at index to hr. Careful to claim the index + // first if in parallel. + void setMarkedHeapRegion(jint index, HeapRegion* hr); + // Atomically increment the number of claimed regions by "inc_by". + void incNumMarkedHeapRegions(jint inc_by); + + void clearMarkedHeapRegions(); + + void updateAfterFullCollection(); + + // Ensure that "hr" is not a member of the marked region array or the cache + void removeRegion(HeapRegion* hr); + + bool unmarked_age_1_returned_as_new() { return _unmarked_age_1_returned_as_new; } + + // Returns true if the used portion of "_markedRegions" is properly + // sorted, otherwise asserts false. +#ifndef PRODUCT + bool verify(void); + bool regionProperlyOrdered(HeapRegion* r) { + int si = r->sort_index(); + return (si == -1) || + (si > -1 && _markedRegions.at(si) == r) || + (si < -1 && _cache.region_in_cache(r)); + } +#endif + +}; diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp new file mode 100644 index 00000000000..2eb2bc0ca69 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp @@ -0,0 +1,355 @@ +/* + * Copyright 2001-2007 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. + * + */ + +#include "incls/_precompiled.incl" +#include "incls/_concurrentG1Refine.cpp.incl" + +bool ConcurrentG1Refine::_enabled = false; + +ConcurrentG1Refine::ConcurrentG1Refine() : + _pya(PYA_continue), _last_pya(PYA_continue), + _last_cards_during(), _first_traversal(false), + _card_counts(NULL), _cur_card_count_histo(NULL), _cum_card_count_histo(NULL), + _hot_cache(NULL), + _def_use_cache(false), _use_cache(false), + _n_periods(0), _total_cards(0), _total_travs(0) +{ + if (G1ConcRefine) { + _cg1rThread = new ConcurrentG1RefineThread(this); + assert(cg1rThread() != NULL, "Conc refine should have been created"); + assert(cg1rThread()->cg1r() == this, + "Conc refine thread should refer to this"); + } else { + _cg1rThread = NULL; + } +} + +void ConcurrentG1Refine::init() { + if (G1ConcRSLogCacheSize > 0 || G1ConcRSCountTraversals) { + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + _n_card_counts = + (unsigned) (g1h->g1_reserved_obj_bytes() >> CardTableModRefBS::card_shift); + _card_counts = NEW_C_HEAP_ARRAY(unsigned char, _n_card_counts); + for (size_t i = 0; i < _n_card_counts; i++) _card_counts[i] = 0; + ModRefBarrierSet* bs = g1h->mr_bs(); + guarantee(bs->is_a(BarrierSet::CardTableModRef), "Precondition"); + CardTableModRefBS* ctbs = (CardTableModRefBS*)bs; + _ct_bot = ctbs->byte_for_const(g1h->reserved_region().start()); + if (G1ConcRSCountTraversals) { + _cur_card_count_histo = NEW_C_HEAP_ARRAY(unsigned, 256); + _cum_card_count_histo = NEW_C_HEAP_ARRAY(unsigned, 256); + for (int i = 0; i < 256; i++) { + _cur_card_count_histo[i] = 0; + _cum_card_count_histo[i] = 0; + } + } + } + if (G1ConcRSLogCacheSize > 0) { + _def_use_cache = true; + _use_cache = true; + _hot_cache_size = (1 << G1ConcRSLogCacheSize); + _hot_cache = NEW_C_HEAP_ARRAY(jbyte*, _hot_cache_size); + _n_hot = 0; + _hot_cache_idx = 0; + } +} + +ConcurrentG1Refine::~ConcurrentG1Refine() { + if (G1ConcRSLogCacheSize > 0 || G1ConcRSCountTraversals) { + assert(_card_counts != NULL, "Logic"); + FREE_C_HEAP_ARRAY(unsigned char, _card_counts); + assert(_cur_card_count_histo != NULL, "Logic"); + FREE_C_HEAP_ARRAY(unsigned, _cur_card_count_histo); + assert(_cum_card_count_histo != NULL, "Logic"); + FREE_C_HEAP_ARRAY(unsigned, _cum_card_count_histo); + } + if (G1ConcRSLogCacheSize > 0) { + assert(_hot_cache != NULL, "Logic"); + FREE_C_HEAP_ARRAY(jbyte*, _hot_cache); + } +} + +bool ConcurrentG1Refine::refine() { + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + unsigned cards_before = g1h->g1_rem_set()->conc_refine_cards(); + clear_hot_cache(); // Any previous values in this are now invalid. + g1h->g1_rem_set()->concurrentRefinementPass(this); + _traversals++; + unsigned cards_after = g1h->g1_rem_set()->conc_refine_cards(); + unsigned cards_during = cards_after-cards_before; + // If this is the first traversal in the current enabling + // and we did some cards, or if the number of cards found is decreasing + // sufficiently quickly, then keep going. Otherwise, sleep a while. + bool res = + (_first_traversal && cards_during > 0) + || + (!_first_traversal && cards_during * 3 < _last_cards_during * 2); + _last_cards_during = cards_during; + _first_traversal = false; + return res; +} + +void ConcurrentG1Refine::enable() { + MutexLocker x(G1ConcRefine_mon); + if (!_enabled) { + _enabled = true; + _first_traversal = true; _last_cards_during = 0; + G1ConcRefine_mon->notify_all(); + } +} + +unsigned ConcurrentG1Refine::disable() { + MutexLocker x(G1ConcRefine_mon); + if (_enabled) { + _enabled = false; + return _traversals; + } else { + return 0; + } +} + +void ConcurrentG1Refine::wait_for_ConcurrentG1Refine_enabled() { + G1ConcRefine_mon->lock(); + while (!_enabled) { + G1ConcRefine_mon->wait(Mutex::_no_safepoint_check_flag); + } + G1ConcRefine_mon->unlock(); + _traversals = 0; +}; + +void ConcurrentG1Refine::set_pya_restart() { + // If we're using the log-based RS barrier, the above will cause + // in-progress traversals of completed log buffers to quit early; we will + // also abandon all other buffers. + if (G1RSBarrierUseQueue) { + DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set(); + dcqs.abandon_logs(); + if (_cg1rThread->do_traversal()) { + _pya = PYA_restart; + } else { + _cg1rThread->set_do_traversal(true); + // Reset the post-yield actions. + _pya = PYA_continue; + _last_pya = PYA_continue; + } + } else { + _pya = PYA_restart; + } +} + +void ConcurrentG1Refine::set_pya_cancel() { + _pya = PYA_cancel; +} + +PostYieldAction ConcurrentG1Refine::get_pya() { + if (_pya != PYA_continue) { + jint val = _pya; + while (true) { + jint val_read = Atomic::cmpxchg(PYA_continue, &_pya, val); + if (val_read == val) { + PostYieldAction res = (PostYieldAction)val; + assert(res != PYA_continue, "Only the refine thread should reset."); + _last_pya = res; + return res; + } else { + val = val_read; + } + } + } + // QQQ WELL WHAT DO WE RETURN HERE??? + // make up something! + return PYA_continue; +} + +PostYieldAction ConcurrentG1Refine::get_last_pya() { + PostYieldAction res = _last_pya; + _last_pya = PYA_continue; + return res; +} + +bool ConcurrentG1Refine::do_traversal() { + return _cg1rThread->do_traversal(); +} + +int ConcurrentG1Refine::add_card_count(jbyte* card_ptr) { + size_t card_num = (card_ptr - _ct_bot); + guarantee(0 <= card_num && card_num < _n_card_counts, "Bounds"); + unsigned char cnt = _card_counts[card_num]; + if (cnt < 255) _card_counts[card_num]++; + return cnt; + _total_travs++; +} + +jbyte* ConcurrentG1Refine::cache_insert(jbyte* card_ptr) { + int count = add_card_count(card_ptr); + // Count previously unvisited cards. + if (count == 0) _total_cards++; + // We'll assume a traversal unless we store it in the cache. + if (count < G1ConcRSHotCardLimit) { + _total_travs++; + return card_ptr; + } + // Otherwise, it's hot. + jbyte* res = NULL; + MutexLockerEx x(HotCardCache_lock, Mutex::_no_safepoint_check_flag); + if (_n_hot == _hot_cache_size) { + _total_travs++; + res = _hot_cache[_hot_cache_idx]; + _n_hot--; + } + // Now _n_hot < _hot_cache_size, and we can insert at _hot_cache_idx. + _hot_cache[_hot_cache_idx] = card_ptr; + _hot_cache_idx++; + if (_hot_cache_idx == _hot_cache_size) _hot_cache_idx = 0; + _n_hot++; + return res; +} + + +void ConcurrentG1Refine::clean_up_cache(int worker_i, G1RemSet* g1rs) { + assert(!use_cache(), "cache should be disabled"); + int start_ind = _hot_cache_idx-1; + for (int i = 0; i < _n_hot; i++) { + int ind = start_ind - i; + if (ind < 0) ind = ind + _hot_cache_size; + jbyte* entry = _hot_cache[ind]; + if (entry != NULL) { + g1rs->concurrentRefineOneCard(entry, worker_i); + } + } + _n_hot = 0; + _hot_cache_idx = 0; +} + +void ConcurrentG1Refine::clear_and_record_card_counts() { + if (G1ConcRSLogCacheSize == 0 && !G1ConcRSCountTraversals) return; + _n_periods++; + if (G1ConcRSCountTraversals) { + for (size_t i = 0; i < _n_card_counts; i++) { + unsigned char bucket = _card_counts[i]; + _cur_card_count_histo[bucket]++; + _card_counts[i] = 0; + } + gclog_or_tty->print_cr("Card counts:"); + for (int i = 0; i < 256; i++) { + if (_cur_card_count_histo[i] > 0) { + gclog_or_tty->print_cr(" %3d: %9d", i, _cur_card_count_histo[i]); + _cum_card_count_histo[i] += _cur_card_count_histo[i]; + _cur_card_count_histo[i] = 0; + } + } + } else { + assert(G1ConcRSLogCacheSize > 0, "Logic"); + Copy::fill_to_words((HeapWord*)(&_card_counts[0]), + _n_card_counts / HeapWordSize); + } +} + +void +ConcurrentG1Refine:: +print_card_count_histo_range(unsigned* histo, int from, int to, + float& cum_card_pct, + float& cum_travs_pct) { + unsigned cards = 0; + unsigned travs = 0; + guarantee(to <= 256, "Precondition"); + for (int i = from; i < to-1; i++) { + cards += histo[i]; + travs += histo[i] * i; + } + if (to == 256) { + unsigned histo_card_sum = 0; + unsigned histo_trav_sum = 0; + for (int i = 1; i < 255; i++) { + histo_trav_sum += histo[i] * i; + } + cards += histo[255]; + // correct traversals for the last one. + unsigned travs_255 = (unsigned) (_total_travs - histo_trav_sum); + travs += travs_255; + + } else { + cards += histo[to-1]; + travs += histo[to-1] * (to-1); + } + float fperiods = (float)_n_periods; + float f_tot_cards = (float)_total_cards/fperiods; + float f_tot_travs = (float)_total_travs/fperiods; + if (cards > 0) { + float fcards = (float)cards/fperiods; + float ftravs = (float)travs/fperiods; + if (to == 256) { + gclog_or_tty->print(" %4d- %10.2f%10.2f", from, fcards, ftravs); + } else { + gclog_or_tty->print(" %4d-%4d %10.2f%10.2f", from, to-1, fcards, ftravs); + } + float pct_cards = fcards*100.0/f_tot_cards; + cum_card_pct += pct_cards; + float pct_travs = ftravs*100.0/f_tot_travs; + cum_travs_pct += pct_travs; + gclog_or_tty->print_cr("%10.2f%10.2f%10.2f%10.2f", + pct_cards, cum_card_pct, + pct_travs, cum_travs_pct); + } +} + +void ConcurrentG1Refine::print_final_card_counts() { + if (!G1ConcRSCountTraversals) return; + + gclog_or_tty->print_cr("Did %d total traversals of %d distinct cards.", + _total_travs, _total_cards); + float fperiods = (float)_n_periods; + gclog_or_tty->print_cr(" This is an average of %8.2f traversals, %8.2f cards, " + "per collection.", (float)_total_travs/fperiods, + (float)_total_cards/fperiods); + gclog_or_tty->print_cr(" This is an average of %8.2f traversals/distinct " + "dirty card.\n", + _total_cards > 0 ? + (float)_total_travs/(float)_total_cards : 0.0); + + + gclog_or_tty->print_cr("Histogram:\n\n%10s %10s%10s%10s%10s%10s%10s", + "range", "# cards", "# travs", "% cards", "(cum)", + "% travs", "(cum)"); + gclog_or_tty->print_cr("------------------------------------------------------------" + "-------------"); + float cum_cards_pct = 0.0; + float cum_travs_pct = 0.0; + for (int i = 1; i < 10; i++) { + print_card_count_histo_range(_cum_card_count_histo, i, i+1, + cum_cards_pct, cum_travs_pct); + } + for (int i = 10; i < 100; i += 10) { + print_card_count_histo_range(_cum_card_count_histo, i, i+10, + cum_cards_pct, cum_travs_pct); + } + print_card_count_histo_range(_cum_card_count_histo, 100, 150, + cum_cards_pct, cum_travs_pct); + print_card_count_histo_range(_cum_card_count_histo, 150, 200, + cum_cards_pct, cum_travs_pct); + print_card_count_histo_range(_cum_card_count_histo, 150, 255, + cum_cards_pct, cum_travs_pct); + print_card_count_histo_range(_cum_card_count_histo, 255, 256, + cum_cards_pct, cum_travs_pct); +} diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.hpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.hpp new file mode 100644 index 00000000000..ea9a997d7a6 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.hpp @@ -0,0 +1,132 @@ +/* + * Copyright 2001-2007 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. + * + */ + +// Forward decl +class ConcurrentG1RefineThread; +class G1RemSet; + +// What to do after a yield: +enum PostYieldAction { + PYA_continue, // Continue the traversal + PYA_restart, // Restart + PYA_cancel // It's been completed by somebody else: cancel. +}; + +class ConcurrentG1Refine { + ConcurrentG1RefineThread* _cg1rThread; + + volatile jint _pya; + PostYieldAction _last_pya; + + static bool _enabled; // Protected by G1ConcRefine_mon. + unsigned _traversals; + + // Number of cards processed during last refinement traversal. + unsigned _first_traversal; + unsigned _last_cards_during; + + // The cache for card refinement. + bool _use_cache; + bool _def_use_cache; + size_t _n_periods; + size_t _total_cards; + size_t _total_travs; + + unsigned char* _card_counts; + unsigned _n_card_counts; + const jbyte* _ct_bot; + unsigned* _cur_card_count_histo; + unsigned* _cum_card_count_histo; + jbyte** _hot_cache; + int _hot_cache_size; + int _n_hot; + int _hot_cache_idx; + + // Returns the count of this card after incrementing it. + int add_card_count(jbyte* card_ptr); + + void print_card_count_histo_range(unsigned* histo, int from, int to, + float& cum_card_pct, + float& cum_travs_pct); + public: + ConcurrentG1Refine(); + ~ConcurrentG1Refine(); + + void init(); // Accomplish some initialization that has to wait. + + // Enabled Conc refinement, waking up thread if necessary. + void enable(); + + // Returns the number of traversals performed since this refiner was enabled. + unsigned disable(); + + // Requires G1ConcRefine_mon to be held. + bool enabled() { return _enabled; } + + // Returns only when G1 concurrent refinement has been enabled. + void wait_for_ConcurrentG1Refine_enabled(); + + // Do one concurrent refinement pass over the card table. Returns "true" + // if heuristics determine that another pass should be done immediately. + bool refine(); + + // Indicate that an in-progress refinement pass should start over. + void set_pya_restart(); + // Indicate that an in-progress refinement pass should quit. + void set_pya_cancel(); + + // Get the appropriate post-yield action. Also sets last_pya. + PostYieldAction get_pya(); + + // The last PYA read by "get_pya". + PostYieldAction get_last_pya(); + + bool do_traversal(); + + ConcurrentG1RefineThread* cg1rThread() { return _cg1rThread; } + + // If this is the first entry for the slot, writes into the cache and + // returns NULL. If it causes an eviction, returns the evicted pointer. + // Otherwise, its a cache hit, and returns NULL. + jbyte* cache_insert(jbyte* card_ptr); + + // Process the cached entries. + void clean_up_cache(int worker_i, G1RemSet* g1rs); + + // Discard entries in the hot cache. + void clear_hot_cache() { + _hot_cache_idx = 0; _n_hot = 0; + } + + bool hot_cache_is_empty() { return _n_hot == 0; } + + bool use_cache() { return _use_cache; } + void set_use_cache(bool b) { + if (b) _use_cache = _def_use_cache; + else _use_cache = false; + } + + void clear_and_record_card_counts(); + void print_final_card_counts(); +}; diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentG1RefineThread.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1RefineThread.cpp new file mode 100644 index 00000000000..110c08327c3 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1RefineThread.cpp @@ -0,0 +1,246 @@ +/* + * Copyright 2001-2007 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. + * + */ + +#include "incls/_precompiled.incl" +#include "incls/_concurrentG1RefineThread.cpp.incl" + +// ======= Concurrent Mark Thread ======== + +// The CM thread is created when the G1 garbage collector is used + +ConcurrentG1RefineThread:: +ConcurrentG1RefineThread(ConcurrentG1Refine* cg1r) : + ConcurrentGCThread(), + _cg1r(cg1r), + _started(false), + _in_progress(false), + _do_traversal(false), + _vtime_accum(0.0), + _co_tracker(G1CRGroup), + _interval_ms(5.0) +{ + create_and_start(); +} + +const long timeout = 200; // ms. + +void ConcurrentG1RefineThread::traversalBasedRefinement() { + _cg1r->wait_for_ConcurrentG1Refine_enabled(); + MutexLocker x(G1ConcRefine_mon); + while (_cg1r->enabled()) { + MutexUnlocker ux(G1ConcRefine_mon); + ResourceMark rm; + HandleMark hm; + + if (TraceG1Refine) gclog_or_tty->print_cr("G1-Refine starting pass"); + _sts.join(); + bool no_sleep = _cg1r->refine(); + _sts.leave(); + if (!no_sleep) { + MutexLockerEx x(CGC_lock, Mutex::_no_safepoint_check_flag); + // We do this only for the timeout; we don't expect this to be signalled. + CGC_lock->wait(Mutex::_no_safepoint_check_flag, timeout); + } + } +} + +void ConcurrentG1RefineThread::queueBasedRefinement() { + DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set(); + // Wait for completed log buffers to exist. + { + MutexLockerEx x(DirtyCardQ_CBL_mon, Mutex::_no_safepoint_check_flag); + while (!_do_traversal && !dcqs.process_completed_buffers() && + !_should_terminate) { + DirtyCardQ_CBL_mon->wait(Mutex::_no_safepoint_check_flag); + } + } + + if (_should_terminate) { + return; + } + + // Now we take them off (this doesn't hold locks while it applies + // closures.) (If we did a full collection, then we'll do a full + // traversal. + _sts.join(); + if (_do_traversal) { + (void)_cg1r->refine(); + switch (_cg1r->get_last_pya()) { + case PYA_cancel: case PYA_continue: + // Continue was caught and handled inside "refine". If it's still + // "continue" when we get here, we're done. + _do_traversal = false; + break; + case PYA_restart: + assert(_do_traversal, "Because of Full GC."); + break; + } + } else { + int n_logs = 0; + int lower_limit = 0; + double start_vtime_sec; // only used when G1SmoothConcRefine is on + int prev_buffer_num; // only used when G1SmoothConcRefine is on + + if (G1SmoothConcRefine) { + lower_limit = 0; + start_vtime_sec = os::elapsedVTime(); + prev_buffer_num = (int) dcqs.completed_buffers_num(); + } else { + lower_limit = DCQBarrierProcessCompletedThreshold / 4; // For now. + } + while (dcqs.apply_closure_to_completed_buffer(0, lower_limit)) { + double end_vtime_sec; + double elapsed_vtime_sec; + int elapsed_vtime_ms; + int curr_buffer_num; + + if (G1SmoothConcRefine) { + end_vtime_sec = os::elapsedVTime(); + elapsed_vtime_sec = end_vtime_sec - start_vtime_sec; + elapsed_vtime_ms = (int) (elapsed_vtime_sec * 1000.0); + curr_buffer_num = (int) dcqs.completed_buffers_num(); + + if (curr_buffer_num > prev_buffer_num || + curr_buffer_num > DCQBarrierProcessCompletedThreshold) { + decreaseInterval(elapsed_vtime_ms); + } else if (curr_buffer_num < prev_buffer_num) { + increaseInterval(elapsed_vtime_ms); + } + } + + sample_young_list_rs_lengths(); + _co_tracker.update(false); + + if (G1SmoothConcRefine) { + start_vtime_sec = os::elapsedVTime(); + prev_buffer_num = curr_buffer_num; + + _sts.leave(); + os::sleep(Thread::current(), (jlong) _interval_ms, false); + _sts.join(); + } + + n_logs++; + } + // Make sure we harvest the PYA, if any. + (void)_cg1r->get_pya(); + } + _sts.leave(); +} + +void ConcurrentG1RefineThread::sample_young_list_rs_lengths() { + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + G1CollectorPolicy* g1p = g1h->g1_policy(); + if (g1p->adaptive_young_list_length()) { + int regions_visited = 0; + + g1h->young_list_rs_length_sampling_init(); + while (g1h->young_list_rs_length_sampling_more()) { + g1h->young_list_rs_length_sampling_next(); + ++regions_visited; + + // we try to yield every time we visit 10 regions + if (regions_visited == 10) { + if (_sts.should_yield()) { + _sts.yield("G1 refine"); + // we just abandon the iteration + break; + } + regions_visited = 0; + } + } + + g1p->check_prediction_validity(); + } +} + +void ConcurrentG1RefineThread::run() { + initialize_in_thread(); + _vtime_start = os::elapsedVTime(); + wait_for_universe_init(); + + _co_tracker.enable(); + _co_tracker.start(); + + while (!_should_terminate) { + // wait until started is set. + if (G1RSBarrierUseQueue) { + queueBasedRefinement(); + } else { + traversalBasedRefinement(); + } + _sts.join(); + _co_tracker.update(); + _sts.leave(); + if (os::supports_vtime()) { + _vtime_accum = (os::elapsedVTime() - _vtime_start); + } else { + _vtime_accum = 0.0; + } + } + _sts.join(); + _co_tracker.update(true); + _sts.leave(); + assert(_should_terminate, "just checking"); + + terminate(); +} + + +void ConcurrentG1RefineThread::yield() { + if (TraceG1Refine) gclog_or_tty->print_cr("G1-Refine-yield"); + _sts.yield("G1 refine"); + if (TraceG1Refine) gclog_or_tty->print_cr("G1-Refine-yield-end"); +} + +void ConcurrentG1RefineThread::stop() { + // it is ok to take late safepoints here, if needed + { + MutexLockerEx mu(Terminator_lock); + _should_terminate = true; + } + + { + MutexLockerEx x(DirtyCardQ_CBL_mon, Mutex::_no_safepoint_check_flag); + DirtyCardQ_CBL_mon->notify_all(); + } + + { + MutexLockerEx mu(Terminator_lock); + while (!_has_terminated) { + Terminator_lock->wait(); + } + } + if (TraceG1Refine) gclog_or_tty->print_cr("G1-Refine-stop"); +} + +void ConcurrentG1RefineThread::print() { + gclog_or_tty->print("\"Concurrent G1 Refinement Thread\" "); + Thread::print(); + gclog_or_tty->cr(); +} + +void ConcurrentG1RefineThread::set_do_traversal(bool b) { + _do_traversal = b; +} diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentG1RefineThread.hpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1RefineThread.hpp new file mode 100644 index 00000000000..69f272c7895 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1RefineThread.hpp @@ -0,0 +1,104 @@ +/* + * Copyright 2001-2007 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. + * + */ + +// Forward Decl. +class ConcurrentG1Refine; + +// The G1 Concurrent Refinement Thread (could be several in the future). + +class ConcurrentG1RefineThread: public ConcurrentGCThread { + friend class VMStructs; + friend class G1CollectedHeap; + + double _vtime_start; // Initial virtual time. + double _vtime_accum; // Initial virtual time. + + public: + virtual void run(); + + private: + ConcurrentG1Refine* _cg1r; + bool _started; + bool _in_progress; + volatile bool _restart; + + COTracker _co_tracker; + double _interval_ms; + + bool _do_traversal; + + void decreaseInterval(int processing_time_ms) { + double min_interval_ms = (double) processing_time_ms; + _interval_ms = 0.8 * _interval_ms; + if (_interval_ms < min_interval_ms) + _interval_ms = min_interval_ms; + } + void increaseInterval(int processing_time_ms) { + double max_interval_ms = 9.0 * (double) processing_time_ms; + _interval_ms = 1.1 * _interval_ms; + if (max_interval_ms > 0 && _interval_ms > max_interval_ms) + _interval_ms = max_interval_ms; + } + + void sleepBeforeNextCycle(); + + void traversalBasedRefinement(); + + void queueBasedRefinement(); + + // For use by G1CollectedHeap, which is a friend. + static SuspendibleThreadSet* sts() { return &_sts; } + + public: + // Constructor + ConcurrentG1RefineThread(ConcurrentG1Refine* cg1r); + + // Printing + void print(); + + // Total virtual time so far. + double vtime_accum() { return _vtime_accum; } + + ConcurrentG1Refine* cg1r() { return _cg1r; } + + + 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_do_traversal(bool b); + bool do_traversal() { return _do_traversal; } + + void sample_young_list_rs_lengths(); + + // Yield for GC + void yield(); + + // shutdown + static void stop(); +}; diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp new file mode 100644 index 00000000000..4200691d4b5 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp @@ -0,0 +1,3957 @@ +/* + * Copyright 2001-2007 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. + * + */ + +#include "incls/_precompiled.incl" +#include "incls/_concurrentMark.cpp.incl" + +// +// CMS Bit Map Wrapper + +CMBitMapRO::CMBitMapRO(ReservedSpace rs, int shifter): + _bm((uintptr_t*)NULL,0), + _shifter(shifter) { + _bmStartWord = (HeapWord*)(rs.base()); + _bmWordSize = rs.size()/HeapWordSize; // rs.size() is in bytes + ReservedSpace brs(ReservedSpace::allocation_align_size_up( + (_bmWordSize >> (_shifter + LogBitsPerByte)) + 1)); + + guarantee(brs.is_reserved(), "couldn't allocate CMS bit map"); + // For now we'll just commit all of the bit map up fromt. + // Later on we'll try to be more parsimonious with swap. + guarantee(_virtual_space.initialize(brs, brs.size()), + "couldn't reseve backing store for CMS bit map"); + assert(_virtual_space.committed_size() == brs.size(), + "didn't reserve backing store for all of CMS bit map?"); + _bm.set_map((uintptr_t*)_virtual_space.low()); + assert(_virtual_space.committed_size() << (_shifter + LogBitsPerByte) >= + _bmWordSize, "inconsistency in bit map sizing"); + _bm.set_size(_bmWordSize >> _shifter); +} + +HeapWord* CMBitMapRO::getNextMarkedWordAddress(HeapWord* addr, + HeapWord* limit) const { + // First we must round addr *up* to a possible object boundary. + addr = (HeapWord*)align_size_up((intptr_t)addr, + HeapWordSize << _shifter); + size_t addrOffset = heapWordToOffset(addr); + if (limit == NULL) limit = _bmStartWord + _bmWordSize; + size_t limitOffset = heapWordToOffset(limit); + size_t nextOffset = _bm.get_next_one_offset(addrOffset, limitOffset); + HeapWord* nextAddr = offsetToHeapWord(nextOffset); + assert(nextAddr >= addr, "get_next_one postcondition"); + assert(nextAddr == limit || isMarked(nextAddr), + "get_next_one postcondition"); + return nextAddr; +} + +HeapWord* CMBitMapRO::getNextUnmarkedWordAddress(HeapWord* addr, + HeapWord* limit) const { + size_t addrOffset = heapWordToOffset(addr); + if (limit == NULL) limit = _bmStartWord + _bmWordSize; + size_t limitOffset = heapWordToOffset(limit); + size_t nextOffset = _bm.get_next_zero_offset(addrOffset, limitOffset); + HeapWord* nextAddr = offsetToHeapWord(nextOffset); + assert(nextAddr >= addr, "get_next_one postcondition"); + assert(nextAddr == limit || !isMarked(nextAddr), + "get_next_one postcondition"); + return nextAddr; +} + +int CMBitMapRO::heapWordDiffToOffsetDiff(size_t diff) const { + assert((diff & ((1 << _shifter) - 1)) == 0, "argument check"); + return (int) (diff >> _shifter); +} + +bool CMBitMapRO::iterate(BitMapClosure* cl, MemRegion mr) { + HeapWord* left = MAX2(_bmStartWord, mr.start()); + HeapWord* right = MIN2(_bmStartWord + _bmWordSize, mr.end()); + if (right > left) { + // Right-open interval [leftOffset, rightOffset). + return _bm.iterate(cl, heapWordToOffset(left), heapWordToOffset(right)); + } else { + return true; + } +} + +void CMBitMapRO::mostly_disjoint_range_union(BitMap* from_bitmap, + size_t from_start_index, + HeapWord* to_start_word, + size_t word_num) { + _bm.mostly_disjoint_range_union(from_bitmap, + from_start_index, + heapWordToOffset(to_start_word), + word_num); +} + +#ifndef PRODUCT +bool CMBitMapRO::covers(ReservedSpace rs) const { + // assert(_bm.map() == _virtual_space.low(), "map inconsistency"); + assert(((size_t)_bm.size() * (1 << _shifter)) == _bmWordSize, + "size inconsistency"); + return _bmStartWord == (HeapWord*)(rs.base()) && + _bmWordSize == rs.size()>>LogHeapWordSize; +} +#endif + +void CMBitMap::clearAll() { + _bm.clear(); + return; +} + +void CMBitMap::markRange(MemRegion mr) { + mr.intersection(MemRegion(_bmStartWord, _bmWordSize)); + assert(!mr.is_empty(), "unexpected empty region"); + assert((offsetToHeapWord(heapWordToOffset(mr.end())) == + ((HeapWord *) mr.end())), + "markRange memory region end is not card aligned"); + // convert address range into offset range + _bm.at_put_range(heapWordToOffset(mr.start()), + heapWordToOffset(mr.end()), true); +} + +void CMBitMap::clearRange(MemRegion mr) { + mr.intersection(MemRegion(_bmStartWord, _bmWordSize)); + assert(!mr.is_empty(), "unexpected empty region"); + // convert address range into offset range + _bm.at_put_range(heapWordToOffset(mr.start()), + heapWordToOffset(mr.end()), false); +} + +MemRegion CMBitMap::getAndClearMarkedRegion(HeapWord* addr, + HeapWord* end_addr) { + HeapWord* start = getNextMarkedWordAddress(addr); + start = MIN2(start, end_addr); + HeapWord* end = getNextUnmarkedWordAddress(start); + end = MIN2(end, end_addr); + assert(start <= end, "Consistency check"); + MemRegion mr(start, end); + if (!mr.is_empty()) { + clearRange(mr); + } + return mr; +} + +CMMarkStack::CMMarkStack(ConcurrentMark* cm) : + _base(NULL), _cm(cm) +#ifdef ASSERT + , _drain_in_progress(false) + , _drain_in_progress_yields(false) +#endif +{} + +void CMMarkStack::allocate(size_t size) { + _base = NEW_C_HEAP_ARRAY(oop, size); + if (_base == NULL) + vm_exit_during_initialization("Failed to allocate " + "CM region mark stack"); + _index = 0; + // QQQQ cast ... + _capacity = (jint) size; + _oops_do_bound = -1; + NOT_PRODUCT(_max_depth = 0); +} + +CMMarkStack::~CMMarkStack() { + if (_base != NULL) FREE_C_HEAP_ARRAY(oop, _base); +} + +void CMMarkStack::par_push(oop ptr) { + while (true) { + if (isFull()) { + _overflow = true; + return; + } + // Otherwise... + jint index = _index; + jint next_index = index+1; + jint res = Atomic::cmpxchg(next_index, &_index, index); + if (res == index) { + _base[index] = ptr; + // Note that we don't maintain this atomically. We could, but it + // doesn't seem necessary. + NOT_PRODUCT(_max_depth = MAX2(_max_depth, next_index)); + return; + } + // Otherwise, we need to try again. + } +} + +void CMMarkStack::par_adjoin_arr(oop* ptr_arr, int n) { + while (true) { + if (isFull()) { + _overflow = true; + return; + } + // Otherwise... + jint index = _index; + jint next_index = index + n; + if (next_index > _capacity) { + _overflow = true; + return; + } + jint res = Atomic::cmpxchg(next_index, &_index, index); + if (res == index) { + for (int i = 0; i < n; i++) { + int ind = index + i; + assert(ind < _capacity, "By overflow test above."); + _base[ind] = ptr_arr[i]; + } + NOT_PRODUCT(_max_depth = MAX2(_max_depth, next_index)); + return; + } + // Otherwise, we need to try again. + } +} + + +void CMMarkStack::par_push_arr(oop* ptr_arr, int n) { + MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag); + jint start = _index; + jint next_index = start + n; + if (next_index > _capacity) { + _overflow = true; + return; + } + // Otherwise. + _index = next_index; + for (int i = 0; i < n; i++) { + int ind = start + i; + guarantee(ind < _capacity, "By overflow test above."); + _base[ind] = ptr_arr[i]; + } +} + + +bool CMMarkStack::par_pop_arr(oop* ptr_arr, int max, int* n) { + MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag); + jint index = _index; + if (index == 0) { + *n = 0; + return false; + } else { + int k = MIN2(max, index); + jint new_ind = index - k; + for (int j = 0; j < k; j++) { + ptr_arr[j] = _base[new_ind + j]; + } + _index = new_ind; + *n = k; + return true; + } +} + + +CMRegionStack::CMRegionStack() : _base(NULL) {} + +void CMRegionStack::allocate(size_t size) { + _base = NEW_C_HEAP_ARRAY(MemRegion, size); + if (_base == NULL) + vm_exit_during_initialization("Failed to allocate " + "CM region mark stack"); + _index = 0; + // QQQQ cast ... + _capacity = (jint) size; +} + +CMRegionStack::~CMRegionStack() { + if (_base != NULL) FREE_C_HEAP_ARRAY(oop, _base); +} + +void CMRegionStack::push(MemRegion mr) { + assert(mr.word_size() > 0, "Precondition"); + while (true) { + if (isFull()) { + _overflow = true; + return; + } + // Otherwise... + jint index = _index; + jint next_index = index+1; + jint res = Atomic::cmpxchg(next_index, &_index, index); + if (res == index) { + _base[index] = mr; + return; + } + // Otherwise, we need to try again. + } +} + +MemRegion CMRegionStack::pop() { + while (true) { + // Otherwise... + jint index = _index; + + if (index == 0) { + return MemRegion(); + } + jint next_index = index-1; + jint res = Atomic::cmpxchg(next_index, &_index, index); + if (res == index) { + MemRegion mr = _base[next_index]; + if (mr.start() != NULL) { + tmp_guarantee_CM( mr.end() != NULL, "invariant" ); + tmp_guarantee_CM( mr.word_size() > 0, "invariant" ); + return mr; + } else { + // that entry was invalidated... let's skip it + tmp_guarantee_CM( mr.end() == NULL, "invariant" ); + } + } + // Otherwise, we need to try again. + } +} + +bool CMRegionStack::invalidate_entries_into_cset() { + bool result = false; + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + for (int i = 0; i < _oops_do_bound; ++i) { + MemRegion mr = _base[i]; + if (mr.start() != NULL) { + tmp_guarantee_CM( mr.end() != NULL, "invariant"); + tmp_guarantee_CM( mr.word_size() > 0, "invariant" ); + HeapRegion* hr = g1h->heap_region_containing(mr.start()); + tmp_guarantee_CM( hr != NULL, "invariant" ); + if (hr->in_collection_set()) { + // The region points into the collection set + _base[i] = MemRegion(); + result = true; + } + } else { + // that entry was invalidated... let's skip it + tmp_guarantee_CM( mr.end() == NULL, "invariant" ); + } + } + return result; +} + +template +bool CMMarkStack::drain(OopClosureClass* cl, CMBitMap* bm, bool yield_after) { + assert(!_drain_in_progress || !_drain_in_progress_yields || yield_after + || SafepointSynchronize::is_at_safepoint(), + "Drain recursion must be yield-safe."); + bool res = true; + debug_only(_drain_in_progress = true); + debug_only(_drain_in_progress_yields = yield_after); + while (!isEmpty()) { + oop newOop = pop(); + assert(G1CollectedHeap::heap()->is_in_reserved(newOop), "Bad pop"); + assert(newOop->is_oop(), "Expected an oop"); + assert(bm == NULL || bm->isMarked((HeapWord*)newOop), + "only grey objects on this stack"); + // iterate over the oops in this oop, marking and pushing + // the ones in CMS generation. + newOop->oop_iterate(cl); + if (yield_after && _cm->do_yield_check()) { + res = false; break; + } + } + debug_only(_drain_in_progress = false); + return res; +} + +void CMMarkStack::oops_do(OopClosure* f) { + if (_index == 0) return; + assert(_oops_do_bound != -1 && _oops_do_bound <= _index, + "Bound must be set."); + for (int i = 0; i < _oops_do_bound; i++) { + f->do_oop(&_base[i]); + } + _oops_do_bound = -1; +} + +bool ConcurrentMark::not_yet_marked(oop obj) const { + return (_g1h->is_obj_ill(obj) + || (_g1h->is_in_permanent(obj) + && !nextMarkBitMap()->isMarked((HeapWord*)obj))); +} + +#ifdef _MSC_VER // the use of 'this' below gets a warning, make it go away +#pragma warning( disable:4355 ) // 'this' : used in base member initializer list +#endif // _MSC_VER + +ConcurrentMark::ConcurrentMark(ReservedSpace rs, + int max_regions) : + _markBitMap1(rs, MinObjAlignment - 1), + _markBitMap2(rs, MinObjAlignment - 1), + + _parallel_marking_threads(0), + _sleep_factor(0.0), + _marking_task_overhead(1.0), + _cleanup_sleep_factor(0.0), + _cleanup_task_overhead(1.0), + _region_bm(max_regions, false /* in_resource_area*/), + _card_bm((rs.size() + CardTableModRefBS::card_size - 1) >> + CardTableModRefBS::card_shift, + false /* in_resource_area*/), + _prevMarkBitMap(&_markBitMap1), + _nextMarkBitMap(&_markBitMap2), + _at_least_one_mark_complete(false), + + _markStack(this), + _regionStack(), + // _finger set in set_non_marking_state + + _max_task_num(MAX2(ParallelGCThreads, (size_t)1)), + // _active_tasks set in set_non_marking_state + // _tasks set inside the constructor + _task_queues(new CMTaskQueueSet((int) _max_task_num)), + _terminator(ParallelTaskTerminator((int) _max_task_num, _task_queues)), + + _has_overflown(false), + _concurrent(false), + + // _verbose_level set below + + _init_times(), + _remark_times(), _remark_mark_times(), _remark_weak_ref_times(), + _cleanup_times(), + _total_counting_time(0.0), + _total_rs_scrub_time(0.0), + + _parallel_workers(NULL), + _cleanup_co_tracker(G1CLGroup) +{ + CMVerboseLevel verbose_level = + (CMVerboseLevel) G1MarkingVerboseLevel; + if (verbose_level < no_verbose) + verbose_level = no_verbose; + if (verbose_level > high_verbose) + verbose_level = high_verbose; + _verbose_level = verbose_level; + + if (verbose_low()) + gclog_or_tty->print_cr("[global] init, heap start = "PTR_FORMAT", " + "heap end = "PTR_FORMAT, _heap_start, _heap_end); + + _markStack.allocate(G1CMStackSize); + _regionStack.allocate(G1CMRegionStackSize); + + // Create & start a ConcurrentMark thread. + if (G1ConcMark) { + _cmThread = new ConcurrentMarkThread(this); + assert(cmThread() != NULL, "CM Thread should have been created"); + assert(cmThread()->cm() != NULL, "CM Thread should refer to this cm"); + } else { + _cmThread = NULL; + } + _g1h = G1CollectedHeap::heap(); + assert(CGC_lock != NULL, "Where's the CGC_lock?"); + assert(_markBitMap1.covers(rs), "_markBitMap1 inconsistency"); + assert(_markBitMap2.covers(rs), "_markBitMap2 inconsistency"); + + SATBMarkQueueSet& satb_qs = JavaThread::satb_mark_queue_set(); + satb_qs.set_buffer_size(G1SATBLogBufferSize); + + int size = (int) MAX2(ParallelGCThreads, (size_t)1); + _par_cleanup_thread_state = NEW_C_HEAP_ARRAY(ParCleanupThreadState*, size); + for (int i = 0 ; i < size; i++) { + _par_cleanup_thread_state[i] = new ParCleanupThreadState; + } + + _tasks = NEW_C_HEAP_ARRAY(CMTask*, _max_task_num); + _accum_task_vtime = NEW_C_HEAP_ARRAY(double, _max_task_num); + + // so that the assertion in MarkingTaskQueue::task_queue doesn't fail + _active_tasks = _max_task_num; + for (int i = 0; i < (int) _max_task_num; ++i) { + CMTaskQueue* task_queue = new CMTaskQueue(); + task_queue->initialize(); + _task_queues->register_queue(i, task_queue); + + _tasks[i] = new CMTask(i, this, task_queue, _task_queues); + _accum_task_vtime[i] = 0.0; + } + + if (ParallelMarkingThreads > ParallelGCThreads) { + vm_exit_during_initialization("Can't have more ParallelMarkingThreads " + "than ParallelGCThreads."); + } + if (ParallelGCThreads == 0) { + // if we are not running with any parallel GC threads we will not + // spawn any marking threads either + _parallel_marking_threads = 0; + _sleep_factor = 0.0; + _marking_task_overhead = 1.0; + } else { + if (ParallelMarkingThreads > 0) { + // notice that ParallelMarkingThreads overwrites G1MarkingOverheadPerc + // if both are set + + _parallel_marking_threads = ParallelMarkingThreads; + _sleep_factor = 0.0; + _marking_task_overhead = 1.0; + } else if (G1MarkingOverheadPerc > 0) { + // we will calculate the number of parallel marking threads + // based on a target overhead with respect to the soft real-time + // goal + + double marking_overhead = (double) G1MarkingOverheadPerc / 100.0; + double overall_cm_overhead = + (double) G1MaxPauseTimeMS * marking_overhead / (double) G1TimeSliceMS; + double cpu_ratio = 1.0 / (double) os::processor_count(); + double marking_thread_num = ceil(overall_cm_overhead / cpu_ratio); + double marking_task_overhead = + overall_cm_overhead / marking_thread_num * + (double) os::processor_count(); + double sleep_factor = + (1.0 - marking_task_overhead) / marking_task_overhead; + + _parallel_marking_threads = (size_t) marking_thread_num; + _sleep_factor = sleep_factor; + _marking_task_overhead = marking_task_overhead; + } else { + _parallel_marking_threads = MAX2((ParallelGCThreads + 2) / 4, (size_t)1); + _sleep_factor = 0.0; + _marking_task_overhead = 1.0; + } + + if (parallel_marking_threads() > 1) + _cleanup_task_overhead = 1.0; + else + _cleanup_task_overhead = marking_task_overhead(); + _cleanup_sleep_factor = + (1.0 - cleanup_task_overhead()) / cleanup_task_overhead(); + +#if 0 + gclog_or_tty->print_cr("Marking Threads %d", parallel_marking_threads()); + gclog_or_tty->print_cr("CM Marking Task Overhead %1.4lf", marking_task_overhead()); + gclog_or_tty->print_cr("CM Sleep Factor %1.4lf", sleep_factor()); + gclog_or_tty->print_cr("CL Marking Task Overhead %1.4lf", cleanup_task_overhead()); + gclog_or_tty->print_cr("CL Sleep Factor %1.4lf", cleanup_sleep_factor()); +#endif + + guarantee( parallel_marking_threads() > 0, "peace of mind" ); + _parallel_workers = new WorkGang("Parallel Marking Threads", + (int) parallel_marking_threads(), false, true); + if (_parallel_workers == NULL) + vm_exit_during_initialization("Failed necessary allocation."); + } + + // so that the call below can read a sensible value + _heap_start = (HeapWord*) rs.base(); + set_non_marking_state(); +} + +void ConcurrentMark::update_g1_committed(bool force) { + // If concurrent marking is not in progress, then we do not need to + // update _heap_end. This has a subtle and important + // side-effect. Imagine that two evacuation pauses happen between + // marking completion and remark. The first one can grow the + // heap (hence now the finger is below the heap end). Then, the + // second one could unnecessarily push regions on the region + // stack. This causes the invariant that the region stack is empty + // at the beginning of remark to be false. By ensuring that we do + // not observe heap expansions after marking is complete, then we do + // not have this problem. + if (!concurrent_marking_in_progress() && !force) + return; + + MemRegion committed = _g1h->g1_committed(); + tmp_guarantee_CM( committed.start() == _heap_start, + "start shouldn't change" ); + HeapWord* new_end = committed.end(); + if (new_end > _heap_end) { + // The heap has been expanded. + + _heap_end = new_end; + } + // Notice that the heap can also shrink. However, this only happens + // during a Full GC (at least currently) and the entire marking + // phase will bail out and the task will not be restarted. So, let's + // do nothing. +} + +void ConcurrentMark::reset() { + // Starting values for these two. This should be called in a STW + // phase. CM will be notified of any future g1_committed expansions + // will be at the end of evacuation pauses, when tasks are + // inactive. + MemRegion committed = _g1h->g1_committed(); + _heap_start = committed.start(); + _heap_end = committed.end(); + + guarantee( _heap_start != NULL && + _heap_end != NULL && + _heap_start < _heap_end, "heap bounds should look ok" ); + + // reset all the marking data structures and any necessary flags + clear_marking_state(); + + if (verbose_low()) + gclog_or_tty->print_cr("[global] resetting"); + + // We do reset all of them, since different phases will use + // different number of active threads. So, it's easiest to have all + // of them ready. + for (int i = 0; i < (int) _max_task_num; ++i) + _tasks[i]->reset(_nextMarkBitMap); + + // we need this to make sure that the flag is on during the evac + // pause with initial mark piggy-backed + set_concurrent_marking_in_progress(); +} + +void ConcurrentMark::set_phase(size_t active_tasks, bool concurrent) { + guarantee( active_tasks <= _max_task_num, "we should not have more" ); + + _active_tasks = active_tasks; + // Need to update the three data structures below according to the + // number of active threads for this phase. + _terminator = ParallelTaskTerminator((int) active_tasks, _task_queues); + _first_overflow_barrier_sync.set_n_workers((int) active_tasks); + _second_overflow_barrier_sync.set_n_workers((int) active_tasks); + + _concurrent = concurrent; + // We propagate this to all tasks, not just the active ones. + for (int i = 0; i < (int) _max_task_num; ++i) + _tasks[i]->set_concurrent(concurrent); + + if (concurrent) { + set_concurrent_marking_in_progress(); + } else { + // We currently assume that the concurrent flag has been set to + // false before we start remark. At this point we should also be + // in a STW phase. + guarantee( !concurrent_marking_in_progress(), "invariant" ); + guarantee( _finger == _heap_end, "only way to get here" ); + update_g1_committed(true); + } +} + +void ConcurrentMark::set_non_marking_state() { + // We set the global marking state to some default values when we're + // not doing marking. + clear_marking_state(); + _active_tasks = 0; + clear_concurrent_marking_in_progress(); +} + +ConcurrentMark::~ConcurrentMark() { + int size = (int) MAX2(ParallelGCThreads, (size_t)1); + for (int i = 0; i < size; i++) delete _par_cleanup_thread_state[i]; + FREE_C_HEAP_ARRAY(ParCleanupThreadState*, + _par_cleanup_thread_state); + + for (int i = 0; i < (int) _max_task_num; ++i) { + delete _task_queues->queue(i); + delete _tasks[i]; + } + delete _task_queues; + FREE_C_HEAP_ARRAY(CMTask*, _max_task_num); +} + +// This closure is used to mark refs into the g1 generation +// from external roots in the CMS bit map. +// Called at the first checkpoint. +// + +#define PRINT_REACHABLE_AT_INITIAL_MARK 0 +#if PRINT_REACHABLE_AT_INITIAL_MARK +static FILE* reachable_file = NULL; + +class PrintReachableClosure: public OopsInGenClosure { + CMBitMap* _bm; + int _level; +public: + PrintReachableClosure(CMBitMap* bm) : + _bm(bm), _level(0) { + guarantee(reachable_file != NULL, "pre-condition"); + } + void do_oop(oop* p) { + oop obj = *p; + HeapWord* obj_addr = (HeapWord*)obj; + if (obj == NULL) return; + fprintf(reachable_file, "%d: "PTR_FORMAT" -> "PTR_FORMAT" (%d)\n", + _level, p, (void*) obj, _bm->isMarked(obj_addr)); + if (!_bm->isMarked(obj_addr)) { + _bm->mark(obj_addr); + _level++; + obj->oop_iterate(this); + _level--; + } + } +}; +#endif // PRINT_REACHABLE_AT_INITIAL_MARK + +#define SEND_HEAP_DUMP_TO_FILE 0 +#if SEND_HEAP_DUMP_TO_FILE +static FILE* heap_dump_file = NULL; +#endif // SEND_HEAP_DUMP_TO_FILE + +void ConcurrentMark::clearNextBitmap() { + guarantee(!G1CollectedHeap::heap()->mark_in_progress(), "Precondition."); + + // 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(); + } +} + +class NoteStartOfMarkHRClosure: public HeapRegionClosure { +public: + bool doHeapRegion(HeapRegion* r) { + if (!r->continuesHumongous()) { + r->note_start_of_marking(true); + } + return false; + } +}; + +void ConcurrentMark::checkpointRootsInitialPre() { + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + G1CollectorPolicy* g1p = g1h->g1_policy(); + + _has_aborted = false; + + // Find all the reachable objects... +#if PRINT_REACHABLE_AT_INITIAL_MARK + guarantee(reachable_file == NULL, "Protocol"); + char fn_buf[100]; + sprintf(fn_buf, "/tmp/reachable.txt.%d", os::current_process_id()); + reachable_file = fopen(fn_buf, "w"); + // clear the mark bitmap (no grey objects to start with) + _nextMarkBitMap->clearAll(); + PrintReachableClosure prcl(_nextMarkBitMap); + g1h->process_strong_roots( + false, // fake perm gen collection + SharedHeap::SO_AllClasses, + &prcl, // Regular roots + &prcl // Perm Gen Roots + ); + // The root iteration above "consumed" dirty cards in the perm gen. + // Therefore, as a shortcut, we dirty all such cards. + g1h->rem_set()->invalidate(g1h->perm_gen()->used_region(), false); + fclose(reachable_file); + reachable_file = NULL; + // clear the mark bitmap again. + _nextMarkBitMap->clearAll(); + COMPILER2_PRESENT(DerivedPointerTable::update_pointers()); + COMPILER2_PRESENT(DerivedPointerTable::clear()); +#endif // PRINT_REACHABLE_AT_INITIAL_MARK + + // Initialise marking structures. This has to be done in a STW phase. + reset(); +} + +class CMMarkRootsClosure: public OopsInGenClosure { +private: + ConcurrentMark* _cm; + G1CollectedHeap* _g1h; + bool _do_barrier; + +public: + CMMarkRootsClosure(ConcurrentMark* cm, + G1CollectedHeap* g1h, + bool do_barrier) : _cm(cm), _g1h(g1h), + _do_barrier(do_barrier) { } + + virtual void do_oop(narrowOop* p) { + guarantee(false, "NYI"); + } + + virtual void do_oop(oop* p) { + oop thisOop = *p; + if (thisOop != NULL) { + assert(thisOop->is_oop() || thisOop->mark() == NULL, + "expected an oop, possibly with mark word displaced"); + HeapWord* addr = (HeapWord*)thisOop; + if (_g1h->is_in_g1_reserved(addr)) { + _cm->grayRoot(thisOop); + } + } + if (_do_barrier) { + assert(!_g1h->is_in_g1_reserved(p), + "Should be called on external roots"); + do_barrier(p); + } + } +}; + +void ConcurrentMark::checkpointRootsInitialPost() { + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + + // For each region note start of marking. + NoteStartOfMarkHRClosure startcl; + g1h->heap_region_iterate(&startcl); + + // Start weak-reference discovery. + ReferenceProcessor* rp = g1h->ref_processor(); + rp->verify_no_references_recorded(); + rp->enable_discovery(); // enable ("weak") refs discovery + + SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set(); + satb_mq_set.set_process_completed_threshold(G1SATBProcessCompletedThreshold); + satb_mq_set.set_active_all_threads(true); + + // update_g1_committed() will be called at the end of an evac pause + // when marking is on. So, it's also called at the end of the + // initial-mark pause to update the heap end, if the heap expands + // during it. No need to call it here. + + guarantee( !_cleanup_co_tracker.enabled(), "invariant" ); + + size_t max_marking_threads = + MAX2((size_t) 1, parallel_marking_threads()); + for (int i = 0; i < (int)_max_task_num; ++i) { + _tasks[i]->enable_co_tracker(); + if (i < (int) max_marking_threads) + _tasks[i]->reset_co_tracker(marking_task_overhead()); + else + _tasks[i]->reset_co_tracker(0.0); + } +} + +// Checkpoint the roots into this generation from outside +// this generation. [Note this initial checkpoint need only +// be approximate -- we'll do a catch up phase subsequently.] +void ConcurrentMark::checkpointRootsInitial() { + assert(SafepointSynchronize::is_at_safepoint(), "world should be stopped"); + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + + double start = os::elapsedTime(); + GCOverheadReporter::recordSTWStart(start); + + // If there has not been a GC[n-1] since last GC[n] cycle completed, + // precede our marking with a collection of all + // younger generations to keep floating garbage to a minimum. + // YSR: we won't do this for now -- it's an optimization to be + // done post-beta. + + // YSR: ignoring weak refs for now; will do at bug fixing stage + // EVM: assert(discoveredRefsAreClear()); + + + G1CollectorPolicy* g1p = G1CollectedHeap::heap()->g1_policy(); + g1p->record_concurrent_mark_init_start(); + checkpointRootsInitialPre(); + + // YSR: when concurrent precleaning is in place, we'll + // need to clear the cached card table here + + ResourceMark rm; + HandleMark hm; + + g1h->ensure_parsability(false); + g1h->perm_gen()->save_marks(); + + CMMarkRootsClosure notOlder(this, g1h, false); + CMMarkRootsClosure older(this, g1h, true); + + g1h->set_marking_started(); + g1h->rem_set()->prepare_for_younger_refs_iterate(false); + + g1h->process_strong_roots(false, // fake perm gen collection + SharedHeap::SO_AllClasses, + ¬Older, // Regular roots + &older // Perm Gen Roots + ); + checkpointRootsInitialPost(); + + // Statistics. + double end = os::elapsedTime(); + _init_times.add((end - start) * 1000.0); + GCOverheadReporter::recordSTWEnd(end); + + g1p->record_concurrent_mark_init_end(); +} + +/* + Notice that in the next two methods, we actually leave the STS + during the barrier sync and join it immediately afterwards. If we + do not do this, this then the following deadlock can occur: one + thread could be in the barrier sync code, waiting for the other + thread to also sync up, whereas another one could be trying to + yield, while also waiting for the other threads to sync up too. + + Because the thread that does the sync barrier has left the STS, it + is possible to be suspended for a Full GC or an evacuation pause + could occur. This is actually safe, since the entering the sync + barrier is one of the last things do_marking_step() does, and it + doesn't manipulate any data structures afterwards. +*/ + +void ConcurrentMark::enter_first_sync_barrier(int task_num) { + if (verbose_low()) + gclog_or_tty->print_cr("[%d] entering first barrier", task_num); + + ConcurrentGCThread::stsLeave(); + _first_overflow_barrier_sync.enter(); + ConcurrentGCThread::stsJoin(); + // at this point everyone should have synced up and not be doing any + // more work + + if (verbose_low()) + gclog_or_tty->print_cr("[%d] leaving first barrier", task_num); + + // let task 0 do this + if (task_num == 0) { + // task 0 is responsible for clearing the global data structures + clear_marking_state(); + + if (PrintGC) { + gclog_or_tty->date_stamp(PrintGCDateStamps); + gclog_or_tty->stamp(PrintGCTimeStamps); + gclog_or_tty->print_cr("[GC concurrent-mark-reset-for-overflow]"); + } + } + + // after this, each task should reset its own data structures then + // then go into the second barrier +} + +void ConcurrentMark::enter_second_sync_barrier(int task_num) { + if (verbose_low()) + gclog_or_tty->print_cr("[%d] entering second barrier", task_num); + + ConcurrentGCThread::stsLeave(); + _second_overflow_barrier_sync.enter(); + ConcurrentGCThread::stsJoin(); + // at this point everything should be re-initialised and ready to go + + if (verbose_low()) + gclog_or_tty->print_cr("[%d] leaving second barrier", task_num); +} + +void ConcurrentMark::grayRoot(oop p) { + HeapWord* addr = (HeapWord*) p; + // We can't really check against _heap_start and _heap_end, since it + // is possible during an evacuation pause with piggy-backed + // initial-mark that the committed space is expanded during the + // pause without CM observing this change. So the assertions below + // is a bit conservative; but better than nothing. + tmp_guarantee_CM( _g1h->g1_committed().contains(addr), + "address should be within the heap bounds" ); + + if (!_nextMarkBitMap->isMarked(addr)) + _nextMarkBitMap->parMark(addr); +} + +void ConcurrentMark::grayRegionIfNecessary(MemRegion mr) { + // The objects on the region have already been marked "in bulk" by + // the caller. We only need to decide whether to push the region on + // the region stack or not. + + if (!concurrent_marking_in_progress() || !_should_gray_objects) + // We're done with marking and waiting for remark. We do not need to + // push anything else on the region stack. + return; + + HeapWord* finger = _finger; + + if (verbose_low()) + gclog_or_tty->print_cr("[global] attempting to push " + "region ["PTR_FORMAT", "PTR_FORMAT"), finger is at " + PTR_FORMAT, mr.start(), mr.end(), finger); + + if (mr.start() < finger) { + // The finger is always heap region aligned and it is not possible + // for mr to span heap regions. + tmp_guarantee_CM( mr.end() <= finger, "invariant" ); + + tmp_guarantee_CM( mr.start() <= mr.end() && + _heap_start <= mr.start() && + mr.end() <= _heap_end, + "region boundaries should fall within the committed space" ); + if (verbose_low()) + gclog_or_tty->print_cr("[global] region ["PTR_FORMAT", "PTR_FORMAT") " + "below the finger, pushing it", + mr.start(), mr.end()); + + if (!region_stack_push(mr)) { + if (verbose_low()) + gclog_or_tty->print_cr("[global] region stack has overflown."); + } + } +} + +void ConcurrentMark::markAndGrayObjectIfNecessary(oop p) { + // The object is not marked by the caller. We need to at least mark + // it and maybe push in on the stack. + + HeapWord* addr = (HeapWord*)p; + if (!_nextMarkBitMap->isMarked(addr)) { + // We definitely need to mark it, irrespective whether we bail out + // because we're done with marking. + if (_nextMarkBitMap->parMark(addr)) { + if (!concurrent_marking_in_progress() || !_should_gray_objects) + // If we're done with concurrent marking and we're waiting for + // remark, then we're not pushing anything on the stack. + return; + + // No OrderAccess:store_load() is needed. It is implicit in the + // CAS done in parMark(addr) above + HeapWord* finger = _finger; + + if (addr < finger) { + if (!mark_stack_push(oop(addr))) { + if (verbose_low()) + gclog_or_tty->print_cr("[global] global stack overflow " + "during parMark"); + } + } + } + } +} + +class CMConcurrentMarkingTask: public AbstractGangTask { +private: + ConcurrentMark* _cm; + ConcurrentMarkThread* _cmt; + +public: + void work(int worker_i) { + guarantee( Thread::current()->is_ConcurrentGC_thread(), + "this should only be done by a conc GC thread" ); + + double start_vtime = os::elapsedVTime(); + + ConcurrentGCThread::stsJoin(); + + guarantee( (size_t)worker_i < _cm->active_tasks(), "invariant" ); + CMTask* the_task = _cm->task(worker_i); + the_task->start_co_tracker(); + the_task->record_start_time(); + if (!_cm->has_aborted()) { + do { + double start_vtime_sec = os::elapsedVTime(); + double start_time_sec = os::elapsedTime(); + the_task->do_marking_step(10.0); + double end_time_sec = os::elapsedTime(); + double end_vtime_sec = os::elapsedVTime(); + double elapsed_vtime_sec = end_vtime_sec - start_vtime_sec; + double elapsed_time_sec = end_time_sec - start_time_sec; + _cm->clear_has_overflown(); + + bool ret = _cm->do_yield_check(worker_i); + + jlong sleep_time_ms; + if (!_cm->has_aborted() && the_task->has_aborted()) { + sleep_time_ms = + (jlong) (elapsed_vtime_sec * _cm->sleep_factor() * 1000.0); + ConcurrentGCThread::stsLeave(); + os::sleep(Thread::current(), sleep_time_ms, false); + ConcurrentGCThread::stsJoin(); + } + double end_time2_sec = os::elapsedTime(); + double elapsed_time2_sec = end_time2_sec - start_time_sec; + + the_task->update_co_tracker(); + +#if 0 + gclog_or_tty->print_cr("CM: elapsed %1.4lf ms, sleep %1.4lf ms, " + "overhead %1.4lf", + elapsed_vtime_sec * 1000.0, (double) sleep_time_ms, + the_task->conc_overhead(os::elapsedTime()) * 8.0); + gclog_or_tty->print_cr("elapsed time %1.4lf ms, time 2: %1.4lf ms", + elapsed_time_sec * 1000.0, elapsed_time2_sec * 1000.0); +#endif + } while (!_cm->has_aborted() && the_task->has_aborted()); + } + the_task->record_end_time(); + guarantee( !the_task->has_aborted() || _cm->has_aborted(), "invariant" ); + + ConcurrentGCThread::stsLeave(); + + double end_vtime = os::elapsedVTime(); + the_task->update_co_tracker(true); + _cm->update_accum_task_vtime(worker_i, end_vtime - start_vtime); + } + + CMConcurrentMarkingTask(ConcurrentMark* cm, + ConcurrentMarkThread* cmt) : + AbstractGangTask("Concurrent Mark"), _cm(cm), _cmt(cmt) { } + + ~CMConcurrentMarkingTask() { } +}; + +void ConcurrentMark::markFromRoots() { + // we might be tempted to assert that: + // assert(asynch == !SafepointSynchronize::is_at_safepoint(), + // "inconsistent argument?"); + // However that wouldn't be right, because it's possible that + // a safepoint is indeed in progress as a younger generation + // stop-the-world GC happens even as we mark in this generation. + + _restart_for_overflow = false; + + set_phase(MAX2((size_t) 1, parallel_marking_threads()), true); + + CMConcurrentMarkingTask markingTask(this, cmThread()); + if (parallel_marking_threads() > 0) + _parallel_workers->run_task(&markingTask); + else + markingTask.work(0); + print_stats(); +} + +void ConcurrentMark::checkpointRootsFinal(bool clear_all_soft_refs) { + // world is stopped at this checkpoint + assert(SafepointSynchronize::is_at_safepoint(), + "world should be stopped"); + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + + // If a full collection has happened, we shouldn't do this. + if (has_aborted()) { + g1h->set_marking_complete(); // So bitmap clearing isn't confused + return; + } + + G1CollectorPolicy* g1p = g1h->g1_policy(); + g1p->record_concurrent_mark_remark_start(); + + double start = os::elapsedTime(); + GCOverheadReporter::recordSTWStart(start); + + checkpointRootsFinalWork(); + + double mark_work_end = os::elapsedTime(); + + weakRefsWork(clear_all_soft_refs); + + if (has_overflown()) { + // Oops. We overflowed. Restart concurrent marking. + _restart_for_overflow = true; + // Clear the flag. We do not need it any more. + clear_has_overflown(); + if (G1TraceMarkStackOverflow) + gclog_or_tty->print_cr("\nRemark led to restart for overflow."); + } else { + // We're done with marking. + JavaThread::satb_mark_queue_set().set_active_all_threads(false); + } + +#if VERIFY_OBJS_PROCESSED + _scan_obj_cl.objs_processed = 0; + ThreadLocalObjQueue::objs_enqueued = 0; +#endif + + // Statistics + double now = os::elapsedTime(); + _remark_mark_times.add((mark_work_end - start) * 1000.0); + _remark_weak_ref_times.add((now - mark_work_end) * 1000.0); + _remark_times.add((now - start) * 1000.0); + + GCOverheadReporter::recordSTWEnd(now); + for (int i = 0; i < (int)_max_task_num; ++i) + _tasks[i]->disable_co_tracker(); + _cleanup_co_tracker.enable(); + _cleanup_co_tracker.reset(cleanup_task_overhead()); + g1p->record_concurrent_mark_remark_end(); +} + + +#define CARD_BM_TEST_MODE 0 + +class CalcLiveObjectsClosure: public HeapRegionClosure { + + CMBitMapRO* _bm; + ConcurrentMark* _cm; + COTracker* _co_tracker; + bool _changed; + bool _yield; + size_t _words_done; + size_t _tot_live; + size_t _tot_used; + size_t _regions_done; + double _start_vtime_sec; + + BitMap* _region_bm; + BitMap* _card_bm; + intptr_t _bottom_card_num; + bool _final; + + void mark_card_num_range(intptr_t start_card_num, intptr_t last_card_num) { + for (intptr_t i = start_card_num; i <= last_card_num; i++) { +#if CARD_BM_TEST_MODE + guarantee(_card_bm->at(i - _bottom_card_num), + "Should already be set."); +#else + _card_bm->par_at_put(i - _bottom_card_num, 1); +#endif + } + } + +public: + CalcLiveObjectsClosure(bool final, + CMBitMapRO *bm, ConcurrentMark *cm, + BitMap* region_bm, BitMap* card_bm, + COTracker* co_tracker) : + _bm(bm), _cm(cm), _changed(false), _yield(true), + _words_done(0), _tot_live(0), _tot_used(0), + _region_bm(region_bm), _card_bm(card_bm), + _final(final), _co_tracker(co_tracker), + _regions_done(0), _start_vtime_sec(0.0) + { + _bottom_card_num = + intptr_t(uintptr_t(G1CollectedHeap::heap()->reserved_region().start()) >> + CardTableModRefBS::card_shift); + } + + bool doHeapRegion(HeapRegion* hr) { + if (_co_tracker != NULL) + _co_tracker->update(); + + if (!_final && _regions_done == 0) + _start_vtime_sec = os::elapsedVTime(); + + if (hr->continuesHumongous()) return false; + + HeapWord* nextTop = hr->next_top_at_mark_start(); + HeapWord* start = hr->top_at_conc_mark_count(); + assert(hr->bottom() <= start && start <= hr->end() && + hr->bottom() <= nextTop && nextTop <= hr->end() && + start <= nextTop, + "Preconditions."); + // Otherwise, record the number of word's we'll examine. + size_t words_done = (nextTop - start); + // Find the first marked object at or after "start". + start = _bm->getNextMarkedWordAddress(start, nextTop); + size_t marked_bytes = 0; + + // Below, the term "card num" means the result of shifting an address + // by the card shift -- address 0 corresponds to card number 0. One + // must subtract the card num of the bottom of the heap to obtain a + // card table index. + // The first card num of the sequence of live cards currently being + // constructed. -1 ==> no sequence. + intptr_t start_card_num = -1; + // The last card num of the sequence of live cards currently being + // constructed. -1 ==> no sequence. + intptr_t last_card_num = -1; + + while (start < nextTop) { + if (_yield && _cm->do_yield_check()) { + // We yielded. It might be for a full collection, in which case + // all bets are off; terminate the traversal. + if (_cm->has_aborted()) { + _changed = false; + return true; + } else { + // Otherwise, it might be a collection pause, and the region + // we're looking at might be in the collection set. We'll + // abandon this region. + return false; + } + } + oop obj = oop(start); + int obj_sz = obj->size(); + // The card num of the start of the current object. + intptr_t obj_card_num = + intptr_t(uintptr_t(start) >> CardTableModRefBS::card_shift); + + HeapWord* obj_last = start + obj_sz - 1; + intptr_t obj_last_card_num = + intptr_t(uintptr_t(obj_last) >> CardTableModRefBS::card_shift); + + if (obj_card_num != last_card_num) { + if (start_card_num == -1) { + assert(last_card_num == -1, "Both or neither."); + start_card_num = obj_card_num; + } else { + assert(last_card_num != -1, "Both or neither."); + assert(obj_card_num >= last_card_num, "Inv"); + if ((obj_card_num - last_card_num) > 1) { + // Mark the last run, and start a new one. + mark_card_num_range(start_card_num, last_card_num); + start_card_num = obj_card_num; + } + } +#if CARD_BM_TEST_MODE + /* + gclog_or_tty->print_cr("Setting bits from %d/%d.", + obj_card_num - _bottom_card_num, + obj_last_card_num - _bottom_card_num); + */ + for (intptr_t j = obj_card_num; j <= obj_last_card_num; j++) { + _card_bm->par_at_put(j - _bottom_card_num, 1); + } +#endif + } + // In any case, we set the last card num. + last_card_num = obj_last_card_num; + + marked_bytes += obj_sz * HeapWordSize; + // Find the next marked object after this one. + start = _bm->getNextMarkedWordAddress(start + 1, nextTop); + _changed = true; + } + // Handle the last range, if any. + if (start_card_num != -1) + mark_card_num_range(start_card_num, last_card_num); + if (_final) { + // Mark the allocated-since-marking portion... + HeapWord* tp = hr->top(); + if (nextTop < tp) { + start_card_num = + intptr_t(uintptr_t(nextTop) >> CardTableModRefBS::card_shift); + last_card_num = + intptr_t(uintptr_t(tp) >> CardTableModRefBS::card_shift); + mark_card_num_range(start_card_num, last_card_num); + // This definitely means the region has live objects. + _region_bm->par_at_put(hr->hrs_index(), 1); + } + } + + hr->add_to_marked_bytes(marked_bytes); + // Update the live region bitmap. + if (marked_bytes > 0) { + _region_bm->par_at_put(hr->hrs_index(), 1); + } + hr->set_top_at_conc_mark_count(nextTop); + _tot_live += hr->next_live_bytes(); + _tot_used += hr->used(); + _words_done = words_done; + + if (!_final) { + ++_regions_done; + if (_regions_done % 10 == 0) { + double end_vtime_sec = os::elapsedVTime(); + double elapsed_vtime_sec = end_vtime_sec - _start_vtime_sec; + if (elapsed_vtime_sec > (10.0 / 1000.0)) { + jlong sleep_time_ms = + (jlong) (elapsed_vtime_sec * _cm->cleanup_sleep_factor() * 1000.0); +#if 0 + gclog_or_tty->print_cr("CL: elapsed %1.4lf ms, sleep %1.4lf ms, " + "overhead %1.4lf", + elapsed_vtime_sec * 1000.0, (double) sleep_time_ms, + _co_tracker->concOverhead(os::elapsedTime())); +#endif + os::sleep(Thread::current(), sleep_time_ms, false); + _start_vtime_sec = end_vtime_sec; + } + } + } + + return false; + } + + bool changed() { return _changed; } + void reset() { _changed = false; _words_done = 0; } + void no_yield() { _yield = false; } + size_t words_done() { return _words_done; } + size_t tot_live() { return _tot_live; } + size_t tot_used() { return _tot_used; } +}; + + +void ConcurrentMark::calcDesiredRegions() { + guarantee( _cleanup_co_tracker.enabled(), "invariant" ); + _cleanup_co_tracker.start(); + + _region_bm.clear(); + _card_bm.clear(); + CalcLiveObjectsClosure calccl(false /*final*/, + nextMarkBitMap(), this, + &_region_bm, &_card_bm, + &_cleanup_co_tracker); + G1CollectedHeap *g1h = G1CollectedHeap::heap(); + g1h->heap_region_iterate(&calccl); + + do { + calccl.reset(); + g1h->heap_region_iterate(&calccl); + } while (calccl.changed()); + + _cleanup_co_tracker.update(true); +} + +class G1ParFinalCountTask: public AbstractGangTask { +protected: + G1CollectedHeap* _g1h; + CMBitMap* _bm; + size_t _n_workers; + size_t *_live_bytes; + size_t *_used_bytes; + BitMap* _region_bm; + BitMap* _card_bm; +public: + G1ParFinalCountTask(G1CollectedHeap* g1h, CMBitMap* bm, + BitMap* region_bm, BitMap* card_bm) : + AbstractGangTask("G1 final counting"), _g1h(g1h), + _bm(bm), _region_bm(region_bm), _card_bm(card_bm) + { + if (ParallelGCThreads > 0) + _n_workers = _g1h->workers()->total_workers(); + else + _n_workers = 1; + _live_bytes = NEW_C_HEAP_ARRAY(size_t, _n_workers); + _used_bytes = NEW_C_HEAP_ARRAY(size_t, _n_workers); + } + + ~G1ParFinalCountTask() { + FREE_C_HEAP_ARRAY(size_t, _live_bytes); + FREE_C_HEAP_ARRAY(size_t, _used_bytes); + } + + void work(int i) { + CalcLiveObjectsClosure calccl(true /*final*/, + _bm, _g1h->concurrent_mark(), + _region_bm, _card_bm, + NULL /* CO tracker */); + calccl.no_yield(); + if (ParallelGCThreads > 0) { + _g1h->heap_region_par_iterate_chunked(&calccl, i, 1); + } else { + _g1h->heap_region_iterate(&calccl); + } + assert(calccl.complete(), "Shouldn't have yielded!"); + + guarantee( (size_t)i < _n_workers, "invariant" ); + _live_bytes[i] = calccl.tot_live(); + _used_bytes[i] = calccl.tot_used(); + } + size_t live_bytes() { + size_t live_bytes = 0; + for (size_t i = 0; i < _n_workers; ++i) + live_bytes += _live_bytes[i]; + return live_bytes; + } + size_t used_bytes() { + size_t used_bytes = 0; + for (size_t i = 0; i < _n_workers; ++i) + used_bytes += _used_bytes[i]; + return used_bytes; + } +}; + +class G1ParNoteEndTask; + +class G1NoteEndOfConcMarkClosure : public HeapRegionClosure { + G1CollectedHeap* _g1; + int _worker_num; + size_t _max_live_bytes; + size_t _regions_claimed; + size_t _freed_bytes; + size_t _cleared_h_regions; + size_t _freed_regions; + UncleanRegionList* _unclean_region_list; + double _claimed_region_time; + double _max_region_time; + +public: + G1NoteEndOfConcMarkClosure(G1CollectedHeap* g1, + UncleanRegionList* list, + int worker_num); + size_t freed_bytes() { return _freed_bytes; } + size_t cleared_h_regions() { return _cleared_h_regions; } + size_t freed_regions() { return _freed_regions; } + UncleanRegionList* unclean_region_list() { + return _unclean_region_list; + } + + bool doHeapRegion(HeapRegion *r); + + size_t max_live_bytes() { return _max_live_bytes; } + size_t regions_claimed() { return _regions_claimed; } + double claimed_region_time_sec() { return _claimed_region_time; } + double max_region_time_sec() { return _max_region_time; } +}; + +class G1ParNoteEndTask: public AbstractGangTask { + friend class G1NoteEndOfConcMarkClosure; +protected: + G1CollectedHeap* _g1h; + size_t _max_live_bytes; + size_t _freed_bytes; + ConcurrentMark::ParCleanupThreadState** _par_cleanup_thread_state; +public: + G1ParNoteEndTask(G1CollectedHeap* g1h, + ConcurrentMark::ParCleanupThreadState** + par_cleanup_thread_state) : + AbstractGangTask("G1 note end"), _g1h(g1h), + _max_live_bytes(0), _freed_bytes(0), + _par_cleanup_thread_state(par_cleanup_thread_state) + {} + + void work(int i) { + double start = os::elapsedTime(); + G1NoteEndOfConcMarkClosure g1_note_end(_g1h, + &_par_cleanup_thread_state[i]->list, + i); + if (ParallelGCThreads > 0) { + _g1h->heap_region_par_iterate_chunked(&g1_note_end, i, 2); + } else { + _g1h->heap_region_iterate(&g1_note_end); + } + assert(g1_note_end.complete(), "Shouldn't have yielded!"); + + // Now finish up freeing the current thread's regions. + _g1h->finish_free_region_work(g1_note_end.freed_bytes(), + g1_note_end.cleared_h_regions(), + 0, NULL); + { + MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag); + _max_live_bytes += g1_note_end.max_live_bytes(); + _freed_bytes += g1_note_end.freed_bytes(); + } + double end = os::elapsedTime(); + if (G1PrintParCleanupStats) { + gclog_or_tty->print(" Worker thread %d [%8.3f..%8.3f = %8.3f ms] " + "claimed %d regions (tot = %8.3f ms, max = %8.3f ms).\n", + i, start, end, (end-start)*1000.0, + g1_note_end.regions_claimed(), + g1_note_end.claimed_region_time_sec()*1000.0, + g1_note_end.max_region_time_sec()*1000.0); + } + } + size_t max_live_bytes() { return _max_live_bytes; } + size_t freed_bytes() { return _freed_bytes; } +}; + +class G1ParScrubRemSetTask: public AbstractGangTask { +protected: + G1RemSet* _g1rs; + BitMap* _region_bm; + BitMap* _card_bm; +public: + G1ParScrubRemSetTask(G1CollectedHeap* g1h, + BitMap* region_bm, BitMap* card_bm) : + AbstractGangTask("G1 ScrubRS"), _g1rs(g1h->g1_rem_set()), + _region_bm(region_bm), _card_bm(card_bm) + {} + + void work(int i) { + if (ParallelGCThreads > 0) { + _g1rs->scrub_par(_region_bm, _card_bm, i, 3); + } else { + _g1rs->scrub(_region_bm, _card_bm); + } + } + +}; + +G1NoteEndOfConcMarkClosure:: +G1NoteEndOfConcMarkClosure(G1CollectedHeap* g1, + UncleanRegionList* list, + int worker_num) + : _g1(g1), _worker_num(worker_num), + _max_live_bytes(0), _regions_claimed(0), + _freed_bytes(0), _cleared_h_regions(0), _freed_regions(0), + _claimed_region_time(0.0), _max_region_time(0.0), + _unclean_region_list(list) +{} + +bool G1NoteEndOfConcMarkClosure::doHeapRegion(HeapRegion *r) { + // We use a claim value of zero here because all regions + // were claimed with value 1 in the FinalCount task. + r->reset_gc_time_stamp(); + if (!r->continuesHumongous()) { + double start = os::elapsedTime(); + _regions_claimed++; + r->note_end_of_marking(); + _max_live_bytes += r->max_live_bytes(); + _g1->free_region_if_totally_empty_work(r, + _freed_bytes, + _cleared_h_regions, + _freed_regions, + _unclean_region_list, + true /*par*/); + double region_time = (os::elapsedTime() - start); + _claimed_region_time += region_time; + if (region_time > _max_region_time) _max_region_time = region_time; + } + return false; +} + +void ConcurrentMark::cleanup() { + // world is stopped at this checkpoint + assert(SafepointSynchronize::is_at_safepoint(), + "world should be stopped"); + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + + // If a full collection has happened, we shouldn't do this. + if (has_aborted()) { + g1h->set_marking_complete(); // So bitmap clearing isn't confused + return; + } + + _cleanup_co_tracker.disable(); + + G1CollectorPolicy* g1p = G1CollectedHeap::heap()->g1_policy(); + g1p->record_concurrent_mark_cleanup_start(); + + double start = os::elapsedTime(); + GCOverheadReporter::recordSTWStart(start); + + // Do counting once more with the world stopped for good measure. + G1ParFinalCountTask g1_par_count_task(g1h, nextMarkBitMap(), + &_region_bm, &_card_bm); + if (ParallelGCThreads > 0) { + int n_workers = g1h->workers()->total_workers(); + g1h->set_par_threads(n_workers); + g1h->workers()->run_task(&g1_par_count_task); + g1h->set_par_threads(0); + } else { + g1_par_count_task.work(0); + } + + size_t known_garbage_bytes = + g1_par_count_task.used_bytes() - g1_par_count_task.live_bytes(); +#if 0 + gclog_or_tty->print_cr("used %1.2lf, live %1.2lf, garbage %1.2lf", + (double) g1_par_count_task.used_bytes() / (double) (1024 * 1024), + (double) g1_par_count_task.live_bytes() / (double) (1024 * 1024), + (double) known_garbage_bytes / (double) (1024 * 1024)); +#endif // 0 + g1p->set_known_garbage_bytes(known_garbage_bytes); + + size_t start_used_bytes = g1h->used(); + _at_least_one_mark_complete = true; + g1h->set_marking_complete(); + + double count_end = os::elapsedTime(); + double this_final_counting_time = (count_end - start); + if (G1PrintParCleanupStats) { + gclog_or_tty->print_cr("Cleanup:"); + gclog_or_tty->print_cr(" Finalize counting: %8.3f ms", + this_final_counting_time*1000.0); + } + _total_counting_time += this_final_counting_time; + + // Install newly created mark bitMap as "prev". + swapMarkBitMaps(); + + g1h->reset_gc_time_stamp(); + + // Note end of marking in all heap regions. + double note_end_start = os::elapsedTime(); + G1ParNoteEndTask g1_par_note_end_task(g1h, _par_cleanup_thread_state); + if (ParallelGCThreads > 0) { + int n_workers = g1h->workers()->total_workers(); + g1h->set_par_threads(n_workers); + g1h->workers()->run_task(&g1_par_note_end_task); + g1h->set_par_threads(0); + } else { + g1_par_note_end_task.work(0); + } + g1h->set_unclean_regions_coming(true); + double note_end_end = os::elapsedTime(); + // Tell the mutators that there might be unclean regions coming... + if (G1PrintParCleanupStats) { + gclog_or_tty->print_cr(" note end of marking: %8.3f ms.", + (note_end_end - note_end_start)*1000.0); + } + + // Now we "scrub" remembered sets. Note that we must do this before the + // call below, since it affects the metric by which we sort the heap + // regions. + if (G1ScrubRemSets) { + double rs_scrub_start = os::elapsedTime(); + G1ParScrubRemSetTask g1_par_scrub_rs_task(g1h, &_region_bm, &_card_bm); + if (ParallelGCThreads > 0) { + int n_workers = g1h->workers()->total_workers(); + g1h->set_par_threads(n_workers); + g1h->workers()->run_task(&g1_par_scrub_rs_task); + g1h->set_par_threads(0); + } else { + g1_par_scrub_rs_task.work(0); + } + + double rs_scrub_end = os::elapsedTime(); + double this_rs_scrub_time = (rs_scrub_end - rs_scrub_start); + _total_rs_scrub_time += this_rs_scrub_time; + } + + // this will also free any regions totally full of garbage objects, + // and sort the regions. + g1h->g1_policy()->record_concurrent_mark_cleanup_end( + g1_par_note_end_task.freed_bytes(), + g1_par_note_end_task.max_live_bytes()); + + // Statistics. + double end = os::elapsedTime(); + _cleanup_times.add((end - start) * 1000.0); + GCOverheadReporter::recordSTWEnd(end); + + // G1CollectedHeap::heap()->print(); + // gclog_or_tty->print_cr("HEAP GC TIME STAMP : %d", + // G1CollectedHeap::heap()->get_gc_time_stamp()); + + if (PrintGC || PrintGCDetails) { + g1h->print_size_transition(gclog_or_tty, + start_used_bytes, + g1h->used(), + g1h->capacity()); + } + + size_t cleaned_up_bytes = start_used_bytes - g1h->used(); + g1p->decrease_known_garbage_bytes(cleaned_up_bytes); + + // We need to make this be a "collection" so any collection pause that + // races with it goes around and waits for completeCleanup to finish. + g1h->increment_total_collections(); + +#ifndef PRODUCT + if (G1VerifyConcMark) { + G1CollectedHeap::heap()->prepare_for_verify(); + G1CollectedHeap::heap()->verify(true,false); + } +#endif +} + +void ConcurrentMark::completeCleanup() { + // A full collection intervened. + if (has_aborted()) return; + + int first = 0; + int last = (int)MAX2(ParallelGCThreads, (size_t)1); + for (int t = 0; t < last; t++) { + UncleanRegionList* list = &_par_cleanup_thread_state[t]->list; + assert(list->well_formed(), "Inv"); + HeapRegion* hd = list->hd(); + while (hd != NULL) { + // Now finish up the other stuff. + hd->rem_set()->clear(); + HeapRegion* next_hd = hd->next_from_unclean_list(); + (void)list->pop(); + guarantee(list->hd() == next_hd, "how not?"); + _g1h->put_region_on_unclean_list(hd); + if (!hd->isHumongous()) { + // Add this to the _free_regions count by 1. + _g1h->finish_free_region_work(0, 0, 1, NULL); + } + hd = list->hd(); + guarantee(hd == next_hd, "how not?"); + } + } +} + + +class G1CMIsAliveClosure: public BoolObjectClosure { + G1CollectedHeap* _g1; + public: + G1CMIsAliveClosure(G1CollectedHeap* g1) : + _g1(g1) + {} + + void do_object(oop obj) { + assert(false, "not to be invoked"); + } + bool do_object_b(oop obj) { + HeapWord* addr = (HeapWord*)obj; + return addr != NULL && + (!_g1->is_in_g1_reserved(addr) || !_g1->is_obj_ill(obj)); + } +}; + +class G1CMKeepAliveClosure: public OopClosure { + G1CollectedHeap* _g1; + ConcurrentMark* _cm; + CMBitMap* _bitMap; + public: + G1CMKeepAliveClosure(G1CollectedHeap* g1, ConcurrentMark* cm, + CMBitMap* bitMap) : + _g1(g1), _cm(cm), + _bitMap(bitMap) {} + + void do_oop(narrowOop* p) { + guarantee(false, "NYI"); + } + + void do_oop(oop* p) { + oop thisOop = *p; + HeapWord* addr = (HeapWord*)thisOop; + if (_g1->is_in_g1_reserved(addr) && _g1->is_obj_ill(thisOop)) { + _bitMap->mark(addr); + _cm->mark_stack_push(thisOop); + } + } +}; + +class G1CMDrainMarkingStackClosure: public VoidClosure { + CMMarkStack* _markStack; + CMBitMap* _bitMap; + G1CMKeepAliveClosure* _oopClosure; + public: + G1CMDrainMarkingStackClosure(CMBitMap* bitMap, CMMarkStack* markStack, + G1CMKeepAliveClosure* oopClosure) : + _bitMap(bitMap), + _markStack(markStack), + _oopClosure(oopClosure) + {} + + void do_void() { + _markStack->drain((OopClosure*)_oopClosure, _bitMap, false); + } +}; + +void ConcurrentMark::weakRefsWork(bool clear_all_soft_refs) { + ResourceMark rm; + HandleMark hm; + ReferencePolicy* soft_ref_policy; + + // Process weak references. + if (clear_all_soft_refs) { + soft_ref_policy = new AlwaysClearPolicy(); + } else { +#ifdef COMPILER2 + soft_ref_policy = new LRUMaxHeapPolicy(); +#else + soft_ref_policy = new LRUCurrentHeapPolicy(); +#endif + } + assert(_markStack.isEmpty(), "mark stack should be empty"); + + G1CollectedHeap* g1 = G1CollectedHeap::heap(); + G1CMIsAliveClosure g1IsAliveClosure(g1); + + G1CMKeepAliveClosure g1KeepAliveClosure(g1, this, nextMarkBitMap()); + G1CMDrainMarkingStackClosure + g1DrainMarkingStackClosure(nextMarkBitMap(), &_markStack, + &g1KeepAliveClosure); + + // XXXYYY Also: copy the parallel ref processing code from CMS. + ReferenceProcessor* rp = g1->ref_processor(); + rp->process_discovered_references(soft_ref_policy, + &g1IsAliveClosure, + &g1KeepAliveClosure, + &g1DrainMarkingStackClosure, + NULL); + assert(_markStack.overflow() || _markStack.isEmpty(), + "mark stack should be empty (unless it overflowed)"); + if (_markStack.overflow()) { + set_has_overflown(); + } + + rp->enqueue_discovered_references(); + rp->verify_no_references_recorded(); + assert(!rp->discovery_enabled(), "should have been disabled"); + + // Now clean up stale oops in SymbolTable and StringTable + SymbolTable::unlink(&g1IsAliveClosure); + StringTable::unlink(&g1IsAliveClosure); +} + +void ConcurrentMark::swapMarkBitMaps() { + CMBitMapRO* temp = _prevMarkBitMap; + _prevMarkBitMap = (CMBitMapRO*)_nextMarkBitMap; + _nextMarkBitMap = (CMBitMap*) temp; +} + +class CMRemarkTask: public AbstractGangTask { +private: + ConcurrentMark *_cm; + +public: + void work(int worker_i) { + // Since all available tasks are actually started, we should + // only proceed if we're supposed to be actived. + if ((size_t)worker_i < _cm->active_tasks()) { + CMTask* task = _cm->task(worker_i); + task->record_start_time(); + do { + task->do_marking_step(1000000000.0 /* something very large */); + } while (task->has_aborted() && !_cm->has_overflown()); + // If we overflow, then we do not want to restart. We instead + // want to abort remark and do concurrent marking again. + task->record_end_time(); + } + } + + CMRemarkTask(ConcurrentMark* cm) : + AbstractGangTask("Par Remark"), _cm(cm) { } +}; + +void ConcurrentMark::checkpointRootsFinalWork() { + ResourceMark rm; + HandleMark hm; + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + + g1h->ensure_parsability(false); + + if (ParallelGCThreads > 0) { + g1h->change_strong_roots_parity(); + // this is remark, so we'll use up all available threads + int active_workers = ParallelGCThreads; + set_phase(active_workers, false); + + CMRemarkTask remarkTask(this); + // We will start all available threads, even if we decide that the + // active_workers will be fewer. The extra ones will just bail out + // immediately. + int n_workers = g1h->workers()->total_workers(); + g1h->set_par_threads(n_workers); + g1h->workers()->run_task(&remarkTask); + g1h->set_par_threads(0); + + SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set(); + guarantee( satb_mq_set.completed_buffers_num() == 0, "invariant" ); + } else { + g1h->change_strong_roots_parity(); + // this is remark, so we'll use up all available threads + int active_workers = 1; + set_phase(active_workers, false); + + CMRemarkTask remarkTask(this); + // We will start all available threads, even if we decide that the + // active_workers will be fewer. The extra ones will just bail out + // immediately. + remarkTask.work(0); + + SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set(); + guarantee( satb_mq_set.completed_buffers_num() == 0, "invariant" ); + } + + print_stats(); + + if (!restart_for_overflow()) + set_non_marking_state(); + +#if VERIFY_OBJS_PROCESSED + if (_scan_obj_cl.objs_processed != ThreadLocalObjQueue::objs_enqueued) { + gclog_or_tty->print_cr("Processed = %d, enqueued = %d.", + _scan_obj_cl.objs_processed, + ThreadLocalObjQueue::objs_enqueued); + guarantee(_scan_obj_cl.objs_processed == + ThreadLocalObjQueue::objs_enqueued, + "Different number of objs processed and enqueued."); + } +#endif +} + +class ReachablePrinterOopClosure: public OopClosure { +private: + G1CollectedHeap* _g1h; + CMBitMapRO* _bitmap; + outputStream* _out; + +public: + ReachablePrinterOopClosure(CMBitMapRO* bitmap, outputStream* out) : + _bitmap(bitmap), _g1h(G1CollectedHeap::heap()), _out(out) { } + + void do_oop(narrowOop* p) { + guarantee(false, "NYI"); + } + + void do_oop(oop* p) { + oop obj = *p; + const char* str = NULL; + const char* str2 = ""; + + if (!_g1h->is_in_g1_reserved(obj)) + str = "outside G1 reserved"; + else { + HeapRegion* hr = _g1h->heap_region_containing(obj); + guarantee( hr != NULL, "invariant" ); + if (hr->obj_allocated_since_prev_marking(obj)) { + str = "over TAMS"; + if (_bitmap->isMarked((HeapWord*) obj)) + str2 = " AND MARKED"; + } else if (_bitmap->isMarked((HeapWord*) obj)) + str = "marked"; + else + str = "#### NOT MARKED ####"; + } + + _out->print_cr(" "PTR_FORMAT" contains "PTR_FORMAT" %s%s", + p, (void*) obj, str, str2); + } +}; + +class ReachablePrinterClosure: public BitMapClosure { +private: + CMBitMapRO* _bitmap; + outputStream* _out; + +public: + ReachablePrinterClosure(CMBitMapRO* bitmap, outputStream* out) : + _bitmap(bitmap), _out(out) { } + + bool do_bit(size_t offset) { + HeapWord* addr = _bitmap->offsetToHeapWord(offset); + ReachablePrinterOopClosure oopCl(_bitmap, _out); + + _out->print_cr(" obj "PTR_FORMAT", offset %10d (marked)", addr, offset); + oop(addr)->oop_iterate(&oopCl); + _out->print_cr(""); + + return true; + } +}; + +class ObjInRegionReachablePrinterClosure : public ObjectClosure { +private: + CMBitMapRO* _bitmap; + outputStream* _out; + +public: + void do_object(oop o) { + ReachablePrinterOopClosure oopCl(_bitmap, _out); + + _out->print_cr(" obj "PTR_FORMAT" (over TAMS)", (void*) o); + o->oop_iterate(&oopCl); + _out->print_cr(""); + } + + ObjInRegionReachablePrinterClosure(CMBitMapRO* bitmap, outputStream* out) : + _bitmap(bitmap), _out(out) { } +}; + +class RegionReachablePrinterClosure : public HeapRegionClosure { +private: + CMBitMapRO* _bitmap; + outputStream* _out; + +public: + bool doHeapRegion(HeapRegion* hr) { + HeapWord* b = hr->bottom(); + HeapWord* e = hr->end(); + HeapWord* t = hr->top(); + HeapWord* p = hr->prev_top_at_mark_start(); + _out->print_cr("** ["PTR_FORMAT", "PTR_FORMAT"] top: "PTR_FORMAT" " + "PTAMS: "PTR_FORMAT, b, e, t, p); + _out->print_cr(""); + + ObjInRegionReachablePrinterClosure ocl(_bitmap, _out); + hr->object_iterate_mem_careful(MemRegion(p, t), &ocl); + + return false; + } + + RegionReachablePrinterClosure(CMBitMapRO* bitmap, + outputStream* out) : + _bitmap(bitmap), _out(out) { } +}; + +void ConcurrentMark::print_prev_bitmap_reachable() { + outputStream* out = gclog_or_tty; + +#if SEND_HEAP_DUMP_TO_FILE + guarantee(heap_dump_file == NULL, "Protocol"); + char fn_buf[100]; + sprintf(fn_buf, "/tmp/dump.txt.%d", os::current_process_id()); + heap_dump_file = fopen(fn_buf, "w"); + fileStream fstream(heap_dump_file); + out = &fstream; +#endif // SEND_HEAP_DUMP_TO_FILE + + RegionReachablePrinterClosure rcl(_prevMarkBitMap, out); + out->print_cr("--- ITERATING OVER REGIONS WITH PTAMS < TOP"); + _g1h->heap_region_iterate(&rcl); + out->print_cr(""); + + ReachablePrinterClosure cl(_prevMarkBitMap, out); + out->print_cr("--- REACHABLE OBJECTS ON THE BITMAP"); + _prevMarkBitMap->iterate(&cl); + out->print_cr(""); + +#if SEND_HEAP_DUMP_TO_FILE + fclose(heap_dump_file); + heap_dump_file = NULL; +#endif // SEND_HEAP_DUMP_TO_FILE +} + +// This note is for drainAllSATBBuffers and the code in between. +// In the future we could reuse a task to do this work during an +// evacuation pause (since now tasks are not active and can be claimed +// during an evacuation pause). This was a late change to the code and +// is currently not being taken advantage of. + +class CMGlobalObjectClosure : public ObjectClosure { +private: + ConcurrentMark* _cm; + +public: + void do_object(oop obj) { + _cm->deal_with_reference(obj); + } + + CMGlobalObjectClosure(ConcurrentMark* cm) : _cm(cm) { } +}; + +void ConcurrentMark::deal_with_reference(oop obj) { + if (verbose_high()) + gclog_or_tty->print_cr("[global] we're dealing with reference "PTR_FORMAT, + (void*) obj); + + + HeapWord* objAddr = (HeapWord*) obj; + if (_g1h->is_in_g1_reserved(objAddr)) { + tmp_guarantee_CM( obj != NULL, "is_in_g1_reserved should ensure this" ); + HeapRegion* hr = _g1h->heap_region_containing(obj); + if (_g1h->is_obj_ill(obj, hr)) { + if (verbose_high()) + gclog_or_tty->print_cr("[global] "PTR_FORMAT" is not considered " + "marked", (void*) obj); + + // we need to mark it first + if (_nextMarkBitMap->parMark(objAddr)) { + // No OrderAccess:store_load() is needed. It is implicit in the + // CAS done in parMark(objAddr) above + HeapWord* finger = _finger; + if (objAddr < finger) { + if (verbose_high()) + gclog_or_tty->print_cr("[global] below the global finger " + "("PTR_FORMAT"), pushing it", finger); + if (!mark_stack_push(obj)) { + if (verbose_low()) + gclog_or_tty->print_cr("[global] global stack overflow during " + "deal_with_reference"); + } + } + } + } + } +} + +void ConcurrentMark::drainAllSATBBuffers() { + CMGlobalObjectClosure oc(this); + SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set(); + satb_mq_set.set_closure(&oc); + + while (satb_mq_set.apply_closure_to_completed_buffer()) { + if (verbose_medium()) + gclog_or_tty->print_cr("[global] processed an SATB buffer"); + } + + // no need to check whether we should do this, as this is only + // called during an evacuation pause + satb_mq_set.iterate_closure_all_threads(); + + satb_mq_set.set_closure(NULL); + guarantee( satb_mq_set.completed_buffers_num() == 0, "invariant" ); +} + +void ConcurrentMark::markPrev(oop p) { + // Note we are overriding the read-only view of the prev map here, via + // the cast. + ((CMBitMap*)_prevMarkBitMap)->mark((HeapWord*)p); +} + +void ConcurrentMark::clear(oop p) { + assert(p != NULL && p->is_oop(), "expected an oop"); + HeapWord* addr = (HeapWord*)p; + assert(addr >= _nextMarkBitMap->startWord() || + addr < _nextMarkBitMap->endWord(), "in a region"); + + _nextMarkBitMap->clear(addr); +} + +void ConcurrentMark::clearRangeBothMaps(MemRegion mr) { + // Note we are overriding the read-only view of the prev map here, via + // the cast. + ((CMBitMap*)_prevMarkBitMap)->clearRange(mr); + _nextMarkBitMap->clearRange(mr); +} + +HeapRegion* +ConcurrentMark::claim_region(int task_num) { + // "checkpoint" the finger + HeapWord* finger = _finger; + + // _heap_end will not change underneath our feet; it only changes at + // yield points. + while (finger < _heap_end) { + tmp_guarantee_CM( _g1h->is_in_g1_reserved(finger), "invariant" ); + + // is the gap between reading the finger and doing the CAS too long? + + HeapRegion* curr_region = _g1h->heap_region_containing(finger); + HeapWord* bottom = curr_region->bottom(); + HeapWord* end = curr_region->end(); + HeapWord* limit = curr_region->next_top_at_mark_start(); + + if (verbose_low()) + gclog_or_tty->print_cr("[%d] curr_region = "PTR_FORMAT" " + "["PTR_FORMAT", "PTR_FORMAT"), " + "limit = "PTR_FORMAT, + task_num, curr_region, bottom, end, limit); + + HeapWord* res = + (HeapWord*) Atomic::cmpxchg_ptr(end, &_finger, finger); + if (res == finger) { + // we succeeded + + // notice that _finger == end cannot be guaranteed here since, + // someone else might have moved the finger even further + guarantee( _finger >= end, "the finger should have moved forward" ); + + if (verbose_low()) + gclog_or_tty->print_cr("[%d] we were successful with region = " + PTR_FORMAT, task_num, curr_region); + + if (limit > bottom) { + if (verbose_low()) + gclog_or_tty->print_cr("[%d] region "PTR_FORMAT" is not empty, " + "returning it ", task_num, curr_region); + return curr_region; + } else { + tmp_guarantee_CM( limit == bottom, + "the region limit should be at bottom" ); + if (verbose_low()) + gclog_or_tty->print_cr("[%d] region "PTR_FORMAT" is empty, " + "returning NULL", task_num, curr_region); + // we return NULL and the caller should try calling + // claim_region() again. + return NULL; + } + } else { + guarantee( _finger > finger, "the finger should have moved forward" ); + if (verbose_low()) + gclog_or_tty->print_cr("[%d] somebody else moved the finger, " + "global finger = "PTR_FORMAT", " + "our finger = "PTR_FORMAT, + task_num, _finger, finger); + + // read it again + finger = _finger; + } + } + + return NULL; +} + +void ConcurrentMark::oops_do(OopClosure* cl) { + if (_markStack.size() > 0 && verbose_low()) + gclog_or_tty->print_cr("[global] scanning the global marking stack, " + "size = %d", _markStack.size()); + // we first iterate over the contents of the mark stack... + _markStack.oops_do(cl); + + for (int i = 0; i < (int)_max_task_num; ++i) { + OopTaskQueue* queue = _task_queues->queue((int)i); + + if (queue->size() > 0 && verbose_low()) + gclog_or_tty->print_cr("[global] scanning task queue of task %d, " + "size = %d", i, queue->size()); + + // ...then over the contents of the all the task queues. + queue->oops_do(cl); + } + + // finally, invalidate any entries that in the region stack that + // point into the collection set + if (_regionStack.invalidate_entries_into_cset()) { + // otherwise, any gray objects copied during the evacuation pause + // might not be visited. + guarantee( _should_gray_objects, "invariant" ); + } +} + +void ConcurrentMark::clear_marking_state() { + _markStack.setEmpty(); + _markStack.clear_overflow(); + _regionStack.setEmpty(); + _regionStack.clear_overflow(); + clear_has_overflown(); + _finger = _heap_start; + + for (int i = 0; i < (int)_max_task_num; ++i) { + OopTaskQueue* queue = _task_queues->queue(i); + queue->set_empty(); + } +} + +void ConcurrentMark::print_stats() { + if (verbose_stats()) { + gclog_or_tty->print_cr("---------------------------------------------------------------------"); + for (size_t i = 0; i < _active_tasks; ++i) { + _tasks[i]->print_stats(); + gclog_or_tty->print_cr("---------------------------------------------------------------------"); + } + } +} + +class CSMarkOopClosure: public OopClosure { + friend class CSMarkBitMapClosure; + + G1CollectedHeap* _g1h; + CMBitMap* _bm; + ConcurrentMark* _cm; + oop* _ms; + jint* _array_ind_stack; + int _ms_size; + int _ms_ind; + int _array_increment; + + bool push(oop obj, int arr_ind = 0) { + if (_ms_ind == _ms_size) { + gclog_or_tty->print_cr("Mark stack is full."); + return false; + } + _ms[_ms_ind] = obj; + if (obj->is_objArray()) _array_ind_stack[_ms_ind] = arr_ind; + _ms_ind++; + return true; + } + + oop pop() { + if (_ms_ind == 0) return NULL; + else { + _ms_ind--; + return _ms[_ms_ind]; + } + } + + bool drain() { + while (_ms_ind > 0) { + oop obj = pop(); + assert(obj != NULL, "Since index was non-zero."); + if (obj->is_objArray()) { + jint arr_ind = _array_ind_stack[_ms_ind]; + objArrayOop aobj = objArrayOop(obj); + jint len = aobj->length(); + jint next_arr_ind = arr_ind + _array_increment; + if (next_arr_ind < len) { + push(obj, next_arr_ind); + } + // Now process this portion of this one. + int lim = MIN2(next_arr_ind, len); + assert(!UseCompressedOops, "This needs to be fixed"); + for (int j = arr_ind; j < lim; j++) { + do_oop(aobj->obj_at_addr(j)); + } + + } else { + obj->oop_iterate(this); + } + if (abort()) return false; + } + return true; + } + +public: + CSMarkOopClosure(ConcurrentMark* cm, int ms_size) : + _g1h(G1CollectedHeap::heap()), + _cm(cm), + _bm(cm->nextMarkBitMap()), + _ms_size(ms_size), _ms_ind(0), + _ms(NEW_C_HEAP_ARRAY(oop, ms_size)), + _array_ind_stack(NEW_C_HEAP_ARRAY(jint, ms_size)), + _array_increment(MAX2(ms_size/8, 16)) + {} + + ~CSMarkOopClosure() { + FREE_C_HEAP_ARRAY(oop, _ms); + FREE_C_HEAP_ARRAY(jint, _array_ind_stack); + } + + void do_oop(narrowOop* p) { + guarantee(false, "NYI"); + } + + void do_oop(oop* p) { + oop obj = *p; + if (obj == NULL) return; + if (obj->is_forwarded()) { + // If the object has already been forwarded, we have to make sure + // that it's marked. So follow the forwarding pointer. Note that + // this does the right thing for self-forwarding pointers in the + // evacuation failure case. + obj = obj->forwardee(); + } + HeapRegion* hr = _g1h->heap_region_containing(obj); + if (hr != NULL) { + if (hr->in_collection_set()) { + if (_g1h->is_obj_ill(obj)) { + _bm->mark((HeapWord*)obj); + if (!push(obj)) { + gclog_or_tty->print_cr("Setting abort in CSMarkOopClosure because push failed."); + set_abort(); + } + } + } else { + // Outside the collection set; we need to gray it + _cm->deal_with_reference(obj); + } + } + } +}; + +class CSMarkBitMapClosure: public BitMapClosure { + G1CollectedHeap* _g1h; + CMBitMap* _bitMap; + ConcurrentMark* _cm; + CSMarkOopClosure _oop_cl; +public: + CSMarkBitMapClosure(ConcurrentMark* cm, int ms_size) : + _g1h(G1CollectedHeap::heap()), + _bitMap(cm->nextMarkBitMap()), + _oop_cl(cm, ms_size) + {} + + ~CSMarkBitMapClosure() {} + + bool do_bit(size_t offset) { + // convert offset into a HeapWord* + HeapWord* addr = _bitMap->offsetToHeapWord(offset); + assert(_bitMap->endWord() && addr < _bitMap->endWord(), + "address out of range"); + assert(_bitMap->isMarked(addr), "tautology"); + oop obj = oop(addr); + if (!obj->is_forwarded()) { + if (!_oop_cl.push(obj)) return false; + if (!_oop_cl.drain()) return false; + } + // Otherwise... + return true; + } +}; + + +class CompleteMarkingInCSHRClosure: public HeapRegionClosure { + CMBitMap* _bm; + CSMarkBitMapClosure _bit_cl; + enum SomePrivateConstants { + MSSize = 1000 + }; + bool _completed; +public: + CompleteMarkingInCSHRClosure(ConcurrentMark* cm) : + _bm(cm->nextMarkBitMap()), + _bit_cl(cm, MSSize), + _completed(true) + {} + + ~CompleteMarkingInCSHRClosure() {} + + bool doHeapRegion(HeapRegion* r) { + if (!r->evacuation_failed()) { + MemRegion mr = MemRegion(r->bottom(), r->next_top_at_mark_start()); + if (!mr.is_empty()) { + if (!_bm->iterate(&_bit_cl, mr)) { + _completed = false; + return true; + } + } + } + return false; + } + + bool completed() { return _completed; } +}; + +class ClearMarksInHRClosure: public HeapRegionClosure { + CMBitMap* _bm; +public: + ClearMarksInHRClosure(CMBitMap* bm): _bm(bm) { } + + bool doHeapRegion(HeapRegion* r) { + if (!r->used_region().is_empty() && !r->evacuation_failed()) { + MemRegion usedMR = r->used_region(); + _bm->clearRange(r->used_region()); + } + return false; + } +}; + +void ConcurrentMark::complete_marking_in_collection_set() { + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + + if (!g1h->mark_in_progress()) { + g1h->g1_policy()->record_mark_closure_time(0.0); + return; + } + + int i = 1; + double start = os::elapsedTime(); + while (true) { + i++; + CompleteMarkingInCSHRClosure cmplt(this); + g1h->collection_set_iterate(&cmplt); + if (cmplt.completed()) break; + } + double end_time = os::elapsedTime(); + double elapsed_time_ms = (end_time - start) * 1000.0; + g1h->g1_policy()->record_mark_closure_time(elapsed_time_ms); + if (PrintGCDetails) { + gclog_or_tty->print_cr("Mark closure took %5.2f ms.", elapsed_time_ms); + } + + ClearMarksInHRClosure clr(nextMarkBitMap()); + g1h->collection_set_iterate(&clr); +} + +// The next two methods deal with the following optimisation. Some +// objects are gray by being marked and located above the finger. If +// they are copied, during an evacuation pause, below the finger then +// the need to be pushed on the stack. The observation is that, if +// there are no regions in the collection set located above the +// finger, then the above cannot happen, hence we do not need to +// explicitly gray any objects when copying them to below the +// finger. The global stack will be scanned to ensure that, if it +// points to objects being copied, it will update their +// location. There is a tricky situation with the gray objects in +// region stack that are being coped, however. See the comment in +// newCSet(). + +void ConcurrentMark::newCSet() { + if (!concurrent_marking_in_progress()) + // nothing to do if marking is not in progress + return; + + // find what the lowest finger is among the global and local fingers + _min_finger = _finger; + for (int i = 0; i < (int)_max_task_num; ++i) { + CMTask* task = _tasks[i]; + HeapWord* task_finger = task->finger(); + if (task_finger != NULL && task_finger < _min_finger) + _min_finger = task_finger; + } + + _should_gray_objects = false; + + // This fixes a very subtle and fustrating bug. It might be the case + // that, during en evacuation pause, heap regions that contain + // objects that are gray (by being in regions contained in the + // region stack) are included in the collection set. Since such gray + // objects will be moved, and because it's not easy to redirect + // region stack entries to point to a new location (because objects + // in one region might be scattered to multiple regions after they + // are copied), one option is to ensure that all marked objects + // copied during a pause are pushed on the stack. Notice, however, + // that this problem can only happen when the region stack is not + // empty during an evacuation pause. So, we make the fix a bit less + // conservative and ensure that regions are pushed on the stack, + // irrespective whether all collection set regions are below the + // finger, if the region stack is not empty. This is expected to be + // a rare case, so I don't think it's necessary to be smarted about it. + if (!region_stack_empty()) + _should_gray_objects = true; +} + +void ConcurrentMark::registerCSetRegion(HeapRegion* hr) { + if (!concurrent_marking_in_progress()) + return; + + HeapWord* region_end = hr->end(); + if (region_end > _min_finger) + _should_gray_objects = true; +} + +void ConcurrentMark::disable_co_trackers() { + if (has_aborted()) { + if (_cleanup_co_tracker.enabled()) + _cleanup_co_tracker.disable(); + for (int i = 0; i < (int)_max_task_num; ++i) { + CMTask* task = _tasks[i]; + if (task->co_tracker_enabled()) + task->disable_co_tracker(); + } + } else { + guarantee( !_cleanup_co_tracker.enabled(), "invariant" ); + for (int i = 0; i < (int)_max_task_num; ++i) { + CMTask* task = _tasks[i]; + guarantee( !task->co_tracker_enabled(), "invariant" ); + } + } +} + +// abandon current marking iteration due to a Full GC +void ConcurrentMark::abort() { + // If we're not marking, nothing to do. + if (!G1ConcMark) return; + + // Clear all marks to force marking thread to do nothing + _nextMarkBitMap->clearAll(); + // Empty mark stack + clear_marking_state(); + for (int i = 0; i < (int)_max_task_num; ++i) + _tasks[i]->clear_region_fields(); + _has_aborted = true; + + SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set(); + satb_mq_set.abandon_partial_marking(); + satb_mq_set.set_active_all_threads(false); +} + +static void print_ms_time_info(const char* prefix, const char* name, + NumberSeq& ns) { + gclog_or_tty->print_cr("%s%5d %12s: total time = %8.2f s (avg = %8.2f ms).", + prefix, ns.num(), name, ns.sum()/1000.0, ns.avg()); + if (ns.num() > 0) { + gclog_or_tty->print_cr("%s [std. dev = %8.2f ms, max = %8.2f ms]", + prefix, ns.sd(), ns.maximum()); + } +} + +void ConcurrentMark::print_summary_info() { + gclog_or_tty->print_cr(" Concurrent marking:"); + print_ms_time_info(" ", "init marks", _init_times); + print_ms_time_info(" ", "remarks", _remark_times); + { + print_ms_time_info(" ", "final marks", _remark_mark_times); + print_ms_time_info(" ", "weak refs", _remark_weak_ref_times); + + } + print_ms_time_info(" ", "cleanups", _cleanup_times); + gclog_or_tty->print_cr(" Final counting total time = %8.2f s (avg = %8.2f ms).", + _total_counting_time, + (_cleanup_times.num() > 0 ? _total_counting_time * 1000.0 / + (double)_cleanup_times.num() + : 0.0)); + if (G1ScrubRemSets) { + gclog_or_tty->print_cr(" RS scrub total time = %8.2f s (avg = %8.2f ms).", + _total_rs_scrub_time, + (_cleanup_times.num() > 0 ? _total_rs_scrub_time * 1000.0 / + (double)_cleanup_times.num() + : 0.0)); + } + gclog_or_tty->print_cr(" Total stop_world time = %8.2f s.", + (_init_times.sum() + _remark_times.sum() + + _cleanup_times.sum())/1000.0); + gclog_or_tty->print_cr(" Total concurrent time = %8.2f s " + "(%8.2f s marking, %8.2f s counting).", + cmThread()->vtime_accum(), + cmThread()->vtime_mark_accum(), + cmThread()->vtime_count_accum()); +} + +// Closures +// XXX: there seems to be a lot of code duplication here; +// should refactor and consolidate the shared code. + +// This closure is used to mark refs into the CMS generation in +// the CMS bit map. Called at the first checkpoint. + +// We take a break if someone is trying to stop the world. +bool ConcurrentMark::do_yield_check(int worker_i) { + if (should_yield()) { + if (worker_i == 0) + _g1h->g1_policy()->record_concurrent_pause(); + cmThread()->yield(); + if (worker_i == 0) + _g1h->g1_policy()->record_concurrent_pause_end(); + return true; + } else { + return false; + } +} + +bool ConcurrentMark::should_yield() { + return cmThread()->should_yield(); +} + +bool ConcurrentMark::containing_card_is_marked(void* p) { + size_t offset = pointer_delta(p, _g1h->reserved_region().start(), 1); + return _card_bm.at(offset >> CardTableModRefBS::card_shift); +} + +bool ConcurrentMark::containing_cards_are_marked(void* start, + void* last) { + return + containing_card_is_marked(start) && + containing_card_is_marked(last); +} + +#ifndef PRODUCT +// for debugging purposes +void ConcurrentMark::print_finger() { + gclog_or_tty->print_cr("heap ["PTR_FORMAT", "PTR_FORMAT"), global finger = "PTR_FORMAT, + _heap_start, _heap_end, _finger); + for (int i = 0; i < (int) _max_task_num; ++i) { + gclog_or_tty->print(" %d: "PTR_FORMAT, i, _tasks[i]->finger()); + } + gclog_or_tty->print_cr(""); +} +#endif + +// Closure for iteration over bitmaps +class CMBitMapClosure : public BitMapClosure { +private: + // the bitmap that is being iterated over + CMBitMap* _nextMarkBitMap; + ConcurrentMark* _cm; + CMTask* _task; + // true if we're scanning a heap region claimed by the task (so that + // we move the finger along), false if we're not, i.e. currently when + // scanning a heap region popped from the region stack (so that we + // do not move the task finger along; it'd be a mistake if we did so). + bool _scanning_heap_region; + +public: + CMBitMapClosure(CMTask *task, + ConcurrentMark* cm, + CMBitMap* nextMarkBitMap) + : _task(task), _cm(cm), _nextMarkBitMap(nextMarkBitMap) { } + + void set_scanning_heap_region(bool scanning_heap_region) { + _scanning_heap_region = scanning_heap_region; + } + + bool do_bit(size_t offset) { + HeapWord* addr = _nextMarkBitMap->offsetToHeapWord(offset); + tmp_guarantee_CM( _nextMarkBitMap->isMarked(addr), "invariant" ); + tmp_guarantee_CM( addr < _cm->finger(), "invariant" ); + + if (_scanning_heap_region) { + statsOnly( _task->increase_objs_found_on_bitmap() ); + tmp_guarantee_CM( addr >= _task->finger(), "invariant" ); + // We move that task's local finger along. + _task->move_finger_to(addr); + } else { + // We move the task's region finger along. + _task->move_region_finger_to(addr); + } + + _task->scan_object(oop(addr)); + // we only partially drain the local queue and global stack + _task->drain_local_queue(true); + _task->drain_global_stack(true); + + // if the has_aborted flag has been raised, we need to bail out of + // the iteration + return !_task->has_aborted(); + } +}; + +// Closure for iterating over objects, currently only used for +// processing SATB buffers. +class CMObjectClosure : public ObjectClosure { +private: + CMTask* _task; + +public: + void do_object(oop obj) { + _task->deal_with_reference(obj); + } + + CMObjectClosure(CMTask* task) : _task(task) { } +}; + +// Closure for iterating over object fields +class CMOopClosure : public OopClosure { +private: + G1CollectedHeap* _g1h; + ConcurrentMark* _cm; + CMTask* _task; + +public: + void do_oop(narrowOop* p) { + guarantee(false, "NYI"); + } + + void do_oop(oop* p) { + tmp_guarantee_CM( _g1h->is_in_g1_reserved((HeapWord*) p), "invariant" ); + + oop obj = *p; + if (_cm->verbose_high()) + gclog_or_tty->print_cr("[%d] we're looking at location " + "*"PTR_FORMAT" = "PTR_FORMAT, + _task->task_id(), p, (void*) obj); + _task->deal_with_reference(obj); + } + + CMOopClosure(G1CollectedHeap* g1h, + ConcurrentMark* cm, + CMTask* task) + : _g1h(g1h), _cm(cm), _task(task) { } +}; + +void CMTask::setup_for_region(HeapRegion* hr) { + tmp_guarantee_CM( hr != NULL && !hr->continuesHumongous(), + "claim_region() should have filtered out continues humongous regions" ); + + if (_cm->verbose_low()) + gclog_or_tty->print_cr("[%d] setting up for region "PTR_FORMAT, + _task_id, hr); + + _curr_region = hr; + _finger = hr->bottom(); + update_region_limit(); +} + +void CMTask::update_region_limit() { + HeapRegion* hr = _curr_region; + HeapWord* bottom = hr->bottom(); + HeapWord* limit = hr->next_top_at_mark_start(); + + if (limit == bottom) { + if (_cm->verbose_low()) + gclog_or_tty->print_cr("[%d] found an empty region " + "["PTR_FORMAT", "PTR_FORMAT")", + _task_id, bottom, limit); + // The region was collected underneath our feet. + // We set the finger to bottom to ensure that the bitmap + // iteration that will follow this will not do anything. + // (this is not a condition that holds when we set the region up, + // as the region is not supposed to be empty in the first place) + _finger = bottom; + } else if (limit >= _region_limit) { + tmp_guarantee_CM( limit >= _finger, "peace of mind" ); + } else { + tmp_guarantee_CM( limit < _region_limit, "only way to get here" ); + // This can happen under some pretty unusual circumstances. An + // evacuation pause empties the region underneath our feet (NTAMS + // at bottom). We then do some allocation in the region (NTAMS + // stays at bottom), followed by the region being used as a GC + // alloc region (NTAMS will move to top() and the objects + // originally below it will be grayed). All objects now marked in + // the region are explicitly grayed, if below the global finger, + // and we do not need in fact to scan anything else. So, we simply + // set _finger to be limit to ensure that the bitmap iteration + // doesn't do anything. + _finger = limit; + } + + _region_limit = limit; +} + +void CMTask::giveup_current_region() { + tmp_guarantee_CM( _curr_region != NULL, "invariant" ); + if (_cm->verbose_low()) + gclog_or_tty->print_cr("[%d] giving up region "PTR_FORMAT, + _task_id, _curr_region); + clear_region_fields(); +} + +void CMTask::clear_region_fields() { + // Values for these three fields that indicate that we're not + // holding on to a region. + _curr_region = NULL; + _finger = NULL; + _region_limit = NULL; + + _region_finger = NULL; +} + +void CMTask::reset(CMBitMap* nextMarkBitMap) { + guarantee( nextMarkBitMap != NULL, "invariant" ); + + if (_cm->verbose_low()) + gclog_or_tty->print_cr("[%d] resetting", _task_id); + + _nextMarkBitMap = nextMarkBitMap; + clear_region_fields(); + + _calls = 0; + _elapsed_time_ms = 0.0; + _termination_time_ms = 0.0; + _termination_start_time_ms = 0.0; + +#if _MARKING_STATS_ + _local_pushes = 0; + _local_pops = 0; + _local_max_size = 0; + _objs_scanned = 0; + _global_pushes = 0; + _global_pops = 0; + _global_max_size = 0; + _global_transfers_to = 0; + _global_transfers_from = 0; + _region_stack_pops = 0; + _regions_claimed = 0; + _objs_found_on_bitmap = 0; + _satb_buffers_processed = 0; + _steal_attempts = 0; + _steals = 0; + _aborted = 0; + _aborted_overflow = 0; + _aborted_cm_aborted = 0; + _aborted_yield = 0; + _aborted_timed_out = 0; + _aborted_satb = 0; + _aborted_termination = 0; +#endif // _MARKING_STATS_ +} + +bool CMTask::should_exit_termination() { + regular_clock_call(); + // This is called when we are in the termination protocol. We should + // quit if, for some reason, this task wants to abort or the global + // stack is not empty (this means that we can get work from it). + return !_cm->mark_stack_empty() || has_aborted(); +} + +// This determines whether the method below will check both the local +// and global fingers when determining whether to push on the stack a +// gray object (value 1) or whether it will only check the global one +// (value 0). The tradeoffs are that the former will be a bit more +// accurate and possibly push less on the stack, but it might also be +// a little bit slower. + +#define _CHECK_BOTH_FINGERS_ 1 + +void CMTask::deal_with_reference(oop obj) { + if (_cm->verbose_high()) + gclog_or_tty->print_cr("[%d] we're dealing with reference = "PTR_FORMAT, + _task_id, (void*) obj); + + ++_refs_reached; + + HeapWord* objAddr = (HeapWord*) obj; + if (_g1h->is_in_g1_reserved(objAddr)) { + tmp_guarantee_CM( obj != NULL, "is_in_g1_reserved should ensure this" ); + HeapRegion* hr = _g1h->heap_region_containing(obj); + if (_g1h->is_obj_ill(obj, hr)) { + if (_cm->verbose_high()) + gclog_or_tty->print_cr("[%d] "PTR_FORMAT" is not considered marked", + _task_id, (void*) obj); + + // we need to mark it first + if (_nextMarkBitMap->parMark(objAddr)) { + // No OrderAccess:store_load() is needed. It is implicit in the + // CAS done in parMark(objAddr) above + HeapWord* global_finger = _cm->finger(); + +#if _CHECK_BOTH_FINGERS_ + // we will check both the local and global fingers + + if (_finger != NULL && objAddr < _finger) { + if (_cm->verbose_high()) + gclog_or_tty->print_cr("[%d] below the local finger ("PTR_FORMAT"), " + "pushing it", _task_id, _finger); + push(obj); + } else if (_curr_region != NULL && objAddr < _region_limit) { + // do nothing + } else if (objAddr < global_finger) { + // Notice that the global finger might be moving forward + // concurrently. This is not a problem. In the worst case, we + // mark the object while it is above the global finger and, by + // the time we read the global finger, it has moved forward + // passed this object. In this case, the object will probably + // be visited when a task is scanning the region and will also + // be pushed on the stack. So, some duplicate work, but no + // correctness problems. + + if (_cm->verbose_high()) + gclog_or_tty->print_cr("[%d] below the global finger " + "("PTR_FORMAT"), pushing it", + _task_id, global_finger); + push(obj); + } else { + // do nothing + } +#else // _CHECK_BOTH_FINGERS_ + // we will only check the global finger + + if (objAddr < global_finger) { + // see long comment above + + if (_cm->verbose_high()) + gclog_or_tty->print_cr("[%d] below the global finger " + "("PTR_FORMAT"), pushing it", + _task_id, global_finger); + push(obj); + } +#endif // _CHECK_BOTH_FINGERS_ + } + } + } +} + +void CMTask::push(oop obj) { + HeapWord* objAddr = (HeapWord*) obj; + tmp_guarantee_CM( _g1h->is_in_g1_reserved(objAddr), "invariant" ); + tmp_guarantee_CM( !_g1h->is_obj_ill(obj), "invariant" ); + tmp_guarantee_CM( _nextMarkBitMap->isMarked(objAddr), "invariant" ); + + if (_cm->verbose_high()) + gclog_or_tty->print_cr("[%d] pushing "PTR_FORMAT, _task_id, (void*) obj); + + if (!_task_queue->push(obj)) { + // The local task queue looks full. We need to push some entries + // to the global stack. + + if (_cm->verbose_medium()) + gclog_or_tty->print_cr("[%d] task queue overflow, " + "moving entries to the global stack", + _task_id); + move_entries_to_global_stack(); + + // this should succeed since, even if we overflow the global + // stack, we should have definitely removed some entries from the + // local queue. So, there must be space on it. + bool success = _task_queue->push(obj); + tmp_guarantee_CM( success, "invariant" ); + } + + statsOnly( int tmp_size = _task_queue->size(); + if (tmp_size > _local_max_size) + _local_max_size = tmp_size; + ++_local_pushes ); +} + +void CMTask::reached_limit() { + tmp_guarantee_CM( _words_scanned >= _words_scanned_limit || + _refs_reached >= _refs_reached_limit , + "shouldn't have been called otherwise" ); + regular_clock_call(); +} + +void CMTask::regular_clock_call() { + if (has_aborted()) + return; + + // First, we need to recalculate the words scanned and refs reached + // limits for the next clock call. + recalculate_limits(); + + // During the regular clock call we do the following + + // (1) If an overflow has been flagged, then we abort. + if (_cm->has_overflown()) { + set_has_aborted(); + return; + } + + // If we are not concurrent (i.e. we're doing remark) we don't need + // to check anything else. The other steps are only needed during + // the concurrent marking phase. + if (!concurrent()) + return; + + // (2) If marking has been aborted for Full GC, then we also abort. + if (_cm->has_aborted()) { + set_has_aborted(); + statsOnly( ++_aborted_cm_aborted ); + return; + } + + double curr_time_ms = os::elapsedVTime() * 1000.0; + + // (3) If marking stats are enabled, then we update the step history. +#if _MARKING_STATS_ + if (_words_scanned >= _words_scanned_limit) + ++_clock_due_to_scanning; + if (_refs_reached >= _refs_reached_limit) + ++_clock_due_to_marking; + + double last_interval_ms = curr_time_ms - _interval_start_time_ms; + _interval_start_time_ms = curr_time_ms; + _all_clock_intervals_ms.add(last_interval_ms); + + if (_cm->verbose_medium()) { + gclog_or_tty->print_cr("[%d] regular clock, interval = %1.2lfms, " + "scanned = %d%s, refs reached = %d%s", + _task_id, last_interval_ms, + _words_scanned, + (_words_scanned >= _words_scanned_limit) ? " (*)" : "", + _refs_reached, + (_refs_reached >= _refs_reached_limit) ? " (*)" : ""); + } +#endif // _MARKING_STATS_ + + // (4) We check whether we should yield. If we have to, then we abort. + if (_cm->should_yield()) { + // We should yield. To do this we abort the task. The caller is + // responsible for yielding. + set_has_aborted(); + statsOnly( ++_aborted_yield ); + return; + } + + // (5) We check whether we've reached our time quota. If we have, + // then we abort. + double elapsed_time_ms = curr_time_ms - _start_time_ms; + if (elapsed_time_ms > _time_target_ms) { + set_has_aborted(); + _has_aborted_timed_out = true; + statsOnly( ++_aborted_timed_out ); + return; + } + + // (6) Finally, we check whether there are enough completed STAB + // buffers available for processing. If there are, we abort. + SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set(); + if (!_draining_satb_buffers && satb_mq_set.process_completed_buffers()) { + if (_cm->verbose_low()) + gclog_or_tty->print_cr("[%d] aborting to deal with pending SATB buffers", + _task_id); + // we do need to process SATB buffers, we'll abort and restart + // the marking task to do so + set_has_aborted(); + statsOnly( ++_aborted_satb ); + return; + } +} + +void CMTask::recalculate_limits() { + _real_words_scanned_limit = _words_scanned + words_scanned_period; + _words_scanned_limit = _real_words_scanned_limit; + + _real_refs_reached_limit = _refs_reached + refs_reached_period; + _refs_reached_limit = _real_refs_reached_limit; +} + +void CMTask::decrease_limits() { + // This is called when we believe that we're going to do an infrequent + // operation which will increase the per byte scanned cost (i.e. move + // entries to/from the global stack). It basically tries to decrease the + // scanning limit so that the clock is called earlier. + + if (_cm->verbose_medium()) + gclog_or_tty->print_cr("[%d] decreasing limits", _task_id); + + _words_scanned_limit = _real_words_scanned_limit - + 3 * words_scanned_period / 4; + _refs_reached_limit = _real_refs_reached_limit - + 3 * refs_reached_period / 4; +} + +void CMTask::move_entries_to_global_stack() { + // local array where we'll store the entries that will be popped + // from the local queue + oop buffer[global_stack_transfer_size]; + + int n = 0; + oop obj; + while (n < global_stack_transfer_size && _task_queue->pop_local(obj)) { + buffer[n] = obj; + ++n; + } + + if (n > 0) { + // we popped at least one entry from the local queue + + statsOnly( ++_global_transfers_to; _local_pops += n ); + + if (!_cm->mark_stack_push(buffer, n)) { + if (_cm->verbose_low()) + gclog_or_tty->print_cr("[%d] aborting due to global stack overflow", _task_id); + set_has_aborted(); + } else { + // the transfer was successful + + if (_cm->verbose_medium()) + gclog_or_tty->print_cr("[%d] pushed %d entries to the global stack", + _task_id, n); + statsOnly( int tmp_size = _cm->mark_stack_size(); + if (tmp_size > _global_max_size) + _global_max_size = tmp_size; + _global_pushes += n ); + } + } + + // this operation was quite expensive, so decrease the limits + decrease_limits(); +} + +void CMTask::get_entries_from_global_stack() { + // local array where we'll store the entries that will be popped + // from the global stack. + oop buffer[global_stack_transfer_size]; + int n; + _cm->mark_stack_pop(buffer, global_stack_transfer_size, &n); + tmp_guarantee_CM( n <= global_stack_transfer_size, + "we should not pop more than the given limit" ); + if (n > 0) { + // yes, we did actually pop at least one entry + + statsOnly( ++_global_transfers_from; _global_pops += n ); + if (_cm->verbose_medium()) + gclog_or_tty->print_cr("[%d] popped %d entries from the global stack", + _task_id, n); + for (int i = 0; i < n; ++i) { + bool success = _task_queue->push(buffer[i]); + // We only call this when the local queue is empty or under a + // given target limit. So, we do not expect this push to fail. + tmp_guarantee_CM( success, "invariant" ); + } + + statsOnly( int tmp_size = _task_queue->size(); + if (tmp_size > _local_max_size) + _local_max_size = tmp_size; + _local_pushes += n ); + } + + // this operation was quite expensive, so decrease the limits + decrease_limits(); +} + +void CMTask::drain_local_queue(bool partially) { + if (has_aborted()) + return; + + // Decide what the target size is, depending whether we're going to + // drain it partially (so that other tasks can steal if they run out + // of things to do) or totally (at the very end). + size_t target_size; + if (partially) + target_size = MIN2((size_t)_task_queue->max_elems()/3, GCDrainStackTargetSize); + else + target_size = 0; + + if (_task_queue->size() > target_size) { + if (_cm->verbose_high()) + gclog_or_tty->print_cr("[%d] draining local queue, target size = %d", + _task_id, target_size); + + oop obj; + bool ret = _task_queue->pop_local(obj); + while (ret) { + statsOnly( ++_local_pops ); + + if (_cm->verbose_high()) + gclog_or_tty->print_cr("[%d] popped "PTR_FORMAT, _task_id, + (void*) obj); + + tmp_guarantee_CM( _g1h->is_in_g1_reserved((HeapWord*) obj), + "invariant" ); + + scan_object(obj); + + if (_task_queue->size() <= target_size || has_aborted()) + ret = false; + else + ret = _task_queue->pop_local(obj); + } + + if (_cm->verbose_high()) + gclog_or_tty->print_cr("[%d] drained local queue, size = %d", + _task_id, _task_queue->size()); + } +} + +void CMTask::drain_global_stack(bool partially) { + if (has_aborted()) + return; + + // We have a policy to drain the local queue before we attempt to + // drain the global stack. + tmp_guarantee_CM( partially || _task_queue->size() == 0, "invariant" ); + + // Decide what the target size is, depending whether we're going to + // drain it partially (so that other tasks can steal if they run out + // of things to do) or totally (at the very end). Notice that, + // because we move entries from the global stack in chunks or + // because another task might be doing the same, we might in fact + // drop below the target. But, this is not a problem. + size_t target_size; + if (partially) + target_size = _cm->partial_mark_stack_size_target(); + else + target_size = 0; + + if (_cm->mark_stack_size() > target_size) { + if (_cm->verbose_low()) + gclog_or_tty->print_cr("[%d] draining global_stack, target size %d", + _task_id, target_size); + + while (!has_aborted() && _cm->mark_stack_size() > target_size) { + get_entries_from_global_stack(); + drain_local_queue(partially); + } + + if (_cm->verbose_low()) + gclog_or_tty->print_cr("[%d] drained global stack, size = %d", + _task_id, _cm->mark_stack_size()); + } +} + +// SATB Queue has several assumptions on whether to call the par or +// non-par versions of the methods. this is why some of the code is +// replicated. We should really get rid of the single-threaded version +// of the code to simplify things. +void CMTask::drain_satb_buffers() { + if (has_aborted()) + return; + + // We set this so that the regular clock knows that we're in the + // middle of draining buffers and doesn't set the abort flag when it + // notices that SATB buffers are available for draining. It'd be + // very counter productive if it did that. :-) + _draining_satb_buffers = true; + + CMObjectClosure oc(this); + SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set(); + if (ParallelGCThreads > 0) + satb_mq_set.set_par_closure(_task_id, &oc); + else + satb_mq_set.set_closure(&oc); + + // This keeps claiming and applying the closure to completed buffers + // until we run out of buffers or we need to abort. + if (ParallelGCThreads > 0) { + while (!has_aborted() && + satb_mq_set.par_apply_closure_to_completed_buffer(_task_id)) { + if (_cm->verbose_medium()) + gclog_or_tty->print_cr("[%d] processed an SATB buffer", _task_id); + statsOnly( ++_satb_buffers_processed ); + regular_clock_call(); + } + } else { + while (!has_aborted() && + satb_mq_set.apply_closure_to_completed_buffer()) { + if (_cm->verbose_medium()) + gclog_or_tty->print_cr("[%d] processed an SATB buffer", _task_id); + statsOnly( ++_satb_buffers_processed ); + regular_clock_call(); + } + } + + if (!concurrent() && !has_aborted()) { + // We should only do this during remark. + if (ParallelGCThreads > 0) + satb_mq_set.par_iterate_closure_all_threads(_task_id); + else + satb_mq_set.iterate_closure_all_threads(); + } + + _draining_satb_buffers = false; + + tmp_guarantee_CM( has_aborted() || + concurrent() || + satb_mq_set.completed_buffers_num() == 0, "invariant" ); + + if (ParallelGCThreads > 0) + satb_mq_set.set_par_closure(_task_id, NULL); + else + satb_mq_set.set_closure(NULL); + + // again, this was a potentially expensive operation, decrease the + // limits to get the regular clock call early + decrease_limits(); +} + +void CMTask::drain_region_stack(BitMapClosure* bc) { + if (has_aborted()) + return; + + tmp_guarantee_CM( _region_finger == NULL, + "it should be NULL when we're not scanning a region" ); + + if (!_cm->region_stack_empty()) { + if (_cm->verbose_low()) + gclog_or_tty->print_cr("[%d] draining region stack, size = %d", + _task_id, _cm->region_stack_size()); + + MemRegion mr = _cm->region_stack_pop(); + // it returns MemRegion() if the pop fails + statsOnly(if (mr.start() != NULL) ++_region_stack_pops ); + + while (mr.start() != NULL) { + if (_cm->verbose_medium()) + gclog_or_tty->print_cr("[%d] we are scanning region " + "["PTR_FORMAT", "PTR_FORMAT")", + _task_id, mr.start(), mr.end()); + tmp_guarantee_CM( mr.end() <= _cm->finger(), + "otherwise the region shouldn't be on the stack" ); + assert(!mr.is_empty(), "Only non-empty regions live on the region stack"); + if (_nextMarkBitMap->iterate(bc, mr)) { + tmp_guarantee_CM( !has_aborted(), + "cannot abort the task without aborting the bitmap iteration" ); + + // We finished iterating over the region without aborting. + regular_clock_call(); + if (has_aborted()) + mr = MemRegion(); + else { + mr = _cm->region_stack_pop(); + // it returns MemRegion() if the pop fails + statsOnly(if (mr.start() != NULL) ++_region_stack_pops ); + } + } else { + guarantee( has_aborted(), "currently the only way to do so" ); + + // The only way to abort the bitmap iteration is to return + // false from the do_bit() method. However, inside the + // do_bit() method we move the _region_finger to point to the + // object currently being looked at. So, if we bail out, we + // have definitely set _region_finger to something non-null. + guarantee( _region_finger != NULL, "invariant" ); + + // The iteration was actually aborted. So now _region_finger + // points to the address of the object we last scanned. If we + // leave it there, when we restart this task, we will rescan + // the object. It is easy to avoid this. We move the finger by + // enough to point to the next possible object header (the + // bitmap knows by how much we need to move it as it knows its + // granularity). + MemRegion newRegion = + MemRegion(_nextMarkBitMap->nextWord(_region_finger), mr.end()); + + if (!newRegion.is_empty()) { + if (_cm->verbose_low()) { + gclog_or_tty->print_cr("[%d] pushing unscanned region" + "[" PTR_FORMAT "," PTR_FORMAT ") on region stack", + _task_id, + newRegion.start(), newRegion.end()); + } + // 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); + } + // break from while + mr = MemRegion(); + } + _region_finger = NULL; + } + + // We only push regions on the region stack during evacuation + // pauses. So if we come out the above iteration because we region + // stack is empty, it will remain empty until the next yield + // point. So, the guarantee below is safe. + guarantee( has_aborted() || _cm->region_stack_empty(), + "only way to exit the loop" ); + + if (_cm->verbose_low()) + gclog_or_tty->print_cr("[%d] drained region stack, size = %d", + _task_id, _cm->region_stack_size()); + } +} + +void CMTask::print_stats() { + gclog_or_tty->print_cr("Marking Stats, task = %d, calls = %d", + _task_id, _calls); + gclog_or_tty->print_cr(" Elapsed time = %1.2lfms, Termination time = %1.2lfms", + _elapsed_time_ms, _termination_time_ms); + gclog_or_tty->print_cr(" Step Times (cum): num = %d, avg = %1.2lfms, sd = %1.2lfms", + _step_times_ms.num(), _step_times_ms.avg(), + _step_times_ms.sd()); + gclog_or_tty->print_cr(" max = %1.2lfms, total = %1.2lfms", + _step_times_ms.maximum(), _step_times_ms.sum()); + +#if _MARKING_STATS_ + gclog_or_tty->print_cr(" Clock Intervals (cum): num = %d, avg = %1.2lfms, sd = %1.2lfms", + _all_clock_intervals_ms.num(), _all_clock_intervals_ms.avg(), + _all_clock_intervals_ms.sd()); + gclog_or_tty->print_cr(" max = %1.2lfms, total = %1.2lfms", + _all_clock_intervals_ms.maximum(), + _all_clock_intervals_ms.sum()); + gclog_or_tty->print_cr(" Clock Causes (cum): scanning = %d, marking = %d", + _clock_due_to_scanning, _clock_due_to_marking); + gclog_or_tty->print_cr(" Objects: scanned = %d, found on the bitmap = %d", + _objs_scanned, _objs_found_on_bitmap); + gclog_or_tty->print_cr(" Local Queue: pushes = %d, pops = %d, max size = %d", + _local_pushes, _local_pops, _local_max_size); + gclog_or_tty->print_cr(" Global Stack: pushes = %d, pops = %d, max size = %d", + _global_pushes, _global_pops, _global_max_size); + gclog_or_tty->print_cr(" transfers to = %d, transfers from = %d", + _global_transfers_to,_global_transfers_from); + gclog_or_tty->print_cr(" Regions: claimed = %d, Region Stack: pops = %d", + _regions_claimed, _region_stack_pops); + gclog_or_tty->print_cr(" SATB buffers: processed = %d", _satb_buffers_processed); + gclog_or_tty->print_cr(" Steals: attempts = %d, successes = %d", + _steal_attempts, _steals); + gclog_or_tty->print_cr(" Aborted: %d, due to", _aborted); + gclog_or_tty->print_cr(" overflow: %d, global abort: %d, yield: %d", + _aborted_overflow, _aborted_cm_aborted, _aborted_yield); + gclog_or_tty->print_cr(" time out: %d, SATB: %d, termination: %d", + _aborted_timed_out, _aborted_satb, _aborted_termination); +#endif // _MARKING_STATS_ +} + +/***************************************************************************** + + The do_marking_step(time_target_ms) method is the building block + of the parallel marking framework. It can be called in parallel + with other invocations of do_marking_step() on different tasks + (but only one per task, obviously) and concurrently with the + mutator threads, or during remark, hence it eliminates the need + for two versions of the code. When called during remark, it will + pick up from where the task left off during the concurrent marking + phase. Interestingly, tasks are also claimable during evacuation + pauses too, since do_marking_step() ensures that it aborts before + it needs to yield. + + The data structures that is uses to do marking work are the + following: + + (1) Marking Bitmap. If there are gray objects that appear only + on the bitmap (this happens either when dealing with an overflow + or when the initial marking phase has simply marked the roots + and didn't push them on the stack), then tasks claim heap + regions whose bitmap they then scan to find gray objects. A + global finger indicates where the end of the last claimed region + is. A local finger indicates how far into the region a task has + scanned. The two fingers are used to determine how to gray an + object (i.e. whether simply marking it is OK, as it will be + visited by a task in the future, or whether it needs to be also + pushed on a stack). + + (2) Local Queue. The local queue of the task which is accessed + reasonably efficiently by the task. Other tasks can steal from + it when they run out of work. Throughout the marking phase, a + task attempts to keep its local queue short but not totally + empty, so that entries are available for stealing by other + tasks. Only when there is no more work, a task will totally + drain its local queue. + + (3) Global Mark Stack. This handles local queue overflow. During + marking only sets of entries are moved between it and the local + queues, as access to it requires a mutex and more fine-grain + interaction with it which might cause contention. If it + overflows, then the marking phase should restart and iterate + over the bitmap to identify gray objects. Throughout the marking + phase, tasks attempt to keep the global mark stack at a small + length but not totally empty, so that entries are available for + popping by other tasks. Only when there is no more work, tasks + will totally drain the global mark stack. + + (4) Global Region Stack. Entries on it correspond to areas of + the bitmap that need to be scanned since they contain gray + objects. Pushes on the region stack only happen during + evacuation pauses and typically correspond to areas covered by + GC LABS. If it overflows, then the marking phase should restart + and iterate over the bitmap to identify gray objects. Tasks will + try to totally drain the region stack as soon as possible. + + (5) SATB Buffer Queue. This is where completed SATB buffers are + made available. Buffers are regularly removed from this queue + and scanned for roots, so that the queue doesn't get too + long. During remark, all completed buffers are processed, as + well as the filled in parts of any uncompleted buffers. + + The do_marking_step() method tries to abort when the time target + has been reached. There are a few other cases when the + do_marking_step() method also aborts: + + (1) When the marking phase has been aborted (after a Full GC). + + (2) When a global overflow (either on the global stack or the + region stack) has been triggered. Before the task aborts, it + will actually sync up with the other tasks to ensure that all + the marking data structures (local queues, stacks, fingers etc.) + are re-initialised so that when do_marking_step() completes, + the marking phase can immediately restart. + + (3) When enough completed SATB buffers are available. The + do_marking_step() method only tries to drain SATB buffers right + at the beginning. So, if enough buffers are available, the + marking step aborts and the SATB buffers are processed at + the beginning of the next invocation. + + (4) To yield. when we have to yield then we abort and yield + right at the end of do_marking_step(). This saves us from a lot + of hassle as, by yielding we might allow a Full GC. If this + happens then objects will be compacted underneath our feet, the + heap might shrink, etc. We save checking for this by just + aborting and doing the yield right at the end. + + From the above it follows that the do_marking_step() method should + be called in a loop (or, otherwise, regularly) until it completes. + + If a marking step completes without its has_aborted() flag being + true, it means it has completed the current marking phase (and + also all other marking tasks have done so and have all synced up). + + A method called regular_clock_call() is invoked "regularly" (in + sub ms intervals) throughout marking. It is this clock method that + checks all the abort conditions which were mentioned above and + decides when the task should abort. A work-based scheme is used to + trigger this clock method: when the number of object words the + marking phase has scanned or the number of references the marking + phase has visited reach a given limit. Additional invocations to + the method clock have been planted in a few other strategic places + too. The initial reason for the clock method was to avoid calling + vtime too regularly, as it is quite expensive. So, once it was in + place, it was natural to piggy-back all the other conditions on it + too and not constantly check them throughout the code. + + *****************************************************************************/ + +void CMTask::do_marking_step(double time_target_ms) { + guarantee( time_target_ms >= 1.0, "minimum granularity is 1ms" ); + guarantee( concurrent() == _cm->concurrent(), "they should be the same" ); + + guarantee( concurrent() || _cm->region_stack_empty(), + "the region stack should have been cleared before remark" ); + guarantee( _region_finger == NULL, + "this should be non-null only when a region is being scanned" ); + + G1CollectorPolicy* g1_policy = _g1h->g1_policy(); + guarantee( _task_queues != NULL, "invariant" ); + guarantee( _task_queue != NULL, "invariant" ); + guarantee( _task_queues->queue(_task_id) == _task_queue, "invariant" ); + + guarantee( !_claimed, + "only one thread should claim this task at any one time" ); + + // OK, this doesn't safeguard again all possible scenarios, as it is + // possible for two threads to set the _claimed flag at the same + // time. But it is only for debugging purposes anyway and it will + // catch most problems. + _claimed = true; + + _start_time_ms = os::elapsedVTime() * 1000.0; + statsOnly( _interval_start_time_ms = _start_time_ms ); + + double diff_prediction_ms = + g1_policy->get_new_prediction(&_marking_step_diffs_ms); + _time_target_ms = time_target_ms - diff_prediction_ms; + + // set up the variables that are used in the work-based scheme to + // call the regular clock method + _words_scanned = 0; + _refs_reached = 0; + recalculate_limits(); + + // clear all flags + clear_has_aborted(); + _has_aborted_timed_out = false; + _draining_satb_buffers = false; + + ++_calls; + + if (_cm->verbose_low()) + gclog_or_tty->print_cr("[%d] >>>>>>>>>> START, call = %d, " + "target = %1.2lfms >>>>>>>>>>", + _task_id, _calls, _time_target_ms); + + // Set up the bitmap and oop closures. Anything that uses them is + // eventually called from this method, so it is OK to allocate these + // statically. + CMBitMapClosure bitmap_closure(this, _cm, _nextMarkBitMap); + CMOopClosure oop_closure(_g1h, _cm, this); + set_oop_closure(&oop_closure); + + if (_cm->has_overflown()) { + // This can happen if the region stack or the mark stack overflows + // during a GC pause and this task, after a yield point, + // restarts. We have to abort as we need to get into the overflow + // protocol which happens right at the end of this task. + set_has_aborted(); + } + + // First drain any available SATB buffers. After this, we will not + // look at SATB buffers before the next invocation of this method. + // If enough completed SATB buffers are queued up, the regular clock + // will abort this task so that it restarts. + drain_satb_buffers(); + // ...then partially drain the local queue and the global stack + drain_local_queue(true); + drain_global_stack(true); + + // Then totally drain the region stack. We will not look at + // it again before the next invocation of this method. Entries on + // the region stack are only added during evacuation pauses, for + // which we have to yield. When we do, we abort the task anyway so + // it will look at the region stack again when it restarts. + bitmap_closure.set_scanning_heap_region(false); + drain_region_stack(&bitmap_closure); + // ...then partially drain the local queue and the global stack + drain_local_queue(true); + drain_global_stack(true); + + do { + if (!has_aborted() && _curr_region != NULL) { + // This means that we're already holding on to a region. + tmp_guarantee_CM( _finger != NULL, + "if region is not NULL, then the finger " + "should not be NULL either" ); + + // We might have restarted this task after an evacuation pause + // which might have evacuated the region we're holding on to + // underneath our feet. Let's read its limit again to make sure + // that we do not iterate over a region of the heap that + // contains garbage (update_region_limit() will also move + // _finger to the start of the region if it is found empty). + update_region_limit(); + // We will start from _finger not from the start of the region, + // as we might be restarting this task after aborting half-way + // through scanning this region. In this case, _finger points to + // the address where we last found a marked object. If this is a + // fresh region, _finger points to start(). + MemRegion mr = MemRegion(_finger, _region_limit); + + if (_cm->verbose_low()) + gclog_or_tty->print_cr("[%d] we're scanning part " + "["PTR_FORMAT", "PTR_FORMAT") " + "of region "PTR_FORMAT, + _task_id, _finger, _region_limit, _curr_region); + + // Let's iterate over the bitmap of the part of the + // region that is left. + bitmap_closure.set_scanning_heap_region(true); + if (mr.is_empty() || + _nextMarkBitMap->iterate(&bitmap_closure, mr)) { + // We successfully completed iterating over the region. Now, + // let's give up the region. + giveup_current_region(); + regular_clock_call(); + } else { + guarantee( has_aborted(), "currently the only way to do so" ); + // The only way to abort the bitmap iteration is to return + // false from the do_bit() method. However, inside the + // do_bit() method we move the _finger to point to the + // object currently being looked at. So, if we bail out, we + // have definitely set _finger to something non-null. + guarantee( _finger != NULL, "invariant" ); + + // Region iteration was actually aborted. So now _finger + // points to the address of the object we last scanned. If we + // leave it there, when we restart this task, we will rescan + // the object. It is easy to avoid this. We move the finger by + // enough to point to the next possible object header (the + // bitmap knows by how much we need to move it as it knows its + // granularity). + move_finger_to(_nextMarkBitMap->nextWord(_finger)); + } + } + // At this point we have either completed iterating over the + // region we were holding on to, or we have aborted. + + // We then partially drain the local queue and the global stack. + // (Do we really need this?) + drain_local_queue(true); + drain_global_stack(true); + + // Read the note on the claim_region() method on why it might + // return NULL with potentially more regions available for + // claiming and why we have to check out_of_regions() to determine + // whether we're done or not. + while (!has_aborted() && _curr_region == NULL && !_cm->out_of_regions()) { + // We are going to try to claim a new region. We should have + // given up on the previous one. + tmp_guarantee_CM( _curr_region == NULL && + _finger == NULL && + _region_limit == NULL, "invariant" ); + if (_cm->verbose_low()) + gclog_or_tty->print_cr("[%d] trying to claim a new region", _task_id); + HeapRegion* claimed_region = _cm->claim_region(_task_id); + if (claimed_region != NULL) { + // Yes, we managed to claim one + statsOnly( ++_regions_claimed ); + + if (_cm->verbose_low()) + gclog_or_tty->print_cr("[%d] we successfully claimed " + "region "PTR_FORMAT, + _task_id, claimed_region); + + setup_for_region(claimed_region); + tmp_guarantee_CM( _curr_region == claimed_region, "invariant" ); + } + // It is important to call the regular clock here. It might take + // a while to claim a region if, for example, we hit a large + // block of empty regions. So we need to call the regular clock + // method once round the loop to make sure it's called + // frequently enough. + regular_clock_call(); + } + + if (!has_aborted() && _curr_region == NULL) { + tmp_guarantee_CM( _cm->out_of_regions(), + "at this point we should be out of regions" ); + } + } while ( _curr_region != NULL && !has_aborted()); + + if (!has_aborted()) { + // We cannot check whether the global stack is empty, since other + // tasks might be pushing objects to it concurrently. + tmp_guarantee_CM( _cm->out_of_regions() && _cm->region_stack_empty(), + "at this point we should be out of regions" ); + + if (_cm->verbose_low()) + gclog_or_tty->print_cr("[%d] all regions claimed", _task_id); + + // Try to reduce the number of available SATB buffers so that + // remark has less work to do. + drain_satb_buffers(); + } + + // Since we've done everything else, we can now totally drain the + // local queue and global stack. + drain_local_queue(false); + drain_global_stack(false); + + // Attempt at work stealing from other task's queues. + if (!has_aborted()) { + // We have not aborted. This means that we have finished all that + // we could. Let's try to do some stealing... + + // We cannot check whether the global stack is empty, since other + // tasks might be pushing objects to it concurrently. + guarantee( _cm->out_of_regions() && + _cm->region_stack_empty() && + _task_queue->size() == 0, "only way to reach here" ); + + if (_cm->verbose_low()) + gclog_or_tty->print_cr("[%d] starting to steal", _task_id); + + while (!has_aborted()) { + oop obj; + statsOnly( ++_steal_attempts ); + + if (_cm->try_stealing(_task_id, &_hash_seed, obj)) { + if (_cm->verbose_medium()) + gclog_or_tty->print_cr("[%d] stolen "PTR_FORMAT" successfully", + _task_id, (void*) obj); + + statsOnly( ++_steals ); + + tmp_guarantee_CM( _nextMarkBitMap->isMarked((HeapWord*) obj), + "any stolen object should be marked" ); + scan_object(obj); + + // And since we're towards the end, let's totally drain the + // local queue and global stack. + drain_local_queue(false); + drain_global_stack(false); + } else { + break; + } + } + } + + // We still haven't aborted. Now, let's try to get into the + // termination protocol. + if (!has_aborted()) { + // We cannot check whether the global stack is empty, since other + // tasks might be concurrently pushing objects on it. + guarantee( _cm->out_of_regions() && + _cm->region_stack_empty() && + _task_queue->size() == 0, "only way to reach here" ); + + if (_cm->verbose_low()) + gclog_or_tty->print_cr("[%d] starting termination protocol", _task_id); + + _termination_start_time_ms = os::elapsedVTime() * 1000.0; + // The CMTask class also extends the TerminatorTerminator class, + // hence its should_exit_termination() method will also decide + // whether to exit the termination protocol or not. + bool finished = _cm->terminator()->offer_termination(this); + double termination_end_time_ms = os::elapsedVTime() * 1000.0; + _termination_time_ms += + termination_end_time_ms - _termination_start_time_ms; + + if (finished) { + // We're all done. + + if (_task_id == 0) { + // let's allow task 0 to do this + if (concurrent()) { + guarantee( _cm->concurrent_marking_in_progress(), "invariant" ); + // we need to set this to false before the next + // safepoint. This way we ensure that the marking phase + // doesn't observe any more heap expansions. + _cm->clear_concurrent_marking_in_progress(); + } + } + + // We can now guarantee that the global stack is empty, since + // all other tasks have finished. + guarantee( _cm->out_of_regions() && + _cm->region_stack_empty() && + _cm->mark_stack_empty() && + _task_queue->size() == 0 && + !_cm->has_overflown() && + !_cm->mark_stack_overflow() && + !_cm->region_stack_overflow(), + "only way to reach here" ); + + if (_cm->verbose_low()) + gclog_or_tty->print_cr("[%d] all tasks terminated", _task_id); + } else { + // Apparently there's more work to do. Let's abort this task. It + // will restart it and we can hopefully find more things to do. + + if (_cm->verbose_low()) + gclog_or_tty->print_cr("[%d] apparently there is more work to do", _task_id); + + set_has_aborted(); + statsOnly( ++_aborted_termination ); + } + } + + // Mainly for debugging purposes to make sure that a pointer to the + // closure which was statically allocated in this frame doesn't + // escape it by accident. + set_oop_closure(NULL); + double end_time_ms = os::elapsedVTime() * 1000.0; + double elapsed_time_ms = end_time_ms - _start_time_ms; + // Update the step history. + _step_times_ms.add(elapsed_time_ms); + + if (has_aborted()) { + // The task was aborted for some reason. + + statsOnly( ++_aborted ); + + if (_has_aborted_timed_out) { + double diff_ms = elapsed_time_ms - _time_target_ms; + // Keep statistics of how well we did with respect to hitting + // our target only if we actually timed out (if we aborted for + // other reasons, then the results might get skewed). + _marking_step_diffs_ms.add(diff_ms); + } + + if (_cm->has_overflown()) { + // This is the interesting one. We aborted because a global + // overflow was raised. This means we have to restart the + // marking phase and start iterating over regions. However, in + // order to do this we have to make sure that all tasks stop + // what they are doing and re-initialise in a safe manner. We + // will achieve this with the use of two barrier sync points. + + if (_cm->verbose_low()) + gclog_or_tty->print_cr("[%d] detected overflow", _task_id); + + _cm->enter_first_sync_barrier(_task_id); + // When we exit this sync barrier we know that all tasks have + // stopped doing marking work. So, it's now safe to + // re-initialise our data structures. At the end of this method, + // task 0 will clear the global data structures. + + statsOnly( ++_aborted_overflow ); + + // We clear the local state of this task... + clear_region_fields(); + + // ...and enter the second barrier. + _cm->enter_second_sync_barrier(_task_id); + // At this point everything has bee re-initialised and we're + // ready to restart. + } + + if (_cm->verbose_low()) { + gclog_or_tty->print_cr("[%d] <<<<<<<<<< ABORTING, target = %1.2lfms, " + "elapsed = %1.2lfms <<<<<<<<<<", + _task_id, _time_target_ms, elapsed_time_ms); + if (_cm->has_aborted()) + gclog_or_tty->print_cr("[%d] ========== MARKING ABORTED ==========", + _task_id); + } + } else { + if (_cm->verbose_low()) + gclog_or_tty->print_cr("[%d] <<<<<<<<<< FINISHED, target = %1.2lfms, " + "elapsed = %1.2lfms <<<<<<<<<<", + _task_id, _time_target_ms, elapsed_time_ms); + } + + _claimed = false; +} + +CMTask::CMTask(int task_id, + ConcurrentMark* cm, + CMTaskQueue* task_queue, + CMTaskQueueSet* task_queues) + : _g1h(G1CollectedHeap::heap()), + _co_tracker(G1CMGroup), + _task_id(task_id), _cm(cm), + _claimed(false), + _nextMarkBitMap(NULL), _hash_seed(17), + _task_queue(task_queue), + _task_queues(task_queues), + _oop_closure(NULL) { + guarantee( task_queue != NULL, "invariant" ); + guarantee( task_queues != NULL, "invariant" ); + + statsOnly( _clock_due_to_scanning = 0; + _clock_due_to_marking = 0 ); + + _marking_step_diffs_ms.add(0.5); +} diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp new file mode 100644 index 00000000000..a572f74f3a7 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp @@ -0,0 +1,1049 @@ +/* + * Copyright 2001-2007 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. + * + */ + +class G1CollectedHeap; +class CMTask; +typedef GenericTaskQueue CMTaskQueue; +typedef GenericTaskQueueSet CMTaskQueueSet; + +// A generic CM bit map. This is essentially a wrapper around the BitMap +// class, with one bit per (1<<_shifter) HeapWords. + +class CMBitMapRO { + protected: + HeapWord* _bmStartWord; // base address of range covered by map + size_t _bmWordSize; // map size (in #HeapWords covered) + const int _shifter; // map to char or bit + VirtualSpace _virtual_space; // underlying the bit map + BitMap _bm; // the bit map itself + + public: + // constructor + CMBitMapRO(ReservedSpace rs, int shifter); + + enum { do_yield = true }; + + // inquiries + HeapWord* startWord() const { return _bmStartWord; } + size_t sizeInWords() const { return _bmWordSize; } + // the following is one past the last word in space + HeapWord* endWord() const { return _bmStartWord + _bmWordSize; } + + // read marks + + bool isMarked(HeapWord* addr) const { + assert(_bmStartWord <= addr && addr < (_bmStartWord + _bmWordSize), + "outside underlying space?"); + return _bm.at(heapWordToOffset(addr)); + } + + // iteration + bool iterate(BitMapClosure* cl) { return _bm.iterate(cl); } + bool iterate(BitMapClosure* cl, MemRegion mr); + + // Return the address corresponding to the next marked bit at or after + // "addr", and before "limit", if "limit" is non-NULL. If there is no + // such bit, returns "limit" if that is non-NULL, or else "endWord()". + HeapWord* getNextMarkedWordAddress(HeapWord* addr, + HeapWord* limit = NULL) const; + // Return the address corresponding to the next unmarked bit at or after + // "addr", and before "limit", if "limit" is non-NULL. If there is no + // such bit, returns "limit" if that is non-NULL, or else "endWord()". + HeapWord* getNextUnmarkedWordAddress(HeapWord* addr, + HeapWord* limit = NULL) const; + + // conversion utilities + // XXX Fix these so that offsets are size_t's... + HeapWord* offsetToHeapWord(size_t offset) const { + return _bmStartWord + (offset << _shifter); + } + size_t heapWordToOffset(HeapWord* addr) const { + return pointer_delta(addr, _bmStartWord) >> _shifter; + } + int heapWordDiffToOffsetDiff(size_t diff) const; + HeapWord* nextWord(HeapWord* addr) { + return offsetToHeapWord(heapWordToOffset(addr) + 1); + } + + void mostly_disjoint_range_union(BitMap* from_bitmap, + size_t from_start_index, + HeapWord* to_start_word, + size_t word_num); + + // debugging + NOT_PRODUCT(bool covers(ReservedSpace rs) const;) +}; + +class CMBitMap : public CMBitMapRO { + + public: + // constructor + CMBitMap(ReservedSpace rs, int shifter) : + CMBitMapRO(rs, shifter) {} + + // write marks + void mark(HeapWord* addr) { + assert(_bmStartWord <= addr && addr < (_bmStartWord + _bmWordSize), + "outside underlying space?"); + _bm.at_put(heapWordToOffset(addr), true); + } + void clear(HeapWord* addr) { + assert(_bmStartWord <= addr && addr < (_bmStartWord + _bmWordSize), + "outside underlying space?"); + _bm.at_put(heapWordToOffset(addr), false); + } + bool parMark(HeapWord* addr) { + assert(_bmStartWord <= addr && addr < (_bmStartWord + _bmWordSize), + "outside underlying space?"); + return _bm.par_at_put(heapWordToOffset(addr), true); + } + bool parClear(HeapWord* addr) { + assert(_bmStartWord <= addr && addr < (_bmStartWord + _bmWordSize), + "outside underlying space?"); + return _bm.par_at_put(heapWordToOffset(addr), false); + } + void markRange(MemRegion mr); + void clearAll(); + void clearRange(MemRegion mr); + + // Starting at the bit corresponding to "addr" (inclusive), find the next + // "1" bit, if any. This bit starts some run of consecutive "1"'s; find + // the end of this run (stopping at "end_addr"). Return the MemRegion + // covering from the start of the region corresponding to the first bit + // of the run to the end of the region corresponding to the last bit of + // the run. If there is no "1" bit at or after "addr", return an empty + // MemRegion. + MemRegion getAndClearMarkedRegion(HeapWord* addr, HeapWord* end_addr); +}; + +// Represents a marking stack used by the CM collector. +// Ideally this should be GrowableArray<> just like MSC's marking stack(s). +class CMMarkStack { + ConcurrentMark* _cm; + oop* _base; // bottom of stack + jint _index; // one more than last occupied index + jint _capacity; // max #elements + jint _oops_do_bound; // Number of elements to include in next iteration. + NOT_PRODUCT(jint _max_depth;) // max depth plumbed during run + + bool _overflow; + DEBUG_ONLY(bool _drain_in_progress;) + DEBUG_ONLY(bool _drain_in_progress_yields;) + + public: + CMMarkStack(ConcurrentMark* cm); + ~CMMarkStack(); + + void allocate(size_t size); + + oop pop() { + if (!isEmpty()) { + return _base[--_index] ; + } + return NULL; + } + + // If overflow happens, don't do the push, and record the overflow. + // *Requires* that "ptr" is already marked. + void push(oop ptr) { + if (isFull()) { + // Record overflow. + _overflow = true; + return; + } else { + _base[_index++] = ptr; + NOT_PRODUCT(_max_depth = MAX2(_max_depth, _index)); + } + } + // Non-block impl. Note: concurrency is allowed only with other + // "par_push" operations, not with "pop" or "drain". We would need + // parallel versions of them if such concurrency was desired. + void par_push(oop ptr); + + // Pushes the first "n" elements of "ptr_arr" on the stack. + // Non-block impl. Note: concurrency is allowed only with other + // "par_adjoin_arr" or "push" operations, not with "pop" or "drain". + void par_adjoin_arr(oop* ptr_arr, int n); + + // Pushes the first "n" elements of "ptr_arr" on the stack. + // Locking impl: concurrency is allowed only with + // "par_push_arr" and/or "par_pop_arr" operations, which use the same + // locking strategy. + void par_push_arr(oop* ptr_arr, int n); + + // If returns false, the array was empty. Otherwise, removes up to "max" + // elements from the stack, and transfers them to "ptr_arr" in an + // unspecified order. The actual number transferred is given in "n" ("n + // == 0" is deliberately redundant with the return value.) Locking impl: + // concurrency is allowed only with "par_push_arr" and/or "par_pop_arr" + // operations, which use the same locking strategy. + bool par_pop_arr(oop* ptr_arr, int max, int* n); + + // Drain the mark stack, applying the given closure to all fields of + // objects on the stack. (That is, continue until the stack is empty, + // even if closure applications add entries to the stack.) The "bm" + // argument, if non-null, may be used to verify that only marked objects + // are on the mark stack. If "yield_after" is "true", then the + // concurrent marker performing the drain offers to yield after + // processing each object. If a yield occurs, stops the drain operation + // and returns false. Otherwise, returns true. + template + bool drain(OopClosureClass* cl, CMBitMap* bm, bool yield_after = false); + + bool isEmpty() { return _index == 0; } + bool isFull() { return _index == _capacity; } + int maxElems() { return _capacity; } + + bool overflow() { return _overflow; } + void clear_overflow() { _overflow = false; } + + int size() { return _index; } + + void setEmpty() { _index = 0; clear_overflow(); } + + // Record the current size; a subsequent "oops_do" will iterate only over + // indices valid at the time of this call. + void set_oops_do_bound(jint bound = -1) { + if (bound == -1) { + _oops_do_bound = _index; + } else { + _oops_do_bound = bound; + } + } + jint oops_do_bound() { return _oops_do_bound; } + // iterate over the oops in the mark stack, up to the bound recorded via + // the call above. + void oops_do(OopClosure* f); +}; + +class CMRegionStack { + MemRegion* _base; + jint _capacity; + jint _index; + jint _oops_do_bound; + bool _overflow; +public: + CMRegionStack(); + ~CMRegionStack(); + void allocate(size_t size); + + // This is lock-free; assumes that it will only be called in parallel + // with other "push" operations (no pops). + void push(MemRegion mr); + + // Lock-free; assumes that it will only be called in parallel + // with other "pop" operations (no pushes). + MemRegion pop(); + + bool isEmpty() { return _index == 0; } + bool isFull() { return _index == _capacity; } + + bool overflow() { return _overflow; } + void clear_overflow() { _overflow = false; } + + int size() { return _index; } + + // It iterates over the entries in the region stack and it + // invalidates (i.e. assigns MemRegion()) the ones that point to + // regions in the collection set. + bool invalidate_entries_into_cset(); + + // This gives an upper bound up to which the iteration in + // invalidate_entries_into_cset() will reach. This prevents + // newly-added entries to be unnecessarily scanned. + void set_oops_do_bound() { + _oops_do_bound = _index; + } + + void setEmpty() { _index = 0; clear_overflow(); } +}; + +// this will enable a variety of different statistics per GC task +#define _MARKING_STATS_ 0 +// this will enable the higher verbose levels +#define _MARKING_VERBOSE_ 0 + +#if _MARKING_STATS_ +#define statsOnly(statement) \ +do { \ + statement ; \ +} while (0) +#else // _MARKING_STATS_ +#define statsOnly(statement) \ +do { \ +} while (0) +#endif // _MARKING_STATS_ + +// Some extra guarantees that I like to also enable in optimised mode +// when debugging. If you want to enable them, comment out the assert +// macro and uncomment out the guaratee macro +// #define tmp_guarantee_CM(expr, str) guarantee(expr, str) +#define tmp_guarantee_CM(expr, str) assert(expr, str) + +typedef enum { + no_verbose = 0, // verbose turned off + stats_verbose, // only prints stats at the end of marking + low_verbose, // low verbose, mostly per region and per major event + medium_verbose, // a bit more detailed than low + high_verbose // per object verbose +} CMVerboseLevel; + + +class ConcurrentMarkThread; + +class ConcurrentMark { + friend class ConcurrentMarkThread; + friend class CMTask; + friend class CMBitMapClosure; + friend class CSMarkOopClosure; + friend class CMGlobalObjectClosure; + friend class CMRemarkTask; + friend class CMConcurrentMarkingTask; + friend class G1ParNoteEndTask; + friend class CalcLiveObjectsClosure; + +protected: + ConcurrentMarkThread* _cmThread; // the thread doing the work + G1CollectedHeap* _g1h; // the heap. + size_t _parallel_marking_threads; // the number of marking + // threads we'll use + double _sleep_factor; // how much we have to sleep, with + // respect to the work we just did, to + // meet the marking overhead goal + double _marking_task_overhead; // marking target overhead for + // a single task + + // same as the two above, but for the cleanup task + double _cleanup_sleep_factor; + double _cleanup_task_overhead; + + // Stuff related to age cohort processing. + struct ParCleanupThreadState { + char _pre[64]; + UncleanRegionList list; + char _post[64]; + }; + ParCleanupThreadState** _par_cleanup_thread_state; + + // CMS marking support structures + CMBitMap _markBitMap1; + CMBitMap _markBitMap2; + CMBitMapRO* _prevMarkBitMap; // completed mark bitmap + CMBitMap* _nextMarkBitMap; // under-construction mark bitmap + bool _at_least_one_mark_complete; + + BitMap _region_bm; + BitMap _card_bm; + + // Heap bounds + HeapWord* _heap_start; + HeapWord* _heap_end; + + // For gray objects + CMMarkStack _markStack; // Grey objects behind global finger. + CMRegionStack _regionStack; // Grey regions behind global finger. + HeapWord* volatile _finger; // the global finger, region aligned, + // always points to the end of the + // last claimed region + + // marking tasks + size_t _max_task_num; // maximum task number + size_t _active_tasks; // task num currently active + CMTask** _tasks; // task queue array (max_task_num len) + CMTaskQueueSet* _task_queues; // task queue set + ParallelTaskTerminator _terminator; // for termination + + // Two sync barriers that are used to synchronise tasks when an + // overflow occurs. The algorithm is the following. All tasks enter + // the first one to ensure that they have all stopped manipulating + // the global data structures. After they exit it, they re-initialise + // their data structures and task 0 re-initialises the global data + // structures. Then, they enter the second sync barrier. This + // ensure, that no task starts doing work before all data + // structures (local and global) have been re-initialised. When they + // exit it, they are free to start working again. + WorkGangBarrierSync _first_overflow_barrier_sync; + WorkGangBarrierSync _second_overflow_barrier_sync; + + + // this is set by any task, when an overflow on the global data + // structures is detected. + volatile bool _has_overflown; + // true: marking is concurrent, false: we're in remark + volatile bool _concurrent; + // set at the end of a Full GC so that marking aborts + volatile bool _has_aborted; + // used when remark aborts due to an overflow to indicate that + // another concurrent marking phase should start + volatile bool _restart_for_overflow; + + // This is true from the very start of concurrent marking until the + // point when all the tasks complete their work. It is really used + // to determine the points between the end of concurrent marking and + // time of remark. + volatile bool _concurrent_marking_in_progress; + + // verbose level + CMVerboseLevel _verbose_level; + + COTracker _cleanup_co_tracker; + + // These two fields are used to implement the optimisation that + // avoids pushing objects on the global/region stack if there are + // no collection set regions above the lowest finger. + + // This is the lowest finger (among the global and local fingers), + // which is calculated before a new collection set is chosen. + HeapWord* _min_finger; + // If this flag is true, objects/regions that are marked below the + // finger should be pushed on the stack(s). If this is flag is + // false, it is safe not to push them on the stack(s). + bool _should_gray_objects; + + // All of these times are in ms. + NumberSeq _init_times; + NumberSeq _remark_times; + NumberSeq _remark_mark_times; + NumberSeq _remark_weak_ref_times; + NumberSeq _cleanup_times; + double _total_counting_time; + double _total_rs_scrub_time; + + double* _accum_task_vtime; // accumulated task vtime + + WorkGang* _parallel_workers; + + void weakRefsWork(bool clear_all_soft_refs); + + void swapMarkBitMaps(); + + // It resets the global marking data structures, as well as the + // task local ones; should be called during initial mark. + void reset(); + // It resets all the marking data structures. + void clear_marking_state(); + + // It should be called to indicate which phase we're in (concurrent + // mark or remark) and how many threads are currently active. + void set_phase(size_t active_tasks, bool concurrent); + // We do this after we're done with marking so that the marking data + // structures are initialised to a sensible and predictable state. + void set_non_marking_state(); + + // prints all gathered CM-related statistics + void print_stats(); + + // accessor methods + size_t parallel_marking_threads() { return _parallel_marking_threads; } + double sleep_factor() { return _sleep_factor; } + double marking_task_overhead() { return _marking_task_overhead;} + double cleanup_sleep_factor() { return _cleanup_sleep_factor; } + double cleanup_task_overhead() { return _cleanup_task_overhead;} + + HeapWord* finger() { return _finger; } + bool concurrent() { return _concurrent; } + size_t active_tasks() { return _active_tasks; } + ParallelTaskTerminator* terminator() { return &_terminator; } + + // It claims the next available region to be scanned by a marking + // task. It might return NULL if the next region is empty or we have + // run out of regions. In the latter case, out_of_regions() + // determines whether we've really run out of regions or the task + // should call claim_region() again. This might seem a bit + // awkward. Originally, the code was written so that claim_region() + // either successfully returned with a non-empty region or there + // were no more regions to be claimed. The problem with this was + // that, in certain circumstances, it iterated over large chunks of + // the heap finding only empty regions and, while it was working, it + // was preventing the calling task to call its regular clock + // method. So, this way, each task will spend very little time in + // claim_region() and is allowed to call the regular clock method + // frequently. + HeapRegion* claim_region(int task); + + // It determines whether we've run out of regions to scan. + bool out_of_regions() { return _finger == _heap_end; } + + // Returns the task with the given id + CMTask* task(int id) { + guarantee( 0 <= id && id < (int) _active_tasks, "task id not within " + "active bounds" ); + return _tasks[id]; + } + + // Returns the task queue with the given id + CMTaskQueue* task_queue(int id) { + guarantee( 0 <= id && id < (int) _active_tasks, "task queue id not within " + "active bounds" ); + return (CMTaskQueue*) _task_queues->queue(id); + } + + // Returns the task queue set + CMTaskQueueSet* task_queues() { return _task_queues; } + + // Access / manipulation of the overflow flag which is set to + // indicate that the global stack or region stack has overflown + bool has_overflown() { return _has_overflown; } + void set_has_overflown() { _has_overflown = true; } + void clear_has_overflown() { _has_overflown = false; } + + bool has_aborted() { return _has_aborted; } + bool restart_for_overflow() { return _restart_for_overflow; } + + // Methods to enter the two overflow sync barriers + void enter_first_sync_barrier(int task_num); + void enter_second_sync_barrier(int task_num); + +public: + // Manipulation of the global mark stack. + // Notice that the first mark_stack_push is CAS-based, whereas the + // two below are Mutex-based. This is OK since the first one is only + // called during evacuation pauses and doesn't compete with the + // other two (which are called by the marking tasks during + // concurrent marking or remark). + bool mark_stack_push(oop p) { + _markStack.par_push(p); + if (_markStack.overflow()) { + set_has_overflown(); + return false; + } + return true; + } + bool mark_stack_push(oop* arr, int n) { + _markStack.par_push_arr(arr, n); + if (_markStack.overflow()) { + set_has_overflown(); + return false; + } + return true; + } + void mark_stack_pop(oop* arr, int max, int* n) { + _markStack.par_pop_arr(arr, max, n); + } + size_t mark_stack_size() { return _markStack.size(); } + size_t partial_mark_stack_size_target() { return _markStack.maxElems()/3; } + bool mark_stack_overflow() { return _markStack.overflow(); } + bool mark_stack_empty() { return _markStack.isEmpty(); } + + // Manipulation of the region stack + bool region_stack_push(MemRegion mr) { + _regionStack.push(mr); + if (_regionStack.overflow()) { + set_has_overflown(); + return false; + } + return true; + } + MemRegion region_stack_pop() { return _regionStack.pop(); } + int region_stack_size() { return _regionStack.size(); } + bool region_stack_overflow() { return _regionStack.overflow(); } + bool region_stack_empty() { return _regionStack.isEmpty(); } + + bool concurrent_marking_in_progress() { + return _concurrent_marking_in_progress; + } + void set_concurrent_marking_in_progress() { + _concurrent_marking_in_progress = true; + } + void clear_concurrent_marking_in_progress() { + _concurrent_marking_in_progress = false; + } + + void update_accum_task_vtime(int i, double vtime) { + _accum_task_vtime[i] += vtime; + } + + double all_task_accum_vtime() { + double ret = 0.0; + for (int i = 0; i < (int)_max_task_num; ++i) + ret += _accum_task_vtime[i]; + return ret; + } + + // Attempts to steal an object from the task queues of other tasks + bool try_stealing(int task_num, int* hash_seed, oop& obj) { + return _task_queues->steal(task_num, hash_seed, obj); + } + + // It grays an object by first marking it. Then, if it's behind the + // global finger, it also pushes it on the global stack. + void deal_with_reference(oop obj); + + ConcurrentMark(ReservedSpace rs, int max_regions); + ~ConcurrentMark(); + ConcurrentMarkThread* cmThread() { return _cmThread; } + + CMBitMapRO* prevMarkBitMap() const { return _prevMarkBitMap; } + CMBitMap* nextMarkBitMap() const { return _nextMarkBitMap; } + + // The following three are interaction between CM and + // G1CollectedHeap + + // This notifies CM that a root during initial-mark needs to be + // grayed and it's MT-safe. Currently, we just mark it. But, in the + // future, we can experiment with pushing it on the stack and we can + // do this without changing G1CollectedHeap. + void grayRoot(oop p); + // It's used during evacuation pauses to gray a region, if + // necessary, and it's MT-safe. It assumes that the caller has + // marked any objects on that region. If _should_gray_objects is + // true and we're still doing concurrent marking, the region is + // pushed on the region stack, if it is located below the global + // finger, otherwise we do nothing. + void grayRegionIfNecessary(MemRegion mr); + // It's used during evacuation pauses to mark and, if necessary, + // gray a single object and it's MT-safe. It assumes the caller did + // not mark the object. If _should_gray_objects is true and we're + // still doing concurrent marking, the objects is pushed on the + // global stack, if it is located below the global finger, otherwise + // we do nothing. + void markAndGrayObjectIfNecessary(oop p); + + // This iterates over the bitmap of the previous marking and prints + // out all objects that are marked on the bitmap and indicates + // whether what they point to is also marked or not. + void print_prev_bitmap_reachable(); + + // Clear the next marking bitmap (will be called concurrently). + void clearNextBitmap(); + + // main CMS steps and related support + void checkpointRootsInitial(); + + // These two do the work that needs to be done before and after the + // initial root checkpoint. Since this checkpoint can be done at two + // different points (i.e. an explicit pause or piggy-backed on a + // young collection), then it's nice to be able to easily share the + // pre/post code. It might be the case that we can put everything in + // the post method. TP + void checkpointRootsInitialPre(); + void checkpointRootsInitialPost(); + + // Do concurrent phase of marking, to a tentative transitive closure. + void markFromRoots(); + + // Process all unprocessed SATB buffers. It is called at the + // beginning of an evacuation pause. + void drainAllSATBBuffers(); + + void checkpointRootsFinal(bool clear_all_soft_refs); + void checkpointRootsFinalWork(); + void calcDesiredRegions(); + void cleanup(); + void completeCleanup(); + + // Mark in the previous bitmap. NB: this is usually read-only, so use + // this carefully! + void markPrev(oop p); + void clear(oop p); + // Clears marks for all objects in the given range, for both prev and + // next bitmaps. NB: the previous bitmap is usually read-only, so use + // this carefully! + void clearRangeBothMaps(MemRegion mr); + + // Record the current top of the mark and region stacks; a + // subsequent oops_do() on the mark stack and + // invalidate_entries_into_cset() on the region stack will iterate + // only over indices valid at the time of this call. + void set_oops_do_bound() { + _markStack.set_oops_do_bound(); + _regionStack.set_oops_do_bound(); + } + // Iterate over the oops in the mark stack and all local queues. It + // also calls invalidate_entries_into_cset() on the region stack. + void oops_do(OopClosure* f); + // It is called at the end of an evacuation pause during marking so + // that CM is notified of where the new end of the heap is. It + // doesn't do anything if concurrent_marking_in_progress() is false, + // unless the force parameter is true. + void update_g1_committed(bool force = false); + + void complete_marking_in_collection_set(); + + // It indicates that a new collection set is being chosen. + void newCSet(); + // It registers a collection set heap region with CM. This is used + // to determine whether any heap regions are located above the finger. + void registerCSetRegion(HeapRegion* hr); + + // Returns "true" if at least one mark has been completed. + bool at_least_one_mark_complete() { return _at_least_one_mark_complete; } + + bool isMarked(oop p) const { + assert(p != NULL && p->is_oop(), "expected an oop"); + HeapWord* addr = (HeapWord*)p; + assert(addr >= _nextMarkBitMap->startWord() || + addr < _nextMarkBitMap->endWord(), "in a region"); + + return _nextMarkBitMap->isMarked(addr); + } + + inline bool not_yet_marked(oop p) const; + + // XXX Debug code + bool containing_card_is_marked(void* p); + bool containing_cards_are_marked(void* start, void* last); + + bool isPrevMarked(oop p) const { + assert(p != NULL && p->is_oop(), "expected an oop"); + HeapWord* addr = (HeapWord*)p; + assert(addr >= _prevMarkBitMap->startWord() || + addr < _prevMarkBitMap->endWord(), "in a region"); + + return _prevMarkBitMap->isMarked(addr); + } + + inline bool do_yield_check(int worker_i = 0); + inline bool should_yield(); + + // Called to abort the marking cycle after a Full GC takes palce. + void abort(); + + void disable_co_trackers(); + + // This prints the global/local fingers. It is used for debugging. + NOT_PRODUCT(void print_finger();) + + void print_summary_info(); + + // The following indicate whether a given verbose level has been + // set. Notice that anything above stats is conditional to + // _MARKING_VERBOSE_ having been set to 1 + bool verbose_stats() + { return _verbose_level >= stats_verbose; } + bool verbose_low() + { return _MARKING_VERBOSE_ && _verbose_level >= low_verbose; } + bool verbose_medium() + { return _MARKING_VERBOSE_ && _verbose_level >= medium_verbose; } + bool verbose_high() + { return _MARKING_VERBOSE_ && _verbose_level >= high_verbose; } +}; + +// A class representing a marking task. +class CMTask : public TerminatorTerminator { +private: + enum PrivateConstants { + // the regular clock call is called once the scanned words reaches + // this limit + words_scanned_period = 12*1024, + // the regular clock call is called once the number of visited + // references reaches this limit + refs_reached_period = 384, + // initial value for the hash seed, used in the work stealing code + init_hash_seed = 17, + // how many entries will be transferred between global stack and + // local queues + global_stack_transfer_size = 16 + }; + + int _task_id; + G1CollectedHeap* _g1h; + ConcurrentMark* _cm; + CMBitMap* _nextMarkBitMap; + // the task queue of this task + CMTaskQueue* _task_queue; + // the task queue set---needed for stealing + CMTaskQueueSet* _task_queues; + // indicates whether the task has been claimed---this is only for + // debugging purposes + bool _claimed; + + // number of calls to this task + int _calls; + + // concurrent overhead over a single CPU for this task + COTracker _co_tracker; + + // when the virtual timer reaches this time, the marking step should + // exit + double _time_target_ms; + // the start time of the current marking step + double _start_time_ms; + + // the oop closure used for iterations over oops + OopClosure* _oop_closure; + + // the region this task is scanning, NULL if we're not scanning any + HeapRegion* _curr_region; + // the local finger of this task, NULL if we're not scanning a region + HeapWord* _finger; + // limit of the region this task is scanning, NULL if we're not scanning one + HeapWord* _region_limit; + + // This is used only when we scan regions popped from the region + // stack. It records what the last object on such a region we + // scanned was. It is used to ensure that, if we abort region + // iteration, we do not rescan the first part of the region. This + // should be NULL when we're not scanning a region from the region + // stack. + HeapWord* _region_finger; + + // the number of words this task has scanned + size_t _words_scanned; + // When _words_scanned reaches this limit, the regular clock is + // called. Notice that this might be decreased under certain + // circumstances (i.e. when we believe that we did an expensive + // operation). + size_t _words_scanned_limit; + // the initial value of _words_scanned_limit (i.e. what it was + // before it was decreased). + size_t _real_words_scanned_limit; + + // the number of references this task has visited + size_t _refs_reached; + // When _refs_reached reaches this limit, the regular clock is + // called. Notice this this might be decreased under certain + // circumstances (i.e. when we believe that we did an expensive + // operation). + size_t _refs_reached_limit; + // the initial value of _refs_reached_limit (i.e. what it was before + // it was decreased). + size_t _real_refs_reached_limit; + + // used by the work stealing stuff + int _hash_seed; + // if this is true, then the task has aborted for some reason + bool _has_aborted; + // set when the task aborts because it has met its time quota + bool _has_aborted_timed_out; + // true when we're draining SATB buffers; this avoids the task + // aborting due to SATB buffers being available (as we're already + // dealing with them) + bool _draining_satb_buffers; + + // number sequence of past step times + NumberSeq _step_times_ms; + // elapsed time of this task + double _elapsed_time_ms; + // termination time of this task + double _termination_time_ms; + // when this task got into the termination protocol + double _termination_start_time_ms; + + // true when the task is during a concurrent phase, false when it is + // in the remark phase (so, in the latter case, we do not have to + // check all the things that we have to check during the concurrent + // phase, i.e. SATB buffer availability...) + bool _concurrent; + + TruncatedSeq _marking_step_diffs_ms; + + // LOTS of statistics related with this task +#if _MARKING_STATS_ + NumberSeq _all_clock_intervals_ms; + double _interval_start_time_ms; + + int _aborted; + int _aborted_overflow; + int _aborted_cm_aborted; + int _aborted_yield; + int _aborted_timed_out; + int _aborted_satb; + int _aborted_termination; + + int _steal_attempts; + int _steals; + + int _clock_due_to_marking; + int _clock_due_to_scanning; + + int _local_pushes; + int _local_pops; + int _local_max_size; + int _objs_scanned; + + int _global_pushes; + int _global_pops; + int _global_max_size; + + int _global_transfers_to; + int _global_transfers_from; + + int _region_stack_pops; + + int _regions_claimed; + int _objs_found_on_bitmap; + + int _satb_buffers_processed; +#endif // _MARKING_STATS_ + + // it updates the local fields after this task has claimed + // a new region to scan + void setup_for_region(HeapRegion* hr); + // it brings up-to-date the limit of the region + void update_region_limit(); + // it resets the local fields after a task has finished scanning a + // region + void giveup_current_region(); + + // called when either the words scanned or the refs visited limit + // has been reached + void reached_limit(); + // recalculates the words scanned and refs visited limits + void recalculate_limits(); + // decreases the words scanned and refs visited limits when we reach + // an expensive operation + void decrease_limits(); + // it checks whether the words scanned or refs visited reached their + // respective limit and calls reached_limit() if they have + void check_limits() { + if (_words_scanned >= _words_scanned_limit || + _refs_reached >= _refs_reached_limit) + reached_limit(); + } + // this is supposed to be called regularly during a marking step as + // it checks a bunch of conditions that might cause the marking step + // to abort + void regular_clock_call(); + bool concurrent() { return _concurrent; } + +public: + // It resets the task; it should be called right at the beginning of + // a marking phase. + void reset(CMBitMap* _nextMarkBitMap); + // it clears all the fields that correspond to a claimed region. + void clear_region_fields(); + + void set_concurrent(bool concurrent) { _concurrent = concurrent; } + + void enable_co_tracker() { + guarantee( !_co_tracker.enabled(), "invariant" ); + _co_tracker.enable(); + } + void disable_co_tracker() { + guarantee( _co_tracker.enabled(), "invariant" ); + _co_tracker.disable(); + } + bool co_tracker_enabled() { + return _co_tracker.enabled(); + } + void reset_co_tracker(double starting_conc_overhead = 0.0) { + _co_tracker.reset(starting_conc_overhead); + } + void start_co_tracker() { + _co_tracker.start(); + } + void update_co_tracker(bool force_end = false) { + _co_tracker.update(force_end); + } + + // The main method of this class which performs a marking step + // trying not to exceed the given duration. However, it might exit + // prematurely, according to some conditions (i.e. SATB buffers are + // available for processing). + void do_marking_step(double target_ms); + + // These two calls start and stop the timer + void record_start_time() { + _elapsed_time_ms = os::elapsedTime() * 1000.0; + } + void record_end_time() { + _elapsed_time_ms = os::elapsedTime() * 1000.0 - _elapsed_time_ms; + } + + // returns the task ID + int task_id() { return _task_id; } + + // From TerminatorTerminator. It determines whether this task should + // exit the termination protocol after it's entered it. + virtual bool should_exit_termination(); + + HeapWord* finger() { return _finger; } + + bool has_aborted() { return _has_aborted; } + void set_has_aborted() { _has_aborted = true; } + void clear_has_aborted() { _has_aborted = false; } + bool claimed() { return _claimed; } + + void set_oop_closure(OopClosure* oop_closure) { + _oop_closure = oop_closure; + } + + // It grays the object by marking it and, if necessary, pushing it + // on the local queue + void deal_with_reference(oop obj); + + // It scans an object and visits its children. + void scan_object(oop obj) { + tmp_guarantee_CM( _nextMarkBitMap->isMarked((HeapWord*) obj), + "invariant" ); + + if (_cm->verbose_high()) + gclog_or_tty->print_cr("[%d] we're scanning object "PTR_FORMAT, + _task_id, (void*) obj); + + size_t obj_size = obj->size(); + _words_scanned += obj_size; + + obj->oop_iterate(_oop_closure); + statsOnly( ++_objs_scanned ); + check_limits(); + } + + // It pushes an object on the local queue. + void push(oop obj); + + // These two move entries to/from the global stack. + void move_entries_to_global_stack(); + void get_entries_from_global_stack(); + + // It pops and scans objects from the local queue. If partially is + // true, then it stops when the queue size is of a given limit. If + // partially is false, then it stops when the queue is empty. + void drain_local_queue(bool partially); + // It moves entries from the global stack to the local queue and + // drains the local queue. If partially is true, then it stops when + // both the global stack and the local queue reach a given size. If + // partially if false, it tries to empty them totally. + void drain_global_stack(bool partially); + // It keeps picking SATB buffers and processing them until no SATB + // buffers are available. + void drain_satb_buffers(); + // It keeps popping regions from the region stack and processing + // them until the region stack is empty. + void drain_region_stack(BitMapClosure* closure); + + // moves the local finger to a new location + inline void move_finger_to(HeapWord* new_finger) { + tmp_guarantee_CM( new_finger >= _finger && new_finger < _region_limit, + "invariant" ); + _finger = new_finger; + } + + // moves the region finger to a new location + inline void move_region_finger_to(HeapWord* new_finger) { + tmp_guarantee_CM( new_finger < _cm->finger(), "invariant" ); + _region_finger = new_finger; + } + + CMTask(int task_num, ConcurrentMark *cm, + CMTaskQueue* task_queue, CMTaskQueueSet* task_queues); + + // it prints statistics associated with this task + void print_stats(); + +#if _MARKING_STATS_ + void increase_objs_found_on_bitmap() { ++_objs_found_on_bitmap; } +#endif // _MARKING_STATS_ +}; diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp new file mode 100644 index 00000000000..e26df0caae0 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp @@ -0,0 +1,336 @@ +/* + * Copyright 2001-2007 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. + * + */ + +#include "incls/_precompiled.incl" +#include "incls/_concurrentMarkThread.cpp.incl" + +// ======= Concurrent Mark Thread ======== + +// The CM thread is created when the G1 garbage collector is used + +SurrogateLockerThread* + ConcurrentMarkThread::_slt = NULL; + +ConcurrentMarkThread::ConcurrentMarkThread(ConcurrentMark* cm) : + ConcurrentGCThread(), + _cm(cm), + _started(false), + _in_progress(false), + _vtime_accum(0.0), + _vtime_mark_accum(0.0), + _vtime_count_accum(0.0) +{ + create_and_start(); +} + +class CMCheckpointRootsInitialClosure: public VoidClosure { + + ConcurrentMark* _cm; +public: + + CMCheckpointRootsInitialClosure(ConcurrentMark* cm) : + _cm(cm) {} + + void do_void(){ + _cm->checkpointRootsInitial(); + } +}; + +class CMCheckpointRootsFinalClosure: public VoidClosure { + + ConcurrentMark* _cm; +public: + + CMCheckpointRootsFinalClosure(ConcurrentMark* cm) : + _cm(cm) {} + + void do_void(){ + _cm->checkpointRootsFinal(false); // !clear_all_soft_refs + } +}; + +class CMCleanUp: public VoidClosure { + ConcurrentMark* _cm; +public: + + CMCleanUp(ConcurrentMark* cm) : + _cm(cm) {} + + void do_void(){ + _cm->cleanup(); + } +}; + + + +void ConcurrentMarkThread::run() { + initialize_in_thread(); + _vtime_start = os::elapsedVTime(); + wait_for_universe_init(); + + G1CollectedHeap* g1 = G1CollectedHeap::heap(); + G1CollectorPolicy* g1_policy = g1->g1_policy(); + G1MMUTracker *mmu_tracker = g1_policy->mmu_tracker(); + Thread *current_thread = Thread::current(); + + while (!_should_terminate) { + // wait until started is set. + sleepBeforeNextCycle(); + { + ResourceMark rm; + HandleMark hm; + double cycle_start = os::elapsedVTime(); + double mark_start_sec = os::elapsedTime(); + char verbose_str[128]; + + if (PrintGC) { + gclog_or_tty->date_stamp(PrintGCDateStamps); + gclog_or_tty->stamp(PrintGCTimeStamps); + tty->print_cr("[GC concurrent-mark-start]"); + } + + if (!g1_policy->in_young_gc_mode()) { + // this ensures the flag is not set if we bail out of the marking + // cycle; normally the flag is cleared immediately after cleanup + g1->set_marking_complete(); + + if (g1_policy->adaptive_young_list_length()) { + double now = os::elapsedTime(); + double init_prediction_ms = g1_policy->predict_init_time_ms(); + jlong sleep_time_ms = mmu_tracker->when_ms(now, init_prediction_ms); + os::sleep(current_thread, sleep_time_ms, false); + } + + // We don't have to skip here if we've been asked to restart, because + // in the worst case we just enqueue a new VM operation to start a + // marking. Note that the init operation resets has_aborted() + CMCheckpointRootsInitialClosure init_cl(_cm); + strcpy(verbose_str, "GC initial-mark"); + VM_CGC_Operation op(&init_cl, verbose_str); + VMThread::execute(&op); + } + + int iter = 0; + do { + iter++; + if (!cm()->has_aborted()) { + _cm->markFromRoots(); + } else { + if (TraceConcurrentMark) + gclog_or_tty->print_cr("CM-skip-mark-from-roots"); + } + + double mark_end_time = os::elapsedVTime(); + double mark_end_sec = os::elapsedTime(); + _vtime_mark_accum += (mark_end_time - cycle_start); + if (!cm()->has_aborted()) { + if (g1_policy->adaptive_young_list_length()) { + double now = os::elapsedTime(); + double remark_prediction_ms = g1_policy->predict_remark_time_ms(); + jlong sleep_time_ms = mmu_tracker->when_ms(now, remark_prediction_ms); + os::sleep(current_thread, sleep_time_ms, false); + } + + if (PrintGC) { + gclog_or_tty->date_stamp(PrintGCDateStamps); + gclog_or_tty->stamp(PrintGCTimeStamps); + gclog_or_tty->print_cr("[GC concurrent-mark-end, %1.7lf sec]", + mark_end_sec - mark_start_sec); + } + + CMCheckpointRootsFinalClosure final_cl(_cm); + sprintf(verbose_str, "GC remark"); + VM_CGC_Operation op(&final_cl, verbose_str); + VMThread::execute(&op); + } else { + if (TraceConcurrentMark) + gclog_or_tty->print_cr("CM-skip-remark"); + } + if (cm()->restart_for_overflow() && + G1TraceMarkStackOverflow) { + gclog_or_tty->print_cr("Restarting conc marking because of MS overflow " + "in remark (restart #%d).", iter); + } + + if (cm()->restart_for_overflow()) { + if (PrintGC) { + gclog_or_tty->date_stamp(PrintGCDateStamps); + gclog_or_tty->stamp(PrintGCTimeStamps); + gclog_or_tty->print_cr("[GC concurrent-mark-restart-for-overflow]"); + } + } + } while (cm()->restart_for_overflow()); + double counting_start_time = os::elapsedVTime(); + + // YSR: These look dubious (i.e. redundant) !!! FIX ME + slt()->manipulatePLL(SurrogateLockerThread::acquirePLL); + slt()->manipulatePLL(SurrogateLockerThread::releaseAndNotifyPLL); + + if (!cm()->has_aborted()) { + double count_start_sec = os::elapsedTime(); + if (PrintGC) { + gclog_or_tty->date_stamp(PrintGCDateStamps); + gclog_or_tty->stamp(PrintGCTimeStamps); + gclog_or_tty->print_cr("[GC concurrent-count-start]"); + } + + _sts.join(); + _cm->calcDesiredRegions(); + _sts.leave(); + + if (!cm()->has_aborted()) { + double count_end_sec = os::elapsedTime(); + if (PrintGC) { + gclog_or_tty->date_stamp(PrintGCDateStamps); + gclog_or_tty->stamp(PrintGCTimeStamps); + gclog_or_tty->print_cr("[GC concurrent-count-end, %1.7lf]", + count_end_sec - count_start_sec); + } + } + } else { + if (TraceConcurrentMark) gclog_or_tty->print_cr("CM-skip-end-game"); + } + double end_time = os::elapsedVTime(); + _vtime_count_accum += (end_time - counting_start_time); + // Update the total virtual time before doing this, since it will try + // to measure it to get the vtime for this marking. We purposely + // neglect the presumably-short "completeCleanup" phase here. + _vtime_accum = (end_time - _vtime_start); + if (!cm()->has_aborted()) { + if (g1_policy->adaptive_young_list_length()) { + double now = os::elapsedTime(); + double cleanup_prediction_ms = g1_policy->predict_cleanup_time_ms(); + jlong sleep_time_ms = mmu_tracker->when_ms(now, cleanup_prediction_ms); + os::sleep(current_thread, sleep_time_ms, false); + } + + CMCleanUp cl_cl(_cm); + sprintf(verbose_str, "GC cleanup"); + VM_CGC_Operation op(&cl_cl, verbose_str); + VMThread::execute(&op); + } else { + if (TraceConcurrentMark) gclog_or_tty->print_cr("CM-skip-cleanup"); + G1CollectedHeap::heap()->set_marking_complete(); + } + + if (!cm()->has_aborted()) { + double cleanup_start_sec = os::elapsedTime(); + if (PrintGC) { + gclog_or_tty->date_stamp(PrintGCDateStamps); + gclog_or_tty->stamp(PrintGCTimeStamps); + gclog_or_tty->print_cr("[GC concurrent-cleanup-start]"); + } + + // Now do the remainder of the cleanup operation. + _sts.join(); + _cm->completeCleanup(); + if (!cm()->has_aborted()) { + g1_policy->record_concurrent_mark_cleanup_completed(); + + double cleanup_end_sec = os::elapsedTime(); + if (PrintGC) { + gclog_or_tty->date_stamp(PrintGCDateStamps); + gclog_or_tty->stamp(PrintGCTimeStamps); + gclog_or_tty->print_cr("[GC concurrent-cleanup-end, %1.7lf]", + cleanup_end_sec - cleanup_start_sec); + } + } + _sts.leave(); + } + // We're done: no more unclean regions coming. + G1CollectedHeap::heap()->set_unclean_regions_coming(false); + + if (cm()->has_aborted()) { + if (PrintGC) { + gclog_or_tty->date_stamp(PrintGCDateStamps); + gclog_or_tty->stamp(PrintGCTimeStamps); + gclog_or_tty->print_cr("[GC concurrent-mark-abort]"); + } + } + + _sts.join(); + _cm->disable_co_trackers(); + _sts.leave(); + + // we now want to allow clearing of the marking bitmap to be + // suspended by a collection pause. + _sts.join(); + _cm->clearNextBitmap(); + _sts.leave(); + } + } + assert(_should_terminate, "just checking"); + + terminate(); +} + + +void ConcurrentMarkThread::yield() { + if (TraceConcurrentMark) gclog_or_tty->print_cr("CM-yield"); + _sts.yield("Concurrent Mark"); + if (TraceConcurrentMark) gclog_or_tty->print_cr("CM-yield-end"); +} + +void ConcurrentMarkThread::stop() { + // it is ok to take late safepoints here, if needed + MutexLockerEx mu(Terminator_lock); + _should_terminate = true; + while (!_has_terminated) { + Terminator_lock->wait(); + } + if (TraceConcurrentMark) gclog_or_tty->print_cr("CM-stop"); +} + +void ConcurrentMarkThread::print() { + gclog_or_tty->print("\"Concurrent Mark GC Thread\" "); + Thread::print(); + gclog_or_tty->cr(); +} + +void ConcurrentMarkThread::sleepBeforeNextCycle() { + clear_in_progress(); + // We join here because we don't want to do the "shouldConcurrentMark()" + // below while the world is otherwise stopped. + MutexLockerEx x(CGC_lock, Mutex::_no_safepoint_check_flag); + while (!started()) { + if (TraceConcurrentMark) gclog_or_tty->print_cr("CM-sleeping"); + CGC_lock->wait(Mutex::_no_safepoint_check_flag); + } + set_in_progress(); + clear_started(); + if (TraceConcurrentMark) gclog_or_tty->print_cr("CM-starting"); + + return; +} + +// Note: this method, although exported by the ConcurrentMarkSweepThread, +// which is a non-JavaThread, can only be called by a JavaThread. +// Currently this is done at vm creation time (post-vm-init) by the +// main/Primordial (Java)Thread. +// XXX Consider changing this in the future to allow the CMS thread +// itself to create this thread? +void ConcurrentMarkThread::makeSurrogateLockerThread(TRAPS) { + assert(_slt == NULL, "SLT already created"); + _slt = SurrogateLockerThread::make(THREAD); +} diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.hpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.hpp new file mode 100644 index 00000000000..c382778c212 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.hpp @@ -0,0 +1,84 @@ +/* + * Copyright 2001-2007 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. + * + */ + +// The Concurrent Mark GC Thread (could be several in the future). +// This is copied from the Concurrent Mark Sweep GC Thread +// Still under construction. + +class ConcurrentMark; + +class ConcurrentMarkThread: public ConcurrentGCThread { + friend class VMStructs; + + double _vtime_start; // Initial virtual time. + double _vtime_accum; // Accumulated virtual time. + + double _vtime_mark_accum; + double _vtime_count_accum; + + public: + virtual void run(); + + private: + ConcurrentMark* _cm; + bool _started; + bool _in_progress; + + void sleepBeforeNextCycle(); + + static SurrogateLockerThread* _slt; + + public: + // Constructor + ConcurrentMarkThread(ConcurrentMark* cm); + + static void makeSurrogateLockerThread(TRAPS); + static SurrogateLockerThread* slt() { return _slt; } + + // Printing + void print(); + + // Total virtual time so far. + double vtime_accum(); + // Marking virtual time so far + double vtime_mark_accum(); + // Counting virtual time so far. + double vtime_count_accum() { return _vtime_count_accum; } + + ConcurrentMark* cm() { return _cm; } + + 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; } + + // Yield for GC + void yield(); + + // shutdown + static void stop(); +}; diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.inline.hpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.inline.hpp new file mode 100644 index 00000000000..b011973557f --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.inline.hpp @@ -0,0 +1,33 @@ +/* + * Copyright 2001-2007 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. + * + */ + + // Total virtual time so far. +inline double ConcurrentMarkThread::vtime_accum() { + return _vtime_accum + _cm->all_task_accum_vtime(); +} + +// Marking virtual time so far +inline double ConcurrentMarkThread::vtime_mark_accum() { + return _vtime_mark_accum + _cm->all_task_accum_vtime(); +} diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentZFThread.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentZFThread.cpp new file mode 100644 index 00000000000..642c59cb9bf --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentZFThread.cpp @@ -0,0 +1,191 @@ +/* + * Copyright 2001-2007 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. + * + */ + +#include "incls/_precompiled.incl" +#include "incls/_concurrentZFThread.cpp.incl" + +// ======= Concurrent Zero-Fill Thread ======== + +// The CM thread is created when the G1 garbage collector is used + +int ConcurrentZFThread::_region_allocs = 0; +int ConcurrentZFThread::_sync_zfs = 0; +int ConcurrentZFThread::_zf_waits = 0; +int ConcurrentZFThread::_regions_filled = 0; + +ConcurrentZFThread::ConcurrentZFThread() : + ConcurrentGCThread(), + _co_tracker(G1ZFGroup) +{ + create_and_start(); +} + +void ConcurrentZFThread::wait_for_ZF_completed(HeapRegion* hr) { + assert(ZF_mon->owned_by_self(), "Precondition."); + note_zf_wait(); + while (hr->zero_fill_state() == HeapRegion::ZeroFilling) { + ZF_mon->wait(Mutex::_no_safepoint_check_flag); + } +} + +void ConcurrentZFThread::processHeapRegion(HeapRegion* hr) { + assert(!Universe::heap()->is_gc_active(), + "This should not happen during GC."); + assert(hr != NULL, "Precondition"); + // These are unlocked reads, but if this test is successful, then no + // other thread will attempt this zero filling. Only a GC thread can + // modify the ZF state of a region whose state is zero-filling, and this + // should only happen while the ZF thread is locking out GC. + if (hr->zero_fill_state() == HeapRegion::ZeroFilling + && hr->zero_filler() == Thread::current()) { + assert(hr->top() == hr->bottom(), "better be empty!"); + assert(!hr->isHumongous(), "Only free regions on unclean list."); + Copy::fill_to_words(hr->bottom(), hr->capacity()/HeapWordSize); + note_region_filled(); + } +} + +void ConcurrentZFThread::run() { + initialize_in_thread(); + Thread* thr_self = Thread::current(); + _vtime_start = os::elapsedVTime(); + wait_for_universe_init(); + _co_tracker.enable(); + _co_tracker.start(); + + G1CollectedHeap* g1 = G1CollectedHeap::heap(); + _sts.join(); + while (!_should_terminate) { + _sts.leave(); + + { + MutexLockerEx x(ZF_mon, Mutex::_no_safepoint_check_flag); + + // This local variable will hold a region being zero-filled. This + // region will neither be on the unclean or zero-filled lists, and + // will not be available for allocation; thus, we might have an + // allocation fail, causing a full GC, because of this, but this is a + // price we will pay. (In future, we might want to make the fact + // that there's a region being zero-filled apparent to the G1 heap, + // which could then wait for it in this extreme case...) + HeapRegion* to_fill; + + while (!g1->should_zf() + || (to_fill = g1->pop_unclean_region_list_locked()) == NULL) + ZF_mon->wait(Mutex::_no_safepoint_check_flag); + while (to_fill->zero_fill_state() == HeapRegion::ZeroFilling) + ZF_mon->wait(Mutex::_no_safepoint_check_flag); + + // So now to_fill is non-NULL and is not ZeroFilling. It might be + // Allocated or ZeroFilled. (The latter could happen if this thread + // starts the zero-filling of a region, but a GC intervenes and + // pushes new regions needing on the front of the filling on the + // front of the list.) + + switch (to_fill->zero_fill_state()) { + case HeapRegion::Allocated: + to_fill = NULL; + break; + + case HeapRegion::NotZeroFilled: + to_fill->set_zero_fill_in_progress(thr_self); + + ZF_mon->unlock(); + _sts.join(); + processHeapRegion(to_fill); + _sts.leave(); + ZF_mon->lock_without_safepoint_check(); + + if (to_fill->zero_fill_state() == HeapRegion::ZeroFilling + && to_fill->zero_filler() == thr_self) { + to_fill->set_zero_fill_complete(); + (void)g1->put_free_region_on_list_locked(to_fill); + } + break; + + case HeapRegion::ZeroFilled: + (void)g1->put_free_region_on_list_locked(to_fill); + break; + + case HeapRegion::ZeroFilling: + ShouldNotReachHere(); + break; + } + } + _vtime_accum = (os::elapsedVTime() - _vtime_start); + _sts.join(); + + _co_tracker.update(); + } + _co_tracker.update(false); + _sts.leave(); + + assert(_should_terminate, "just checking"); + terminate(); +} + +bool ConcurrentZFThread::offer_yield() { + if (_sts.should_yield()) { + _sts.yield("Concurrent ZF"); + return true; + } else { + return false; + } +} + +void ConcurrentZFThread::stop() { + // it is ok to take late safepoints here, if needed + MutexLockerEx mu(Terminator_lock); + _should_terminate = true; + while (!_has_terminated) { + Terminator_lock->wait(); + } +} + +void ConcurrentZFThread::print() { + gclog_or_tty->print("\"Concurrent ZF Thread\" "); + Thread::print(); + gclog_or_tty->cr(); +} + + +double ConcurrentZFThread::_vtime_accum; + +void ConcurrentZFThread::print_summary_info() { + gclog_or_tty->print("\nConcurrent Zero-Filling:\n"); + gclog_or_tty->print(" Filled %d regions, used %5.2fs.\n", + _regions_filled, + vtime_accum()); + gclog_or_tty->print(" Of %d region allocs, %d (%5.2f%%) required sync ZF,\n", + _region_allocs, _sync_zfs, + (_region_allocs > 0 ? + (float)_sync_zfs/(float)_region_allocs*100.0 : + 0.0)); + gclog_or_tty->print(" and %d (%5.2f%%) required a ZF wait.\n", + _zf_waits, + (_region_allocs > 0 ? + (float)_zf_waits/(float)_region_allocs*100.0 : + 0.0)); + +} diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentZFThread.hpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentZFThread.hpp new file mode 100644 index 00000000000..9a483dbce86 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentZFThread.hpp @@ -0,0 +1,85 @@ +/* + * Copyright 2001-2007 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. + * + */ + +// The Concurrent ZF Thread. Performs concurrent zero-filling. + +class ConcurrentZFThread: public ConcurrentGCThread { + friend class VMStructs; + friend class ZeroFillRegionClosure; + + private: + + // Zero fill the heap region. + void processHeapRegion(HeapRegion* r); + + // Stats + // Allocation (protected by heap lock). + static int _region_allocs; // Number of regions allocated + static int _sync_zfs; // Synchronous zero-fills + + static int _zf_waits; // Wait for conc zero-fill completion. + + // Number of regions CFZ thread fills. + static int _regions_filled; + + COTracker _co_tracker; + + double _vtime_start; // Initial virtual time. + + // These are static because the "print_summary_info" method is, and + // it currently assumes there is only one ZF thread. We'll change when + // we need to. + static double _vtime_accum; // Initial virtual time. + static double vtime_accum() { return _vtime_accum; } + + // Offer yield for GC. Returns true if yield occurred. + bool offer_yield(); + + public: + // Constructor + ConcurrentZFThread(); + + // Main loop. + virtual void run(); + + // Printing + void print(); + + // Waits until "r" has been zero-filled. Requires caller to hold the + // ZF_mon. + static void wait_for_ZF_completed(HeapRegion* r); + + // Get or clear the current unclean region. Should be done + // while holding the ZF_needed_mon lock. + + // shutdown + static void stop(); + + // Stats + static void note_region_alloc() {_region_allocs++; } + static void note_sync_zfs() { _sync_zfs++; } + static void note_zf_wait() { _zf_waits++; } + static void note_region_filled() { _regions_filled++; } + + static void print_summary_info(); +}; diff --git a/hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp b/hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp new file mode 100644 index 00000000000..53de081cc25 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp @@ -0,0 +1,307 @@ +/* + * Copyright 2001-2007 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. + * + */ + +# include "incls/_precompiled.incl" +# include "incls/_dirtyCardQueue.cpp.incl" + +bool DirtyCardQueue::apply_closure(CardTableEntryClosure* cl, + bool consume, + size_t worker_i) { + bool res = true; + if (_buf != NULL) { + res = apply_closure_to_buffer(cl, _buf, _index, _sz, + consume, + (int) worker_i); + if (res && consume) _index = _sz; + } + return res; +} + +bool DirtyCardQueue::apply_closure_to_buffer(CardTableEntryClosure* cl, + void** buf, + size_t index, size_t sz, + bool consume, + int worker_i) { + if (cl == NULL) return true; + for (size_t i = index; i < sz; i += oopSize) { + int ind = byte_index_to_index((int)i); + jbyte* card_ptr = (jbyte*)buf[ind]; + if (card_ptr != NULL) { + // Set the entry to null, so we don't do it again (via the test + // above) if we reconsider this buffer. + if (consume) buf[ind] = NULL; + if (!cl->do_card_ptr(card_ptr, worker_i)) return false; + } + } + return true; +} + +#ifdef _MSC_VER // the use of 'this' below gets a warning, make it go away +#pragma warning( disable:4355 ) // 'this' : used in base member initializer list +#endif // _MSC_VER + +DirtyCardQueueSet::DirtyCardQueueSet() : + PtrQueueSet(true /*notify_when_complete*/), + _closure(NULL), + _shared_dirty_card_queue(this, true /*perm*/), + _free_ids(NULL), + _processed_buffers_mut(0), _processed_buffers_rs_thread(0) +{ + _all_active = true; +} + +size_t DirtyCardQueueSet::num_par_ids() { + return MAX2(ParallelGCThreads, (size_t)2); +} + + +void DirtyCardQueueSet::initialize(Monitor* cbl_mon, Mutex* fl_lock, + int max_completed_queue, + Mutex* lock) { + PtrQueueSet::initialize(cbl_mon, fl_lock, max_completed_queue); + set_buffer_size(DCQBarrierQueueBufferSize); + set_process_completed_threshold(DCQBarrierProcessCompletedThreshold); + + _shared_dirty_card_queue.set_lock(lock); + _free_ids = new FreeIdSet((int) num_par_ids(), _cbl_mon); + bool b = _free_ids->claim_perm_id(0); + guarantee(b, "Must reserve id zero for concurrent refinement thread."); +} + +void DirtyCardQueueSet::handle_zero_index_for_thread(JavaThread* t) { + t->dirty_card_queue().handle_zero_index(); +} + +void DirtyCardQueueSet::set_closure(CardTableEntryClosure* closure) { + _closure = closure; +} + +void DirtyCardQueueSet::iterate_closure_all_threads(bool consume, + size_t worker_i) { + assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint."); + for(JavaThread* t = Threads::first(); t; t = t->next()) { + bool b = t->dirty_card_queue().apply_closure(_closure, consume); + guarantee(b, "Should not be interrupted."); + } + bool b = shared_dirty_card_queue()->apply_closure(_closure, + consume, + worker_i); + guarantee(b, "Should not be interrupted."); +} + +bool DirtyCardQueueSet::mut_process_buffer(void** buf) { + + // Used to determine if we had already claimed a par_id + // before entering this method. + bool already_claimed = false; + + // We grab the current JavaThread. + JavaThread* thread = JavaThread::current(); + + // We get the the number of any par_id that this thread + // might have already claimed. + int worker_i = thread->get_claimed_par_id(); + + // If worker_i is not -1 then the thread has already claimed + // a par_id. We make note of it using the already_claimed value + if (worker_i != -1) { + already_claimed = true; + } else { + + // Otherwise we need to claim a par id + worker_i = _free_ids->claim_par_id(); + + // And store the par_id value in the thread + thread->set_claimed_par_id(worker_i); + } + + bool b = false; + if (worker_i != -1) { + b = DirtyCardQueue::apply_closure_to_buffer(_closure, buf, 0, + _sz, true, worker_i); + if (b) Atomic::inc(&_processed_buffers_mut); + + // If we had not claimed an id before entering the method + // then we must release the id. + if (!already_claimed) { + + // we release the id + _free_ids->release_par_id(worker_i); + + // and set the claimed_id in the thread to -1 + thread->set_claimed_par_id(-1); + } + } + return b; +} + +DirtyCardQueueSet::CompletedBufferNode* +DirtyCardQueueSet::get_completed_buffer_lock(int stop_at) { + CompletedBufferNode* nd = NULL; + MutexLockerEx x(_cbl_mon, Mutex::_no_safepoint_check_flag); + + if ((int)_n_completed_buffers <= stop_at) { + _process_completed = false; + return NULL; + } + + if (_completed_buffers_head != NULL) { + nd = _completed_buffers_head; + _completed_buffers_head = nd->next; + if (_completed_buffers_head == NULL) + _completed_buffers_tail = NULL; + _n_completed_buffers--; + } + debug_only(assert_completed_buffer_list_len_correct_locked()); + return nd; +} + +// We only do this in contexts where there is no concurrent enqueueing. +DirtyCardQueueSet::CompletedBufferNode* +DirtyCardQueueSet::get_completed_buffer_CAS() { + CompletedBufferNode* nd = _completed_buffers_head; + + while (nd != NULL) { + CompletedBufferNode* next = nd->next; + CompletedBufferNode* result = + (CompletedBufferNode*)Atomic::cmpxchg_ptr(next, + &_completed_buffers_head, + nd); + if (result == nd) { + return result; + } else { + nd = _completed_buffers_head; + } + } + assert(_completed_buffers_head == NULL, "Loop post"); + _completed_buffers_tail = NULL; + return NULL; +} + +bool DirtyCardQueueSet:: +apply_closure_to_completed_buffer_helper(int worker_i, + CompletedBufferNode* nd) { + if (nd != NULL) { + bool b = + DirtyCardQueue::apply_closure_to_buffer(_closure, nd->buf, + nd->index, _sz, + true, worker_i); + void** buf = nd->buf; + delete nd; + if (b) { + deallocate_buffer(buf); + return true; // In normal case, go on to next buffer. + } else { + enqueue_complete_buffer(buf, nd->index, true); + return false; + } + } else { + return false; + } +} + +bool DirtyCardQueueSet::apply_closure_to_completed_buffer(int worker_i, + int stop_at, + bool with_CAS) +{ + CompletedBufferNode* nd = NULL; + if (with_CAS) { + guarantee(stop_at == 0, "Precondition"); + nd = get_completed_buffer_CAS(); + } else { + nd = get_completed_buffer_lock(stop_at); + } + bool res = apply_closure_to_completed_buffer_helper(worker_i, nd); + if (res) _processed_buffers_rs_thread++; + return res; +} + +void DirtyCardQueueSet::apply_closure_to_all_completed_buffers() { + CompletedBufferNode* nd = _completed_buffers_head; + while (nd != NULL) { + bool b = + DirtyCardQueue::apply_closure_to_buffer(_closure, nd->buf, 0, _sz, + false); + guarantee(b, "Should not stop early."); + nd = nd->next; + } +} + +void DirtyCardQueueSet::abandon_logs() { + assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint."); + CompletedBufferNode* buffers_to_delete = NULL; + { + MutexLockerEx x(_cbl_mon, Mutex::_no_safepoint_check_flag); + while (_completed_buffers_head != NULL) { + CompletedBufferNode* nd = _completed_buffers_head; + _completed_buffers_head = nd->next; + nd->next = buffers_to_delete; + buffers_to_delete = nd; + } + _n_completed_buffers = 0; + _completed_buffers_tail = NULL; + debug_only(assert_completed_buffer_list_len_correct_locked()); + } + while (buffers_to_delete != NULL) { + CompletedBufferNode* nd = buffers_to_delete; + buffers_to_delete = nd->next; + deallocate_buffer(nd->buf); + delete nd; + } + // Since abandon is done only at safepoints, we can safely manipulate + // these queues. + for (JavaThread* t = Threads::first(); t; t = t->next()) { + t->dirty_card_queue().reset(); + } + shared_dirty_card_queue()->reset(); +} + + +void DirtyCardQueueSet::concatenate_logs() { + // Iterate over all the threads, if we find a partial log add it to + // the global list of logs. Temporarily turn off the limit on the number + // of outstanding buffers. + int save_max_completed_queue = _max_completed_queue; + _max_completed_queue = max_jint; + assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint."); + for (JavaThread* t = Threads::first(); t; t = t->next()) { + DirtyCardQueue& dcq = t->dirty_card_queue(); + if (dcq.size() != 0) { + void **buf = t->dirty_card_queue().get_buf(); + // We must NULL out the unused entries, then enqueue. + for (size_t i = 0; i < t->dirty_card_queue().get_index(); i += oopSize) { + buf[PtrQueue::byte_index_to_index((int)i)] = NULL; + } + enqueue_complete_buffer(dcq.get_buf(), dcq.get_index()); + dcq.reinitialize(); + } + } + if (_shared_dirty_card_queue.size() != 0) { + enqueue_complete_buffer(_shared_dirty_card_queue.get_buf(), + _shared_dirty_card_queue.get_index()); + _shared_dirty_card_queue.reinitialize(); + } + // Restore the completed buffer queue limit. + _max_completed_queue = save_max_completed_queue; +} diff --git a/hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.hpp b/hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.hpp new file mode 100644 index 00000000000..86876fd949d --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.hpp @@ -0,0 +1,152 @@ +/* + * Copyright 2001-2007 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. + * + */ + +class FreeIdSet; + +// A closure class for processing card table entries. Note that we don't +// require these closure objects to be stack-allocated. +class CardTableEntryClosure: public CHeapObj { +public: + // Process the card whose card table entry is "card_ptr". If returns + // "false", terminate the iteration early. + virtual bool do_card_ptr(jbyte* card_ptr, int worker_i = 0) = 0; +}; + +// A ptrQueue whose elements are "oops", pointers to object heads. +class DirtyCardQueue: public PtrQueue { +public: + DirtyCardQueue(PtrQueueSet* qset_, bool perm = false) : + PtrQueue(qset_, perm) + { + // Dirty card queues are always active. + _active = true; + } + // Apply the closure to all elements, and reset the index to make the + // buffer empty. If a closure application returns "false", return + // "false" immediately, halting the iteration. If "consume" is true, + // deletes processed entries from logs. + bool apply_closure(CardTableEntryClosure* cl, + bool consume = true, + size_t worker_i = 0); + + // Apply the closure to all elements of "buf", down to "index" + // (inclusive.) If returns "false", then a closure application returned + // "false", and we return immediately. If "consume" is true, entries are + // set to NULL as they are processed, so they will not be processed again + // later. + static bool apply_closure_to_buffer(CardTableEntryClosure* cl, + void** buf, size_t index, size_t sz, + bool consume = true, + int worker_i = 0); + void **get_buf() { return _buf;} + void set_buf(void **buf) {_buf = buf;} + size_t get_index() { return _index;} + void reinitialize() { _buf = 0; _sz = 0; _index = 0;} +}; + + + +class DirtyCardQueueSet: public PtrQueueSet { + CardTableEntryClosure* _closure; + + DirtyCardQueue _shared_dirty_card_queue; + + // Override. + bool mut_process_buffer(void** buf); + + // Protected by the _cbl_mon. + FreeIdSet* _free_ids; + + // The number of completed buffers processed by mutator and rs thread, + // respectively. + jint _processed_buffers_mut; + jint _processed_buffers_rs_thread; + +public: + DirtyCardQueueSet(); + + void initialize(Monitor* cbl_mon, Mutex* fl_lock, + int max_completed_queue = 0, + Mutex* lock = NULL); + + // The number of parallel ids that can be claimed to allow collector or + // mutator threads to do card-processing work. + static size_t num_par_ids(); + + static void handle_zero_index_for_thread(JavaThread* t); + + // Register "blk" as "the closure" for all queues. Only one such closure + // is allowed. The "apply_closure_to_completed_buffer" method will apply + // this closure to a completed buffer, and "iterate_closure_all_threads" + // applies it to partially-filled buffers (the latter should only be done + // with the world stopped). + void set_closure(CardTableEntryClosure* closure); + + // If there is a registered closure for buffers, apply it to all entries + // in all currently-active buffers. This should only be applied at a + // safepoint. (Currently must not be called in parallel; this should + // change in the future.) If "consume" is true, processed entries are + // discarded. + void iterate_closure_all_threads(bool consume = true, + size_t worker_i = 0); + + // If there exists some completed buffer, pop it, then apply the + // registered closure to all its elements, nulling out those elements + // processed. If all elements are processed, returns "true". If no + // completed buffers exist, returns false. If a completed buffer exists, + // but is only partially completed before a "yield" happens, the + // partially completed buffer (with its processed elements set to NULL) + // is returned to the completed buffer set, and this call returns false. + bool apply_closure_to_completed_buffer(int worker_i = 0, + int stop_at = 0, + bool with_CAS = false); + bool apply_closure_to_completed_buffer_helper(int worker_i, + CompletedBufferNode* nd); + + CompletedBufferNode* get_completed_buffer_CAS(); + CompletedBufferNode* get_completed_buffer_lock(int stop_at); + // Applies the current closure to all completed buffers, + // non-consumptively. + void apply_closure_to_all_completed_buffers(); + + DirtyCardQueue* shared_dirty_card_queue() { + return &_shared_dirty_card_queue; + } + + // If a full collection is happening, reset partial logs, and ignore + // completed ones: the full collection will make them all irrelevant. + void abandon_logs(); + + // If any threads have partial logs, add them to the global list of logs. + void concatenate_logs(); + void clear_n_completed_buffers() { _n_completed_buffers = 0;} + + jint processed_buffers_mut() { + return _processed_buffers_mut; + } + jint processed_buffers_rs_thread() { + return _processed_buffers_rs_thread; + } + +}; diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp new file mode 100644 index 00000000000..c125fbe5d5b --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp @@ -0,0 +1,624 @@ +/* + * Copyright 2001-2007 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. + * + */ + +#include "incls/_precompiled.incl" +#include "incls/_g1BlockOffsetTable.cpp.incl" + +////////////////////////////////////////////////////////////////////// +// G1BlockOffsetSharedArray +////////////////////////////////////////////////////////////////////// + +G1BlockOffsetSharedArray::G1BlockOffsetSharedArray(MemRegion reserved, + size_t init_word_size) : + _reserved(reserved), _end(NULL) +{ + size_t size = compute_size(reserved.word_size()); + ReservedSpace rs(ReservedSpace::allocation_align_size_up(size)); + if (!rs.is_reserved()) { + vm_exit_during_initialization("Could not reserve enough space for heap offset array"); + } + if (!_vs.initialize(rs, 0)) { + vm_exit_during_initialization("Could not reserve enough space for heap offset array"); + } + _offset_array = (u_char*)_vs.low_boundary(); + resize(init_word_size); + if (TraceBlockOffsetTable) { + gclog_or_tty->print_cr("G1BlockOffsetSharedArray::G1BlockOffsetSharedArray: "); + gclog_or_tty->print_cr(" " + " rs.base(): " INTPTR_FORMAT + " rs.size(): " INTPTR_FORMAT + " rs end(): " INTPTR_FORMAT, + rs.base(), rs.size(), rs.base() + rs.size()); + gclog_or_tty->print_cr(" " + " _vs.low_boundary(): " INTPTR_FORMAT + " _vs.high_boundary(): " INTPTR_FORMAT, + _vs.low_boundary(), + _vs.high_boundary()); + } +} + +void G1BlockOffsetSharedArray::resize(size_t new_word_size) { + assert(new_word_size <= _reserved.word_size(), "Resize larger than reserved"); + size_t new_size = compute_size(new_word_size); + size_t old_size = _vs.committed_size(); + size_t delta; + char* high = _vs.high(); + _end = _reserved.start() + new_word_size; + if (new_size > old_size) { + delta = ReservedSpace::page_align_size_up(new_size - old_size); + assert(delta > 0, "just checking"); + if (!_vs.expand_by(delta)) { + // Do better than this for Merlin + vm_exit_out_of_memory(delta, "offset table expansion"); + } + assert(_vs.high() == high + delta, "invalid expansion"); + // Initialization of the contents is left to the + // G1BlockOffsetArray that uses it. + } else { + delta = ReservedSpace::page_align_size_down(old_size - new_size); + if (delta == 0) return; + _vs.shrink_by(delta); + assert(_vs.high() == high - delta, "invalid expansion"); + } +} + +bool G1BlockOffsetSharedArray::is_card_boundary(HeapWord* p) const { + assert(p >= _reserved.start(), "just checking"); + size_t delta = pointer_delta(p, _reserved.start()); + return (delta & right_n_bits(LogN_words)) == (size_t)NoBits; +} + + +////////////////////////////////////////////////////////////////////// +// G1BlockOffsetArray +////////////////////////////////////////////////////////////////////// + +G1BlockOffsetArray::G1BlockOffsetArray(G1BlockOffsetSharedArray* array, + MemRegion mr, bool init_to_zero) : + G1BlockOffsetTable(mr.start(), mr.end()), + _unallocated_block(_bottom), + _array(array), _csp(NULL), + _init_to_zero(init_to_zero) { + assert(_bottom <= _end, "arguments out of order"); + if (!_init_to_zero) { + // initialize cards to point back to mr.start() + set_remainder_to_point_to_start(mr.start() + N_words, mr.end()); + _array->set_offset_array(0, 0); // set first card to 0 + } +} + +void G1BlockOffsetArray::set_space(Space* sp) { + _sp = sp; + _csp = sp->toContiguousSpace(); +} + +// The arguments follow the normal convention of denoting +// a right-open interval: [start, end) +void +G1BlockOffsetArray:: set_remainder_to_point_to_start(HeapWord* start, HeapWord* end) { + + if (start >= end) { + // The start address is equal to the end address (or to + // the right of the end address) so there are not cards + // that need to be updated.. + return; + } + + // Write the backskip value for each region. + // + // offset + // card 2nd 3rd + // | +- 1st | | + // v v v v + // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+- + // |x|0|0|0|0|0|0|0|1|1|1|1|1|1| ... |1|1|1|1|2|2|2|2|2|2| ... + // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+- + // 11 19 75 + // 12 + // + // offset card is the card that points to the start of an object + // x - offset value of offset card + // 1st - start of first logarithmic region + // 0 corresponds to logarithmic value N_words + 0 and 2**(3 * 0) = 1 + // 2nd - start of second logarithmic region + // 1 corresponds to logarithmic value N_words + 1 and 2**(3 * 1) = 8 + // 3rd - start of third logarithmic region + // 2 corresponds to logarithmic value N_words + 2 and 2**(3 * 2) = 64 + // + // integer below the block offset entry is an example of + // the index of the entry + // + // Given an address, + // Find the index for the address + // Find the block offset table entry + // Convert the entry to a back slide + // (e.g., with today's, offset = 0x81 => + // back slip = 2**(3*(0x81 - N_words)) = 2**3) = 8 + // Move back N (e.g., 8) entries and repeat with the + // value of the new entry + // + size_t start_card = _array->index_for(start); + size_t end_card = _array->index_for(end-1); + assert(start ==_array->address_for_index(start_card), "Precondition"); + assert(end ==_array->address_for_index(end_card)+N_words, "Precondition"); + set_remainder_to_point_to_start_incl(start_card, end_card); // closed interval +} + +// Unlike the normal convention in this code, the argument here denotes +// a closed, inclusive interval: [start_card, end_card], cf set_remainder_to_point_to_start() +// above. +void +G1BlockOffsetArray::set_remainder_to_point_to_start_incl(size_t start_card, size_t end_card) { + if (start_card > end_card) { + return; + } + assert(start_card > _array->index_for(_bottom), "Cannot be first card"); + assert(_array->offset_array(start_card-1) <= N_words, + "Offset card has an unexpected value"); + size_t start_card_for_region = start_card; + u_char offset = max_jubyte; + for (int i = 0; i < BlockOffsetArray::N_powers; i++) { + // -1 so that the the card with the actual offset is counted. Another -1 + // so that the reach ends in this region and not at the start + // of the next. + size_t reach = start_card - 1 + (BlockOffsetArray::power_to_cards_back(i+1) - 1); + offset = N_words + i; + if (reach >= end_card) { + _array->set_offset_array(start_card_for_region, end_card, offset); + start_card_for_region = reach + 1; + break; + } + _array->set_offset_array(start_card_for_region, reach, offset); + start_card_for_region = reach + 1; + } + assert(start_card_for_region > end_card, "Sanity check"); + DEBUG_ONLY(check_all_cards(start_card, end_card);) +} + +// The block [blk_start, blk_end) has been allocated; +// adjust the block offset table to represent this information; +// right-open interval: [blk_start, blk_end) +void +G1BlockOffsetArray::alloc_block(HeapWord* blk_start, HeapWord* blk_end) { + mark_block(blk_start, blk_end); + allocated(blk_start, blk_end); +} + +// Adjust BOT to show that a previously whole block has been split +// into two. +void G1BlockOffsetArray::split_block(HeapWord* blk, size_t blk_size, + size_t left_blk_size) { + // Verify that the BOT shows [blk, blk + blk_size) to be one block. + verify_single_block(blk, blk_size); + // Update the BOT to indicate that [blk + left_blk_size, blk + blk_size) + // is one single block. + mark_block(blk + left_blk_size, blk + blk_size); +} + + +// Action_mark - update the BOT for the block [blk_start, blk_end). +// Current typical use is for splitting a block. +// Action_single - udpate the BOT for an allocation. +// Action_verify - BOT verification. +void G1BlockOffsetArray::do_block_internal(HeapWord* blk_start, + HeapWord* blk_end, + Action action) { + assert(Universe::heap()->is_in_reserved(blk_start), + "reference must be into the heap"); + assert(Universe::heap()->is_in_reserved(blk_end-1), + "limit must be within the heap"); + // This is optimized to make the test fast, assuming we only rarely + // cross boundaries. + uintptr_t end_ui = (uintptr_t)(blk_end - 1); + uintptr_t start_ui = (uintptr_t)blk_start; + // Calculate the last card boundary preceding end of blk + intptr_t boundary_before_end = (intptr_t)end_ui; + clear_bits(boundary_before_end, right_n_bits(LogN)); + if (start_ui <= (uintptr_t)boundary_before_end) { + // blk starts at or crosses a boundary + // Calculate index of card on which blk begins + size_t start_index = _array->index_for(blk_start); + // Index of card on which blk ends + size_t end_index = _array->index_for(blk_end - 1); + // Start address of card on which blk begins + HeapWord* boundary = _array->address_for_index(start_index); + assert(boundary <= blk_start, "blk should start at or after boundary"); + if (blk_start != boundary) { + // blk starts strictly after boundary + // adjust card boundary and start_index forward to next card + boundary += N_words; + start_index++; + } + assert(start_index <= end_index, "monotonicity of index_for()"); + assert(boundary <= (HeapWord*)boundary_before_end, "tautology"); + switch (action) { + case Action_mark: { + if (init_to_zero()) { + _array->set_offset_array(start_index, boundary, blk_start); + break; + } // Else fall through to the next case + } + case Action_single: { + _array->set_offset_array(start_index, boundary, blk_start); + // We have finished marking the "offset card". We need to now + // mark the subsequent cards that this blk spans. + if (start_index < end_index) { + HeapWord* rem_st = _array->address_for_index(start_index) + N_words; + HeapWord* rem_end = _array->address_for_index(end_index) + N_words; + set_remainder_to_point_to_start(rem_st, rem_end); + } + break; + } + case Action_check: { + _array->check_offset_array(start_index, boundary, blk_start); + // We have finished checking the "offset card". We need to now + // check the subsequent cards that this blk spans. + check_all_cards(start_index + 1, end_index); + break; + } + default: + ShouldNotReachHere(); + } + } +} + +// The card-interval [start_card, end_card] is a closed interval; this +// is an expensive check -- use with care and only under protection of +// suitable flag. +void G1BlockOffsetArray::check_all_cards(size_t start_card, size_t end_card) const { + + if (end_card < start_card) { + return; + } + guarantee(_array->offset_array(start_card) == N_words, "Wrong value in second card"); + for (size_t c = start_card + 1; c <= end_card; c++ /* yeah! */) { + u_char entry = _array->offset_array(c); + if (c - start_card > BlockOffsetArray::power_to_cards_back(1)) { + guarantee(entry > N_words, "Should be in logarithmic region"); + } + size_t backskip = BlockOffsetArray::entry_to_cards_back(entry); + size_t landing_card = c - backskip; + guarantee(landing_card >= (start_card - 1), "Inv"); + if (landing_card >= start_card) { + guarantee(_array->offset_array(landing_card) <= entry, "monotonicity"); + } else { + guarantee(landing_card == start_card - 1, "Tautology"); + guarantee(_array->offset_array(landing_card) <= N_words, "Offset value"); + } + } +} + +// The range [blk_start, blk_end) represents a single contiguous block +// of storage; modify the block offset table to represent this +// information; Right-open interval: [blk_start, blk_end) +// NOTE: this method does _not_ adjust _unallocated_block. +void +G1BlockOffsetArray::single_block(HeapWord* blk_start, HeapWord* blk_end) { + do_block_internal(blk_start, blk_end, Action_single); +} + +// Mark the BOT such that if [blk_start, blk_end) straddles a card +// boundary, the card following the first such boundary is marked +// with the appropriate offset. +// NOTE: this method does _not_ adjust _unallocated_block or +// any cards subsequent to the first one. +void +G1BlockOffsetArray::mark_block(HeapWord* blk_start, HeapWord* blk_end) { + do_block_internal(blk_start, blk_end, Action_mark); +} + +void G1BlockOffsetArray::join_blocks(HeapWord* blk1, HeapWord* blk2) { + HeapWord* blk1_start = Universe::heap()->block_start(blk1); + HeapWord* blk2_start = Universe::heap()->block_start(blk2); + assert(blk1 == blk1_start && blk2 == blk2_start, + "Must be block starts."); + assert(blk1 + _sp->block_size(blk1) == blk2, "Must be contiguous."); + size_t blk1_start_index = _array->index_for(blk1); + size_t blk2_start_index = _array->index_for(blk2); + assert(blk1_start_index <= blk2_start_index, "sanity"); + HeapWord* blk2_card_start = _array->address_for_index(blk2_start_index); + if (blk2 == blk2_card_start) { + // blk2 starts a card. Does blk1 start on the prevous card, or futher + // back? + assert(blk1_start_index < blk2_start_index, "must be lower card."); + if (blk1_start_index + 1 == blk2_start_index) { + // previous card; new value for blk2 card is size of blk1. + _array->set_offset_array(blk2_start_index, (u_char) _sp->block_size(blk1)); + } else { + // Earlier card; go back a card. + _array->set_offset_array(blk2_start_index, N_words); + } + } else { + // blk2 does not start a card. Does it cross a card? If not, nothing + // to do. + size_t blk2_end_index = + _array->index_for(blk2 + _sp->block_size(blk2) - 1); + assert(blk2_end_index >= blk2_start_index, "sanity"); + if (blk2_end_index > blk2_start_index) { + // Yes, it crosses a card. The value for the next card must change. + if (blk1_start_index + 1 == blk2_start_index) { + // previous card; new value for second blk2 card is size of blk1. + _array->set_offset_array(blk2_start_index + 1, + (u_char) _sp->block_size(blk1)); + } else { + // Earlier card; go back a card. + _array->set_offset_array(blk2_start_index + 1, N_words); + } + } + } +} + +HeapWord* G1BlockOffsetArray::block_start_unsafe(const void* addr) { + assert(_bottom <= addr && addr < _end, + "addr must be covered by this Array"); + // Must read this exactly once because it can be modified by parallel + // allocation. + HeapWord* ub = _unallocated_block; + if (BlockOffsetArrayUseUnallocatedBlock && addr >= ub) { + assert(ub < _end, "tautology (see above)"); + return ub; + } + // Otherwise, find the block start using the table. + HeapWord* q = block_at_or_preceding(addr, false, 0); + return forward_to_block_containing_addr(q, addr); +} + +// This duplicates a little code from the above: unavoidable. +HeapWord* +G1BlockOffsetArray::block_start_unsafe_const(const void* addr) const { + assert(_bottom <= addr && addr < _end, + "addr must be covered by this Array"); + // Must read this exactly once because it can be modified by parallel + // allocation. + HeapWord* ub = _unallocated_block; + if (BlockOffsetArrayUseUnallocatedBlock && addr >= ub) { + assert(ub < _end, "tautology (see above)"); + return ub; + } + // Otherwise, find the block start using the table. + HeapWord* q = block_at_or_preceding(addr, false, 0); + HeapWord* n = q + _sp->block_size(q); + return forward_to_block_containing_addr_const(q, n, addr); +} + + +HeapWord* +G1BlockOffsetArray::forward_to_block_containing_addr_slow(HeapWord* q, + HeapWord* n, + const void* addr) { + // We're not in the normal case. We need to handle an important subcase + // here: LAB allocation. An allocation previously recorded in the + // offset table was actually a lab allocation, and was divided into + // several objects subsequently. Fix this situation as we answer the + // query, by updating entries as we cross them. + size_t next_index = _array->index_for(n) + 1; + HeapWord* next_boundary = _array->address_for_index(next_index); + if (csp() != NULL) { + if (addr >= csp()->top()) return csp()->top(); + while (next_boundary < addr) { + while (n <= next_boundary) { + q = n; + oop obj = oop(q); + if (obj->klass() == NULL) return q; + n += obj->size(); + } + assert(q <= next_boundary && n > next_boundary, "Consequence of loop"); + // [q, n) is the block that crosses the boundary. + alloc_block_work2(&next_boundary, &next_index, q, n); + } + } else { + while (next_boundary < addr) { + while (n <= next_boundary) { + q = n; + oop obj = oop(q); + if (obj->klass() == NULL) return q; + n += _sp->block_size(q); + } + assert(q <= next_boundary && n > next_boundary, "Consequence of loop"); + // [q, n) is the block that crosses the boundary. + alloc_block_work2(&next_boundary, &next_index, q, n); + } + } + return forward_to_block_containing_addr_const(q, n, addr); +} + +HeapWord* G1BlockOffsetArray::block_start_careful(const void* addr) const { + assert(_array->offset_array(0) == 0, "objects can't cross covered areas"); + + assert(_bottom <= addr && addr < _end, + "addr must be covered by this Array"); + // Must read this exactly once because it can be modified by parallel + // allocation. + HeapWord* ub = _unallocated_block; + if (BlockOffsetArrayUseUnallocatedBlock && addr >= ub) { + assert(ub < _end, "tautology (see above)"); + return ub; + } + + // Otherwise, find the block start using the table, but taking + // care (cf block_start_unsafe() above) not to parse any objects/blocks + // on the cards themsleves. + size_t index = _array->index_for(addr); + assert(_array->address_for_index(index) == addr, + "arg should be start of card"); + + HeapWord* q = (HeapWord*)addr; + uint offset; + do { + offset = _array->offset_array(index--); + q -= offset; + } while (offset == N_words); + assert(q <= addr, "block start should be to left of arg"); + return q; +} + +// Note that the committed size of the covered space may have changed, +// so the table size might also wish to change. +void G1BlockOffsetArray::resize(size_t new_word_size) { + HeapWord* new_end = _bottom + new_word_size; + if (_end < new_end && !init_to_zero()) { + // verify that the old and new boundaries are also card boundaries + assert(_array->is_card_boundary(_end), + "_end not a card boundary"); + assert(_array->is_card_boundary(new_end), + "new _end would not be a card boundary"); + // set all the newly added cards + _array->set_offset_array(_end, new_end, N_words); + } + _end = new_end; // update _end +} + +void G1BlockOffsetArray::set_region(MemRegion mr) { + _bottom = mr.start(); + _end = mr.end(); +} + +// +// threshold_ +// | _index_ +// v v +// +-------+-------+-------+-------+-------+ +// | i-1 | i | i+1 | i+2 | i+3 | +// +-------+-------+-------+-------+-------+ +// ( ^ ] +// block-start +// +void G1BlockOffsetArray::alloc_block_work2(HeapWord** threshold_, size_t* index_, + HeapWord* blk_start, HeapWord* blk_end) { + // For efficiency, do copy-in/copy-out. + HeapWord* threshold = *threshold_; + size_t index = *index_; + + assert(blk_start != NULL && blk_end > blk_start, + "phantom block"); + assert(blk_end > threshold, "should be past threshold"); + assert(blk_start <= threshold, "blk_start should be at or before threshold") + assert(pointer_delta(threshold, blk_start) <= N_words, + "offset should be <= BlockOffsetSharedArray::N"); + assert(Universe::heap()->is_in_reserved(blk_start), + "reference must be into the heap"); + assert(Universe::heap()->is_in_reserved(blk_end-1), + "limit must be within the heap"); + assert(threshold == _array->_reserved.start() + index*N_words, + "index must agree with threshold"); + + DEBUG_ONLY(size_t orig_index = index;) + + // Mark the card that holds the offset into the block. Note + // that _next_offset_index and _next_offset_threshold are not + // updated until the end of this method. + _array->set_offset_array(index, threshold, blk_start); + + // We need to now mark the subsequent cards that this blk spans. + + // Index of card on which blk ends. + size_t end_index = _array->index_for(blk_end - 1); + + // Are there more cards left to be updated? + if (index + 1 <= end_index) { + HeapWord* rem_st = _array->address_for_index(index + 1); + // Calculate rem_end this way because end_index + // may be the last valid index in the covered region. + HeapWord* rem_end = _array->address_for_index(end_index) + N_words; + set_remainder_to_point_to_start(rem_st, rem_end); + } + + index = end_index + 1; + // Calculate threshold_ this way because end_index + // may be the last valid index in the covered region. + threshold = _array->address_for_index(end_index) + N_words; + assert(threshold >= blk_end, "Incorrect offset threshold"); + + // index_ and threshold_ updated here. + *threshold_ = threshold; + *index_ = index; + +#ifdef ASSERT + // The offset can be 0 if the block starts on a boundary. That + // is checked by an assertion above. + size_t start_index = _array->index_for(blk_start); + HeapWord* boundary = _array->address_for_index(start_index); + assert((_array->offset_array(orig_index) == 0 && + blk_start == boundary) || + (_array->offset_array(orig_index) > 0 && + _array->offset_array(orig_index) <= N_words), + "offset array should have been set"); + for (size_t j = orig_index + 1; j <= end_index; j++) { + assert(_array->offset_array(j) > 0 && + _array->offset_array(j) <= + (u_char) (N_words+BlockOffsetArray::N_powers-1), + "offset array should have been set"); + } +#endif +} + +////////////////////////////////////////////////////////////////////// +// G1BlockOffsetArrayContigSpace +////////////////////////////////////////////////////////////////////// + +HeapWord* +G1BlockOffsetArrayContigSpace::block_start_unsafe(const void* addr) { + assert(_bottom <= addr && addr < _end, + "addr must be covered by this Array"); + HeapWord* q = block_at_or_preceding(addr, true, _next_offset_index-1); + return forward_to_block_containing_addr(q, addr); +} + +HeapWord* +G1BlockOffsetArrayContigSpace:: +block_start_unsafe_const(const void* addr) const { + assert(_bottom <= addr && addr < _end, + "addr must be covered by this Array"); + HeapWord* q = block_at_or_preceding(addr, true, _next_offset_index-1); + HeapWord* n = q + _sp->block_size(q); + return forward_to_block_containing_addr_const(q, n, addr); +} + +G1BlockOffsetArrayContigSpace:: +G1BlockOffsetArrayContigSpace(G1BlockOffsetSharedArray* array, + MemRegion mr) : + G1BlockOffsetArray(array, mr, true) +{ + _next_offset_threshold = NULL; + _next_offset_index = 0; +} + +HeapWord* G1BlockOffsetArrayContigSpace::initialize_threshold() { + assert(!Universe::heap()->is_in_reserved(_array->_offset_array), + "just checking"); + _next_offset_index = _array->index_for(_bottom); + _next_offset_index++; + _next_offset_threshold = + _array->address_for_index(_next_offset_index); + return _next_offset_threshold; +} + +void G1BlockOffsetArrayContigSpace::zero_bottom_entry() { + assert(!Universe::heap()->is_in_reserved(_array->_offset_array), + "just checking"); + size_t bottom_index = _array->index_for(_bottom); + assert(_array->address_for_index(bottom_index) == _bottom, + "Precondition of call"); + _array->set_offset_array(bottom_index, 0); +} diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp new file mode 100644 index 00000000000..8c72f768933 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp @@ -0,0 +1,487 @@ +/* + * Copyright 2001-2007 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. + * + */ + +// The CollectedHeap type requires subtypes to implement a method +// "block_start". For some subtypes, notably generational +// systems using card-table-based write barriers, the efficiency of this +// operation may be important. Implementations of the "BlockOffsetArray" +// class may be useful in providing such efficient implementations. +// +// While generally mirroring the structure of the BOT for GenCollectedHeap, +// the following types are tailored more towards G1's uses; these should, +// however, be merged back into a common BOT to avoid code duplication +// and reduce maintenance overhead. +// +// G1BlockOffsetTable (abstract) +// -- G1BlockOffsetArray (uses G1BlockOffsetSharedArray) +// -- G1BlockOffsetArrayContigSpace +// +// A main impediment to the consolidation of this code might be the +// effect of making some of the block_start*() calls non-const as +// below. Whether that might adversely affect performance optimizations +// that compilers might normally perform in the case of non-G1 +// collectors needs to be carefully investigated prior to any such +// consolidation. + +// Forward declarations +class ContiguousSpace; +class G1BlockOffsetSharedArray; + +class G1BlockOffsetTable VALUE_OBJ_CLASS_SPEC { + friend class VMStructs; +protected: + // These members describe the region covered by the table. + + // The space this table is covering. + HeapWord* _bottom; // == reserved.start + HeapWord* _end; // End of currently allocated region. + +public: + // Initialize the table to cover the given space. + // The contents of the initial table are undefined. + G1BlockOffsetTable(HeapWord* bottom, HeapWord* end) : + _bottom(bottom), _end(end) + { + assert(_bottom <= _end, "arguments out of order"); + } + + // Note that the committed size of the covered space may have changed, + // so the table size might also wish to change. + virtual void resize(size_t new_word_size) = 0; + + virtual void set_bottom(HeapWord* new_bottom) { + assert(new_bottom <= _end, "new_bottom > _end"); + _bottom = new_bottom; + resize(pointer_delta(_end, _bottom)); + } + + // Requires "addr" to be contained by a block, and returns the address of + // the start of that block. (May have side effects, namely updating of + // shared array entries that "point" too far backwards. This can occur, + // for example, when LAB allocation is used in a space covered by the + // table.) + virtual HeapWord* block_start_unsafe(const void* addr) = 0; + // Same as above, but does not have any of the possible side effects + // discussed above. + virtual HeapWord* block_start_unsafe_const(const void* addr) const = 0; + + // Returns the address of the start of the block containing "addr", or + // else "null" if it is covered by no block. (May have side effects, + // namely updating of shared array entries that "point" too far + // backwards. This can occur, for example, when lab allocation is used + // in a space covered by the table.) + inline HeapWord* block_start(const void* addr); + // Same as above, but does not have any of the possible side effects + // discussed above. + inline HeapWord* block_start_const(const void* addr) const; +}; + +// This implementation of "G1BlockOffsetTable" divides the covered region +// into "N"-word subregions (where "N" = 2^"LogN". An array with an entry +// for each such subregion indicates how far back one must go to find the +// start of the chunk that includes the first word of the subregion. +// +// Each BlockOffsetArray is owned by a Space. However, the actual array +// may be shared by several BlockOffsetArrays; this is useful +// when a single resizable area (such as a generation) is divided up into +// several spaces in which contiguous allocation takes place, +// such as, for example, in G1 or in the train generation.) + +// Here is the shared array type. + +class G1BlockOffsetSharedArray: public CHeapObj { + friend class G1BlockOffsetArray; + friend class G1BlockOffsetArrayContigSpace; + friend class VMStructs; + +private: + // The reserved region covered by the shared array. + MemRegion _reserved; + + // End of the current committed region. + HeapWord* _end; + + // Array for keeping offsets for retrieving object start fast given an + // address. + VirtualSpace _vs; + u_char* _offset_array; // byte array keeping backwards offsets + + // Bounds checking accessors: + // For performance these have to devolve to array accesses in product builds. + u_char offset_array(size_t index) const { + assert(index < _vs.committed_size(), "index out of range"); + return _offset_array[index]; + } + + void set_offset_array(size_t index, u_char offset) { + assert(index < _vs.committed_size(), "index out of range"); + assert(offset <= N_words, "offset too large"); + _offset_array[index] = offset; + } + + void set_offset_array(size_t index, HeapWord* high, HeapWord* low) { + assert(index < _vs.committed_size(), "index out of range"); + assert(high >= low, "addresses out of order"); + assert(pointer_delta(high, low) <= N_words, "offset too large"); + _offset_array[index] = (u_char) pointer_delta(high, low); + } + + void set_offset_array(HeapWord* left, HeapWord* right, u_char offset) { + assert(index_for(right - 1) < _vs.committed_size(), + "right address out of range"); + assert(left < right, "Heap addresses out of order"); + size_t num_cards = pointer_delta(right, left) >> LogN_words; + memset(&_offset_array[index_for(left)], offset, num_cards); + } + + void set_offset_array(size_t left, size_t right, u_char offset) { + assert(right < _vs.committed_size(), "right address out of range"); + assert(left <= right, "indexes out of order"); + size_t num_cards = right - left + 1; + memset(&_offset_array[left], offset, num_cards); + } + + void check_offset_array(size_t index, HeapWord* high, HeapWord* low) const { + assert(index < _vs.committed_size(), "index out of range"); + assert(high >= low, "addresses out of order"); + assert(pointer_delta(high, low) <= N_words, "offset too large"); + assert(_offset_array[index] == pointer_delta(high, low), + "Wrong offset"); + } + + bool is_card_boundary(HeapWord* p) const; + + // Return the number of slots needed for an offset array + // that covers mem_region_words words. + // We always add an extra slot because if an object + // ends on a card boundary we put a 0 in the next + // offset array slot, so we want that slot always + // to be reserved. + + size_t compute_size(size_t mem_region_words) { + size_t number_of_slots = (mem_region_words / N_words) + 1; + return ReservedSpace::page_align_size_up(number_of_slots); + } + +public: + enum SomePublicConstants { + LogN = 9, + LogN_words = LogN - LogHeapWordSize, + N_bytes = 1 << LogN, + N_words = 1 << LogN_words + }; + + // Initialize the table to cover from "base" to (at least) + // "base + init_word_size". In the future, the table may be expanded + // (see "resize" below) up to the size of "_reserved" (which must be at + // least "init_word_size".) The contents of the initial table are + // undefined; it is the responsibility of the constituent + // G1BlockOffsetTable(s) to initialize cards. + G1BlockOffsetSharedArray(MemRegion reserved, size_t init_word_size); + + // Notes a change in the committed size of the region covered by the + // table. The "new_word_size" may not be larger than the size of the + // reserved region this table covers. + void resize(size_t new_word_size); + + void set_bottom(HeapWord* new_bottom); + + // Updates all the BlockOffsetArray's sharing this shared array to + // reflect the current "top"'s of their spaces. + void update_offset_arrays(); + + // Return the appropriate index into "_offset_array" for "p". + inline size_t index_for(const void* p) const; + + // Return the address indicating the start of the region corresponding to + // "index" in "_offset_array". + inline HeapWord* address_for_index(size_t index) const; +}; + +// And here is the G1BlockOffsetTable subtype that uses the array. + +class G1BlockOffsetArray: public G1BlockOffsetTable { + friend class G1BlockOffsetSharedArray; + friend class G1BlockOffsetArrayContigSpace; + friend class VMStructs; +private: + enum SomePrivateConstants { + N_words = G1BlockOffsetSharedArray::N_words, + LogN = G1BlockOffsetSharedArray::LogN + }; + + // The following enums are used by do_block_helper + enum Action { + Action_single, // BOT records a single block (see single_block()) + Action_mark, // BOT marks the start of a block (see mark_block()) + Action_check // Check that BOT records block correctly + // (see verify_single_block()). + }; + + // This is the array, which can be shared by several BlockOffsetArray's + // servicing different + G1BlockOffsetSharedArray* _array; + + // The space that owns this subregion. + Space* _sp; + + // If "_sp" is a contiguous space, the field below is the view of "_sp" + // as a contiguous space, else NULL. + ContiguousSpace* _csp; + + // If true, array entries are initialized to 0; otherwise, they are + // initialized to point backwards to the beginning of the covered region. + bool _init_to_zero; + + // The portion [_unallocated_block, _sp.end()) of the space that + // is a single block known not to contain any objects. + // NOTE: See BlockOffsetArrayUseUnallocatedBlock flag. + HeapWord* _unallocated_block; + + // Sets the entries + // corresponding to the cards starting at "start" and ending at "end" + // to point back to the card before "start": the interval [start, end) + // is right-open. + void set_remainder_to_point_to_start(HeapWord* start, HeapWord* end); + // Same as above, except that the args here are a card _index_ interval + // that is closed: [start_index, end_index] + void set_remainder_to_point_to_start_incl(size_t start, size_t end); + + // A helper function for BOT adjustment/verification work + void do_block_internal(HeapWord* blk_start, HeapWord* blk_end, Action action); + +protected: + + ContiguousSpace* csp() const { return _csp; } + + // Returns the address of a block whose start is at most "addr". + // If "has_max_index" is true, "assumes "max_index" is the last valid one + // in the array. + inline HeapWord* block_at_or_preceding(const void* addr, + bool has_max_index, + size_t max_index) const; + + // "q" is a block boundary that is <= "addr"; "n" is the address of the + // next block (or the end of the space.) Return the address of the + // beginning of the block that contains "addr". Does so without side + // effects (see, e.g., spec of block_start.) + inline HeapWord* + forward_to_block_containing_addr_const(HeapWord* q, HeapWord* n, + const void* addr) const; + + // "q" is a block boundary that is <= "addr"; return the address of the + // beginning of the block that contains "addr". May have side effects + // on "this", by updating imprecise entries. + inline HeapWord* forward_to_block_containing_addr(HeapWord* q, + const void* addr); + + // "q" is a block boundary that is <= "addr"; "n" is the address of the + // next block (or the end of the space.) Return the address of the + // beginning of the block that contains "addr". May have side effects + // on "this", by updating imprecise entries. + HeapWord* forward_to_block_containing_addr_slow(HeapWord* q, + HeapWord* n, + const void* addr); + + // Requires that "*threshold_" be the first array entry boundary at or + // above "blk_start", and that "*index_" be the corresponding array + // index. If the block starts at or crosses "*threshold_", records + // "blk_start" as the appropriate block start for the array index + // starting at "*threshold_", and for any other indices crossed by the + // block. Updates "*threshold_" and "*index_" to correspond to the first + // index after the block end. + void alloc_block_work2(HeapWord** threshold_, size_t* index_, + HeapWord* blk_start, HeapWord* blk_end); + +public: + // The space may not have it's bottom and top set yet, which is why the + // region is passed as a parameter. If "init_to_zero" is true, the + // elements of the array are initialized to zero. Otherwise, they are + // initialized to point backwards to the beginning. + G1BlockOffsetArray(G1BlockOffsetSharedArray* array, MemRegion mr, + bool init_to_zero); + + // Note: this ought to be part of the constructor, but that would require + // "this" to be passed as a parameter to a member constructor for + // the containing concrete subtype of Space. + // This would be legal C++, but MS VC++ doesn't allow it. + void set_space(Space* sp); + + // Resets the covered region to the given "mr". + void set_region(MemRegion mr); + + // Resets the covered region to one with the same _bottom as before but + // the "new_word_size". + void resize(size_t new_word_size); + + // These must be guaranteed to work properly (i.e., do nothing) + // when "blk_start" ("blk" for second version) is "NULL". + virtual void alloc_block(HeapWord* blk_start, HeapWord* blk_end); + virtual void alloc_block(HeapWord* blk, size_t size) { + alloc_block(blk, blk + size); + } + + // The following methods are useful and optimized for a + // general, non-contiguous space. + + // The given arguments are required to be the starts of adjacent ("blk1" + // before "blk2") well-formed blocks covered by "this". After this call, + // they should be considered to form one block. + virtual void join_blocks(HeapWord* blk1, HeapWord* blk2); + + // Given a block [blk_start, blk_start + full_blk_size), and + // a left_blk_size < full_blk_size, adjust the BOT to show two + // blocks [blk_start, blk_start + left_blk_size) and + // [blk_start + left_blk_size, blk_start + full_blk_size). + // It is assumed (and verified in the non-product VM) that the + // BOT was correct for the original block. + void split_block(HeapWord* blk_start, size_t full_blk_size, + size_t left_blk_size); + + // Adjust the BOT to show that it has a single block in the + // range [blk_start, blk_start + size). All necessary BOT + // cards are adjusted, but _unallocated_block isn't. + void single_block(HeapWord* blk_start, HeapWord* blk_end); + void single_block(HeapWord* blk, size_t size) { + single_block(blk, blk + size); + } + + // Adjust BOT to show that it has a block in the range + // [blk_start, blk_start + size). Only the first card + // of BOT is touched. It is assumed (and verified in the + // non-product VM) that the remaining cards of the block + // are correct. + void mark_block(HeapWord* blk_start, HeapWord* blk_end); + void mark_block(HeapWord* blk, size_t size) { + mark_block(blk, blk + size); + } + + // Adjust _unallocated_block to indicate that a particular + // block has been newly allocated or freed. It is assumed (and + // verified in the non-product VM) that the BOT is correct for + // the given block. + inline void allocated(HeapWord* blk_start, HeapWord* blk_end) { + // Verify that the BOT shows [blk, blk + blk_size) to be one block. + verify_single_block(blk_start, blk_end); + if (BlockOffsetArrayUseUnallocatedBlock) { + _unallocated_block = MAX2(_unallocated_block, blk_end); + } + } + + inline void allocated(HeapWord* blk, size_t size) { + allocated(blk, blk + size); + } + + inline void freed(HeapWord* blk_start, HeapWord* blk_end); + + inline void freed(HeapWord* blk, size_t size); + + virtual HeapWord* block_start_unsafe(const void* addr); + virtual HeapWord* block_start_unsafe_const(const void* addr) const; + + // Requires "addr" to be the start of a card and returns the + // start of the block that contains the given address. + HeapWord* block_start_careful(const void* addr) const; + + // If true, initialize array slots with no allocated blocks to zero. + // Otherwise, make them point back to the front. + bool init_to_zero() { return _init_to_zero; } + + // Verification & debugging - ensure that the offset table reflects the fact + // that the block [blk_start, blk_end) or [blk, blk + size) is a + // single block of storage. NOTE: can;t const this because of + // call to non-const do_block_internal() below. + inline void verify_single_block(HeapWord* blk_start, HeapWord* blk_end) { + if (VerifyBlockOffsetArray) { + do_block_internal(blk_start, blk_end, Action_check); + } + } + + inline void verify_single_block(HeapWord* blk, size_t size) { + verify_single_block(blk, blk + size); + } + + // Verify that the given block is before _unallocated_block + inline void verify_not_unallocated(HeapWord* blk_start, + HeapWord* blk_end) const { + if (BlockOffsetArrayUseUnallocatedBlock) { + assert(blk_start < blk_end, "Block inconsistency?"); + assert(blk_end <= _unallocated_block, "_unallocated_block problem"); + } + } + + inline void verify_not_unallocated(HeapWord* blk, size_t size) const { + verify_not_unallocated(blk, blk + size); + } + + void check_all_cards(size_t left_card, size_t right_card) const; +}; + +// A subtype of BlockOffsetArray that takes advantage of the fact +// that its underlying space is a ContiguousSpace, so that its "active" +// region can be more efficiently tracked (than for a non-contiguous space). +class G1BlockOffsetArrayContigSpace: public G1BlockOffsetArray { + friend class VMStructs; + + // allocation boundary at which offset array must be updated + HeapWord* _next_offset_threshold; + size_t _next_offset_index; // index corresponding to that boundary + + // Work function to be called when allocation start crosses the next + // threshold in the contig space. + void alloc_block_work1(HeapWord* blk_start, HeapWord* blk_end) { + alloc_block_work2(&_next_offset_threshold, &_next_offset_index, + blk_start, blk_end); + } + + + public: + G1BlockOffsetArrayContigSpace(G1BlockOffsetSharedArray* array, MemRegion mr); + + // Initialize the threshold to reflect the first boundary after the + // bottom of the covered region. + HeapWord* initialize_threshold(); + + // Zero out the entry for _bottom (offset will be zero). + void zero_bottom_entry(); + + // Return the next threshold, the point at which the table should be + // updated. + HeapWord* threshold() const { return _next_offset_threshold; } + + // These must be guaranteed to work properly (i.e., do nothing) + // when "blk_start" ("blk" for second version) is "NULL". In this + // implementation, that's true because NULL is represented as 0, and thus + // never exceeds the "_next_offset_threshold". + void alloc_block(HeapWord* blk_start, HeapWord* blk_end) { + if (blk_end > _next_offset_threshold) + alloc_block_work1(blk_start, blk_end); + } + void alloc_block(HeapWord* blk, size_t size) { + alloc_block(blk, blk+size); + } + + HeapWord* block_start_unsafe(const void* addr); + HeapWord* block_start_unsafe_const(const void* addr) const; +}; diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.inline.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.inline.hpp new file mode 100644 index 00000000000..45e148532c4 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.inline.hpp @@ -0,0 +1,153 @@ +/* + * Copyright 2001-2007 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. + * + */ + +inline HeapWord* G1BlockOffsetTable::block_start(const void* addr) { + if (addr >= _bottom && addr < _end) { + return block_start_unsafe(addr); + } else { + return NULL; + } +} + +inline HeapWord* +G1BlockOffsetTable::block_start_const(const void* addr) const { + if (addr >= _bottom && addr < _end) { + return block_start_unsafe_const(addr); + } else { + return NULL; + } +} + +inline size_t G1BlockOffsetSharedArray::index_for(const void* p) const { + char* pc = (char*)p; + assert(pc >= (char*)_reserved.start() && + pc < (char*)_reserved.end(), + "p not in range."); + size_t delta = pointer_delta(pc, _reserved.start(), sizeof(char)); + size_t result = delta >> LogN; + assert(result < _vs.committed_size(), "bad index from address"); + return result; +} + +inline HeapWord* +G1BlockOffsetSharedArray::address_for_index(size_t index) const { + assert(index < _vs.committed_size(), "bad index"); + HeapWord* result = _reserved.start() + (index << LogN_words); + assert(result >= _reserved.start() && result < _reserved.end(), + "bad address from index"); + return result; +} + +inline HeapWord* +G1BlockOffsetArray::block_at_or_preceding(const void* addr, + bool has_max_index, + size_t max_index) const { + assert(_array->offset_array(0) == 0, "objects can't cross covered areas"); + size_t index = _array->index_for(addr); + // We must make sure that the offset table entry we use is valid. If + // "addr" is past the end, start at the last known one and go forward. + if (has_max_index) { + index = MIN2(index, max_index); + } + HeapWord* q = _array->address_for_index(index); + + uint offset = _array->offset_array(index); // Extend u_char to uint. + while (offset >= N_words) { + // The excess of the offset from N_words indicates a power of Base + // to go back by. + size_t n_cards_back = BlockOffsetArray::entry_to_cards_back(offset); + q -= (N_words * n_cards_back); + assert(q >= _sp->bottom(), "Went below bottom!"); + index -= n_cards_back; + offset = _array->offset_array(index); + } + assert(offset < N_words, "offset too large"); + q -= offset; + return q; +} + +inline HeapWord* +G1BlockOffsetArray:: +forward_to_block_containing_addr_const(HeapWord* q, HeapWord* n, + const void* addr) const { + if (csp() != NULL) { + if (addr >= csp()->top()) return csp()->top(); + while (n <= addr) { + q = n; + oop obj = oop(q); + if (obj->klass() == NULL) return q; + n += obj->size(); + } + } else { + while (n <= addr) { + q = n; + oop obj = oop(q); + if (obj->klass() == NULL) return q; + n += _sp->block_size(q); + } + } + assert(q <= n, "wrong order for q and addr"); + assert(addr < n, "wrong order for addr and n"); + return q; +} + +inline HeapWord* +G1BlockOffsetArray::forward_to_block_containing_addr(HeapWord* q, + const void* addr) { + if (oop(q)->klass() == NULL) return q; + HeapWord* n = q + _sp->block_size(q); + // In the normal case, where the query "addr" is a card boundary, and the + // offset table chunks are the same size as cards, the block starting at + // "q" will contain addr, so the test below will fail, and we'll fall + // through quickly. + if (n <= addr) { + q = forward_to_block_containing_addr_slow(q, n, addr); + } + assert(q <= addr, "wrong order for current and arg"); + return q; +} + +////////////////////////////////////////////////////////////////////////// +// BlockOffsetArrayNonContigSpace inlines +////////////////////////////////////////////////////////////////////////// +inline void G1BlockOffsetArray::freed(HeapWord* blk_start, HeapWord* blk_end) { + // Verify that the BOT shows [blk_start, blk_end) to be one block. + verify_single_block(blk_start, blk_end); + // adjust _unallocated_block upward or downward + // as appropriate + if (BlockOffsetArrayUseUnallocatedBlock) { + assert(_unallocated_block <= _end, + "Inconsistent value for _unallocated_block"); + if (blk_end >= _unallocated_block && blk_start <= _unallocated_block) { + // CMS-specific note: a block abutting _unallocated_block to + // its left is being freed, a new block is being added or + // we are resetting following a compaction + _unallocated_block = blk_start; + } + } +} + +inline void G1BlockOffsetArray::freed(HeapWord* blk, size_t size) { + freed(blk, blk + size); +} diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp new file mode 100644 index 00000000000..a4d96e02359 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -0,0 +1,5355 @@ +/* + * Copyright 2001-2007 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. + * + */ + +#include "incls/_precompiled.incl" +#include "incls/_g1CollectedHeap.cpp.incl" + +// turn it on so that the contents of the young list (scan-only / +// to-be-collected) are printed at "strategic" points before / during +// / after the collection --- this is useful for debugging +#define SCAN_ONLY_VERBOSE 0 +// CURRENT STATUS +// This file is under construction. Search for "FIXME". + +// INVARIANTS/NOTES +// +// All allocation activity covered by the G1CollectedHeap interface is +// serialized by acquiring the HeapLock. This happens in +// mem_allocate_work, which all such allocation functions call. +// (Note that this does not apply to TLAB allocation, which is not part +// of this interface: it is done by clients of this interface.) + +// Local to this file. + +// Finds the first HeapRegion. +// No longer used, but might be handy someday. + +class FindFirstRegionClosure: public HeapRegionClosure { + HeapRegion* _a_region; +public: + FindFirstRegionClosure() : _a_region(NULL) {} + bool doHeapRegion(HeapRegion* r) { + _a_region = r; + return true; + } + HeapRegion* result() { return _a_region; } +}; + + +class RefineCardTableEntryClosure: public CardTableEntryClosure { + SuspendibleThreadSet* _sts; + G1RemSet* _g1rs; + ConcurrentG1Refine* _cg1r; + bool _concurrent; +public: + RefineCardTableEntryClosure(SuspendibleThreadSet* sts, + G1RemSet* g1rs, + ConcurrentG1Refine* cg1r) : + _sts(sts), _g1rs(g1rs), _cg1r(cg1r), _concurrent(true) + {} + bool do_card_ptr(jbyte* card_ptr, int worker_i) { + _g1rs->concurrentRefineOneCard(card_ptr, worker_i); + if (_concurrent && _sts->should_yield()) { + // Caller will actually yield. + return false; + } + // Otherwise, we finished successfully; return true. + return true; + } + void set_concurrent(bool b) { _concurrent = b; } +}; + + +class ClearLoggedCardTableEntryClosure: public CardTableEntryClosure { + int _calls; + G1CollectedHeap* _g1h; + CardTableModRefBS* _ctbs; + int _histo[256]; +public: + ClearLoggedCardTableEntryClosure() : + _calls(0) + { + _g1h = G1CollectedHeap::heap(); + _ctbs = (CardTableModRefBS*)_g1h->barrier_set(); + for (int i = 0; i < 256; i++) _histo[i] = 0; + } + bool do_card_ptr(jbyte* card_ptr, int worker_i) { + if (_g1h->is_in_reserved(_ctbs->addr_for(card_ptr))) { + _calls++; + unsigned char* ujb = (unsigned char*)card_ptr; + int ind = (int)(*ujb); + _histo[ind]++; + *card_ptr = -1; + } + return true; + } + int calls() { return _calls; } + void print_histo() { + gclog_or_tty->print_cr("Card table value histogram:"); + for (int i = 0; i < 256; i++) { + if (_histo[i] != 0) { + gclog_or_tty->print_cr(" %d: %d", i, _histo[i]); + } + } + } +}; + +class RedirtyLoggedCardTableEntryClosure: public CardTableEntryClosure { + int _calls; + G1CollectedHeap* _g1h; + CardTableModRefBS* _ctbs; +public: + RedirtyLoggedCardTableEntryClosure() : + _calls(0) + { + _g1h = G1CollectedHeap::heap(); + _ctbs = (CardTableModRefBS*)_g1h->barrier_set(); + } + bool do_card_ptr(jbyte* card_ptr, int worker_i) { + if (_g1h->is_in_reserved(_ctbs->addr_for(card_ptr))) { + _calls++; + *card_ptr = 0; + } + return true; + } + int calls() { return _calls; } +}; + +YoungList::YoungList(G1CollectedHeap* g1h) + : _g1h(g1h), _head(NULL), + _scan_only_head(NULL), _scan_only_tail(NULL), _curr_scan_only(NULL), + _length(0), _scan_only_length(0), + _last_sampled_rs_lengths(0), + _survivor_head(NULL), _survivors_tail(NULL), _survivor_length(0) +{ + guarantee( check_list_empty(false), "just making sure..." ); +} + +void YoungList::push_region(HeapRegion *hr) { + assert(!hr->is_young(), "should not already be young"); + assert(hr->get_next_young_region() == NULL, "cause it should!"); + + hr->set_next_young_region(_head); + _head = hr; + + hr->set_young(); + double yg_surv_rate = _g1h->g1_policy()->predict_yg_surv_rate((int)_length); + ++_length; +} + +void YoungList::add_survivor_region(HeapRegion* hr) { + assert(!hr->is_survivor(), "should not already be for survived"); + assert(hr->get_next_young_region() == NULL, "cause it should!"); + + hr->set_next_young_region(_survivor_head); + if (_survivor_head == NULL) { + _survivors_tail = hr; + } + _survivor_head = hr; + + hr->set_survivor(); + ++_survivor_length; +} + +HeapRegion* YoungList::pop_region() { + while (_head != NULL) { + assert( length() > 0, "list should not be empty" ); + HeapRegion* ret = _head; + _head = ret->get_next_young_region(); + ret->set_next_young_region(NULL); + --_length; + assert(ret->is_young(), "region should be very young"); + + // Replace 'Survivor' region type with 'Young'. So the region will + // be treated as a young region and will not be 'confused' with + // newly created survivor regions. + if (ret->is_survivor()) { + ret->set_young(); + } + + if (!ret->is_scan_only()) { + return ret; + } + + // scan-only, we'll add it to the scan-only list + if (_scan_only_tail == NULL) { + guarantee( _scan_only_head == NULL, "invariant" ); + + _scan_only_head = ret; + _curr_scan_only = ret; + } else { + guarantee( _scan_only_head != NULL, "invariant" ); + _scan_only_tail->set_next_young_region(ret); + } + guarantee( ret->get_next_young_region() == NULL, "invariant" ); + _scan_only_tail = ret; + + // no need to be tagged as scan-only any more + ret->set_young(); + + ++_scan_only_length; + } + assert( length() == 0, "list should be empty" ); + return NULL; +} + +void YoungList::empty_list(HeapRegion* list) { + while (list != NULL) { + HeapRegion* next = list->get_next_young_region(); + list->set_next_young_region(NULL); + list->uninstall_surv_rate_group(); + list->set_not_young(); + list = next; + } +} + +void YoungList::empty_list() { + assert(check_list_well_formed(), "young list should be well formed"); + + empty_list(_head); + _head = NULL; + _length = 0; + + empty_list(_scan_only_head); + _scan_only_head = NULL; + _scan_only_tail = NULL; + _scan_only_length = 0; + _curr_scan_only = NULL; + + empty_list(_survivor_head); + _survivor_head = NULL; + _survivors_tail = NULL; + _survivor_length = 0; + + _last_sampled_rs_lengths = 0; + + assert(check_list_empty(false), "just making sure..."); +} + +bool YoungList::check_list_well_formed() { + bool ret = true; + + size_t length = 0; + HeapRegion* curr = _head; + HeapRegion* last = NULL; + while (curr != NULL) { + if (!curr->is_young() || curr->is_scan_only()) { + gclog_or_tty->print_cr("### YOUNG REGION "PTR_FORMAT"-"PTR_FORMAT" " + "incorrectly tagged (%d, %d)", + curr->bottom(), curr->end(), + curr->is_young(), curr->is_scan_only()); + ret = false; + } + ++length; + last = curr; + curr = curr->get_next_young_region(); + } + ret = ret && (length == _length); + + if (!ret) { + gclog_or_tty->print_cr("### YOUNG LIST seems not well formed!"); + gclog_or_tty->print_cr("### list has %d entries, _length is %d", + length, _length); + } + + bool scan_only_ret = true; + length = 0; + curr = _scan_only_head; + last = NULL; + while (curr != NULL) { + if (!curr->is_young() || curr->is_scan_only()) { + gclog_or_tty->print_cr("### SCAN-ONLY REGION "PTR_FORMAT"-"PTR_FORMAT" " + "incorrectly tagged (%d, %d)", + curr->bottom(), curr->end(), + curr->is_young(), curr->is_scan_only()); + scan_only_ret = false; + } + ++length; + last = curr; + curr = curr->get_next_young_region(); + } + scan_only_ret = scan_only_ret && (length == _scan_only_length); + + if ( (last != _scan_only_tail) || + (_scan_only_head == NULL && _scan_only_tail != NULL) || + (_scan_only_head != NULL && _scan_only_tail == NULL) ) { + gclog_or_tty->print_cr("## _scan_only_tail is set incorrectly"); + scan_only_ret = false; + } + + if (_curr_scan_only != NULL && _curr_scan_only != _scan_only_head) { + gclog_or_tty->print_cr("### _curr_scan_only is set incorrectly"); + scan_only_ret = false; + } + + if (!scan_only_ret) { + gclog_or_tty->print_cr("### SCAN-ONLY LIST seems not well formed!"); + gclog_or_tty->print_cr("### list has %d entries, _scan_only_length is %d", + length, _scan_only_length); + } + + return ret && scan_only_ret; +} + +bool YoungList::check_list_empty(bool ignore_scan_only_list, + bool check_sample) { + bool ret = true; + + if (_length != 0) { + gclog_or_tty->print_cr("### YOUNG LIST should have 0 length, not %d", + _length); + ret = false; + } + if (check_sample && _last_sampled_rs_lengths != 0) { + gclog_or_tty->print_cr("### YOUNG LIST has non-zero last sampled RS lengths"); + ret = false; + } + if (_head != NULL) { + gclog_or_tty->print_cr("### YOUNG LIST does not have a NULL head"); + ret = false; + } + if (!ret) { + gclog_or_tty->print_cr("### YOUNG LIST does not seem empty"); + } + + if (ignore_scan_only_list) + return ret; + + bool scan_only_ret = true; + if (_scan_only_length != 0) { + gclog_or_tty->print_cr("### SCAN-ONLY LIST should have 0 length, not %d", + _scan_only_length); + scan_only_ret = false; + } + if (_scan_only_head != NULL) { + gclog_or_tty->print_cr("### SCAN-ONLY LIST does not have a NULL head"); + scan_only_ret = false; + } + if (_scan_only_tail != NULL) { + gclog_or_tty->print_cr("### SCAN-ONLY LIST does not have a NULL tail"); + scan_only_ret = false; + } + if (!scan_only_ret) { + gclog_or_tty->print_cr("### SCAN-ONLY LIST does not seem empty"); + } + + return ret && scan_only_ret; +} + +void +YoungList::rs_length_sampling_init() { + _sampled_rs_lengths = 0; + _curr = _head; +} + +bool +YoungList::rs_length_sampling_more() { + return _curr != NULL; +} + +void +YoungList::rs_length_sampling_next() { + assert( _curr != NULL, "invariant" ); + _sampled_rs_lengths += _curr->rem_set()->occupied(); + _curr = _curr->get_next_young_region(); + if (_curr == NULL) { + _last_sampled_rs_lengths = _sampled_rs_lengths; + // gclog_or_tty->print_cr("last sampled RS lengths = %d", _last_sampled_rs_lengths); + } +} + +void +YoungList::reset_auxilary_lists() { + // We could have just "moved" the scan-only list to the young list. + // However, the scan-only list is ordered according to the region + // age in descending order, so, by moving one entry at a time, we + // ensure that it is recreated in ascending order. + + guarantee( is_empty(), "young list should be empty" ); + assert(check_list_well_formed(), "young list should be well formed"); + + // Add survivor regions to SurvRateGroup. + _g1h->g1_policy()->note_start_adding_survivor_regions(); + for (HeapRegion* curr = _survivor_head; + curr != NULL; + curr = curr->get_next_young_region()) { + _g1h->g1_policy()->set_region_survivors(curr); + } + _g1h->g1_policy()->note_stop_adding_survivor_regions(); + + if (_survivor_head != NULL) { + _head = _survivor_head; + _length = _survivor_length + _scan_only_length; + _survivors_tail->set_next_young_region(_scan_only_head); + } else { + _head = _scan_only_head; + _length = _scan_only_length; + } + + for (HeapRegion* curr = _scan_only_head; + curr != NULL; + curr = curr->get_next_young_region()) { + curr->recalculate_age_in_surv_rate_group(); + } + _scan_only_head = NULL; + _scan_only_tail = NULL; + _scan_only_length = 0; + _curr_scan_only = NULL; + + _survivor_head = NULL; + _survivors_tail = NULL; + _survivor_length = 0; + _g1h->g1_policy()->finished_recalculating_age_indexes(); + + assert(check_list_well_formed(), "young list should be well formed"); +} + +void YoungList::print() { + HeapRegion* lists[] = {_head, _scan_only_head, _survivor_head}; + const char* names[] = {"YOUNG", "SCAN-ONLY", "SURVIVOR"}; + + for (unsigned int list = 0; list < ARRAY_SIZE(lists); ++list) { + gclog_or_tty->print_cr("%s LIST CONTENTS", names[list]); + HeapRegion *curr = lists[list]; + if (curr == NULL) + gclog_or_tty->print_cr(" empty"); + while (curr != NULL) { + gclog_or_tty->print_cr(" [%08x-%08x], t: %08x, P: %08x, N: %08x, C: %08x, " + "age: %4d, y: %d, s-o: %d, surv: %d", + curr->bottom(), curr->end(), + curr->top(), + curr->prev_top_at_mark_start(), + curr->next_top_at_mark_start(), + curr->top_at_conc_mark_count(), + curr->age_in_surv_rate_group_cond(), + curr->is_young(), + curr->is_scan_only(), + curr->is_survivor()); + curr = curr->get_next_young_region(); + } + } + + gclog_or_tty->print_cr(""); +} + +void G1CollectedHeap::stop_conc_gc_threads() { + _cg1r->cg1rThread()->stop(); + _czft->stop(); + _cmThread->stop(); +} + + +void G1CollectedHeap::check_ct_logs_at_safepoint() { + DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set(); + CardTableModRefBS* ct_bs = (CardTableModRefBS*)barrier_set(); + + // Count the dirty cards at the start. + CountNonCleanMemRegionClosure count1(this); + ct_bs->mod_card_iterate(&count1); + int orig_count = count1.n(); + + // First clear the logged cards. + ClearLoggedCardTableEntryClosure clear; + dcqs.set_closure(&clear); + dcqs.apply_closure_to_all_completed_buffers(); + dcqs.iterate_closure_all_threads(false); + clear.print_histo(); + + // Now ensure that there's no dirty cards. + CountNonCleanMemRegionClosure count2(this); + ct_bs->mod_card_iterate(&count2); + if (count2.n() != 0) { + gclog_or_tty->print_cr("Card table has %d entries; %d originally", + count2.n(), orig_count); + } + guarantee(count2.n() == 0, "Card table should be clean."); + + RedirtyLoggedCardTableEntryClosure redirty; + JavaThread::dirty_card_queue_set().set_closure(&redirty); + dcqs.apply_closure_to_all_completed_buffers(); + dcqs.iterate_closure_all_threads(false); + gclog_or_tty->print_cr("Log entries = %d, dirty cards = %d.", + clear.calls(), orig_count); + guarantee(redirty.calls() == clear.calls(), + "Or else mechanism is broken."); + + CountNonCleanMemRegionClosure count3(this); + ct_bs->mod_card_iterate(&count3); + if (count3.n() != orig_count) { + gclog_or_tty->print_cr("Should have restored them all: orig = %d, final = %d.", + orig_count, count3.n()); + guarantee(count3.n() >= orig_count, "Should have restored them all."); + } + + JavaThread::dirty_card_queue_set().set_closure(_refine_cte_cl); +} + +// Private class members. + +G1CollectedHeap* G1CollectedHeap::_g1h; + +// Private methods. + +// Finds a HeapRegion that can be used to allocate a given size of block. + + +HeapRegion* G1CollectedHeap::newAllocRegion_work(size_t word_size, + bool do_expand, + bool zero_filled) { + ConcurrentZFThread::note_region_alloc(); + HeapRegion* res = alloc_free_region_from_lists(zero_filled); + if (res == NULL && do_expand) { + expand(word_size * HeapWordSize); + res = alloc_free_region_from_lists(zero_filled); + assert(res == NULL || + (!res->isHumongous() && + (!zero_filled || + res->zero_fill_state() == HeapRegion::Allocated)), + "Alloc Regions must be zero filled (and non-H)"); + } + if (res != NULL && res->is_empty()) _free_regions--; + assert(res == NULL || + (!res->isHumongous() && + (!zero_filled || + res->zero_fill_state() == HeapRegion::Allocated)), + "Non-young alloc Regions must be zero filled (and non-H)"); + + if (G1TraceRegions) { + if (res != NULL) { + gclog_or_tty->print_cr("new alloc region %d:["PTR_FORMAT", "PTR_FORMAT"], " + "top "PTR_FORMAT, + res->hrs_index(), res->bottom(), res->end(), res->top()); + } + } + + return res; +} + +HeapRegion* G1CollectedHeap::newAllocRegionWithExpansion(int purpose, + size_t word_size, + bool zero_filled) { + HeapRegion* alloc_region = NULL; + if (_gc_alloc_region_counts[purpose] < g1_policy()->max_regions(purpose)) { + alloc_region = newAllocRegion_work(word_size, true, zero_filled); + if (purpose == GCAllocForSurvived && alloc_region != NULL) { + _young_list->add_survivor_region(alloc_region); + } + ++_gc_alloc_region_counts[purpose]; + } else { + g1_policy()->note_alloc_region_limit_reached(purpose); + } + return alloc_region; +} + +// If could fit into free regions w/o expansion, try. +// Otherwise, if can expand, do so. +// Otherwise, if using ex regions might help, try with ex given back. +HeapWord* G1CollectedHeap::humongousObjAllocate(size_t word_size) { + assert(regions_accounted_for(), "Region leakage!"); + + // We can't allocate H regions while cleanupComplete is running, since + // some of the regions we find to be empty might not yet be added to the + // unclean list. (If we're already at a safepoint, this call is + // unnecessary, not to mention wrong.) + if (!SafepointSynchronize::is_at_safepoint()) + wait_for_cleanup_complete(); + + size_t num_regions = + round_to(word_size, HeapRegion::GrainWords) / HeapRegion::GrainWords; + + // Special case if < one region??? + + // Remember the ft size. + size_t x_size = expansion_regions(); + + HeapWord* res = NULL; + bool eliminated_allocated_from_lists = false; + + // Can the allocation potentially fit in the free regions? + if (free_regions() >= num_regions) { + res = _hrs->obj_allocate(word_size); + } + if (res == NULL) { + // Try expansion. + size_t fs = _hrs->free_suffix(); + if (fs + x_size >= num_regions) { + expand((num_regions - fs) * HeapRegion::GrainBytes); + res = _hrs->obj_allocate(word_size); + assert(res != NULL, "This should have worked."); + } else { + // Expansion won't help. Are there enough free regions if we get rid + // of reservations? + size_t avail = free_regions(); + if (avail >= num_regions) { + res = _hrs->obj_allocate(word_size); + if (res != NULL) { + remove_allocated_regions_from_lists(); + eliminated_allocated_from_lists = true; + } + } + } + } + if (res != NULL) { + // Increment by the number of regions allocated. + // FIXME: Assumes regions all of size GrainBytes. +#ifndef PRODUCT + mr_bs()->verify_clean_region(MemRegion(res, res + num_regions * + HeapRegion::GrainWords)); +#endif + if (!eliminated_allocated_from_lists) + remove_allocated_regions_from_lists(); + _summary_bytes_used += word_size * HeapWordSize; + _free_regions -= num_regions; + _num_humongous_regions += (int) num_regions; + } + assert(regions_accounted_for(), "Region Leakage"); + return res; +} + +HeapWord* +G1CollectedHeap::attempt_allocation_slow(size_t word_size, + bool permit_collection_pause) { + HeapWord* res = NULL; + HeapRegion* allocated_young_region = NULL; + + assert( SafepointSynchronize::is_at_safepoint() || + Heap_lock->owned_by_self(), "pre condition of the call" ); + + if (isHumongous(word_size)) { + // Allocation of a humongous object can, in a sense, complete a + // partial region, if the previous alloc was also humongous, and + // caused the test below to succeed. + if (permit_collection_pause) + do_collection_pause_if_appropriate(word_size); + res = humongousObjAllocate(word_size); + assert(_cur_alloc_region == NULL + || !_cur_alloc_region->isHumongous(), + "Prevent a regression of this bug."); + + } else { + // If we do a collection pause, this will be reset to a non-NULL + // value. If we don't, nulling here ensures that we allocate a new + // region below. + if (_cur_alloc_region != NULL) { + // We're finished with the _cur_alloc_region. + _summary_bytes_used += _cur_alloc_region->used(); + _cur_alloc_region = NULL; + } + assert(_cur_alloc_region == NULL, "Invariant."); + // Completion of a heap region is perhaps a good point at which to do + // a collection pause. + if (permit_collection_pause) + do_collection_pause_if_appropriate(word_size); + // Make sure we have an allocation region available. + if (_cur_alloc_region == NULL) { + if (!SafepointSynchronize::is_at_safepoint()) + wait_for_cleanup_complete(); + bool next_is_young = should_set_young_locked(); + // If the next region is not young, make sure it's zero-filled. + _cur_alloc_region = newAllocRegion(word_size, !next_is_young); + if (_cur_alloc_region != NULL) { + _summary_bytes_used -= _cur_alloc_region->used(); + if (next_is_young) { + set_region_short_lived_locked(_cur_alloc_region); + allocated_young_region = _cur_alloc_region; + } + } + } + assert(_cur_alloc_region == NULL || !_cur_alloc_region->isHumongous(), + "Prevent a regression of this bug."); + + // Now retry the allocation. + if (_cur_alloc_region != NULL) { + res = _cur_alloc_region->allocate(word_size); + } + } + + // NOTE: fails frequently in PRT + assert(regions_accounted_for(), "Region leakage!"); + + if (res != NULL) { + if (!SafepointSynchronize::is_at_safepoint()) { + assert( permit_collection_pause, "invariant" ); + assert( Heap_lock->owned_by_self(), "invariant" ); + Heap_lock->unlock(); + } + + if (allocated_young_region != NULL) { + HeapRegion* hr = allocated_young_region; + HeapWord* bottom = hr->bottom(); + HeapWord* end = hr->end(); + MemRegion mr(bottom, end); + ((CardTableModRefBS*)_g1h->barrier_set())->dirty(mr); + } + } + + assert( SafepointSynchronize::is_at_safepoint() || + (res == NULL && Heap_lock->owned_by_self()) || + (res != NULL && !Heap_lock->owned_by_self()), + "post condition of the call" ); + + return res; +} + +HeapWord* +G1CollectedHeap::mem_allocate(size_t word_size, + bool is_noref, + bool is_tlab, + bool* gc_overhead_limit_was_exceeded) { + debug_only(check_for_valid_allocation_state()); + assert(no_gc_in_progress(), "Allocation during gc not allowed"); + HeapWord* result = NULL; + + // Loop until the allocation is satisified, + // or unsatisfied after GC. + for (int try_count = 1; /* return or throw */; try_count += 1) { + int gc_count_before; + { + Heap_lock->lock(); + result = attempt_allocation(word_size); + if (result != NULL) { + // attempt_allocation should have unlocked the heap lock + assert(is_in(result), "result not in heap"); + return result; + } + // Read the gc count while the heap lock is held. + gc_count_before = SharedHeap::heap()->total_collections(); + Heap_lock->unlock(); + } + + // Create the garbage collection operation... + VM_G1CollectForAllocation op(word_size, + gc_count_before); + + // ...and get the VM thread to execute it. + VMThread::execute(&op); + if (op.prologue_succeeded()) { + result = op.result(); + assert(result == NULL || is_in(result), "result not in heap"); + return result; + } + + // Give a warning if we seem to be looping forever. + if ((QueuedAllocationWarningCount > 0) && + (try_count % QueuedAllocationWarningCount == 0)) { + warning("G1CollectedHeap::mem_allocate_work retries %d times", + try_count); + } + } +} + +void G1CollectedHeap::abandon_cur_alloc_region() { + if (_cur_alloc_region != NULL) { + // We're finished with the _cur_alloc_region. + if (_cur_alloc_region->is_empty()) { + _free_regions++; + free_region(_cur_alloc_region); + } else { + _summary_bytes_used += _cur_alloc_region->used(); + } + _cur_alloc_region = NULL; + } +} + +class PostMCRemSetClearClosure: public HeapRegionClosure { + ModRefBarrierSet* _mr_bs; +public: + PostMCRemSetClearClosure(ModRefBarrierSet* mr_bs) : _mr_bs(mr_bs) {} + bool doHeapRegion(HeapRegion* r) { + r->reset_gc_time_stamp(); + if (r->continuesHumongous()) + return false; + HeapRegionRemSet* hrrs = r->rem_set(); + if (hrrs != NULL) hrrs->clear(); + // You might think here that we could clear just the cards + // corresponding to the used region. But no: if we leave a dirty card + // in a region we might allocate into, then it would prevent that card + // from being enqueued, and cause it to be missed. + // Re: the performance cost: we shouldn't be doing full GC anyway! + _mr_bs->clear(MemRegion(r->bottom(), r->end())); + return false; + } +}; + + +class PostMCRemSetInvalidateClosure: public HeapRegionClosure { + ModRefBarrierSet* _mr_bs; +public: + PostMCRemSetInvalidateClosure(ModRefBarrierSet* mr_bs) : _mr_bs(mr_bs) {} + bool doHeapRegion(HeapRegion* r) { + if (r->continuesHumongous()) return false; + if (r->used_region().word_size() != 0) { + _mr_bs->invalidate(r->used_region(), true /*whole heap*/); + } + return false; + } +}; + +void G1CollectedHeap::do_collection(bool full, bool clear_all_soft_refs, + size_t word_size) { + ResourceMark rm; + + if (full && DisableExplicitGC) { + gclog_or_tty->print("\n\n\nDisabling Explicit GC\n\n\n"); + return; + } + + 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; + + // Timing + gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps); + TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty); + TraceTime t(full ? "Full GC (System.gc())" : "Full GC", PrintGC, true, gclog_or_tty); + + double start = os::elapsedTime(); + GCOverheadReporter::recordSTWStart(start); + g1_policy()->record_full_collection_start(); + + gc_prologue(true); + increment_total_collections(); + + size_t g1h_prev_used = used(); + assert(used() == recalculate_used(), "Should be equal"); + + if (VerifyBeforeGC && total_collections() >= VerifyGCStartAt) { + HandleMark hm; // Discard invalid handles created during verification + prepare_for_verify(); + gclog_or_tty->print(" VerifyBeforeGC:"); + Universe::verify(true); + } + assert(regions_accounted_for(), "Region leakage!"); + + COMPILER2_PRESENT(DerivedPointerTable::clear()); + + // We want to discover references, but not process them yet. + // This mode is disabled in + // instanceRefKlass::process_discovered_references if the + // generation does some collection work, or + // instanceRefKlass::enqueue_discovered_references if the + // generation returns without doing any work. + ref_processor()->disable_discovery(); + ref_processor()->abandon_partial_discovery(); + ref_processor()->verify_no_references_recorded(); + + // Abandon current iterations of concurrent marking and concurrent + // refinement, if any are in progress. + concurrent_mark()->abort(); + + // Make sure we'll choose a new allocation region afterwards. + abandon_cur_alloc_region(); + assert(_cur_alloc_region == NULL, "Invariant."); + g1_rem_set()->as_HRInto_G1RemSet()->cleanupHRRS(); + tear_down_region_lists(); + set_used_regions_to_need_zero_fill(); + if (g1_policy()->in_young_gc_mode()) { + empty_young_list(); + g1_policy()->set_full_young_gcs(true); + } + + // Temporarily make reference _discovery_ single threaded (non-MT). + ReferenceProcessorMTMutator rp_disc_ser(ref_processor(), false); + + // Temporarily make refs discovery atomic + ReferenceProcessorAtomicMutator rp_disc_atomic(ref_processor(), true); + + // Temporarily clear _is_alive_non_header + ReferenceProcessorIsAliveMutator rp_is_alive_null(ref_processor(), NULL); + + ref_processor()->enable_discovery(); + + // Do collection work + { + HandleMark hm; // Discard invalid handles created during gc + G1MarkSweep::invoke_at_safepoint(ref_processor(), clear_all_soft_refs); + } + // Because freeing humongous regions may have added some unclean + // regions, it is necessary to tear down again before rebuilding. + tear_down_region_lists(); + rebuild_region_lists(); + + _summary_bytes_used = recalculate_used(); + + ref_processor()->enqueue_discovered_references(); + + COMPILER2_PRESENT(DerivedPointerTable::update_pointers()); + + if (VerifyAfterGC && total_collections() >= VerifyGCStartAt) { + HandleMark hm; // Discard invalid handles created during verification + gclog_or_tty->print(" VerifyAfterGC:"); + Universe::verify(false); + } + NOT_PRODUCT(ref_processor()->verify_no_references_recorded()); + + reset_gc_time_stamp(); + // Since everything potentially moved, we will clear all remembered + // sets, and clear all cards. Later we will also cards in the used + // portion of the heap after the resizing (which could be a shrinking.) + // We will also reset the GC time stamps of the regions. + PostMCRemSetClearClosure rs_clear(mr_bs()); + heap_region_iterate(&rs_clear); + + // Resize the heap if necessary. + resize_if_necessary_after_full_collection(full ? 0 : word_size); + + // Since everything potentially moved, we will clear all remembered + // sets, but also dirty all cards corresponding to used regions. + PostMCRemSetInvalidateClosure rs_invalidate(mr_bs()); + heap_region_iterate(&rs_invalidate); + if (_cg1r->use_cache()) { + _cg1r->clear_and_record_card_counts(); + _cg1r->clear_hot_cache(); + } + + if (PrintGC) { + print_size_transition(gclog_or_tty, g1h_prev_used, used(), capacity()); + } + + if (true) { // FIXME + // Ask the permanent generation to adjust size for full collections + perm()->compute_new_size(); + } + + double end = os::elapsedTime(); + GCOverheadReporter::recordSTWEnd(end); + g1_policy()->record_full_collection_end(); + + gc_epilogue(true); + + // Abandon concurrent refinement. This must happen last: in the + // dirty-card logging system, some cards may be dirty by weak-ref + // processing, and may be enqueued. But the whole card table is + // dirtied, so this should abandon those logs, and set "do_traversal" + // to true. + concurrent_g1_refine()->set_pya_restart(); + + assert(regions_accounted_for(), "Region leakage!"); + } + + if (g1_policy()->in_young_gc_mode()) { + _young_list->reset_sampled_info(); + assert( check_young_list_empty(false, false), + "young list should be empty at this point"); + } +} + +void G1CollectedHeap::do_full_collection(bool clear_all_soft_refs) { + do_collection(true, clear_all_soft_refs, 0); +} + +// This code is mostly copied from TenuredGeneration. +void +G1CollectedHeap:: +resize_if_necessary_after_full_collection(size_t word_size) { + assert(MinHeapFreeRatio <= MaxHeapFreeRatio, "sanity check"); + + // Include the current allocation, if any, and bytes that will be + // pre-allocated to support collections, as "used". + const size_t used_after_gc = used(); + const size_t capacity_after_gc = capacity(); + const size_t free_after_gc = capacity_after_gc - used_after_gc; + + // We don't have floating point command-line arguments + const double minimum_free_percentage = (double) MinHeapFreeRatio / 100; + const double maximum_used_percentage = 1.0 - minimum_free_percentage; + const double maximum_free_percentage = (double) MaxHeapFreeRatio / 100; + const double minimum_used_percentage = 1.0 - maximum_free_percentage; + + size_t minimum_desired_capacity = (size_t) (used_after_gc / maximum_used_percentage); + size_t maximum_desired_capacity = (size_t) (used_after_gc / minimum_used_percentage); + + // Don't shrink less than the initial size. + minimum_desired_capacity = + MAX2(minimum_desired_capacity, + collector_policy()->initial_heap_byte_size()); + maximum_desired_capacity = + MAX2(maximum_desired_capacity, + collector_policy()->initial_heap_byte_size()); + + // We are failing here because minimum_desired_capacity is + assert(used_after_gc <= minimum_desired_capacity, "sanity check"); + assert(minimum_desired_capacity <= maximum_desired_capacity, "sanity check"); + + if (PrintGC && Verbose) { + const double free_percentage = ((double)free_after_gc) / capacity(); + gclog_or_tty->print_cr("Computing new size after full GC "); + gclog_or_tty->print_cr(" " + " minimum_free_percentage: %6.2f", + minimum_free_percentage); + gclog_or_tty->print_cr(" " + " maximum_free_percentage: %6.2f", + maximum_free_percentage); + gclog_or_tty->print_cr(" " + " capacity: %6.1fK" + " minimum_desired_capacity: %6.1fK" + " maximum_desired_capacity: %6.1fK", + capacity() / (double) K, + minimum_desired_capacity / (double) K, + maximum_desired_capacity / (double) K); + gclog_or_tty->print_cr(" " + " free_after_gc : %6.1fK" + " used_after_gc : %6.1fK", + free_after_gc / (double) K, + used_after_gc / (double) K); + gclog_or_tty->print_cr(" " + " free_percentage: %6.2f", + free_percentage); + } + if (capacity() < minimum_desired_capacity) { + // Don't expand unless it's significant + size_t expand_bytes = minimum_desired_capacity - capacity_after_gc; + expand(expand_bytes); + if (PrintGC && Verbose) { + gclog_or_tty->print_cr(" expanding:" + " minimum_desired_capacity: %6.1fK" + " expand_bytes: %6.1fK", + minimum_desired_capacity / (double) K, + expand_bytes / (double) K); + } + + // No expansion, now see if we want to shrink + } else if (capacity() > maximum_desired_capacity) { + // Capacity too large, compute shrinking size + size_t shrink_bytes = capacity_after_gc - maximum_desired_capacity; + shrink(shrink_bytes); + if (PrintGC && Verbose) { + gclog_or_tty->print_cr(" " + " shrinking:" + " initSize: %.1fK" + " maximum_desired_capacity: %.1fK", + collector_policy()->initial_heap_byte_size() / (double) K, + maximum_desired_capacity / (double) K); + gclog_or_tty->print_cr(" " + " shrink_bytes: %.1fK", + shrink_bytes / (double) K); + } + } +} + + +HeapWord* +G1CollectedHeap::satisfy_failed_allocation(size_t word_size) { + HeapWord* result = NULL; + + // In a G1 heap, we're supposed to keep allocation from failing by + // incremental pauses. Therefore, at least for now, we'll favor + // expansion over collection. (This might change in the future if we can + // do something smarter than full collection to satisfy a failed alloc.) + + result = expand_and_allocate(word_size); + if (result != NULL) { + assert(is_in(result), "result not in heap"); + return result; + } + + // OK, I guess we have to try collection. + + do_collection(false, false, word_size); + + result = attempt_allocation(word_size, /*permit_collection_pause*/false); + + if (result != NULL) { + assert(is_in(result), "result not in heap"); + return result; + } + + // Try collecting soft references. + do_collection(false, true, word_size); + result = attempt_allocation(word_size, /*permit_collection_pause*/false); + if (result != NULL) { + assert(is_in(result), "result not in heap"); + return result; + } + + // What else? We might try synchronous finalization later. If the total + // space available is large enough for the allocation, then a more + // complete compaction phase than we've tried so far might be + // appropriate. + return NULL; +} + +// Attempting to expand the heap sufficiently +// to support an allocation of the given "word_size". If +// successful, perform the allocation and return the address of the +// allocated block, or else "NULL". + +HeapWord* G1CollectedHeap::expand_and_allocate(size_t word_size) { + size_t expand_bytes = word_size * HeapWordSize; + if (expand_bytes < MinHeapDeltaBytes) { + expand_bytes = MinHeapDeltaBytes; + } + expand(expand_bytes); + assert(regions_accounted_for(), "Region leakage!"); + HeapWord* result = attempt_allocation(word_size, false /* permit_collection_pause */); + return result; +} + +size_t G1CollectedHeap::free_region_if_totally_empty(HeapRegion* hr) { + size_t pre_used = 0; + size_t cleared_h_regions = 0; + size_t freed_regions = 0; + UncleanRegionList local_list; + free_region_if_totally_empty_work(hr, pre_used, cleared_h_regions, + freed_regions, &local_list); + + finish_free_region_work(pre_used, cleared_h_regions, freed_regions, + &local_list); + return pre_used; +} + +void +G1CollectedHeap::free_region_if_totally_empty_work(HeapRegion* hr, + size_t& pre_used, + size_t& cleared_h, + size_t& freed_regions, + UncleanRegionList* list, + bool par) { + assert(!hr->continuesHumongous(), "should have filtered these out"); + size_t res = 0; + if (!hr->popular() && hr->used() > 0 && hr->garbage_bytes() == hr->used()) { + if (!hr->is_young()) { + if (G1PolicyVerbose > 0) + gclog_or_tty->print_cr("Freeing empty region "PTR_FORMAT "(" SIZE_FORMAT " bytes)" + " during cleanup", hr, hr->used()); + free_region_work(hr, pre_used, cleared_h, freed_regions, list, par); + } + } +} + +// FIXME: both this and shrink could probably be more efficient by +// doing one "VirtualSpace::expand_by" call rather than several. +void G1CollectedHeap::expand(size_t expand_bytes) { + size_t old_mem_size = _g1_storage.committed_size(); + // We expand by a minimum of 1K. + expand_bytes = MAX2(expand_bytes, (size_t)K); + size_t aligned_expand_bytes = + ReservedSpace::page_align_size_up(expand_bytes); + aligned_expand_bytes = align_size_up(aligned_expand_bytes, + HeapRegion::GrainBytes); + expand_bytes = aligned_expand_bytes; + while (expand_bytes > 0) { + HeapWord* base = (HeapWord*)_g1_storage.high(); + // Commit more storage. + bool successful = _g1_storage.expand_by(HeapRegion::GrainBytes); + if (!successful) { + expand_bytes = 0; + } else { + expand_bytes -= HeapRegion::GrainBytes; + // Expand the committed region. + HeapWord* high = (HeapWord*) _g1_storage.high(); + _g1_committed.set_end(high); + // Create a new HeapRegion. + MemRegion mr(base, high); + bool is_zeroed = !_g1_max_committed.contains(base); + HeapRegion* hr = new HeapRegion(_bot_shared, mr, is_zeroed); + + // Now update max_committed if necessary. + _g1_max_committed.set_end(MAX2(_g1_max_committed.end(), high)); + + // Add it to the HeapRegionSeq. + _hrs->insert(hr); + // Set the zero-fill state, according to whether it's already + // zeroed. + { + MutexLockerEx x(ZF_mon, Mutex::_no_safepoint_check_flag); + if (is_zeroed) { + hr->set_zero_fill_complete(); + put_free_region_on_list_locked(hr); + } else { + hr->set_zero_fill_needed(); + put_region_on_unclean_list_locked(hr); + } + } + _free_regions++; + // And we used up an expansion region to create it. + _expansion_regions--; + // Tell the cardtable about it. + Universe::heap()->barrier_set()->resize_covered_region(_g1_committed); + // And the offset table as well. + _bot_shared->resize(_g1_committed.word_size()); + } + } + if (Verbose && PrintGC) { + size_t new_mem_size = _g1_storage.committed_size(); + gclog_or_tty->print_cr("Expanding garbage-first heap from %ldK by %ldK to %ldK", + old_mem_size/K, aligned_expand_bytes/K, + new_mem_size/K); + } +} + +void G1CollectedHeap::shrink_helper(size_t shrink_bytes) +{ + size_t old_mem_size = _g1_storage.committed_size(); + size_t aligned_shrink_bytes = + ReservedSpace::page_align_size_down(shrink_bytes); + aligned_shrink_bytes = align_size_down(aligned_shrink_bytes, + HeapRegion::GrainBytes); + size_t num_regions_deleted = 0; + MemRegion mr = _hrs->shrink_by(aligned_shrink_bytes, num_regions_deleted); + + assert(mr.end() == (HeapWord*)_g1_storage.high(), "Bad shrink!"); + if (mr.byte_size() > 0) + _g1_storage.shrink_by(mr.byte_size()); + assert(mr.start() == (HeapWord*)_g1_storage.high(), "Bad shrink!"); + + _g1_committed.set_end(mr.start()); + _free_regions -= num_regions_deleted; + _expansion_regions += num_regions_deleted; + + // Tell the cardtable about it. + Universe::heap()->barrier_set()->resize_covered_region(_g1_committed); + + // And the offset table as well. + _bot_shared->resize(_g1_committed.word_size()); + + HeapRegionRemSet::shrink_heap(n_regions()); + + if (Verbose && PrintGC) { + size_t new_mem_size = _g1_storage.committed_size(); + gclog_or_tty->print_cr("Shrinking garbage-first heap from %ldK by %ldK to %ldK", + old_mem_size/K, aligned_shrink_bytes/K, + new_mem_size/K); + } +} + +void G1CollectedHeap::shrink(size_t shrink_bytes) { + release_gc_alloc_regions(); + tear_down_region_lists(); // We will rebuild them in a moment. + shrink_helper(shrink_bytes); + rebuild_region_lists(); +} + +// Public methods. + +#ifdef _MSC_VER // the use of 'this' below gets a warning, make it go away +#pragma warning( disable:4355 ) // 'this' : used in base member initializer list +#endif // _MSC_VER + + +G1CollectedHeap::G1CollectedHeap(G1CollectorPolicy* policy_) : + SharedHeap(policy_), + _g1_policy(policy_), + _ref_processor(NULL), + _process_strong_tasks(new SubTasksDone(G1H_PS_NumElements)), + _bot_shared(NULL), + _par_alloc_during_gc_lock(Mutex::leaf, "par alloc during GC lock"), + _objs_with_preserved_marks(NULL), _preserved_marks_of_objs(NULL), + _evac_failure_scan_stack(NULL) , + _mark_in_progress(false), + _cg1r(NULL), _czft(NULL), _summary_bytes_used(0), + _cur_alloc_region(NULL), + _refine_cte_cl(NULL), + _free_region_list(NULL), _free_region_list_size(0), + _free_regions(0), + _popular_object_boundary(NULL), + _cur_pop_hr_index(0), + _popular_regions_to_be_evacuated(NULL), + _pop_obj_rc_at_copy(), + _full_collection(false), + _unclean_region_list(), + _unclean_regions_coming(false), + _young_list(new YoungList(this)), + _gc_time_stamp(0), + _surviving_young_words(NULL) +{ + _g1h = this; // To catch bugs. + if (_process_strong_tasks == NULL || !_process_strong_tasks->valid()) { + vm_exit_during_initialization("Failed necessary allocation."); + } + int n_queues = MAX2((int)ParallelGCThreads, 1); + _task_queues = new RefToScanQueueSet(n_queues); + + int n_rem_sets = HeapRegionRemSet::num_par_rem_sets(); + assert(n_rem_sets > 0, "Invariant."); + + HeapRegionRemSetIterator** iter_arr = + NEW_C_HEAP_ARRAY(HeapRegionRemSetIterator*, n_queues); + for (int i = 0; i < n_queues; i++) { + iter_arr[i] = new HeapRegionRemSetIterator(); + } + _rem_set_iterator = iter_arr; + + for (int i = 0; i < n_queues; i++) { + RefToScanQueue* q = new RefToScanQueue(); + q->initialize(); + _task_queues->register_queue(i, q); + } + + for (int ap = 0; ap < GCAllocPurposeCount; ++ap) { + _gc_alloc_regions[ap] = NULL; + _gc_alloc_region_counts[ap] = 0; + } + guarantee(_task_queues != NULL, "task_queues allocation failure."); +} + +jint G1CollectedHeap::initialize() { + os::enable_vtime(); + + // Necessary to satisfy locking discipline assertions. + + MutexLocker x(Heap_lock); + + // While there are no constraints in the GC code that HeapWordSize + // be any particular value, there are multiple other areas in the + // system which believe this to be true (e.g. oop->object_size in some + // cases incorrectly returns the size in wordSize units rather than + // HeapWordSize). + guarantee(HeapWordSize == wordSize, "HeapWordSize must equal wordSize"); + + size_t init_byte_size = collector_policy()->initial_heap_byte_size(); + size_t max_byte_size = collector_policy()->max_heap_byte_size(); + + // Ensure that the sizes are properly aligned. + Universe::check_alignment(init_byte_size, HeapRegion::GrainBytes, "g1 heap"); + Universe::check_alignment(max_byte_size, HeapRegion::GrainBytes, "g1 heap"); + + // We allocate this in any case, but only do no work if the command line + // param is off. + _cg1r = new ConcurrentG1Refine(); + + // Reserve the maximum. + PermanentGenerationSpec* pgs = collector_policy()->permanent_generation(); + // Includes the perm-gen. + ReservedSpace heap_rs(max_byte_size + pgs->max_size(), + HeapRegion::GrainBytes, + false /*ism*/); + + if (!heap_rs.is_reserved()) { + vm_exit_during_initialization("Could not reserve enough space for object heap"); + return JNI_ENOMEM; + } + + // It is important to do this in a way such that concurrent readers can't + // temporarily think somethings in the heap. (I've actually seen this + // happen in asserts: DLD.) + _reserved.set_word_size(0); + _reserved.set_start((HeapWord*)heap_rs.base()); + _reserved.set_end((HeapWord*)(heap_rs.base() + heap_rs.size())); + + _expansion_regions = max_byte_size/HeapRegion::GrainBytes; + + _num_humongous_regions = 0; + + // Create the gen rem set (and barrier set) for the entire reserved region. + _rem_set = collector_policy()->create_rem_set(_reserved, 2); + set_barrier_set(rem_set()->bs()); + if (barrier_set()->is_a(BarrierSet::ModRef)) { + _mr_bs = (ModRefBarrierSet*)_barrier_set; + } else { + vm_exit_during_initialization("G1 requires a mod ref bs."); + return JNI_ENOMEM; + } + + // Also create a G1 rem set. + if (G1UseHRIntoRS) { + if (mr_bs()->is_a(BarrierSet::CardTableModRef)) { + _g1_rem_set = new HRInto_G1RemSet(this, (CardTableModRefBS*)mr_bs()); + } else { + vm_exit_during_initialization("G1 requires a cardtable mod ref bs."); + return JNI_ENOMEM; + } + } else { + _g1_rem_set = new StupidG1RemSet(this); + } + + // Carve out the G1 part of the heap. + + ReservedSpace g1_rs = heap_rs.first_part(max_byte_size); + _g1_reserved = MemRegion((HeapWord*)g1_rs.base(), + g1_rs.size()/HeapWordSize); + ReservedSpace perm_gen_rs = heap_rs.last_part(max_byte_size); + + _perm_gen = pgs->init(perm_gen_rs, pgs->init_size(), rem_set()); + + _g1_storage.initialize(g1_rs, 0); + _g1_committed = MemRegion((HeapWord*)_g1_storage.low(), (size_t) 0); + _g1_max_committed = _g1_committed; + _hrs = new HeapRegionSeq(); + guarantee(_hrs != NULL, "Couldn't allocate HeapRegionSeq"); + guarantee(_cur_alloc_region == NULL, "from constructor"); + + _bot_shared = new G1BlockOffsetSharedArray(_reserved, + heap_word_size(init_byte_size)); + + _g1h = this; + + // Create the ConcurrentMark data structure and thread. + // (Must do this late, so that "max_regions" is defined.) + _cm = new ConcurrentMark(heap_rs, (int) max_regions()); + _cmThread = _cm->cmThread(); + + // ...and the concurrent zero-fill thread, if necessary. + if (G1ConcZeroFill) { + _czft = new ConcurrentZFThread(); + } + + + + // Allocate the popular regions; take them off free lists. + size_t pop_byte_size = G1NumPopularRegions * HeapRegion::GrainBytes; + expand(pop_byte_size); + _popular_object_boundary = + _g1_reserved.start() + (G1NumPopularRegions * HeapRegion::GrainWords); + for (int i = 0; i < G1NumPopularRegions; i++) { + HeapRegion* hr = newAllocRegion(HeapRegion::GrainWords); + // assert(hr != NULL && hr->bottom() < _popular_object_boundary, + // "Should be enough, and all should be below boundary."); + hr->set_popular(true); + } + assert(_cur_pop_hr_index == 0, "Start allocating at the first region."); + + // Initialize the from_card cache structure of HeapRegionRemSet. + HeapRegionRemSet::init_heap(max_regions()); + + // Now expand into the rest of the initial heap size. + expand(init_byte_size - pop_byte_size); + + // Perform any initialization actions delegated to the policy. + g1_policy()->init(); + + g1_policy()->note_start_of_mark_thread(); + + _refine_cte_cl = + new RefineCardTableEntryClosure(ConcurrentG1RefineThread::sts(), + g1_rem_set(), + concurrent_g1_refine()); + JavaThread::dirty_card_queue_set().set_closure(_refine_cte_cl); + + JavaThread::satb_mark_queue_set().initialize(SATB_Q_CBL_mon, + SATB_Q_FL_lock, + 0, + Shared_SATB_Q_lock); + if (G1RSBarrierUseQueue) { + JavaThread::dirty_card_queue_set().initialize(DirtyCardQ_CBL_mon, + DirtyCardQ_FL_lock, + G1DirtyCardQueueMax, + Shared_DirtyCardQ_lock); + } + // In case we're keeping closure specialization stats, initialize those + // counts and that mechanism. + SpecializationStats::clear(); + + _gc_alloc_region_list = NULL; + + // Do later initialization work for concurrent refinement. + _cg1r->init(); + + const char* group_names[] = { "CR", "ZF", "CM", "CL" }; + GCOverheadReporter::initGCOverheadReporter(4, group_names); + + return JNI_OK; +} + +void G1CollectedHeap::ref_processing_init() { + SharedHeap::ref_processing_init(); + MemRegion mr = reserved_region(); + _ref_processor = ReferenceProcessor::create_ref_processor( + mr, // span + false, // Reference discovery is not atomic + // (though it shouldn't matter here.) + true, // mt_discovery + NULL, // is alive closure: need to fill this in for efficiency + ParallelGCThreads, + ParallelRefProcEnabled, + true); // Setting next fields of discovered + // lists requires a barrier. +} + +size_t G1CollectedHeap::capacity() const { + return _g1_committed.byte_size(); +} + +void G1CollectedHeap::iterate_dirty_card_closure(bool concurrent, + int worker_i) { + DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set(); + int n_completed_buffers = 0; + while (dcqs.apply_closure_to_completed_buffer(worker_i, 0, true)) { + n_completed_buffers++; + } + g1_policy()->record_update_rs_processed_buffers(worker_i, + (double) n_completed_buffers); + dcqs.clear_n_completed_buffers(); + // Finish up the queue... + if (worker_i == 0) concurrent_g1_refine()->clean_up_cache(worker_i, + g1_rem_set()); + assert(!dcqs.completed_buffers_exist_dirty(), "Completed buffers exist!"); +} + + +// Computes the sum of the storage used by the various regions. + +size_t G1CollectedHeap::used() const { + assert(Heap_lock->owner() != NULL, + "Should be owned on this thread's behalf."); + size_t result = _summary_bytes_used; + if (_cur_alloc_region != NULL) + result += _cur_alloc_region->used(); + return result; +} + +class SumUsedClosure: public HeapRegionClosure { + size_t _used; +public: + SumUsedClosure() : _used(0) {} + bool doHeapRegion(HeapRegion* r) { + if (!r->continuesHumongous()) { + _used += r->used(); + } + return false; + } + size_t result() { return _used; } +}; + +size_t G1CollectedHeap::recalculate_used() const { + SumUsedClosure blk; + _hrs->iterate(&blk); + return blk.result(); +} + +#ifndef PRODUCT +class SumUsedRegionsClosure: public HeapRegionClosure { + size_t _num; +public: + // _num is set to 1 to account for the popular region + SumUsedRegionsClosure() : _num(G1NumPopularRegions) {} + bool doHeapRegion(HeapRegion* r) { + if (r->continuesHumongous() || r->used() > 0 || r->is_gc_alloc_region()) { + _num += 1; + } + return false; + } + size_t result() { return _num; } +}; + +size_t G1CollectedHeap::recalculate_used_regions() const { + SumUsedRegionsClosure blk; + _hrs->iterate(&blk); + return blk.result(); +} +#endif // PRODUCT + +size_t G1CollectedHeap::unsafe_max_alloc() { + if (_free_regions > 0) return HeapRegion::GrainBytes; + // otherwise, is there space in the current allocation region? + + // We need to store the current allocation region in a local variable + // here. The problem is that this method doesn't take any locks and + // there may be other threads which overwrite the current allocation + // region field. attempt_allocation(), for example, sets it to NULL + // and this can happen *after* the NULL check here but before the call + // to free(), resulting in a SIGSEGV. Note that this doesn't appear + // to be a problem in the optimized build, since the two loads of the + // current allocation region field are optimized away. + HeapRegion* car = _cur_alloc_region; + + // FIXME: should iterate over all regions? + if (car == NULL) { + return 0; + } + return car->free(); +} + +void G1CollectedHeap::collect(GCCause::Cause cause) { + // The caller doesn't have the Heap_lock + assert(!Heap_lock->owned_by_self(), "this thread should not own the Heap_lock"); + MutexLocker ml(Heap_lock); + collect_locked(cause); +} + +void G1CollectedHeap::collect_as_vm_thread(GCCause::Cause cause) { + assert(Thread::current()->is_VM_thread(), "Precondition#1"); + assert(Heap_lock->is_locked(), "Precondition#2"); + GCCauseSetter gcs(this, cause); + switch (cause) { + case GCCause::_heap_inspection: + case GCCause::_heap_dump: { + HandleMark hm; + do_full_collection(false); // don't clear all soft refs + break; + } + default: // XXX FIX ME + ShouldNotReachHere(); // Unexpected use of this function + } +} + + +void G1CollectedHeap::collect_locked(GCCause::Cause cause) { + // Don't want to do a GC until cleanup is completed. + wait_for_cleanup_complete(); + + // Read the GC count while holding the Heap_lock + int gc_count_before = SharedHeap::heap()->total_collections(); + { + MutexUnlocker mu(Heap_lock); // give up heap lock, execute gets it back + VM_G1CollectFull op(gc_count_before, cause); + VMThread::execute(&op); + } +} + +bool G1CollectedHeap::is_in(const void* p) const { + if (_g1_committed.contains(p)) { + HeapRegion* hr = _hrs->addr_to_region(p); + return hr->is_in(p); + } else { + return _perm_gen->as_gen()->is_in(p); + } +} + +// Iteration functions. + +// Iterates an OopClosure over all ref-containing fields of objects +// within a HeapRegion. + +class IterateOopClosureRegionClosure: public HeapRegionClosure { + MemRegion _mr; + OopClosure* _cl; +public: + IterateOopClosureRegionClosure(MemRegion mr, OopClosure* cl) + : _mr(mr), _cl(cl) {} + bool doHeapRegion(HeapRegion* r) { + if (! r->continuesHumongous()) { + r->oop_iterate(_cl); + } + return false; + } +}; + +void G1CollectedHeap::oop_iterate(OopClosure* cl) { + IterateOopClosureRegionClosure blk(_g1_committed, cl); + _hrs->iterate(&blk); +} + +void G1CollectedHeap::oop_iterate(MemRegion mr, OopClosure* cl) { + IterateOopClosureRegionClosure blk(mr, cl); + _hrs->iterate(&blk); +} + +// Iterates an ObjectClosure over all objects within a HeapRegion. + +class IterateObjectClosureRegionClosure: public HeapRegionClosure { + ObjectClosure* _cl; +public: + IterateObjectClosureRegionClosure(ObjectClosure* cl) : _cl(cl) {} + bool doHeapRegion(HeapRegion* r) { + if (! r->continuesHumongous()) { + r->object_iterate(_cl); + } + return false; + } +}; + +void G1CollectedHeap::object_iterate(ObjectClosure* cl) { + IterateObjectClosureRegionClosure blk(cl); + _hrs->iterate(&blk); +} + +void G1CollectedHeap::object_iterate_since_last_GC(ObjectClosure* cl) { + // FIXME: is this right? + guarantee(false, "object_iterate_since_last_GC not supported by G1 heap"); +} + +// Calls a SpaceClosure on a HeapRegion. + +class SpaceClosureRegionClosure: public HeapRegionClosure { + SpaceClosure* _cl; +public: + SpaceClosureRegionClosure(SpaceClosure* cl) : _cl(cl) {} + bool doHeapRegion(HeapRegion* r) { + _cl->do_space(r); + return false; + } +}; + +void G1CollectedHeap::space_iterate(SpaceClosure* cl) { + SpaceClosureRegionClosure blk(cl); + _hrs->iterate(&blk); +} + +void G1CollectedHeap::heap_region_iterate(HeapRegionClosure* cl) { + _hrs->iterate(cl); +} + +void G1CollectedHeap::heap_region_iterate_from(HeapRegion* r, + HeapRegionClosure* cl) { + _hrs->iterate_from(r, cl); +} + +void +G1CollectedHeap::heap_region_iterate_from(int idx, HeapRegionClosure* cl) { + _hrs->iterate_from(idx, cl); +} + +HeapRegion* G1CollectedHeap::region_at(size_t idx) { return _hrs->at(idx); } + +const int OverpartitionFactor = 4; +void +G1CollectedHeap::heap_region_par_iterate_chunked(HeapRegionClosure* cl, + int worker, + jint claim_value) { + // We break up the heap regions into blocks of size ParallelGCThreads (to + // decrease iteration costs). + const size_t nregions = n_regions(); + const size_t n_thrds = (ParallelGCThreads > 0 ? ParallelGCThreads : 1); + const size_t partitions = n_thrds * OverpartitionFactor; + const size_t BlkSize = MAX2(nregions/partitions, (size_t)1); + const size_t n_blocks = (nregions + BlkSize - 1)/BlkSize; + assert(ParallelGCThreads > 0 || worker == 0, "Precondition"); + const int init_idx = (int) (n_blocks/n_thrds * worker); + for (size_t blk = 0; blk < n_blocks; blk++) { + size_t idx = init_idx + blk; + if (idx >= n_blocks) idx = idx - n_blocks; + size_t reg_idx = idx * BlkSize; + assert(reg_idx < nregions, "Because we rounded blk up."); + HeapRegion* r = region_at(reg_idx); + if (r->claimHeapRegion(claim_value)) { + for (size_t j = 0; j < BlkSize; j++) { + size_t reg_idx2 = reg_idx + j; + if (reg_idx2 == nregions) break; + HeapRegion* r2 = region_at(reg_idx2); + if (j > 0) r2->set_claim_value(claim_value); + bool res = cl->doHeapRegion(r2); + guarantee(!res, "Should not abort."); + } + } + } +} + +void G1CollectedHeap::collection_set_iterate(HeapRegionClosure* cl) { + HeapRegion* r = g1_policy()->collection_set(); + while (r != NULL) { + HeapRegion* next = r->next_in_collection_set(); + if (cl->doHeapRegion(r)) { + cl->incomplete(); + return; + } + r = next; + } +} + +void G1CollectedHeap::collection_set_iterate_from(HeapRegion* r, + HeapRegionClosure *cl) { + assert(r->in_collection_set(), + "Start region must be a member of the collection set."); + HeapRegion* cur = r; + while (cur != NULL) { + HeapRegion* next = cur->next_in_collection_set(); + if (cl->doHeapRegion(cur) && false) { + cl->incomplete(); + return; + } + cur = next; + } + cur = g1_policy()->collection_set(); + while (cur != r) { + HeapRegion* next = cur->next_in_collection_set(); + if (cl->doHeapRegion(cur) && false) { + cl->incomplete(); + return; + } + cur = next; + } +} + +CompactibleSpace* G1CollectedHeap::first_compactible_space() { + return _hrs->length() > 0 ? _hrs->at(0) : NULL; +} + + +Space* G1CollectedHeap::space_containing(const void* addr) const { + Space* res = heap_region_containing(addr); + if (res == NULL) + res = perm_gen()->space_containing(addr); + return res; +} + +HeapWord* G1CollectedHeap::block_start(const void* addr) const { + Space* sp = space_containing(addr); + if (sp != NULL) { + return sp->block_start(addr); + } + return NULL; +} + +size_t G1CollectedHeap::block_size(const HeapWord* addr) const { + Space* sp = space_containing(addr); + assert(sp != NULL, "block_size of address outside of heap"); + return sp->block_size(addr); +} + +bool G1CollectedHeap::block_is_obj(const HeapWord* addr) const { + Space* sp = space_containing(addr); + return sp->block_is_obj(addr); +} + +bool G1CollectedHeap::supports_tlab_allocation() const { + return true; +} + +size_t G1CollectedHeap::tlab_capacity(Thread* ignored) const { + return HeapRegion::GrainBytes; +} + +size_t G1CollectedHeap::unsafe_max_tlab_alloc(Thread* ignored) const { + // Return the remaining space in the cur alloc region, but not less than + // the min TLAB size. + // Also, no more than half the region size, since we can't allow tlabs to + // grow big enough to accomodate humongous objects. + + // We need to story it locally, since it might change between when we + // test for NULL and when we use it later. + ContiguousSpace* cur_alloc_space = _cur_alloc_region; + if (cur_alloc_space == NULL) { + return HeapRegion::GrainBytes/2; + } else { + return MAX2(MIN2(cur_alloc_space->free(), + (size_t)(HeapRegion::GrainBytes/2)), + (size_t)MinTLABSize); + } +} + +HeapWord* G1CollectedHeap::allocate_new_tlab(size_t size) { + bool dummy; + return G1CollectedHeap::mem_allocate(size, false, true, &dummy); +} + +bool G1CollectedHeap::allocs_are_zero_filled() { + return false; +} + +size_t G1CollectedHeap::large_typearray_limit() { + // FIXME + return HeapRegion::GrainBytes/HeapWordSize; +} + +size_t G1CollectedHeap::max_capacity() const { + return _g1_committed.byte_size(); +} + +jlong G1CollectedHeap::millis_since_last_gc() { + // assert(false, "NYI"); + return 0; +} + + +void G1CollectedHeap::prepare_for_verify() { + if (SafepointSynchronize::is_at_safepoint() || ! UseTLAB) { + ensure_parsability(false); + } + g1_rem_set()->prepare_for_verify(); +} + +class VerifyLivenessOopClosure: public OopClosure { + G1CollectedHeap* g1h; +public: + VerifyLivenessOopClosure(G1CollectedHeap* _g1h) { + g1h = _g1h; + } + void do_oop(narrowOop *p) { + guarantee(false, "NYI"); + } + void do_oop(oop *p) { + oop obj = *p; + assert(obj == NULL || !g1h->is_obj_dead(obj), + "Dead object referenced by a not dead object"); + } +}; + +class VerifyObjsInRegionClosure: public ObjectClosure { + G1CollectedHeap* _g1h; + size_t _live_bytes; + HeapRegion *_hr; +public: + VerifyObjsInRegionClosure(HeapRegion *hr) : _live_bytes(0), _hr(hr) { + _g1h = G1CollectedHeap::heap(); + } + void do_object(oop o) { + VerifyLivenessOopClosure isLive(_g1h); + assert(o != NULL, "Huh?"); + if (!_g1h->is_obj_dead(o)) { + o->oop_iterate(&isLive); + if (!_hr->obj_allocated_since_prev_marking(o)) + _live_bytes += (o->size() * HeapWordSize); + } + } + size_t live_bytes() { return _live_bytes; } +}; + +class PrintObjsInRegionClosure : public ObjectClosure { + HeapRegion *_hr; + G1CollectedHeap *_g1; +public: + PrintObjsInRegionClosure(HeapRegion *hr) : _hr(hr) { + _g1 = G1CollectedHeap::heap(); + }; + + void do_object(oop o) { + if (o != NULL) { + HeapWord *start = (HeapWord *) o; + size_t word_sz = o->size(); + gclog_or_tty->print("\nPrinting obj "PTR_FORMAT" of size " SIZE_FORMAT + " isMarkedPrev %d isMarkedNext %d isAllocSince %d\n", + (void*) o, word_sz, + _g1->isMarkedPrev(o), + _g1->isMarkedNext(o), + _hr->obj_allocated_since_prev_marking(o)); + HeapWord *end = start + word_sz; + HeapWord *cur; + int *val; + for (cur = start; cur < end; cur++) { + val = (int *) cur; + gclog_or_tty->print("\t "PTR_FORMAT":"PTR_FORMAT"\n", val, *val); + } + } + } +}; + +class VerifyRegionClosure: public HeapRegionClosure { +public: + bool _allow_dirty; + VerifyRegionClosure(bool allow_dirty) + : _allow_dirty(allow_dirty) {} + bool doHeapRegion(HeapRegion* r) { + guarantee(r->claim_value() == 0, "Should be unclaimed at verify points."); + if (r->isHumongous()) { + if (r->startsHumongous()) { + // Verify the single H object. + oop(r->bottom())->verify(); + size_t word_sz = oop(r->bottom())->size(); + guarantee(r->top() == r->bottom() + word_sz, + "Only one object in a humongous region"); + } + } else { + VerifyObjsInRegionClosure not_dead_yet_cl(r); + r->verify(_allow_dirty); + r->object_iterate(¬_dead_yet_cl); + guarantee(r->max_live_bytes() >= not_dead_yet_cl.live_bytes(), + "More live objects than counted in last complete marking."); + } + return false; + } +}; + +class VerifyRootsClosure: public OopsInGenClosure { +private: + G1CollectedHeap* _g1h; + bool _failures; + +public: + VerifyRootsClosure() : + _g1h(G1CollectedHeap::heap()), _failures(false) { } + + bool failures() { return _failures; } + + void do_oop(narrowOop* p) { + guarantee(false, "NYI"); + } + + void do_oop(oop* p) { + oop obj = *p; + if (obj != NULL) { + if (_g1h->is_obj_dead(obj)) { + gclog_or_tty->print_cr("Root location "PTR_FORMAT" " + "points to dead obj "PTR_FORMAT, p, (void*) obj); + obj->print_on(gclog_or_tty); + _failures = true; + } + } + } +}; + +void G1CollectedHeap::verify(bool allow_dirty, bool silent) { + if (SafepointSynchronize::is_at_safepoint() || ! UseTLAB) { + if (!silent) { gclog_or_tty->print("roots "); } + VerifyRootsClosure rootsCl; + process_strong_roots(false, + SharedHeap::SO_AllClasses, + &rootsCl, + &rootsCl); + rem_set()->invalidate(perm_gen()->used_region(), false); + if (!silent) { gclog_or_tty->print("heapRegions "); } + VerifyRegionClosure blk(allow_dirty); + _hrs->iterate(&blk); + if (!silent) gclog_or_tty->print("remset "); + rem_set()->verify(); + guarantee(!rootsCl.failures(), "should not have had failures"); + } else { + if (!silent) gclog_or_tty->print("(SKIPPING roots, heapRegions, remset) "); + } +} + +class PrintRegionClosure: public HeapRegionClosure { + outputStream* _st; +public: + PrintRegionClosure(outputStream* st) : _st(st) {} + bool doHeapRegion(HeapRegion* r) { + r->print_on(_st); + return false; + } +}; + +void G1CollectedHeap::print() const { print_on(gclog_or_tty); } + +void G1CollectedHeap::print_on(outputStream* st) const { + PrintRegionClosure blk(st); + _hrs->iterate(&blk); +} + +void G1CollectedHeap::print_gc_threads_on(outputStream* st) const { + if (ParallelGCThreads > 0) { + workers()->print_worker_threads(); + } + st->print("\"G1 concurrent mark GC Thread\" "); + _cmThread->print(); + st->cr(); + st->print("\"G1 concurrent refinement GC Thread\" "); + _cg1r->cg1rThread()->print_on(st); + st->cr(); + st->print("\"G1 zero-fill GC Thread\" "); + _czft->print_on(st); + st->cr(); +} + +void G1CollectedHeap::gc_threads_do(ThreadClosure* tc) const { + if (ParallelGCThreads > 0) { + workers()->threads_do(tc); + } + tc->do_thread(_cmThread); + tc->do_thread(_cg1r->cg1rThread()); + tc->do_thread(_czft); +} + +void G1CollectedHeap::print_tracing_info() const { + concurrent_g1_refine()->print_final_card_counts(); + + // We'll overload this to mean "trace GC pause statistics." + if (TraceGen0Time || TraceGen1Time) { + // The "G1CollectorPolicy" is keeping track of these stats, so delegate + // to that. + g1_policy()->print_tracing_info(); + } + if (SummarizeG1RSStats) { + g1_rem_set()->print_summary_info(); + } + if (SummarizeG1ConcMark) { + concurrent_mark()->print_summary_info(); + } + if (SummarizeG1ZFStats) { + ConcurrentZFThread::print_summary_info(); + } + if (G1SummarizePopularity) { + print_popularity_summary_info(); + } + g1_policy()->print_yg_surv_rate_info(); + + GCOverheadReporter::printGCOverhead(); + + SpecializationStats::print(); +} + + +int G1CollectedHeap::addr_to_arena_id(void* addr) const { + HeapRegion* hr = heap_region_containing(addr); + if (hr == NULL) { + return 0; + } else { + return 1; + } +} + +G1CollectedHeap* G1CollectedHeap::heap() { + assert(_sh->kind() == CollectedHeap::G1CollectedHeap, + "not a garbage-first heap"); + return _g1h; +} + +void G1CollectedHeap::gc_prologue(bool full /* Ignored */) { + if (PrintHeapAtGC){ + gclog_or_tty->print_cr(" {Heap before GC collections=%d:", total_collections()); + Universe::print(); + } + assert(InlineCacheBuffer::is_empty(), "should have cleaned up ICBuffer"); + // Call allocation profiler + AllocationProfiler::iterate_since_last_gc(); + // Fill TLAB's and such + ensure_parsability(true); +} + +void G1CollectedHeap::gc_epilogue(bool full /* Ignored */) { + // FIXME: what is this about? + // I'm ignoring the "fill_newgen()" call if "alloc_event_enabled" + // is set. + COMPILER2_PRESENT(assert(DerivedPointerTable::is_empty(), + "derived pointer present")); + + if (PrintHeapAtGC){ + gclog_or_tty->print_cr(" Heap after GC collections=%d:", total_collections()); + Universe::print(); + gclog_or_tty->print("} "); + } +} + +void G1CollectedHeap::do_collection_pause() { + // Read the GC count while holding the Heap_lock + // we need to do this _before_ wait_for_cleanup_complete(), to + // ensure that we do not give up the heap lock and potentially + // pick up the wrong count + int gc_count_before = SharedHeap::heap()->total_collections(); + + // Don't want to do a GC pause while cleanup is being completed! + wait_for_cleanup_complete(); + + g1_policy()->record_stop_world_start(); + { + MutexUnlocker mu(Heap_lock); // give up heap lock, execute gets it back + VM_G1IncCollectionPause op(gc_count_before); + VMThread::execute(&op); + } +} + +void +G1CollectedHeap::doConcurrentMark() { + if (G1ConcMark) { + MutexLockerEx x(CGC_lock, Mutex::_no_safepoint_check_flag); + if (!_cmThread->in_progress()) { + _cmThread->set_started(); + CGC_lock->notify(); + } + } +} + +class VerifyMarkedObjsClosure: public ObjectClosure { + G1CollectedHeap* _g1h; + public: + VerifyMarkedObjsClosure(G1CollectedHeap* g1h) : _g1h(g1h) {} + void do_object(oop obj) { + assert(obj->mark()->is_marked() ? !_g1h->is_obj_dead(obj) : true, + "markandsweep mark should agree with concurrent deadness"); + } +}; + +void +G1CollectedHeap::checkConcurrentMark() { + VerifyMarkedObjsClosure verifycl(this); + doConcurrentMark(); + // MutexLockerEx x(getMarkBitMapLock(), + // Mutex::_no_safepoint_check_flag); + object_iterate(&verifycl); +} + +void G1CollectedHeap::do_sync_mark() { + _cm->checkpointRootsInitial(); + _cm->markFromRoots(); + _cm->checkpointRootsFinal(false); +} + +// + +double G1CollectedHeap::predict_region_elapsed_time_ms(HeapRegion *hr, + bool young) { + return _g1_policy->predict_region_elapsed_time_ms(hr, young); +} + +void G1CollectedHeap::check_if_region_is_too_expensive(double + predicted_time_ms) { + _g1_policy->check_if_region_is_too_expensive(predicted_time_ms); +} + +size_t G1CollectedHeap::pending_card_num() { + size_t extra_cards = 0; + JavaThread *curr = Threads::first(); + while (curr != NULL) { + DirtyCardQueue& dcq = curr->dirty_card_queue(); + extra_cards += dcq.size(); + curr = curr->next(); + } + DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set(); + size_t buffer_size = dcqs.buffer_size(); + size_t buffer_num = dcqs.completed_buffers_num(); + return buffer_size * buffer_num + extra_cards; +} + +size_t G1CollectedHeap::max_pending_card_num() { + DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set(); + size_t buffer_size = dcqs.buffer_size(); + size_t buffer_num = dcqs.completed_buffers_num(); + int thread_num = Threads::number_of_threads(); + return (buffer_num + thread_num) * buffer_size; +} + +size_t G1CollectedHeap::cards_scanned() { + HRInto_G1RemSet* g1_rset = (HRInto_G1RemSet*) g1_rem_set(); + return g1_rset->cardsScanned(); +} + +void +G1CollectedHeap::setup_surviving_young_words() { + guarantee( _surviving_young_words == NULL, "pre-condition" ); + size_t array_length = g1_policy()->young_cset_length(); + _surviving_young_words = NEW_C_HEAP_ARRAY(size_t, array_length); + if (_surviving_young_words == NULL) { + vm_exit_out_of_memory(sizeof(size_t) * array_length, + "Not enough space for young surv words summary."); + } + memset(_surviving_young_words, 0, array_length * sizeof(size_t)); + for (size_t i = 0; i < array_length; ++i) { + guarantee( _surviving_young_words[i] == 0, "invariant" ); + } +} + +void +G1CollectedHeap::update_surviving_young_words(size_t* surv_young_words) { + MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag); + size_t array_length = g1_policy()->young_cset_length(); + for (size_t i = 0; i < array_length; ++i) + _surviving_young_words[i] += surv_young_words[i]; +} + +void +G1CollectedHeap::cleanup_surviving_young_words() { + guarantee( _surviving_young_words != NULL, "pre-condition" ); + FREE_C_HEAP_ARRAY(size_t, _surviving_young_words); + _surviving_young_words = NULL; +} + +// + +void +G1CollectedHeap::do_collection_pause_at_safepoint(HeapRegion* popular_region) { + char verbose_str[128]; + sprintf(verbose_str, "GC pause "); + if (popular_region != NULL) + strcat(verbose_str, "(popular)"); + else if (g1_policy()->in_young_gc_mode()) { + if (g1_policy()->full_young_gcs()) + strcat(verbose_str, "(young)"); + else + strcat(verbose_str, "(partial)"); + } + bool reset_should_initiate_conc_mark = false; + if (popular_region != NULL && g1_policy()->should_initiate_conc_mark()) { + // we currently do not allow an initial mark phase to be piggy-backed + // on a popular pause + reset_should_initiate_conc_mark = true; + g1_policy()->unset_should_initiate_conc_mark(); + } + if (g1_policy()->should_initiate_conc_mark()) + strcat(verbose_str, " (initial-mark)"); + + GCCauseSetter x(this, (popular_region == NULL ? + GCCause::_g1_inc_collection_pause : + GCCause::_g1_pop_region_collection_pause)); + + // if PrintGCDetails is on, we'll print long statistics information + // in the collector policy code, so let's not print this as the output + // is messy if we do. + gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps); + TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty); + TraceTime t(verbose_str, PrintGC && !PrintGCDetails, true, gclog_or_tty); + + ResourceMark rm; + assert(SafepointSynchronize::is_at_safepoint(), "should be at safepoint"); + assert(Thread::current() == VMThread::vm_thread(), "should be in vm thread"); + guarantee(!is_gc_active(), "collection is not reentrant"); + assert(regions_accounted_for(), "Region leakage!"); + ++_gc_time_stamp; + + if (g1_policy()->in_young_gc_mode()) { + assert(check_young_list_well_formed(), + "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; + + gc_prologue(false); + increment_total_collections(); + +#if G1_REM_SET_LOGGING + gclog_or_tty->print_cr("\nJust chose CS, heap:"); + print(); +#endif + + if (VerifyBeforeGC && total_collections() >= VerifyGCStartAt) { + HandleMark hm; // Discard invalid handles created during verification + prepare_for_verify(); + gclog_or_tty->print(" VerifyBeforeGC:"); + Universe::verify(false); + } + + COMPILER2_PRESENT(DerivedPointerTable::clear()); + + // We want to turn off ref discovere, if necessary, and turn it back on + // on again later if we do. + bool was_enabled = ref_processor()->discovery_enabled(); + if (was_enabled) ref_processor()->disable_discovery(); + + // Forget the current alloc region (we might even choose it to be part + // of the collection set!). + abandon_cur_alloc_region(); + + // The elapsed time induced by the start time below deliberately elides + // the possible verification above. + double start_time_sec = os::elapsedTime(); + GCOverheadReporter::recordSTWStart(start_time_sec); + size_t start_used_bytes = used(); + if (!G1ConcMark) { + do_sync_mark(); + } + + g1_policy()->record_collection_pause_start(start_time_sec, + start_used_bytes); + +#if SCAN_ONLY_VERBOSE + _young_list->print(); +#endif // SCAN_ONLY_VERBOSE + + if (g1_policy()->should_initiate_conc_mark()) { + concurrent_mark()->checkpointRootsInitialPre(); + } + save_marks(); + + // We must do this before any possible evacuation that should propogate + // marks, including evacuation of popular objects in a popular pause. + if (mark_in_progress()) { + double start_time_sec = os::elapsedTime(); + + _cm->drainAllSATBBuffers(); + double finish_mark_ms = (os::elapsedTime() - start_time_sec) * 1000.0; + g1_policy()->record_satb_drain_time(finish_mark_ms); + + } + // Record the number of elements currently on the mark stack, so we + // only iterate over these. (Since evacuation may add to the mark + // stack, doing more exposes race conditions.) If no mark is in + // progress, this will be zero. + _cm->set_oops_do_bound(); + + assert(regions_accounted_for(), "Region leakage."); + + bool abandoned = false; + + if (mark_in_progress()) + concurrent_mark()->newCSet(); + + // Now choose the CS. + if (popular_region == NULL) { + g1_policy()->choose_collection_set(); + } else { + // We may be evacuating a single region (for popularity). + g1_policy()->record_popular_pause_preamble_start(); + popularity_pause_preamble(popular_region); + g1_policy()->record_popular_pause_preamble_end(); + abandoned = (g1_policy()->collection_set() == NULL); + // Now we allow more regions to be added (we have to collect + // all popular regions). + if (!abandoned) { + g1_policy()->choose_collection_set(popular_region); + } + } + // We may abandon a pause if we find no region that will fit in the MMU + // pause. + abandoned = (g1_policy()->collection_set() == NULL); + + // Nothing to do if we were unable to choose a collection set. + if (!abandoned) { +#if G1_REM_SET_LOGGING + gclog_or_tty->print_cr("\nAfter pause, heap:"); + print(); +#endif + + setup_surviving_young_words(); + + // Set up the gc allocation regions. + get_gc_alloc_regions(); + + // Actually do the work... + evacuate_collection_set(); + free_collection_set(g1_policy()->collection_set()); + g1_policy()->clear_collection_set(); + + if (popular_region != NULL) { + // We have to wait until now, because we don't want the region to + // be rescheduled for pop-evac during RS update. + popular_region->set_popular_pending(false); + } + + release_gc_alloc_regions(); + + cleanup_surviving_young_words(); + + if (g1_policy()->in_young_gc_mode()) { + _young_list->reset_sampled_info(); + assert(check_young_list_empty(true), + "young list should be empty"); + +#if SCAN_ONLY_VERBOSE + _young_list->print(); +#endif // SCAN_ONLY_VERBOSE + + _young_list->reset_auxilary_lists(); + } + } else { + COMPILER2_PRESENT(DerivedPointerTable::update_pointers()); + } + + if (evacuation_failed()) { + _summary_bytes_used = recalculate_used(); + } else { + // The "used" of the the collection set have already been subtracted + // when they were freed. Add in the bytes evacuated. + _summary_bytes_used += g1_policy()->bytes_in_to_space(); + } + + if (g1_policy()->in_young_gc_mode() && + g1_policy()->should_initiate_conc_mark()) { + concurrent_mark()->checkpointRootsInitialPost(); + set_marking_started(); + doConcurrentMark(); + } + +#if SCAN_ONLY_VERBOSE + _young_list->print(); +#endif // SCAN_ONLY_VERBOSE + + double end_time_sec = os::elapsedTime(); + g1_policy()->record_pause_time((end_time_sec - start_time_sec)*1000.0); + GCOverheadReporter::recordSTWEnd(end_time_sec); + g1_policy()->record_collection_pause_end(popular_region != NULL, + abandoned); + + assert(regions_accounted_for(), "Region leakage."); + + if (VerifyAfterGC && total_collections() >= VerifyGCStartAt) { + HandleMark hm; // Discard invalid handles created during verification + gclog_or_tty->print(" VerifyAfterGC:"); + Universe::verify(false); + } + + if (was_enabled) ref_processor()->enable_discovery(); + + { + size_t expand_bytes = g1_policy()->expansion_amount(); + if (expand_bytes > 0) { + size_t bytes_before = capacity(); + expand(expand_bytes); + } + } + + if (mark_in_progress()) + concurrent_mark()->update_g1_committed(); + + gc_epilogue(false); + } + + assert(verify_region_lists(), "Bad region lists."); + + if (reset_should_initiate_conc_mark) + g1_policy()->set_should_initiate_conc_mark(); + + if (ExitAfterGCNum > 0 && total_collections() == ExitAfterGCNum) { + gclog_or_tty->print_cr("Stopping after GC #%d", ExitAfterGCNum); + print_tracing_info(); + vm_exit(-1); + } +} + +void G1CollectedHeap::set_gc_alloc_region(int purpose, HeapRegion* r) { + assert(purpose >= 0 && purpose < GCAllocPurposeCount, "invalid purpose"); + HeapWord* original_top = NULL; + if (r != NULL) + original_top = r->top(); + + // We will want to record the used space in r as being there before gc. + // One we install it as a GC alloc region it's eligible for allocation. + // So record it now and use it later. + size_t r_used = 0; + if (r != NULL) { + r_used = r->used(); + + if (ParallelGCThreads > 0) { + // need to take the lock to guard against two threads calling + // get_gc_alloc_region concurrently (very unlikely but...) + MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag); + r->save_marks(); + } + } + HeapRegion* old_alloc_region = _gc_alloc_regions[purpose]; + _gc_alloc_regions[purpose] = r; + if (old_alloc_region != NULL) { + // Replace aliases too. + for (int ap = 0; ap < GCAllocPurposeCount; ++ap) { + if (_gc_alloc_regions[ap] == old_alloc_region) { + _gc_alloc_regions[ap] = r; + } + } + } + if (r != NULL) { + push_gc_alloc_region(r); + if (mark_in_progress() && original_top != r->next_top_at_mark_start()) { + // We are using a region as a GC alloc region after it has been used + // as a mutator allocation region during the current marking cycle. + // The mutator-allocated objects are currently implicitly marked, but + // when we move hr->next_top_at_mark_start() forward at the the end + // of the GC pause, they won't be. We therefore mark all objects in + // the "gap". We do this object-by-object, since marking densely + // does not currently work right with marking bitmap iteration. This + // means we rely on TLAB filling at the start of pauses, and no + // "resuscitation" of filled TLAB's. If we want to do this, we need + // to fix the marking bitmap iteration. + HeapWord* curhw = r->next_top_at_mark_start(); + HeapWord* t = original_top; + + while (curhw < t) { + oop cur = (oop)curhw; + // We'll assume parallel for generality. This is rare code. + concurrent_mark()->markAndGrayObjectIfNecessary(cur); // can't we just mark them? + curhw = curhw + cur->size(); + } + assert(curhw == t, "Should have parsed correctly."); + } + if (G1PolicyVerbose > 1) { + gclog_or_tty->print("New alloc region ["PTR_FORMAT", "PTR_FORMAT", " PTR_FORMAT") " + "for survivors:", r->bottom(), original_top, r->end()); + r->print(); + } + g1_policy()->record_before_bytes(r_used); + } +} + +void G1CollectedHeap::push_gc_alloc_region(HeapRegion* hr) { + assert(Thread::current()->is_VM_thread() || + par_alloc_during_gc_lock()->owned_by_self(), "Precondition"); + assert(!hr->is_gc_alloc_region() && !hr->in_collection_set(), + "Precondition."); + hr->set_is_gc_alloc_region(true); + hr->set_next_gc_alloc_region(_gc_alloc_region_list); + _gc_alloc_region_list = hr; +} + +#ifdef G1_DEBUG +class FindGCAllocRegion: public HeapRegionClosure { +public: + bool doHeapRegion(HeapRegion* r) { + if (r->is_gc_alloc_region()) { + gclog_or_tty->print_cr("Region %d ["PTR_FORMAT"...] is still a gc_alloc_region.", + r->hrs_index(), r->bottom()); + } + return false; + } +}; +#endif // G1_DEBUG + +void G1CollectedHeap::forget_alloc_region_list() { + assert(Thread::current()->is_VM_thread(), "Precondition"); + while (_gc_alloc_region_list != NULL) { + HeapRegion* r = _gc_alloc_region_list; + assert(r->is_gc_alloc_region(), "Invariant."); + _gc_alloc_region_list = r->next_gc_alloc_region(); + r->set_next_gc_alloc_region(NULL); + r->set_is_gc_alloc_region(false); + if (r->is_empty()) { + ++_free_regions; + } + } +#ifdef G1_DEBUG + FindGCAllocRegion fa; + heap_region_iterate(&fa); +#endif // G1_DEBUG +} + + +bool G1CollectedHeap::check_gc_alloc_regions() { + // TODO: allocation regions check + return true; +} + +void G1CollectedHeap::get_gc_alloc_regions() { + for (int ap = 0; ap < GCAllocPurposeCount; ++ap) { + // Create new GC alloc regions. + HeapRegion* alloc_region = _gc_alloc_regions[ap]; + // Clear this alloc region, so that in case it turns out to be + // unacceptable, we end up with no allocation region, rather than a bad + // one. + _gc_alloc_regions[ap] = NULL; + if (alloc_region == NULL || alloc_region->in_collection_set()) { + // Can't re-use old one. Allocate a new one. + alloc_region = newAllocRegionWithExpansion(ap, 0); + } + if (alloc_region != NULL) { + set_gc_alloc_region(ap, alloc_region); + } + } + // Set alternative regions for allocation purposes that have reached + // thier limit. + for (int ap = 0; ap < GCAllocPurposeCount; ++ap) { + GCAllocPurpose alt_purpose = g1_policy()->alternative_purpose(ap); + if (_gc_alloc_regions[ap] == NULL && alt_purpose != ap) { + _gc_alloc_regions[ap] = _gc_alloc_regions[alt_purpose]; + } + } + assert(check_gc_alloc_regions(), "alloc regions messed up"); +} + +void G1CollectedHeap::release_gc_alloc_regions() { + // We keep a separate list of all regions that have been alloc regions in + // the current collection pause. Forget that now. + forget_alloc_region_list(); + + // The current alloc regions contain objs that have survived + // collection. Make them no longer GC alloc regions. + for (int ap = 0; ap < GCAllocPurposeCount; ++ap) { + HeapRegion* r = _gc_alloc_regions[ap]; + if (r != NULL && r->is_empty()) { + { + MutexLockerEx x(ZF_mon, Mutex::_no_safepoint_check_flag); + r->set_zero_fill_complete(); + put_free_region_on_list_locked(r); + } + } + // set_gc_alloc_region will also NULLify all aliases to the region + set_gc_alloc_region(ap, NULL); + _gc_alloc_region_counts[ap] = 0; + } +} + +void G1CollectedHeap::init_for_evac_failure(OopsInHeapRegionClosure* cl) { + _drain_in_progress = false; + set_evac_failure_closure(cl); + _evac_failure_scan_stack = new (ResourceObj::C_HEAP) GrowableArray(40, true); +} + +void G1CollectedHeap::finalize_for_evac_failure() { + assert(_evac_failure_scan_stack != NULL && + _evac_failure_scan_stack->length() == 0, + "Postcondition"); + assert(!_drain_in_progress, "Postcondition"); + // Don't have to delete, since the scan stack is a resource object. + _evac_failure_scan_stack = NULL; +} + + + +// *** Sequential G1 Evacuation + +HeapWord* G1CollectedHeap::allocate_during_gc(GCAllocPurpose purpose, size_t word_size) { + HeapRegion* alloc_region = _gc_alloc_regions[purpose]; + // let the caller handle alloc failure + if (alloc_region == NULL) return NULL; + assert(isHumongous(word_size) || !alloc_region->isHumongous(), + "Either the object is humongous or the region isn't"); + HeapWord* block = alloc_region->allocate(word_size); + if (block == NULL) { + block = allocate_during_gc_slow(purpose, alloc_region, false, word_size); + } + return block; +} + +class G1IsAliveClosure: public BoolObjectClosure { + G1CollectedHeap* _g1; +public: + G1IsAliveClosure(G1CollectedHeap* g1) : _g1(g1) {} + void do_object(oop p) { assert(false, "Do not call."); } + bool do_object_b(oop p) { + // It is reachable if it is outside the collection set, or is inside + // and forwarded. + +#ifdef G1_DEBUG + gclog_or_tty->print_cr("is alive "PTR_FORMAT" in CS %d forwarded %d overall %d", + (void*) p, _g1->obj_in_cs(p), p->is_forwarded(), + !_g1->obj_in_cs(p) || p->is_forwarded()); +#endif // G1_DEBUG + + return !_g1->obj_in_cs(p) || p->is_forwarded(); + } +}; + +class G1KeepAliveClosure: public OopClosure { + G1CollectedHeap* _g1; +public: + G1KeepAliveClosure(G1CollectedHeap* g1) : _g1(g1) {} + void do_oop(narrowOop* p) { + guarantee(false, "NYI"); + } + void do_oop(oop* p) { + oop obj = *p; +#ifdef G1_DEBUG + if (PrintGC && Verbose) { + gclog_or_tty->print_cr("keep alive *"PTR_FORMAT" = "PTR_FORMAT" "PTR_FORMAT, + p, (void*) obj, (void*) *p); + } +#endif // G1_DEBUG + + if (_g1->obj_in_cs(obj)) { + assert( obj->is_forwarded(), "invariant" ); + *p = obj->forwardee(); + +#ifdef G1_DEBUG + gclog_or_tty->print_cr(" in CSet: moved "PTR_FORMAT" -> "PTR_FORMAT, + (void*) obj, (void*) *p); +#endif // G1_DEBUG + } + } +}; + +class RecreateRSetEntriesClosure: public OopClosure { +private: + G1CollectedHeap* _g1; + G1RemSet* _g1_rem_set; + HeapRegion* _from; +public: + RecreateRSetEntriesClosure(G1CollectedHeap* g1, HeapRegion* from) : + _g1(g1), _g1_rem_set(g1->g1_rem_set()), _from(from) + {} + + void do_oop(narrowOop* p) { + guarantee(false, "NYI"); + } + void do_oop(oop* p) { + assert(_from->is_in_reserved(p), "paranoia"); + if (*p != NULL) { + _g1_rem_set->write_ref(_from, p); + } + } +}; + +class RemoveSelfPointerClosure: public ObjectClosure { +private: + G1CollectedHeap* _g1; + ConcurrentMark* _cm; + HeapRegion* _hr; + HeapWord* _last_self_forwarded_end; + size_t _prev_marked_bytes; + size_t _next_marked_bytes; +public: + RemoveSelfPointerClosure(G1CollectedHeap* g1, HeapRegion* hr) : + _g1(g1), _cm(_g1->concurrent_mark()), _hr(hr), + _last_self_forwarded_end(_hr->bottom()), + _prev_marked_bytes(0), _next_marked_bytes(0) + {} + + size_t prev_marked_bytes() { return _prev_marked_bytes; } + size_t next_marked_bytes() { return _next_marked_bytes; } + + void fill_remainder() { + HeapWord* limit = _hr->top(); + MemRegion mr(_last_self_forwarded_end, limit); + if (!mr.is_empty()) { + SharedHeap::fill_region_with_object(mr); + _cm->clearRangeBothMaps(mr); + _hr->declare_filled_region_to_BOT(mr); + } + } + + void do_object(oop obj) { + if (obj->is_forwarded()) { + if (obj->forwardee() == obj) { + assert(!_g1->is_obj_dead(obj), "We should not be preserving dead objs."); + _cm->markPrev(obj); + assert(_cm->isPrevMarked(obj), "Should be marked!"); + _prev_marked_bytes += (obj->size() * HeapWordSize); + if (_g1->mark_in_progress() && !_g1->is_obj_ill(obj)) { + _cm->markAndGrayObjectIfNecessary(obj); + } + HeapWord* obj_start = (HeapWord*)obj; + if (obj_start > _last_self_forwarded_end) { + MemRegion mr(_last_self_forwarded_end, obj_start); + SharedHeap::fill_region_with_object(mr); + assert(_cm->isPrevMarked(obj), "Should be marked!"); + _cm->clearRangeBothMaps(mr); + assert(_cm->isPrevMarked(obj), "Should be marked!"); + _hr->declare_filled_region_to_BOT(mr); + } + _last_self_forwarded_end = obj_start + obj->size(); + obj->set_mark(markOopDesc::prototype()); + + // While we were processing RSet buffers during the + // collection, we actually didn't scan any cards on the + // collection set, since we didn't want to update remebered + // sets with entries that point into the collection set, given + // that live objects fromthe collection set are about to move + // and such entries will be stale very soon. This change also + // dealt with a reliability issue which involved scanning a + // card in the collection set and coming across an array that + // was being chunked and looking malformed. The problem is + // that, if evacuation fails, we might have remembered set + // entries missing given that we skipped cards on the + // collection set. So, we'll recreate such entries now. + RecreateRSetEntriesClosure cl(_g1, _hr); + obj->oop_iterate(&cl); + + assert(_cm->isPrevMarked(obj), "Should be marked!"); + } + } + } +}; + +void G1CollectedHeap::remove_self_forwarding_pointers() { + HeapRegion* cur = g1_policy()->collection_set(); + + while (cur != NULL) { + assert(g1_policy()->assertMarkedBytesDataOK(), "Should be!"); + + if (cur->evacuation_failed()) { + RemoveSelfPointerClosure rspc(_g1h, cur); + assert(cur->in_collection_set(), "bad CS"); + cur->object_iterate(&rspc); + rspc.fill_remainder(); + + // A number of manipulations to make the TAMS be the current top, + // and the marked bytes be the ones observed in the iteration. + if (_g1h->concurrent_mark()->at_least_one_mark_complete()) { + // The comments below are the postconditions achieved by the + // calls. Note especially the last such condition, which says that + // the count of marked bytes has been properly restored. + cur->note_start_of_marking(false); + // _next_top_at_mark_start == top, _next_marked_bytes == 0 + cur->add_to_marked_bytes(rspc.prev_marked_bytes()); + // _next_marked_bytes == prev_marked_bytes. + cur->note_end_of_marking(); + // _prev_top_at_mark_start == top(), + // _prev_marked_bytes == prev_marked_bytes + } + // If there is no mark in progress, we modified the _next variables + // above needlessly, but harmlessly. + if (_g1h->mark_in_progress()) { + cur->note_start_of_marking(false); + // _next_top_at_mark_start == top, _next_marked_bytes == 0 + // _next_marked_bytes == next_marked_bytes. + } + + // Now make sure the region has the right index in the sorted array. + g1_policy()->note_change_in_marked_bytes(cur); + } + cur = cur->next_in_collection_set(); + } + assert(g1_policy()->assertMarkedBytesDataOK(), "Should be!"); + + // Now restore saved marks, if any. + if (_objs_with_preserved_marks != NULL) { + assert(_preserved_marks_of_objs != NULL, "Both or none."); + assert(_objs_with_preserved_marks->length() == + _preserved_marks_of_objs->length(), "Both or none."); + guarantee(_objs_with_preserved_marks->length() == + _preserved_marks_of_objs->length(), "Both or none."); + for (int i = 0; i < _objs_with_preserved_marks->length(); i++) { + oop obj = _objs_with_preserved_marks->at(i); + markOop m = _preserved_marks_of_objs->at(i); + obj->set_mark(m); + } + // Delete the preserved marks growable arrays (allocated on the C heap). + delete _objs_with_preserved_marks; + delete _preserved_marks_of_objs; + _objs_with_preserved_marks = NULL; + _preserved_marks_of_objs = NULL; + } +} + +void G1CollectedHeap::push_on_evac_failure_scan_stack(oop obj) { + _evac_failure_scan_stack->push(obj); +} + +void G1CollectedHeap::drain_evac_failure_scan_stack() { + assert(_evac_failure_scan_stack != NULL, "precondition"); + + while (_evac_failure_scan_stack->length() > 0) { + oop obj = _evac_failure_scan_stack->pop(); + _evac_failure_closure->set_region(heap_region_containing(obj)); + obj->oop_iterate_backwards(_evac_failure_closure); + } +} + +void G1CollectedHeap::handle_evacuation_failure(oop old) { + markOop m = old->mark(); + // forward to self + assert(!old->is_forwarded(), "precondition"); + + old->forward_to(old); + handle_evacuation_failure_common(old, m); +} + +oop +G1CollectedHeap::handle_evacuation_failure_par(OopsInHeapRegionClosure* cl, + oop old) { + markOop m = old->mark(); + oop forward_ptr = old->forward_to_atomic(old); + if (forward_ptr == NULL) { + // Forward-to-self succeeded. + if (_evac_failure_closure != cl) { + MutexLockerEx x(EvacFailureStack_lock, Mutex::_no_safepoint_check_flag); + assert(!_drain_in_progress, + "Should only be true while someone holds the lock."); + // Set the global evac-failure closure to the current thread's. + assert(_evac_failure_closure == NULL, "Or locking has failed."); + set_evac_failure_closure(cl); + // Now do the common part. + handle_evacuation_failure_common(old, m); + // Reset to NULL. + set_evac_failure_closure(NULL); + } else { + // The lock is already held, and this is recursive. + assert(_drain_in_progress, "This should only be the recursive case."); + handle_evacuation_failure_common(old, m); + } + return old; + } else { + // Someone else had a place to copy it. + return forward_ptr; + } +} + +void G1CollectedHeap::handle_evacuation_failure_common(oop old, markOop m) { + set_evacuation_failed(true); + + preserve_mark_if_necessary(old, m); + + HeapRegion* r = heap_region_containing(old); + if (!r->evacuation_failed()) { + r->set_evacuation_failed(true); + if (G1TraceRegions) { + gclog_or_tty->print("evacuation failed in heap region "PTR_FORMAT" " + "["PTR_FORMAT","PTR_FORMAT")\n", + r, r->bottom(), r->end()); + } + } + + push_on_evac_failure_scan_stack(old); + + if (!_drain_in_progress) { + // prevent recursion in copy_to_survivor_space() + _drain_in_progress = true; + drain_evac_failure_scan_stack(); + _drain_in_progress = false; + } +} + +void G1CollectedHeap::preserve_mark_if_necessary(oop obj, markOop m) { + if (m != markOopDesc::prototype()) { + if (_objs_with_preserved_marks == NULL) { + assert(_preserved_marks_of_objs == NULL, "Both or none."); + _objs_with_preserved_marks = + new (ResourceObj::C_HEAP) GrowableArray(40, true); + _preserved_marks_of_objs = + new (ResourceObj::C_HEAP) GrowableArray(40, true); + } + _objs_with_preserved_marks->push(obj); + _preserved_marks_of_objs->push(m); + } +} + +// *** Parallel G1 Evacuation + +HeapWord* G1CollectedHeap::par_allocate_during_gc(GCAllocPurpose purpose, + size_t word_size) { + HeapRegion* alloc_region = _gc_alloc_regions[purpose]; + // let the caller handle alloc failure + if (alloc_region == NULL) return NULL; + + HeapWord* block = alloc_region->par_allocate(word_size); + if (block == NULL) { + MutexLockerEx x(par_alloc_during_gc_lock(), + Mutex::_no_safepoint_check_flag); + block = allocate_during_gc_slow(purpose, alloc_region, true, word_size); + } + return block; +} + +HeapWord* +G1CollectedHeap::allocate_during_gc_slow(GCAllocPurpose purpose, + HeapRegion* alloc_region, + bool par, + size_t word_size) { + HeapWord* block = NULL; + // In the parallel case, a previous thread to obtain the lock may have + // already assigned a new gc_alloc_region. + if (alloc_region != _gc_alloc_regions[purpose]) { + assert(par, "But should only happen in parallel case."); + alloc_region = _gc_alloc_regions[purpose]; + if (alloc_region == NULL) return NULL; + block = alloc_region->par_allocate(word_size); + if (block != NULL) return block; + // Otherwise, continue; this new region is empty, too. + } + assert(alloc_region != NULL, "We better have an allocation region"); + // Another thread might have obtained alloc_region for the given + // purpose, and might be attempting to allocate in it, and might + // succeed. Therefore, we can't do the "finalization" stuff on the + // region below until we're sure the last allocation has happened. + // We ensure this by allocating the remaining space with a garbage + // object. + if (par) par_allocate_remaining_space(alloc_region); + // Now we can do the post-GC stuff on the region. + alloc_region->note_end_of_copying(); + g1_policy()->record_after_bytes(alloc_region->used()); + + if (_gc_alloc_region_counts[purpose] >= g1_policy()->max_regions(purpose)) { + // Cannot allocate more regions for the given purpose. + GCAllocPurpose alt_purpose = g1_policy()->alternative_purpose(purpose); + // Is there an alternative? + if (purpose != alt_purpose) { + HeapRegion* alt_region = _gc_alloc_regions[alt_purpose]; + // Has not the alternative region been aliased? + if (alloc_region != alt_region) { + // Try to allocate in the alternative region. + if (par) { + block = alt_region->par_allocate(word_size); + } else { + block = alt_region->allocate(word_size); + } + // Make an alias. + _gc_alloc_regions[purpose] = _gc_alloc_regions[alt_purpose]; + } + if (block != NULL) { + return block; + } + // Both the allocation region and the alternative one are full + // and aliased, replace them with a new allocation region. + purpose = alt_purpose; + } else { + set_gc_alloc_region(purpose, NULL); + return NULL; + } + } + + // Now allocate a new region for allocation. + alloc_region = newAllocRegionWithExpansion(purpose, word_size, false /*zero_filled*/); + + // let the caller handle alloc failure + if (alloc_region != NULL) { + + assert(check_gc_alloc_regions(), "alloc regions messed up"); + assert(alloc_region->saved_mark_at_top(), + "Mark should have been saved already."); + // We used to assert that the region was zero-filled here, but no + // longer. + + // This must be done last: once it's installed, other regions may + // allocate in it (without holding the lock.) + set_gc_alloc_region(purpose, alloc_region); + + if (par) { + block = alloc_region->par_allocate(word_size); + } else { + block = alloc_region->allocate(word_size); + } + // Caller handles alloc failure. + } else { + // This sets other apis using the same old alloc region to NULL, also. + set_gc_alloc_region(purpose, NULL); + } + return block; // May be NULL. +} + +void G1CollectedHeap::par_allocate_remaining_space(HeapRegion* r) { + HeapWord* block = NULL; + size_t free_words; + do { + free_words = r->free()/HeapWordSize; + // If there's too little space, no one can allocate, so we're done. + if (free_words < (size_t)oopDesc::header_size()) return; + // Otherwise, try to claim it. + block = r->par_allocate(free_words); + } while (block == NULL); + SharedHeap::fill_region_with_object(MemRegion(block, free_words)); +} + +#define use_local_bitmaps 1 +#define verify_local_bitmaps 0 + +#ifndef PRODUCT + +class GCLabBitMap; +class GCLabBitMapClosure: public BitMapClosure { +private: + ConcurrentMark* _cm; + GCLabBitMap* _bitmap; + +public: + GCLabBitMapClosure(ConcurrentMark* cm, + GCLabBitMap* bitmap) { + _cm = cm; + _bitmap = bitmap; + } + + virtual bool do_bit(size_t offset); +}; + +#endif // PRODUCT + +#define oop_buffer_length 256 + +class GCLabBitMap: public BitMap { +private: + ConcurrentMark* _cm; + + int _shifter; + size_t _bitmap_word_covers_words; + + // beginning of the heap + HeapWord* _heap_start; + + // this is the actual start of the GCLab + HeapWord* _real_start_word; + + // this is the actual end of the GCLab + HeapWord* _real_end_word; + + // this is the first word, possibly located before the actual start + // of the GCLab, that corresponds to the first bit of the bitmap + HeapWord* _start_word; + + // size of a GCLab in words + size_t _gclab_word_size; + + static int shifter() { + return MinObjAlignment - 1; + } + + // how many heap words does a single bitmap word corresponds to? + static size_t bitmap_word_covers_words() { + return BitsPerWord << shifter(); + } + + static size_t gclab_word_size() { + return ParallelGCG1AllocBufferSize / HeapWordSize; + } + + static size_t bitmap_size_in_bits() { + size_t bits_in_bitmap = gclab_word_size() >> shifter(); + // We are going to ensure that the beginning of a word in this + // bitmap also corresponds to the beginning of a word in the + // global marking bitmap. To handle the case where a GCLab + // starts from the middle of the bitmap, we need to add enough + // space (i.e. up to a bitmap word) to ensure that we have + // enough bits in the bitmap. + return bits_in_bitmap + BitsPerWord - 1; + } +public: + GCLabBitMap(HeapWord* heap_start) + : BitMap(bitmap_size_in_bits()), + _cm(G1CollectedHeap::heap()->concurrent_mark()), + _shifter(shifter()), + _bitmap_word_covers_words(bitmap_word_covers_words()), + _heap_start(heap_start), + _gclab_word_size(gclab_word_size()), + _real_start_word(NULL), + _real_end_word(NULL), + _start_word(NULL) + { + guarantee( size_in_words() >= bitmap_size_in_words(), + "just making sure"); + } + + inline unsigned heapWordToOffset(HeapWord* addr) { + unsigned offset = (unsigned) pointer_delta(addr, _start_word) >> _shifter; + assert(offset < size(), "offset should be within bounds"); + return offset; + } + + inline HeapWord* offsetToHeapWord(size_t offset) { + HeapWord* addr = _start_word + (offset << _shifter); + assert(_real_start_word <= addr && addr < _real_end_word, "invariant"); + return addr; + } + + bool fields_well_formed() { + bool ret1 = (_real_start_word == NULL) && + (_real_end_word == NULL) && + (_start_word == NULL); + if (ret1) + return true; + + bool ret2 = _real_start_word >= _start_word && + _start_word < _real_end_word && + (_real_start_word + _gclab_word_size) == _real_end_word && + (_start_word + _gclab_word_size + _bitmap_word_covers_words) + > _real_end_word; + return ret2; + } + + inline bool mark(HeapWord* addr) { + guarantee(use_local_bitmaps, "invariant"); + assert(fields_well_formed(), "invariant"); + + if (addr >= _real_start_word && addr < _real_end_word) { + assert(!isMarked(addr), "should not have already been marked"); + + // first mark it on the bitmap + at_put(heapWordToOffset(addr), true); + + return true; + } else { + return false; + } + } + + inline bool isMarked(HeapWord* addr) { + guarantee(use_local_bitmaps, "invariant"); + assert(fields_well_formed(), "invariant"); + + return at(heapWordToOffset(addr)); + } + + void set_buffer(HeapWord* start) { + guarantee(use_local_bitmaps, "invariant"); + clear(); + + assert(start != NULL, "invariant"); + _real_start_word = start; + _real_end_word = start + _gclab_word_size; + + size_t diff = + pointer_delta(start, _heap_start) % _bitmap_word_covers_words; + _start_word = start - diff; + + assert(fields_well_formed(), "invariant"); + } + +#ifndef PRODUCT + void verify() { + // verify that the marks have been propagated + GCLabBitMapClosure cl(_cm, this); + iterate(&cl); + } +#endif // PRODUCT + + void retire() { + guarantee(use_local_bitmaps, "invariant"); + assert(fields_well_formed(), "invariant"); + + if (_start_word != NULL) { + CMBitMap* mark_bitmap = _cm->nextMarkBitMap(); + + // this means that the bitmap was set up for the GCLab + assert(_real_start_word != NULL && _real_end_word != NULL, "invariant"); + + mark_bitmap->mostly_disjoint_range_union(this, + 0, // always start from the start of the bitmap + _start_word, + size_in_words()); + _cm->grayRegionIfNecessary(MemRegion(_real_start_word, _real_end_word)); + +#ifndef PRODUCT + if (use_local_bitmaps && verify_local_bitmaps) + verify(); +#endif // PRODUCT + } else { + assert(_real_start_word == NULL && _real_end_word == NULL, "invariant"); + } + } + + static size_t bitmap_size_in_words() { + return (bitmap_size_in_bits() + BitsPerWord - 1) / BitsPerWord; + } +}; + +#ifndef PRODUCT + +bool GCLabBitMapClosure::do_bit(size_t offset) { + HeapWord* addr = _bitmap->offsetToHeapWord(offset); + guarantee(_cm->isMarked(oop(addr)), "it should be!"); + return true; +} + +#endif // PRODUCT + +class G1ParGCAllocBuffer: public ParGCAllocBuffer { +private: + bool _retired; + bool _during_marking; + GCLabBitMap _bitmap; + +public: + G1ParGCAllocBuffer() : + ParGCAllocBuffer(ParallelGCG1AllocBufferSize / HeapWordSize), + _during_marking(G1CollectedHeap::heap()->mark_in_progress()), + _bitmap(G1CollectedHeap::heap()->reserved_region().start()), + _retired(false) + { } + + inline bool mark(HeapWord* addr) { + guarantee(use_local_bitmaps, "invariant"); + assert(_during_marking, "invariant"); + return _bitmap.mark(addr); + } + + inline void set_buf(HeapWord* buf) { + if (use_local_bitmaps && _during_marking) + _bitmap.set_buffer(buf); + ParGCAllocBuffer::set_buf(buf); + _retired = false; + } + + inline void retire(bool end_of_gc, bool retain) { + if (_retired) + return; + if (use_local_bitmaps && _during_marking) { + _bitmap.retire(); + } + ParGCAllocBuffer::retire(end_of_gc, retain); + _retired = true; + } +}; + + +class G1ParScanThreadState : public StackObj { +protected: + G1CollectedHeap* _g1h; + RefToScanQueue* _refs; + + typedef GrowableArray OverflowQueue; + OverflowQueue* _overflowed_refs; + + G1ParGCAllocBuffer _alloc_buffers[GCAllocPurposeCount]; + + size_t _alloc_buffer_waste; + size_t _undo_waste; + + OopsInHeapRegionClosure* _evac_failure_cl; + G1ParScanHeapEvacClosure* _evac_cl; + G1ParScanPartialArrayClosure* _partial_scan_cl; + + int _hash_seed; + int _queue_num; + + int _term_attempts; +#if G1_DETAILED_STATS + int _pushes, _pops, _steals, _steal_attempts; + int _overflow_pushes; +#endif + + double _start; + double _start_strong_roots; + double _strong_roots_time; + double _start_term; + double _term_time; + + // Map from young-age-index (0 == not young, 1 is youngest) to + // surviving words. base is what we get back from the malloc call + size_t* _surviving_young_words_base; + // this points into the array, as we use the first few entries for padding + size_t* _surviving_young_words; + +#define PADDING_ELEM_NUM (64 / sizeof(size_t)) + + void add_to_alloc_buffer_waste(size_t waste) { _alloc_buffer_waste += waste; } + + void add_to_undo_waste(size_t waste) { _undo_waste += waste; } + +public: + G1ParScanThreadState(G1CollectedHeap* g1h, int queue_num) + : _g1h(g1h), + _refs(g1h->task_queue(queue_num)), + _hash_seed(17), _queue_num(queue_num), + _term_attempts(0), +#if G1_DETAILED_STATS + _pushes(0), _pops(0), _steals(0), + _steal_attempts(0), _overflow_pushes(0), +#endif + _strong_roots_time(0), _term_time(0), + _alloc_buffer_waste(0), _undo_waste(0) + { + // we allocate G1YoungSurvRateNumRegions plus one entries, since + // we "sacrifice" entry 0 to keep track of surviving bytes for + // non-young regions (where the age is -1) + // We also add a few elements at the beginning and at the end in + // an attempt to eliminate cache contention + size_t real_length = 1 + _g1h->g1_policy()->young_cset_length(); + size_t array_length = PADDING_ELEM_NUM + + real_length + + PADDING_ELEM_NUM; + _surviving_young_words_base = NEW_C_HEAP_ARRAY(size_t, array_length); + if (_surviving_young_words_base == NULL) + vm_exit_out_of_memory(array_length * sizeof(size_t), + "Not enough space for young surv histo."); + _surviving_young_words = _surviving_young_words_base + PADDING_ELEM_NUM; + memset(_surviving_young_words, 0, real_length * sizeof(size_t)); + + _overflowed_refs = new OverflowQueue(10); + + _start = os::elapsedTime(); + } + + ~G1ParScanThreadState() { + FREE_C_HEAP_ARRAY(size_t, _surviving_young_words_base); + } + + RefToScanQueue* refs() { return _refs; } + OverflowQueue* overflowed_refs() { return _overflowed_refs; } + + inline G1ParGCAllocBuffer* alloc_buffer(GCAllocPurpose purpose) { + return &_alloc_buffers[purpose]; + } + + size_t alloc_buffer_waste() { return _alloc_buffer_waste; } + size_t undo_waste() { return _undo_waste; } + + void push_on_queue(oop* ref) { + if (!refs()->push(ref)) { + overflowed_refs()->push(ref); + IF_G1_DETAILED_STATS(note_overflow_push()); + } else { + IF_G1_DETAILED_STATS(note_push()); + } + } + + void pop_from_queue(oop*& ref) { + if (!refs()->pop_local(ref)) { + ref = NULL; + } else { + IF_G1_DETAILED_STATS(note_pop()); + } + } + + void pop_from_overflow_queue(oop*& ref) { + ref = overflowed_refs()->pop(); + } + + int refs_to_scan() { return refs()->size(); } + int overflowed_refs_to_scan() { return overflowed_refs()->length(); } + + HeapWord* allocate_slow(GCAllocPurpose purpose, size_t word_sz) { + + HeapWord* obj = NULL; + if (word_sz * 100 < + (size_t)(ParallelGCG1AllocBufferSize / HeapWordSize) * + ParallelGCBufferWastePct) { + G1ParGCAllocBuffer* alloc_buf = alloc_buffer(purpose); + add_to_alloc_buffer_waste(alloc_buf->words_remaining()); + alloc_buf->retire(false, false); + + HeapWord* buf = + _g1h->par_allocate_during_gc(purpose, ParallelGCG1AllocBufferSize / HeapWordSize); + if (buf == NULL) return NULL; // Let caller handle allocation failure. + // Otherwise. + alloc_buf->set_buf(buf); + + obj = alloc_buf->allocate(word_sz); + assert(obj != NULL, "buffer was definitely big enough..."); + } + else { + obj = _g1h->par_allocate_during_gc(purpose, word_sz); + } + return obj; + } + + HeapWord* allocate(GCAllocPurpose purpose, size_t word_sz) { + HeapWord* obj = alloc_buffer(purpose)->allocate(word_sz); + if (obj != NULL) return obj; + return allocate_slow(purpose, word_sz); + } + + void undo_allocation(GCAllocPurpose purpose, HeapWord* obj, size_t word_sz) { + if (alloc_buffer(purpose)->contains(obj)) { + guarantee(alloc_buffer(purpose)->contains(obj + word_sz - 1), + "should contain whole object"); + alloc_buffer(purpose)->undo_allocation(obj, word_sz); + } + else { + SharedHeap::fill_region_with_object(MemRegion(obj, word_sz)); + add_to_undo_waste(word_sz); + } + } + + void set_evac_failure_closure(OopsInHeapRegionClosure* evac_failure_cl) { + _evac_failure_cl = evac_failure_cl; + } + OopsInHeapRegionClosure* evac_failure_closure() { + return _evac_failure_cl; + } + + void set_evac_closure(G1ParScanHeapEvacClosure* evac_cl) { + _evac_cl = evac_cl; + } + + void set_partial_scan_closure(G1ParScanPartialArrayClosure* partial_scan_cl) { + _partial_scan_cl = partial_scan_cl; + } + + int* hash_seed() { return &_hash_seed; } + int queue_num() { return _queue_num; } + + int term_attempts() { return _term_attempts; } + void note_term_attempt() { _term_attempts++; } + +#if G1_DETAILED_STATS + int pushes() { return _pushes; } + int pops() { return _pops; } + int steals() { return _steals; } + int steal_attempts() { return _steal_attempts; } + int overflow_pushes() { return _overflow_pushes; } + + void note_push() { _pushes++; } + void note_pop() { _pops++; } + void note_steal() { _steals++; } + void note_steal_attempt() { _steal_attempts++; } + void note_overflow_push() { _overflow_pushes++; } +#endif + + void start_strong_roots() { + _start_strong_roots = os::elapsedTime(); + } + void end_strong_roots() { + _strong_roots_time += (os::elapsedTime() - _start_strong_roots); + } + double strong_roots_time() { return _strong_roots_time; } + + void start_term_time() { + note_term_attempt(); + _start_term = os::elapsedTime(); + } + void end_term_time() { + _term_time += (os::elapsedTime() - _start_term); + } + double term_time() { return _term_time; } + + double elapsed() { + return os::elapsedTime() - _start; + } + + size_t* surviving_young_words() { + // We add on to hide entry 0 which accumulates surviving words for + // age -1 regions (i.e. non-young ones) + return _surviving_young_words; + } + + void retire_alloc_buffers() { + for (int ap = 0; ap < GCAllocPurposeCount; ++ap) { + size_t waste = _alloc_buffers[ap].words_remaining(); + add_to_alloc_buffer_waste(waste); + _alloc_buffers[ap].retire(true, false); + } + } + + void trim_queue() { + while (refs_to_scan() > 0 || overflowed_refs_to_scan() > 0) { + oop *ref_to_scan = NULL; + if (overflowed_refs_to_scan() == 0) { + pop_from_queue(ref_to_scan); + } else { + pop_from_overflow_queue(ref_to_scan); + } + if (ref_to_scan != NULL) { + if ((intptr_t)ref_to_scan & G1_PARTIAL_ARRAY_MASK) { + _partial_scan_cl->do_oop_nv(ref_to_scan); + } else { + // Note: we can use "raw" versions of "region_containing" because + // "obj_to_scan" is definitely in the heap, and is not in a + // humongous region. + HeapRegion* r = _g1h->heap_region_containing_raw(ref_to_scan); + _evac_cl->set_region(r); + _evac_cl->do_oop_nv(ref_to_scan); + } + } + } + } +}; + + +G1ParClosureSuper::G1ParClosureSuper(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state) : + _g1(g1), _g1_rem(_g1->g1_rem_set()), _cm(_g1->concurrent_mark()), + _par_scan_state(par_scan_state) { } + +// This closure is applied to the fields of the objects that have just been copied. +// Should probably be made inline and moved in g1OopClosures.inline.hpp. +void G1ParScanClosure::do_oop_nv(oop* p) { + oop obj = *p; + if (obj != NULL) { + if (_g1->obj_in_cs(obj)) { + if (obj->is_forwarded()) { + *p = obj->forwardee(); + } else { + _par_scan_state->push_on_queue(p); + return; + } + } + _g1_rem->par_write_ref(_from, p, _par_scan_state->queue_num()); + } +} + +void G1ParCopyHelper::mark_forwardee(oop* p) { + // This is called _after_ do_oop_work has been called, hence after + // the object has been relocated to its new location and *p points + // to its new location. + + oop thisOop = *p; + if (thisOop != NULL) { + assert((_g1->evacuation_failed()) || (!_g1->obj_in_cs(thisOop)), + "shouldn't still be in the CSet if evacuation didn't fail."); + HeapWord* addr = (HeapWord*)thisOop; + if (_g1->is_in_g1_reserved(addr)) + _cm->grayRoot(oop(addr)); + } +} + +oop G1ParCopyHelper::copy_to_survivor_space(oop old) { + size_t word_sz = old->size(); + HeapRegion* from_region = _g1->heap_region_containing_raw(old); + // +1 to make the -1 indexes valid... + int young_index = from_region->young_index_in_cset()+1; + assert( (from_region->is_young() && young_index > 0) || + (!from_region->is_young() && young_index == 0), "invariant" ); + G1CollectorPolicy* g1p = _g1->g1_policy(); + markOop m = old->mark(); + GCAllocPurpose alloc_purpose = g1p->evacuation_destination(from_region, m->age(), + word_sz); + HeapWord* obj_ptr = _par_scan_state->allocate(alloc_purpose, word_sz); + oop obj = oop(obj_ptr); + + if (obj_ptr == NULL) { + // This will either forward-to-self, or detect that someone else has + // installed a forwarding pointer. + OopsInHeapRegionClosure* cl = _par_scan_state->evac_failure_closure(); + return _g1->handle_evacuation_failure_par(cl, old); + } + + oop forward_ptr = old->forward_to_atomic(obj); + if (forward_ptr == NULL) { + Copy::aligned_disjoint_words((HeapWord*) old, obj_ptr, word_sz); + obj->set_mark(m); + if (g1p->track_object_age(alloc_purpose)) { + obj->incr_age(); + } + // preserve "next" mark bit + if (_g1->mark_in_progress() && !_g1->is_obj_ill(old)) { + if (!use_local_bitmaps || + !_par_scan_state->alloc_buffer(alloc_purpose)->mark(obj_ptr)) { + // if we couldn't mark it on the local bitmap (this happens when + // the object was not allocated in the GCLab), we have to bite + // the bullet and do the standard parallel mark + _cm->markAndGrayObjectIfNecessary(obj); + } +#if 1 + if (_g1->isMarkedNext(old)) { + _cm->nextMarkBitMap()->parClear((HeapWord*)old); + } +#endif + } + + size_t* surv_young_words = _par_scan_state->surviving_young_words(); + surv_young_words[young_index] += word_sz; + + if (obj->is_objArray() && arrayOop(obj)->length() >= ParGCArrayScanChunk) { + arrayOop(old)->set_length(0); + _par_scan_state->push_on_queue((oop*) ((intptr_t)old | G1_PARTIAL_ARRAY_MASK)); + } else { + _scanner->set_region(_g1->heap_region_containing(obj)); + obj->oop_iterate_backwards(_scanner); + } + } else { + _par_scan_state->undo_allocation(alloc_purpose, obj_ptr, word_sz); + obj = forward_ptr; + } + return obj; +} + +template +void G1ParCopyClosure::do_oop_work(oop* p) { + oop obj = *p; + assert(barrier != G1BarrierRS || obj != NULL, + "Precondition: G1BarrierRS implies obj is nonNull"); + + if (obj != NULL) { + if (_g1->obj_in_cs(obj)) { +#if G1_REM_SET_LOGGING + gclog_or_tty->print_cr("Loc "PTR_FORMAT" contains pointer "PTR_FORMAT" into CS.", + p, (void*) obj); +#endif + if (obj->is_forwarded()) { + *p = obj->forwardee(); + } else { + *p = copy_to_survivor_space(obj); + } + // When scanning the RS, we only care about objs in CS. + if (barrier == G1BarrierRS) { + _g1_rem->par_write_ref(_from, p, _par_scan_state->queue_num()); + } + } + // When scanning moved objs, must look at all oops. + if (barrier == G1BarrierEvac) { + _g1_rem->par_write_ref(_from, p, _par_scan_state->queue_num()); + } + + if (do_gen_barrier) { + par_do_barrier(p); + } + } +} + +template void G1ParCopyClosure::do_oop_work(oop* p); + +template void G1ParScanPartialArrayClosure::process_array_chunk( + oop obj, int start, int end) { + // process our set of indices (include header in first chunk) + assert(start < end, "invariant"); + T* const base = (T*)objArrayOop(obj)->base(); + T* const start_addr = base + start; + T* const end_addr = base + end; + MemRegion mr((HeapWord*)start_addr, (HeapWord*)end_addr); + _scanner.set_region(_g1->heap_region_containing(obj)); + obj->oop_iterate(&_scanner, mr); +} + +void G1ParScanPartialArrayClosure::do_oop_nv(oop* p) { + assert(!UseCompressedOops, "Needs to be fixed to work with compressed oops"); + oop old = oop((intptr_t)p & ~G1_PARTIAL_ARRAY_MASK); + assert(old->is_objArray(), "must be obj array"); + assert(old->is_forwarded(), "must be forwarded"); + assert(Universe::heap()->is_in_reserved(old), "must be in heap."); + + objArrayOop obj = objArrayOop(old->forwardee()); + assert((void*)old != (void*)old->forwardee(), "self forwarding here?"); + // Process ParGCArrayScanChunk elements now + // and push the remainder back onto queue + int start = arrayOop(old)->length(); + int end = obj->length(); + int remainder = end - start; + assert(start <= end, "just checking"); + if (remainder > 2 * ParGCArrayScanChunk) { + // Test above combines last partial chunk with a full chunk + end = start + ParGCArrayScanChunk; + arrayOop(old)->set_length(end); + // Push remainder. + _par_scan_state->push_on_queue((oop*) ((intptr_t) old | G1_PARTIAL_ARRAY_MASK)); + } else { + // Restore length so that the heap remains parsable in + // case of evacuation failure. + arrayOop(old)->set_length(end); + } + + // process our set of indices (include header in first chunk) + process_array_chunk(obj, start, end); + oop* start_addr = start == 0 ? (oop*)obj : obj->obj_at_addr(start); + oop* end_addr = (oop*)(obj->base()) + end; // obj_at_addr(end) asserts end < length + MemRegion mr((HeapWord*)start_addr, (HeapWord*)end_addr); + _scanner.set_region(_g1->heap_region_containing(obj)); + obj->oop_iterate(&_scanner, mr); +} + +int G1ScanAndBalanceClosure::_nq = 0; + +class G1ParEvacuateFollowersClosure : public VoidClosure { +protected: + G1CollectedHeap* _g1h; + G1ParScanThreadState* _par_scan_state; + RefToScanQueueSet* _queues; + ParallelTaskTerminator* _terminator; + + G1ParScanThreadState* par_scan_state() { return _par_scan_state; } + RefToScanQueueSet* queues() { return _queues; } + ParallelTaskTerminator* terminator() { return _terminator; } + +public: + G1ParEvacuateFollowersClosure(G1CollectedHeap* g1h, + G1ParScanThreadState* par_scan_state, + RefToScanQueueSet* queues, + ParallelTaskTerminator* terminator) + : _g1h(g1h), _par_scan_state(par_scan_state), + _queues(queues), _terminator(terminator) {} + + void do_void() { + G1ParScanThreadState* pss = par_scan_state(); + while (true) { + oop* ref_to_scan; + pss->trim_queue(); + IF_G1_DETAILED_STATS(pss->note_steal_attempt()); + if (queues()->steal(pss->queue_num(), + pss->hash_seed(), + ref_to_scan)) { + IF_G1_DETAILED_STATS(pss->note_steal()); + pss->push_on_queue(ref_to_scan); + continue; + } + pss->start_term_time(); + if (terminator()->offer_termination()) break; + pss->end_term_time(); + } + pss->end_term_time(); + pss->retire_alloc_buffers(); + } +}; + +class G1ParTask : public AbstractGangTask { +protected: + G1CollectedHeap* _g1h; + RefToScanQueueSet *_queues; + ParallelTaskTerminator _terminator; + + Mutex _stats_lock; + Mutex* stats_lock() { return &_stats_lock; } + + size_t getNCards() { + return (_g1h->capacity() + G1BlockOffsetSharedArray::N_bytes - 1) + / G1BlockOffsetSharedArray::N_bytes; + } + +public: + G1ParTask(G1CollectedHeap* g1h, int workers, RefToScanQueueSet *task_queues) + : AbstractGangTask("G1 collection"), + _g1h(g1h), + _queues(task_queues), + _terminator(workers, _queues), + _stats_lock(Mutex::leaf, "parallel G1 stats lock", true) + {} + + RefToScanQueueSet* queues() { return _queues; } + + RefToScanQueue *work_queue(int i) { + return queues()->queue(i); + } + + void work(int i) { + ResourceMark rm; + HandleMark hm; + + G1ParScanThreadState pss(_g1h, i); + G1ParScanHeapEvacClosure scan_evac_cl(_g1h, &pss); + G1ParScanHeapEvacClosure evac_failure_cl(_g1h, &pss); + G1ParScanPartialArrayClosure partial_scan_cl(_g1h, &pss); + + pss.set_evac_closure(&scan_evac_cl); + pss.set_evac_failure_closure(&evac_failure_cl); + pss.set_partial_scan_closure(&partial_scan_cl); + + G1ParScanExtRootClosure only_scan_root_cl(_g1h, &pss); + G1ParScanPermClosure only_scan_perm_cl(_g1h, &pss); + G1ParScanHeapRSClosure only_scan_heap_rs_cl(_g1h, &pss); + G1ParScanAndMarkExtRootClosure scan_mark_root_cl(_g1h, &pss); + G1ParScanAndMarkPermClosure scan_mark_perm_cl(_g1h, &pss); + G1ParScanAndMarkHeapRSClosure scan_mark_heap_rs_cl(_g1h, &pss); + + OopsInHeapRegionClosure *scan_root_cl; + OopsInHeapRegionClosure *scan_perm_cl; + OopsInHeapRegionClosure *scan_so_cl; + + if (_g1h->g1_policy()->should_initiate_conc_mark()) { + scan_root_cl = &scan_mark_root_cl; + scan_perm_cl = &scan_mark_perm_cl; + scan_so_cl = &scan_mark_heap_rs_cl; + } else { + scan_root_cl = &only_scan_root_cl; + scan_perm_cl = &only_scan_perm_cl; + scan_so_cl = &only_scan_heap_rs_cl; + } + + pss.start_strong_roots(); + _g1h->g1_process_strong_roots(/* not collecting perm */ false, + SharedHeap::SO_AllClasses, + scan_root_cl, + &only_scan_heap_rs_cl, + scan_so_cl, + scan_perm_cl, + i); + pss.end_strong_roots(); + { + double start = os::elapsedTime(); + G1ParEvacuateFollowersClosure evac(_g1h, &pss, _queues, &_terminator); + evac.do_void(); + double elapsed_ms = (os::elapsedTime()-start)*1000.0; + double term_ms = pss.term_time()*1000.0; + _g1h->g1_policy()->record_obj_copy_time(i, elapsed_ms-term_ms); + _g1h->g1_policy()->record_termination_time(i, term_ms); + } + _g1h->update_surviving_young_words(pss.surviving_young_words()+1); + + // Clean up any par-expanded rem sets. + HeapRegionRemSet::par_cleanup(); + + MutexLocker x(stats_lock()); + if (ParallelGCVerbose) { + gclog_or_tty->print("Thread %d complete:\n", i); +#if G1_DETAILED_STATS + gclog_or_tty->print(" Pushes: %7d Pops: %7d Overflows: %7d Steals %7d (in %d attempts)\n", + pss.pushes(), + pss.pops(), + pss.overflow_pushes(), + pss.steals(), + pss.steal_attempts()); +#endif + double elapsed = pss.elapsed(); + double strong_roots = pss.strong_roots_time(); + double term = pss.term_time(); + gclog_or_tty->print(" Elapsed: %7.2f ms.\n" + " Strong roots: %7.2f ms (%6.2f%%)\n" + " Termination: %7.2f ms (%6.2f%%) (in %d entries)\n", + elapsed * 1000.0, + strong_roots * 1000.0, (strong_roots*100.0/elapsed), + term * 1000.0, (term*100.0/elapsed), + pss.term_attempts()); + size_t total_waste = pss.alloc_buffer_waste() + pss.undo_waste(); + gclog_or_tty->print(" Waste: %8dK\n" + " Alloc Buffer: %8dK\n" + " Undo: %8dK\n", + (total_waste * HeapWordSize) / K, + (pss.alloc_buffer_waste() * HeapWordSize) / K, + (pss.undo_waste() * HeapWordSize) / K); + } + + assert(pss.refs_to_scan() == 0, "Task queue should be empty"); + assert(pss.overflowed_refs_to_scan() == 0, "Overflow queue should be empty"); + } +}; + +// *** Common G1 Evacuation Stuff + +class G1CountClosure: public OopsInHeapRegionClosure { +public: + int n; + G1CountClosure() : n(0) {} + void do_oop(narrowOop* p) { + guarantee(false, "NYI"); + } + void do_oop(oop* p) { + oop obj = *p; + assert(obj != NULL && G1CollectedHeap::heap()->obj_in_cs(obj), + "Rem set closure called on non-rem-set pointer."); + n++; + } +}; + +static G1CountClosure count_closure; + +void +G1CollectedHeap:: +g1_process_strong_roots(bool collecting_perm_gen, + SharedHeap::ScanningOption so, + OopClosure* scan_non_heap_roots, + OopsInHeapRegionClosure* scan_rs, + OopsInHeapRegionClosure* scan_so, + OopsInGenClosure* scan_perm, + int worker_i) { + // First scan the strong roots, including the perm gen. + double ext_roots_start = os::elapsedTime(); + double closure_app_time_sec = 0.0; + + BufferingOopClosure buf_scan_non_heap_roots(scan_non_heap_roots); + BufferingOopsInGenClosure buf_scan_perm(scan_perm); + buf_scan_perm.set_generation(perm_gen()); + + process_strong_roots(collecting_perm_gen, so, + &buf_scan_non_heap_roots, + &buf_scan_perm); + // Finish up any enqueued closure apps. + buf_scan_non_heap_roots.done(); + buf_scan_perm.done(); + double ext_roots_end = os::elapsedTime(); + g1_policy()->reset_obj_copy_time(worker_i); + double obj_copy_time_sec = + buf_scan_non_heap_roots.closure_app_seconds() + + buf_scan_perm.closure_app_seconds(); + g1_policy()->record_obj_copy_time(worker_i, obj_copy_time_sec * 1000.0); + double ext_root_time_ms = + ((ext_roots_end - ext_roots_start) - obj_copy_time_sec) * 1000.0; + g1_policy()->record_ext_root_scan_time(worker_i, ext_root_time_ms); + + // Scan strong roots in mark stack. + if (!_process_strong_tasks->is_task_claimed(G1H_PS_mark_stack_oops_do)) { + concurrent_mark()->oops_do(scan_non_heap_roots); + } + double mark_stack_scan_ms = (os::elapsedTime() - ext_roots_end) * 1000.0; + g1_policy()->record_mark_stack_scan_time(worker_i, mark_stack_scan_ms); + + // XXX What should this be doing in the parallel case? + g1_policy()->record_collection_pause_end_CH_strong_roots(); + if (G1VerifyRemSet) { + // :::: FIXME :::: + // The stupid remembered set doesn't know how to filter out dead + // objects, which the smart one does, and so when it is created + // and then compared the number of entries in each differs and + // the verification code fails. + guarantee(false, "verification code is broken, see note"); + + // Let's make sure that the current rem set agrees with the stupidest + // one possible! + bool refs_enabled = ref_processor()->discovery_enabled(); + if (refs_enabled) ref_processor()->disable_discovery(); + StupidG1RemSet stupid(this); + count_closure.n = 0; + stupid.oops_into_collection_set_do(&count_closure, worker_i); + int stupid_n = count_closure.n; + count_closure.n = 0; + g1_rem_set()->oops_into_collection_set_do(&count_closure, worker_i); + guarantee(count_closure.n == stupid_n, "Old and new rem sets differ."); + gclog_or_tty->print_cr("\nFound %d pointers in heap RS.", count_closure.n); + if (refs_enabled) ref_processor()->enable_discovery(); + } + if (scan_so != NULL) { + scan_scan_only_set(scan_so, worker_i); + } + // Now scan the complement of the collection set. + if (scan_rs != NULL) { + g1_rem_set()->oops_into_collection_set_do(scan_rs, worker_i); + } + // Finish with the ref_processor roots. + if (!_process_strong_tasks->is_task_claimed(G1H_PS_refProcessor_oops_do)) { + ref_processor()->oops_do(scan_non_heap_roots); + } + g1_policy()->record_collection_pause_end_G1_strong_roots(); + _process_strong_tasks->all_tasks_completed(); +} + +void +G1CollectedHeap::scan_scan_only_region(HeapRegion* r, + OopsInHeapRegionClosure* oc, + int worker_i) { + HeapWord* startAddr = r->bottom(); + HeapWord* endAddr = r->used_region().end(); + + oc->set_region(r); + + HeapWord* p = r->bottom(); + HeapWord* t = r->top(); + guarantee( p == r->next_top_at_mark_start(), "invariant" ); + while (p < t) { + oop obj = oop(p); + p += obj->oop_iterate(oc); + } +} + +void +G1CollectedHeap::scan_scan_only_set(OopsInHeapRegionClosure* oc, + int worker_i) { + double start = os::elapsedTime(); + + BufferingOopsInHeapRegionClosure boc(oc); + + FilterInHeapRegionAndIntoCSClosure scan_only(this, &boc); + FilterAndMarkInHeapRegionAndIntoCSClosure scan_and_mark(this, &boc, concurrent_mark()); + + OopsInHeapRegionClosure *foc; + if (g1_policy()->should_initiate_conc_mark()) + foc = &scan_and_mark; + else + foc = &scan_only; + + HeapRegion* hr; + int n = 0; + while ((hr = _young_list->par_get_next_scan_only_region()) != NULL) { + scan_scan_only_region(hr, foc, worker_i); + ++n; + } + boc.done(); + + double closure_app_s = boc.closure_app_seconds(); + g1_policy()->record_obj_copy_time(worker_i, closure_app_s * 1000.0); + double ms = (os::elapsedTime() - start - closure_app_s)*1000.0; + g1_policy()->record_scan_only_time(worker_i, ms, n); +} + +void +G1CollectedHeap::g1_process_weak_roots(OopClosure* root_closure, + OopClosure* non_root_closure) { + SharedHeap::process_weak_roots(root_closure, non_root_closure); +} + + +class SaveMarksClosure: public HeapRegionClosure { +public: + bool doHeapRegion(HeapRegion* r) { + r->save_marks(); + return false; + } +}; + +void G1CollectedHeap::save_marks() { + if (ParallelGCThreads == 0) { + SaveMarksClosure sm; + heap_region_iterate(&sm); + } + // We do this even in the parallel case + perm_gen()->save_marks(); +} + +void G1CollectedHeap::evacuate_collection_set() { + set_evacuation_failed(false); + + g1_rem_set()->prepare_for_oops_into_collection_set_do(); + concurrent_g1_refine()->set_use_cache(false); + int n_workers = (ParallelGCThreads > 0 ? workers()->total_workers() : 1); + + set_par_threads(n_workers); + G1ParTask g1_par_task(this, n_workers, _task_queues); + + init_for_evac_failure(NULL); + + change_strong_roots_parity(); // In preparation for parallel strong roots. + rem_set()->prepare_for_younger_refs_iterate(true); + double start_par = os::elapsedTime(); + + if (ParallelGCThreads > 0) { + // The individual threads will set their evac-failure closures. + workers()->run_task(&g1_par_task); + } else { + g1_par_task.work(0); + } + + double par_time = (os::elapsedTime() - start_par) * 1000.0; + g1_policy()->record_par_time(par_time); + set_par_threads(0); + // Is this the right thing to do here? We don't save marks + // on individual heap regions when we allocate from + // them in parallel, so this seems like the correct place for this. + all_alloc_regions_note_end_of_copying(); + { + G1IsAliveClosure is_alive(this); + G1KeepAliveClosure keep_alive(this); + JNIHandles::weak_oops_do(&is_alive, &keep_alive); + } + + g1_rem_set()->cleanup_after_oops_into_collection_set_do(); + concurrent_g1_refine()->set_use_cache(true); + + finalize_for_evac_failure(); + + // Must do this before removing self-forwarding pointers, which clears + // the per-region evac-failure flags. + concurrent_mark()->complete_marking_in_collection_set(); + + if (evacuation_failed()) { + remove_self_forwarding_pointers(); + + if (PrintGCDetails) { + gclog_or_tty->print(" (evacuation failed)"); + } else if (PrintGC) { + gclog_or_tty->print("--"); + } + } + + COMPILER2_PRESENT(DerivedPointerTable::update_pointers()); +} + +void G1CollectedHeap::free_region(HeapRegion* hr) { + size_t pre_used = 0; + size_t cleared_h_regions = 0; + size_t freed_regions = 0; + UncleanRegionList local_list; + + HeapWord* start = hr->bottom(); + HeapWord* end = hr->prev_top_at_mark_start(); + size_t used_bytes = hr->used(); + size_t live_bytes = hr->max_live_bytes(); + if (used_bytes > 0) { + guarantee( live_bytes <= used_bytes, "invariant" ); + } else { + guarantee( live_bytes == 0, "invariant" ); + } + + size_t garbage_bytes = used_bytes - live_bytes; + if (garbage_bytes > 0) + g1_policy()->decrease_known_garbage_bytes(garbage_bytes); + + free_region_work(hr, pre_used, cleared_h_regions, freed_regions, + &local_list); + finish_free_region_work(pre_used, cleared_h_regions, freed_regions, + &local_list); +} + +void +G1CollectedHeap::free_region_work(HeapRegion* hr, + size_t& pre_used, + size_t& cleared_h_regions, + size_t& freed_regions, + UncleanRegionList* list, + bool par) { + assert(!hr->popular(), "should not free popular regions"); + pre_used += hr->used(); + if (hr->isHumongous()) { + assert(hr->startsHumongous(), + "Only the start of a humongous region should be freed."); + int ind = _hrs->find(hr); + assert(ind != -1, "Should have an index."); + // Clear the start region. + hr->hr_clear(par, true /*clear_space*/); + list->insert_before_head(hr); + cleared_h_regions++; + freed_regions++; + // Clear any continued regions. + ind++; + while ((size_t)ind < n_regions()) { + HeapRegion* hrc = _hrs->at(ind); + if (!hrc->continuesHumongous()) break; + // Otherwise, does continue the H region. + assert(hrc->humongous_start_region() == hr, "Huh?"); + hrc->hr_clear(par, true /*clear_space*/); + cleared_h_regions++; + freed_regions++; + list->insert_before_head(hrc); + ind++; + } + } else { + hr->hr_clear(par, true /*clear_space*/); + list->insert_before_head(hr); + freed_regions++; + // If we're using clear2, this should not be enabled. + // assert(!hr->in_cohort(), "Can't be both free and in a cohort."); + } +} + +void G1CollectedHeap::finish_free_region_work(size_t pre_used, + size_t cleared_h_regions, + size_t freed_regions, + UncleanRegionList* list) { + if (list != NULL && list->sz() > 0) { + prepend_region_list_on_unclean_list(list); + } + // Acquire a lock, if we're parallel, to update possibly-shared + // variables. + Mutex* lock = (n_par_threads() > 0) ? ParGCRareEvent_lock : NULL; + { + MutexLockerEx x(lock, Mutex::_no_safepoint_check_flag); + _summary_bytes_used -= pre_used; + _num_humongous_regions -= (int) cleared_h_regions; + _free_regions += freed_regions; + } +} + + +void G1CollectedHeap::dirtyCardsForYoungRegions(CardTableModRefBS* ct_bs, HeapRegion* list) { + while (list != NULL) { + guarantee( list->is_young(), "invariant" ); + + HeapWord* bottom = list->bottom(); + HeapWord* end = list->end(); + MemRegion mr(bottom, end); + ct_bs->dirty(mr); + + list = list->get_next_young_region(); + } +} + +void G1CollectedHeap::cleanUpCardTable() { + CardTableModRefBS* ct_bs = (CardTableModRefBS*) (barrier_set()); + double start = os::elapsedTime(); + + ct_bs->clear(_g1_committed); + + // now, redirty the cards of the scan-only and survivor regions + // (it seemed faster to do it this way, instead of iterating over + // all regions and then clearing / dirtying as approprite) + dirtyCardsForYoungRegions(ct_bs, _young_list->first_scan_only_region()); + dirtyCardsForYoungRegions(ct_bs, _young_list->first_survivor_region()); + + double elapsed = os::elapsedTime() - start; + g1_policy()->record_clear_ct_time( elapsed * 1000.0); +} + + +void G1CollectedHeap::do_collection_pause_if_appropriate(size_t word_size) { + // First do any popular regions. + HeapRegion* hr; + while ((hr = popular_region_to_evac()) != NULL) { + evac_popular_region(hr); + } + // Now do heuristic pauses. + if (g1_policy()->should_do_collection_pause(word_size)) { + do_collection_pause(); + } +} + +void G1CollectedHeap::free_collection_set(HeapRegion* cs_head) { + double young_time_ms = 0.0; + double non_young_time_ms = 0.0; + + G1CollectorPolicy* policy = g1_policy(); + + double start_sec = os::elapsedTime(); + bool non_young = true; + + HeapRegion* cur = cs_head; + int age_bound = -1; + size_t rs_lengths = 0; + + while (cur != NULL) { + if (non_young) { + if (cur->is_young()) { + double end_sec = os::elapsedTime(); + double elapsed_ms = (end_sec - start_sec) * 1000.0; + non_young_time_ms += elapsed_ms; + + start_sec = os::elapsedTime(); + non_young = false; + } + } else { + if (!cur->is_on_free_list()) { + double end_sec = os::elapsedTime(); + double elapsed_ms = (end_sec - start_sec) * 1000.0; + young_time_ms += elapsed_ms; + + start_sec = os::elapsedTime(); + non_young = true; + } + } + + rs_lengths += cur->rem_set()->occupied(); + + HeapRegion* next = cur->next_in_collection_set(); + assert(cur->in_collection_set(), "bad CS"); + cur->set_next_in_collection_set(NULL); + cur->set_in_collection_set(false); + + if (cur->is_young()) { + int index = cur->young_index_in_cset(); + guarantee( index != -1, "invariant" ); + guarantee( (size_t)index < policy->young_cset_length(), "invariant" ); + size_t words_survived = _surviving_young_words[index]; + cur->record_surv_words_in_group(words_survived); + } else { + int index = cur->young_index_in_cset(); + guarantee( index == -1, "invariant" ); + } + + assert( (cur->is_young() && cur->young_index_in_cset() > -1) || + (!cur->is_young() && cur->young_index_in_cset() == -1), + "invariant" ); + + if (!cur->evacuation_failed()) { + // And the region is empty. + assert(!cur->is_empty(), + "Should not have empty regions in a CS."); + free_region(cur); + } else { + guarantee( !cur->is_scan_only(), "should not be scan only" ); + cur->uninstall_surv_rate_group(); + if (cur->is_young()) + cur->set_young_index_in_cset(-1); + cur->set_not_young(); + cur->set_evacuation_failed(false); + } + cur = next; + } + + policy->record_max_rs_lengths(rs_lengths); + policy->cset_regions_freed(); + + double end_sec = os::elapsedTime(); + double elapsed_ms = (end_sec - start_sec) * 1000.0; + if (non_young) + non_young_time_ms += elapsed_ms; + else + young_time_ms += elapsed_ms; + + policy->record_young_free_cset_time_ms(young_time_ms); + policy->record_non_young_free_cset_time_ms(non_young_time_ms); +} + +HeapRegion* +G1CollectedHeap::alloc_region_from_unclean_list_locked(bool zero_filled) { + assert(ZF_mon->owned_by_self(), "Precondition"); + HeapRegion* res = pop_unclean_region_list_locked(); + if (res != NULL) { + assert(!res->continuesHumongous() && + res->zero_fill_state() != HeapRegion::Allocated, + "Only free regions on unclean list."); + if (zero_filled) { + res->ensure_zero_filled_locked(); + res->set_zero_fill_allocated(); + } + } + return res; +} + +HeapRegion* G1CollectedHeap::alloc_region_from_unclean_list(bool zero_filled) { + MutexLockerEx zx(ZF_mon, Mutex::_no_safepoint_check_flag); + return alloc_region_from_unclean_list_locked(zero_filled); +} + +void G1CollectedHeap::put_region_on_unclean_list(HeapRegion* r) { + MutexLockerEx x(ZF_mon, Mutex::_no_safepoint_check_flag); + put_region_on_unclean_list_locked(r); + if (should_zf()) ZF_mon->notify_all(); // Wake up ZF thread. +} + +void G1CollectedHeap::set_unclean_regions_coming(bool b) { + MutexLockerEx x(Cleanup_mon); + set_unclean_regions_coming_locked(b); +} + +void G1CollectedHeap::set_unclean_regions_coming_locked(bool b) { + assert(Cleanup_mon->owned_by_self(), "Precondition"); + _unclean_regions_coming = b; + // Wake up mutator threads that might be waiting for completeCleanup to + // finish. + if (!b) Cleanup_mon->notify_all(); +} + +void G1CollectedHeap::wait_for_cleanup_complete() { + MutexLockerEx x(Cleanup_mon); + wait_for_cleanup_complete_locked(); +} + +void G1CollectedHeap::wait_for_cleanup_complete_locked() { + assert(Cleanup_mon->owned_by_self(), "precondition"); + while (_unclean_regions_coming) { + Cleanup_mon->wait(); + } +} + +void +G1CollectedHeap::put_region_on_unclean_list_locked(HeapRegion* r) { + assert(ZF_mon->owned_by_self(), "precondition."); + _unclean_region_list.insert_before_head(r); +} + +void +G1CollectedHeap::prepend_region_list_on_unclean_list(UncleanRegionList* list) { + MutexLockerEx x(ZF_mon, Mutex::_no_safepoint_check_flag); + prepend_region_list_on_unclean_list_locked(list); + if (should_zf()) ZF_mon->notify_all(); // Wake up ZF thread. +} + +void +G1CollectedHeap:: +prepend_region_list_on_unclean_list_locked(UncleanRegionList* list) { + assert(ZF_mon->owned_by_self(), "precondition."); + _unclean_region_list.prepend_list(list); +} + +HeapRegion* G1CollectedHeap::pop_unclean_region_list_locked() { + assert(ZF_mon->owned_by_self(), "precondition."); + HeapRegion* res = _unclean_region_list.pop(); + if (res != NULL) { + // Inform ZF thread that there's a new unclean head. + if (_unclean_region_list.hd() != NULL && should_zf()) + ZF_mon->notify_all(); + } + return res; +} + +HeapRegion* G1CollectedHeap::peek_unclean_region_list_locked() { + assert(ZF_mon->owned_by_self(), "precondition."); + return _unclean_region_list.hd(); +} + + +bool G1CollectedHeap::move_cleaned_region_to_free_list_locked() { + assert(ZF_mon->owned_by_self(), "Precondition"); + HeapRegion* r = peek_unclean_region_list_locked(); + if (r != NULL && r->zero_fill_state() == HeapRegion::ZeroFilled) { + // Result of below must be equal to "r", since we hold the lock. + (void)pop_unclean_region_list_locked(); + put_free_region_on_list_locked(r); + return true; + } else { + return false; + } +} + +bool G1CollectedHeap::move_cleaned_region_to_free_list() { + MutexLockerEx x(ZF_mon, Mutex::_no_safepoint_check_flag); + return move_cleaned_region_to_free_list_locked(); +} + + +void G1CollectedHeap::put_free_region_on_list_locked(HeapRegion* r) { + assert(ZF_mon->owned_by_self(), "precondition."); + assert(_free_region_list_size == free_region_list_length(), "Inv"); + assert(r->zero_fill_state() == HeapRegion::ZeroFilled, + "Regions on free list must be zero filled"); + assert(!r->isHumongous(), "Must not be humongous."); + assert(r->is_empty(), "Better be empty"); + assert(!r->is_on_free_list(), + "Better not already be on free list"); + assert(!r->is_on_unclean_list(), + "Better not already be on unclean list"); + r->set_on_free_list(true); + r->set_next_on_free_list(_free_region_list); + _free_region_list = r; + _free_region_list_size++; + assert(_free_region_list_size == free_region_list_length(), "Inv"); +} + +void G1CollectedHeap::put_free_region_on_list(HeapRegion* r) { + MutexLockerEx x(ZF_mon, Mutex::_no_safepoint_check_flag); + put_free_region_on_list_locked(r); +} + +HeapRegion* G1CollectedHeap::pop_free_region_list_locked() { + assert(ZF_mon->owned_by_self(), "precondition."); + assert(_free_region_list_size == free_region_list_length(), "Inv"); + HeapRegion* res = _free_region_list; + if (res != NULL) { + _free_region_list = res->next_from_free_list(); + _free_region_list_size--; + res->set_on_free_list(false); + res->set_next_on_free_list(NULL); + assert(_free_region_list_size == free_region_list_length(), "Inv"); + } + return res; +} + + +HeapRegion* G1CollectedHeap::alloc_free_region_from_lists(bool zero_filled) { + // By self, or on behalf of self. + assert(Heap_lock->is_locked(), "Precondition"); + HeapRegion* res = NULL; + bool first = true; + while (res == NULL) { + if (zero_filled || !first) { + MutexLockerEx x(ZF_mon, Mutex::_no_safepoint_check_flag); + res = pop_free_region_list_locked(); + if (res != NULL) { + assert(!res->zero_fill_is_allocated(), + "No allocated regions on free list."); + res->set_zero_fill_allocated(); + } else if (!first) { + break; // We tried both, time to return NULL. + } + } + + if (res == NULL) { + res = alloc_region_from_unclean_list(zero_filled); + } + assert(res == NULL || + !zero_filled || + res->zero_fill_is_allocated(), + "We must have allocated the region we're returning"); + first = false; + } + return res; +} + +void G1CollectedHeap::remove_allocated_regions_from_lists() { + MutexLockerEx x(ZF_mon, Mutex::_no_safepoint_check_flag); + { + HeapRegion* prev = NULL; + HeapRegion* cur = _unclean_region_list.hd(); + while (cur != NULL) { + HeapRegion* next = cur->next_from_unclean_list(); + if (cur->zero_fill_is_allocated()) { + // Remove from the list. + if (prev == NULL) { + (void)_unclean_region_list.pop(); + } else { + _unclean_region_list.delete_after(prev); + } + cur->set_on_unclean_list(false); + cur->set_next_on_unclean_list(NULL); + } else { + prev = cur; + } + cur = next; + } + assert(_unclean_region_list.sz() == unclean_region_list_length(), + "Inv"); + } + + { + HeapRegion* prev = NULL; + HeapRegion* cur = _free_region_list; + while (cur != NULL) { + HeapRegion* next = cur->next_from_free_list(); + if (cur->zero_fill_is_allocated()) { + // Remove from the list. + if (prev == NULL) { + _free_region_list = cur->next_from_free_list(); + } else { + prev->set_next_on_free_list(cur->next_from_free_list()); + } + cur->set_on_free_list(false); + cur->set_next_on_free_list(NULL); + _free_region_list_size--; + } else { + prev = cur; + } + cur = next; + } + assert(_free_region_list_size == free_region_list_length(), "Inv"); + } +} + +bool G1CollectedHeap::verify_region_lists() { + MutexLockerEx x(ZF_mon, Mutex::_no_safepoint_check_flag); + return verify_region_lists_locked(); +} + +bool G1CollectedHeap::verify_region_lists_locked() { + HeapRegion* unclean = _unclean_region_list.hd(); + while (unclean != NULL) { + guarantee(unclean->is_on_unclean_list(), "Well, it is!"); + guarantee(!unclean->is_on_free_list(), "Well, it shouldn't be!"); + guarantee(unclean->zero_fill_state() != HeapRegion::Allocated, + "Everything else is possible."); + unclean = unclean->next_from_unclean_list(); + } + guarantee(_unclean_region_list.sz() == unclean_region_list_length(), "Inv"); + + HeapRegion* free_r = _free_region_list; + while (free_r != NULL) { + assert(free_r->is_on_free_list(), "Well, it is!"); + assert(!free_r->is_on_unclean_list(), "Well, it shouldn't be!"); + switch (free_r->zero_fill_state()) { + case HeapRegion::NotZeroFilled: + case HeapRegion::ZeroFilling: + guarantee(false, "Should not be on free list."); + break; + default: + // Everything else is possible. + break; + } + free_r = free_r->next_from_free_list(); + } + guarantee(_free_region_list_size == free_region_list_length(), "Inv"); + // If we didn't do an assertion... + return true; +} + +size_t G1CollectedHeap::free_region_list_length() { + assert(ZF_mon->owned_by_self(), "precondition."); + size_t len = 0; + HeapRegion* cur = _free_region_list; + while (cur != NULL) { + len++; + cur = cur->next_from_free_list(); + } + return len; +} + +size_t G1CollectedHeap::unclean_region_list_length() { + assert(ZF_mon->owned_by_self(), "precondition."); + return _unclean_region_list.length(); +} + +size_t G1CollectedHeap::n_regions() { + return _hrs->length(); +} + +size_t G1CollectedHeap::max_regions() { + return + (size_t)align_size_up(g1_reserved_obj_bytes(), HeapRegion::GrainBytes) / + HeapRegion::GrainBytes; +} + +size_t G1CollectedHeap::free_regions() { + /* Possibly-expensive assert. + assert(_free_regions == count_free_regions(), + "_free_regions is off."); + */ + return _free_regions; +} + +bool G1CollectedHeap::should_zf() { + return _free_region_list_size < (size_t) G1ConcZFMaxRegions; +} + +class RegionCounter: public HeapRegionClosure { + size_t _n; +public: + RegionCounter() : _n(0) {} + bool doHeapRegion(HeapRegion* r) { + if (r->is_empty() && !r->popular()) { + assert(!r->isHumongous(), "H regions should not be empty."); + _n++; + } + return false; + } + int res() { return (int) _n; } +}; + +size_t G1CollectedHeap::count_free_regions() { + RegionCounter rc; + heap_region_iterate(&rc); + size_t n = rc.res(); + if (_cur_alloc_region != NULL && _cur_alloc_region->is_empty()) + n--; + return n; +} + +size_t G1CollectedHeap::count_free_regions_list() { + size_t n = 0; + size_t o = 0; + ZF_mon->lock_without_safepoint_check(); + HeapRegion* cur = _free_region_list; + while (cur != NULL) { + cur = cur->next_from_free_list(); + n++; + } + size_t m = unclean_region_list_length(); + ZF_mon->unlock(); + return n + m; +} + +bool G1CollectedHeap::should_set_young_locked() { + assert(heap_lock_held_for_gc(), + "the heap lock should already be held by or for this thread"); + return (g1_policy()->in_young_gc_mode() && + g1_policy()->should_add_next_region_to_young_list()); +} + +void G1CollectedHeap::set_region_short_lived_locked(HeapRegion* hr) { + assert(heap_lock_held_for_gc(), + "the heap lock should already be held by or for this thread"); + _young_list->push_region(hr); + g1_policy()->set_region_short_lived(hr); +} + +class NoYoungRegionsClosure: public HeapRegionClosure { +private: + bool _success; +public: + NoYoungRegionsClosure() : _success(true) { } + bool doHeapRegion(HeapRegion* r) { + if (r->is_young()) { + gclog_or_tty->print_cr("Region ["PTR_FORMAT", "PTR_FORMAT") tagged as young", + r->bottom(), r->end()); + _success = false; + } + return false; + } + bool success() { return _success; } +}; + +bool G1CollectedHeap::check_young_list_empty(bool ignore_scan_only_list, + bool check_sample) { + bool ret = true; + + ret = _young_list->check_list_empty(ignore_scan_only_list, check_sample); + if (!ignore_scan_only_list) { + NoYoungRegionsClosure closure; + heap_region_iterate(&closure); + ret = ret && closure.success(); + } + + return ret; +} + +void G1CollectedHeap::empty_young_list() { + assert(heap_lock_held_for_gc(), + "the heap lock should already be held by or for this thread"); + assert(g1_policy()->in_young_gc_mode(), "should be in young GC mode"); + + _young_list->empty_list(); +} + +bool G1CollectedHeap::all_alloc_regions_no_allocs_since_save_marks() { + bool no_allocs = true; + for (int ap = 0; ap < GCAllocPurposeCount && no_allocs; ++ap) { + HeapRegion* r = _gc_alloc_regions[ap]; + no_allocs = r == NULL || r->saved_mark_at_top(); + } + return no_allocs; +} + +void G1CollectedHeap::all_alloc_regions_note_end_of_copying() { + for (int ap = 0; ap < GCAllocPurposeCount; ++ap) { + HeapRegion* r = _gc_alloc_regions[ap]; + if (r != NULL) { + // Check for aliases. + bool has_processed_alias = false; + for (int i = 0; i < ap; ++i) { + if (_gc_alloc_regions[i] == r) { + has_processed_alias = true; + break; + } + } + if (!has_processed_alias) { + r->note_end_of_copying(); + g1_policy()->record_after_bytes(r->used()); + } + } + } +} + + +// Done at the start of full GC. +void G1CollectedHeap::tear_down_region_lists() { + MutexLockerEx x(ZF_mon, Mutex::_no_safepoint_check_flag); + while (pop_unclean_region_list_locked() != NULL) ; + assert(_unclean_region_list.hd() == NULL && _unclean_region_list.sz() == 0, + "Postconditions of loop.") + while (pop_free_region_list_locked() != NULL) ; + assert(_free_region_list == NULL, "Postcondition of loop."); + if (_free_region_list_size != 0) { + gclog_or_tty->print_cr("Size is %d.", _free_region_list_size); + print(); + } + assert(_free_region_list_size == 0, "Postconditions of loop."); +} + + +class RegionResetter: public HeapRegionClosure { + G1CollectedHeap* _g1; + int _n; +public: + RegionResetter() : _g1(G1CollectedHeap::heap()), _n(0) {} + bool doHeapRegion(HeapRegion* r) { + if (r->continuesHumongous()) return false; + if (r->top() > r->bottom()) { + if (r->top() < r->end()) { + Copy::fill_to_words(r->top(), + pointer_delta(r->end(), r->top())); + } + r->set_zero_fill_allocated(); + } else { + assert(r->is_empty(), "tautology"); + if (r->popular()) { + if (r->zero_fill_state() != HeapRegion::Allocated) { + r->ensure_zero_filled_locked(); + r->set_zero_fill_allocated(); + } + } else { + _n++; + switch (r->zero_fill_state()) { + case HeapRegion::NotZeroFilled: + case HeapRegion::ZeroFilling: + _g1->put_region_on_unclean_list_locked(r); + break; + case HeapRegion::Allocated: + r->set_zero_fill_complete(); + // no break; go on to put on free list. + case HeapRegion::ZeroFilled: + _g1->put_free_region_on_list_locked(r); + break; + } + } + } + return false; + } + + int getFreeRegionCount() {return _n;} +}; + +// Done at the end of full GC. +void G1CollectedHeap::rebuild_region_lists() { + MutexLockerEx x(ZF_mon, Mutex::_no_safepoint_check_flag); + // This needs to go at the end of the full GC. + RegionResetter rs; + heap_region_iterate(&rs); + _free_regions = rs.getFreeRegionCount(); + // Tell the ZF thread it may have work to do. + if (should_zf()) ZF_mon->notify_all(); +} + +class UsedRegionsNeedZeroFillSetter: public HeapRegionClosure { + G1CollectedHeap* _g1; + int _n; +public: + UsedRegionsNeedZeroFillSetter() : _g1(G1CollectedHeap::heap()), _n(0) {} + bool doHeapRegion(HeapRegion* r) { + if (r->continuesHumongous()) return false; + if (r->top() > r->bottom()) { + // There are assertions in "set_zero_fill_needed()" below that + // require top() == bottom(), so this is technically illegal. + // We'll skirt the law here, by making that true temporarily. + DEBUG_ONLY(HeapWord* save_top = r->top(); + r->set_top(r->bottom())); + r->set_zero_fill_needed(); + DEBUG_ONLY(r->set_top(save_top)); + } + return false; + } +}; + +// Done at the start of full GC. +void G1CollectedHeap::set_used_regions_to_need_zero_fill() { + MutexLockerEx x(ZF_mon, Mutex::_no_safepoint_check_flag); + // This needs to go at the end of the full GC. + UsedRegionsNeedZeroFillSetter rs; + heap_region_iterate(&rs); +} + +class CountObjClosure: public ObjectClosure { + size_t _n; +public: + CountObjClosure() : _n(0) {} + void do_object(oop obj) { _n++; } + size_t n() { return _n; } +}; + +size_t G1CollectedHeap::pop_object_used_objs() { + size_t sum_objs = 0; + for (int i = 0; i < G1NumPopularRegions; i++) { + CountObjClosure cl; + _hrs->at(i)->object_iterate(&cl); + sum_objs += cl.n(); + } + return sum_objs; +} + +size_t G1CollectedHeap::pop_object_used_bytes() { + size_t sum_bytes = 0; + for (int i = 0; i < G1NumPopularRegions; i++) { + sum_bytes += _hrs->at(i)->used(); + } + return sum_bytes; +} + + +static int nq = 0; + +HeapWord* G1CollectedHeap::allocate_popular_object(size_t word_size) { + while (_cur_pop_hr_index < G1NumPopularRegions) { + HeapRegion* cur_pop_region = _hrs->at(_cur_pop_hr_index); + HeapWord* res = cur_pop_region->allocate(word_size); + if (res != NULL) { + // We account for popular objs directly in the used summary: + _summary_bytes_used += (word_size * HeapWordSize); + return res; + } + // Otherwise, try the next region (first making sure that we remember + // the last "top" value as the "next_top_at_mark_start", so that + // objects made popular during markings aren't automatically considered + // live). + cur_pop_region->note_end_of_copying(); + // Otherwise, try the next region. + _cur_pop_hr_index++; + } + // XXX: For now !!! + vm_exit_out_of_memory(word_size, + "Not enough pop obj space (To Be Fixed)"); + return NULL; +} + +class HeapRegionList: public CHeapObj { + public: + HeapRegion* hr; + HeapRegionList* next; +}; + +void G1CollectedHeap::schedule_popular_region_evac(HeapRegion* r) { + // This might happen during parallel GC, so protect by this lock. + MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag); + // We don't schedule regions whose evacuations are already pending, or + // are already being evacuated. + if (!r->popular_pending() && !r->in_collection_set()) { + r->set_popular_pending(true); + if (G1TracePopularity) { + gclog_or_tty->print_cr("Scheduling region "PTR_FORMAT" " + "["PTR_FORMAT", "PTR_FORMAT") for pop-object evacuation.", + r, r->bottom(), r->end()); + } + HeapRegionList* hrl = new HeapRegionList; + hrl->hr = r; + hrl->next = _popular_regions_to_be_evacuated; + _popular_regions_to_be_evacuated = hrl; + } +} + +HeapRegion* G1CollectedHeap::popular_region_to_evac() { + MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag); + HeapRegion* res = NULL; + while (_popular_regions_to_be_evacuated != NULL && res == NULL) { + HeapRegionList* hrl = _popular_regions_to_be_evacuated; + _popular_regions_to_be_evacuated = hrl->next; + res = hrl->hr; + // The G1RSPopLimit may have increased, so recheck here... + if (res->rem_set()->occupied() < (size_t) G1RSPopLimit) { + // Hah: don't need to schedule. + if (G1TracePopularity) { + gclog_or_tty->print_cr("Unscheduling region "PTR_FORMAT" " + "["PTR_FORMAT", "PTR_FORMAT") " + "for pop-object evacuation (size %d < limit %d)", + res, res->bottom(), res->end(), + res->rem_set()->occupied(), G1RSPopLimit); + } + res->set_popular_pending(false); + res = NULL; + } + // We do not reset res->popular() here; if we did so, it would allow + // the region to be "rescheduled" for popularity evacuation. Instead, + // this is done in the collection pause, with the world stopped. + // So the invariant is that the regions in the list have the popularity + // boolean set, but having the boolean set does not imply membership + // on the list (though there can at most one such pop-pending region + // not on the list at any time). + delete hrl; + } + return res; +} + +void G1CollectedHeap::evac_popular_region(HeapRegion* hr) { + while (true) { + // Don't want to do a GC pause while cleanup is being completed! + wait_for_cleanup_complete(); + + // Read the GC count while holding the Heap_lock + int gc_count_before = SharedHeap::heap()->total_collections(); + g1_policy()->record_stop_world_start(); + + { + MutexUnlocker mu(Heap_lock); // give up heap lock, execute gets it back + VM_G1PopRegionCollectionPause op(gc_count_before, hr); + VMThread::execute(&op); + + // If the prolog succeeded, we didn't do a GC for this. + if (op.prologue_succeeded()) break; + } + // Otherwise we didn't. We should recheck the size, though, since + // the limit may have increased... + if (hr->rem_set()->occupied() < (size_t) G1RSPopLimit) { + hr->set_popular_pending(false); + break; + } + } +} + +void G1CollectedHeap::atomic_inc_obj_rc(oop obj) { + Atomic::inc(obj_rc_addr(obj)); +} + +class CountRCClosure: public OopsInHeapRegionClosure { + G1CollectedHeap* _g1h; + bool _parallel; +public: + CountRCClosure(G1CollectedHeap* g1h) : + _g1h(g1h), _parallel(ParallelGCThreads > 0) + {} + void do_oop(narrowOop* p) { + guarantee(false, "NYI"); + } + void do_oop(oop* p) { + oop obj = *p; + assert(obj != NULL, "Precondition."); + if (_parallel) { + // We go sticky at the limit to avoid excess contention. + // If we want to track the actual RC's further, we'll need to keep a + // per-thread hash table or something for the popular objects. + if (_g1h->obj_rc(obj) < G1ObjPopLimit) { + _g1h->atomic_inc_obj_rc(obj); + } + } else { + _g1h->inc_obj_rc(obj); + } + } +}; + +class EvacPopObjClosure: public ObjectClosure { + G1CollectedHeap* _g1h; + size_t _pop_objs; + size_t _max_rc; +public: + EvacPopObjClosure(G1CollectedHeap* g1h) : + _g1h(g1h), _pop_objs(0), _max_rc(0) {} + + void do_object(oop obj) { + size_t rc = _g1h->obj_rc(obj); + _max_rc = MAX2(rc, _max_rc); + if (rc >= (size_t) G1ObjPopLimit) { + _g1h->_pop_obj_rc_at_copy.add((double)rc); + size_t word_sz = obj->size(); + HeapWord* new_pop_loc = _g1h->allocate_popular_object(word_sz); + oop new_pop_obj = (oop)new_pop_loc; + Copy::aligned_disjoint_words((HeapWord*)obj, new_pop_loc, word_sz); + obj->forward_to(new_pop_obj); + G1ScanAndBalanceClosure scan_and_balance(_g1h); + new_pop_obj->oop_iterate_backwards(&scan_and_balance); + // preserve "next" mark bit if marking is in progress. + if (_g1h->mark_in_progress() && !_g1h->is_obj_ill(obj)) { + _g1h->concurrent_mark()->markAndGrayObjectIfNecessary(new_pop_obj); + } + + if (G1TracePopularity) { + gclog_or_tty->print_cr("Found obj " PTR_FORMAT " of word size " SIZE_FORMAT + " pop (%d), move to " PTR_FORMAT, + (void*) obj, word_sz, + _g1h->obj_rc(obj), (void*) new_pop_obj); + } + _pop_objs++; + } + } + size_t pop_objs() { return _pop_objs; } + size_t max_rc() { return _max_rc; } +}; + +class G1ParCountRCTask : public AbstractGangTask { + G1CollectedHeap* _g1h; + BitMap _bm; + + size_t getNCards() { + return (_g1h->capacity() + G1BlockOffsetSharedArray::N_bytes - 1) + / G1BlockOffsetSharedArray::N_bytes; + } + CountRCClosure _count_rc_closure; +public: + G1ParCountRCTask(G1CollectedHeap* g1h) : + AbstractGangTask("G1 Par RC Count task"), + _g1h(g1h), _bm(getNCards()), _count_rc_closure(g1h) + {} + + void work(int i) { + ResourceMark rm; + HandleMark hm; + _g1h->g1_rem_set()->oops_into_collection_set_do(&_count_rc_closure, i); + } +}; + +void G1CollectedHeap::popularity_pause_preamble(HeapRegion* popular_region) { + // We're evacuating a single region (for popularity). + if (G1TracePopularity) { + gclog_or_tty->print_cr("Doing pop region pause for ["PTR_FORMAT", "PTR_FORMAT")", + popular_region->bottom(), popular_region->end()); + } + g1_policy()->set_single_region_collection_set(popular_region); + size_t max_rc; + if (!compute_reference_counts_and_evac_popular(popular_region, + &max_rc)) { + // We didn't evacuate any popular objects. + // We increase the RS popularity limit, to prevent this from + // happening in the future. + if (G1RSPopLimit < (1 << 30)) { + G1RSPopLimit *= 2; + } + // For now, interesting enough for a message: +#if 1 + gclog_or_tty->print_cr("In pop region pause for ["PTR_FORMAT", "PTR_FORMAT"), " + "failed to find a pop object (max = %d).", + popular_region->bottom(), popular_region->end(), + max_rc); + gclog_or_tty->print_cr("Increased G1RSPopLimit to %d.", G1RSPopLimit); +#endif // 0 + // Also, we reset the collection set to NULL, to make the rest of + // the collection do nothing. + assert(popular_region->next_in_collection_set() == NULL, + "should be single-region."); + popular_region->set_in_collection_set(false); + popular_region->set_popular_pending(false); + g1_policy()->clear_collection_set(); + } +} + +bool G1CollectedHeap:: +compute_reference_counts_and_evac_popular(HeapRegion* popular_region, + size_t* max_rc) { + HeapWord* rc_region_bot; + HeapWord* rc_region_end; + + // Set up the reference count region. + HeapRegion* rc_region = newAllocRegion(HeapRegion::GrainWords); + if (rc_region != NULL) { + rc_region_bot = rc_region->bottom(); + rc_region_end = rc_region->end(); + } else { + rc_region_bot = NEW_C_HEAP_ARRAY(HeapWord, HeapRegion::GrainWords); + if (rc_region_bot == NULL) { + vm_exit_out_of_memory(HeapRegion::GrainWords, + "No space for RC region."); + } + rc_region_end = rc_region_bot + HeapRegion::GrainWords; + } + + if (G1TracePopularity) + gclog_or_tty->print_cr("RC region is ["PTR_FORMAT", "PTR_FORMAT")", + rc_region_bot, rc_region_end); + if (rc_region_bot > popular_region->bottom()) { + _rc_region_above = true; + _rc_region_diff = + pointer_delta(rc_region_bot, popular_region->bottom(), 1); + } else { + assert(rc_region_bot < popular_region->bottom(), "Can't be equal."); + _rc_region_above = false; + _rc_region_diff = + pointer_delta(popular_region->bottom(), rc_region_bot, 1); + } + g1_policy()->record_pop_compute_rc_start(); + // Count external references. + g1_rem_set()->prepare_for_oops_into_collection_set_do(); + if (ParallelGCThreads > 0) { + + set_par_threads(workers()->total_workers()); + G1ParCountRCTask par_count_rc_task(this); + workers()->run_task(&par_count_rc_task); + set_par_threads(0); + + } else { + CountRCClosure count_rc_closure(this); + g1_rem_set()->oops_into_collection_set_do(&count_rc_closure, 0); + } + g1_rem_set()->cleanup_after_oops_into_collection_set_do(); + g1_policy()->record_pop_compute_rc_end(); + + // Now evacuate popular objects. + g1_policy()->record_pop_evac_start(); + EvacPopObjClosure evac_pop_obj_cl(this); + popular_region->object_iterate(&evac_pop_obj_cl); + *max_rc = evac_pop_obj_cl.max_rc(); + + // Make sure the last "top" value of the current popular region is copied + // as the "next_top_at_mark_start", so that objects made popular during + // markings aren't automatically considered live. + HeapRegion* cur_pop_region = _hrs->at(_cur_pop_hr_index); + cur_pop_region->note_end_of_copying(); + + if (rc_region != NULL) { + free_region(rc_region); + } else { + FREE_C_HEAP_ARRAY(HeapWord, rc_region_bot); + } + g1_policy()->record_pop_evac_end(); + + return evac_pop_obj_cl.pop_objs() > 0; +} + +class CountPopObjInfoClosure: public HeapRegionClosure { + size_t _objs; + size_t _bytes; + + class CountObjClosure: public ObjectClosure { + int _n; + public: + CountObjClosure() : _n(0) {} + void do_object(oop obj) { _n++; } + size_t n() { return _n; } + }; + +public: + CountPopObjInfoClosure() : _objs(0), _bytes(0) {} + bool doHeapRegion(HeapRegion* r) { + _bytes += r->used(); + CountObjClosure blk; + r->object_iterate(&blk); + _objs += blk.n(); + return false; + } + size_t objs() { return _objs; } + size_t bytes() { return _bytes; } +}; + + +void G1CollectedHeap::print_popularity_summary_info() const { + CountPopObjInfoClosure blk; + for (int i = 0; i <= _cur_pop_hr_index; i++) { + blk.doHeapRegion(_hrs->at(i)); + } + gclog_or_tty->print_cr("\nPopular objects: %d objs, %d bytes.", + blk.objs(), blk.bytes()); + gclog_or_tty->print_cr(" RC at copy = [avg = %5.2f, max = %5.2f, sd = %5.2f].", + _pop_obj_rc_at_copy.avg(), + _pop_obj_rc_at_copy.maximum(), + _pop_obj_rc_at_copy.sd()); +} + +void G1CollectedHeap::set_refine_cte_cl_concurrency(bool concurrent) { + _refine_cte_cl->set_concurrent(concurrent); +} + +#ifndef PRODUCT + +class PrintHeapRegionClosure: public HeapRegionClosure { +public: + bool doHeapRegion(HeapRegion *r) { + gclog_or_tty->print("Region: "PTR_FORMAT":", r); + if (r != NULL) { + if (r->is_on_free_list()) + gclog_or_tty->print("Free "); + if (r->is_young()) + gclog_or_tty->print("Young "); + if (r->isHumongous()) + gclog_or_tty->print("Is Humongous "); + r->print(); + } + return false; + } +}; + +class SortHeapRegionClosure : public HeapRegionClosure { + size_t young_regions,free_regions, unclean_regions; + size_t hum_regions, count; + size_t unaccounted, cur_unclean, cur_alloc; + size_t total_free; + HeapRegion* cur; +public: + SortHeapRegionClosure(HeapRegion *_cur) : cur(_cur), young_regions(0), + free_regions(0), unclean_regions(0), + hum_regions(0), + count(0), unaccounted(0), + cur_alloc(0), total_free(0) + {} + bool doHeapRegion(HeapRegion *r) { + count++; + if (r->is_on_free_list()) free_regions++; + else if (r->is_on_unclean_list()) unclean_regions++; + else if (r->isHumongous()) hum_regions++; + else if (r->is_young()) young_regions++; + else if (r == cur) cur_alloc++; + else unaccounted++; + return false; + } + void print() { + total_free = free_regions + unclean_regions; + gclog_or_tty->print("%d regions\n", count); + gclog_or_tty->print("%d free: free_list = %d unclean = %d\n", + total_free, free_regions, unclean_regions); + gclog_or_tty->print("%d humongous %d young\n", + hum_regions, young_regions); + gclog_or_tty->print("%d cur_alloc\n", cur_alloc); + gclog_or_tty->print("UHOH unaccounted = %d\n", unaccounted); + } +}; + +void G1CollectedHeap::print_region_counts() { + SortHeapRegionClosure sc(_cur_alloc_region); + PrintHeapRegionClosure cl; + heap_region_iterate(&cl); + heap_region_iterate(&sc); + sc.print(); + print_region_accounting_info(); +}; + +bool G1CollectedHeap::regions_accounted_for() { + // TODO: regions accounting for young/survivor/tenured + return true; +} + +bool G1CollectedHeap::print_region_accounting_info() { + gclog_or_tty->print_cr("P regions: %d.", G1NumPopularRegions); + gclog_or_tty->print_cr("Free regions: %d (count: %d count list %d) (clean: %d unclean: %d).", + free_regions(), + count_free_regions(), count_free_regions_list(), + _free_region_list_size, _unclean_region_list.sz()); + gclog_or_tty->print_cr("cur_alloc: %d.", + (_cur_alloc_region == NULL ? 0 : 1)); + gclog_or_tty->print_cr("H regions: %d.", _num_humongous_regions); + + // TODO: check regions accounting for young/survivor/tenured + return true; +} + +bool G1CollectedHeap::is_in_closed_subset(const void* p) const { + HeapRegion* hr = heap_region_containing(p); + if (hr == NULL) { + return is_in_permanent(p); + } else { + return hr->is_in(p); + } +} +#endif // PRODUCT + +void G1CollectedHeap::g1_unimplemented() { + // Unimplemented(); +} + + +// Local Variables: *** +// c-indentation-style: gnu *** +// End: *** diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp new file mode 100644 index 00000000000..4cc1db22d50 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp @@ -0,0 +1,1191 @@ +/* + * Copyright 2001-2007 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. + * + */ + +// A "G1CollectedHeap" is an implementation of a java heap for HotSpot. +// It uses the "Garbage First" heap organization and algorithm, which +// may combine concurrent marking with parallel, incremental compaction of +// heap subsets that will yield large amounts of garbage. + +class HeapRegion; +class HeapRegionSeq; +class HeapRegionList; +class PermanentGenerationSpec; +class GenerationSpec; +class OopsInHeapRegionClosure; +class G1ScanHeapEvacClosure; +class ObjectClosure; +class SpaceClosure; +class CompactibleSpaceClosure; +class Space; +class G1CollectorPolicy; +class GenRemSet; +class G1RemSet; +class HeapRegionRemSetIterator; +class ConcurrentMark; +class ConcurrentMarkThread; +class ConcurrentG1Refine; +class ConcurrentZFThread; + +// If want to accumulate detailed statistics on work queues +// turn this on. +#define G1_DETAILED_STATS 0 + +#if G1_DETAILED_STATS +# define IF_G1_DETAILED_STATS(code) code +#else +# define IF_G1_DETAILED_STATS(code) +#endif + +typedef GenericTaskQueue RefToScanQueue; +typedef GenericTaskQueueSet RefToScanQueueSet; + +enum G1GCThreadGroups { + G1CRGroup = 0, + G1ZFGroup = 1, + G1CMGroup = 2, + G1CLGroup = 3 +}; + +enum GCAllocPurpose { + GCAllocForTenured, + GCAllocForSurvived, + GCAllocPurposeCount +}; + +class YoungList : public CHeapObj { +private: + G1CollectedHeap* _g1h; + + HeapRegion* _head; + + HeapRegion* _scan_only_head; + HeapRegion* _scan_only_tail; + size_t _length; + size_t _scan_only_length; + + size_t _last_sampled_rs_lengths; + size_t _sampled_rs_lengths; + HeapRegion* _curr; + HeapRegion* _curr_scan_only; + + HeapRegion* _survivor_head; + HeapRegion* _survivors_tail; + size_t _survivor_length; + + void empty_list(HeapRegion* list); + +public: + YoungList(G1CollectedHeap* g1h); + + void push_region(HeapRegion* hr); + void add_survivor_region(HeapRegion* hr); + HeapRegion* pop_region(); + void empty_list(); + bool is_empty() { return _length == 0; } + size_t length() { return _length; } + size_t scan_only_length() { return _scan_only_length; } + + void rs_length_sampling_init(); + bool rs_length_sampling_more(); + void rs_length_sampling_next(); + + void reset_sampled_info() { + _last_sampled_rs_lengths = 0; + } + size_t sampled_rs_lengths() { return _last_sampled_rs_lengths; } + + // for development purposes + void reset_auxilary_lists(); + HeapRegion* first_region() { return _head; } + HeapRegion* first_scan_only_region() { return _scan_only_head; } + HeapRegion* first_survivor_region() { return _survivor_head; } + HeapRegion* par_get_next_scan_only_region() { + MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag); + HeapRegion* ret = _curr_scan_only; + if (ret != NULL) + _curr_scan_only = ret->get_next_young_region(); + return ret; + } + + // debugging + bool check_list_well_formed(); + bool check_list_empty(bool ignore_scan_only_list, + bool check_sample = true); + void print(); +}; + +class RefineCardTableEntryClosure; +class G1CollectedHeap : public SharedHeap { + friend class VM_G1CollectForAllocation; + friend class VM_GenCollectForPermanentAllocation; + friend class VM_G1CollectFull; + friend class VM_G1IncCollectionPause; + friend class VM_G1PopRegionCollectionPause; + friend class VMStructs; + + // Closures used in implementation. + friend class G1ParCopyHelper; + friend class G1IsAliveClosure; + friend class G1EvacuateFollowersClosure; + friend class G1ParScanThreadState; + friend class G1ParScanClosureSuper; + friend class G1ParEvacuateFollowersClosure; + friend class G1ParTask; + friend class G1FreeGarbageRegionClosure; + friend class RefineCardTableEntryClosure; + friend class G1PrepareCompactClosure; + friend class RegionSorter; + friend class CountRCClosure; + friend class EvacPopObjClosure; + + // Other related classes. + friend class G1MarkSweep; + +private: + enum SomePrivateConstants { + VeryLargeInBytes = HeapRegion::GrainBytes/2, + VeryLargeInWords = VeryLargeInBytes/HeapWordSize, + MinHeapDeltaBytes = 10 * HeapRegion::GrainBytes, // FIXME + NumAPIs = HeapRegion::MaxAge + }; + + + // The one and only G1CollectedHeap, so static functions can find it. + static G1CollectedHeap* _g1h; + + // Storage for the G1 heap (excludes the permanent generation). + VirtualSpace _g1_storage; + MemRegion _g1_reserved; + + // The part of _g1_storage that is currently committed. + MemRegion _g1_committed; + + // The maximum part of _g1_storage that has ever been committed. + MemRegion _g1_max_committed; + + // The number of regions that are completely free. + size_t _free_regions; + + // The number of regions we could create by expansion. + size_t _expansion_regions; + + // Return the number of free regions in the heap (by direct counting.) + size_t count_free_regions(); + // Return the number of free regions on the free and unclean lists. + size_t count_free_regions_list(); + + // The block offset table for the G1 heap. + G1BlockOffsetSharedArray* _bot_shared; + + // Move all of the regions off the free lists, then rebuild those free + // lists, before and after full GC. + void tear_down_region_lists(); + void rebuild_region_lists(); + // This sets all non-empty regions to need zero-fill (which they will if + // they are empty after full collection.) + void set_used_regions_to_need_zero_fill(); + + // The sequence of all heap regions in the heap. + HeapRegionSeq* _hrs; + + // The region from which normal-sized objects are currently being + // allocated. May be NULL. + HeapRegion* _cur_alloc_region; + + // Postcondition: cur_alloc_region == NULL. + void abandon_cur_alloc_region(); + + // The to-space memory regions into which objects are being copied during + // a GC. + HeapRegion* _gc_alloc_regions[GCAllocPurposeCount]; + uint _gc_alloc_region_counts[GCAllocPurposeCount]; + + // A list of the regions that have been set to be alloc regions in the + // current collection. + HeapRegion* _gc_alloc_region_list; + + // When called by par thread, require par_alloc_during_gc_lock() to be held. + void push_gc_alloc_region(HeapRegion* hr); + + // This should only be called single-threaded. Undeclares all GC alloc + // regions. + void forget_alloc_region_list(); + + // Should be used to set an alloc region, because there's other + // associated bookkeeping. + void set_gc_alloc_region(int purpose, HeapRegion* r); + + // Check well-formedness of alloc region list. + bool check_gc_alloc_regions(); + + // Outside of GC pauses, the number of bytes used in all regions other + // than the current allocation region. + size_t _summary_bytes_used; + + // Summary information about popular objects; method to print it. + NumberSeq _pop_obj_rc_at_copy; + void print_popularity_summary_info() const; + + unsigned _gc_time_stamp; + + size_t* _surviving_young_words; + + void setup_surviving_young_words(); + void update_surviving_young_words(size_t* surv_young_words); + void cleanup_surviving_young_words(); + +protected: + + // Returns "true" iff none of the gc alloc regions have any allocations + // since the last call to "save_marks". + bool all_alloc_regions_no_allocs_since_save_marks(); + // Calls "note_end_of_copying on all gc alloc_regions. + void all_alloc_regions_note_end_of_copying(); + + // The number of regions allocated to hold humongous objects. + int _num_humongous_regions; + YoungList* _young_list; + + // The current policy object for the collector. + G1CollectorPolicy* _g1_policy; + + // Parallel allocation lock to protect the current allocation region. + Mutex _par_alloc_during_gc_lock; + Mutex* par_alloc_during_gc_lock() { return &_par_alloc_during_gc_lock; } + + // If possible/desirable, allocate a new HeapRegion for normal object + // allocation sufficient for an allocation of the given "word_size". + // If "do_expand" is true, will attempt to expand the heap if necessary + // to to satisfy the request. If "zero_filled" is true, requires a + // zero-filled region. + // (Returning NULL will trigger a GC.) + virtual HeapRegion* newAllocRegion_work(size_t word_size, + bool do_expand, + bool zero_filled); + + virtual HeapRegion* newAllocRegion(size_t word_size, + bool zero_filled = true) { + return newAllocRegion_work(word_size, false, zero_filled); + } + virtual HeapRegion* newAllocRegionWithExpansion(int purpose, + size_t word_size, + bool zero_filled = true); + + // Attempt to allocate an object of the given (very large) "word_size". + // Returns "NULL" on failure. + virtual HeapWord* humongousObjAllocate(size_t word_size); + + // If possible, allocate a block of the given word_size, else return "NULL". + // Returning NULL will trigger GC or heap expansion. + // These two methods have rather awkward pre- and + // post-conditions. If they are called outside a safepoint, then + // they assume that the caller is holding the heap lock. Upon return + // they release the heap lock, if they are returning a non-NULL + // value. attempt_allocation_slow() also dirties the cards of a + // newly-allocated young region after it releases the heap + // lock. This change in interface was the neatest way to achieve + // this card dirtying without affecting mem_allocate(), which is a + // more frequently called method. We tried two or three different + // approaches, but they were even more hacky. + HeapWord* attempt_allocation(size_t word_size, + bool permit_collection_pause = true); + + HeapWord* attempt_allocation_slow(size_t word_size, + bool permit_collection_pause = true); + + // Allocate blocks during garbage collection. Will ensure an + // allocation region, either by picking one or expanding the + // heap, and then allocate a block of the given size. The block + // may not be a humongous - it must fit into a single heap region. + HeapWord* allocate_during_gc(GCAllocPurpose purpose, size_t word_size); + HeapWord* par_allocate_during_gc(GCAllocPurpose purpose, size_t word_size); + + HeapWord* allocate_during_gc_slow(GCAllocPurpose purpose, + HeapRegion* alloc_region, + bool par, + size_t word_size); + + // Ensure that no further allocations can happen in "r", bearing in mind + // that parallel threads might be attempting allocations. + void par_allocate_remaining_space(HeapRegion* r); + + // Helper function for two callbacks below. + // "full", if true, indicates that the GC is for a System.gc() request, + // and should collect the entire heap. If "clear_all_soft_refs" is true, + // all soft references are cleared during the GC. If "full" is false, + // "word_size" describes the allocation that the GC should + // attempt (at least) to satisfy. + void do_collection(bool full, bool clear_all_soft_refs, + size_t word_size); + + // Callback from VM_G1CollectFull operation. + // Perform a full collection. + void do_full_collection(bool clear_all_soft_refs); + + // Resize the heap if necessary after a full collection. If this is + // after a collect-for allocation, "word_size" is the allocation size, + // and will be considered part of the used portion of the heap. + void resize_if_necessary_after_full_collection(size_t word_size); + + // Callback from VM_G1CollectForAllocation operation. + // This function does everything necessary/possible to satisfy a + // failed allocation request (including collection, expansion, etc.) + HeapWord* satisfy_failed_allocation(size_t word_size); + + // Attempting to expand the heap sufficiently + // to support an allocation of the given "word_size". If + // successful, perform the allocation and return the address of the + // allocated block, or else "NULL". + virtual HeapWord* expand_and_allocate(size_t word_size); + +public: + // Expand the garbage-first heap by at least the given size (in bytes!). + // (Rounds up to a HeapRegion boundary.) + virtual void expand(size_t expand_bytes); + + // Do anything common to GC's. + virtual void gc_prologue(bool full); + virtual void gc_epilogue(bool full); + +protected: + + // Shrink the garbage-first heap by at most the given size (in bytes!). + // (Rounds down to a HeapRegion boundary.) + virtual void shrink(size_t expand_bytes); + void shrink_helper(size_t expand_bytes); + + // Do an incremental collection: identify a collection set, and evacuate + // its live objects elsewhere. + virtual void do_collection_pause(); + + // The guts of the incremental collection pause, executed by the vm + // thread. If "popular_region" is non-NULL, this pause should evacuate + // this single region whose remembered set has gotten large, moving + // any popular objects to one of the popular regions. + virtual void do_collection_pause_at_safepoint(HeapRegion* popular_region); + + // Actually do the work of evacuating the collection set. + virtual void evacuate_collection_set(); + + // If this is an appropriate right time, do a collection pause. + // The "word_size" argument, if non-zero, indicates the size of an + // allocation request that is prompting this query. + void do_collection_pause_if_appropriate(size_t word_size); + + // The g1 remembered set of the heap. + G1RemSet* _g1_rem_set; + // And it's mod ref barrier set, used to track updates for the above. + ModRefBarrierSet* _mr_bs; + + // The Heap Region Rem Set Iterator. + HeapRegionRemSetIterator** _rem_set_iterator; + + // The closure used to refine a single card. + RefineCardTableEntryClosure* _refine_cte_cl; + + // A function to check the consistency of dirty card logs. + void check_ct_logs_at_safepoint(); + + // After a collection pause, make the regions in the CS into free + // regions. + void free_collection_set(HeapRegion* cs_head); + + // Applies "scan_non_heap_roots" to roots outside the heap, + // "scan_rs" to roots inside the heap (having done "set_region" to + // indicate the region in which the root resides), and does "scan_perm" + // (setting the generation to the perm generation.) If "scan_rs" is + // NULL, then this step is skipped. The "worker_i" + // param is for use with parallel roots processing, and should be + // the "i" of the calling parallel worker thread's work(i) function. + // In the sequential case this param will be ignored. + void g1_process_strong_roots(bool collecting_perm_gen, + SharedHeap::ScanningOption so, + OopClosure* scan_non_heap_roots, + OopsInHeapRegionClosure* scan_rs, + OopsInHeapRegionClosure* scan_so, + OopsInGenClosure* scan_perm, + int worker_i); + + void scan_scan_only_set(OopsInHeapRegionClosure* oc, + int worker_i); + void scan_scan_only_region(HeapRegion* hr, + OopsInHeapRegionClosure* oc, + int worker_i); + + // Apply "blk" to all the weak roots of the system. These include + // JNI weak roots, the code cache, system dictionary, symbol table, + // string table, and referents of reachable weak refs. + void g1_process_weak_roots(OopClosure* root_closure, + OopClosure* non_root_closure); + + // Invoke "save_marks" on all heap regions. + void save_marks(); + + // Free a heap region. + void free_region(HeapRegion* hr); + // A component of "free_region", exposed for 'batching'. + // All the params after "hr" are out params: the used bytes of the freed + // region(s), the number of H regions cleared, the number of regions + // freed, and pointers to the head and tail of a list of freed contig + // regions, linked throught the "next_on_unclean_list" field. + void free_region_work(HeapRegion* hr, + size_t& pre_used, + size_t& cleared_h, + size_t& freed_regions, + UncleanRegionList* list, + bool par = false); + + + // The concurrent marker (and the thread it runs in.) + ConcurrentMark* _cm; + ConcurrentMarkThread* _cmThread; + bool _mark_in_progress; + + // The concurrent refiner. + ConcurrentG1Refine* _cg1r; + + // The concurrent zero-fill thread. + ConcurrentZFThread* _czft; + + // The parallel task queues + RefToScanQueueSet *_task_queues; + + // True iff a evacuation has failed in the current collection. + bool _evacuation_failed; + + // Set the attribute indicating whether evacuation has failed in the + // current collection. + void set_evacuation_failed(bool b) { _evacuation_failed = b; } + + // Failed evacuations cause some logical from-space objects to have + // forwarding pointers to themselves. Reset them. + void remove_self_forwarding_pointers(); + + // When one is non-null, so is the other. Together, they each pair is + // an object with a preserved mark, and its mark value. + GrowableArray* _objs_with_preserved_marks; + GrowableArray* _preserved_marks_of_objs; + + // Preserve the mark of "obj", if necessary, in preparation for its mark + // word being overwritten with a self-forwarding-pointer. + void preserve_mark_if_necessary(oop obj, markOop m); + + // The stack of evac-failure objects left to be scanned. + GrowableArray* _evac_failure_scan_stack; + // The closure to apply to evac-failure objects. + + OopsInHeapRegionClosure* _evac_failure_closure; + // Set the field above. + void + set_evac_failure_closure(OopsInHeapRegionClosure* evac_failure_closure) { + _evac_failure_closure = evac_failure_closure; + } + + // Push "obj" on the scan stack. + void push_on_evac_failure_scan_stack(oop obj); + // Process scan stack entries until the stack is empty. + void drain_evac_failure_scan_stack(); + // True iff an invocation of "drain_scan_stack" is in progress; to + // prevent unnecessary recursion. + bool _drain_in_progress; + + // Do any necessary initialization for evacuation-failure handling. + // "cl" is the closure that will be used to process evac-failure + // objects. + void init_for_evac_failure(OopsInHeapRegionClosure* cl); + // Do any necessary cleanup for evacuation-failure handling data + // structures. + void finalize_for_evac_failure(); + + // An attempt to evacuate "obj" has failed; take necessary steps. + void handle_evacuation_failure(oop obj); + oop handle_evacuation_failure_par(OopsInHeapRegionClosure* cl, oop obj); + void handle_evacuation_failure_common(oop obj, markOop m); + + + // Ensure that the relevant gc_alloc regions are set. + void get_gc_alloc_regions(); + // We're done with GC alloc regions; release them, as appropriate. + void release_gc_alloc_regions(); + + // ("Weak") Reference processing support + ReferenceProcessor* _ref_processor; + + enum G1H_process_strong_roots_tasks { + G1H_PS_mark_stack_oops_do, + G1H_PS_refProcessor_oops_do, + // Leave this one last. + G1H_PS_NumElements + }; + + SubTasksDone* _process_strong_tasks; + + // Allocate space to hold a popular object. Result is guaranteed below + // "popular_object_boundary()". Note: CURRENTLY halts the system if we + // run out of space to hold popular objects. + HeapWord* allocate_popular_object(size_t word_size); + + // The boundary between popular and non-popular objects. + HeapWord* _popular_object_boundary; + + HeapRegionList* _popular_regions_to_be_evacuated; + + // Compute which objects in "single_region" are popular. If any are, + // evacuate them to a popular region, leaving behind forwarding pointers, + // and select "popular_region" as the single collection set region. + // Otherwise, leave the collection set null. + void popularity_pause_preamble(HeapRegion* populer_region); + + // Compute which objects in "single_region" are popular, and evacuate + // them to a popular region, leaving behind forwarding pointers. + // Returns "true" if at least one popular object is discovered and + // evacuated. In any case, "*max_rc" is set to the maximum reference + // count of an object in the region. + bool compute_reference_counts_and_evac_popular(HeapRegion* populer_region, + size_t* max_rc); + // Subroutines used in the above. + bool _rc_region_above; + size_t _rc_region_diff; + jint* obj_rc_addr(oop obj) { + uintptr_t obj_addr = (uintptr_t)obj; + if (_rc_region_above) { + jint* res = (jint*)(obj_addr + _rc_region_diff); + assert((uintptr_t)res > obj_addr, "RC region is above."); + return res; + } else { + jint* res = (jint*)(obj_addr - _rc_region_diff); + assert((uintptr_t)res < obj_addr, "RC region is below."); + return res; + } + } + jint obj_rc(oop obj) { + return *obj_rc_addr(obj); + } + void inc_obj_rc(oop obj) { + (*obj_rc_addr(obj))++; + } + void atomic_inc_obj_rc(oop obj); + + + // Number of popular objects and bytes (latter is cheaper!). + size_t pop_object_used_objs(); + size_t pop_object_used_bytes(); + + // Index of the popular region in which allocation is currently being + // done. + int _cur_pop_hr_index; + + // List of regions which require zero filling. + UncleanRegionList _unclean_region_list; + bool _unclean_regions_coming; + + bool check_age_cohort_well_formed_work(int a, HeapRegion* hr); + +public: + void set_refine_cte_cl_concurrency(bool concurrent); + + RefToScanQueue *task_queue(int i); + + // Create a G1CollectedHeap with the specified policy. + // Must call the initialize method afterwards. + // May not return if something goes wrong. + G1CollectedHeap(G1CollectorPolicy* policy); + + // Initialize the G1CollectedHeap to have the initial and + // maximum sizes, permanent generation, and remembered and barrier sets + // specified by the policy object. + jint initialize(); + + void ref_processing_init(); + + void set_par_threads(int t) { + SharedHeap::set_par_threads(t); + _process_strong_tasks->set_par_threads(t); + } + + virtual CollectedHeap::Name kind() const { + return CollectedHeap::G1CollectedHeap; + } + + // The current policy object for the collector. + G1CollectorPolicy* g1_policy() const { return _g1_policy; } + + // Adaptive size policy. No such thing for g1. + virtual AdaptiveSizePolicy* size_policy() { return NULL; } + + // The rem set and barrier set. + G1RemSet* g1_rem_set() const { return _g1_rem_set; } + ModRefBarrierSet* mr_bs() const { return _mr_bs; } + + // The rem set iterator. + HeapRegionRemSetIterator* rem_set_iterator(int i) { + return _rem_set_iterator[i]; + } + + HeapRegionRemSetIterator* rem_set_iterator() { + return _rem_set_iterator[0]; + } + + unsigned get_gc_time_stamp() { + return _gc_time_stamp; + } + + void reset_gc_time_stamp() { + _gc_time_stamp = 0; + } + + void iterate_dirty_card_closure(bool concurrent, int worker_i); + + // The shared block offset table array. + G1BlockOffsetSharedArray* bot_shared() const { return _bot_shared; } + + // Reference Processing accessor + ReferenceProcessor* ref_processor() { return _ref_processor; } + + // Reserved (g1 only; super method includes perm), capacity and the used + // portion in bytes. + size_t g1_reserved_obj_bytes() { return _g1_reserved.byte_size(); } + virtual size_t capacity() const; + virtual size_t used() const; + size_t recalculate_used() const; +#ifndef PRODUCT + size_t recalculate_used_regions() const; +#endif // PRODUCT + + // These virtual functions do the actual allocation. + virtual HeapWord* mem_allocate(size_t word_size, + bool is_noref, + bool is_tlab, + bool* gc_overhead_limit_was_exceeded); + + // Some heaps may offer a contiguous region for shared non-blocking + // allocation, via inlined code (by exporting the address of the top and + // end fields defining the extent of the contiguous allocation region.) + // But G1CollectedHeap doesn't yet support this. + + // Return an estimate of the maximum allocation that could be performed + // without triggering any collection or expansion activity. In a + // generational collector, for example, this is probably the largest + // allocation that could be supported (without expansion) in the youngest + // generation. It is "unsafe" because no locks are taken; the result + // should be treated as an approximation, not a guarantee, for use in + // heuristic resizing decisions. + virtual size_t unsafe_max_alloc(); + + virtual bool is_maximal_no_gc() const { + return _g1_storage.uncommitted_size() == 0; + } + + // The total number of regions in the heap. + size_t n_regions(); + + // The number of regions that are completely free. + size_t max_regions(); + + // The number of regions that are completely free. + size_t free_regions(); + + // The number of regions that are not completely free. + size_t used_regions() { return n_regions() - free_regions(); } + + // True iff the ZF thread should run. + bool should_zf(); + + // The number of regions available for "regular" expansion. + size_t expansion_regions() { return _expansion_regions; } + +#ifndef PRODUCT + bool regions_accounted_for(); + bool print_region_accounting_info(); + void print_region_counts(); +#endif + + HeapRegion* alloc_region_from_unclean_list(bool zero_filled); + HeapRegion* alloc_region_from_unclean_list_locked(bool zero_filled); + + void put_region_on_unclean_list(HeapRegion* r); + void put_region_on_unclean_list_locked(HeapRegion* r); + + void prepend_region_list_on_unclean_list(UncleanRegionList* list); + void prepend_region_list_on_unclean_list_locked(UncleanRegionList* list); + + void set_unclean_regions_coming(bool b); + void set_unclean_regions_coming_locked(bool b); + // Wait for cleanup to be complete. + void wait_for_cleanup_complete(); + // Like above, but assumes that the calling thread owns the Heap_lock. + void wait_for_cleanup_complete_locked(); + + // Return the head of the unclean list. + HeapRegion* peek_unclean_region_list_locked(); + // Remove and return the head of the unclean list. + HeapRegion* pop_unclean_region_list_locked(); + + // List of regions which are zero filled and ready for allocation. + HeapRegion* _free_region_list; + // Number of elements on the free list. + size_t _free_region_list_size; + + // If the head of the unclean list is ZeroFilled, move it to the free + // list. + bool move_cleaned_region_to_free_list_locked(); + bool move_cleaned_region_to_free_list(); + + void put_free_region_on_list_locked(HeapRegion* r); + void put_free_region_on_list(HeapRegion* r); + + // Remove and return the head element of the free list. + HeapRegion* pop_free_region_list_locked(); + + // If "zero_filled" is true, we first try the free list, then we try the + // unclean list, zero-filling the result. If "zero_filled" is false, we + // first try the unclean list, then the zero-filled list. + HeapRegion* alloc_free_region_from_lists(bool zero_filled); + + // Verify the integrity of the region lists. + void remove_allocated_regions_from_lists(); + bool verify_region_lists(); + bool verify_region_lists_locked(); + size_t unclean_region_list_length(); + size_t free_region_list_length(); + + // Perform a collection of the heap; intended for use in implementing + // "System.gc". This probably implies as full a collection as the + // "CollectedHeap" supports. + virtual void collect(GCCause::Cause cause); + + // The same as above but assume that the caller holds the Heap_lock. + void collect_locked(GCCause::Cause cause); + + // This interface assumes that it's being called by the + // vm thread. It collects the heap assuming that the + // heap lock is already held and that we are executing in + // the context of the vm thread. + virtual void collect_as_vm_thread(GCCause::Cause cause); + + // True iff a evacuation has failed in the most-recent collection. + bool evacuation_failed() { return _evacuation_failed; } + + // Free a region if it is totally full of garbage. Returns the number of + // bytes freed (0 ==> didn't free it). + size_t free_region_if_totally_empty(HeapRegion *hr); + void free_region_if_totally_empty_work(HeapRegion *hr, + size_t& pre_used, + size_t& cleared_h_regions, + size_t& freed_regions, + UncleanRegionList* list, + bool par = false); + + // If we've done free region work that yields the given changes, update + // the relevant global variables. + void finish_free_region_work(size_t pre_used, + size_t cleared_h_regions, + size_t freed_regions, + UncleanRegionList* list); + + + // Returns "TRUE" iff "p" points into the allocated area of the heap. + virtual bool is_in(const void* p) const; + + // Return "TRUE" iff the given object address is within the collection + // set. + inline bool obj_in_cs(oop obj); + + // Return "TRUE" iff the given object address is in the reserved + // region of g1 (excluding the permanent generation). + bool is_in_g1_reserved(const void* p) const { + return _g1_reserved.contains(p); + } + + // Returns a MemRegion that corresponds to the space that has been + // committed in the heap + MemRegion g1_committed() { + return _g1_committed; + } + + NOT_PRODUCT( bool is_in_closed_subset(const void* p) const; ) + + // Dirty card table entries covering a list of young regions. + void dirtyCardsForYoungRegions(CardTableModRefBS* ct_bs, HeapRegion* list); + + // This resets the card table to all zeros. It is used after + // a collection pause which used the card table to claim cards. + void cleanUpCardTable(); + + // Iteration functions. + + // Iterate over all the ref-containing fields of all objects, calling + // "cl.do_oop" on each. + virtual void oop_iterate(OopClosure* cl); + + // Same as above, restricted to a memory region. + virtual void oop_iterate(MemRegion mr, OopClosure* cl); + + // Iterate over all objects, calling "cl.do_object" on each. + virtual void object_iterate(ObjectClosure* cl); + + // Iterate over all objects allocated since the last collection, calling + // "cl.do_object" on each. The heap must have been initialized properly + // to support this function, or else this call will fail. + virtual void object_iterate_since_last_GC(ObjectClosure* cl); + + // Iterate over all spaces in use in the heap, in ascending address order. + virtual void space_iterate(SpaceClosure* cl); + + // Iterate over heap regions, in address order, terminating the + // iteration early if the "doHeapRegion" method returns "true". + void heap_region_iterate(HeapRegionClosure* blk); + + // Iterate over heap regions starting with r (or the first region if "r" + // is NULL), in address order, terminating early if the "doHeapRegion" + // method returns "true". + void heap_region_iterate_from(HeapRegion* r, HeapRegionClosure* blk); + + // As above but starting from the region at index idx. + void heap_region_iterate_from(int idx, HeapRegionClosure* blk); + + HeapRegion* region_at(size_t idx); + + + // Divide the heap region sequence into "chunks" of some size (the number + // of regions divided by the number of parallel threads times some + // overpartition factor, currently 4). Assumes that this will be called + // in parallel by ParallelGCThreads worker threads with discinct worker + // ids in the range [0..max(ParallelGCThreads-1, 1)], that all parallel + // calls will use the same "claim_value", and that that claim value is + // different from the claim_value of any heap region before the start of + // the iteration. Applies "blk->doHeapRegion" to each of the regions, by + // attempting to claim the first region in each chunk, and, if + // successful, applying the closure to each region in the chunk (and + // setting the claim value of the second and subsequent regions of the + // chunk.) For now requires that "doHeapRegion" always returns "false", + // i.e., that a closure never attempt to abort a traversal. + void heap_region_par_iterate_chunked(HeapRegionClosure* blk, + int worker, + jint claim_value); + + // Iterate over the regions (if any) in the current collection set. + void collection_set_iterate(HeapRegionClosure* blk); + + // As above but starting from region r + void collection_set_iterate_from(HeapRegion* r, HeapRegionClosure *blk); + + // Returns the first (lowest address) compactible space in the heap. + virtual CompactibleSpace* first_compactible_space(); + + // A CollectedHeap will contain some number of spaces. This finds the + // space containing a given address, or else returns NULL. + virtual Space* space_containing(const void* addr) const; + + // A G1CollectedHeap will contain some number of heap regions. This + // finds the region containing a given address, or else returns NULL. + HeapRegion* heap_region_containing(const void* addr) const; + + // Like the above, but requires "addr" to be in the heap (to avoid a + // null-check), and unlike the above, may return an continuing humongous + // region. + HeapRegion* heap_region_containing_raw(const void* addr) const; + + // A CollectedHeap is divided into a dense sequence of "blocks"; that is, + // each address in the (reserved) heap is a member of exactly + // one block. The defining characteristic of a block is that it is + // possible to find its size, and thus to progress forward to the next + // block. (Blocks may be of different sizes.) Thus, blocks may + // represent Java objects, or they might be free blocks in a + // free-list-based heap (or subheap), as long as the two kinds are + // distinguishable and the size of each is determinable. + + // Returns the address of the start of the "block" that contains the + // address "addr". We say "blocks" instead of "object" since some heaps + // may not pack objects densely; a chunk may either be an object or a + // non-object. + virtual HeapWord* block_start(const void* addr) const; + + // Requires "addr" to be the start of a chunk, and returns its size. + // "addr + size" is required to be the start of a new chunk, or the end + // of the active area of the heap. + virtual size_t block_size(const HeapWord* addr) const; + + // Requires "addr" to be the start of a block, and returns "TRUE" iff + // the block is an object. + virtual bool block_is_obj(const HeapWord* addr) const; + + // Does this heap support heap inspection? (+PrintClassHistogram) + virtual bool supports_heap_inspection() const { return true; } + + // Section on thread-local allocation buffers (TLABs) + // See CollectedHeap for semantics. + + virtual bool supports_tlab_allocation() const; + virtual size_t tlab_capacity(Thread* thr) const; + virtual size_t unsafe_max_tlab_alloc(Thread* thr) const; + virtual HeapWord* allocate_new_tlab(size_t size); + + // Can a compiler initialize a new object without store barriers? + // This permission only extends from the creation of a new object + // via a TLAB up to the first subsequent safepoint. + virtual bool can_elide_tlab_store_barriers() const { + // Since G1's TLAB's may, on occasion, come from non-young regions + // as well. (Is there a flag controlling that? XXX) + return false; + } + + // Can a compiler elide a store barrier when it writes + // a permanent oop into the heap? Applies when the compiler + // is storing x to the heap, where x->is_perm() is true. + virtual bool can_elide_permanent_oop_store_barriers() const { + // At least until perm gen collection is also G1-ified, at + // which point this should return false. + return true; + } + + virtual bool allocs_are_zero_filled(); + + // The boundary between a "large" and "small" array of primitives, in + // words. + virtual size_t large_typearray_limit(); + + // All popular objects are guaranteed to have addresses below this + // boundary. + HeapWord* popular_object_boundary() { + return _popular_object_boundary; + } + + // Declare the region as one that should be evacuated because its + // remembered set is too large. + void schedule_popular_region_evac(HeapRegion* r); + // If there is a popular region to evacuate it, remove it from the list + // and return it. + HeapRegion* popular_region_to_evac(); + // Evacuate the given popular region. + void evac_popular_region(HeapRegion* r); + + // Returns "true" iff the given word_size is "very large". + static bool isHumongous(size_t word_size) { + return word_size >= VeryLargeInWords; + } + + // Update mod union table with the set of dirty cards. + void updateModUnion(); + + // Set the mod union bits corresponding to the given memRegion. Note + // that this is always a safe operation, since it doesn't clear any + // bits. + void markModUnionRange(MemRegion mr); + + // Records the fact that a marking phase is no longer in progress. + void set_marking_complete() { + _mark_in_progress = false; + } + void set_marking_started() { + _mark_in_progress = true; + } + bool mark_in_progress() { + return _mark_in_progress; + } + + // Print the maximum heap capacity. + virtual size_t max_capacity() const; + + virtual jlong millis_since_last_gc(); + + // Perform any cleanup actions necessary before allowing a verification. + virtual void prepare_for_verify(); + + // Perform verification. + virtual void verify(bool allow_dirty, bool silent); + virtual void print() const; + virtual void print_on(outputStream* st) const; + + virtual void print_gc_threads_on(outputStream* st) const; + virtual void gc_threads_do(ThreadClosure* tc) const; + + // Override + void print_tracing_info() const; + + // If "addr" is a pointer into the (reserved?) heap, returns a positive + // number indicating the "arena" within the heap in which "addr" falls. + // Or else returns 0. + virtual int addr_to_arena_id(void* addr) const; + + // Convenience function to be used in situations where the heap type can be + // asserted to be this type. + static G1CollectedHeap* heap(); + + void empty_young_list(); + bool should_set_young_locked(); + + void set_region_short_lived_locked(HeapRegion* hr); + // add appropriate methods for any other surv rate groups + + void young_list_rs_length_sampling_init() { + _young_list->rs_length_sampling_init(); + } + bool young_list_rs_length_sampling_more() { + return _young_list->rs_length_sampling_more(); + } + void young_list_rs_length_sampling_next() { + _young_list->rs_length_sampling_next(); + } + size_t young_list_sampled_rs_lengths() { + return _young_list->sampled_rs_lengths(); + } + + size_t young_list_length() { return _young_list->length(); } + size_t young_list_scan_only_length() { + return _young_list->scan_only_length(); } + + HeapRegion* pop_region_from_young_list() { + return _young_list->pop_region(); + } + + HeapRegion* young_list_first_region() { + return _young_list->first_region(); + } + + // debugging + bool check_young_list_well_formed() { + return _young_list->check_list_well_formed(); + } + bool check_young_list_empty(bool ignore_scan_only_list, + bool check_sample = true); + + // *** Stuff related to concurrent marking. It's not clear to me that so + // many of these need to be public. + + // The functions below are helper functions that a subclass of + // "CollectedHeap" can use in the implementation of its virtual + // functions. + // This performs a concurrent marking of the live objects in a + // bitmap off to the side. + void doConcurrentMark(); + + // This is called from the marksweep collector which then does + // a concurrent mark and verifies that the results agree with + // the stop the world marking. + void checkConcurrentMark(); + void do_sync_mark(); + + bool isMarkedPrev(oop obj) const; + bool isMarkedNext(oop obj) const; + + // Determine if an object is dead, given the object and also + // the region to which the object belongs. An object is dead + // iff a) it was not allocated since the last mark and b) it + // is not marked. + + bool is_obj_dead(const oop obj, const HeapRegion* hr) const { + return + !hr->obj_allocated_since_prev_marking(obj) && + !isMarkedPrev(obj); + } + + // This is used when copying an object to survivor space. + // If the object is marked live, then we mark the copy live. + // If the object is allocated since the start of this mark + // cycle, then we mark the copy live. + // If the object has been around since the previous mark + // phase, and hasn't been marked yet during this phase, + // then we don't mark it, we just wait for the + // current marking cycle to get to it. + + // This function returns true when an object has been + // around since the previous marking and hasn't yet + // been marked during this marking. + + bool is_obj_ill(const oop obj, const HeapRegion* hr) const { + return + !hr->obj_allocated_since_next_marking(obj) && + !isMarkedNext(obj); + } + + // Determine if an object is dead, given only the object itself. + // This will find the region to which the object belongs and + // then call the region version of the same function. + + // Added if it is in permanent gen it isn't dead. + // Added if it is NULL it isn't dead. + + bool is_obj_dead(oop obj) { + HeapRegion* hr = heap_region_containing(obj); + if (hr == NULL) { + if (Universe::heap()->is_in_permanent(obj)) + return false; + else if (obj == NULL) return false; + else return true; + } + else return is_obj_dead(obj, hr); + } + + bool is_obj_ill(oop obj) { + HeapRegion* hr = heap_region_containing(obj); + if (hr == NULL) { + if (Universe::heap()->is_in_permanent(obj)) + return false; + else if (obj == NULL) return false; + else return true; + } + else return is_obj_ill(obj, hr); + } + + // The following is just to alert the verification code + // that a full collection has occurred and that the + // remembered sets are no longer up to date. + bool _full_collection; + void set_full_collection() { _full_collection = true;} + void clear_full_collection() {_full_collection = false;} + bool full_collection() {return _full_collection;} + + ConcurrentMark* concurrent_mark() const { return _cm; } + ConcurrentG1Refine* concurrent_g1_refine() const { return _cg1r; } + +public: + void stop_conc_gc_threads(); + + // + + double predict_region_elapsed_time_ms(HeapRegion* hr, bool young); + void check_if_region_is_too_expensive(double predicted_time_ms); + size_t pending_card_num(); + size_t max_pending_card_num(); + size_t cards_scanned(); + + // + +protected: + size_t _max_heap_capacity; + +// debug_only(static void check_for_valid_allocation_state();) + +public: + // Temporary: call to mark things unimplemented for the G1 heap (e.g., + // MemoryService). In productization, we can make this assert false + // to catch such places (as well as searching for calls to this...) + static void g1_unimplemented(); + +}; + +// Local Variables: *** +// c-indentation-style: gnu *** +// End: *** diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp new file mode 100644 index 00000000000..8cafe3d9885 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp @@ -0,0 +1,91 @@ +/* + * Copyright 2001-2007 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. + * + */ + +// Inline functions for G1CollectedHeap + +inline HeapRegion* +G1CollectedHeap::heap_region_containing(const void* addr) const { + HeapRegion* hr = _hrs->addr_to_region(addr); + // hr can be null if addr in perm_gen + if (hr != NULL && hr->continuesHumongous()) { + hr = hr->humongous_start_region(); + } + return hr; +} + +inline HeapRegion* +G1CollectedHeap::heap_region_containing_raw(const void* addr) const { + HeapRegion* res = _hrs->addr_to_region(addr); + assert(res != NULL, "addr outside of heap?"); + return res; +} + +inline bool G1CollectedHeap::obj_in_cs(oop obj) { + HeapRegion* r = _hrs->addr_to_region(obj); + return r != NULL && r->in_collection_set(); +} + +inline HeapWord* G1CollectedHeap::attempt_allocation(size_t word_size, + bool permit_collection_pause) { + HeapWord* res = NULL; + + assert( SafepointSynchronize::is_at_safepoint() || + Heap_lock->owned_by_self(), "pre-condition of the call" ); + + if (_cur_alloc_region != NULL) { + + // If this allocation causes a region to become non empty, + // then we need to update our free_regions count. + + if (_cur_alloc_region->is_empty()) { + res = _cur_alloc_region->allocate(word_size); + if (res != NULL) + _free_regions--; + } else { + res = _cur_alloc_region->allocate(word_size); + } + } + if (res != NULL) { + if (!SafepointSynchronize::is_at_safepoint()) { + assert( Heap_lock->owned_by_self(), "invariant" ); + Heap_lock->unlock(); + } + return res; + } + // attempt_allocation_slow will also unlock the heap lock when appropriate. + return attempt_allocation_slow(word_size, permit_collection_pause); +} + +inline RefToScanQueue* G1CollectedHeap::task_queue(int i) { + return _task_queues->queue(i); +} + + +inline bool G1CollectedHeap::isMarkedPrev(oop obj) const { + return _cm->prevMarkBitMap()->isMarked((HeapWord *)obj); +} + +inline bool G1CollectedHeap::isMarkedNext(oop obj) const { + return _cm->nextMarkBitMap()->isMarked((HeapWord *)obj); +} diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp new file mode 100644 index 00000000000..accea783c21 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp @@ -0,0 +1,3159 @@ +/* + * Copyright 2001-2007 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. + * + */ + +#include "incls/_precompiled.incl" +#include "incls/_g1CollectorPolicy.cpp.incl" + +#define PREDICTIONS_VERBOSE 0 + +// + +// Different defaults for different number of GC threads +// They were chosen by running GCOld and SPECjbb on debris with different +// numbers of GC threads and choosing them based on the results + +// all the same +static double rs_length_diff_defaults[] = { + 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 +}; + +static double cost_per_card_ms_defaults[] = { + 0.01, 0.005, 0.005, 0.003, 0.003, 0.002, 0.002, 0.0015 +}; + +static double cost_per_scan_only_region_ms_defaults[] = { + 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 +}; + +// all the same +static double fully_young_cards_per_entry_ratio_defaults[] = { + 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 +}; + +static double cost_per_entry_ms_defaults[] = { + 0.015, 0.01, 0.01, 0.008, 0.008, 0.0055, 0.0055, 0.005 +}; + +static double cost_per_byte_ms_defaults[] = { + 0.00006, 0.00003, 0.00003, 0.000015, 0.000015, 0.00001, 0.00001, 0.000009 +}; + +// these should be pretty consistent +static double constant_other_time_ms_defaults[] = { + 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0 +}; + + +static double young_other_cost_per_region_ms_defaults[] = { + 0.3, 0.2, 0.2, 0.15, 0.15, 0.12, 0.12, 0.1 +}; + +static double non_young_other_cost_per_region_ms_defaults[] = { + 1.0, 0.7, 0.7, 0.5, 0.5, 0.42, 0.42, 0.30 +}; + +// + +G1CollectorPolicy::G1CollectorPolicy() : + _parallel_gc_threads((ParallelGCThreads > 0) ? ParallelGCThreads : 1), + _n_pauses(0), + _recent_CH_strong_roots_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)), + _recent_G1_strong_roots_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)), + _recent_evac_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)), + _recent_pause_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)), + _recent_rs_sizes(new TruncatedSeq(NumPrevPausesForHeuristics)), + _recent_gc_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)), + _all_pause_times_ms(new NumberSeq()), + _stop_world_start(0.0), + _all_stop_world_times_ms(new NumberSeq()), + _all_yield_times_ms(new NumberSeq()), + + _all_mod_union_times_ms(new NumberSeq()), + + _non_pop_summary(new NonPopSummary()), + _pop_summary(new PopSummary()), + _non_pop_abandoned_summary(new NonPopAbandonedSummary()), + _pop_abandoned_summary(new PopAbandonedSummary()), + + _cur_clear_ct_time_ms(0.0), + + _region_num_young(0), + _region_num_tenured(0), + _prev_region_num_young(0), + _prev_region_num_tenured(0), + + _aux_num(10), + _all_aux_times_ms(new NumberSeq[_aux_num]), + _cur_aux_start_times_ms(new double[_aux_num]), + _cur_aux_times_ms(new double[_aux_num]), + _cur_aux_times_set(new bool[_aux_num]), + + _pop_compute_rc_start(0.0), + _pop_evac_start(0.0), + + _concurrent_mark_init_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)), + _concurrent_mark_remark_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)), + _concurrent_mark_cleanup_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)), + + // + + _alloc_rate_ms_seq(new TruncatedSeq(TruncatedSeqLength)), + _prev_collection_pause_end_ms(0.0), + _pending_card_diff_seq(new TruncatedSeq(TruncatedSeqLength)), + _rs_length_diff_seq(new TruncatedSeq(TruncatedSeqLength)), + _cost_per_card_ms_seq(new TruncatedSeq(TruncatedSeqLength)), + _cost_per_scan_only_region_ms_seq(new TruncatedSeq(TruncatedSeqLength)), + _fully_young_cards_per_entry_ratio_seq(new TruncatedSeq(TruncatedSeqLength)), + _partially_young_cards_per_entry_ratio_seq( + new TruncatedSeq(TruncatedSeqLength)), + _cost_per_entry_ms_seq(new TruncatedSeq(TruncatedSeqLength)), + _partially_young_cost_per_entry_ms_seq(new TruncatedSeq(TruncatedSeqLength)), + _cost_per_byte_ms_seq(new TruncatedSeq(TruncatedSeqLength)), + _cost_per_byte_ms_during_cm_seq(new TruncatedSeq(TruncatedSeqLength)), + _cost_per_scan_only_region_ms_during_cm_seq(new TruncatedSeq(TruncatedSeqLength)), + _constant_other_time_ms_seq(new TruncatedSeq(TruncatedSeqLength)), + _young_other_cost_per_region_ms_seq(new TruncatedSeq(TruncatedSeqLength)), + _non_young_other_cost_per_region_ms_seq( + new TruncatedSeq(TruncatedSeqLength)), + + _pending_cards_seq(new TruncatedSeq(TruncatedSeqLength)), + _scanned_cards_seq(new TruncatedSeq(TruncatedSeqLength)), + _rs_lengths_seq(new TruncatedSeq(TruncatedSeqLength)), + + _pause_time_target_ms((double) G1MaxPauseTimeMS), + + // + + _in_young_gc_mode(false), + _full_young_gcs(true), + _full_young_pause_num(0), + _partial_young_pause_num(0), + + _during_marking(false), + _in_marking_window(false), + _in_marking_window_im(false), + + _known_garbage_ratio(0.0), + _known_garbage_bytes(0), + + _young_gc_eff_seq(new TruncatedSeq(TruncatedSeqLength)), + _target_pause_time_ms(-1.0), + + _recent_prev_end_times_for_all_gcs_sec(new TruncatedSeq(NumPrevPausesForHeuristics)), + + _recent_CS_bytes_used_before(new TruncatedSeq(NumPrevPausesForHeuristics)), + _recent_CS_bytes_surviving(new TruncatedSeq(NumPrevPausesForHeuristics)), + + _recent_avg_pause_time_ratio(0.0), + _num_markings(0), + _n_marks(0), + _n_pauses_at_mark_end(0), + + _all_full_gc_times_ms(new NumberSeq()), + + _conc_refine_enabled(0), + _conc_refine_zero_traversals(0), + _conc_refine_max_traversals(0), + _conc_refine_current_delta(G1ConcRefineInitialDelta), + + // G1PausesBtwnConcMark defaults to -1 + // 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), + _should_revert_to_full_young_gcs(false), + _last_full_young_gc(false), + + _prev_collection_pause_used_at_end_bytes(0), + + _collection_set(NULL), +#ifdef _MSC_VER // the use of 'this' below gets a warning, make it go away +#pragma warning( disable:4355 ) // 'this' : used in base member initializer list +#endif // _MSC_VER + + _short_lived_surv_rate_group(new SurvRateGroup(this, "Short Lived", + G1YoungSurvRateNumRegionsSummary)), + _survivor_surv_rate_group(new SurvRateGroup(this, "Survivor", + G1YoungSurvRateNumRegionsSummary)) + // add here any more surv rate groups +{ + _recent_prev_end_times_for_all_gcs_sec->add(os::elapsedTime()); + _prev_collection_pause_end_ms = os::elapsedTime() * 1000.0; + + _par_last_ext_root_scan_times_ms = new double[_parallel_gc_threads]; + _par_last_mark_stack_scan_times_ms = new double[_parallel_gc_threads]; + _par_last_scan_only_times_ms = new double[_parallel_gc_threads]; + _par_last_scan_only_regions_scanned = new double[_parallel_gc_threads]; + + _par_last_update_rs_start_times_ms = new double[_parallel_gc_threads]; + _par_last_update_rs_times_ms = new double[_parallel_gc_threads]; + _par_last_update_rs_processed_buffers = new double[_parallel_gc_threads]; + + _par_last_scan_rs_start_times_ms = new double[_parallel_gc_threads]; + _par_last_scan_rs_times_ms = new double[_parallel_gc_threads]; + _par_last_scan_new_refs_times_ms = new double[_parallel_gc_threads]; + + _par_last_obj_copy_times_ms = new double[_parallel_gc_threads]; + + _par_last_termination_times_ms = new double[_parallel_gc_threads]; + + // we store the data from the first pass during popularity pauses + _pop_par_last_update_rs_start_times_ms = new double[_parallel_gc_threads]; + _pop_par_last_update_rs_times_ms = new double[_parallel_gc_threads]; + _pop_par_last_update_rs_processed_buffers = new double[_parallel_gc_threads]; + + _pop_par_last_scan_rs_start_times_ms = new double[_parallel_gc_threads]; + _pop_par_last_scan_rs_times_ms = new double[_parallel_gc_threads]; + + _pop_par_last_closure_app_times_ms = new double[_parallel_gc_threads]; + + // start conservatively + _expensive_region_limit_ms = 0.5 * (double) G1MaxPauseTimeMS; + + // + + int index; + if (ParallelGCThreads == 0) + index = 0; + else if (ParallelGCThreads > 8) + index = 7; + else + index = ParallelGCThreads - 1; + + _pending_card_diff_seq->add(0.0); + _rs_length_diff_seq->add(rs_length_diff_defaults[index]); + _cost_per_card_ms_seq->add(cost_per_card_ms_defaults[index]); + _cost_per_scan_only_region_ms_seq->add( + cost_per_scan_only_region_ms_defaults[index]); + _fully_young_cards_per_entry_ratio_seq->add( + fully_young_cards_per_entry_ratio_defaults[index]); + _cost_per_entry_ms_seq->add(cost_per_entry_ms_defaults[index]); + _cost_per_byte_ms_seq->add(cost_per_byte_ms_defaults[index]); + _constant_other_time_ms_seq->add(constant_other_time_ms_defaults[index]); + _young_other_cost_per_region_ms_seq->add( + young_other_cost_per_region_ms_defaults[index]); + _non_young_other_cost_per_region_ms_seq->add( + non_young_other_cost_per_region_ms_defaults[index]); + + // + + double time_slice = (double) G1TimeSliceMS / 1000.0; + double max_gc_time = (double) G1MaxPauseTimeMS / 1000.0; + guarantee(max_gc_time < time_slice, + "Max GC time should not be greater than the time slice"); + _mmu_tracker = new G1MMUTrackerQueue(time_slice, max_gc_time); + _sigma = (double) G1ConfidencePerc / 100.0; + + // start conservatively (around 50ms is about right) + _concurrent_mark_init_times_ms->add(0.05); + _concurrent_mark_remark_times_ms->add(0.05); + _concurrent_mark_cleanup_times_ms->add(0.20); + _tenuring_threshold = MaxTenuringThreshold; + + initialize_all(); +} + +// Increment "i", mod "len" +static void inc_mod(int& i, int len) { + i++; if (i == len) i = 0; +} + +void G1CollectorPolicy::initialize_flags() { + set_min_alignment(HeapRegion::GrainBytes); + set_max_alignment(GenRemSet::max_alignment_constraint(rem_set_name())); + CollectorPolicy::initialize_flags(); +} + +void G1CollectorPolicy::init() { + // Set aside an initial future to_space. + _g1 = G1CollectedHeap::heap(); + size_t regions = Universe::heap()->capacity() / HeapRegion::GrainBytes; + + assert(Heap_lock->owned_by_self(), "Locking discipline."); + + if (G1SteadyStateUsed < 50) { + vm_exit_during_initialization("G1SteadyStateUsed must be at least 50%."); + } + if (UseConcMarkSweepGC) { + vm_exit_during_initialization("-XX:+UseG1GC is incompatible with " + "-XX:+UseConcMarkSweepGC."); + } + + if (G1Gen) { + _in_young_gc_mode = true; + + if (G1YoungGenSize == 0) { + set_adaptive_young_list_length(true); + _young_list_fixed_length = 0; + } else { + set_adaptive_young_list_length(false); + _young_list_fixed_length = (G1YoungGenSize / HeapRegion::GrainBytes); + } + _free_regions_at_end_of_collection = _g1->free_regions(); + _scan_only_regions_at_end_of_collection = 0; + calculate_young_list_min_length(); + guarantee( _young_list_min_length == 0, "invariant, not enough info" ); + calculate_young_list_target_config(); + } else { + _young_list_fixed_length = 0; + _in_young_gc_mode = false; + } +} + +void G1CollectorPolicy::calculate_young_list_min_length() { + _young_list_min_length = 0; + + if (!adaptive_young_list_length()) + return; + + if (_alloc_rate_ms_seq->num() > 3) { + double now_sec = os::elapsedTime(); + double when_ms = _mmu_tracker->when_max_gc_sec(now_sec) * 1000.0; + double alloc_rate_ms = predict_alloc_rate_ms(); + int min_regions = (int) ceil(alloc_rate_ms * when_ms); + int current_region_num = (int) _g1->young_list_length(); + _young_list_min_length = min_regions + current_region_num; + } +} + +void G1CollectorPolicy::calculate_young_list_target_config() { + if (adaptive_young_list_length()) { + size_t rs_lengths = (size_t) get_new_prediction(_rs_lengths_seq); + calculate_young_list_target_config(rs_lengths); + } else { + if (full_young_gcs()) + _young_list_target_length = _young_list_fixed_length; + else + _young_list_target_length = _young_list_fixed_length / 2; + _young_list_target_length = MAX2(_young_list_target_length, (size_t)1); + size_t so_length = calculate_optimal_so_length(_young_list_target_length); + guarantee( so_length < _young_list_target_length, "invariant" ); + _young_list_so_prefix_length = so_length; + } +} + +// This method calculate the optimal scan-only set for a fixed young +// gen size. I couldn't work out how to reuse the more elaborate one, +// i.e. calculate_young_list_target_config(rs_length), as the loops are +// fundamentally different (the other one finds a config for different +// S-O lengths, whereas here we need to do the opposite). +size_t G1CollectorPolicy::calculate_optimal_so_length( + size_t young_list_length) { + if (!G1UseScanOnlyPrefix) + return 0; + + if (_all_pause_times_ms->num() < 3) { + // we won't use a scan-only set at the beginning to allow the rest + // of the predictors to warm up + return 0; + } + + if (_cost_per_scan_only_region_ms_seq->num() < 3) { + // then, we'll only set the S-O set to 1 for a little bit of time, + // to get enough information on the scanning cost + return 1; + } + + size_t pending_cards = (size_t) get_new_prediction(_pending_cards_seq); + size_t rs_lengths = (size_t) get_new_prediction(_rs_lengths_seq); + size_t adj_rs_lengths = rs_lengths + predict_rs_length_diff(); + size_t scanned_cards; + if (full_young_gcs()) + scanned_cards = predict_young_card_num(adj_rs_lengths); + else + scanned_cards = predict_non_young_card_num(adj_rs_lengths); + double base_time_ms = predict_base_elapsed_time_ms(pending_cards, + scanned_cards); + + size_t so_length = 0; + double max_gc_eff = 0.0; + for (size_t i = 0; i < young_list_length; ++i) { + double gc_eff = 0.0; + double pause_time_ms = 0.0; + predict_gc_eff(young_list_length, i, base_time_ms, + &gc_eff, &pause_time_ms); + if (gc_eff > max_gc_eff) { + max_gc_eff = gc_eff; + so_length = i; + } + } + + // set it to 95% of the optimal to make sure we sample the "area" + // around the optimal length to get up-to-date survival rate data + return so_length * 950 / 1000; +} + +// This is a really cool piece of code! It finds the best +// target configuration (young length / scan-only prefix length) so +// that GC efficiency is maximized and that we also meet a pause +// time. It's a triple nested loop. These loops are explained below +// from the inside-out :-) +// +// (a) The innermost loop will try to find the optimal young length +// for a fixed S-O length. It uses a binary search to speed up the +// process. We assume that, for a fixed S-O length, as we add more +// young regions to the CSet, the GC efficiency will only go up (I'll +// skip the proof). So, using a binary search to optimize this process +// makes perfect sense. +// +// (b) The middle loop will fix the S-O length before calling the +// innermost one. It will vary it between two parameters, increasing +// it by a given increment. +// +// (c) The outermost loop will call the middle loop three times. +// (1) The first time it will explore all possible S-O length values +// from 0 to as large as it can get, using a coarse increment (to +// quickly "home in" to where the optimal seems to be). +// (2) The second time it will explore the values around the optimal +// that was found by the first iteration using a fine increment. +// (3) Once the optimal config has been determined by the second +// iteration, we'll redo the calculation, but setting the S-O length +// to 95% of the optimal to make sure we sample the "area" +// around the optimal length to get up-to-date survival rate data +// +// Termination conditions for the iterations are several: the pause +// time is over the limit, we do not have enough to-space, etc. + +void G1CollectorPolicy::calculate_young_list_target_config(size_t rs_lengths) { + guarantee( adaptive_young_list_length(), "pre-condition" ); + + double start_time_sec = os::elapsedTime(); + size_t min_reserve_perc = MAX2((size_t)2, (size_t)G1MinReservePerc); + min_reserve_perc = MIN2((size_t) 50, min_reserve_perc); + size_t reserve_regions = + (size_t) ((double) min_reserve_perc * (double) _g1->n_regions() / 100.0); + + if (full_young_gcs() && _free_regions_at_end_of_collection > 0) { + // we are in fully-young mode and there are free regions in the heap + + size_t min_so_length = 0; + size_t max_so_length = 0; + + if (G1UseScanOnlyPrefix) { + if (_all_pause_times_ms->num() < 3) { + // we won't use a scan-only set at the beginning to allow the rest + // of the predictors to warm up + min_so_length = 0; + max_so_length = 0; + } else if (_cost_per_scan_only_region_ms_seq->num() < 3) { + // then, we'll only set the S-O set to 1 for a little bit of time, + // to get enough information on the scanning cost + min_so_length = 1; + max_so_length = 1; + } else if (_in_marking_window || _last_full_young_gc) { + // no S-O prefix during a marking phase either, as at the end + // of the marking phase we'll have to use a very small young + // length target to fill up the rest of the CSet with + // non-young regions and, if we have lots of scan-only regions + // left-over, we will not be able to add any more non-young + // regions. + min_so_length = 0; + max_so_length = 0; + } else { + // this is the common case; we'll never reach the maximum, we + // one of the end conditions will fire well before that + // (hopefully!) + min_so_length = 0; + max_so_length = _free_regions_at_end_of_collection - 1; + } + } else { + // no S-O prefix, as the switch is not set, but we still need to + // do one iteration to calculate the best young target that + // meets the pause time; this way we reuse the same code instead + // of replicating it + min_so_length = 0; + max_so_length = 0; + } + + double target_pause_time_ms = _mmu_tracker->max_gc_time() * 1000.0; + size_t pending_cards = (size_t) get_new_prediction(_pending_cards_seq); + size_t adj_rs_lengths = rs_lengths + predict_rs_length_diff(); + size_t scanned_cards; + if (full_young_gcs()) + scanned_cards = predict_young_card_num(adj_rs_lengths); + else + scanned_cards = predict_non_young_card_num(adj_rs_lengths); + // calculate this once, so that we don't have to recalculate it in + // the innermost loop + double base_time_ms = predict_base_elapsed_time_ms(pending_cards, + scanned_cards); + + // the result + size_t final_young_length = 0; + size_t final_so_length = 0; + double final_gc_eff = 0.0; + // we'll also keep track of how many times we go into the inner loop + // this is for profiling reasons + size_t calculations = 0; + + // this determines which of the three iterations the outer loop is in + typedef enum { + pass_type_coarse, + pass_type_fine, + pass_type_final + } pass_type_t; + + // range of the outer loop's iteration + size_t from_so_length = min_so_length; + size_t to_so_length = max_so_length; + guarantee( from_so_length <= to_so_length, "invariant" ); + + // this will keep the S-O length that's found by the second + // iteration of the outer loop; we'll keep it just in case the third + // iteration fails to find something + size_t fine_so_length = 0; + + // the increment step for the coarse (first) iteration + size_t so_coarse_increments = 5; + + // the common case, we'll start with the coarse iteration + pass_type_t pass = pass_type_coarse; + size_t so_length_incr = so_coarse_increments; + + if (from_so_length == to_so_length) { + // not point in doing the coarse iteration, we'll go directly into + // the fine one (we essentially trying to find the optimal young + // length for a fixed S-O length). + so_length_incr = 1; + pass = pass_type_final; + } else if (to_so_length - from_so_length < 3 * so_coarse_increments) { + // again, the range is too short so no point in foind the coarse + // iteration either + so_length_incr = 1; + pass = pass_type_fine; + } + + bool done = false; + // this is the outermost loop + while (!done) { +#if 0 + // leave this in for debugging, just in case + gclog_or_tty->print_cr("searching between " SIZE_FORMAT " and " SIZE_FORMAT + ", incr " SIZE_FORMAT ", pass %s", + from_so_length, to_so_length, so_length_incr, + (pass == pass_type_coarse) ? "coarse" : + (pass == pass_type_fine) ? "fine" : "final"); +#endif // 0 + + size_t so_length = from_so_length; + size_t init_free_regions = + MAX2((size_t)0, + _free_regions_at_end_of_collection + + _scan_only_regions_at_end_of_collection - reserve_regions); + + // this determines whether a configuration was found + bool gc_eff_set = false; + // this is the middle loop + while (so_length <= to_so_length) { + // base time, which excludes region-related time; again we + // calculate it once to avoid recalculating it in the + // innermost loop + double base_time_with_so_ms = + base_time_ms + predict_scan_only_time_ms(so_length); + // it's already over the pause target, go around + if (base_time_with_so_ms > target_pause_time_ms) + break; + + size_t starting_young_length = so_length+1; + + // we make sure that the short young length that makes sense + // (one more than the S-O length) is feasible + size_t min_young_length = starting_young_length; + double min_gc_eff; + bool min_ok; + ++calculations; + min_ok = predict_gc_eff(min_young_length, so_length, + base_time_with_so_ms, + init_free_regions, target_pause_time_ms, + &min_gc_eff); + + if (min_ok) { + // the shortest young length is indeed feasible; we'll know + // set up the max young length and we'll do a binary search + // between min_young_length and max_young_length + size_t max_young_length = _free_regions_at_end_of_collection - 1; + double max_gc_eff = 0.0; + bool max_ok = false; + + // the innermost loop! (finally!) + while (max_young_length > min_young_length) { + // we'll make sure that min_young_length is always at a + // feasible config + guarantee( min_ok, "invariant" ); + + ++calculations; + max_ok = predict_gc_eff(max_young_length, so_length, + base_time_with_so_ms, + init_free_regions, target_pause_time_ms, + &max_gc_eff); + + size_t diff = (max_young_length - min_young_length) / 2; + if (max_ok) { + min_young_length = max_young_length; + min_gc_eff = max_gc_eff; + min_ok = true; + } + max_young_length = min_young_length + diff; + } + + // the innermost loop found a config + guarantee( min_ok, "invariant" ); + if (min_gc_eff > final_gc_eff) { + // it's the best config so far, so we'll keep it + final_gc_eff = min_gc_eff; + final_young_length = min_young_length; + final_so_length = so_length; + gc_eff_set = true; + } + } + + // incremental the fixed S-O length and go around + so_length += so_length_incr; + } + + // this is the end of the outermost loop and we need to decide + // what to do during the next iteration + if (pass == pass_type_coarse) { + // we just did the coarse pass (first iteration) + + if (!gc_eff_set) + // we didn't find a feasible config so we'll just bail out; of + // course, it might be the case that we missed it; but I'd say + // it's a bit unlikely + done = true; + else { + // We did find a feasible config with optimal GC eff during + // the first pass. So the second pass we'll only consider the + // S-O lengths around that config with a fine increment. + + guarantee( so_length_incr == so_coarse_increments, "invariant" ); + guarantee( final_so_length >= min_so_length, "invariant" ); + +#if 0 + // leave this in for debugging, just in case + gclog_or_tty->print_cr(" coarse pass: SO length " SIZE_FORMAT, + final_so_length); +#endif // 0 + + from_so_length = + (final_so_length - min_so_length > so_coarse_increments) ? + final_so_length - so_coarse_increments + 1 : min_so_length; + to_so_length = + (max_so_length - final_so_length > so_coarse_increments) ? + final_so_length + so_coarse_increments - 1 : max_so_length; + + pass = pass_type_fine; + so_length_incr = 1; + } + } else if (pass == pass_type_fine) { + // we just finished the second pass + + if (!gc_eff_set) { + // we didn't find a feasible config (yes, it's possible; + // notice that, sometimes, we go directly into the fine + // iteration and skip the coarse one) so we bail out + done = true; + } else { + // We did find a feasible config with optimal GC eff + guarantee( so_length_incr == 1, "invariant" ); + + if (final_so_length == 0) { + // The config is of an empty S-O set, so we'll just bail out + done = true; + } else { + // we'll go around once more, setting the S-O length to 95% + // of the optimal + size_t new_so_length = 950 * final_so_length / 1000; + +#if 0 + // leave this in for debugging, just in case + gclog_or_tty->print_cr(" fine pass: SO length " SIZE_FORMAT + ", setting it to " SIZE_FORMAT, + final_so_length, new_so_length); +#endif // 0 + + from_so_length = new_so_length; + to_so_length = new_so_length; + fine_so_length = final_so_length; + + pass = pass_type_final; + } + } + } else if (pass == pass_type_final) { + // we just finished the final (third) pass + + if (!gc_eff_set) + // we didn't find a feasible config, so we'll just use the one + // we found during the second pass, which we saved + final_so_length = fine_so_length; + + // and we're done! + done = true; + } else { + guarantee( false, "should never reach here" ); + } + + // we now go around the outermost loop + } + + // we should have at least one region in the target young length + _young_list_target_length = MAX2((size_t) 1, final_young_length); + if (final_so_length >= final_young_length) + // and we need to ensure that the S-O length is not greater than + // the target young length (this is being a bit careful) + final_so_length = 0; + _young_list_so_prefix_length = final_so_length; + guarantee( !_in_marking_window || !_last_full_young_gc || + _young_list_so_prefix_length == 0, "invariant" ); + + // let's keep an eye of how long we spend on this calculation + // right now, I assume that we'll print it when we need it; we + // should really adde it to the breakdown of a pause + double end_time_sec = os::elapsedTime(); + double elapsed_time_ms = (end_time_sec - start_time_sec) * 1000.0; + +#if 0 + // leave this in for debugging, just in case + gclog_or_tty->print_cr("target = %1.1lf ms, young = " SIZE_FORMAT + ", SO = " SIZE_FORMAT ", " + "elapsed %1.2lf ms, calcs: " SIZE_FORMAT " (%s%s) " + SIZE_FORMAT SIZE_FORMAT, + target_pause_time_ms, + _young_list_target_length - _young_list_so_prefix_length, + _young_list_so_prefix_length, + elapsed_time_ms, + calculations, + full_young_gcs() ? "full" : "partial", + should_initiate_conc_mark() ? " i-m" : "", + in_marking_window(), + in_marking_window_im()); +#endif // 0 + + if (_young_list_target_length < _young_list_min_length) { + // bummer; this means that, if we do a pause when the optimal + // config dictates, we'll violate the pause spacing target (the + // min length was calculate based on the application's current + // alloc rate); + + // so, we have to bite the bullet, and allocate the minimum + // number. We'll violate our target, but we just can't meet it. + + size_t so_length = 0; + // a note further up explains why we do not want an S-O length + // during marking + if (!_in_marking_window && !_last_full_young_gc) + // but we can still try to see whether we can find an optimal + // S-O length + so_length = calculate_optimal_so_length(_young_list_min_length); + +#if 0 + // leave this in for debugging, just in case + gclog_or_tty->print_cr("adjusted target length from " + SIZE_FORMAT " to " SIZE_FORMAT + ", SO " SIZE_FORMAT, + _young_list_target_length, _young_list_min_length, + so_length); +#endif // 0 + + _young_list_target_length = + MAX2(_young_list_min_length, (size_t)1); + _young_list_so_prefix_length = so_length; + } + } else { + // we are in a partially-young mode or we've run out of regions (due + // to evacuation failure) + +#if 0 + // leave this in for debugging, just in case + gclog_or_tty->print_cr("(partial) setting target to " SIZE_FORMAT + ", SO " SIZE_FORMAT, + _young_list_min_length, 0); +#endif // 0 + + // we'll do the pause as soon as possible and with no S-O prefix + // (see above for the reasons behind the latter) + _young_list_target_length = + MAX2(_young_list_min_length, (size_t) 1); + _young_list_so_prefix_length = 0; + } + + _rs_lengths_prediction = rs_lengths; +} + +// This is used by: calculate_optimal_so_length(length). It returns +// the GC eff and predicted pause time for a particular config +void +G1CollectorPolicy::predict_gc_eff(size_t young_length, + size_t so_length, + double base_time_ms, + double* ret_gc_eff, + double* ret_pause_time_ms) { + double so_time_ms = predict_scan_only_time_ms(so_length); + double accum_surv_rate_adj = 0.0; + if (so_length > 0) + accum_surv_rate_adj = accum_yg_surv_rate_pred((int)(so_length - 1)); + double accum_surv_rate = + accum_yg_surv_rate_pred((int)(young_length - 1)) - accum_surv_rate_adj; + size_t bytes_to_copy = + (size_t) (accum_surv_rate * (double) HeapRegion::GrainBytes); + double copy_time_ms = predict_object_copy_time_ms(bytes_to_copy); + double young_other_time_ms = + predict_young_other_time_ms(young_length - so_length); + double pause_time_ms = + base_time_ms + so_time_ms + copy_time_ms + young_other_time_ms; + size_t reclaimed_bytes = + (young_length - so_length) * HeapRegion::GrainBytes - bytes_to_copy; + double gc_eff = (double) reclaimed_bytes / pause_time_ms; + + *ret_gc_eff = gc_eff; + *ret_pause_time_ms = pause_time_ms; +} + +// This is used by: calculate_young_list_target_config(rs_length). It +// returns the GC eff of a particular config. It returns false if that +// config violates any of the end conditions of the search in the +// calling method, or true upon success. The end conditions were put +// here since it's called twice and it was best not to replicate them +// in the caller. Also, passing the parameteres avoids having to +// recalculate them in the innermost loop. +bool +G1CollectorPolicy::predict_gc_eff(size_t young_length, + size_t so_length, + double base_time_with_so_ms, + size_t init_free_regions, + double target_pause_time_ms, + double* ret_gc_eff) { + *ret_gc_eff = 0.0; + + if (young_length >= init_free_regions) + // end condition 1: not enough space for the young regions + return false; + + double accum_surv_rate_adj = 0.0; + if (so_length > 0) + accum_surv_rate_adj = accum_yg_surv_rate_pred((int)(so_length - 1)); + double accum_surv_rate = + accum_yg_surv_rate_pred((int)(young_length - 1)) - accum_surv_rate_adj; + size_t bytes_to_copy = + (size_t) (accum_surv_rate * (double) HeapRegion::GrainBytes); + double copy_time_ms = predict_object_copy_time_ms(bytes_to_copy); + double young_other_time_ms = + predict_young_other_time_ms(young_length - so_length); + double pause_time_ms = + base_time_with_so_ms + copy_time_ms + young_other_time_ms; + + if (pause_time_ms > target_pause_time_ms) + // end condition 2: over the target pause time + return false; + + size_t reclaimed_bytes = + (young_length - so_length) * HeapRegion::GrainBytes - bytes_to_copy; + size_t free_bytes = + (init_free_regions - young_length) * HeapRegion::GrainBytes; + + if ((2.0 + sigma()) * (double) bytes_to_copy > (double) free_bytes) + // end condition 3: out of to-space (conservatively) + return false; + + // success! + double gc_eff = (double) reclaimed_bytes / pause_time_ms; + *ret_gc_eff = gc_eff; + + return true; +} + +void G1CollectorPolicy::check_prediction_validity() { + guarantee( adaptive_young_list_length(), "should not call this otherwise" ); + + size_t rs_lengths = _g1->young_list_sampled_rs_lengths(); + if (rs_lengths > _rs_lengths_prediction) { + // add 10% to avoid having to recalculate often + size_t rs_lengths_prediction = rs_lengths * 1100 / 1000; + calculate_young_list_target_config(rs_lengths_prediction); + } +} + +HeapWord* G1CollectorPolicy::mem_allocate_work(size_t size, + bool is_tlab, + bool* gc_overhead_limit_was_exceeded) { + guarantee(false, "Not using this policy feature yet."); + return NULL; +} + +// This method controls how a collector handles one or more +// of its generations being fully allocated. +HeapWord* G1CollectorPolicy::satisfy_failed_allocation(size_t size, + bool is_tlab) { + guarantee(false, "Not using this policy feature yet."); + return NULL; +} + + +#ifndef PRODUCT +bool G1CollectorPolicy::verify_young_ages() { + HeapRegion* head = _g1->young_list_first_region(); + return + verify_young_ages(head, _short_lived_surv_rate_group); + // also call verify_young_ages on any additional surv rate groups +} + +bool +G1CollectorPolicy::verify_young_ages(HeapRegion* head, + SurvRateGroup *surv_rate_group) { + guarantee( surv_rate_group != NULL, "pre-condition" ); + + const char* name = surv_rate_group->name(); + bool ret = true; + int prev_age = -1; + + for (HeapRegion* curr = head; + curr != NULL; + curr = curr->get_next_young_region()) { + SurvRateGroup* group = curr->surv_rate_group(); + if (group == NULL && !curr->is_survivor()) { + gclog_or_tty->print_cr("## %s: encountered NULL surv_rate_group", name); + ret = false; + } + + if (surv_rate_group == group) { + int age = curr->age_in_surv_rate_group(); + + if (age < 0) { + gclog_or_tty->print_cr("## %s: encountered negative age", name); + ret = false; + } + + if (age <= prev_age) { + gclog_or_tty->print_cr("## %s: region ages are not strictly increasing " + "(%d, %d)", name, age, prev_age); + ret = false; + } + prev_age = age; + } + } + + return ret; +} +#endif // PRODUCT + +void G1CollectorPolicy::record_full_collection_start() { + _cur_collection_start_sec = os::elapsedTime(); + // Release the future to-space so that it is available for compaction into. + _g1->set_full_collection(); +} + +void G1CollectorPolicy::record_full_collection_end() { + // Consider this like a collection pause for the purposes of allocation + // since last pause. + double end_sec = os::elapsedTime(); + double full_gc_time_sec = end_sec - _cur_collection_start_sec; + double full_gc_time_ms = full_gc_time_sec * 1000.0; + + checkpoint_conc_overhead(); + + _all_full_gc_times_ms->add(full_gc_time_ms); + + update_recent_gc_times(end_sec, full_gc_time_sec); + + _g1->clear_full_collection(); + + // "Nuke" the heuristics that control the fully/partially young GC + // transitions and make sure we start with fully young GCs after the + // Full GC. + set_full_young_gcs(true); + _last_full_young_gc = false; + _should_revert_to_full_young_gcs = false; + _should_initiate_conc_mark = false; + _known_garbage_bytes = 0; + _known_garbage_ratio = 0.0; + _in_marking_window = false; + _in_marking_window_im = false; + + _short_lived_surv_rate_group->record_scan_only_prefix(0); + _short_lived_surv_rate_group->start_adding_regions(); + // also call this on any additional surv rate groups + + _prev_region_num_young = _region_num_young; + _prev_region_num_tenured = _region_num_tenured; + + _free_regions_at_end_of_collection = _g1->free_regions(); + _scan_only_regions_at_end_of_collection = 0; + calculate_young_list_min_length(); + calculate_young_list_target_config(); + } + +void G1CollectorPolicy::record_pop_compute_rc_start() { + _pop_compute_rc_start = os::elapsedTime(); +} +void G1CollectorPolicy::record_pop_compute_rc_end() { + double ms = (os::elapsedTime() - _pop_compute_rc_start)*1000.0; + _cur_popular_compute_rc_time_ms = ms; + _pop_compute_rc_start = 0.0; +} +void G1CollectorPolicy::record_pop_evac_start() { + _pop_evac_start = os::elapsedTime(); +} +void G1CollectorPolicy::record_pop_evac_end() { + double ms = (os::elapsedTime() - _pop_evac_start)*1000.0; + _cur_popular_evac_time_ms = ms; + _pop_evac_start = 0.0; +} + +void G1CollectorPolicy::record_before_bytes(size_t bytes) { + _bytes_in_to_space_before_gc += bytes; +} + +void G1CollectorPolicy::record_after_bytes(size_t bytes) { + _bytes_in_to_space_after_gc += bytes; +} + +void G1CollectorPolicy::record_stop_world_start() { + _stop_world_start = os::elapsedTime(); +} + +void G1CollectorPolicy::record_collection_pause_start(double start_time_sec, + size_t start_used) { + if (PrintGCDetails) { + gclog_or_tty->stamp(PrintGCTimeStamps); + gclog_or_tty->print("[GC pause"); + if (in_young_gc_mode()) + gclog_or_tty->print(" (%s)", full_young_gcs() ? "young" : "partial"); + } + + assert(_g1->used_regions() == _g1->recalculate_used_regions(), + "sanity"); + + double s_w_t_ms = (start_time_sec - _stop_world_start) * 1000.0; + _all_stop_world_times_ms->add(s_w_t_ms); + _stop_world_start = 0.0; + + _cur_collection_start_sec = start_time_sec; + _cur_collection_pause_used_at_start_bytes = start_used; + _cur_collection_pause_used_regions_at_start = _g1->used_regions(); + _pending_cards = _g1->pending_card_num(); + _max_pending_cards = _g1->max_pending_card_num(); + + _bytes_in_to_space_before_gc = 0; + _bytes_in_to_space_after_gc = 0; + _bytes_in_collection_set_before_gc = 0; + +#ifdef DEBUG + // initialise these to something well known so that we can spot + // if they are not set properly + + for (int i = 0; i < _parallel_gc_threads; ++i) { + _par_last_ext_root_scan_times_ms[i] = -666.0; + _par_last_mark_stack_scan_times_ms[i] = -666.0; + _par_last_scan_only_times_ms[i] = -666.0; + _par_last_scan_only_regions_scanned[i] = -666.0; + _par_last_update_rs_start_times_ms[i] = -666.0; + _par_last_update_rs_times_ms[i] = -666.0; + _par_last_update_rs_processed_buffers[i] = -666.0; + _par_last_scan_rs_start_times_ms[i] = -666.0; + _par_last_scan_rs_times_ms[i] = -666.0; + _par_last_scan_new_refs_times_ms[i] = -666.0; + _par_last_obj_copy_times_ms[i] = -666.0; + _par_last_termination_times_ms[i] = -666.0; + + _pop_par_last_update_rs_start_times_ms[i] = -666.0; + _pop_par_last_update_rs_times_ms[i] = -666.0; + _pop_par_last_update_rs_processed_buffers[i] = -666.0; + _pop_par_last_scan_rs_start_times_ms[i] = -666.0; + _pop_par_last_scan_rs_times_ms[i] = -666.0; + _pop_par_last_closure_app_times_ms[i] = -666.0; + } +#endif + + for (int i = 0; i < _aux_num; ++i) { + _cur_aux_times_ms[i] = 0.0; + _cur_aux_times_set[i] = false; + } + + _satb_drain_time_set = false; + _last_satb_drain_processed_buffers = -1; + + if (in_young_gc_mode()) + _last_young_gc_full = false; + + + // do that for any other surv rate groups + _short_lived_surv_rate_group->stop_adding_regions(); + size_t short_lived_so_length = _young_list_so_prefix_length; + _short_lived_surv_rate_group->record_scan_only_prefix(short_lived_so_length); + tag_scan_only(short_lived_so_length); + + assert( verify_young_ages(), "region age verification" ); +} + +void G1CollectorPolicy::tag_scan_only(size_t short_lived_scan_only_length) { + // done in a way that it can be extended for other surv rate groups too... + + HeapRegion* head = _g1->young_list_first_region(); + bool finished_short_lived = (short_lived_scan_only_length == 0); + + if (finished_short_lived) + return; + + for (HeapRegion* curr = head; + curr != NULL; + curr = curr->get_next_young_region()) { + SurvRateGroup* surv_rate_group = curr->surv_rate_group(); + int age = curr->age_in_surv_rate_group(); + + if (surv_rate_group == _short_lived_surv_rate_group) { + if ((size_t)age < short_lived_scan_only_length) + curr->set_scan_only(); + else + finished_short_lived = true; + } + + + if (finished_short_lived) + return; + } + + guarantee( false, "we should never reach here" ); +} + +void G1CollectorPolicy::record_popular_pause_preamble_start() { + _cur_popular_preamble_start_ms = os::elapsedTime() * 1000.0; +} + +void G1CollectorPolicy::record_popular_pause_preamble_end() { + _cur_popular_preamble_time_ms = + (os::elapsedTime() * 1000.0) - _cur_popular_preamble_start_ms; + + // copy the recorded statistics of the first pass to temporary arrays + for (int i = 0; i < _parallel_gc_threads; ++i) { + _pop_par_last_update_rs_start_times_ms[i] = _par_last_update_rs_start_times_ms[i]; + _pop_par_last_update_rs_times_ms[i] = _par_last_update_rs_times_ms[i]; + _pop_par_last_update_rs_processed_buffers[i] = _par_last_update_rs_processed_buffers[i]; + _pop_par_last_scan_rs_start_times_ms[i] = _par_last_scan_rs_start_times_ms[i]; + _pop_par_last_scan_rs_times_ms[i] = _par_last_scan_rs_times_ms[i]; + _pop_par_last_closure_app_times_ms[i] = _par_last_obj_copy_times_ms[i]; + } +} + +void G1CollectorPolicy::record_mark_closure_time(double mark_closure_time_ms) { + _mark_closure_time_ms = mark_closure_time_ms; +} + +void G1CollectorPolicy::record_concurrent_mark_init_start() { + _mark_init_start_sec = os::elapsedTime(); + guarantee(!in_young_gc_mode(), "should not do be here in young GC mode"); +} + +void G1CollectorPolicy::record_concurrent_mark_init_end_pre(double + mark_init_elapsed_time_ms) { + _during_marking = true; + _should_initiate_conc_mark = false; + _cur_mark_stop_world_time_ms = mark_init_elapsed_time_ms; +} + +void G1CollectorPolicy::record_concurrent_mark_init_end() { + double end_time_sec = os::elapsedTime(); + double elapsed_time_ms = (end_time_sec - _mark_init_start_sec) * 1000.0; + _concurrent_mark_init_times_ms->add(elapsed_time_ms); + checkpoint_conc_overhead(); + record_concurrent_mark_init_end_pre(elapsed_time_ms); + + _mmu_tracker->add_pause(_mark_init_start_sec, end_time_sec, true); +} + +void G1CollectorPolicy::record_concurrent_mark_remark_start() { + _mark_remark_start_sec = os::elapsedTime(); + _during_marking = false; +} + +void G1CollectorPolicy::record_concurrent_mark_remark_end() { + double end_time_sec = os::elapsedTime(); + double elapsed_time_ms = (end_time_sec - _mark_remark_start_sec)*1000.0; + checkpoint_conc_overhead(); + _concurrent_mark_remark_times_ms->add(elapsed_time_ms); + _cur_mark_stop_world_time_ms += elapsed_time_ms; + _prev_collection_pause_end_ms += elapsed_time_ms; + + _mmu_tracker->add_pause(_mark_remark_start_sec, end_time_sec, true); +} + +void G1CollectorPolicy::record_concurrent_mark_cleanup_start() { + _mark_cleanup_start_sec = os::elapsedTime(); +} + +void +G1CollectorPolicy::record_concurrent_mark_cleanup_end(size_t freed_bytes, + size_t max_live_bytes) { + record_concurrent_mark_cleanup_end_work1(freed_bytes, max_live_bytes); + record_concurrent_mark_cleanup_end_work2(); +} + +void +G1CollectorPolicy:: +record_concurrent_mark_cleanup_end_work1(size_t freed_bytes, + size_t max_live_bytes) { + if (_n_marks < 2) _n_marks++; + if (G1PolicyVerbose > 0) + gclog_or_tty->print_cr("At end of marking, max_live is " SIZE_FORMAT " MB " + " (of " SIZE_FORMAT " MB heap).", + max_live_bytes/M, _g1->capacity()/M); +} + +// The important thing about this is that it includes "os::elapsedTime". +void G1CollectorPolicy::record_concurrent_mark_cleanup_end_work2() { + checkpoint_conc_overhead(); + double end_time_sec = os::elapsedTime(); + double elapsed_time_ms = (end_time_sec - _mark_cleanup_start_sec)*1000.0; + _concurrent_mark_cleanup_times_ms->add(elapsed_time_ms); + _cur_mark_stop_world_time_ms += elapsed_time_ms; + _prev_collection_pause_end_ms += elapsed_time_ms; + + _mmu_tracker->add_pause(_mark_cleanup_start_sec, end_time_sec, true); + + _num_markings++; + + // We did a marking, so reset the "since_last_mark" variables. + double considerConcMarkCost = 1.0; + // If there are available processors, concurrent activity is free... + if (Threads::number_of_non_daemon_threads() * 2 < + os::active_processor_count()) { + considerConcMarkCost = 0.0; + } + _n_pauses_at_mark_end = _n_pauses; + _n_marks_since_last_pause++; + _conc_mark_initiated = false; +} + +void +G1CollectorPolicy::record_concurrent_mark_cleanup_completed() { + if (in_young_gc_mode()) { + _should_revert_to_full_young_gcs = false; + _last_full_young_gc = true; + _in_marking_window = false; + if (adaptive_young_list_length()) + calculate_young_list_target_config(); + } +} + +void G1CollectorPolicy::record_concurrent_pause() { + if (_stop_world_start > 0.0) { + double yield_ms = (os::elapsedTime() - _stop_world_start) * 1000.0; + _all_yield_times_ms->add(yield_ms); + } +} + +void G1CollectorPolicy::record_concurrent_pause_end() { +} + +void G1CollectorPolicy::record_collection_pause_end_CH_strong_roots() { + _cur_CH_strong_roots_end_sec = os::elapsedTime(); + _cur_CH_strong_roots_dur_ms = + (_cur_CH_strong_roots_end_sec - _cur_collection_start_sec) * 1000.0; +} + +void G1CollectorPolicy::record_collection_pause_end_G1_strong_roots() { + _cur_G1_strong_roots_end_sec = os::elapsedTime(); + _cur_G1_strong_roots_dur_ms = + (_cur_G1_strong_roots_end_sec - _cur_CH_strong_roots_end_sec) * 1000.0; +} + +template +T sum_of(T* sum_arr, int start, int n, int N) { + T sum = (T)0; + for (int i = 0; i < n; i++) { + int j = (start + i) % N; + sum += sum_arr[j]; + } + return sum; +} + +void G1CollectorPolicy::print_par_stats (int level, + const char* str, + double* data, + bool summary) { + double min = data[0], max = data[0]; + double total = 0.0; + int j; + for (j = 0; j < level; ++j) + gclog_or_tty->print(" "); + gclog_or_tty->print("[%s (ms):", str); + for (uint i = 0; i < ParallelGCThreads; ++i) { + double val = data[i]; + if (val < min) + min = val; + if (val > max) + max = val; + total += val; + gclog_or_tty->print(" %3.1lf", val); + } + if (summary) { + gclog_or_tty->print_cr(""); + double avg = total / (double) ParallelGCThreads; + gclog_or_tty->print(" "); + for (j = 0; j < level; ++j) + gclog_or_tty->print(" "); + gclog_or_tty->print("Avg: %5.1lf, Min: %5.1lf, Max: %5.1lf", + avg, min, max); + } + gclog_or_tty->print_cr("]"); +} + +void G1CollectorPolicy::print_par_buffers (int level, + const char* str, + double* data, + bool summary) { + double min = data[0], max = data[0]; + double total = 0.0; + int j; + for (j = 0; j < level; ++j) + gclog_or_tty->print(" "); + gclog_or_tty->print("[%s :", str); + for (uint i = 0; i < ParallelGCThreads; ++i) { + double val = data[i]; + if (val < min) + min = val; + if (val > max) + max = val; + total += val; + gclog_or_tty->print(" %d", (int) val); + } + if (summary) { + gclog_or_tty->print_cr(""); + double avg = total / (double) ParallelGCThreads; + gclog_or_tty->print(" "); + for (j = 0; j < level; ++j) + gclog_or_tty->print(" "); + gclog_or_tty->print("Sum: %d, Avg: %d, Min: %d, Max: %d", + (int)total, (int)avg, (int)min, (int)max); + } + gclog_or_tty->print_cr("]"); +} + +void G1CollectorPolicy::print_stats (int level, + const char* str, + double value) { + for (int j = 0; j < level; ++j) + gclog_or_tty->print(" "); + gclog_or_tty->print_cr("[%s: %5.1lf ms]", str, value); +} + +void G1CollectorPolicy::print_stats (int level, + const char* str, + int value) { + for (int j = 0; j < level; ++j) + gclog_or_tty->print(" "); + gclog_or_tty->print_cr("[%s: %d]", str, value); +} + +double G1CollectorPolicy::avg_value (double* data) { + if (ParallelGCThreads > 0) { + double ret = 0.0; + for (uint i = 0; i < ParallelGCThreads; ++i) + ret += data[i]; + return ret / (double) ParallelGCThreads; + } else { + return data[0]; + } +} + +double G1CollectorPolicy::max_value (double* data) { + if (ParallelGCThreads > 0) { + double ret = data[0]; + for (uint i = 1; i < ParallelGCThreads; ++i) + if (data[i] > ret) + ret = data[i]; + return ret; + } else { + return data[0]; + } +} + +double G1CollectorPolicy::sum_of_values (double* data) { + if (ParallelGCThreads > 0) { + double sum = 0.0; + for (uint i = 0; i < ParallelGCThreads; i++) + sum += data[i]; + return sum; + } else { + return data[0]; + } +} + +double G1CollectorPolicy::max_sum (double* data1, + double* data2) { + double ret = data1[0] + data2[0]; + + if (ParallelGCThreads > 0) { + for (uint i = 1; i < ParallelGCThreads; ++i) { + double data = data1[i] + data2[i]; + if (data > ret) + ret = data; + } + } + return ret; +} + +// Anything below that is considered to be zero +#define MIN_TIMER_GRANULARITY 0.0000001 + +void G1CollectorPolicy::record_collection_pause_end(bool popular, + bool abandoned) { + double end_time_sec = os::elapsedTime(); + double elapsed_ms = _last_pause_time_ms; + bool parallel = ParallelGCThreads > 0; + double evac_ms = (end_time_sec - _cur_G1_strong_roots_end_sec) * 1000.0; + size_t rs_size = + _cur_collection_pause_used_regions_at_start - collection_set_size(); + size_t cur_used_bytes = _g1->used(); + assert(cur_used_bytes == _g1->recalculate_used(), "It should!"); + bool last_pause_included_initial_mark = false; + +#ifndef PRODUCT + if (G1YoungSurvRateVerbose) { + gclog_or_tty->print_cr(""); + _short_lived_surv_rate_group->print(); + // do that for any other surv rate groups too + } +#endif // PRODUCT + + checkpoint_conc_overhead(); + + if (in_young_gc_mode()) { + last_pause_included_initial_mark = _should_initiate_conc_mark; + if (last_pause_included_initial_mark) + record_concurrent_mark_init_end_pre(0.0); + + size_t min_used_targ = + (_g1->capacity() / 100) * (G1SteadyStateUsed - G1SteadyStateUsedDelta); + + 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; + } + } + + _prev_collection_pause_used_at_end_bytes = cur_used_bytes; + } + + _mmu_tracker->add_pause(end_time_sec - elapsed_ms/1000.0, + end_time_sec, false); + + guarantee(_cur_collection_pause_used_regions_at_start >= + collection_set_size(), + "Negative RS size?"); + + // This assert is exempted when we're doing parallel collection pauses, + // because the fragmentation caused by the parallel GC allocation buffers + // can lead to more memory being used during collection than was used + // before. Best leave this out until the fragmentation problem is fixed. + // Pauses in which evacuation failed can also lead to negative + // collections, since no space is reclaimed from a region containing an + // object whose evacuation failed. + // Further, we're now always doing parallel collection. But I'm still + // leaving this here as a placeholder for a more precise assertion later. + // (DLD, 10/05.) + assert((true || parallel) // Always using GC LABs now. + || _g1->evacuation_failed() + || _cur_collection_pause_used_at_start_bytes >= cur_used_bytes, + "Negative collection"); + + size_t freed_bytes = + _cur_collection_pause_used_at_start_bytes - cur_used_bytes; + size_t surviving_bytes = _collection_set_bytes_used_before - freed_bytes; + double survival_fraction = + (double)surviving_bytes/ + (double)_collection_set_bytes_used_before; + + _n_pauses++; + + if (!abandoned) { + _recent_CH_strong_roots_times_ms->add(_cur_CH_strong_roots_dur_ms); + _recent_G1_strong_roots_times_ms->add(_cur_G1_strong_roots_dur_ms); + _recent_evac_times_ms->add(evac_ms); + _recent_pause_times_ms->add(elapsed_ms); + + _recent_rs_sizes->add(rs_size); + + // We exempt parallel collection from this check because Alloc Buffer + // fragmentation can produce negative collections. Same with evac + // failure. + // Further, we're now always doing parallel collection. But I'm still + // leaving this here as a placeholder for a more precise assertion later. + // (DLD, 10/05. + assert((true || parallel) + || _g1->evacuation_failed() + || surviving_bytes <= _collection_set_bytes_used_before, + "Or else negative collection!"); + _recent_CS_bytes_used_before->add(_collection_set_bytes_used_before); + _recent_CS_bytes_surviving->add(surviving_bytes); + + // this is where we update the allocation rate of the application + double app_time_ms = + (_cur_collection_start_sec * 1000.0 - _prev_collection_pause_end_ms); + if (app_time_ms < MIN_TIMER_GRANULARITY) { + // This usually happens due to the timer not having the required + // granularity. Some Linuxes are the usual culprits. + // We'll just set it to something (arbitrarily) small. + app_time_ms = 1.0; + } + size_t regions_allocated = + (_region_num_young - _prev_region_num_young) + + (_region_num_tenured - _prev_region_num_tenured); + double alloc_rate_ms = (double) regions_allocated / app_time_ms; + _alloc_rate_ms_seq->add(alloc_rate_ms); + _prev_region_num_young = _region_num_young; + _prev_region_num_tenured = _region_num_tenured; + + double interval_ms = + (end_time_sec - _recent_prev_end_times_for_all_gcs_sec->oldest()) * 1000.0; + update_recent_gc_times(end_time_sec, elapsed_ms); + _recent_avg_pause_time_ratio = _recent_gc_times_ms->sum()/interval_ms; + assert(recent_avg_pause_time_ratio() < 1.00, "All GC?"); + } + + if (G1PolicyVerbose > 1) { + gclog_or_tty->print_cr(" Recording collection pause(%d)", _n_pauses); + } + + PauseSummary* summary; + if (!abandoned && !popular) + summary = _non_pop_summary; + else if (!abandoned && popular) + summary = _pop_summary; + else if (abandoned && !popular) + summary = _non_pop_abandoned_summary; + else if (abandoned && popular) + summary = _pop_abandoned_summary; + else + guarantee(false, "should not get here!"); + + double pop_update_rs_time; + double pop_update_rs_processed_buffers; + double pop_scan_rs_time; + double pop_closure_app_time; + double pop_other_time; + + if (popular) { + PopPreambleSummary* preamble_summary = summary->pop_preamble_summary(); + guarantee(preamble_summary != NULL, "should not be null!"); + + pop_update_rs_time = avg_value(_pop_par_last_update_rs_times_ms); + pop_update_rs_processed_buffers = + sum_of_values(_pop_par_last_update_rs_processed_buffers); + pop_scan_rs_time = avg_value(_pop_par_last_scan_rs_times_ms); + pop_closure_app_time = avg_value(_pop_par_last_closure_app_times_ms); + pop_other_time = _cur_popular_preamble_time_ms - + (pop_update_rs_time + pop_scan_rs_time + pop_closure_app_time + + _cur_popular_evac_time_ms); + + preamble_summary->record_pop_preamble_time_ms(_cur_popular_preamble_time_ms); + preamble_summary->record_pop_update_rs_time_ms(pop_update_rs_time); + preamble_summary->record_pop_scan_rs_time_ms(pop_scan_rs_time); + preamble_summary->record_pop_closure_app_time_ms(pop_closure_app_time); + preamble_summary->record_pop_evacuation_time_ms(_cur_popular_evac_time_ms); + preamble_summary->record_pop_other_time_ms(pop_other_time); + } + + double ext_root_scan_time = avg_value(_par_last_ext_root_scan_times_ms); + double mark_stack_scan_time = avg_value(_par_last_mark_stack_scan_times_ms); + double scan_only_time = avg_value(_par_last_scan_only_times_ms); + double scan_only_regions_scanned = + sum_of_values(_par_last_scan_only_regions_scanned); + double update_rs_time = avg_value(_par_last_update_rs_times_ms); + double update_rs_processed_buffers = + sum_of_values(_par_last_update_rs_processed_buffers); + double scan_rs_time = avg_value(_par_last_scan_rs_times_ms); + double obj_copy_time = avg_value(_par_last_obj_copy_times_ms); + double termination_time = avg_value(_par_last_termination_times_ms); + + double parallel_other_time; + if (!abandoned) { + MainBodySummary* body_summary = summary->main_body_summary(); + guarantee(body_summary != NULL, "should not be null!"); + + if (_satb_drain_time_set) + body_summary->record_satb_drain_time_ms(_cur_satb_drain_time_ms); + else + body_summary->record_satb_drain_time_ms(0.0); + body_summary->record_ext_root_scan_time_ms(ext_root_scan_time); + body_summary->record_mark_stack_scan_time_ms(mark_stack_scan_time); + body_summary->record_scan_only_time_ms(scan_only_time); + body_summary->record_update_rs_time_ms(update_rs_time); + body_summary->record_scan_rs_time_ms(scan_rs_time); + body_summary->record_obj_copy_time_ms(obj_copy_time); + if (parallel) { + body_summary->record_parallel_time_ms(_cur_collection_par_time_ms); + body_summary->record_clear_ct_time_ms(_cur_clear_ct_time_ms); + body_summary->record_termination_time_ms(termination_time); + parallel_other_time = _cur_collection_par_time_ms - + (update_rs_time + ext_root_scan_time + mark_stack_scan_time + + scan_only_time + scan_rs_time + obj_copy_time + termination_time); + body_summary->record_parallel_other_time_ms(parallel_other_time); + } + body_summary->record_mark_closure_time_ms(_mark_closure_time_ms); + } + + if (G1PolicyVerbose > 1) { + gclog_or_tty->print_cr(" ET: %10.6f ms (avg: %10.6f ms)\n" + " CH Strong: %10.6f ms (avg: %10.6f ms)\n" + " G1 Strong: %10.6f ms (avg: %10.6f ms)\n" + " Evac: %10.6f ms (avg: %10.6f ms)\n" + " ET-RS: %10.6f ms (avg: %10.6f ms)\n" + " |RS|: " SIZE_FORMAT, + elapsed_ms, recent_avg_time_for_pauses_ms(), + _cur_CH_strong_roots_dur_ms, recent_avg_time_for_CH_strong_ms(), + _cur_G1_strong_roots_dur_ms, recent_avg_time_for_G1_strong_ms(), + evac_ms, recent_avg_time_for_evac_ms(), + scan_rs_time, + recent_avg_time_for_pauses_ms() - + recent_avg_time_for_G1_strong_ms(), + rs_size); + + gclog_or_tty->print_cr(" Used at start: " SIZE_FORMAT"K" + " At end " SIZE_FORMAT "K\n" + " garbage : " SIZE_FORMAT "K" + " of " SIZE_FORMAT "K\n" + " survival : %6.2f%% (%6.2f%% avg)", + _cur_collection_pause_used_at_start_bytes/K, + _g1->used()/K, freed_bytes/K, + _collection_set_bytes_used_before/K, + survival_fraction*100.0, + recent_avg_survival_fraction()*100.0); + gclog_or_tty->print_cr(" Recent %% gc pause time: %6.2f", + recent_avg_pause_time_ratio() * 100.0); + } + + double other_time_ms = elapsed_ms; + if (popular) + other_time_ms -= _cur_popular_preamble_time_ms; + + if (!abandoned) { + if (_satb_drain_time_set) + other_time_ms -= _cur_satb_drain_time_ms; + + if (parallel) + other_time_ms -= _cur_collection_par_time_ms + _cur_clear_ct_time_ms; + else + other_time_ms -= + update_rs_time + + ext_root_scan_time + mark_stack_scan_time + scan_only_time + + scan_rs_time + obj_copy_time; + } + + if (PrintGCDetails) { + gclog_or_tty->print_cr("%s%s, %1.8lf secs]", + (popular && !abandoned) ? " (popular)" : + (!popular && abandoned) ? " (abandoned)" : + (popular && abandoned) ? " (popular/abandoned)" : "", + (last_pause_included_initial_mark) ? " (initial-mark)" : "", + elapsed_ms / 1000.0); + + if (!abandoned) { + if (_satb_drain_time_set) + print_stats(1, "SATB Drain Time", _cur_satb_drain_time_ms); + if (_last_satb_drain_processed_buffers >= 0) + print_stats(2, "Processed Buffers", _last_satb_drain_processed_buffers); + } + if (popular) + print_stats(1, "Popularity Preamble", _cur_popular_preamble_time_ms); + if (parallel) { + if (popular) { + print_par_stats(2, "Update RS (Start)", _pop_par_last_update_rs_start_times_ms, false); + print_par_stats(2, "Update RS", _pop_par_last_update_rs_times_ms); + if (G1RSBarrierUseQueue) + print_par_buffers(3, "Processed Buffers", + _pop_par_last_update_rs_processed_buffers, true); + print_par_stats(2, "Scan RS", _pop_par_last_scan_rs_times_ms); + print_par_stats(2, "Closure app", _pop_par_last_closure_app_times_ms); + print_stats(2, "Evacuation", _cur_popular_evac_time_ms); + print_stats(2, "Other", pop_other_time); + } + if (!abandoned) { + print_stats(1, "Parallel Time", _cur_collection_par_time_ms); + if (!popular) { + print_par_stats(2, "Update RS (Start)", _par_last_update_rs_start_times_ms, false); + print_par_stats(2, "Update RS", _par_last_update_rs_times_ms); + if (G1RSBarrierUseQueue) + print_par_buffers(3, "Processed Buffers", + _par_last_update_rs_processed_buffers, true); + } + print_par_stats(2, "Ext Root Scanning", _par_last_ext_root_scan_times_ms); + print_par_stats(2, "Mark Stack Scanning", _par_last_mark_stack_scan_times_ms); + print_par_stats(2, "Scan-Only Scanning", _par_last_scan_only_times_ms); + print_par_buffers(3, "Scan-Only Regions", + _par_last_scan_only_regions_scanned, true); + print_par_stats(2, "Scan RS", _par_last_scan_rs_times_ms); + print_par_stats(2, "Object Copy", _par_last_obj_copy_times_ms); + print_par_stats(2, "Termination", _par_last_termination_times_ms); + print_stats(2, "Other", parallel_other_time); + print_stats(1, "Clear CT", _cur_clear_ct_time_ms); + } + } else { + if (popular) { + print_stats(2, "Update RS", pop_update_rs_time); + if (G1RSBarrierUseQueue) + print_stats(3, "Processed Buffers", + (int)pop_update_rs_processed_buffers); + print_stats(2, "Scan RS", pop_scan_rs_time); + print_stats(2, "Closure App", pop_closure_app_time); + print_stats(2, "Evacuation", _cur_popular_evac_time_ms); + print_stats(2, "Other", pop_other_time); + } + if (!abandoned) { + if (!popular) { + print_stats(1, "Update RS", update_rs_time); + if (G1RSBarrierUseQueue) + print_stats(2, "Processed Buffers", + (int)update_rs_processed_buffers); + } + print_stats(1, "Ext Root Scanning", ext_root_scan_time); + print_stats(1, "Mark Stack Scanning", mark_stack_scan_time); + print_stats(1, "Scan-Only Scanning", scan_only_time); + print_stats(1, "Scan RS", scan_rs_time); + print_stats(1, "Object Copying", obj_copy_time); + } + } + print_stats(1, "Other", other_time_ms); + for (int i = 0; i < _aux_num; ++i) { + if (_cur_aux_times_set[i]) { + char buffer[96]; + sprintf(buffer, "Aux%d", i); + print_stats(1, buffer, _cur_aux_times_ms[i]); + } + } + } + if (PrintGCDetails) + gclog_or_tty->print(" ["); + if (PrintGC || PrintGCDetails) + _g1->print_size_transition(gclog_or_tty, + _cur_collection_pause_used_at_start_bytes, + _g1->used(), _g1->capacity()); + if (PrintGCDetails) + gclog_or_tty->print_cr("]"); + + _all_pause_times_ms->add(elapsed_ms); + summary->record_total_time_ms(elapsed_ms); + summary->record_other_time_ms(other_time_ms); + for (int i = 0; i < _aux_num; ++i) + if (_cur_aux_times_set[i]) + _all_aux_times_ms[i].add(_cur_aux_times_ms[i]); + + // Reset marks-between-pauses counter. + _n_marks_since_last_pause = 0; + + // Update the efficiency-since-mark vars. + double proc_ms = elapsed_ms * (double) _parallel_gc_threads; + if (elapsed_ms < MIN_TIMER_GRANULARITY) { + // This usually happens due to the timer not having the required + // granularity. Some Linuxes are the usual culprits. + // We'll just set it to something (arbitrarily) small. + proc_ms = 1.0; + } + double cur_efficiency = (double) freed_bytes / proc_ms; + + bool new_in_marking_window = _in_marking_window; + bool new_in_marking_window_im = false; + if (_should_initiate_conc_mark) { + new_in_marking_window = true; + new_in_marking_window_im = true; + } + + if (in_young_gc_mode()) { + if (_last_full_young_gc) { + set_full_young_gcs(false); + _last_full_young_gc = false; + } + + if ( !_last_young_gc_full ) { + if ( _should_revert_to_full_young_gcs || + _known_garbage_ratio < 0.05 || + (adaptive_young_list_length() && + (get_gc_eff_factor() * cur_efficiency < predict_young_gc_eff())) ) { + set_full_young_gcs(true); + } + } + _should_revert_to_full_young_gcs = false; + + if (_last_young_gc_full && !_during_marking) + _young_gc_eff_seq->add(cur_efficiency); + } + + _short_lived_surv_rate_group->start_adding_regions(); + // do that for any other surv rate groupsx + + // + + if (!popular && !abandoned) { + double pause_time_ms = elapsed_ms; + + size_t diff = 0; + if (_max_pending_cards >= _pending_cards) + diff = _max_pending_cards - _pending_cards; + _pending_card_diff_seq->add((double) diff); + + double cost_per_card_ms = 0.0; + if (_pending_cards > 0) { + cost_per_card_ms = update_rs_time / (double) _pending_cards; + _cost_per_card_ms_seq->add(cost_per_card_ms); + } + + double cost_per_scan_only_region_ms = 0.0; + if (scan_only_regions_scanned > 0.0) { + cost_per_scan_only_region_ms = + scan_only_time / scan_only_regions_scanned; + if (_in_marking_window_im) + _cost_per_scan_only_region_ms_during_cm_seq->add(cost_per_scan_only_region_ms); + else + _cost_per_scan_only_region_ms_seq->add(cost_per_scan_only_region_ms); + } + + size_t cards_scanned = _g1->cards_scanned(); + + double cost_per_entry_ms = 0.0; + if (cards_scanned > 10) { + cost_per_entry_ms = scan_rs_time / (double) cards_scanned; + if (_last_young_gc_full) + _cost_per_entry_ms_seq->add(cost_per_entry_ms); + else + _partially_young_cost_per_entry_ms_seq->add(cost_per_entry_ms); + } + + if (_max_rs_lengths > 0) { + double cards_per_entry_ratio = + (double) cards_scanned / (double) _max_rs_lengths; + if (_last_young_gc_full) + _fully_young_cards_per_entry_ratio_seq->add(cards_per_entry_ratio); + else + _partially_young_cards_per_entry_ratio_seq->add(cards_per_entry_ratio); + } + + size_t rs_length_diff = _max_rs_lengths - _recorded_rs_lengths; + if (rs_length_diff >= 0) + _rs_length_diff_seq->add((double) rs_length_diff); + + size_t copied_bytes = surviving_bytes; + double cost_per_byte_ms = 0.0; + if (copied_bytes > 0) { + cost_per_byte_ms = obj_copy_time / (double) copied_bytes; + if (_in_marking_window) + _cost_per_byte_ms_during_cm_seq->add(cost_per_byte_ms); + else + _cost_per_byte_ms_seq->add(cost_per_byte_ms); + } + + double all_other_time_ms = pause_time_ms - + (update_rs_time + scan_only_time + scan_rs_time + obj_copy_time + + _mark_closure_time_ms + termination_time); + + double young_other_time_ms = 0.0; + if (_recorded_young_regions > 0) { + young_other_time_ms = + _recorded_young_cset_choice_time_ms + + _recorded_young_free_cset_time_ms; + _young_other_cost_per_region_ms_seq->add(young_other_time_ms / + (double) _recorded_young_regions); + } + double non_young_other_time_ms = 0.0; + if (_recorded_non_young_regions > 0) { + non_young_other_time_ms = + _recorded_non_young_cset_choice_time_ms + + _recorded_non_young_free_cset_time_ms; + + _non_young_other_cost_per_region_ms_seq->add(non_young_other_time_ms / + (double) _recorded_non_young_regions); + } + + double constant_other_time_ms = all_other_time_ms - + (young_other_time_ms + non_young_other_time_ms); + _constant_other_time_ms_seq->add(constant_other_time_ms); + + double survival_ratio = 0.0; + if (_bytes_in_collection_set_before_gc > 0) { + survival_ratio = (double) bytes_in_to_space_during_gc() / + (double) _bytes_in_collection_set_before_gc; + } + + _pending_cards_seq->add((double) _pending_cards); + _scanned_cards_seq->add((double) cards_scanned); + _rs_lengths_seq->add((double) _max_rs_lengths); + + double expensive_region_limit_ms = + (double) G1MaxPauseTimeMS - predict_constant_other_time_ms(); + if (expensive_region_limit_ms < 0.0) { + // this means that the other time was predicted to be longer than + // than the max pause time + expensive_region_limit_ms = (double) G1MaxPauseTimeMS; + } + _expensive_region_limit_ms = expensive_region_limit_ms; + + if (PREDICTIONS_VERBOSE) { + gclog_or_tty->print_cr(""); + gclog_or_tty->print_cr("PREDICTIONS %1.4lf %d " + "REGIONS %d %d %d %d " + "PENDING_CARDS %d %d " + "CARDS_SCANNED %d %d " + "RS_LENGTHS %d %d " + "SCAN_ONLY_SCAN %1.6lf %1.6lf " + "RS_UPDATE %1.6lf %1.6lf RS_SCAN %1.6lf %1.6lf " + "SURVIVAL_RATIO %1.6lf %1.6lf " + "OBJECT_COPY %1.6lf %1.6lf OTHER_CONSTANT %1.6lf %1.6lf " + "OTHER_YOUNG %1.6lf %1.6lf " + "OTHER_NON_YOUNG %1.6lf %1.6lf " + "VTIME_DIFF %1.6lf TERMINATION %1.6lf " + "ELAPSED %1.6lf %1.6lf ", + _cur_collection_start_sec, + (!_last_young_gc_full) ? 2 : + (last_pause_included_initial_mark) ? 1 : 0, + _recorded_region_num, + _recorded_young_regions, + _recorded_scan_only_regions, + _recorded_non_young_regions, + _predicted_pending_cards, _pending_cards, + _predicted_cards_scanned, cards_scanned, + _predicted_rs_lengths, _max_rs_lengths, + _predicted_scan_only_scan_time_ms, scan_only_time, + _predicted_rs_update_time_ms, update_rs_time, + _predicted_rs_scan_time_ms, scan_rs_time, + _predicted_survival_ratio, survival_ratio, + _predicted_object_copy_time_ms, obj_copy_time, + _predicted_constant_other_time_ms, constant_other_time_ms, + _predicted_young_other_time_ms, young_other_time_ms, + _predicted_non_young_other_time_ms, + non_young_other_time_ms, + _vtime_diff_ms, termination_time, + _predicted_pause_time_ms, elapsed_ms); + } + + if (G1PolicyVerbose > 0) { + gclog_or_tty->print_cr("Pause Time, predicted: %1.4lfms (predicted %s), actual: %1.4lfms", + _predicted_pause_time_ms, + (_within_target) ? "within" : "outside", + elapsed_ms); + } + + } + + _in_marking_window = new_in_marking_window; + _in_marking_window_im = new_in_marking_window_im; + _free_regions_at_end_of_collection = _g1->free_regions(); + _scan_only_regions_at_end_of_collection = _g1->young_list_length(); + calculate_young_list_min_length(); + calculate_young_list_target_config(); + + // + + _target_pause_time_ms = -1.0; + + // TODO: calculate tenuring threshold + _tenuring_threshold = MaxTenuringThreshold; +} + +// + +double +G1CollectorPolicy:: +predict_young_collection_elapsed_time_ms(size_t adjustment) { + guarantee( adjustment == 0 || adjustment == 1, "invariant" ); + + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + size_t young_num = g1h->young_list_length(); + if (young_num == 0) + return 0.0; + + young_num += adjustment; + size_t pending_cards = predict_pending_cards(); + size_t rs_lengths = g1h->young_list_sampled_rs_lengths() + + predict_rs_length_diff(); + size_t card_num; + if (full_young_gcs()) + card_num = predict_young_card_num(rs_lengths); + else + card_num = predict_non_young_card_num(rs_lengths); + size_t young_byte_size = young_num * HeapRegion::GrainBytes; + double accum_yg_surv_rate = + _short_lived_surv_rate_group->accum_surv_rate(adjustment); + + size_t bytes_to_copy = + (size_t) (accum_yg_surv_rate * (double) HeapRegion::GrainBytes); + + return + predict_rs_update_time_ms(pending_cards) + + predict_rs_scan_time_ms(card_num) + + predict_object_copy_time_ms(bytes_to_copy) + + predict_young_other_time_ms(young_num) + + predict_constant_other_time_ms(); +} + +double +G1CollectorPolicy::predict_base_elapsed_time_ms(size_t pending_cards) { + size_t rs_length = predict_rs_length_diff(); + size_t card_num; + if (full_young_gcs()) + card_num = predict_young_card_num(rs_length); + else + card_num = predict_non_young_card_num(rs_length); + return predict_base_elapsed_time_ms(pending_cards, card_num); +} + +double +G1CollectorPolicy::predict_base_elapsed_time_ms(size_t pending_cards, + size_t scanned_cards) { + return + predict_rs_update_time_ms(pending_cards) + + predict_rs_scan_time_ms(scanned_cards) + + predict_constant_other_time_ms(); +} + +double +G1CollectorPolicy::predict_region_elapsed_time_ms(HeapRegion* hr, + bool young) { + size_t rs_length = hr->rem_set()->occupied(); + size_t card_num; + if (full_young_gcs()) + card_num = predict_young_card_num(rs_length); + else + card_num = predict_non_young_card_num(rs_length); + size_t bytes_to_copy = predict_bytes_to_copy(hr); + + double region_elapsed_time_ms = + predict_rs_scan_time_ms(card_num) + + predict_object_copy_time_ms(bytes_to_copy); + + if (young) + region_elapsed_time_ms += predict_young_other_time_ms(1); + else + region_elapsed_time_ms += predict_non_young_other_time_ms(1); + + return region_elapsed_time_ms; +} + +size_t +G1CollectorPolicy::predict_bytes_to_copy(HeapRegion* hr) { + size_t bytes_to_copy; + if (hr->is_marked()) + bytes_to_copy = hr->max_live_bytes(); + else { + guarantee( hr->is_young() && hr->age_in_surv_rate_group() != -1, + "invariant" ); + int age = hr->age_in_surv_rate_group(); + double yg_surv_rate = predict_yg_surv_rate(age); + bytes_to_copy = (size_t) ((double) hr->used() * yg_surv_rate); + } + + return bytes_to_copy; +} + +void +G1CollectorPolicy::start_recording_regions() { + _recorded_rs_lengths = 0; + _recorded_scan_only_regions = 0; + _recorded_young_regions = 0; + _recorded_non_young_regions = 0; + +#if PREDICTIONS_VERBOSE + _predicted_rs_lengths = 0; + _predicted_cards_scanned = 0; + + _recorded_marked_bytes = 0; + _recorded_young_bytes = 0; + _predicted_bytes_to_copy = 0; +#endif // PREDICTIONS_VERBOSE +} + +void +G1CollectorPolicy::record_cset_region(HeapRegion* hr, bool young) { + if (young) { + ++_recorded_young_regions; + } else { + ++_recorded_non_young_regions; + } +#if PREDICTIONS_VERBOSE + if (young) { + _recorded_young_bytes += hr->asSpace()->used(); + } else { + _recorded_marked_bytes += hr->max_live_bytes(); + } + _predicted_bytes_to_copy += predict_bytes_to_copy(hr); +#endif // PREDICTIONS_VERBOSE + + size_t rs_length = hr->rem_set()->occupied(); + _recorded_rs_lengths += rs_length; +} + +void +G1CollectorPolicy::record_scan_only_regions(size_t scan_only_length) { + _recorded_scan_only_regions = scan_only_length; +} + +void +G1CollectorPolicy::end_recording_regions() { +#if PREDICTIONS_VERBOSE + _predicted_pending_cards = predict_pending_cards(); + _predicted_rs_lengths = _recorded_rs_lengths + predict_rs_length_diff(); + if (full_young_gcs()) + _predicted_cards_scanned += predict_young_card_num(_predicted_rs_lengths); + else + _predicted_cards_scanned += + predict_non_young_card_num(_predicted_rs_lengths); + _recorded_region_num = _recorded_young_regions + _recorded_non_young_regions; + + _predicted_young_survival_ratio = 0.0; + for (int i = 0; i < _recorded_young_regions; ++i) + _predicted_young_survival_ratio += predict_yg_surv_rate(i); + _predicted_young_survival_ratio /= (double) _recorded_young_regions; + + _predicted_scan_only_scan_time_ms = + predict_scan_only_time_ms(_recorded_scan_only_regions); + _predicted_rs_update_time_ms = + predict_rs_update_time_ms(_g1->pending_card_num()); + _predicted_rs_scan_time_ms = + predict_rs_scan_time_ms(_predicted_cards_scanned); + _predicted_object_copy_time_ms = + predict_object_copy_time_ms(_predicted_bytes_to_copy); + _predicted_constant_other_time_ms = + predict_constant_other_time_ms(); + _predicted_young_other_time_ms = + predict_young_other_time_ms(_recorded_young_regions); + _predicted_non_young_other_time_ms = + predict_non_young_other_time_ms(_recorded_non_young_regions); + + _predicted_pause_time_ms = + _predicted_scan_only_scan_time_ms + + _predicted_rs_update_time_ms + + _predicted_rs_scan_time_ms + + _predicted_object_copy_time_ms + + _predicted_constant_other_time_ms + + _predicted_young_other_time_ms + + _predicted_non_young_other_time_ms; +#endif // PREDICTIONS_VERBOSE +} + +void G1CollectorPolicy::check_if_region_is_too_expensive(double + predicted_time_ms) { + // I don't think we need to do this when in young GC mode since + // marking will be initiated next time we hit the soft limit anyway... + if (predicted_time_ms > _expensive_region_limit_ms) { + if (!in_young_gc_mode()) { + set_full_young_gcs(true); + _should_initiate_conc_mark = true; + } else + // no point in doing another partial one + _should_revert_to_full_young_gcs = true; + } +} + +// + + +void G1CollectorPolicy::update_recent_gc_times(double end_time_sec, + double elapsed_ms) { + _recent_gc_times_ms->add(elapsed_ms); + _recent_prev_end_times_for_all_gcs_sec->add(end_time_sec); + _prev_collection_pause_end_ms = end_time_sec * 1000.0; +} + +double G1CollectorPolicy::recent_avg_time_for_pauses_ms() { + if (_recent_pause_times_ms->num() == 0) return (double) G1MaxPauseTimeMS; + else return _recent_pause_times_ms->avg(); +} + +double G1CollectorPolicy::recent_avg_time_for_CH_strong_ms() { + if (_recent_CH_strong_roots_times_ms->num() == 0) + return (double)G1MaxPauseTimeMS/3.0; + else return _recent_CH_strong_roots_times_ms->avg(); +} + +double G1CollectorPolicy::recent_avg_time_for_G1_strong_ms() { + if (_recent_G1_strong_roots_times_ms->num() == 0) + return (double)G1MaxPauseTimeMS/3.0; + else return _recent_G1_strong_roots_times_ms->avg(); +} + +double G1CollectorPolicy::recent_avg_time_for_evac_ms() { + if (_recent_evac_times_ms->num() == 0) return (double)G1MaxPauseTimeMS/3.0; + else return _recent_evac_times_ms->avg(); +} + +int G1CollectorPolicy::number_of_recent_gcs() { + assert(_recent_CH_strong_roots_times_ms->num() == + _recent_G1_strong_roots_times_ms->num(), "Sequence out of sync"); + assert(_recent_G1_strong_roots_times_ms->num() == + _recent_evac_times_ms->num(), "Sequence out of sync"); + assert(_recent_evac_times_ms->num() == + _recent_pause_times_ms->num(), "Sequence out of sync"); + assert(_recent_pause_times_ms->num() == + _recent_CS_bytes_used_before->num(), "Sequence out of sync"); + assert(_recent_CS_bytes_used_before->num() == + _recent_CS_bytes_surviving->num(), "Sequence out of sync"); + return _recent_pause_times_ms->num(); +} + +double G1CollectorPolicy::recent_avg_survival_fraction() { + return recent_avg_survival_fraction_work(_recent_CS_bytes_surviving, + _recent_CS_bytes_used_before); +} + +double G1CollectorPolicy::last_survival_fraction() { + return last_survival_fraction_work(_recent_CS_bytes_surviving, + _recent_CS_bytes_used_before); +} + +double +G1CollectorPolicy::recent_avg_survival_fraction_work(TruncatedSeq* surviving, + TruncatedSeq* before) { + assert(surviving->num() == before->num(), "Sequence out of sync"); + if (before->sum() > 0.0) { + double recent_survival_rate = surviving->sum() / before->sum(); + // We exempt parallel collection from this check because Alloc Buffer + // fragmentation can produce negative collections. + // Further, we're now always doing parallel collection. But I'm still + // leaving this here as a placeholder for a more precise assertion later. + // (DLD, 10/05.) + assert((true || ParallelGCThreads > 0) || + _g1->evacuation_failed() || + recent_survival_rate <= 1.0, "Or bad frac"); + return recent_survival_rate; + } else { + return 1.0; // Be conservative. + } +} + +double +G1CollectorPolicy::last_survival_fraction_work(TruncatedSeq* surviving, + TruncatedSeq* before) { + assert(surviving->num() == before->num(), "Sequence out of sync"); + if (surviving->num() > 0 && before->last() > 0.0) { + double last_survival_rate = surviving->last() / before->last(); + // We exempt parallel collection from this check because Alloc Buffer + // fragmentation can produce negative collections. + // Further, we're now always doing parallel collection. But I'm still + // leaving this here as a placeholder for a more precise assertion later. + // (DLD, 10/05.) + assert((true || ParallelGCThreads > 0) || + last_survival_rate <= 1.0, "Or bad frac"); + return last_survival_rate; + } else { + return 1.0; + } +} + +static const int survival_min_obs = 5; +static double survival_min_obs_limits[] = { 0.9, 0.7, 0.5, 0.3, 0.1 }; +static const double min_survival_rate = 0.1; + +double +G1CollectorPolicy::conservative_avg_survival_fraction_work(double avg, + double latest) { + double res = avg; + if (number_of_recent_gcs() < survival_min_obs) { + res = MAX2(res, survival_min_obs_limits[number_of_recent_gcs()]); + } + res = MAX2(res, latest); + res = MAX2(res, min_survival_rate); + // In the parallel case, LAB fragmentation can produce "negative + // collections"; so can evac failure. Cap at 1.0 + res = MIN2(res, 1.0); + return res; +} + +size_t G1CollectorPolicy::expansion_amount() { + if ((int)(recent_avg_pause_time_ratio() * 100.0) > G1GCPct) { + // We will double the existing space, or take G1ExpandByPctOfAvail % of + // the available expansion space, whichever is smaller, bounded below + // by a minimum expansion (unless that's all that's left.) + const size_t min_expand_bytes = 1*M; + size_t reserved_bytes = _g1->g1_reserved_obj_bytes(); + size_t committed_bytes = _g1->capacity(); + size_t uncommitted_bytes = reserved_bytes - committed_bytes; + size_t expand_bytes; + size_t expand_bytes_via_pct = + uncommitted_bytes * G1ExpandByPctOfAvail / 100; + expand_bytes = MIN2(expand_bytes_via_pct, committed_bytes); + expand_bytes = MAX2(expand_bytes, min_expand_bytes); + expand_bytes = MIN2(expand_bytes, uncommitted_bytes); + if (G1PolicyVerbose > 1) { + gclog_or_tty->print("Decided to expand: ratio = %5.2f, " + "committed = %d%s, uncommited = %d%s, via pct = %d%s.\n" + " Answer = %d.\n", + recent_avg_pause_time_ratio(), + byte_size_in_proper_unit(committed_bytes), + proper_unit_for_byte_size(committed_bytes), + byte_size_in_proper_unit(uncommitted_bytes), + proper_unit_for_byte_size(uncommitted_bytes), + byte_size_in_proper_unit(expand_bytes_via_pct), + proper_unit_for_byte_size(expand_bytes_via_pct), + byte_size_in_proper_unit(expand_bytes), + proper_unit_for_byte_size(expand_bytes)); + } + return expand_bytes; + } else { + return 0; + } +} + +void G1CollectorPolicy::note_start_of_mark_thread() { + _mark_thread_startup_sec = os::elapsedTime(); +} + +class CountCSClosure: public HeapRegionClosure { + G1CollectorPolicy* _g1_policy; +public: + CountCSClosure(G1CollectorPolicy* g1_policy) : + _g1_policy(g1_policy) {} + bool doHeapRegion(HeapRegion* r) { + _g1_policy->_bytes_in_collection_set_before_gc += r->used(); + return false; + } +}; + +void G1CollectorPolicy::count_CS_bytes_used() { + CountCSClosure cs_closure(this); + _g1->collection_set_iterate(&cs_closure); +} + +static void print_indent(int level) { + for (int j = 0; j < level+1; ++j) + gclog_or_tty->print(" "); +} + +void G1CollectorPolicy::print_summary (int level, + const char* str, + NumberSeq* seq) const { + double sum = seq->sum(); + print_indent(level); + gclog_or_tty->print_cr("%-24s = %8.2lf s (avg = %8.2lf ms)", + str, sum / 1000.0, seq->avg()); +} + +void G1CollectorPolicy::print_summary_sd (int level, + const char* str, + NumberSeq* seq) const { + print_summary(level, str, seq); + print_indent(level + 5); + gclog_or_tty->print_cr("(num = %5d, std dev = %8.2lf ms, max = %8.2lf ms)", + seq->num(), seq->sd(), seq->maximum()); +} + +void G1CollectorPolicy::check_other_times(int level, + NumberSeq* other_times_ms, + NumberSeq* calc_other_times_ms) const { + bool should_print = false; + + double max_sum = MAX2(fabs(other_times_ms->sum()), + fabs(calc_other_times_ms->sum())); + double min_sum = MIN2(fabs(other_times_ms->sum()), + fabs(calc_other_times_ms->sum())); + double sum_ratio = max_sum / min_sum; + if (sum_ratio > 1.1) { + should_print = true; + print_indent(level + 1); + gclog_or_tty->print_cr("## CALCULATED OTHER SUM DOESN'T MATCH RECORDED ###"); + } + + double max_avg = MAX2(fabs(other_times_ms->avg()), + fabs(calc_other_times_ms->avg())); + double min_avg = MIN2(fabs(other_times_ms->avg()), + fabs(calc_other_times_ms->avg())); + double avg_ratio = max_avg / min_avg; + if (avg_ratio > 1.1) { + should_print = true; + print_indent(level + 1); + gclog_or_tty->print_cr("## CALCULATED OTHER AVG DOESN'T MATCH RECORDED ###"); + } + + if (other_times_ms->sum() < -0.01) { + print_indent(level + 1); + gclog_or_tty->print_cr("## RECORDED OTHER SUM IS NEGATIVE ###"); + } + + if (other_times_ms->avg() < -0.01) { + print_indent(level + 1); + gclog_or_tty->print_cr("## RECORDED OTHER AVG IS NEGATIVE ###"); + } + + if (calc_other_times_ms->sum() < -0.01) { + should_print = true; + print_indent(level + 1); + gclog_or_tty->print_cr("## CALCULATED OTHER SUM IS NEGATIVE ###"); + } + + if (calc_other_times_ms->avg() < -0.01) { + should_print = true; + print_indent(level + 1); + gclog_or_tty->print_cr("## CALCULATED OTHER AVG IS NEGATIVE ###"); + } + + if (should_print) + print_summary(level, "Other(Calc)", calc_other_times_ms); +} + +void G1CollectorPolicy::print_summary(PauseSummary* summary) const { + bool parallel = ParallelGCThreads > 0; + MainBodySummary* body_summary = summary->main_body_summary(); + PopPreambleSummary* preamble_summary = summary->pop_preamble_summary(); + + if (summary->get_total_seq()->num() > 0) { + print_summary_sd(0, + (preamble_summary == NULL) ? "Non-Popular Pauses" : + "Popular Pauses", + summary->get_total_seq()); + if (preamble_summary != NULL) { + print_summary(1, "Popularity Preamble", + preamble_summary->get_pop_preamble_seq()); + print_summary(2, "Update RS", preamble_summary->get_pop_update_rs_seq()); + print_summary(2, "Scan RS", preamble_summary->get_pop_scan_rs_seq()); + print_summary(2, "Closure App", + preamble_summary->get_pop_closure_app_seq()); + print_summary(2, "Evacuation", + preamble_summary->get_pop_evacuation_seq()); + print_summary(2, "Other", preamble_summary->get_pop_other_seq()); + { + NumberSeq* other_parts[] = { + preamble_summary->get_pop_update_rs_seq(), + preamble_summary->get_pop_scan_rs_seq(), + preamble_summary->get_pop_closure_app_seq(), + preamble_summary->get_pop_evacuation_seq() + }; + NumberSeq calc_other_times_ms(preamble_summary->get_pop_preamble_seq(), + 4, other_parts); + check_other_times(2, preamble_summary->get_pop_other_seq(), + &calc_other_times_ms); + } + } + if (body_summary != NULL) { + print_summary(1, "SATB Drain", body_summary->get_satb_drain_seq()); + if (parallel) { + print_summary(1, "Parallel Time", body_summary->get_parallel_seq()); + print_summary(2, "Update RS", body_summary->get_update_rs_seq()); + print_summary(2, "Ext Root Scanning", + body_summary->get_ext_root_scan_seq()); + print_summary(2, "Mark Stack Scanning", + body_summary->get_mark_stack_scan_seq()); + print_summary(2, "Scan-Only Scanning", + body_summary->get_scan_only_seq()); + print_summary(2, "Scan RS", body_summary->get_scan_rs_seq()); + print_summary(2, "Object Copy", body_summary->get_obj_copy_seq()); + print_summary(2, "Termination", body_summary->get_termination_seq()); + print_summary(2, "Other", body_summary->get_parallel_other_seq()); + { + NumberSeq* other_parts[] = { + body_summary->get_update_rs_seq(), + body_summary->get_ext_root_scan_seq(), + body_summary->get_mark_stack_scan_seq(), + body_summary->get_scan_only_seq(), + body_summary->get_scan_rs_seq(), + body_summary->get_obj_copy_seq(), + body_summary->get_termination_seq() + }; + NumberSeq calc_other_times_ms(body_summary->get_parallel_seq(), + 7, other_parts); + check_other_times(2, body_summary->get_parallel_other_seq(), + &calc_other_times_ms); + } + print_summary(1, "Mark Closure", body_summary->get_mark_closure_seq()); + print_summary(1, "Clear CT", body_summary->get_clear_ct_seq()); + } else { + print_summary(1, "Update RS", body_summary->get_update_rs_seq()); + print_summary(1, "Ext Root Scanning", + body_summary->get_ext_root_scan_seq()); + print_summary(1, "Mark Stack Scanning", + body_summary->get_mark_stack_scan_seq()); + print_summary(1, "Scan-Only Scanning", + body_summary->get_scan_only_seq()); + print_summary(1, "Scan RS", body_summary->get_scan_rs_seq()); + print_summary(1, "Object Copy", body_summary->get_obj_copy_seq()); + } + } + print_summary(1, "Other", summary->get_other_seq()); + { + NumberSeq calc_other_times_ms; + if (body_summary != NULL) { + // not abandoned + if (parallel) { + // parallel + NumberSeq* other_parts[] = { + body_summary->get_satb_drain_seq(), + (preamble_summary == NULL) ? NULL : + preamble_summary->get_pop_preamble_seq(), + body_summary->get_parallel_seq(), + body_summary->get_clear_ct_seq() + }; + calc_other_times_ms = NumberSeq (summary->get_total_seq(), + 4, other_parts); + } else { + // serial + NumberSeq* other_parts[] = { + body_summary->get_satb_drain_seq(), + (preamble_summary == NULL) ? NULL : + preamble_summary->get_pop_preamble_seq(), + body_summary->get_update_rs_seq(), + body_summary->get_ext_root_scan_seq(), + body_summary->get_mark_stack_scan_seq(), + body_summary->get_scan_only_seq(), + body_summary->get_scan_rs_seq(), + body_summary->get_obj_copy_seq() + }; + calc_other_times_ms = NumberSeq(summary->get_total_seq(), + 8, other_parts); + } + } else { + // abandoned + NumberSeq* other_parts[] = { + (preamble_summary == NULL) ? NULL : + preamble_summary->get_pop_preamble_seq() + }; + calc_other_times_ms = NumberSeq(summary->get_total_seq(), + 1, other_parts); + } + check_other_times(1, summary->get_other_seq(), &calc_other_times_ms); + } + } else { + print_indent(0); + gclog_or_tty->print_cr("none"); + } + gclog_or_tty->print_cr(""); +} + +void +G1CollectorPolicy::print_abandoned_summary(PauseSummary* non_pop_summary, + PauseSummary* pop_summary) const { + bool printed = false; + if (non_pop_summary->get_total_seq()->num() > 0) { + printed = true; + print_summary(non_pop_summary); + } + if (pop_summary->get_total_seq()->num() > 0) { + printed = true; + print_summary(pop_summary); + } + + if (!printed) { + print_indent(0); + gclog_or_tty->print_cr("none"); + gclog_or_tty->print_cr(""); + } +} + +void G1CollectorPolicy::print_tracing_info() const { + if (TraceGen0Time) { + gclog_or_tty->print_cr("ALL PAUSES"); + print_summary_sd(0, "Total", _all_pause_times_ms); + gclog_or_tty->print_cr(""); + gclog_or_tty->print_cr(""); + gclog_or_tty->print_cr(" Full Young GC Pauses: %8d", _full_young_pause_num); + gclog_or_tty->print_cr(" Partial Young GC Pauses: %8d", _partial_young_pause_num); + gclog_or_tty->print_cr(""); + + gclog_or_tty->print_cr("NON-POPULAR PAUSES"); + print_summary(_non_pop_summary); + + gclog_or_tty->print_cr("POPULAR PAUSES"); + print_summary(_pop_summary); + + gclog_or_tty->print_cr("ABANDONED PAUSES"); + print_abandoned_summary(_non_pop_abandoned_summary, + _pop_abandoned_summary); + + gclog_or_tty->print_cr("MISC"); + print_summary_sd(0, "Stop World", _all_stop_world_times_ms); + print_summary_sd(0, "Yields", _all_yield_times_ms); + for (int i = 0; i < _aux_num; ++i) { + if (_all_aux_times_ms[i].num() > 0) { + char buffer[96]; + sprintf(buffer, "Aux%d", i); + print_summary_sd(0, buffer, &_all_aux_times_ms[i]); + } + } + + size_t all_region_num = _region_num_young + _region_num_tenured; + gclog_or_tty->print_cr(" New Regions %8d, Young %8d (%6.2lf%%), " + "Tenured %8d (%6.2lf%%)", + all_region_num, + _region_num_young, + (double) _region_num_young / (double) all_region_num * 100.0, + _region_num_tenured, + (double) _region_num_tenured / (double) all_region_num * 100.0); + + if (!G1RSBarrierUseQueue) { + gclog_or_tty->print_cr("Of %d times conc refinement was enabled, %d (%7.2f%%) " + "did zero traversals.", + _conc_refine_enabled, _conc_refine_zero_traversals, + _conc_refine_enabled > 0 ? + 100.0 * (float)_conc_refine_zero_traversals/ + (float)_conc_refine_enabled : 0.0); + gclog_or_tty->print_cr(" Max # of traversals = %d.", + _conc_refine_max_traversals); + gclog_or_tty->print_cr(""); + } + } + if (TraceGen1Time) { + if (_all_full_gc_times_ms->num() > 0) { + gclog_or_tty->print("\n%4d full_gcs: total time = %8.2f s", + _all_full_gc_times_ms->num(), + _all_full_gc_times_ms->sum() / 1000.0); + gclog_or_tty->print_cr(" (avg = %8.2fms).", _all_full_gc_times_ms->avg()); + gclog_or_tty->print_cr(" [std. dev = %8.2f ms, max = %8.2f ms]", + _all_full_gc_times_ms->sd(), + _all_full_gc_times_ms->maximum()); + } + } +} + +void G1CollectorPolicy::print_yg_surv_rate_info() const { +#ifndef PRODUCT + _short_lived_surv_rate_group->print_surv_rate_summary(); + // add this call for any other surv rate groups +#endif // PRODUCT +} + +void G1CollectorPolicy::update_conc_refine_data() { + unsigned traversals = _g1->concurrent_g1_refine()->disable(); + if (traversals == 0) _conc_refine_zero_traversals++; + _conc_refine_max_traversals = MAX2(_conc_refine_max_traversals, + (size_t)traversals); + + if (G1PolicyVerbose > 1) + gclog_or_tty->print_cr("Did a CR traversal series: %d traversals.", traversals); + double multiplier = 1.0; + if (traversals == 0) { + multiplier = 4.0; + } else if (traversals > (size_t)G1ConcRefineTargTraversals) { + multiplier = 1.0/1.5; + } else if (traversals < (size_t)G1ConcRefineTargTraversals) { + multiplier = 1.5; + } + if (G1PolicyVerbose > 1) { + gclog_or_tty->print_cr(" Multiplier = %7.2f.", multiplier); + gclog_or_tty->print(" Delta went from %d regions to ", + _conc_refine_current_delta); + } + _conc_refine_current_delta = + MIN2(_g1->n_regions(), + (size_t)(_conc_refine_current_delta * multiplier)); + _conc_refine_current_delta = + MAX2(_conc_refine_current_delta, (size_t)1); + if (G1PolicyVerbose > 1) { + gclog_or_tty->print_cr("%d regions.", _conc_refine_current_delta); + } + _conc_refine_enabled++; +} + +void G1CollectorPolicy::set_single_region_collection_set(HeapRegion* hr) { + assert(collection_set() == NULL, "Must be no current CS."); + _collection_set_size = 0; + _collection_set_bytes_used_before = 0; + add_to_collection_set(hr); + count_CS_bytes_used(); +} + +bool +G1CollectorPolicy::should_add_next_region_to_young_list() { + assert(in_young_gc_mode(), "should be in young GC mode"); + bool ret; + size_t young_list_length = _g1->young_list_length(); + + if (young_list_length < _young_list_target_length) { + ret = true; + ++_region_num_young; + } else { + ret = false; + ++_region_num_tenured; + } + + return ret; +} + +#ifndef PRODUCT +// for debugging, bit of a hack... +static char* +region_num_to_mbs(int length) { + static char buffer[64]; + double bytes = (double) (length * HeapRegion::GrainBytes); + double mbs = bytes / (double) (1024 * 1024); + sprintf(buffer, "%7.2lfMB", mbs); + return buffer; +} +#endif // PRODUCT + +void +G1CollectorPolicy::checkpoint_conc_overhead() { + double conc_overhead = 0.0; + if (G1AccountConcurrentOverhead) + conc_overhead = COTracker::totalPredConcOverhead(); + _mmu_tracker->update_conc_overhead(conc_overhead); +#if 0 + gclog_or_tty->print(" CO %1.4lf TARGET %1.4lf", + conc_overhead, _mmu_tracker->max_gc_time()); +#endif +} + + +uint G1CollectorPolicy::max_regions(int purpose) { + switch (purpose) { + case GCAllocForSurvived: + return G1MaxSurvivorRegions; + case GCAllocForTenured: + return UINT_MAX; + default: + return UINT_MAX; + }; +} + +void +G1CollectorPolicy_BestRegionsFirst:: +set_single_region_collection_set(HeapRegion* hr) { + G1CollectorPolicy::set_single_region_collection_set(hr); + _collectionSetChooser->removeRegion(hr); +} + + +bool +G1CollectorPolicy_BestRegionsFirst::should_do_collection_pause(size_t + word_size) { + assert(_g1->regions_accounted_for(), "Region leakage!"); + // Initiate a pause when we reach the steady-state "used" target. + size_t used_hard = (_g1->capacity() / 100) * G1SteadyStateUsed; + size_t used_soft = + MAX2((_g1->capacity() / 100) * (G1SteadyStateUsed - G1SteadyStateUsedDelta), + used_hard/2); + size_t used = _g1->used(); + + double max_pause_time_ms = _mmu_tracker->max_gc_time() * 1000.0; + + size_t young_list_length = _g1->young_list_length(); + bool reached_target_length = young_list_length >= _young_list_target_length; + + if (in_young_gc_mode()) { + if (reached_target_length) { + assert( young_list_length > 0 && _g1->young_list_length() > 0, + "invariant" ); + _target_pause_time_ms = max_pause_time_ms; + return true; + } + } else { + guarantee( false, "should not reach here" ); + } + + return false; +} + +#ifndef PRODUCT +class HRSortIndexIsOKClosure: public HeapRegionClosure { + CollectionSetChooser* _chooser; +public: + HRSortIndexIsOKClosure(CollectionSetChooser* chooser) : + _chooser(chooser) {} + + bool doHeapRegion(HeapRegion* r) { + if (!r->continuesHumongous()) { + assert(_chooser->regionProperlyOrdered(r), "Ought to be."); + } + return false; + } +}; + +bool G1CollectorPolicy_BestRegionsFirst::assertMarkedBytesDataOK() { + HRSortIndexIsOKClosure cl(_collectionSetChooser); + _g1->heap_region_iterate(&cl); + return true; +} +#endif + +void +G1CollectorPolicy_BestRegionsFirst:: +record_collection_pause_start(double start_time_sec, size_t start_used) { + G1CollectorPolicy::record_collection_pause_start(start_time_sec, start_used); +} + +class NextNonCSElemFinder: public HeapRegionClosure { + HeapRegion* _res; +public: + NextNonCSElemFinder(): _res(NULL) {} + bool doHeapRegion(HeapRegion* r) { + if (!r->in_collection_set()) { + _res = r; + return true; + } else { + return false; + } + } + HeapRegion* res() { return _res; } +}; + +class KnownGarbageClosure: public HeapRegionClosure { + CollectionSetChooser* _hrSorted; + +public: + KnownGarbageClosure(CollectionSetChooser* hrSorted) : + _hrSorted(hrSorted) + {} + + bool doHeapRegion(HeapRegion* r) { + // We only include humongous regions in collection + // sets when concurrent mark shows that their contained object is + // unreachable. + + // Do we have any marking information for this region? + if (r->is_marked()) { + // We don't include humongous regions in collection + // sets because we collect them immediately at the end of a marking + // cycle. We also don't include young regions because we *must* + // include them in the next collection pause. + if (!r->isHumongous() && !r->is_young()) { + _hrSorted->addMarkedHeapRegion(r); + } + } + return false; + } +}; + +class ParKnownGarbageHRClosure: public HeapRegionClosure { + CollectionSetChooser* _hrSorted; + jint _marked_regions_added; + jint _chunk_size; + jint _cur_chunk_idx; + jint _cur_chunk_end; // Cur chunk [_cur_chunk_idx, _cur_chunk_end) + int _worker; + int _invokes; + + void get_new_chunk() { + _cur_chunk_idx = _hrSorted->getParMarkedHeapRegionChunk(_chunk_size); + _cur_chunk_end = _cur_chunk_idx + _chunk_size; + } + void add_region(HeapRegion* r) { + if (_cur_chunk_idx == _cur_chunk_end) { + get_new_chunk(); + } + assert(_cur_chunk_idx < _cur_chunk_end, "postcondition"); + _hrSorted->setMarkedHeapRegion(_cur_chunk_idx, r); + _marked_regions_added++; + _cur_chunk_idx++; + } + +public: + ParKnownGarbageHRClosure(CollectionSetChooser* hrSorted, + jint chunk_size, + int worker) : + _hrSorted(hrSorted), _chunk_size(chunk_size), _worker(worker), + _marked_regions_added(0), _cur_chunk_idx(0), _cur_chunk_end(0), + _invokes(0) + {} + + bool doHeapRegion(HeapRegion* r) { + // We only include humongous regions in collection + // sets when concurrent mark shows that their contained object is + // unreachable. + _invokes++; + + // Do we have any marking information for this region? + if (r->is_marked()) { + // We don't include humongous regions in collection + // sets because we collect them immediately at the end of a marking + // cycle. + // We also do not include young regions in collection sets + if (!r->isHumongous() && !r->is_young()) { + add_region(r); + } + } + return false; + } + jint marked_regions_added() { return _marked_regions_added; } + int invokes() { return _invokes; } +}; + +class ParKnownGarbageTask: public AbstractGangTask { + CollectionSetChooser* _hrSorted; + jint _chunk_size; + G1CollectedHeap* _g1; +public: + ParKnownGarbageTask(CollectionSetChooser* hrSorted, jint chunk_size) : + AbstractGangTask("ParKnownGarbageTask"), + _hrSorted(hrSorted), _chunk_size(chunk_size), + _g1(G1CollectedHeap::heap()) + {} + + void work(int i) { + ParKnownGarbageHRClosure parKnownGarbageCl(_hrSorted, _chunk_size, i); + // Back to zero for the claim value. + _g1->heap_region_par_iterate_chunked(&parKnownGarbageCl, i, 0); + jint regions_added = parKnownGarbageCl.marked_regions_added(); + _hrSorted->incNumMarkedHeapRegions(regions_added); + if (G1PrintParCleanupStats) { + gclog_or_tty->print(" Thread %d called %d times, added %d regions to list.\n", + i, parKnownGarbageCl.invokes(), regions_added); + } + } +}; + +void +G1CollectorPolicy_BestRegionsFirst:: +record_concurrent_mark_cleanup_end(size_t freed_bytes, + size_t max_live_bytes) { + double start; + if (G1PrintParCleanupStats) start = os::elapsedTime(); + record_concurrent_mark_cleanup_end_work1(freed_bytes, max_live_bytes); + + _collectionSetChooser->clearMarkedHeapRegions(); + double clear_marked_end; + if (G1PrintParCleanupStats) { + clear_marked_end = os::elapsedTime(); + gclog_or_tty->print_cr(" clear marked regions + work1: %8.3f ms.", + (clear_marked_end - start)*1000.0); + } + if (ParallelGCThreads > 0) { + const size_t OverpartitionFactor = 4; + const size_t MinChunkSize = 8; + const size_t ChunkSize = + MAX2(_g1->n_regions() / (ParallelGCThreads * OverpartitionFactor), + MinChunkSize); + _collectionSetChooser->prepareForAddMarkedHeapRegionsPar(_g1->n_regions(), + ChunkSize); + ParKnownGarbageTask parKnownGarbageTask(_collectionSetChooser, + (int) ChunkSize); + _g1->workers()->run_task(&parKnownGarbageTask); + } else { + KnownGarbageClosure knownGarbagecl(_collectionSetChooser); + _g1->heap_region_iterate(&knownGarbagecl); + } + double known_garbage_end; + if (G1PrintParCleanupStats) { + known_garbage_end = os::elapsedTime(); + gclog_or_tty->print_cr(" compute known garbage: %8.3f ms.", + (known_garbage_end - clear_marked_end)*1000.0); + } + _collectionSetChooser->sortMarkedHeapRegions(); + double sort_end; + if (G1PrintParCleanupStats) { + sort_end = os::elapsedTime(); + gclog_or_tty->print_cr(" sorting: %8.3f ms.", + (sort_end - known_garbage_end)*1000.0); + } + + record_concurrent_mark_cleanup_end_work2(); + double work2_end; + if (G1PrintParCleanupStats) { + work2_end = os::elapsedTime(); + gclog_or_tty->print_cr(" work2: %8.3f ms.", + (work2_end - sort_end)*1000.0); + } +} + +// Add the heap region to the collection set and return the conservative +// estimate of the number of live bytes. +void G1CollectorPolicy:: +add_to_collection_set(HeapRegion* hr) { + if (G1TraceRegions) { + gclog_or_tty->print_cr("added region to cset %d:["PTR_FORMAT", "PTR_FORMAT"], " + "top "PTR_FORMAT", young %s", + hr->hrs_index(), hr->bottom(), hr->end(), + hr->top(), (hr->is_young()) ? "YES" : "NO"); + } + + if (_g1->mark_in_progress()) + _g1->concurrent_mark()->registerCSetRegion(hr); + + assert(!hr->in_collection_set(), + "should not already be in the CSet"); + hr->set_in_collection_set(true); + hr->set_next_in_collection_set(_collection_set); + _collection_set = hr; + _collection_set_size++; + _collection_set_bytes_used_before += hr->used(); +} + +void +G1CollectorPolicy_BestRegionsFirst:: +choose_collection_set(HeapRegion* pop_region) { + double non_young_start_time_sec; + start_recording_regions(); + + if (pop_region != NULL) { + _target_pause_time_ms = (double) G1MaxPauseTimeMS; + } else { + guarantee(_target_pause_time_ms > -1.0, + "_target_pause_time_ms should have been set!"); + } + + // pop region is either null (and so is CS), or else it *is* the CS. + assert(_collection_set == pop_region, "Precondition"); + + double base_time_ms = predict_base_elapsed_time_ms(_pending_cards); + double predicted_pause_time_ms = base_time_ms; + + double target_time_ms = _target_pause_time_ms; + double time_remaining_ms = target_time_ms - base_time_ms; + + // the 10% and 50% values are arbitrary... + if (time_remaining_ms < 0.10*target_time_ms) { + time_remaining_ms = 0.50 * target_time_ms; + _within_target = false; + } else { + _within_target = true; + } + + // We figure out the number of bytes available for future to-space. + // For new regions without marking information, we must assume the + // worst-case of complete survival. If we have marking information for a + // region, we can bound the amount of live data. We can add a number of + // such regions, as long as the sum of the live data bounds does not + // exceed the available evacuation space. + size_t max_live_bytes = _g1->free_regions() * HeapRegion::GrainBytes; + + size_t expansion_bytes = + _g1->expansion_regions() * HeapRegion::GrainBytes; + + if (pop_region == NULL) { + _collection_set_bytes_used_before = 0; + _collection_set_size = 0; + } + + // Adjust for expansion and slop. + max_live_bytes = max_live_bytes + expansion_bytes; + + assert(pop_region != NULL || _g1->regions_accounted_for(), "Region leakage!"); + + HeapRegion* hr; + if (in_young_gc_mode()) { + double young_start_time_sec = os::elapsedTime(); + + if (G1PolicyVerbose > 0) { + gclog_or_tty->print_cr("Adding %d young regions to the CSet", + _g1->young_list_length()); + } + _young_cset_length = 0; + _last_young_gc_full = full_young_gcs() ? true : false; + if (_last_young_gc_full) + ++_full_young_pause_num; + else + ++_partial_young_pause_num; + hr = _g1->pop_region_from_young_list(); + while (hr != NULL) { + + assert( hr->young_index_in_cset() == -1, "invariant" ); + assert( hr->age_in_surv_rate_group() != -1, "invariant" ); + hr->set_young_index_in_cset((int) _young_cset_length); + + ++_young_cset_length; + double predicted_time_ms = predict_region_elapsed_time_ms(hr, true); + time_remaining_ms -= predicted_time_ms; + predicted_pause_time_ms += predicted_time_ms; + if (hr == pop_region) { + // The popular region was young. Skip over it. + assert(hr->in_collection_set(), "It's the pop region."); + } else { + assert(!hr->in_collection_set(), "It's not the pop region."); + add_to_collection_set(hr); + record_cset_region(hr, true); + } + max_live_bytes -= MIN2(hr->max_live_bytes(), max_live_bytes); + if (G1PolicyVerbose > 0) { + gclog_or_tty->print_cr(" Added [" PTR_FORMAT ", " PTR_FORMAT") to CS.", + hr->bottom(), hr->end()); + gclog_or_tty->print_cr(" (" SIZE_FORMAT " KB left in heap.)", + max_live_bytes/K); + } + hr = _g1->pop_region_from_young_list(); + } + + record_scan_only_regions(_g1->young_list_scan_only_length()); + + double young_end_time_sec = os::elapsedTime(); + _recorded_young_cset_choice_time_ms = + (young_end_time_sec - young_start_time_sec) * 1000.0; + + non_young_start_time_sec = os::elapsedTime(); + + if (_young_cset_length > 0 && _last_young_gc_full) { + // don't bother adding more regions... + goto choose_collection_set_end; + } + } else if (pop_region != NULL) { + // We're not in young mode, and we chose a popular region; don't choose + // any more. + return; + } + + if (!in_young_gc_mode() || !full_young_gcs()) { + bool should_continue = true; + NumberSeq seq; + double avg_prediction = 100000000000000000.0; // something very large + do { + hr = _collectionSetChooser->getNextMarkedRegion(time_remaining_ms, + avg_prediction); + if (hr != NULL && !hr->popular()) { + double predicted_time_ms = predict_region_elapsed_time_ms(hr, false); + time_remaining_ms -= predicted_time_ms; + predicted_pause_time_ms += predicted_time_ms; + add_to_collection_set(hr); + record_cset_region(hr, false); + max_live_bytes -= MIN2(hr->max_live_bytes(), max_live_bytes); + if (G1PolicyVerbose > 0) { + gclog_or_tty->print_cr(" (" SIZE_FORMAT " KB left in heap.)", + max_live_bytes/K); + } + seq.add(predicted_time_ms); + avg_prediction = seq.avg() + seq.sd(); + } + should_continue = + ( hr != NULL) && + ( (adaptive_young_list_length()) ? time_remaining_ms > 0.0 + : _collection_set_size < _young_list_fixed_length ); + } while (should_continue); + + if (!adaptive_young_list_length() && + _collection_set_size < _young_list_fixed_length) + _should_revert_to_full_young_gcs = true; + } + +choose_collection_set_end: + count_CS_bytes_used(); + + end_recording_regions(); + + double non_young_end_time_sec = os::elapsedTime(); + _recorded_non_young_cset_choice_time_ms = + (non_young_end_time_sec - non_young_start_time_sec) * 1000.0; +} + +void G1CollectorPolicy_BestRegionsFirst::record_full_collection_end() { + G1CollectorPolicy::record_full_collection_end(); + _collectionSetChooser->updateAfterFullCollection(); +} + +void G1CollectorPolicy_BestRegionsFirst:: +expand_if_possible(size_t numRegions) { + size_t expansion_bytes = numRegions * HeapRegion::GrainBytes; + _g1->expand(expansion_bytes); +} + +void G1CollectorPolicy_BestRegionsFirst:: +record_collection_pause_end(bool popular, bool abandoned) { + G1CollectorPolicy::record_collection_pause_end(popular, abandoned); + assert(assertMarkedBytesDataOK(), "Marked regions not OK at pause end."); +} + +// Local Variables: *** +// c-indentation-style: gnu *** +// End: *** diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp new file mode 100644 index 00000000000..110f81fef0e --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp @@ -0,0 +1,1199 @@ +/* + * Copyright 2001-2007 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. + * + */ + +// A G1CollectorPolicy makes policy decisions that determine the +// characteristics of the collector. Examples include: +// * choice of collection set. +// * when to collect. + +class HeapRegion; +class CollectionSetChooser; + +// Yes, this is a bit unpleasant... but it saves replicating the same thing +// over and over again and introducing subtle problems through small typos and +// cutting and pasting mistakes. The macros below introduces a number +// sequnce into the following two classes and the methods that access it. + +#define define_num_seq(name) \ +private: \ + NumberSeq _all_##name##_times_ms; \ +public: \ + void record_##name##_time_ms(double ms) { \ + _all_##name##_times_ms.add(ms); \ + } \ + NumberSeq* get_##name##_seq() { \ + return &_all_##name##_times_ms; \ + } + +class MainBodySummary; +class PopPreambleSummary; + +class PauseSummary { + define_num_seq(total) + define_num_seq(other) + +public: + virtual MainBodySummary* main_body_summary() { return NULL; } + virtual PopPreambleSummary* pop_preamble_summary() { return NULL; } +}; + +class MainBodySummary { + define_num_seq(satb_drain) // optional + define_num_seq(parallel) // parallel only + define_num_seq(ext_root_scan) + define_num_seq(mark_stack_scan) + define_num_seq(scan_only) + define_num_seq(update_rs) + define_num_seq(scan_rs) + define_num_seq(scan_new_refs) // Only for temp use; added to + // in parallel case. + define_num_seq(obj_copy) + define_num_seq(termination) // parallel only + define_num_seq(parallel_other) // parallel only + define_num_seq(mark_closure) + define_num_seq(clear_ct) // parallel only +}; + +class PopPreambleSummary { + define_num_seq(pop_preamble) + define_num_seq(pop_update_rs) + define_num_seq(pop_scan_rs) + define_num_seq(pop_closure_app) + define_num_seq(pop_evacuation) + define_num_seq(pop_other) +}; + +class NonPopSummary: public PauseSummary, + public MainBodySummary { +public: + virtual MainBodySummary* main_body_summary() { return this; } +}; + +class PopSummary: public PauseSummary, + public MainBodySummary, + public PopPreambleSummary { +public: + virtual MainBodySummary* main_body_summary() { return this; } + virtual PopPreambleSummary* pop_preamble_summary() { return this; } +}; + +class NonPopAbandonedSummary: public PauseSummary { +}; + +class PopAbandonedSummary: public PauseSummary, + public PopPreambleSummary { +public: + virtual PopPreambleSummary* pop_preamble_summary() { return this; } +}; + +class G1CollectorPolicy: public CollectorPolicy { +protected: + // The number of pauses during the execution. + long _n_pauses; + + // either equal to the number of parallel threads, if ParallelGCThreads + // has been set, or 1 otherwise + int _parallel_gc_threads; + + enum SomePrivateConstants { + NumPrevPausesForHeuristics = 10, + NumPrevGCsForHeuristics = 10, + NumAPIs = HeapRegion::MaxAge + }; + + G1MMUTracker* _mmu_tracker; + + void initialize_flags(); + + void initialize_all() { + initialize_flags(); + initialize_size_info(); + initialize_perm_generation(PermGen::MarkSweepCompact); + } + + virtual size_t default_init_heap_size() { + // Pick some reasonable default. + return 8*M; + } + + + double _cur_collection_start_sec; + size_t _cur_collection_pause_used_at_start_bytes; + size_t _cur_collection_pause_used_regions_at_start; + size_t _prev_collection_pause_used_at_end_bytes; + double _cur_collection_par_time_ms; + double _cur_satb_drain_time_ms; + double _cur_clear_ct_time_ms; + bool _satb_drain_time_set; + double _cur_popular_preamble_start_ms; + double _cur_popular_preamble_time_ms; + double _cur_popular_compute_rc_time_ms; + double _cur_popular_evac_time_ms; + + double _cur_CH_strong_roots_end_sec; + double _cur_CH_strong_roots_dur_ms; + double _cur_G1_strong_roots_end_sec; + double _cur_G1_strong_roots_dur_ms; + + // Statistics for recent GC pauses. See below for how indexed. + TruncatedSeq* _recent_CH_strong_roots_times_ms; + TruncatedSeq* _recent_G1_strong_roots_times_ms; + TruncatedSeq* _recent_evac_times_ms; + // These exclude marking times. + TruncatedSeq* _recent_pause_times_ms; + TruncatedSeq* _recent_gc_times_ms; + + TruncatedSeq* _recent_CS_bytes_used_before; + TruncatedSeq* _recent_CS_bytes_surviving; + + TruncatedSeq* _recent_rs_sizes; + + TruncatedSeq* _concurrent_mark_init_times_ms; + TruncatedSeq* _concurrent_mark_remark_times_ms; + TruncatedSeq* _concurrent_mark_cleanup_times_ms; + + NonPopSummary* _non_pop_summary; + PopSummary* _pop_summary; + NonPopAbandonedSummary* _non_pop_abandoned_summary; + PopAbandonedSummary* _pop_abandoned_summary; + + NumberSeq* _all_pause_times_ms; + NumberSeq* _all_full_gc_times_ms; + double _stop_world_start; + NumberSeq* _all_stop_world_times_ms; + NumberSeq* _all_yield_times_ms; + + size_t _region_num_young; + size_t _region_num_tenured; + size_t _prev_region_num_young; + size_t _prev_region_num_tenured; + + NumberSeq* _all_mod_union_times_ms; + + int _aux_num; + NumberSeq* _all_aux_times_ms; + double* _cur_aux_start_times_ms; + double* _cur_aux_times_ms; + bool* _cur_aux_times_set; + + double* _par_last_ext_root_scan_times_ms; + double* _par_last_mark_stack_scan_times_ms; + double* _par_last_scan_only_times_ms; + double* _par_last_scan_only_regions_scanned; + double* _par_last_update_rs_start_times_ms; + double* _par_last_update_rs_times_ms; + double* _par_last_update_rs_processed_buffers; + double* _par_last_scan_rs_start_times_ms; + double* _par_last_scan_rs_times_ms; + double* _par_last_scan_new_refs_times_ms; + double* _par_last_obj_copy_times_ms; + double* _par_last_termination_times_ms; + + // there are two pases during popular pauses, so we need to store + // somewhere the results of the first pass + double* _pop_par_last_update_rs_start_times_ms; + double* _pop_par_last_update_rs_times_ms; + double* _pop_par_last_update_rs_processed_buffers; + double* _pop_par_last_scan_rs_start_times_ms; + double* _pop_par_last_scan_rs_times_ms; + double* _pop_par_last_closure_app_times_ms; + + double _pop_compute_rc_start; + double _pop_evac_start; + + // indicates that we are in young GC mode + bool _in_young_gc_mode; + + // indicates whether we are in full young or partially young GC mode + bool _full_young_gcs; + + // if true, then it tries to dynamically adjust the length of the + // young list + bool _adaptive_young_list_length; + size_t _young_list_min_length; + size_t _young_list_target_length; + size_t _young_list_so_prefix_length; + size_t _young_list_fixed_length; + + size_t _young_cset_length; + bool _last_young_gc_full; + + double _target_pause_time_ms; + + unsigned _full_young_pause_num; + unsigned _partial_young_pause_num; + + bool _during_marking; + bool _in_marking_window; + bool _in_marking_window_im; + + SurvRateGroup* _short_lived_surv_rate_group; + SurvRateGroup* _survivor_surv_rate_group; + // add here any more surv rate groups + + bool during_marking() { + return _during_marking; + } + + // + +private: + enum PredictionConstants { + TruncatedSeqLength = 10 + }; + + TruncatedSeq* _alloc_rate_ms_seq; + double _prev_collection_pause_end_ms; + + TruncatedSeq* _pending_card_diff_seq; + TruncatedSeq* _rs_length_diff_seq; + TruncatedSeq* _cost_per_card_ms_seq; + TruncatedSeq* _cost_per_scan_only_region_ms_seq; + TruncatedSeq* _fully_young_cards_per_entry_ratio_seq; + TruncatedSeq* _partially_young_cards_per_entry_ratio_seq; + TruncatedSeq* _cost_per_entry_ms_seq; + TruncatedSeq* _partially_young_cost_per_entry_ms_seq; + TruncatedSeq* _cost_per_byte_ms_seq; + TruncatedSeq* _constant_other_time_ms_seq; + TruncatedSeq* _young_other_cost_per_region_ms_seq; + TruncatedSeq* _non_young_other_cost_per_region_ms_seq; + + TruncatedSeq* _pending_cards_seq; + TruncatedSeq* _scanned_cards_seq; + TruncatedSeq* _rs_lengths_seq; + + TruncatedSeq* _cost_per_byte_ms_during_cm_seq; + TruncatedSeq* _cost_per_scan_only_region_ms_during_cm_seq; + + TruncatedSeq* _young_gc_eff_seq; + + TruncatedSeq* _max_conc_overhead_seq; + + size_t _recorded_young_regions; + size_t _recorded_scan_only_regions; + size_t _recorded_non_young_regions; + size_t _recorded_region_num; + + size_t _free_regions_at_end_of_collection; + size_t _scan_only_regions_at_end_of_collection; + + size_t _recorded_rs_lengths; + size_t _max_rs_lengths; + + size_t _recorded_marked_bytes; + size_t _recorded_young_bytes; + + size_t _predicted_pending_cards; + size_t _predicted_cards_scanned; + size_t _predicted_rs_lengths; + size_t _predicted_bytes_to_copy; + + double _predicted_survival_ratio; + double _predicted_rs_update_time_ms; + double _predicted_rs_scan_time_ms; + double _predicted_scan_only_scan_time_ms; + double _predicted_object_copy_time_ms; + double _predicted_constant_other_time_ms; + double _predicted_young_other_time_ms; + double _predicted_non_young_other_time_ms; + double _predicted_pause_time_ms; + + double _vtime_diff_ms; + + double _recorded_young_free_cset_time_ms; + double _recorded_non_young_free_cset_time_ms; + + double _sigma; + double _expensive_region_limit_ms; + + size_t _rs_lengths_prediction; + + size_t _known_garbage_bytes; + double _known_garbage_ratio; + + double sigma() { + return _sigma; + } + + // A function that prevents us putting too much stock in small sample + // sets. Returns a number between 2.0 and 1.0, depending on the number + // of samples. 5 or more samples yields one; fewer scales linearly from + // 2.0 at 1 sample to 1.0 at 5. + double confidence_factor(int samples) { + if (samples > 4) return 1.0; + else return 1.0 + sigma() * ((double)(5 - samples))/2.0; + } + + double get_new_neg_prediction(TruncatedSeq* seq) { + return seq->davg() - sigma() * seq->dsd(); + } + +#ifndef PRODUCT + bool verify_young_ages(HeapRegion* head, SurvRateGroup *surv_rate_group); +#endif // PRODUCT + +protected: + double _pause_time_target_ms; + double _recorded_young_cset_choice_time_ms; + double _recorded_non_young_cset_choice_time_ms; + bool _within_target; + size_t _pending_cards; + size_t _max_pending_cards; + +public: + + void set_region_short_lived(HeapRegion* hr) { + hr->install_surv_rate_group(_short_lived_surv_rate_group); + } + + void set_region_survivors(HeapRegion* hr) { + hr->install_surv_rate_group(_survivor_surv_rate_group); + } + +#ifndef PRODUCT + bool verify_young_ages(); +#endif // PRODUCT + + void tag_scan_only(size_t short_lived_scan_only_length); + + double get_new_prediction(TruncatedSeq* seq) { + return MAX2(seq->davg() + sigma() * seq->dsd(), + seq->davg() * confidence_factor(seq->num())); + } + + size_t young_cset_length() { + return _young_cset_length; + } + + void record_max_rs_lengths(size_t rs_lengths) { + _max_rs_lengths = rs_lengths; + } + + size_t predict_pending_card_diff() { + double prediction = get_new_neg_prediction(_pending_card_diff_seq); + if (prediction < 0.00001) + return 0; + else + return (size_t) prediction; + } + + size_t predict_pending_cards() { + size_t max_pending_card_num = _g1->max_pending_card_num(); + size_t diff = predict_pending_card_diff(); + size_t prediction; + if (diff > max_pending_card_num) + prediction = max_pending_card_num; + else + prediction = max_pending_card_num - diff; + + return prediction; + } + + size_t predict_rs_length_diff() { + return (size_t) get_new_prediction(_rs_length_diff_seq); + } + + double predict_alloc_rate_ms() { + return get_new_prediction(_alloc_rate_ms_seq); + } + + double predict_cost_per_card_ms() { + return get_new_prediction(_cost_per_card_ms_seq); + } + + double predict_rs_update_time_ms(size_t pending_cards) { + return (double) pending_cards * predict_cost_per_card_ms(); + } + + double predict_fully_young_cards_per_entry_ratio() { + return get_new_prediction(_fully_young_cards_per_entry_ratio_seq); + } + + double predict_partially_young_cards_per_entry_ratio() { + if (_partially_young_cards_per_entry_ratio_seq->num() < 2) + return predict_fully_young_cards_per_entry_ratio(); + else + return get_new_prediction(_partially_young_cards_per_entry_ratio_seq); + } + + size_t predict_young_card_num(size_t rs_length) { + return (size_t) ((double) rs_length * + predict_fully_young_cards_per_entry_ratio()); + } + + size_t predict_non_young_card_num(size_t rs_length) { + return (size_t) ((double) rs_length * + predict_partially_young_cards_per_entry_ratio()); + } + + double predict_rs_scan_time_ms(size_t card_num) { + if (full_young_gcs()) + return (double) card_num * get_new_prediction(_cost_per_entry_ms_seq); + else + return predict_partially_young_rs_scan_time_ms(card_num); + } + + double predict_partially_young_rs_scan_time_ms(size_t card_num) { + if (_partially_young_cost_per_entry_ms_seq->num() < 3) + return (double) card_num * get_new_prediction(_cost_per_entry_ms_seq); + else + return (double) card_num * + get_new_prediction(_partially_young_cost_per_entry_ms_seq); + } + + double predict_scan_only_time_ms_during_cm(size_t scan_only_region_num) { + if (_cost_per_scan_only_region_ms_during_cm_seq->num() < 3) + return 1.5 * (double) scan_only_region_num * + get_new_prediction(_cost_per_scan_only_region_ms_seq); + else + return (double) scan_only_region_num * + get_new_prediction(_cost_per_scan_only_region_ms_during_cm_seq); + } + + double predict_scan_only_time_ms(size_t scan_only_region_num) { + if (_in_marking_window_im) + return predict_scan_only_time_ms_during_cm(scan_only_region_num); + else + return (double) scan_only_region_num * + get_new_prediction(_cost_per_scan_only_region_ms_seq); + } + + double predict_object_copy_time_ms_during_cm(size_t bytes_to_copy) { + if (_cost_per_byte_ms_during_cm_seq->num() < 3) + return 1.1 * (double) bytes_to_copy * + get_new_prediction(_cost_per_byte_ms_seq); + else + return (double) bytes_to_copy * + get_new_prediction(_cost_per_byte_ms_during_cm_seq); + } + + double predict_object_copy_time_ms(size_t bytes_to_copy) { + if (_in_marking_window && !_in_marking_window_im) + return predict_object_copy_time_ms_during_cm(bytes_to_copy); + else + return (double) bytes_to_copy * + get_new_prediction(_cost_per_byte_ms_seq); + } + + double predict_constant_other_time_ms() { + return get_new_prediction(_constant_other_time_ms_seq); + } + + double predict_young_other_time_ms(size_t young_num) { + return + (double) young_num * + get_new_prediction(_young_other_cost_per_region_ms_seq); + } + + double predict_non_young_other_time_ms(size_t non_young_num) { + return + (double) non_young_num * + get_new_prediction(_non_young_other_cost_per_region_ms_seq); + } + + void check_if_region_is_too_expensive(double predicted_time_ms); + + double predict_young_collection_elapsed_time_ms(size_t adjustment); + double predict_base_elapsed_time_ms(size_t pending_cards); + double predict_base_elapsed_time_ms(size_t pending_cards, + size_t scanned_cards); + size_t predict_bytes_to_copy(HeapRegion* hr); + double predict_region_elapsed_time_ms(HeapRegion* hr, bool young); + + // for use by: calculate_optimal_so_length(length) + void predict_gc_eff(size_t young_region_num, + size_t so_length, + double base_time_ms, + double *gc_eff, + double *pause_time_ms); + + // for use by: calculate_young_list_target_config(rs_length) + bool predict_gc_eff(size_t young_region_num, + size_t so_length, + double base_time_with_so_ms, + size_t init_free_regions, + double target_pause_time_ms, + double* gc_eff); + + void start_recording_regions(); + void record_cset_region(HeapRegion* hr, bool young); + void record_scan_only_regions(size_t scan_only_length); + void end_recording_regions(); + + void record_vtime_diff_ms(double vtime_diff_ms) { + _vtime_diff_ms = vtime_diff_ms; + } + + void record_young_free_cset_time_ms(double time_ms) { + _recorded_young_free_cset_time_ms = time_ms; + } + + void record_non_young_free_cset_time_ms(double time_ms) { + _recorded_non_young_free_cset_time_ms = time_ms; + } + + double predict_young_gc_eff() { + return get_new_neg_prediction(_young_gc_eff_seq); + } + + // + +public: + void cset_regions_freed() { + bool propagate = _last_young_gc_full && !_in_marking_window; + _short_lived_surv_rate_group->all_surviving_words_recorded(propagate); + _survivor_surv_rate_group->all_surviving_words_recorded(propagate); + // also call it on any more surv rate groups + } + + void set_known_garbage_bytes(size_t known_garbage_bytes) { + _known_garbage_bytes = known_garbage_bytes; + size_t heap_bytes = _g1->capacity(); + _known_garbage_ratio = (double) _known_garbage_bytes / (double) heap_bytes; + } + + void decrease_known_garbage_bytes(size_t known_garbage_bytes) { + guarantee( _known_garbage_bytes >= known_garbage_bytes, "invariant" ); + + _known_garbage_bytes -= known_garbage_bytes; + size_t heap_bytes = _g1->capacity(); + _known_garbage_ratio = (double) _known_garbage_bytes / (double) heap_bytes; + } + + G1MMUTracker* mmu_tracker() { + return _mmu_tracker; + } + + double predict_init_time_ms() { + return get_new_prediction(_concurrent_mark_init_times_ms); + } + + double predict_remark_time_ms() { + return get_new_prediction(_concurrent_mark_remark_times_ms); + } + + double predict_cleanup_time_ms() { + return get_new_prediction(_concurrent_mark_cleanup_times_ms); + } + + // Returns an estimate of the survival rate of the region at yg-age + // "yg_age". + double predict_yg_surv_rate(int age) { + TruncatedSeq* seq = _short_lived_surv_rate_group->get_seq(age); + if (seq->num() == 0) + gclog_or_tty->print("BARF! age is %d", age); + guarantee( seq->num() > 0, "invariant" ); + double pred = get_new_prediction(seq); + if (pred > 1.0) + pred = 1.0; + return pred; + } + + double accum_yg_surv_rate_pred(int age) { + return _short_lived_surv_rate_group->accum_surv_rate_pred(age); + } + +protected: + void print_stats (int level, const char* str, double value); + void print_stats (int level, const char* str, int value); + void print_par_stats (int level, const char* str, double* data) { + print_par_stats(level, str, data, true); + } + void print_par_stats (int level, const char* str, double* data, bool summary); + void print_par_buffers (int level, const char* str, double* data, bool summary); + + void check_other_times(int level, + NumberSeq* other_times_ms, + NumberSeq* calc_other_times_ms) const; + + void print_summary (PauseSummary* stats) const; + void print_abandoned_summary(PauseSummary* non_pop_summary, + PauseSummary* pop_summary) const; + + void print_summary (int level, const char* str, NumberSeq* seq) const; + void print_summary_sd (int level, const char* str, NumberSeq* seq) const; + + double avg_value (double* data); + double max_value (double* data); + double sum_of_values (double* data); + double max_sum (double* data1, double* data2); + + int _last_satb_drain_processed_buffers; + int _last_update_rs_processed_buffers; + double _last_pause_time_ms; + + size_t _bytes_in_to_space_before_gc; + size_t _bytes_in_to_space_after_gc; + size_t bytes_in_to_space_during_gc() { + return + _bytes_in_to_space_after_gc - _bytes_in_to_space_before_gc; + } + size_t _bytes_in_collection_set_before_gc; + // Used to count used bytes in CS. + friend class CountCSClosure; + + // Statistics kept per GC stoppage, pause or full. + TruncatedSeq* _recent_prev_end_times_for_all_gcs_sec; + + // We track markings. + int _num_markings; + double _mark_thread_startup_sec; // Time at startup of marking thread + + // Add a new GC of the given duration and end time to the record. + void update_recent_gc_times(double end_time_sec, double elapsed_ms); + + // The head of the list (via "next_in_collection_set()") representing the + // current collection set. + HeapRegion* _collection_set; + size_t _collection_set_size; + size_t _collection_set_bytes_used_before; + + // Info about marking. + int _n_marks; // Sticky at 2, so we know when we've done at least 2. + + // The number of collection pauses at the end of the last mark. + size_t _n_pauses_at_mark_end; + + // ==== This section is for stats related to starting Conc Refinement on time. + size_t _conc_refine_enabled; + size_t _conc_refine_zero_traversals; + size_t _conc_refine_max_traversals; + // In # of heap regions. + size_t _conc_refine_current_delta; + + // At the beginning of a collection pause, update the variables above, + // especially the "delta". + void update_conc_refine_data(); + // ==== + + // Stash a pointer to the g1 heap. + G1CollectedHeap* _g1; + + // The average time in ms per collection pause, averaged over recent pauses. + double recent_avg_time_for_pauses_ms(); + + // The average time in ms for processing CollectedHeap strong roots, per + // collection pause, averaged over recent pauses. + double recent_avg_time_for_CH_strong_ms(); + + // The average time in ms for processing the G1 remembered set, per + // pause, averaged over recent pauses. + double recent_avg_time_for_G1_strong_ms(); + + // The average time in ms for "evacuating followers", per pause, averaged + // over recent pauses. + double recent_avg_time_for_evac_ms(); + + // The number of "recent" GCs recorded in the number sequences + int number_of_recent_gcs(); + + // The average survival ratio, computed by the total number of bytes + // suriviving / total number of bytes before collection over the last + // several recent pauses. + double recent_avg_survival_fraction(); + // The survival fraction of the most recent pause; if there have been no + // pauses, returns 1.0. + double last_survival_fraction(); + + // Returns a "conservative" estimate of the recent survival rate, i.e., + // one that may be higher than "recent_avg_survival_fraction". + // This is conservative in several ways: + // If there have been few pauses, it will assume a potential high + // variance, and err on the side of caution. + // It puts a lower bound (currently 0.1) on the value it will return. + // To try to detect phase changes, if the most recent pause ("latest") has a + // higher-than average ("avg") survival rate, it returns that rate. + // "work" version is a utility function; young is restricted to young regions. + double conservative_avg_survival_fraction_work(double avg, + double latest); + + // The arguments are the two sequences that keep track of the number of bytes + // surviving and the total number of bytes before collection, resp., + // over the last evereal recent pauses + // Returns the survival rate for the category in the most recent pause. + // If there have been no pauses, returns 1.0. + double last_survival_fraction_work(TruncatedSeq* surviving, + TruncatedSeq* before); + + // The arguments are the two sequences that keep track of the number of bytes + // surviving and the total number of bytes before collection, resp., + // over the last several recent pauses + // Returns the average survival ration over the last several recent pauses + // If there have been no pauses, return 1.0 + double recent_avg_survival_fraction_work(TruncatedSeq* surviving, + TruncatedSeq* before); + + double conservative_avg_survival_fraction() { + double avg = recent_avg_survival_fraction(); + double latest = last_survival_fraction(); + return conservative_avg_survival_fraction_work(avg, latest); + } + + // The ratio of gc time to elapsed time, computed over recent pauses. + double _recent_avg_pause_time_ratio; + + double recent_avg_pause_time_ratio() { + return _recent_avg_pause_time_ratio; + } + + // Number of pauses between concurrent marking. + size_t _pauses_btwn_concurrent_mark; + + size_t _n_marks_since_last_pause; + + // True iff CM has been initiated. + bool _conc_mark_initiated; + + // True iff CM should be initiated + bool _should_initiate_conc_mark; + bool _should_revert_to_full_young_gcs; + bool _last_full_young_gc; + + // This set of variables tracks the collector efficiency, in order to + // determine whether we should initiate a new marking. + double _cur_mark_stop_world_time_ms; + double _mark_init_start_sec; + double _mark_remark_start_sec; + double _mark_cleanup_start_sec; + double _mark_closure_time_ms; + + void calculate_young_list_min_length(); + void calculate_young_list_target_config(); + void calculate_young_list_target_config(size_t rs_lengths); + size_t calculate_optimal_so_length(size_t young_list_length); + +public: + + G1CollectorPolicy(); + + virtual G1CollectorPolicy* as_g1_policy() { return this; } + + virtual CollectorPolicy::Name kind() { + return CollectorPolicy::G1CollectorPolicyKind; + } + + void check_prediction_validity(); + + size_t bytes_in_collection_set() { + return _bytes_in_collection_set_before_gc; + } + + size_t bytes_in_to_space() { + return bytes_in_to_space_during_gc(); + } + + unsigned calc_gc_alloc_time_stamp() { + return _all_pause_times_ms->num() + 1; + } + +protected: + + // Count the number of bytes used in the CS. + void count_CS_bytes_used(); + + // Together these do the base cleanup-recording work. Subclasses might + // want to put something between them. + void record_concurrent_mark_cleanup_end_work1(size_t freed_bytes, + size_t max_live_bytes); + void record_concurrent_mark_cleanup_end_work2(); + +public: + + virtual void init(); + + virtual HeapWord* mem_allocate_work(size_t size, + bool is_tlab, + bool* gc_overhead_limit_was_exceeded); + + // This method controls how a collector handles one or more + // of its generations being fully allocated. + virtual HeapWord* satisfy_failed_allocation(size_t size, + bool is_tlab); + + BarrierSet::Name barrier_set_name() { return BarrierSet::G1SATBCTLogging; } + + GenRemSet::Name rem_set_name() { return GenRemSet::CardTable; } + + // The number of collection pauses so far. + long n_pauses() const { return _n_pauses; } + + // Update the heuristic info to record a collection pause of the given + // start time, where the given number of bytes were used at the start. + // This may involve changing the desired size of a collection set. + + virtual void record_stop_world_start(); + + virtual void record_collection_pause_start(double start_time_sec, + size_t start_used); + + virtual void record_popular_pause_preamble_start(); + virtual void record_popular_pause_preamble_end(); + + // Must currently be called while the world is stopped. + virtual void record_concurrent_mark_init_start(); + virtual void record_concurrent_mark_init_end(); + void record_concurrent_mark_init_end_pre(double + mark_init_elapsed_time_ms); + + void record_mark_closure_time(double mark_closure_time_ms); + + virtual void record_concurrent_mark_remark_start(); + virtual void record_concurrent_mark_remark_end(); + + virtual void record_concurrent_mark_cleanup_start(); + virtual void record_concurrent_mark_cleanup_end(size_t freed_bytes, + size_t max_live_bytes); + virtual void record_concurrent_mark_cleanup_completed(); + + virtual void record_concurrent_pause(); + virtual void record_concurrent_pause_end(); + + virtual void record_collection_pause_end_CH_strong_roots(); + virtual void record_collection_pause_end_G1_strong_roots(); + + virtual void record_collection_pause_end(bool popular, bool abandoned); + + // Record the fact that a full collection occurred. + virtual void record_full_collection_start(); + virtual void record_full_collection_end(); + + void record_ext_root_scan_time(int worker_i, double ms) { + _par_last_ext_root_scan_times_ms[worker_i] = ms; + } + + void record_mark_stack_scan_time(int worker_i, double ms) { + _par_last_mark_stack_scan_times_ms[worker_i] = ms; + } + + void record_scan_only_time(int worker_i, double ms, int n) { + _par_last_scan_only_times_ms[worker_i] = ms; + _par_last_scan_only_regions_scanned[worker_i] = (double) n; + } + + void record_satb_drain_time(double ms) { + _cur_satb_drain_time_ms = ms; + _satb_drain_time_set = true; + } + + void record_satb_drain_processed_buffers (int processed_buffers) { + _last_satb_drain_processed_buffers = processed_buffers; + } + + void record_mod_union_time(double ms) { + _all_mod_union_times_ms->add(ms); + } + + void record_update_rs_start_time(int thread, double ms) { + _par_last_update_rs_start_times_ms[thread] = ms; + } + + void record_update_rs_time(int thread, double ms) { + _par_last_update_rs_times_ms[thread] = ms; + } + + void record_update_rs_processed_buffers (int thread, + double processed_buffers) { + _par_last_update_rs_processed_buffers[thread] = processed_buffers; + } + + void record_scan_rs_start_time(int thread, double ms) { + _par_last_scan_rs_start_times_ms[thread] = ms; + } + + void record_scan_rs_time(int thread, double ms) { + _par_last_scan_rs_times_ms[thread] = ms; + } + + void record_scan_new_refs_time(int thread, double ms) { + _par_last_scan_new_refs_times_ms[thread] = ms; + } + + double get_scan_new_refs_time(int thread) { + return _par_last_scan_new_refs_times_ms[thread]; + } + + void reset_obj_copy_time(int thread) { + _par_last_obj_copy_times_ms[thread] = 0.0; + } + + void reset_obj_copy_time() { + reset_obj_copy_time(0); + } + + void record_obj_copy_time(int thread, double ms) { + _par_last_obj_copy_times_ms[thread] += ms; + } + + void record_obj_copy_time(double ms) { + record_obj_copy_time(0, ms); + } + + void record_termination_time(int thread, double ms) { + _par_last_termination_times_ms[thread] = ms; + } + + void record_termination_time(double ms) { + record_termination_time(0, ms); + } + + void record_pause_time(double ms) { + _last_pause_time_ms = ms; + } + + void record_clear_ct_time(double ms) { + _cur_clear_ct_time_ms = ms; + } + + void record_par_time(double ms) { + _cur_collection_par_time_ms = ms; + } + + void record_aux_start_time(int i) { + guarantee(i < _aux_num, "should be within range"); + _cur_aux_start_times_ms[i] = os::elapsedTime() * 1000.0; + } + + void record_aux_end_time(int i) { + guarantee(i < _aux_num, "should be within range"); + double ms = os::elapsedTime() * 1000.0 - _cur_aux_start_times_ms[i]; + _cur_aux_times_set[i] = true; + _cur_aux_times_ms[i] += ms; + } + + void record_pop_compute_rc_start(); + void record_pop_compute_rc_end(); + + void record_pop_evac_start(); + void record_pop_evac_end(); + + // Record the fact that "bytes" bytes allocated in a region. + void record_before_bytes(size_t bytes); + void record_after_bytes(size_t bytes); + + // Returns "true" if this is a good time to do a collection pause. + // The "word_size" argument, if non-zero, indicates the size of an + // allocation request that is prompting this query. + virtual bool should_do_collection_pause(size_t word_size) = 0; + + // Choose a new collection set. Marks the chosen regions as being + // "in_collection_set", and links them together. The head and number of + // the collection set are available via access methods. + // If "pop_region" is non-NULL, it is a popular region that has already + // been added to the collection set. + virtual void choose_collection_set(HeapRegion* pop_region = NULL) = 0; + + void clear_collection_set() { _collection_set = NULL; } + + // The head of the list (via "next_in_collection_set()") representing the + // current collection set. + HeapRegion* collection_set() { return _collection_set; } + + // Sets the collection set to the given single region. + virtual void set_single_region_collection_set(HeapRegion* hr); + + // The number of elements in the current collection set. + size_t collection_set_size() { return _collection_set_size; } + + // 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; } + + void checkpoint_conc_overhead(); + + // If an expansion would be appropriate, because recent GC overhead had + // exceeded the desired limit, return an amount to expand by. + virtual size_t expansion_amount(); + + // note start of mark thread + void note_start_of_mark_thread(); + + // The marked bytes of the "r" has changed; reclassify it's desirability + // for marking. Also asserts that "r" is eligible for a CS. + virtual void note_change_in_marked_bytes(HeapRegion* r) = 0; + +#ifndef PRODUCT + // Check any appropriate marked bytes info, asserting false if + // something's wrong, else returning "true". + virtual bool assertMarkedBytesDataOK() = 0; +#endif + + // Print tracing information. + void print_tracing_info() const; + + // Print stats on young survival ratio + void print_yg_surv_rate_info() const; + + void finished_recalculating_age_indexes() { + _short_lived_surv_rate_group->finished_recalculating_age_indexes(); + // do that for any other surv rate groups + } + + bool should_add_next_region_to_young_list(); + + bool in_young_gc_mode() { + return _in_young_gc_mode; + } + void set_in_young_gc_mode(bool in_young_gc_mode) { + _in_young_gc_mode = in_young_gc_mode; + } + + bool full_young_gcs() { + return _full_young_gcs; + } + void set_full_young_gcs(bool full_young_gcs) { + _full_young_gcs = full_young_gcs; + } + + bool adaptive_young_list_length() { + return _adaptive_young_list_length; + } + void set_adaptive_young_list_length(bool adaptive_young_list_length) { + _adaptive_young_list_length = adaptive_young_list_length; + } + + inline double get_gc_eff_factor() { + double ratio = _known_garbage_ratio; + + double square = ratio * ratio; + // square = square * square; + double ret = square * 9.0 + 1.0; +#if 0 + gclog_or_tty->print_cr("ratio = %1.2lf, ret = %1.2lf", ratio, ret); +#endif // 0 + guarantee(0.0 <= ret && ret < 10.0, "invariant!"); + return ret; + } + + // + // Survivor regions policy. + // +protected: + + // Current tenuring threshold, set to 0 if the collector reaches the + // maximum amount of suvivors regions. + int _tenuring_threshold; + +public: + + inline GCAllocPurpose + evacuation_destination(HeapRegion* src_region, int age, size_t word_sz) { + if (age < _tenuring_threshold && src_region->is_young()) { + return GCAllocForSurvived; + } else { + return GCAllocForTenured; + } + } + + inline bool track_object_age(GCAllocPurpose purpose) { + return purpose == GCAllocForSurvived; + } + + inline GCAllocPurpose alternative_purpose(int purpose) { + return GCAllocForTenured; + } + + uint max_regions(int purpose); + + // The limit on regions for a particular purpose is reached. + void note_alloc_region_limit_reached(int purpose) { + if (purpose == GCAllocForSurvived) { + _tenuring_threshold = 0; + } + } + + void note_start_adding_survivor_regions() { + _survivor_surv_rate_group->start_adding_regions(); + } + + void note_stop_adding_survivor_regions() { + _survivor_surv_rate_group->stop_adding_regions(); + } +}; + +// This encapsulates a particular strategy for a g1 Collector. +// +// Start a concurrent mark when our heap size is n bytes +// greater then our heap size was at the last concurrent +// mark. Where n is a function of the CMSTriggerRatio +// and the MinHeapFreeRatio. +// +// Start a g1 collection pause when we have allocated the +// average number of bytes currently being freed in +// a collection, but only if it is at least one region +// full +// +// Resize Heap based on desired +// allocation space, where desired allocation space is +// a function of survival rate and desired future to size. +// +// Choose collection set by first picking all older regions +// which have a survival rate which beats our projected young +// survival rate. Then fill out the number of needed regions +// with young regions. + +class G1CollectorPolicy_BestRegionsFirst: public G1CollectorPolicy { + CollectionSetChooser* _collectionSetChooser; + // If the estimated is less then desirable, resize if possible. + void expand_if_possible(size_t numRegions); + + virtual void choose_collection_set(HeapRegion* pop_region = NULL); + virtual void record_collection_pause_start(double start_time_sec, + size_t start_used); + virtual void record_concurrent_mark_cleanup_end(size_t freed_bytes, + size_t max_live_bytes); + virtual void record_full_collection_end(); + +public: + G1CollectorPolicy_BestRegionsFirst() { + _collectionSetChooser = new CollectionSetChooser(); + } + void record_collection_pause_end(bool popular, bool abandoned); + bool should_do_collection_pause(size_t word_size); + virtual void set_single_region_collection_set(HeapRegion* hr); + // This is not needed any more, after the CSet choosing code was + // changed to use the pause prediction work. But let's leave the + // hook in just in case. + void note_change_in_marked_bytes(HeapRegion* r) { } +#ifndef PRODUCT + bool assertMarkedBytesDataOK(); +#endif +}; + +// This should move to some place more general... + +// If we have "n" measurements, and we've kept track of their "sum" and the +// "sum_of_squares" of the measurements, this returns the variance of the +// sequence. +inline double variance(int n, double sum_of_squares, double sum) { + double n_d = (double)n; + double avg = sum/n_d; + return (sum_of_squares - 2.0 * avg * sum + n_d * avg * avg) / n_d; +} + +// Local Variables: *** +// c-indentation-style: gnu *** +// End: *** diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1MMUTracker.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1MMUTracker.cpp new file mode 100644 index 00000000000..74209dc3b79 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/g1MMUTracker.cpp @@ -0,0 +1,187 @@ +/* + * Copyright 2001-2007 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. + * + */ + +#include "incls/_precompiled.incl" +#include "incls/_g1MMUTracker.cpp.incl" + +#define _DISABLE_MMU 0 + +// can't rely on comparing doubles with tolerating a small margin for error +#define SMALL_MARGIN 0.0000001 +#define is_double_leq_0(_value) ( (_value) < SMALL_MARGIN ) +#define is_double_leq(_val1, _val2) is_double_leq_0((_val1) - (_val2)) +#define is_double_geq(_val1, _val2) is_double_leq_0((_val2) - (_val1)) + +/***** ALL TIMES ARE IN SECS!!!!!!! *****/ + +G1MMUTracker::G1MMUTracker(double time_slice, double max_gc_time) : + _time_slice(time_slice), + _max_gc_time(max_gc_time), + _conc_overhead_time_sec(0.0) { } + +void +G1MMUTracker::update_conc_overhead(double conc_overhead) { + double conc_overhead_time_sec = _time_slice * conc_overhead; + if (conc_overhead_time_sec > 0.9 * _max_gc_time) { + // We are screwed, as we only seem to have <10% of the soft + // real-time goal available for pauses. Let's admit defeat and + // allow something more generous as a pause target. + conc_overhead_time_sec = 0.75 * _max_gc_time; + } + + _conc_overhead_time_sec = conc_overhead_time_sec; +} + +G1MMUTrackerQueue::G1MMUTrackerQueue(double time_slice, double max_gc_time) : + G1MMUTracker(time_slice, max_gc_time), + _head_index(0), + _tail_index(trim_index(_head_index+1)), + _no_entries(0) { } + +void G1MMUTrackerQueue::remove_expired_entries(double current_time) { + double limit = current_time - _time_slice; + while (_no_entries > 0) { + if (is_double_geq(limit, _array[_tail_index].end_time())) { + _tail_index = trim_index(_tail_index + 1); + --_no_entries; + } else + return; + } + guarantee(_no_entries == 0, "should have no entries in the array"); +} + +double G1MMUTrackerQueue::calculate_gc_time(double current_time) { + double gc_time = 0.0; + double limit = current_time - _time_slice; + for (int i = 0; i < _no_entries; ++i) { + int index = trim_index(_tail_index + i); + G1MMUTrackerQueueElem *elem = &_array[index]; + if (elem->end_time() > limit) { + if (elem->start_time() > limit) + gc_time += elem->duration(); + else + gc_time += elem->end_time() - limit; + } + } + return gc_time; +} + +void G1MMUTrackerQueue::add_pause(double start, double end, bool gc_thread) { + double longest_allowed = longest_pause_internal(start); + if (longest_allowed < 0.0) + longest_allowed = 0.0; + double duration = end - start; + + remove_expired_entries(end); + if (_no_entries == QueueLength) { + // OK, right now when we fill up we bomb out + // there are a few ways of dealing with this "gracefully" + // increase the array size (:-) + // remove the oldest entry (this might allow more GC time for + // the time slice than what's allowed) + // concolidate the two entries with the minimum gap between them + // (this mighte allow less GC time than what's allowed) + guarantee(0, "array full, currently we can't recover"); + } + _head_index = trim_index(_head_index + 1); + ++_no_entries; + _array[_head_index] = G1MMUTrackerQueueElem(start, end); +} + +// basically the _internal call does not remove expired entries +// this is for trying things out in the future and a couple +// of other places (debugging) + +double G1MMUTrackerQueue::longest_pause(double current_time) { + if (_DISABLE_MMU) + return _max_gc_time; + + MutexLockerEx x(MMUTracker_lock, Mutex::_no_safepoint_check_flag); + remove_expired_entries(current_time); + + return longest_pause_internal(current_time); +} + +double G1MMUTrackerQueue::longest_pause_internal(double current_time) { + double target_time = _max_gc_time; + + while( 1 ) { + double gc_time = + calculate_gc_time(current_time + target_time) + _conc_overhead_time_sec; + double diff = target_time + gc_time - _max_gc_time; + if (!is_double_leq_0(diff)) { + target_time -= diff; + if (is_double_leq_0(target_time)) { + target_time = -1.0; + break; + } + } else { + break; + } + } + + return target_time; +} + +// basically the _internal call does not remove expired entries +// this is for trying things out in the future and a couple +// of other places (debugging) + +double G1MMUTrackerQueue::when_sec(double current_time, double pause_time) { + if (_DISABLE_MMU) + return 0.0; + + MutexLockerEx x(MMUTracker_lock, Mutex::_no_safepoint_check_flag); + remove_expired_entries(current_time); + + return when_internal(current_time, pause_time); +} + +double G1MMUTrackerQueue::when_internal(double current_time, + double pause_time) { + // if the pause is over the maximum, just assume that it's the maximum + double adjusted_pause_time = + (pause_time > max_gc_time()) ? max_gc_time() : pause_time; + double earliest_end = current_time + adjusted_pause_time; + double limit = earliest_end - _time_slice; + double gc_time = calculate_gc_time(earliest_end); + double diff = gc_time + adjusted_pause_time - max_gc_time(); + if (is_double_leq_0(diff)) + return 0.0; + + int index = _tail_index; + while ( 1 ) { + G1MMUTrackerQueueElem *elem = &_array[index]; + if (elem->end_time() > limit) { + if (elem->start_time() > limit) + diff -= elem->duration(); + else + diff -= elem->end_time() - limit; + if (is_double_leq_0(diff)) + return elem->end_time() + diff + _time_slice - adjusted_pause_time - current_time; + } + index = trim_index(index+1); + guarantee(index != trim_index(_head_index + 1), "should not go past head"); + } +} diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1MMUTracker.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1MMUTracker.hpp new file mode 100644 index 00000000000..88a3707626b --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/g1MMUTracker.hpp @@ -0,0 +1,130 @@ +/* + * Copyright 2001-2007 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. + * + */ + +// Keeps track of the GC work and decides when it is OK to do GC work +// and for how long so that the MMU invariants are maintained. + +/***** ALL TIMES ARE IN SECS!!!!!!! *****/ + +// this is the "interface" +class G1MMUTracker { +protected: + double _time_slice; + double _max_gc_time; // this is per time slice + + double _conc_overhead_time_sec; + +public: + G1MMUTracker(double time_slice, double max_gc_time); + + void update_conc_overhead(double conc_overhead); + + virtual void add_pause(double start, double end, bool gc_thread) = 0; + virtual double longest_pause(double current_time) = 0; + virtual double when_sec(double current_time, double pause_time) = 0; + + double max_gc_time() { + return _max_gc_time - _conc_overhead_time_sec; + } + + inline bool now_max_gc(double current_time) { + return when_sec(current_time, max_gc_time()) < 0.00001; + } + + inline double when_max_gc_sec(double current_time) { + return when_sec(current_time, max_gc_time()); + } + + inline jlong when_max_gc_ms(double current_time) { + double when = when_max_gc_sec(current_time); + return (jlong) (when * 1000.0); + } + + inline jlong when_ms(double current_time, double pause_time) { + double when = when_sec(current_time, pause_time); + return (jlong) (when * 1000.0); + } +}; + +class G1MMUTrackerQueueElem { +private: + double _start_time; + double _end_time; + +public: + inline double start_time() { return _start_time; } + inline double end_time() { return _end_time; } + inline double duration() { return _end_time - _start_time; } + + G1MMUTrackerQueueElem() { + _start_time = 0.0; + _end_time = 0.0; + } + + G1MMUTrackerQueueElem(double start_time, double end_time) { + _start_time = start_time; + _end_time = end_time; + } +}; + +// this is an implementation of the MMUTracker using a (fixed-size) queue +// that keeps track of all the recent pause times +class G1MMUTrackerQueue: public G1MMUTracker { +private: + enum PrivateConstants { + QueueLength = 64 + }; + + // The array keeps track of all the pauses that fall within a time + // slice (the last time slice during which pauses took place). + // The data structure implemented is a circular queue. + // Head "points" to the most recent addition, tail to the oldest one. + // The array is of fixed size and I don't think we'll need more than + // two or three entries with the current behaviour of G1 pauses. + // If the array is full, an easy fix is to look for the pauses with + // the shortest gap between them and concolidate them. + + G1MMUTrackerQueueElem _array[QueueLength]; + int _head_index; + int _tail_index; + int _no_entries; + + inline int trim_index(int index) { + return (index + QueueLength) % QueueLength; + } + + void remove_expired_entries(double current_time); + double calculate_gc_time(double current_time); + + double longest_pause_internal(double current_time); + double when_internal(double current_time, double pause_time); + +public: + G1MMUTrackerQueue(double time_slice, double max_gc_time); + + virtual void add_pause(double start, double end, bool gc_thread); + + virtual double longest_pause(double current_time); + virtual double when_sec(double current_time, double pause_time); +}; diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp new file mode 100644 index 00000000000..2a4c7acdc8c --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp @@ -0,0 +1,381 @@ +/* + * Copyright 2001-2007 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. + * + */ + +#include "incls/_precompiled.incl" +#include "incls/_g1MarkSweep.cpp.incl" + +class HeapRegion; + +void G1MarkSweep::invoke_at_safepoint(ReferenceProcessor* rp, + bool clear_all_softrefs) { + assert(SafepointSynchronize::is_at_safepoint(), "must be at a safepoint"); + + // hook up weak ref data so it can be used during Mark-Sweep + assert(GenMarkSweep::ref_processor() == NULL, "no stomping"); + GenMarkSweep::_ref_processor = rp; + assert(rp != NULL, "should be non-NULL"); + + // When collecting the permanent generation methodOops may be moving, + // so we either have to flush all bcp data or convert it into bci. + CodeCache::gc_prologue(); + Threads::gc_prologue(); + + // Increment the invocation count for the permanent generation, since it is + // implicitly collected whenever we do a full mark sweep collection. + SharedHeap* sh = SharedHeap::heap(); + sh->perm_gen()->stat_record()->invocations++; + + bool marked_for_unloading = false; + + allocate_stacks(); + + mark_sweep_phase1(marked_for_unloading, clear_all_softrefs); + + if (G1VerifyConcMark) { + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + g1h->checkConcurrentMark(); + } + + mark_sweep_phase2(); + + // Don't add any more derived pointers during phase3 + COMPILER2_PRESENT(DerivedPointerTable::set_active(false)); + + mark_sweep_phase3(); + + mark_sweep_phase4(); + + GenMarkSweep::restore_marks(); + + GenMarkSweep::deallocate_stacks(); + + // We must invalidate the perm-gen rs, so that it gets rebuilt. + GenRemSet* rs = sh->rem_set(); + rs->invalidate(sh->perm_gen()->used_region(), true /*whole_heap*/); + + // "free at last gc" is calculated from these. + // CHF: cheating for now!!! + // Universe::set_heap_capacity_at_last_gc(Universe::heap()->capacity()); + // Universe::set_heap_used_at_last_gc(Universe::heap()->used()); + + Threads::gc_epilogue(); + CodeCache::gc_epilogue(); + + // refs processing: clean slate + GenMarkSweep::_ref_processor = NULL; +} + + +void G1MarkSweep::allocate_stacks() { + GenMarkSweep::_preserved_count_max = 0; + GenMarkSweep::_preserved_marks = NULL; + GenMarkSweep::_preserved_count = 0; + GenMarkSweep::_preserved_mark_stack = NULL; + GenMarkSweep::_preserved_oop_stack = NULL; + + GenMarkSweep::_marking_stack = + new (ResourceObj::C_HEAP) GrowableArray(4000, true); + + size_t size = SystemDictionary::number_of_classes() * 2; + GenMarkSweep::_revisit_klass_stack = + new (ResourceObj::C_HEAP) GrowableArray((int)size, true); +} + +void G1MarkSweep::mark_sweep_phase1(bool& marked_for_unloading, + bool clear_all_softrefs) { + // Recursively traverse all live objects and mark them + EventMark m("1 mark object"); + TraceTime tm("phase 1", PrintGC && Verbose, true, gclog_or_tty); + GenMarkSweep::trace(" 1"); + + SharedHeap* sh = SharedHeap::heap(); + + sh->process_strong_roots(true, // Collecting permanent generation. + SharedHeap::SO_SystemClasses, + &GenMarkSweep::follow_root_closure, + &GenMarkSweep::follow_root_closure); + + // Process reference objects found during marking + ReferencePolicy *soft_ref_policy; + if (clear_all_softrefs) { + soft_ref_policy = new AlwaysClearPolicy(); + } else { +#ifdef COMPILER2 + soft_ref_policy = new LRUMaxHeapPolicy(); +#else + soft_ref_policy = new LRUCurrentHeapPolicy(); +#endif + } + assert(soft_ref_policy != NULL,"No soft reference policy"); + GenMarkSweep::ref_processor()->process_discovered_references( + soft_ref_policy, + &GenMarkSweep::is_alive, + &GenMarkSweep::keep_alive, + &GenMarkSweep::follow_stack_closure, + NULL); + + // Follow system dictionary roots and unload classes + bool purged_class = SystemDictionary::do_unloading(&GenMarkSweep::is_alive); + assert(GenMarkSweep::_marking_stack->is_empty(), + "stack should be empty by now"); + + // Follow code cache roots (has to be done after system dictionary, + // assumes all live klasses are marked) + CodeCache::do_unloading(&GenMarkSweep::is_alive, + &GenMarkSweep::keep_alive, + purged_class); + GenMarkSweep::follow_stack(); + + // Update subklass/sibling/implementor links of live klasses + GenMarkSweep::follow_weak_klass_links(); + assert(GenMarkSweep::_marking_stack->is_empty(), + "stack should be empty by now"); + + // Visit symbol and interned string tables and delete unmarked oops + SymbolTable::unlink(&GenMarkSweep::is_alive); + StringTable::unlink(&GenMarkSweep::is_alive); + + assert(GenMarkSweep::_marking_stack->is_empty(), + "stack should be empty by now"); +} + +class G1PrepareCompactClosure: public HeapRegionClosure { + ModRefBarrierSet* _mrbs; + CompactPoint _cp; + bool _popular_only; + + void free_humongous_region(HeapRegion* hr) { + HeapWord* bot = hr->bottom(); + HeapWord* end = hr->end(); + assert(hr->startsHumongous(), + "Only the start of a humongous region should be freed."); + G1CollectedHeap::heap()->free_region(hr); + hr->prepare_for_compaction(&_cp); + // Also clear the part of the card table that will be unused after + // compaction. + _mrbs->clear(MemRegion(hr->compaction_top(), hr->end())); + } + +public: + G1PrepareCompactClosure(CompactibleSpace* cs, bool popular_only) : + _cp(NULL, cs, cs->initialize_threshold()), + _mrbs(G1CollectedHeap::heap()->mr_bs()), + _popular_only(popular_only) + {} + bool doHeapRegion(HeapRegion* hr) { + if (_popular_only && !hr->popular()) + return true; // terminate early + else if (!_popular_only && hr->popular()) + return false; // skip this one. + + if (hr->isHumongous()) { + if (hr->startsHumongous()) { + oop obj = oop(hr->bottom()); + if (obj->is_gc_marked()) { + obj->forward_to(obj); + } else { + free_humongous_region(hr); + } + } else { + assert(hr->continuesHumongous(), "Invalid humongous."); + } + } else { + hr->prepare_for_compaction(&_cp); + // Also clear the part of the card table that will be unused after + // compaction. + _mrbs->clear(MemRegion(hr->compaction_top(), hr->end())); + } + return false; + } +}; +// Stolen verbatim from g1CollectedHeap.cpp +class FindFirstRegionClosure: public HeapRegionClosure { + HeapRegion* _a_region; + bool _find_popular; +public: + FindFirstRegionClosure(bool find_popular) : + _a_region(NULL), _find_popular(find_popular) {} + bool doHeapRegion(HeapRegion* r) { + if (r->popular() == _find_popular) { + _a_region = r; + return true; + } else { + return false; + } + } + HeapRegion* result() { return _a_region; } +}; + +void G1MarkSweep::mark_sweep_phase2() { + // Now all live objects are marked, compute the new object addresses. + + // It is imperative that we traverse perm_gen LAST. If dead space is + // allowed a range of dead object may get overwritten by a dead int + // array. If perm_gen is not traversed last a klassOop may get + // overwritten. This is fine since it is dead, but if the class has dead + // instances we have to skip them, and in order to find their size we + // need the klassOop! + // + // It is not required that we traverse spaces in the same order in + // phase2, phase3 and phase4, but the ValidateMarkSweep live oops + // tracking expects us to do so. See comment under phase4. + + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + Generation* pg = g1h->perm_gen(); + + EventMark m("2 compute new addresses"); + TraceTime tm("phase 2", PrintGC && Verbose, true, gclog_or_tty); + GenMarkSweep::trace("2"); + + // First we compact the popular regions. + if (G1NumPopularRegions > 0) { + CompactibleSpace* sp = g1h->first_compactible_space(); + FindFirstRegionClosure cl(true /*find_popular*/); + g1h->heap_region_iterate(&cl); + HeapRegion *r = cl.result(); + assert(r->popular(), "should have found a popular region."); + assert(r == sp, "first popular heap region should " + "== first compactible space"); + G1PrepareCompactClosure blk(sp, true/*popular_only*/); + g1h->heap_region_iterate(&blk); + } + + // Now we do the regular regions. + FindFirstRegionClosure cl(false /*find_popular*/); + g1h->heap_region_iterate(&cl); + HeapRegion *r = cl.result(); + assert(!r->popular(), "should have founda non-popular region."); + CompactibleSpace* sp = r; + if (r->isHumongous() && oop(r->bottom())->is_gc_marked()) { + sp = r->next_compaction_space(); + } + + G1PrepareCompactClosure blk(sp, false/*popular_only*/); + g1h->heap_region_iterate(&blk); + + CompactPoint perm_cp(pg, NULL, NULL); + pg->prepare_for_compaction(&perm_cp); +} + +class G1AdjustPointersClosure: public HeapRegionClosure { + public: + bool doHeapRegion(HeapRegion* r) { + if (r->isHumongous()) { + if (r->startsHumongous()) { + // We must adjust the pointers on the single H object. + oop obj = oop(r->bottom()); + debug_only(GenMarkSweep::track_interior_pointers(obj)); + // point all the oops to the new location + obj->adjust_pointers(); + debug_only(GenMarkSweep::check_interior_pointers()); + } + } else { + // This really ought to be "as_CompactibleSpace"... + r->adjust_pointers(); + } + return false; + } +}; + +void G1MarkSweep::mark_sweep_phase3() { + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + Generation* pg = g1h->perm_gen(); + + // Adjust the pointers to reflect the new locations + EventMark m("3 adjust pointers"); + TraceTime tm("phase 3", PrintGC && Verbose, true, gclog_or_tty); + GenMarkSweep::trace("3"); + + SharedHeap* sh = SharedHeap::heap(); + + sh->process_strong_roots(true, // Collecting permanent generation. + SharedHeap::SO_AllClasses, + &GenMarkSweep::adjust_root_pointer_closure, + &GenMarkSweep::adjust_pointer_closure); + + g1h->ref_processor()->weak_oops_do(&GenMarkSweep::adjust_root_pointer_closure); + + // Now adjust pointers in remaining weak roots. (All of which should + // have been cleared if they pointed to non-surviving objects.) + g1h->g1_process_weak_roots(&GenMarkSweep::adjust_root_pointer_closure, + &GenMarkSweep::adjust_pointer_closure); + + GenMarkSweep::adjust_marks(); + + G1AdjustPointersClosure blk; + g1h->heap_region_iterate(&blk); + pg->adjust_pointers(); +} + +class G1SpaceCompactClosure: public HeapRegionClosure { +public: + G1SpaceCompactClosure() {} + + bool doHeapRegion(HeapRegion* hr) { + if (hr->isHumongous()) { + if (hr->startsHumongous()) { + oop obj = oop(hr->bottom()); + if (obj->is_gc_marked()) { + obj->init_mark(); + } else { + assert(hr->is_empty(), "Should have been cleared in phase 2."); + } + hr->reset_during_compaction(); + } + } else { + hr->compact(); + } + return false; + } +}; + +void G1MarkSweep::mark_sweep_phase4() { + // All pointers are now adjusted, move objects accordingly + + // It is imperative that we traverse perm_gen first in phase4. All + // classes must be allocated earlier than their instances, and traversing + // perm_gen first makes sure that all klassOops have moved to their new + // location before any instance does a dispatch through it's klass! + + // The ValidateMarkSweep live oops tracking expects us to traverse spaces + // in the same order in phase2, phase3 and phase4. We don't quite do that + // here (perm_gen first rather than last), so we tell the validate code + // to use a higher index (saved from phase2) when verifying perm_gen. + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + Generation* pg = g1h->perm_gen(); + + EventMark m("4 compact heap"); + TraceTime tm("phase 4", PrintGC && Verbose, true, gclog_or_tty); + GenMarkSweep::trace("4"); + + pg->compact(); + + G1SpaceCompactClosure blk; + g1h->heap_region_iterate(&blk); + +} + +// Local Variables: *** +// c-indentation-style: gnu *** +// End: *** diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.hpp new file mode 100644 index 00000000000..a0bd370bf01 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.hpp @@ -0,0 +1,57 @@ +/* + * Copyright 2001-2007 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. + * + */ + +class ReferenceProcessor; + +// G1MarkSweep takes care of global mark-compact garbage collection for a +// G1CollectedHeap using a four-phase pointer forwarding algorithm. All +// generations are assumed to support marking; those that can also support +// compaction. +// +// Class unloading will only occur when a full gc is invoked. + + +class G1MarkSweep : AllStatic { + friend class VM_G1MarkSweep; + friend class Scavenge; + + public: + + static void invoke_at_safepoint(ReferenceProcessor* rp, + bool clear_all_softrefs); + + private: + + // Mark live objects + static void mark_sweep_phase1(bool& marked_for_deopt, + bool clear_all_softrefs); + // Calculate new addresses + static void mark_sweep_phase2(); + // Update pointers + static void mark_sweep_phase3(); + // Move objects to new positions + static void mark_sweep_phase4(); + + static void allocate_stacks(); +}; diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.hpp new file mode 100644 index 00000000000..58653196a36 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.hpp @@ -0,0 +1,202 @@ +/* + * Copyright 2001-2007 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. + * + */ + +class HeapRegion; +class G1CollectedHeap; +class G1RemSet; +class HRInto_G1RemSet; +class G1RemSet; +class ConcurrentMark; +class DirtyCardToOopClosure; +class CMBitMap; +class CMMarkStack; +class G1ParScanThreadState; + +// A class that scans oops in a given heap region (much as OopsInGenClosure +// scans oops in a generation.) +class OopsInHeapRegionClosure: public OopsInGenClosure { +protected: + HeapRegion* _from; +public: + virtual void set_region(HeapRegion* from) { _from = from; } +}; + + +class G1ScanAndBalanceClosure : public OopClosure { + G1CollectedHeap* _g1; + static int _nq; +public: + G1ScanAndBalanceClosure(G1CollectedHeap* g1) : _g1(g1) { } + inline void do_oop_nv(oop* p); + inline void do_oop_nv(narrowOop* p) { guarantee(false, "NYI"); } + virtual void do_oop(oop* p); + virtual void do_oop(narrowOop* p) { guarantee(false, "NYI"); } +}; + +class G1ParClosureSuper : public OopsInHeapRegionClosure { +protected: + G1CollectedHeap* _g1; + G1RemSet* _g1_rem; + ConcurrentMark* _cm; + G1ParScanThreadState* _par_scan_state; +public: + G1ParClosureSuper(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state); + bool apply_to_weak_ref_discovered_field() { return true; } +}; + +class G1ParScanClosure : public G1ParClosureSuper { +public: + G1ParScanClosure(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state) : + G1ParClosureSuper(g1, par_scan_state) { } + void do_oop_nv(oop* p); // should be made inline + inline void do_oop_nv(narrowOop* p) { guarantee(false, "NYI"); } + virtual void do_oop(oop* p) { do_oop_nv(p); } + virtual void do_oop(narrowOop* p) { do_oop_nv(p); } +}; + +#define G1_PARTIAL_ARRAY_MASK 1 + +class G1ParScanPartialArrayClosure : public G1ParClosureSuper { + G1ParScanClosure _scanner; + template void process_array_chunk(oop obj, int start, int end); +public: + G1ParScanPartialArrayClosure(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state) : + G1ParClosureSuper(g1, par_scan_state), _scanner(g1, par_scan_state) { } + void do_oop_nv(oop* p); + void do_oop_nv(narrowOop* p) { guarantee(false, "NYI"); } + virtual void do_oop(oop* p) { do_oop_nv(p); } + virtual void do_oop(narrowOop* p) { do_oop_nv(p); } +}; + + +class G1ParCopyHelper : public G1ParClosureSuper { + G1ParScanClosure *_scanner; +protected: + void mark_forwardee(oop* p); + oop copy_to_survivor_space(oop obj); +public: + G1ParCopyHelper(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state, + G1ParScanClosure *scanner) : + G1ParClosureSuper(g1, par_scan_state), _scanner(scanner) { } +}; + +template +class G1ParCopyClosure : public G1ParCopyHelper { + G1ParScanClosure _scanner; + void do_oop_work(oop* p); + void do_oop_work(narrowOop* p) { guarantee(false, "NYI"); } +public: + G1ParCopyClosure(G1CollectedHeap* g1, G1ParScanThreadState* par_scan_state) : + _scanner(g1, par_scan_state), G1ParCopyHelper(g1, par_scan_state, &_scanner) { } + inline void do_oop_nv(oop* p) { + do_oop_work(p); + if (do_mark_forwardee) + mark_forwardee(p); + } + inline void do_oop_nv(narrowOop* p) { guarantee(false, "NYI"); } + virtual void do_oop(oop* p) { do_oop_nv(p); } + virtual void do_oop(narrowOop* p) { do_oop_nv(p); } +}; + +typedef G1ParCopyClosure G1ParScanExtRootClosure; +typedef G1ParCopyClosure G1ParScanPermClosure; +typedef G1ParCopyClosure G1ParScanAndMarkExtRootClosure; +typedef G1ParCopyClosure G1ParScanAndMarkPermClosure; +typedef G1ParCopyClosure G1ParScanHeapRSClosure; +typedef G1ParCopyClosure G1ParScanAndMarkHeapRSClosure; +typedef G1ParCopyClosure G1ParScanHeapEvacClosure; + + +class FilterIntoCSClosure: public OopClosure { + G1CollectedHeap* _g1; + OopClosure* _oc; + DirtyCardToOopClosure* _dcto_cl; +public: + FilterIntoCSClosure( DirtyCardToOopClosure* dcto_cl, + G1CollectedHeap* g1, OopClosure* oc) : + _dcto_cl(dcto_cl), _g1(g1), _oc(oc) + {} + inline void do_oop_nv(oop* p); + inline void do_oop_nv(narrowOop* p) { guarantee(false, "NYI"); } + virtual void do_oop(oop* p); + virtual void do_oop(narrowOop* p) { guarantee(false, "NYI"); } + bool apply_to_weak_ref_discovered_field() { return true; } + bool do_header() { return false; } +}; + +class FilterInHeapRegionAndIntoCSClosure : public OopsInHeapRegionClosure { + G1CollectedHeap* _g1; + OopsInHeapRegionClosure* _oc; +public: + FilterInHeapRegionAndIntoCSClosure(G1CollectedHeap* g1, + OopsInHeapRegionClosure* oc) : + _g1(g1), _oc(oc) + {} + inline void do_oop_nv(oop* p); + inline void do_oop_nv(narrowOop* p) { guarantee(false, "NYI"); } + virtual void do_oop(oop* p); + virtual void do_oop(narrowOop* p) { guarantee(false, "NYI"); } + bool apply_to_weak_ref_discovered_field() { return true; } + bool do_header() { return false; } + void set_region(HeapRegion* from) { + _oc->set_region(from); + } +}; + +class FilterAndMarkInHeapRegionAndIntoCSClosure : public OopsInHeapRegionClosure { + G1CollectedHeap* _g1; + ConcurrentMark* _cm; + OopsInHeapRegionClosure* _oc; +public: + FilterAndMarkInHeapRegionAndIntoCSClosure(G1CollectedHeap* g1, + OopsInHeapRegionClosure* oc, + ConcurrentMark* cm) + : _g1(g1), _oc(oc), _cm(cm) { } + + inline void do_oop_nv(oop* p); + inline void do_oop_nv(narrowOop* p) { guarantee(false, "NYI"); } + virtual void do_oop(oop* p); + virtual void do_oop(narrowOop* p) { guarantee(false, "NYI"); } + bool apply_to_weak_ref_discovered_field() { return true; } + bool do_header() { return false; } + void set_region(HeapRegion* from) { + _oc->set_region(from); + } +}; + +class FilterOutOfRegionClosure: public OopClosure { + HeapWord* _r_bottom; + HeapWord* _r_end; + OopClosure* _oc; + int _out_of_region; +public: + FilterOutOfRegionClosure(HeapRegion* r, OopClosure* oc); + inline void do_oop_nv(oop* p); + inline void do_oop_nv(narrowOop* p) { guarantee(false, "NYI"); } + virtual void do_oop(oop* p); + virtual void do_oop(narrowOop* p) { guarantee(false, "NYI"); } + bool apply_to_weak_ref_discovered_field() { return true; } + bool do_header() { return false; } + int out_of_region() { return _out_of_region; } +}; diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp new file mode 100644 index 00000000000..fdca16083fc --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp @@ -0,0 +1,112 @@ +/* + * Copyright 2001-2007 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. + * + */ + +/* + * This really ought to be an inline function, but apparently the C++ + * compiler sometimes sees fit to ignore inline declarations. Sigh. + */ + +// This must a ifdef'ed because the counting it controls is in a +// perf-critical inner loop. +#define FILTERINTOCSCLOSURE_DOHISTOGRAMCOUNT 0 + +inline void FilterIntoCSClosure::do_oop_nv(oop* p) { + oop obj = *p; + if (obj != NULL && _g1->obj_in_cs(obj)) { + _oc->do_oop(p); +#if FILTERINTOCSCLOSURE_DOHISTOGRAMCOUNT + _dcto_cl->incr_count(); +#endif + } +} + +inline void FilterIntoCSClosure::do_oop(oop* p) +{ + do_oop_nv(p); +} + +#define FILTEROUTOFREGIONCLOSURE_DOHISTOGRAMCOUNT 0 + +inline void FilterOutOfRegionClosure::do_oop_nv(oop* p) { + oop obj = *p; + HeapWord* obj_hw = (HeapWord*)obj; + if (obj_hw != NULL && (obj_hw < _r_bottom || obj_hw >= _r_end)) { + _oc->do_oop(p); +#if FILTEROUTOFREGIONCLOSURE_DOHISTOGRAMCOUNT + _out_of_region++; +#endif + } +} + +inline void FilterOutOfRegionClosure::do_oop(oop* p) +{ + do_oop_nv(p); +} + +inline void FilterInHeapRegionAndIntoCSClosure::do_oop_nv(oop* p) { + oop obj = *p; + if (obj != NULL && _g1->obj_in_cs(obj)) + _oc->do_oop(p); +} + +inline void FilterInHeapRegionAndIntoCSClosure::do_oop(oop* p) +{ + do_oop_nv(p); +} + + +inline void FilterAndMarkInHeapRegionAndIntoCSClosure::do_oop_nv(oop* p) { + oop obj = *p; + if (obj != NULL) { + HeapRegion* hr = _g1->heap_region_containing((HeapWord*) obj); + if (hr != NULL) { + if (hr->in_collection_set()) + _oc->do_oop(p); + else if (!hr->is_young()) + _cm->grayRoot(obj); + } + } +} + +inline void FilterAndMarkInHeapRegionAndIntoCSClosure::do_oop(oop* p) +{ + do_oop_nv(p); +} + +inline void G1ScanAndBalanceClosure::do_oop_nv(oop* p) { + RefToScanQueue* q; + if (ParallelGCThreads > 0) { + // Deal the work out equally. + _nq = (_nq + 1) % ParallelGCThreads; + q = _g1->task_queue(_nq); + } else { + q = _g1->task_queue(0); + } + bool nooverflow = q->push(p); + guarantee(nooverflow, "Overflow during poplularity region processing"); +} + +inline void G1ScanAndBalanceClosure::do_oop(oop* p) { + do_oop_nv(p); +} diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp new file mode 100644 index 00000000000..462be9a689e --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp @@ -0,0 +1,1003 @@ +/* + * Copyright 2001-2007 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. + * + */ + +#include "incls/_precompiled.incl" +#include "incls/_g1RemSet.cpp.incl" + +#define CARD_REPEAT_HISTO 0 + +#if CARD_REPEAT_HISTO +static size_t ct_freq_sz; +static jbyte* ct_freq = NULL; + +void init_ct_freq_table(size_t heap_sz_bytes) { + if (ct_freq == NULL) { + ct_freq_sz = heap_sz_bytes/CardTableModRefBS::card_size; + ct_freq = new jbyte[ct_freq_sz]; + for (size_t j = 0; j < ct_freq_sz; j++) ct_freq[j] = 0; + } +} + +void ct_freq_note_card(size_t index) { + assert(0 <= index && index < ct_freq_sz, "Bounds error."); + if (ct_freq[index] < 100) { ct_freq[index]++; } +} + +static IntHistogram card_repeat_count(10, 10); + +void ct_freq_update_histo_and_reset() { + for (size_t j = 0; j < ct_freq_sz; j++) { + card_repeat_count.add_entry(ct_freq[j]); + ct_freq[j] = 0; + } + +} +#endif + + +class IntoCSOopClosure: public OopsInHeapRegionClosure { + OopsInHeapRegionClosure* _blk; + G1CollectedHeap* _g1; +public: + IntoCSOopClosure(G1CollectedHeap* g1, OopsInHeapRegionClosure* blk) : + _g1(g1), _blk(blk) {} + void set_region(HeapRegion* from) { + _blk->set_region(from); + } + virtual void do_oop(narrowOop* p) { + guarantee(false, "NYI"); + } + virtual void do_oop(oop* p) { + oop obj = *p; + if (_g1->obj_in_cs(obj)) _blk->do_oop(p); + } + bool apply_to_weak_ref_discovered_field() { return true; } + bool idempotent() { return true; } +}; + +class IntoCSRegionClosure: public HeapRegionClosure { + IntoCSOopClosure _blk; + G1CollectedHeap* _g1; +public: + IntoCSRegionClosure(G1CollectedHeap* g1, OopsInHeapRegionClosure* blk) : + _g1(g1), _blk(g1, blk) {} + bool doHeapRegion(HeapRegion* r) { + if (!r->in_collection_set()) { + _blk.set_region(r); + if (r->isHumongous()) { + if (r->startsHumongous()) { + oop obj = oop(r->bottom()); + obj->oop_iterate(&_blk); + } + } else { + r->oop_before_save_marks_iterate(&_blk); + } + } + return false; + } +}; + +void +StupidG1RemSet::oops_into_collection_set_do(OopsInHeapRegionClosure* oc, + int worker_i) { + IntoCSRegionClosure rc(_g1, oc); + _g1->heap_region_iterate(&rc); +} + +class UpdateRSOopClosure: public OopClosure { + HeapRegion* _from; + HRInto_G1RemSet* _rs; + int _worker_i; +public: + UpdateRSOopClosure(HRInto_G1RemSet* rs, int worker_i = 0) : + _from(NULL), _rs(rs), _worker_i(worker_i) { + guarantee(_rs != NULL, "Requires an HRIntoG1RemSet"); + } + + void set_from(HeapRegion* from) { + assert(from != NULL, "from region must be non-NULL"); + _from = from; + } + + virtual void do_oop(narrowOop* p) { + guarantee(false, "NYI"); + } + virtual void do_oop(oop* p) { + assert(_from != NULL, "from region must be non-NULL"); + _rs->par_write_ref(_from, p, _worker_i); + } + // Override: this closure is idempotent. + // bool idempotent() { return true; } + bool apply_to_weak_ref_discovered_field() { return true; } +}; + +class UpdateRSOutOfRegionClosure: public HeapRegionClosure { + G1CollectedHeap* _g1h; + ModRefBarrierSet* _mr_bs; + UpdateRSOopClosure _cl; + int _worker_i; +public: + UpdateRSOutOfRegionClosure(G1CollectedHeap* g1, int worker_i = 0) : + _cl(g1->g1_rem_set()->as_HRInto_G1RemSet(), worker_i), + _mr_bs(g1->mr_bs()), + _worker_i(worker_i), + _g1h(g1) + {} + bool doHeapRegion(HeapRegion* r) { + if (!r->in_collection_set() && !r->continuesHumongous()) { + _cl.set_from(r); + r->set_next_filter_kind(HeapRegionDCTOC::OutOfRegionFilterKind); + _mr_bs->mod_oop_in_space_iterate(r, &_cl, true, true); + } + return false; + } +}; + +class VerifyRSCleanCardOopClosure: public OopClosure { + G1CollectedHeap* _g1; +public: + VerifyRSCleanCardOopClosure(G1CollectedHeap* g1) : _g1(g1) {} + + virtual void do_oop(narrowOop* p) { + guarantee(false, "NYI"); + } + virtual void do_oop(oop* p) { + oop obj = *p; + HeapRegion* to = _g1->heap_region_containing(obj); + guarantee(to == NULL || !to->in_collection_set(), + "Missed a rem set member."); + } +}; + +HRInto_G1RemSet::HRInto_G1RemSet(G1CollectedHeap* g1, CardTableModRefBS* ct_bs) + : G1RemSet(g1), _ct_bs(ct_bs), _g1p(_g1->g1_policy()), + _cg1r(g1->concurrent_g1_refine()), + _par_traversal_in_progress(false), _new_refs(NULL), + _cards_scanned(NULL), _total_cards_scanned(0) +{ + _seq_task = new SubTasksDone(NumSeqTasks); + _new_refs = NEW_C_HEAP_ARRAY(GrowableArray*, ParallelGCThreads); +} + +HRInto_G1RemSet::~HRInto_G1RemSet() { + delete _seq_task; +} + +void CountNonCleanMemRegionClosure::do_MemRegion(MemRegion mr) { + if (_g1->is_in_g1_reserved(mr.start())) { + _n += (int) ((mr.byte_size() / CardTableModRefBS::card_size)); + if (_start_first == NULL) _start_first = mr.start(); + } +} + +class ScanRSClosure : public HeapRegionClosure { + size_t _cards_done, _cards; + G1CollectedHeap* _g1h; + OopsInHeapRegionClosure* _oc; + G1BlockOffsetSharedArray* _bot_shared; + CardTableModRefBS *_ct_bs; + int _worker_i; + bool _try_claimed; +public: + ScanRSClosure(OopsInHeapRegionClosure* oc, int worker_i) : + _oc(oc), + _cards(0), + _cards_done(0), + _worker_i(worker_i), + _try_claimed(false) + { + _g1h = G1CollectedHeap::heap(); + _bot_shared = _g1h->bot_shared(); + _ct_bs = (CardTableModRefBS*) (_g1h->barrier_set()); + } + + void set_try_claimed() { _try_claimed = true; } + + void scanCard(size_t index, HeapRegion *r) { + _cards_done++; + DirtyCardToOopClosure* cl = + r->new_dcto_closure(_oc, + CardTableModRefBS::Precise, + HeapRegionDCTOC::IntoCSFilterKind); + + // Set the "from" region in the closure. + _oc->set_region(r); + HeapWord* card_start = _bot_shared->address_for_index(index); + HeapWord* card_end = card_start + G1BlockOffsetSharedArray::N_words; + Space *sp = SharedHeap::heap()->space_containing(card_start); + MemRegion sm_region; + if (ParallelGCThreads > 0) { + // first find the used area + sm_region = sp->used_region_at_save_marks(); + } else { + // The closure is not idempotent. We shouldn't look at objects + // allocated during the GC. + sm_region = sp->used_region_at_save_marks(); + } + MemRegion mr = sm_region.intersection(MemRegion(card_start,card_end)); + if (!mr.is_empty()) { + cl->do_MemRegion(mr); + } + } + + void printCard(HeapRegion* card_region, size_t card_index, + HeapWord* card_start) { + gclog_or_tty->print_cr("T %d Region [" PTR_FORMAT ", " PTR_FORMAT ") " + "RS names card %p: " + "[" PTR_FORMAT ", " PTR_FORMAT ")", + _worker_i, + card_region->bottom(), card_region->end(), + card_index, + card_start, card_start + G1BlockOffsetSharedArray::N_words); + } + + bool doHeapRegion(HeapRegion* r) { + assert(r->in_collection_set(), "should only be called on elements of CS."); + HeapRegionRemSet* hrrs = r->rem_set(); + if (hrrs->iter_is_complete()) return false; // All done. + if (!_try_claimed && !hrrs->claim_iter()) return false; + // If we didn't return above, then + // _try_claimed || r->claim_iter() + // is true: either we're supposed to work on claimed-but-not-complete + // regions, or we successfully claimed the region. + HeapRegionRemSetIterator* iter = _g1h->rem_set_iterator(_worker_i); + hrrs->init_iterator(iter); + size_t card_index; + while (iter->has_next(card_index)) { + HeapWord* card_start = _g1h->bot_shared()->address_for_index(card_index); + +#if 0 + gclog_or_tty->print("Rem set iteration yielded card [" PTR_FORMAT ", " PTR_FORMAT ").\n", + card_start, card_start + CardTableModRefBS::card_size_in_words); +#endif + + HeapRegion* card_region = _g1h->heap_region_containing(card_start); + assert(card_region != NULL, "Yielding cards not in the heap?"); + _cards++; + + if (!card_region->in_collection_set()) { + // If the card is dirty, then we will scan it during updateRS. + if (!_ct_bs->is_card_claimed(card_index) && + !_ct_bs->is_card_dirty(card_index)) { + assert(_ct_bs->is_card_clean(card_index) || + _ct_bs->is_card_claimed(card_index), + "Card is either dirty, clean, or claimed"); + if (_ct_bs->claim_card(card_index)) + scanCard(card_index, card_region); + } + } + } + hrrs->set_iter_complete(); + return false; + } + // Set all cards back to clean. + void cleanup() {_g1h->cleanUpCardTable();} + size_t cards_done() { return _cards_done;} + size_t cards_looked_up() { return _cards;} +}; + +// We want the parallel threads to start their scanning at +// different collection set regions to avoid contention. +// If we have: +// n collection set regions +// p threads +// Then thread t will start at region t * floor (n/p) + +HeapRegion* HRInto_G1RemSet::calculateStartRegion(int worker_i) { + HeapRegion* result = _g1p->collection_set(); + if (ParallelGCThreads > 0) { + size_t cs_size = _g1p->collection_set_size(); + int n_workers = _g1->workers()->total_workers(); + size_t cs_spans = cs_size / n_workers; + size_t ind = cs_spans * worker_i; + for (size_t i = 0; i < ind; i++) + result = result->next_in_collection_set(); + } + return result; +} + +void HRInto_G1RemSet::scanRS(OopsInHeapRegionClosure* oc, int worker_i) { + double rs_time_start = os::elapsedTime(); + HeapRegion *startRegion = calculateStartRegion(worker_i); + + BufferingOopsInHeapRegionClosure boc(oc); + ScanRSClosure scanRScl(&boc, worker_i); + _g1->collection_set_iterate_from(startRegion, &scanRScl); + scanRScl.set_try_claimed(); + _g1->collection_set_iterate_from(startRegion, &scanRScl); + + boc.done(); + double closure_app_time_sec = boc.closure_app_seconds(); + double scan_rs_time_sec = (os::elapsedTime() - rs_time_start) - + closure_app_time_sec; + double closure_app_time_ms = closure_app_time_sec * 1000.0; + + assert( _cards_scanned != NULL, "invariant" ); + _cards_scanned[worker_i] = scanRScl.cards_done(); + + _g1p->record_scan_rs_start_time(worker_i, rs_time_start * 1000.0); + _g1p->record_scan_rs_time(worker_i, scan_rs_time_sec * 1000.0); + if (ParallelGCThreads > 0) { + // In this case, we called scanNewRefsRS and recorded the corresponding + // time. + double scan_new_refs_time_ms = _g1p->get_scan_new_refs_time(worker_i); + if (scan_new_refs_time_ms > 0.0) { + closure_app_time_ms += scan_new_refs_time_ms; + } + } + _g1p->record_obj_copy_time(worker_i, closure_app_time_ms); +} + +void HRInto_G1RemSet::updateRS(int worker_i) { + ConcurrentG1Refine* cg1r = _g1->concurrent_g1_refine(); + + double start = os::elapsedTime(); + _g1p->record_update_rs_start_time(worker_i, start * 1000.0); + + if (G1RSBarrierUseQueue && !cg1r->do_traversal()) { + // Apply the appropriate closure to all remaining log entries. + _g1->iterate_dirty_card_closure(false, worker_i); + // Now there should be no dirty cards. + if (G1RSLogCheckCardTable) { + CountNonCleanMemRegionClosure cl(_g1); + _ct_bs->mod_card_iterate(&cl); + // XXX This isn't true any more: keeping cards of young regions + // marked dirty broke it. Need some reasonable fix. + guarantee(cl.n() == 0, "Card table should be clean."); + } + } else { + UpdateRSOutOfRegionClosure update_rs(_g1, worker_i); + _g1->heap_region_iterate(&update_rs); + // We did a traversal; no further one is necessary. + if (G1RSBarrierUseQueue) { + assert(cg1r->do_traversal(), "Or we shouldn't have gotten here."); + cg1r->set_pya_cancel(); + } + if (_cg1r->use_cache()) { + _cg1r->clear_and_record_card_counts(); + _cg1r->clear_hot_cache(); + } + } + _g1p->record_update_rs_time(worker_i, (os::elapsedTime() - start) * 1000.0); +} + +#ifndef PRODUCT +class PrintRSClosure : public HeapRegionClosure { + int _count; +public: + PrintRSClosure() : _count(0) {} + bool doHeapRegion(HeapRegion* r) { + HeapRegionRemSet* hrrs = r->rem_set(); + _count += (int) hrrs->occupied(); + if (hrrs->occupied() == 0) { + gclog_or_tty->print("Heap Region [" PTR_FORMAT ", " PTR_FORMAT ") " + "has no remset entries\n", + r->bottom(), r->end()); + } else { + gclog_or_tty->print("Printing rem set for heap region [" PTR_FORMAT ", " PTR_FORMAT ")\n", + r->bottom(), r->end()); + r->print(); + hrrs->print(); + gclog_or_tty->print("\nDone printing rem set\n"); + } + return false; + } + int occupied() {return _count;} +}; +#endif + +class CountRSSizeClosure: public HeapRegionClosure { + size_t _n; + size_t _tot; + size_t _max; + HeapRegion* _max_r; + enum { + N = 20, + MIN = 6 + }; + int _histo[N]; +public: + CountRSSizeClosure() : _n(0), _tot(0), _max(0), _max_r(NULL) { + for (int i = 0; i < N; i++) _histo[i] = 0; + } + bool doHeapRegion(HeapRegion* r) { + if (!r->continuesHumongous()) { + size_t occ = r->rem_set()->occupied(); + _n++; + _tot += occ; + if (occ > _max) { + _max = occ; + _max_r = r; + } + // Fit it into a histo bin. + int s = 1 << MIN; + int i = 0; + while (occ > (size_t) s && i < (N-1)) { + s = s << 1; + i++; + } + _histo[i]++; + } + return false; + } + size_t n() { return _n; } + size_t tot() { return _tot; } + size_t mx() { return _max; } + HeapRegion* mxr() { return _max_r; } + void print_histo() { + int mx = N; + while (mx >= 0) { + if (_histo[mx-1] > 0) break; + mx--; + } + gclog_or_tty->print_cr("Number of regions with given RS sizes:"); + gclog_or_tty->print_cr(" <= %8d %8d", 1 << MIN, _histo[0]); + for (int i = 1; i < mx-1; i++) { + gclog_or_tty->print_cr(" %8d - %8d %8d", + (1 << (MIN + i - 1)) + 1, + 1 << (MIN + i), + _histo[i]); + } + gclog_or_tty->print_cr(" > %8d %8d", (1 << (MIN+mx-2))+1, _histo[mx-1]); + } +}; + +void +HRInto_G1RemSet::scanNewRefsRS(OopsInHeapRegionClosure* oc, + int worker_i) { + double scan_new_refs_start_sec = os::elapsedTime(); + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + CardTableModRefBS* ct_bs = (CardTableModRefBS*) (g1h->barrier_set()); + while (_new_refs[worker_i]->is_nonempty()) { + oop* p = _new_refs[worker_i]->pop(); + oop obj = *p; + // *p was in the collection set when p was pushed on "_new_refs", but + // another thread may have processed this location from an RS, so it + // might not point into the CS any longer. If so, it's obviously been + // processed, and we don't need to do anything further. + if (g1h->obj_in_cs(obj)) { + HeapRegion* r = g1h->heap_region_containing(p); + + DEBUG_ONLY(HeapRegion* to = g1h->heap_region_containing(obj)); + assert(ParallelGCThreads > 1 + || to->rem_set()->contains_reference(p), + "Invariant: pushed after being added." + "(Not reliable in parallel code.)"); + oc->set_region(r); + // If "p" has already been processed concurrently, this is + // idempotent. + oc->do_oop(p); + } + } + _g1p->record_scan_new_refs_time(worker_i, + (os::elapsedTime() - scan_new_refs_start_sec) + * 1000.0); +} + +void HRInto_G1RemSet::set_par_traversal(bool b) { + _par_traversal_in_progress = b; + HeapRegionRemSet::set_par_traversal(b); +} + +void HRInto_G1RemSet::cleanupHRRS() { + HeapRegionRemSet::cleanup(); +} + +void +HRInto_G1RemSet::oops_into_collection_set_do(OopsInHeapRegionClosure* oc, + int worker_i) { +#if CARD_REPEAT_HISTO + ct_freq_update_histo_and_reset(); +#endif + if (worker_i == 0) { + _cg1r->clear_and_record_card_counts(); + } + + // Make this into a command-line flag... + if (G1RSCountHisto && (ParallelGCThreads == 0 || worker_i == 0)) { + CountRSSizeClosure count_cl; + _g1->heap_region_iterate(&count_cl); + gclog_or_tty->print_cr("Avg of %d RS counts is %f, max is %d, " + "max region is " PTR_FORMAT, + count_cl.n(), (float)count_cl.tot()/(float)count_cl.n(), + count_cl.mx(), count_cl.mxr()); + count_cl.print_histo(); + } + + if (ParallelGCThreads > 0) { + // This is a temporary change to serialize the update and scanning + // of remembered sets. There are some race conditions when this is + // done in parallel and they are causing failures. When we resolve + // said race conditions, we'll revert back to parallel remembered + // set updating and scanning. See CRs 6677707 and 6677708. + if (worker_i == 0) { + updateRS(worker_i); + scanNewRefsRS(oc, worker_i); + scanRS(oc, worker_i); + } + } else { + assert(worker_i == 0, "invariant"); + + updateRS(0); + scanRS(oc, 0); + } +} + +void HRInto_G1RemSet:: +prepare_for_oops_into_collection_set_do() { +#if G1_REM_SET_LOGGING + PrintRSClosure cl; + _g1->collection_set_iterate(&cl); +#endif + cleanupHRRS(); + ConcurrentG1Refine* cg1r = _g1->concurrent_g1_refine(); + _g1->set_refine_cte_cl_concurrency(false); + DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set(); + dcqs.concatenate_logs(); + + assert(!_par_traversal_in_progress, "Invariant between iterations."); + if (ParallelGCThreads > 0) { + set_par_traversal(true); + int n_workers = _g1->workers()->total_workers(); + _seq_task->set_par_threads(n_workers); + for (uint i = 0; i < ParallelGCThreads; i++) + _new_refs[i] = new (ResourceObj::C_HEAP) GrowableArray(8192,true); + + if (cg1r->do_traversal()) { + updateRS(0); + // Have to do this again after updaters + cleanupHRRS(); + } + } + guarantee( _cards_scanned == NULL, "invariant" ); + _cards_scanned = NEW_C_HEAP_ARRAY(size_t, n_workers()); + _total_cards_scanned = 0; +} + + +class cleanUpIteratorsClosure : public HeapRegionClosure { + bool doHeapRegion(HeapRegion *r) { + HeapRegionRemSet* hrrs = r->rem_set(); + hrrs->init_for_par_iteration(); + return false; + } +}; + +void HRInto_G1RemSet::cleanup_after_oops_into_collection_set_do() { + guarantee( _cards_scanned != NULL, "invariant" ); + _total_cards_scanned = 0; + for (uint i = 0; i < n_workers(); ++i) + _total_cards_scanned += _cards_scanned[i]; + FREE_C_HEAP_ARRAY(size_t, _cards_scanned); + _cards_scanned = NULL; + // Cleanup after copy +#if G1_REM_SET_LOGGING + PrintRSClosure cl; + _g1->heap_region_iterate(&cl); +#endif + _g1->set_refine_cte_cl_concurrency(true); + cleanUpIteratorsClosure iterClosure; + _g1->collection_set_iterate(&iterClosure); + // Set all cards back to clean. + _g1->cleanUpCardTable(); + if (ParallelGCThreads > 0) { + ConcurrentG1Refine* cg1r = _g1->concurrent_g1_refine(); + if (cg1r->do_traversal()) { + cg1r->cg1rThread()->set_do_traversal(false); + } + for (uint i = 0; i < ParallelGCThreads; i++) { + delete _new_refs[i]; + } + set_par_traversal(false); + } + assert(!_par_traversal_in_progress, "Invariant between iterations."); +} + +class UpdateRSObjectClosure: public ObjectClosure { + UpdateRSOopClosure* _update_rs_oop_cl; +public: + UpdateRSObjectClosure(UpdateRSOopClosure* update_rs_oop_cl) : + _update_rs_oop_cl(update_rs_oop_cl) {} + void do_object(oop obj) { + obj->oop_iterate(_update_rs_oop_cl); + } + +}; + +class ScrubRSClosure: public HeapRegionClosure { + G1CollectedHeap* _g1h; + BitMap* _region_bm; + BitMap* _card_bm; + CardTableModRefBS* _ctbs; +public: + ScrubRSClosure(BitMap* region_bm, BitMap* card_bm) : + _g1h(G1CollectedHeap::heap()), + _region_bm(region_bm), _card_bm(card_bm), + _ctbs(NULL) + { + ModRefBarrierSet* bs = _g1h->mr_bs(); + guarantee(bs->is_a(BarrierSet::CardTableModRef), "Precondition"); + _ctbs = (CardTableModRefBS*)bs; + } + + bool doHeapRegion(HeapRegion* r) { + if (!r->continuesHumongous()) { + r->rem_set()->scrub(_ctbs, _region_bm, _card_bm); + } + return false; + } +}; + +void HRInto_G1RemSet::scrub(BitMap* region_bm, BitMap* card_bm) { + ScrubRSClosure scrub_cl(region_bm, card_bm); + _g1->heap_region_iterate(&scrub_cl); +} + +void HRInto_G1RemSet::scrub_par(BitMap* region_bm, BitMap* card_bm, + int worker_num, int claim_val) { + ScrubRSClosure scrub_cl(region_bm, card_bm); + _g1->heap_region_par_iterate_chunked(&scrub_cl, worker_num, claim_val); +} + + +class ConcRefineRegionClosure: public HeapRegionClosure { + G1CollectedHeap* _g1h; + CardTableModRefBS* _ctbs; + ConcurrentGCThread* _cgc_thrd; + ConcurrentG1Refine* _cg1r; + unsigned _cards_processed; + UpdateRSOopClosure _update_rs_oop_cl; +public: + ConcRefineRegionClosure(CardTableModRefBS* ctbs, + ConcurrentG1Refine* cg1r, + HRInto_G1RemSet* g1rs) : + _ctbs(ctbs), _cg1r(cg1r), _cgc_thrd(cg1r->cg1rThread()), + _update_rs_oop_cl(g1rs), _cards_processed(0), + _g1h(G1CollectedHeap::heap()) + {} + + bool doHeapRegion(HeapRegion* r) { + if (!r->in_collection_set() && + !r->continuesHumongous() && + !r->is_young()) { + _update_rs_oop_cl.set_from(r); + UpdateRSObjectClosure update_rs_obj_cl(&_update_rs_oop_cl); + + // For each run of dirty card in the region: + // 1) Clear the cards. + // 2) Process the range corresponding to the run, adding any + // necessary RS entries. + // 1 must precede 2, so that a concurrent modification redirties the + // card. If a processing attempt does not succeed, because it runs + // into an unparseable region, we will do binary search to find the + // beginning of the next parseable region. + HeapWord* startAddr = r->bottom(); + HeapWord* endAddr = r->used_region().end(); + HeapWord* lastAddr; + HeapWord* nextAddr; + + for (nextAddr = lastAddr = startAddr; + nextAddr < endAddr; + nextAddr = lastAddr) { + MemRegion dirtyRegion; + + // Get and clear dirty region from card table + MemRegion next_mr(nextAddr, endAddr); + dirtyRegion = + _ctbs->dirty_card_range_after_reset( + next_mr, + true, CardTableModRefBS::clean_card_val()); + assert(dirtyRegion.start() >= nextAddr, + "returned region inconsistent?"); + + if (!dirtyRegion.is_empty()) { + HeapWord* stop_point = + r->object_iterate_mem_careful(dirtyRegion, + &update_rs_obj_cl); + if (stop_point == NULL) { + lastAddr = dirtyRegion.end(); + _cards_processed += + (int) (dirtyRegion.word_size() / CardTableModRefBS::card_size_in_words); + } else { + // We're going to skip one or more cards that we can't parse. + HeapWord* next_parseable_card = + r->next_block_start_careful(stop_point); + // Round this up to a card boundary. + next_parseable_card = + _ctbs->addr_for(_ctbs->byte_after_const(next_parseable_card)); + // Now we invalidate the intervening cards so we'll see them + // again. + MemRegion remaining_dirty = + MemRegion(stop_point, dirtyRegion.end()); + MemRegion skipped = + MemRegion(stop_point, next_parseable_card); + _ctbs->invalidate(skipped.intersection(remaining_dirty)); + + // Now start up again where we can parse. + lastAddr = next_parseable_card; + + // Count how many we did completely. + _cards_processed += + (stop_point - dirtyRegion.start()) / + CardTableModRefBS::card_size_in_words; + } + // Allow interruption at regular intervals. + // (Might need to make them more regular, if we get big + // dirty regions.) + if (_cgc_thrd != NULL) { + if (_cgc_thrd->should_yield()) { + _cgc_thrd->yield(); + switch (_cg1r->get_pya()) { + case PYA_continue: + // This may have changed: re-read. + endAddr = r->used_region().end(); + continue; + case PYA_restart: case PYA_cancel: + return true; + } + } + } + } else { + break; + } + } + } + // A good yield opportunity. + if (_cgc_thrd != NULL) { + if (_cgc_thrd->should_yield()) { + _cgc_thrd->yield(); + switch (_cg1r->get_pya()) { + case PYA_restart: case PYA_cancel: + return true; + default: + break; + } + + } + } + return false; + } + + unsigned cards_processed() { return _cards_processed; } +}; + + +void HRInto_G1RemSet::concurrentRefinementPass(ConcurrentG1Refine* cg1r) { + ConcRefineRegionClosure cr_cl(ct_bs(), cg1r, this); + _g1->heap_region_iterate(&cr_cl); + _conc_refine_traversals++; + _conc_refine_cards += cr_cl.cards_processed(); +} + +static IntHistogram out_of_histo(50, 50); + + + +void HRInto_G1RemSet::concurrentRefineOneCard(jbyte* card_ptr, int worker_i) { + // If the card is no longer dirty, nothing to do. + if (*card_ptr != CardTableModRefBS::dirty_card_val()) return; + + // Construct the region representing the card. + HeapWord* start = _ct_bs->addr_for(card_ptr); + // And find the region containing it. + HeapRegion* r = _g1->heap_region_containing(start); + if (r == NULL) { + guarantee(_g1->is_in_permanent(start), "Or else where?"); + return; // Not in the G1 heap (might be in perm, for example.) + } + // Why do we have to check here whether a card is on a young region, + // given that we dirty young regions and, as a result, the + // post-barrier is supposed to filter them out and never to enqueue + // them? When we allocate a new region as the "allocation region" we + // actually dirty its cards after we release the lock, since card + // dirtying while holding the lock was a performance bottleneck. So, + // as a result, it is possible for other threads to actually + // allocate objects in the region (after the acquire the lock) + // before all the cards on the region are dirtied. This is unlikely, + // and it doesn't happen often, but it can happen. So, the extra + // check below filters out those cards. + if (r->is_young()) { + return; + } + // While we are processing RSet buffers during the collection, we + // actually don't want to scan any cards on the collection set, + // since we don't want to update remebered sets with entries that + // point into the collection set, given that live objects from the + // collection set are about to move and such entries will be stale + // very soon. This change also deals with a reliability issue which + // involves scanning a card in the collection set and coming across + // an array that was being chunked and looking malformed. Note, + // however, that if evacuation fails, we have to scan any objects + // that were not moved and create any missing entries. + if (r->in_collection_set()) { + return; + } + + // Should we defer it? + if (_cg1r->use_cache()) { + card_ptr = _cg1r->cache_insert(card_ptr); + // If it was not an eviction, nothing to do. + if (card_ptr == NULL) return; + + // OK, we have to reset the card start, region, etc. + start = _ct_bs->addr_for(card_ptr); + r = _g1->heap_region_containing(start); + if (r == NULL) { + guarantee(_g1->is_in_permanent(start), "Or else where?"); + return; // Not in the G1 heap (might be in perm, for example.) + } + guarantee(!r->is_young(), "It was evicted in the current minor cycle."); + } + + HeapWord* end = _ct_bs->addr_for(card_ptr + 1); + MemRegion dirtyRegion(start, end); + +#if CARD_REPEAT_HISTO + init_ct_freq_table(_g1->g1_reserved_obj_bytes()); + ct_freq_note_card(_ct_bs->index_for(start)); +#endif + + UpdateRSOopClosure update_rs_oop_cl(this, worker_i); + update_rs_oop_cl.set_from(r); + FilterOutOfRegionClosure filter_then_update_rs_oop_cl(r, &update_rs_oop_cl); + + // Undirty the card. + *card_ptr = CardTableModRefBS::clean_card_val(); + // We must complete this write before we do any of the reads below. + OrderAccess::storeload(); + // And process it, being careful of unallocated portions of TLAB's. + HeapWord* stop_point = + r->oops_on_card_seq_iterate_careful(dirtyRegion, + &filter_then_update_rs_oop_cl); + // If stop_point is non-null, then we encountered an unallocated region + // (perhaps the unfilled portion of a TLAB.) For now, we'll dirty the + // card and re-enqueue: if we put off the card until a GC pause, then the + // unallocated portion will be filled in. Alternatively, we might try + // the full complexity of the technique used in "regular" precleaning. + if (stop_point != NULL) { + // The card might have gotten re-dirtied and re-enqueued while we + // worked. (In fact, it's pretty likely.) + if (*card_ptr != CardTableModRefBS::dirty_card_val()) { + *card_ptr = CardTableModRefBS::dirty_card_val(); + MutexLockerEx x(Shared_DirtyCardQ_lock, + Mutex::_no_safepoint_check_flag); + DirtyCardQueue* sdcq = + JavaThread::dirty_card_queue_set().shared_dirty_card_queue(); + sdcq->enqueue(card_ptr); + } + } else { + out_of_histo.add_entry(filter_then_update_rs_oop_cl.out_of_region()); + _conc_refine_cards++; + } +} + +class HRRSStatsIter: public HeapRegionClosure { + size_t _occupied; + size_t _total_mem_sz; + size_t _max_mem_sz; + HeapRegion* _max_mem_sz_region; +public: + HRRSStatsIter() : + _occupied(0), + _total_mem_sz(0), + _max_mem_sz(0), + _max_mem_sz_region(NULL) + {} + + bool doHeapRegion(HeapRegion* r) { + if (r->continuesHumongous()) return false; + size_t mem_sz = r->rem_set()->mem_size(); + if (mem_sz > _max_mem_sz) { + _max_mem_sz = mem_sz; + _max_mem_sz_region = r; + } + _total_mem_sz += mem_sz; + size_t occ = r->rem_set()->occupied(); + _occupied += occ; + return false; + } + size_t total_mem_sz() { return _total_mem_sz; } + size_t max_mem_sz() { return _max_mem_sz; } + size_t occupied() { return _occupied; } + HeapRegion* max_mem_sz_region() { return _max_mem_sz_region; } +}; + +void HRInto_G1RemSet::print_summary_info() { + G1CollectedHeap* g1 = G1CollectedHeap::heap(); + ConcurrentG1RefineThread* cg1r_thrd = + g1->concurrent_g1_refine()->cg1rThread(); + +#if CARD_REPEAT_HISTO + gclog_or_tty->print_cr("\nG1 card_repeat count histogram: "); + gclog_or_tty->print_cr(" # of repeats --> # of cards with that number."); + card_repeat_count.print_on(gclog_or_tty); +#endif + + if (FILTEROUTOFREGIONCLOSURE_DOHISTOGRAMCOUNT) { + gclog_or_tty->print_cr("\nG1 rem-set out-of-region histogram: "); + gclog_or_tty->print_cr(" # of CS ptrs --> # of cards with that number."); + out_of_histo.print_on(gclog_or_tty); + } + gclog_or_tty->print_cr("\n Concurrent RS processed %d cards in " + "%5.2fs.", + _conc_refine_cards, cg1r_thrd->vtime_accum()); + + DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set(); + jint tot_processed_buffers = + dcqs.processed_buffers_mut() + dcqs.processed_buffers_rs_thread(); + gclog_or_tty->print_cr(" Of %d completed buffers:", tot_processed_buffers); + gclog_or_tty->print_cr(" %8d (%5.1f%%) by conc RS thread.", + dcqs.processed_buffers_rs_thread(), + 100.0*(float)dcqs.processed_buffers_rs_thread()/ + (float)tot_processed_buffers); + gclog_or_tty->print_cr(" %8d (%5.1f%%) by mutator threads.", + dcqs.processed_buffers_mut(), + 100.0*(float)dcqs.processed_buffers_mut()/ + (float)tot_processed_buffers); + gclog_or_tty->print_cr(" Did %d concurrent refinement traversals.", + _conc_refine_traversals); + if (!G1RSBarrierUseQueue) { + gclog_or_tty->print_cr(" Scanned %8.2f cards/traversal.", + _conc_refine_traversals > 0 ? + (float)_conc_refine_cards/(float)_conc_refine_traversals : + 0); + } + gclog_or_tty->print_cr(""); + if (G1UseHRIntoRS) { + HRRSStatsIter blk; + g1->heap_region_iterate(&blk); + gclog_or_tty->print_cr(" Total heap region rem set sizes = " SIZE_FORMAT "K." + " Max = " SIZE_FORMAT "K.", + blk.total_mem_sz()/K, blk.max_mem_sz()/K); + gclog_or_tty->print_cr(" Static structures = " SIZE_FORMAT "K," + " free_lists = " SIZE_FORMAT "K.", + HeapRegionRemSet::static_mem_size()/K, + HeapRegionRemSet::fl_mem_size()/K); + gclog_or_tty->print_cr(" %d occupied cards represented.", + blk.occupied()); + gclog_or_tty->print_cr(" Max sz region = [" PTR_FORMAT ", " PTR_FORMAT " )" + " %s, cap = " SIZE_FORMAT "K, occ = " SIZE_FORMAT "K.", + blk.max_mem_sz_region()->bottom(), blk.max_mem_sz_region()->end(), + (blk.max_mem_sz_region()->popular() ? "POP" : ""), + (blk.max_mem_sz_region()->rem_set()->mem_size() + K - 1)/K, + (blk.max_mem_sz_region()->rem_set()->occupied() + K - 1)/K); + gclog_or_tty->print_cr(" Did %d coarsenings.", + HeapRegionRemSet::n_coarsenings()); + + } +} +void HRInto_G1RemSet::prepare_for_verify() { + if (G1HRRSFlushLogBuffersOnVerify && VerifyBeforeGC && !_g1->full_collection()) { + cleanupHRRS(); + _g1->set_refine_cte_cl_concurrency(false); + if (SafepointSynchronize::is_at_safepoint()) { + DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set(); + dcqs.concatenate_logs(); + } + bool cg1r_use_cache = _cg1r->use_cache(); + _cg1r->set_use_cache(false); + updateRS(0); + _cg1r->set_use_cache(cg1r_use_cache); + } +} diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp new file mode 100644 index 00000000000..a07ba882a2c --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp @@ -0,0 +1,216 @@ +/* + * Copyright 2001-2007 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. + * + */ + +// A G1RemSet provides ways of iterating over pointers into a selected +// collection set. + +class G1CollectedHeap; +class CardTableModRefBarrierSet; +class HRInto_G1RemSet; +class ConcurrentG1Refine; + +class G1RemSet { +protected: + G1CollectedHeap* _g1; + + unsigned _conc_refine_traversals; + unsigned _conc_refine_cards; + + size_t n_workers(); + +public: + G1RemSet(G1CollectedHeap* g1) : + _g1(g1), _conc_refine_traversals(0), _conc_refine_cards(0) + {} + + // Invoke "blk->do_oop" on all pointers into the CS in object in regions + // outside the CS (having invoked "blk->set_region" to set the "from" + // region correctly beforehand.) The "worker_i" param is for the + // parallel case where the number of the worker thread calling this + // function can be helpful in partitioning the work to be done. It + // should be the same as the "i" passed to the calling thread's + // work(i) function. In the sequential case this param will be ingored. + virtual void oops_into_collection_set_do(OopsInHeapRegionClosure* blk, + int worker_i) = 0; + + // Prepare for and cleanup after an oops_into_collection_set_do + // call. Must call each of these once before and after (in sequential + // code) any threads call oops into collection set do. (This offers an + // opportunity to sequential setup and teardown of structures needed by a + // parallel iteration over the CS's RS.) + virtual void prepare_for_oops_into_collection_set_do() = 0; + virtual void cleanup_after_oops_into_collection_set_do() = 0; + + // If "this" is of the given subtype, return "this", else "NULL". + virtual HRInto_G1RemSet* as_HRInto_G1RemSet() { return NULL; } + + // Record, if necessary, the fact that *p (where "p" is in region "from") + // has changed to its new value. + virtual void write_ref(HeapRegion* from, oop* p) = 0; + virtual void par_write_ref(HeapRegion* from, oop* p, int tid) = 0; + + // Requires "region_bm" and "card_bm" to be bitmaps with 1 bit per region + // or card, respectively, such that a region or card with a corresponding + // 0 bit contains no part of any live object. Eliminates any remembered + // set entries that correspond to dead heap ranges. + virtual void scrub(BitMap* region_bm, BitMap* card_bm) = 0; + // Like the above, but assumes is called in parallel: "worker_num" is the + // parallel thread id of the current thread, and "claim_val" is the + // value that should be used to claim heap regions. + virtual void scrub_par(BitMap* region_bm, BitMap* card_bm, + int worker_num, int claim_val) = 0; + + // Do any "refinement" activity that might be appropriate to the given + // G1RemSet. If "refinement" has iterateive "passes", do one pass. + // If "t" is non-NULL, it is the thread performing the refinement. + // Default implementation does nothing. + virtual void concurrentRefinementPass(ConcurrentG1Refine* cg1r) {} + + // Refine the card corresponding to "card_ptr". If "sts" is non-NULL, + // join and leave around parts that must be atomic wrt GC. (NULL means + // being done at a safepoint.) + virtual void concurrentRefineOneCard(jbyte* card_ptr, int worker_i) {} + + unsigned conc_refine_cards() { return _conc_refine_cards; } + + // Print any relevant summary info. + virtual void print_summary_info() {} + + // Prepare remebered set for verification. + virtual void prepare_for_verify() {}; +}; + + +// The simplest possible G1RemSet: iterates over all objects in non-CS +// regions, searching for pointers into the CS. +class StupidG1RemSet: public G1RemSet { +public: + StupidG1RemSet(G1CollectedHeap* g1) : G1RemSet(g1) {} + + void oops_into_collection_set_do(OopsInHeapRegionClosure* blk, + int worker_i); + + void prepare_for_oops_into_collection_set_do() {} + void cleanup_after_oops_into_collection_set_do() {} + + // Nothing is necessary in the version below. + void write_ref(HeapRegion* from, oop* p) {} + void par_write_ref(HeapRegion* from, oop* p, int tid) {} + + void scrub(BitMap* region_bm, BitMap* card_bm) {} + void scrub_par(BitMap* region_bm, BitMap* card_bm, + int worker_num, int claim_val) {} + +}; + +// A G1RemSet in which each heap region has a rem set that records the +// external heap references into it. Uses a mod ref bs to track updates, +// so that they can be used to update the individual region remsets. + +class HRInto_G1RemSet: public G1RemSet { +protected: + enum SomePrivateConstants { + UpdateRStoMergeSync = 0, + MergeRStoDoDirtySync = 1, + DoDirtySync = 2, + LastSync = 3, + + SeqTask = 0, + NumSeqTasks = 1 + }; + + CardTableModRefBS* _ct_bs; + SubTasksDone* _seq_task; + G1CollectorPolicy* _g1p; + + ConcurrentG1Refine* _cg1r; + + size_t* _cards_scanned; + size_t _total_cards_scanned; + + // _par_traversal_in_progress is "true" iff a parallel traversal is in + // progress. If so, then cards added to remembered sets should also have + // their references into the collection summarized in "_new_refs". + bool _par_traversal_in_progress; + void set_par_traversal(bool b); + GrowableArray** _new_refs; + +public: + // This is called to reset dual hash tables after the gc pause + // is finished and the initial hash table is no longer being + // scanned. + void cleanupHRRS(); + + HRInto_G1RemSet(G1CollectedHeap* g1, CardTableModRefBS* ct_bs); + ~HRInto_G1RemSet(); + + void oops_into_collection_set_do(OopsInHeapRegionClosure* blk, + int worker_i); + + void prepare_for_oops_into_collection_set_do(); + void cleanup_after_oops_into_collection_set_do(); + void scanRS(OopsInHeapRegionClosure* oc, int worker_i); + void scanNewRefsRS(OopsInHeapRegionClosure* oc, int worker_i); + void updateRS(int worker_i); + HeapRegion* calculateStartRegion(int i); + + HRInto_G1RemSet* as_HRInto_G1RemSet() { return this; } + + CardTableModRefBS* ct_bs() { return _ct_bs; } + size_t cardsScanned() { return _total_cards_scanned; } + + // Record, if necessary, the fact that *p (where "p" is in region "from", + // which is required to be non-NULL) has changed to a new non-NULL value. + inline void write_ref(HeapRegion* from, oop* p); + // The "_nv" version is the same; it exists just so that it is not virtual. + inline void write_ref_nv(HeapRegion* from, oop* p); + + inline bool self_forwarded(oop obj); + inline void par_write_ref(HeapRegion* from, oop* p, int tid); + + void scrub(BitMap* region_bm, BitMap* card_bm); + void scrub_par(BitMap* region_bm, BitMap* card_bm, + int worker_num, int claim_val); + + virtual void concurrentRefinementPass(ConcurrentG1Refine* t); + virtual void concurrentRefineOneCard(jbyte* card_ptr, int worker_i); + + virtual void print_summary_info(); + virtual void prepare_for_verify(); +}; + +#define G1_REM_SET_LOGGING 0 + +class CountNonCleanMemRegionClosure: public MemRegionClosure { + G1CollectedHeap* _g1; + int _n; + HeapWord* _start_first; +public: + CountNonCleanMemRegionClosure(G1CollectedHeap* g1) : + _g1(g1), _n(0), _start_first(NULL) + {} + void do_MemRegion(MemRegion mr); + int n() { return _n; }; + HeapWord* start_first() { return _start_first; } +}; diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.inline.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.inline.hpp new file mode 100644 index 00000000000..e3f1b5cc81d --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.inline.hpp @@ -0,0 +1,104 @@ +/* + * Copyright 2001-2007 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. + * + */ + +inline size_t G1RemSet::n_workers() { + if (_g1->workers() != NULL) { + return _g1->workers()->total_workers(); + } else { + return 1; + } +} + +inline void HRInto_G1RemSet::write_ref_nv(HeapRegion* from, oop* p) { + oop obj = *p; + assert(from != NULL && from->is_in_reserved(p), + "p is not in a from"); + HeapRegion* to = _g1->heap_region_containing(obj); + if (from != to && to != NULL) { + if (!to->popular() && !from->is_survivor()) { +#if G1_REM_SET_LOGGING + gclog_or_tty->print_cr("Adding " PTR_FORMAT " (" PTR_FORMAT ") to RS" + " for region [" PTR_FORMAT ", " PTR_FORMAT ")", + p, obj, + to->bottom(), to->end()); +#endif + assert(to->rem_set() != NULL, "Need per-region 'into' remsets."); + if (to->rem_set()->add_reference(p)) { + _g1->schedule_popular_region_evac(to); + } + } + } +} + +inline void HRInto_G1RemSet::write_ref(HeapRegion* from, oop* p) { + write_ref_nv(from, p); +} + +inline bool HRInto_G1RemSet::self_forwarded(oop obj) { + bool result = (obj->is_forwarded() && (obj->forwardee()== obj)); + return result; +} + +inline void HRInto_G1RemSet::par_write_ref(HeapRegion* from, oop* p, int tid) { + oop obj = *p; +#ifdef ASSERT + // can't do because of races + // assert(obj == NULL || obj->is_oop(), "expected an oop"); + + // Do the safe subset of is_oop + if (obj != NULL) { +#ifdef CHECK_UNHANDLED_OOPS + oopDesc* o = obj.obj(); +#else + oopDesc* o = obj; +#endif // CHECK_UNHANDLED_OOPS + assert((intptr_t)o % MinObjAlignmentInBytes == 0, "not oop aligned"); + assert(Universe::heap()->is_in_reserved(obj), "must be in heap"); + } +#endif // ASSERT + assert(from == NULL || from->is_in_reserved(p), + "p is not in from"); + HeapRegion* to = _g1->heap_region_containing(obj); + // The test below could be optimized by applying a bit op to to and from. + if (to != NULL && from != NULL && from != to) { + if (!to->popular() && !from->is_survivor()) { +#if G1_REM_SET_LOGGING + gclog_or_tty->print_cr("Adding " PTR_FORMAT " (" PTR_FORMAT ") to RS" + " for region [" PTR_FORMAT ", " PTR_FORMAT ")", + p, obj, + to->bottom(), to->end()); +#endif + assert(to->rem_set() != NULL, "Need per-region 'into' remsets."); + if (to->rem_set()->add_reference(p, tid)) { + _g1->schedule_popular_region_evac(to); + } + } + // There is a tricky infinite loop if we keep pushing + // self forwarding pointers onto our _new_refs list. + if (_par_traversal_in_progress && + to->in_collection_set() && !self_forwarded(obj)) { + _new_refs[tid]->push(p); + } + } +} diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp new file mode 100644 index 00000000000..37414989eb9 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp @@ -0,0 +1,150 @@ +/* + * Copyright 2001-2007 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. + * + */ + +#include "incls/_precompiled.incl" +#include "incls/_g1SATBCardTableModRefBS.cpp.incl" + +G1SATBCardTableModRefBS::G1SATBCardTableModRefBS(MemRegion whole_heap, + int max_covered_regions) : + CardTableModRefBSForCTRS(whole_heap, max_covered_regions) +{ + _kind = G1SATBCT; +} + + +void G1SATBCardTableModRefBS::enqueue(oop pre_val) { + if (!JavaThread::satb_mark_queue_set().active()) return; + Thread* thr = Thread::current(); + if (thr->is_Java_thread()) { + JavaThread* jt = (JavaThread*)thr; + jt->satb_mark_queue().enqueue(pre_val); + } else { + MutexLocker x(Shared_SATB_Q_lock); + JavaThread::satb_mark_queue_set().shared_satb_queue()->enqueue(pre_val); + } +} + +// When we know the current java thread: +void +G1SATBCardTableModRefBS::write_ref_field_pre_static(void* field, + oop newVal, + JavaThread* jt) { + if (!JavaThread::satb_mark_queue_set().active()) return; + assert(!UseCompressedOops, "Else will need to modify this to deal with narrowOop"); + oop preVal = *(oop*)field; + if (preVal != NULL) { + jt->satb_mark_queue().enqueue(preVal); + } +} + +void +G1SATBCardTableModRefBS::write_ref_array_pre(MemRegion mr) { + if (!JavaThread::satb_mark_queue_set().active()) return; + assert(!UseCompressedOops, "Else will need to modify this to deal with narrowOop"); + oop* elem_ptr = (oop*)mr.start(); + while ((HeapWord*)elem_ptr < mr.end()) { + oop elem = *elem_ptr; + if (elem != NULL) enqueue(elem); + elem_ptr++; + } +} + + + +G1SATBCardTableLoggingModRefBS:: +G1SATBCardTableLoggingModRefBS(MemRegion whole_heap, + int max_covered_regions) : + G1SATBCardTableModRefBS(whole_heap, max_covered_regions), + _dcqs(JavaThread::dirty_card_queue_set()) +{ + _kind = G1SATBCTLogging; +} + +void +G1SATBCardTableLoggingModRefBS::write_ref_field_work(void* field, + oop new_val) { + jbyte* byte = byte_for(field); + if (*byte != dirty_card) { + *byte = dirty_card; + Thread* thr = Thread::current(); + if (thr->is_Java_thread()) { + JavaThread* jt = (JavaThread*)thr; + jt->dirty_card_queue().enqueue(byte); + } else { + MutexLockerEx x(Shared_DirtyCardQ_lock, + Mutex::_no_safepoint_check_flag); + _dcqs.shared_dirty_card_queue()->enqueue(byte); + } + } +} + +void +G1SATBCardTableLoggingModRefBS::write_ref_field_static(void* field, + oop new_val) { + uintptr_t field_uint = (uintptr_t)field; + uintptr_t new_val_uint = (uintptr_t)new_val; + uintptr_t comb = field_uint ^ new_val_uint; + comb = comb >> HeapRegion::LogOfHRGrainBytes; + if (comb == 0) return; + if (new_val == NULL) return; + // Otherwise, log it. + G1SATBCardTableLoggingModRefBS* g1_bs = + (G1SATBCardTableLoggingModRefBS*)Universe::heap()->barrier_set(); + g1_bs->write_ref_field_work(field, new_val); +} + +void +G1SATBCardTableLoggingModRefBS::invalidate(MemRegion mr, bool whole_heap) { + jbyte* byte = byte_for(mr.start()); + jbyte* last_byte = byte_for(mr.last()); + Thread* thr = Thread::current(); + if (whole_heap) { + while (byte <= last_byte) { + *byte = dirty_card; + byte++; + } + } else { + // Enqueue if necessary. + if (thr->is_Java_thread()) { + JavaThread* jt = (JavaThread*)thr; + while (byte <= last_byte) { + if (*byte != dirty_card) { + *byte = dirty_card; + jt->dirty_card_queue().enqueue(byte); + } + byte++; + } + } else { + MutexLockerEx x(Shared_DirtyCardQ_lock, + Mutex::_no_safepoint_check_flag); + while (byte <= last_byte) { + if (*byte != dirty_card) { + *byte = dirty_card; + _dcqs.shared_dirty_card_queue()->enqueue(byte); + } + byte++; + } + } + } +} diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp new file mode 100644 index 00000000000..86f8283d449 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp @@ -0,0 +1,107 @@ +/* + * Copyright 2001-2007 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. + * + */ + +#ifndef SERIALGC + +class DirtyCardQueueSet; + +// This barrier is specialized to use a logging barrier to support +// snapshot-at-the-beginning marking. + +class G1SATBCardTableModRefBS: public CardTableModRefBSForCTRS { +private: + // Add "pre_val" to a set of objects that may have been disconnected from the + // pre-marking object graph. + static void enqueue(oop pre_val); + +public: + G1SATBCardTableModRefBS(MemRegion whole_heap, + int max_covered_regions); + + bool is_a(BarrierSet::Name bsn) { + return bsn == BarrierSet::G1SATBCT || CardTableModRefBS::is_a(bsn); + } + + virtual bool has_write_ref_pre_barrier() { return true; } + + // This notes that we don't need to access any BarrierSet data + // structures, so this can be called from a static context. + static void write_ref_field_pre_static(void* field, oop newVal) { + assert(!UseCompressedOops, "Else needs to be templatized"); + oop preVal = *((oop*)field); + if (preVal != NULL) { + enqueue(preVal); + } + } + + // When we know the current java thread: + static void write_ref_field_pre_static(void* field, oop newVal, + JavaThread* jt); + + // We export this to make it available in cases where the static + // type of the barrier set is known. Note that it is non-virtual. + inline void inline_write_ref_field_pre(void* field, oop newVal) { + write_ref_field_pre_static(field, newVal); + } + + // This is the more general virtual version. + void write_ref_field_pre_work(void* field, oop new_val) { + inline_write_ref_field_pre(field, new_val); + } + + virtual void write_ref_array_pre(MemRegion mr); + +}; + +// Adds card-table logging to the post-barrier. +// Usual invariant: all dirty cards are logged in the DirtyCardQueueSet. +class G1SATBCardTableLoggingModRefBS: public G1SATBCardTableModRefBS { + private: + DirtyCardQueueSet& _dcqs; + public: + G1SATBCardTableLoggingModRefBS(MemRegion whole_heap, + int max_covered_regions); + + bool is_a(BarrierSet::Name bsn) { + return bsn == BarrierSet::G1SATBCTLogging || + G1SATBCardTableModRefBS::is_a(bsn); + } + + void write_ref_field_work(void* field, oop new_val); + + // Can be called from static contexts. + static void write_ref_field_static(void* field, oop new_val); + + // NB: if you do a whole-heap invalidation, the "usual invariant" defined + // above no longer applies. + void invalidate(MemRegion mr, bool whole_heap = false); + + void write_region_work(MemRegion mr) { invalidate(mr); } + void write_ref_array_work(MemRegion mr) { invalidate(mr); } + + +}; + + +#endif // SERIALGC diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.cpp new file mode 100644 index 00000000000..14dfe800bec --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.cpp @@ -0,0 +1,31 @@ +/* + * Copyright 2001-2007 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. + * + */ + +#include "incls/_precompiled.incl" +#include "incls/_g1_globals.cpp.incl" + +G1_FLAGS(MATERIALIZE_DEVELOPER_FLAG, MATERIALIZE_PD_DEVELOPER_FLAG, \ + MATERIALIZE_PRODUCT_FLAG, MATERIALIZE_PD_PRODUCT_FLAG, \ + MATERIALIZE_DIAGNOSTIC_FLAG, MATERIALIZE_NOTPRODUCT_FLAG, \ + MATERIALIZE_MANAGEABLE_FLAG, MATERIALIZE_PRODUCT_RW_FLAG) diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp new file mode 100644 index 00000000000..d1b81c2f22c --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp @@ -0,0 +1,287 @@ +/* + * Copyright 2001-2007 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. + * + */ + +// +// Defines all globals flags used by the garbage-first compiler. +// + +#define G1_FLAGS(develop, develop_pd, product, product_pd, diagnostic, notproduct, manageable, product_rw) \ + \ + product(intx, ParallelGCG1AllocBufferSize, 4*K, \ + "Size of parallel G1 allocation buffers in to-space.") \ + \ + product(intx, G1TimeSliceMS, 500, \ + "Time slice for MMU specification") \ + \ + product(intx, G1MaxPauseTimeMS, 200, \ + "Max GC time per MMU time slice") \ + \ + product(intx, G1ConfidencePerc, 50, \ + "Confidence level for MMU/pause predictions") \ + \ + product(intx, G1MarkingOverheadPerc, 0, \ + "Overhead of concurrent marking") \ + \ + product(bool, G1AccountConcurrentOverhead, false, \ + "Whether soft real-time compliance in G1 will take into account" \ + "concurrent overhead") \ + \ + product(intx, G1YoungGenSize, 0, \ + "Size of the G1 young generation, 0 is the adaptive policy") \ + \ + product(bool, G1Gen, true, \ + "If true, it will enable the generational G1") \ + \ + develop(intx, G1GCPct, 10, \ + "The desired percent time spent on GC") \ + \ + product(intx, G1PolicyVerbose, 0, \ + "The verbosity level on G1 policy decisions") \ + \ + develop(bool, G1UseHRIntoRS, true, \ + "Determines whether the 'advanced' HR Into rem set is used.") \ + \ + product(bool, G1VerifyRemSet, false, \ + "If true, verify the rem set functioning at each GC") \ + \ + product(bool, G1VerifyConcMark, false, \ + "If true, verify the conc marking code at full GC time") \ + \ + develop(intx, G1MarkingVerboseLevel, 0, \ + "Level (0-4) of verboseness of the marking code") \ + \ + develop(bool, G1VerifyConcMarkPrintReachable, true, \ + "If conc mark verification fails, print reachable objects") \ + \ + develop(bool, G1TraceMarkStackOverflow, false, \ + "If true, extra debugging code for CM restart for ovflw.") \ + \ + product(bool, G1VerifyMarkingInEvac, false, \ + "If true, verify marking info during evacuation") \ + \ + develop(intx, G1PausesBtwnConcMark, -1, \ + "If positive, fixed number of pauses between conc markings") \ + \ + product(intx, G1EfficiencyPctCausesMark, 80, \ + "The cum gc efficiency since mark fall-off that causes " \ + "new marking") \ + \ + product(bool, TraceConcurrentMark, false, \ + "Trace concurrent mark") \ + \ + product(bool, SummarizeG1ConcMark, false, \ + "Summarize concurrent mark info") \ + \ + product(bool, SummarizeG1RSStats, false, \ + "Summarize remembered set processing info") \ + \ + product(bool, SummarizeG1ZFStats, false, \ + "Summarize zero-filling info") \ + \ + product(bool, TraceG1Refine, false, \ + "Trace G1 concurrent refinement") \ + \ + develop(bool, G1ConcMark, true, \ + "If true, run concurrent marking for G1") \ + \ + product(intx, G1CMStackSize, 2 * 1024 * 1024, \ + "Size of the mark stack for concurrent marking.") \ + \ + product(intx, G1CMRegionStackSize, 1024 * 1024, \ + "Size of the region stack for concurrent marking.") \ + \ + develop(bool, G1ConcRefine, true, \ + "If true, run concurrent rem set refinement for G1") \ + \ + develop(intx, G1ConcRefineTargTraversals, 4, \ + "Number of concurrent refinement we try to achieve") \ + \ + develop(intx, G1ConcRefineInitialDelta, 4, \ + "Number of heap regions of alloc ahead of starting collection " \ + "pause to start concurrent refinement (initially)") \ + \ + product(bool, G1SmoothConcRefine, true, \ + "Attempts to smooth out the overhead of concurrent refinement") \ + \ + develop(bool, G1ConcZeroFill, true, \ + "If true, run concurrent zero-filling thread") \ + \ + develop(intx, G1ConcZFMaxRegions, 1, \ + "Stop zero-filling when # of zf'd regions reaches") \ + \ + product(intx, G1SteadyStateUsed, 90, \ + "If non-0, try to maintain 'used' at this pct (of max)") \ + \ + product(intx, G1SteadyStateUsedDelta, 30, \ + "If G1SteadyStateUsed is non-0, then do pause this number of " \ + "of percentage points earlier if no marking is in progress.") \ + \ + develop(bool, G1SATBBarrierPrintNullPreVals, false, \ + "If true, count frac of ptr writes with null pre-vals.") \ + \ + product(intx, G1SATBLogBufferSize, 1*K, \ + "Number of entries in an SATB log buffer.") \ + \ + product(intx, G1SATBProcessCompletedThreshold, 20, \ + "Number of completed buffers that triggers log processing.") \ + \ + develop(intx, G1ExtraRegionSurvRate, 33, \ + "If the young survival rate is S, and there's room left in " \ + "to-space, we will allow regions whose survival rate is up to " \ + "S + (1 - S)*X, where X is this parameter (as a fraction.)") \ + \ + develop(intx, G1InitYoungSurvRatio, 50, \ + "Expected Survival Rate for newly allocated bytes") \ + \ + develop(bool, G1SATBPrintStubs, false, \ + "If true, print generated stubs for the SATB barrier") \ + \ + product(intx, G1ExpandByPctOfAvail, 20, \ + "When expanding, % of uncommitted space to claim.") \ + \ + develop(bool, G1RSBarrierRegionFilter, true, \ + "If true, generate region filtering code in RS barrier") \ + \ + develop(bool, G1RSBarrierNullFilter, true, \ + "If true, generate null-pointer filtering code in RS barrier") \ + \ + develop(bool, G1PrintCTFilterStats, false, \ + "If true, print stats on RS filtering effectiveness") \ + \ + develop(bool, G1RSBarrierUseQueue, true, \ + "If true, use queueing RS barrier") \ + \ + develop(bool, G1RSLogCheckCardTable, false, \ + "If true, verify that no dirty cards remain after RS log " \ + "processing.") \ + \ + product(intx, G1MinPausesBetweenMarks, 2, \ + "Number of inefficient pauses necessary to trigger marking.") \ + \ + product(intx, G1InefficientPausePct, 80, \ + "Threshold of an 'inefficient' pauses (as % of cum efficiency.") \ + \ + product(intx, G1RSPopLimit, 32768, \ + "Limit that defines popularity. Should go away! XXX") \ + \ + develop(bool, G1RSCountHisto, false, \ + "If true, print a histogram of RS occupancies after each pause") \ + \ + product(intx, G1ObjPopLimit, 256, \ + "Limit that defines popularity for an object.") \ + \ + product(bool, G1TraceFileOverwrite, false, \ + "Allow the trace file to be overwritten") \ + \ + develop(intx, G1PrintRegionLivenessInfo, 0, \ + "When > 0, print the occupancies of the best and worst" \ + "regions.") \ + \ + develop(bool, G1TracePopularity, false, \ + "When true, provide detailed tracing of popularity.") \ + \ + product(bool, G1SummarizePopularity, false, \ + "When true, provide end-of-run-summarization of popularity.") \ + \ + product(intx, G1NumPopularRegions, 1, \ + "Number of regions reserved to hold popular objects. " \ + "Should go away later.") \ + \ + develop(bool, G1PrintParCleanupStats, false, \ + "When true, print extra stats about parallel cleanup.") \ + \ + product(bool, G1DoAgeCohortChecks, false, \ + "When true, check well-formedness of age cohort structures.") \ + \ + develop(bool, G1DisablePreBarrier, false, \ + "Disable generation of pre-barrier (i.e., marking barrier) ") \ + \ + develop(bool, G1DisablePostBarrier, false, \ + "Disable generation of post-barrier (i.e., RS barrier) ") \ + \ + product(intx, G1DirtyCardQueueMax, 30, \ + "Maximum number of completed RS buffers before mutator threads " \ + "start processing them.") \ + \ + develop(intx, G1ConcRSLogCacheSize, 10, \ + "Log base 2 of the length of conc RS hot-card cache.") \ + \ + product(bool, G1ConcRSCountTraversals, false, \ + "If true, gather data about the number of times CR traverses " \ + "cards ") \ + \ + product(intx, G1ConcRSHotCardLimit, 4, \ + "The threshold that defines (>=) a hot card.") \ + \ + develop(bool, G1PrintOopAppls, false, \ + "When true, print applications of closures to external locs.") \ + \ + product(intx, G1LogRSRegionEntries, 7, \ + "Log_2 of max number of regions for which we keep bitmaps.") \ + \ + develop(bool, G1RecordHRRSOops, false, \ + "When true, record recent calls to rem set operations.") \ + \ + develop(bool, G1RecordHRRSEvents, false, \ + "When true, record recent calls to rem set operations.") \ + \ + develop(intx, G1MaxVerifyFailures, -1, \ + "The maximum number of verification failrues to print. " \ + "-1 means print all.") \ + \ + develop(bool, G1ScrubRemSets, true, \ + "When true, do RS scrubbing after cleanup.") \ + \ + develop(bool, G1RSScrubVerbose, false, \ + "When true, do RS scrubbing with verbose output.") \ + \ + develop(bool, G1YoungSurvRateVerbose, false, \ + "print out the survival rate of young regions according to age.") \ + \ + develop(intx, G1YoungSurvRateNumRegionsSummary, 0, \ + "the number of regions for which we'll print a surv rate " \ + "summary.") \ + \ + product(bool, G1UseScanOnlyPrefix, false, \ + "It determines whether the system will calculate an optimum " \ + "scan-only set.") \ + \ + product(intx, G1MinReservePerc, 10, \ + "It determines the minimum reserve we should have in the heap " \ + "to minimize the probability of promotion failure.") \ + \ + product(bool, G1TraceRegions, false, \ + "If set G1 will print information on which regions are being " \ + "allocated and which are reclaimed.") \ + \ + develop(bool, G1HRRSUseSparseTable, true, \ + "When true, use sparse table to save space.") \ + \ + develop(bool, G1HRRSFlushLogBuffersOnVerify, false, \ + "Forces flushing of log buffers before verification.") \ + \ + product(intx, G1MaxSurvivorRegions, 0, \ + "The maximum number of survivor regions") + +G1_FLAGS(DECLARE_DEVELOPER_FLAG, DECLARE_PD_DEVELOPER_FLAG, DECLARE_PRODUCT_FLAG, DECLARE_PD_PRODUCT_FLAG, DECLARE_DIAGNOSTIC_FLAG, DECLARE_NOTPRODUCT_FLAG, DECLARE_MANAGEABLE_FLAG, DECLARE_PRODUCT_RW_FLAG) diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1_specialized_oop_closures.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1_specialized_oop_closures.hpp new file mode 100644 index 00000000000..39f72a616b7 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/g1_specialized_oop_closures.hpp @@ -0,0 +1,64 @@ +/* + * Copyright 2001-2007 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. + * + */ + +// The following OopClosure types get specialized versions of +// "oop_oop_iterate" that invoke the closures' do_oop methods +// non-virtually, using a mechanism defined in this file. Extend these +// macros in the obvious way to add specializations for new closures. + +// Forward declarations. +enum G1Barrier { + G1BarrierNone, G1BarrierRS, G1BarrierEvac +}; + +template +class G1ParCopyClosure; +class G1ParScanClosure; + +typedef G1ParCopyClosure G1ParScanHeapEvacClosure; + +class FilterIntoCSClosure; +class FilterOutOfRegionClosure; +class FilterInHeapRegionAndIntoCSClosure; +class FilterAndMarkInHeapRegionAndIntoCSClosure; +class G1ScanAndBalanceClosure; + +#ifdef FURTHER_SPECIALIZED_OOP_OOP_ITERATE_CLOSURES +#error "FURTHER_SPECIALIZED_OOP_OOP_ITERATE_CLOSURES already defined." +#endif + +#define FURTHER_SPECIALIZED_OOP_OOP_ITERATE_CLOSURES(f) \ + f(G1ParScanHeapEvacClosure,_nv) \ + f(G1ParScanClosure,_nv) \ + f(FilterIntoCSClosure,_nv) \ + f(FilterOutOfRegionClosure,_nv) \ + f(FilterInHeapRegionAndIntoCSClosure,_nv) \ + f(FilterAndMarkInHeapRegionAndIntoCSClosure,_nv) \ + f(G1ScanAndBalanceClosure,_nv) + +#ifdef FURTHER_SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES +#error "FURTHER_SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES already defined." +#endif + +#define FURTHER_SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(f) diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp new file mode 100644 index 00000000000..05435f54c14 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp @@ -0,0 +1,874 @@ +/* + * Copyright 2001-2007 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. + * + */ + +#include "incls/_precompiled.incl" +#include "incls/_heapRegion.cpp.incl" + +HeapRegionDCTOC::HeapRegionDCTOC(G1CollectedHeap* g1, + HeapRegion* hr, OopClosure* cl, + CardTableModRefBS::PrecisionStyle precision, + FilterKind fk) : + ContiguousSpaceDCTOC(hr, cl, precision, NULL), + _hr(hr), _fk(fk), _g1(g1) +{} + +FilterOutOfRegionClosure::FilterOutOfRegionClosure(HeapRegion* r, + OopClosure* oc) : + _r_bottom(r->bottom()), _r_end(r->end()), + _oc(oc), _out_of_region(0) +{} + +class VerifyLiveClosure: public OopClosure { + G1CollectedHeap* _g1h; + CardTableModRefBS* _bs; + oop _containing_obj; + bool _failures; + int _n_failures; +public: + VerifyLiveClosure(G1CollectedHeap* g1h) : + _g1h(g1h), _bs(NULL), _containing_obj(NULL), + _failures(false), _n_failures(0) + { + BarrierSet* bs = _g1h->barrier_set(); + if (bs->is_a(BarrierSet::CardTableModRef)) + _bs = (CardTableModRefBS*)bs; + } + + void set_containing_obj(oop obj) { + _containing_obj = obj; + } + + bool failures() { return _failures; } + int n_failures() { return _n_failures; } + + virtual void do_oop(narrowOop* p) { + guarantee(false, "NYI"); + } + + void do_oop(oop* p) { + assert(_containing_obj != NULL, "Precondition"); + assert(!_g1h->is_obj_dead(_containing_obj), "Precondition"); + oop obj = *p; + if (obj != NULL) { + bool failed = false; + if (!_g1h->is_in_closed_subset(obj) || _g1h->is_obj_dead(obj)) { + if (!_failures) { + gclog_or_tty->print_cr(""); + gclog_or_tty->print_cr("----------"); + } + if (!_g1h->is_in_closed_subset(obj)) { + gclog_or_tty->print_cr("Field "PTR_FORMAT + " of live obj "PTR_FORMAT + " points to obj "PTR_FORMAT + " not in the heap.", + p, (void*) _containing_obj, (void*) obj); + } else { + gclog_or_tty->print_cr("Field "PTR_FORMAT + " of live obj "PTR_FORMAT + " points to dead obj "PTR_FORMAT".", + p, (void*) _containing_obj, (void*) obj); + } + gclog_or_tty->print_cr("Live obj:"); + _containing_obj->print_on(gclog_or_tty); + gclog_or_tty->print_cr("Bad referent:"); + obj->print_on(gclog_or_tty); + gclog_or_tty->print_cr("----------"); + _failures = true; + failed = true; + _n_failures++; + } + + if (!_g1h->full_collection()) { + HeapRegion* from = _g1h->heap_region_containing(p); + HeapRegion* to = _g1h->heap_region_containing(*p); + if (from != NULL && to != NULL && + from != to && + !to->popular() && + !to->isHumongous()) { + jbyte cv_obj = *_bs->byte_for_const(_containing_obj); + jbyte cv_field = *_bs->byte_for_const(p); + const jbyte dirty = CardTableModRefBS::dirty_card_val(); + + bool is_bad = !(from->is_young() + || to->rem_set()->contains_reference(p) + || !G1HRRSFlushLogBuffersOnVerify && // buffers were not flushed + (_containing_obj->is_objArray() ? + cv_field == dirty + : cv_obj == dirty || cv_field == dirty)); + if (is_bad) { + if (!_failures) { + gclog_or_tty->print_cr(""); + gclog_or_tty->print_cr("----------"); + } + gclog_or_tty->print_cr("Missing rem set entry:"); + gclog_or_tty->print_cr("Field "PTR_FORMAT + " of obj "PTR_FORMAT + ", in region %d ["PTR_FORMAT + ", "PTR_FORMAT"),", + p, (void*) _containing_obj, + from->hrs_index(), + from->bottom(), + from->end()); + _containing_obj->print_on(gclog_or_tty); + gclog_or_tty->print_cr("points to obj "PTR_FORMAT + " in region %d ["PTR_FORMAT + ", "PTR_FORMAT").", + (void*) obj, to->hrs_index(), + to->bottom(), to->end()); + obj->print_on(gclog_or_tty); + gclog_or_tty->print_cr("Obj head CTE = %d, field CTE = %d.", + cv_obj, cv_field); + gclog_or_tty->print_cr("----------"); + _failures = true; + if (!failed) _n_failures++; + } + } + } + } + } +}; + +template +HeapWord* walk_mem_region_loop(ClosureType* cl, G1CollectedHeap* g1h, + HeapRegion* hr, + HeapWord* cur, HeapWord* top) { + oop cur_oop = oop(cur); + int oop_size = cur_oop->size(); + HeapWord* next_obj = cur + oop_size; + while (next_obj < top) { + // Keep filtering the remembered set. + if (!g1h->is_obj_dead(cur_oop, hr)) { + // Bottom lies entirely below top, so we can call the + // non-memRegion version of oop_iterate below. +#ifndef PRODUCT + if (G1VerifyMarkingInEvac) { + VerifyLiveClosure vl_cl(g1h); + cur_oop->oop_iterate(&vl_cl); + } +#endif + cur_oop->oop_iterate(cl); + } + cur = next_obj; + cur_oop = oop(cur); + oop_size = cur_oop->size(); + next_obj = cur + oop_size; + } + return cur; +} + +void HeapRegionDCTOC::walk_mem_region_with_cl(MemRegion mr, + HeapWord* bottom, + HeapWord* top, + OopClosure* cl) { + G1CollectedHeap* g1h = _g1; + + int oop_size; + + OopClosure* cl2 = cl; + FilterIntoCSClosure intoCSFilt(this, g1h, cl); + FilterOutOfRegionClosure outOfRegionFilt(_hr, cl); + switch (_fk) { + case IntoCSFilterKind: cl2 = &intoCSFilt; break; + case OutOfRegionFilterKind: cl2 = &outOfRegionFilt; break; + } + + // Start filtering what we add to the remembered set. If the object is + // not considered dead, either because it is marked (in the mark bitmap) + // or it was allocated after marking finished, then we add it. Otherwise + // we can safely ignore the object. + if (!g1h->is_obj_dead(oop(bottom), _hr)) { +#ifndef PRODUCT + if (G1VerifyMarkingInEvac) { + VerifyLiveClosure vl_cl(g1h); + oop(bottom)->oop_iterate(&vl_cl, mr); + } +#endif + oop_size = oop(bottom)->oop_iterate(cl2, mr); + } else { + oop_size = oop(bottom)->size(); + } + + bottom += oop_size; + + if (bottom < top) { + // We replicate the loop below for several kinds of possible filters. + switch (_fk) { + case NoFilterKind: + bottom = walk_mem_region_loop(cl, g1h, _hr, bottom, top); + break; + case IntoCSFilterKind: { + FilterIntoCSClosure filt(this, g1h, cl); + bottom = walk_mem_region_loop(&filt, g1h, _hr, bottom, top); + break; + } + case OutOfRegionFilterKind: { + FilterOutOfRegionClosure filt(_hr, cl); + bottom = walk_mem_region_loop(&filt, g1h, _hr, bottom, top); + break; + } + default: + ShouldNotReachHere(); + } + + // Last object. Need to do dead-obj filtering here too. + if (!g1h->is_obj_dead(oop(bottom), _hr)) { +#ifndef PRODUCT + if (G1VerifyMarkingInEvac) { + VerifyLiveClosure vl_cl(g1h); + oop(bottom)->oop_iterate(&vl_cl, mr); + } +#endif + oop(bottom)->oop_iterate(cl2, mr); + } + } +} + +void HeapRegion::reset_after_compaction() { + G1OffsetTableContigSpace::reset_after_compaction(); + // After a compaction the mark bitmap is invalid, so we must + // treat all objects as being inside the unmarked area. + zero_marked_bytes(); + init_top_at_mark_start(); +} + + + +DirtyCardToOopClosure* +HeapRegion::new_dcto_closure(OopClosure* cl, + CardTableModRefBS::PrecisionStyle precision, + HeapRegionDCTOC::FilterKind fk) { + return new HeapRegionDCTOC(G1CollectedHeap::heap(), + this, cl, precision, fk); +} + +void HeapRegion::hr_clear(bool par, bool clear_space) { + _humongous = false; + _humongous_start = false; + _humongous_start_region = NULL; + _in_collection_set = false; + _is_gc_alloc_region = false; + + // Age stuff (if parallel, this will be done separately, since it needs + // to be sequential). + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + + set_young_index_in_cset(-1); + uninstall_surv_rate_group(); + set_young_type(NotYoung); + + // In case it had been the start of a humongous sequence, reset its end. + set_end(_orig_end); + + if (!par) { + // If this is parallel, this will be done later. + HeapRegionRemSet* hrrs = rem_set(); + if (hrrs != NULL) hrrs->clear(); + _claimed = 0; + } + zero_marked_bytes(); + set_sort_index(-1); + if ((uintptr_t)bottom() >= (uintptr_t)g1h->popular_object_boundary()) + set_popular(false); + + _offsets.resize(HeapRegion::GrainWords); + init_top_at_mark_start(); + if (clear_space) clear(); +} + +// +void HeapRegion::calc_gc_efficiency() { + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + _gc_efficiency = (double) garbage_bytes() / + g1h->predict_region_elapsed_time_ms(this, false); +} +// + +void HeapRegion::set_startsHumongous() { + _humongous_start = true; _humongous = true; + _humongous_start_region = this; + assert(end() == _orig_end, "Should be normal before alloc."); +} + +bool HeapRegion::claimHeapRegion(jint claimValue) { + jint current = _claimed; + if (current != claimValue) { + jint res = Atomic::cmpxchg(claimValue, &_claimed, current); + if (res == current) { + return true; + } + } + return false; +} + +HeapWord* HeapRegion::next_block_start_careful(HeapWord* addr) { + HeapWord* low = addr; + HeapWord* high = end(); + while (low < high) { + size_t diff = pointer_delta(high, low); + // Must add one below to bias toward the high amount. Otherwise, if + // "high" were at the desired value, and "low" were one less, we + // would not converge on "high". This is not symmetric, because + // we set "high" to a block start, which might be the right one, + // which we don't do for "low". + HeapWord* middle = low + (diff+1)/2; + if (middle == high) return high; + HeapWord* mid_bs = block_start_careful(middle); + if (mid_bs < addr) { + low = middle; + } else { + high = mid_bs; + } + } + assert(low == high && low >= addr, "Didn't work."); + return low; +} + +void HeapRegion::set_next_on_unclean_list(HeapRegion* r) { + assert(r == NULL || r->is_on_unclean_list(), "Malformed unclean list."); + _next_in_special_set = r; +} + +void HeapRegion::set_on_unclean_list(bool b) { + _is_on_unclean_list = b; +} + +void HeapRegion::initialize(MemRegion mr, bool clear_space) { + G1OffsetTableContigSpace::initialize(mr, false); + hr_clear(false/*par*/, clear_space); +} +#ifdef _MSC_VER // the use of 'this' below gets a warning, make it go away +#pragma warning( disable:4355 ) // 'this' : used in base member initializer list +#endif // _MSC_VER + + +HeapRegion:: +HeapRegion(G1BlockOffsetSharedArray* sharedOffsetArray, + MemRegion mr, bool is_zeroed) + : G1OffsetTableContigSpace(sharedOffsetArray, mr, is_zeroed), + _next_fk(HeapRegionDCTOC::NoFilterKind), + _hrs_index(-1), + _humongous(false), _humongous_start(false), _humongous_start_region(NULL), + _in_collection_set(false), _is_gc_alloc_region(false), + _is_on_free_list(false), _is_on_unclean_list(false), + _next_in_special_set(NULL), _orig_end(NULL), + _claimed(0), _evacuation_failed(false), + _prev_marked_bytes(0), _next_marked_bytes(0), _sort_index(-1), + _popularity(NotPopular), + _young_type(NotYoung), _next_young_region(NULL), + _young_index_in_cset(-1), _surv_rate_group(NULL), _age_index(-1), + _rem_set(NULL), _zfs(NotZeroFilled) +{ + _orig_end = mr.end(); + // Note that initialize() will set the start of the unmarked area of the + // region. + this->initialize(mr, !is_zeroed); + + _rem_set = new HeapRegionRemSet(sharedOffsetArray, this); + + assert(HeapRegionRemSet::num_par_rem_sets() > 0, "Invariant."); + // In case the region is allocated during a pause, note the top. + // We haven't done any counting on a brand new region. + _top_at_conc_mark_count = bottom(); +} + +class NextCompactionHeapRegionClosure: public HeapRegionClosure { + const HeapRegion* _target; + bool _target_seen; + HeapRegion* _last; + CompactibleSpace* _res; +public: + NextCompactionHeapRegionClosure(const HeapRegion* target) : + _target(target), _target_seen(false), _res(NULL) {} + bool doHeapRegion(HeapRegion* cur) { + if (_target_seen) { + if (!cur->isHumongous()) { + _res = cur; + return true; + } + } else if (cur == _target) { + _target_seen = true; + } + return false; + } + CompactibleSpace* result() { return _res; } +}; + +CompactibleSpace* HeapRegion::next_compaction_space() const { + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + // cast away const-ness + HeapRegion* r = (HeapRegion*) this; + NextCompactionHeapRegionClosure blk(r); + g1h->heap_region_iterate_from(r, &blk); + return blk.result(); +} + +void HeapRegion::set_continuesHumongous(HeapRegion* start) { + // The order is important here. + start->add_continuingHumongousRegion(this); + _humongous = true; _humongous_start = false; + _humongous_start_region = start; +} + +void HeapRegion::add_continuingHumongousRegion(HeapRegion* cont) { + // Must join the blocks of the current H region seq with the block of the + // added region. + offsets()->join_blocks(bottom(), cont->bottom()); + arrayOop obj = (arrayOop)(bottom()); + obj->set_length((int) (obj->length() + cont->capacity()/jintSize)); + set_end(cont->end()); + set_top(cont->end()); +} + +void HeapRegion::save_marks() { + set_saved_mark(); +} + +void HeapRegion::oops_in_mr_iterate(MemRegion mr, OopClosure* cl) { + HeapWord* p = mr.start(); + HeapWord* e = mr.end(); + oop obj; + while (p < e) { + obj = oop(p); + p += obj->oop_iterate(cl); + } + assert(p == e, "bad memregion: doesn't end on obj boundary"); +} + +#define HeapRegion_OOP_SINCE_SAVE_MARKS_DEFN(OopClosureType, nv_suffix) \ +void HeapRegion::oop_since_save_marks_iterate##nv_suffix(OopClosureType* cl) { \ + ContiguousSpace::oop_since_save_marks_iterate##nv_suffix(cl); \ +} +SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(HeapRegion_OOP_SINCE_SAVE_MARKS_DEFN) + + +void HeapRegion::oop_before_save_marks_iterate(OopClosure* cl) { + oops_in_mr_iterate(MemRegion(bottom(), saved_mark_word()), cl); +} + +#ifdef DEBUG +HeapWord* HeapRegion::allocate(size_t size) { + jint state = zero_fill_state(); + assert(!G1CollectedHeap::heap()->allocs_are_zero_filled() || + zero_fill_is_allocated(), + "When ZF is on, only alloc in ZF'd regions"); + return G1OffsetTableContigSpace::allocate(size); +} +#endif + +void HeapRegion::set_zero_fill_state_work(ZeroFillState zfs) { + assert(top() == bottom() || zfs == Allocated, + "Region must be empty, or we must be setting it to allocated."); + assert(ZF_mon->owned_by_self() || + Universe::heap()->is_gc_active(), + "Must hold the lock or be a full GC to modify."); + _zfs = zfs; +} + +void HeapRegion::set_zero_fill_complete() { + set_zero_fill_state_work(ZeroFilled); + if (ZF_mon->owned_by_self()) { + ZF_mon->notify_all(); + } +} + + +void HeapRegion::ensure_zero_filled() { + MutexLockerEx x(ZF_mon, Mutex::_no_safepoint_check_flag); + ensure_zero_filled_locked(); +} + +void HeapRegion::ensure_zero_filled_locked() { + assert(ZF_mon->owned_by_self(), "Precondition"); + bool should_ignore_zf = SafepointSynchronize::is_at_safepoint(); + assert(should_ignore_zf || Heap_lock->is_locked(), + "Either we're in a GC or we're allocating a region."); + switch (zero_fill_state()) { + case HeapRegion::NotZeroFilled: + set_zero_fill_in_progress(Thread::current()); + { + ZF_mon->unlock(); + Copy::fill_to_words(bottom(), capacity()/HeapWordSize); + ZF_mon->lock_without_safepoint_check(); + } + // A trap. + guarantee(zero_fill_state() == HeapRegion::ZeroFilling + && zero_filler() == Thread::current(), + "AHA! Tell Dave D if you see this..."); + set_zero_fill_complete(); + // gclog_or_tty->print_cr("Did sync ZF."); + ConcurrentZFThread::note_sync_zfs(); + break; + case HeapRegion::ZeroFilling: + if (should_ignore_zf) { + // We can "break" the lock and take over the work. + Copy::fill_to_words(bottom(), capacity()/HeapWordSize); + set_zero_fill_complete(); + ConcurrentZFThread::note_sync_zfs(); + break; + } else { + ConcurrentZFThread::wait_for_ZF_completed(this); + } + case HeapRegion::ZeroFilled: + // Nothing to do. + break; + case HeapRegion::Allocated: + guarantee(false, "Should not call on allocated regions."); + } + assert(zero_fill_state() == HeapRegion::ZeroFilled, "Post"); +} + +HeapWord* +HeapRegion::object_iterate_mem_careful(MemRegion mr, + ObjectClosure* cl) { + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + // We used to use "block_start_careful" here. But we're actually happy + // to update the BOT while we do this... + HeapWord* cur = block_start(mr.start()); + mr = mr.intersection(used_region()); + if (mr.is_empty()) return NULL; + // Otherwise, find the obj that extends onto mr.start(). + + assert(cur <= mr.start() + && (oop(cur)->klass() == NULL || + cur + oop(cur)->size() > mr.start()), + "postcondition of block_start"); + oop obj; + while (cur < mr.end()) { + obj = oop(cur); + if (obj->klass() == NULL) { + // Ran into an unparseable point. + return cur; + } else if (!g1h->is_obj_dead(obj)) { + cl->do_object(obj); + } + if (cl->abort()) return cur; + // The check above must occur before the operation below, since an + // abort might invalidate the "size" operation. + cur += obj->size(); + } + return NULL; +} + +HeapWord* +HeapRegion:: +oops_on_card_seq_iterate_careful(MemRegion mr, + FilterOutOfRegionClosure* cl) { + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + + // If we're within a stop-world GC, then we might look at a card in a + // GC alloc region that extends onto a GC LAB, which may not be + // parseable. Stop such at the "saved_mark" of the region. + if (G1CollectedHeap::heap()->is_gc_active()) { + mr = mr.intersection(used_region_at_save_marks()); + } else { + mr = mr.intersection(used_region()); + } + if (mr.is_empty()) return NULL; + // Otherwise, find the obj that extends onto mr.start(). + + // We used to use "block_start_careful" here. But we're actually happy + // to update the BOT while we do this... + HeapWord* cur = block_start(mr.start()); + assert(cur <= mr.start(), "Postcondition"); + + while (cur <= mr.start()) { + if (oop(cur)->klass() == NULL) { + // Ran into an unparseable point. + return cur; + } + // Otherwise... + int sz = oop(cur)->size(); + if (cur + sz > mr.start()) break; + // Otherwise, go on. + cur = cur + sz; + } + oop obj; + obj = oop(cur); + // If we finish this loop... + assert(cur <= mr.start() + && obj->klass() != NULL + && cur + obj->size() > mr.start(), + "Loop postcondition"); + if (!g1h->is_obj_dead(obj)) { + obj->oop_iterate(cl, mr); + } + + HeapWord* next; + while (cur < mr.end()) { + obj = oop(cur); + if (obj->klass() == NULL) { + // Ran into an unparseable point. + return cur; + }; + // Otherwise: + next = (cur + obj->size()); + if (!g1h->is_obj_dead(obj)) { + if (next < mr.end()) { + obj->oop_iterate(cl); + } else { + // this obj spans the boundary. If it's an array, stop at the + // boundary. + if (obj->is_objArray()) { + obj->oop_iterate(cl, mr); + } else { + obj->oop_iterate(cl); + } + } + } + cur = next; + } + return NULL; +} + +void HeapRegion::print() const { print_on(gclog_or_tty); } +void HeapRegion::print_on(outputStream* st) const { + if (isHumongous()) { + if (startsHumongous()) + st->print(" HS"); + else + st->print(" HC"); + } else { + st->print(" "); + } + if (in_collection_set()) + st->print(" CS"); + else if (is_gc_alloc_region()) + st->print(" A "); + else + st->print(" "); + if (is_young()) + st->print(is_scan_only() ? " SO" : (is_survivor() ? " SU" : " Y ")); + else + st->print(" "); + if (is_empty()) + st->print(" F"); + else + st->print(" "); + st->print(" %d", _gc_time_stamp); + G1OffsetTableContigSpace::print_on(st); +} + +#define OBJ_SAMPLE_INTERVAL 0 +#define BLOCK_SAMPLE_INTERVAL 100 + +// This really ought to be commoned up into OffsetTableContigSpace somehow. +// We would need a mechanism to make that code skip dead objects. + +void HeapRegion::verify(bool allow_dirty) const { + G1CollectedHeap* g1 = G1CollectedHeap::heap(); + HeapWord* p = bottom(); + HeapWord* prev_p = NULL; + int objs = 0; + int blocks = 0; + VerifyLiveClosure vl_cl(g1); + while (p < top()) { + size_t size = oop(p)->size(); + if (blocks == BLOCK_SAMPLE_INTERVAL) { + guarantee(p == block_start_const(p + (size/2)), + "check offset computation"); + blocks = 0; + } else { + blocks++; + } + if (objs == OBJ_SAMPLE_INTERVAL) { + oop obj = oop(p); + if (!g1->is_obj_dead(obj, this)) { + obj->verify(); + vl_cl.set_containing_obj(obj); + obj->oop_iterate(&vl_cl); + if (G1MaxVerifyFailures >= 0 + && vl_cl.n_failures() >= G1MaxVerifyFailures) break; + } + objs = 0; + } else { + objs++; + } + prev_p = p; + p += size; + } + HeapWord* rend = end(); + HeapWord* rtop = top(); + if (rtop < rend) { + guarantee(block_start_const(rtop + (rend - rtop) / 2) == rtop, + "check offset computation"); + } + if (vl_cl.failures()) { + gclog_or_tty->print_cr("Heap:"); + G1CollectedHeap::heap()->print(); + gclog_or_tty->print_cr(""); + } + if (G1VerifyConcMark && + G1VerifyConcMarkPrintReachable && + vl_cl.failures()) { + g1->concurrent_mark()->print_prev_bitmap_reachable(); + } + guarantee(!vl_cl.failures(), "should not have had any failures"); + guarantee(p == top(), "end of last object must match end of space"); +} + +// G1OffsetTableContigSpace code; copied from space.cpp. Hope this can go +// away eventually. + +void G1OffsetTableContigSpace::initialize(MemRegion mr, bool clear_space) { + // false ==> we'll do the clearing if there's clearing to be done. + ContiguousSpace::initialize(mr, false); + _offsets.zero_bottom_entry(); + _offsets.initialize_threshold(); + if (clear_space) clear(); +} + +void G1OffsetTableContigSpace::clear() { + ContiguousSpace::clear(); + _offsets.zero_bottom_entry(); + _offsets.initialize_threshold(); +} + +void G1OffsetTableContigSpace::set_bottom(HeapWord* new_bottom) { + Space::set_bottom(new_bottom); + _offsets.set_bottom(new_bottom); +} + +void G1OffsetTableContigSpace::set_end(HeapWord* new_end) { + Space::set_end(new_end); + _offsets.resize(new_end - bottom()); +} + +void G1OffsetTableContigSpace::print() const { + print_short(); + gclog_or_tty->print_cr(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ", " + INTPTR_FORMAT ", " INTPTR_FORMAT ")", + bottom(), top(), _offsets.threshold(), end()); +} + +HeapWord* G1OffsetTableContigSpace::initialize_threshold() { + return _offsets.initialize_threshold(); +} + +HeapWord* G1OffsetTableContigSpace::cross_threshold(HeapWord* start, + HeapWord* end) { + _offsets.alloc_block(start, end); + return _offsets.threshold(); +} + +HeapWord* G1OffsetTableContigSpace::saved_mark_word() const { + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + assert( _gc_time_stamp <= g1h->get_gc_time_stamp(), "invariant" ); + if (_gc_time_stamp < g1h->get_gc_time_stamp()) + return top(); + else + return ContiguousSpace::saved_mark_word(); +} + +void G1OffsetTableContigSpace::set_saved_mark() { + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + unsigned curr_gc_time_stamp = g1h->get_gc_time_stamp(); + + if (_gc_time_stamp < curr_gc_time_stamp) { + // The order of these is important, as another thread might be + // about to start scanning this region. If it does so after + // set_saved_mark and before _gc_time_stamp = ..., then the latter + // will be false, and it will pick up top() as the high water mark + // of region. If it does so after _gc_time_stamp = ..., then it + // will pick up the right saved_mark_word() as the high water mark + // of the region. Either way, the behaviour will be correct. + ContiguousSpace::set_saved_mark(); + OrderAccess::release_store_ptr((volatile intptr_t*) &_gc_time_stamp, + (intptr_t) curr_gc_time_stamp); + } +} + +G1OffsetTableContigSpace:: +G1OffsetTableContigSpace(G1BlockOffsetSharedArray* sharedOffsetArray, + MemRegion mr, bool is_zeroed) : + _offsets(sharedOffsetArray, mr), + _par_alloc_lock(Mutex::leaf, "OffsetTableContigSpace par alloc lock", true), + _gc_time_stamp(0) +{ + _offsets.set_space(this); + initialize(mr, !is_zeroed); +} + +size_t RegionList::length() { + size_t len = 0; + HeapRegion* cur = hd(); + DEBUG_ONLY(HeapRegion* last = NULL); + while (cur != NULL) { + len++; + DEBUG_ONLY(last = cur); + cur = get_next(cur); + } + assert(last == tl(), "Invariant"); + return len; +} + +void RegionList::insert_before_head(HeapRegion* r) { + assert(well_formed(), "Inv"); + set_next(r, hd()); + _hd = r; + _sz++; + if (tl() == NULL) _tl = r; + assert(well_formed(), "Inv"); +} + +void RegionList::prepend_list(RegionList* new_list) { + assert(well_formed(), "Precondition"); + assert(new_list->well_formed(), "Precondition"); + HeapRegion* new_tl = new_list->tl(); + if (new_tl != NULL) { + set_next(new_tl, hd()); + _hd = new_list->hd(); + _sz += new_list->sz(); + if (tl() == NULL) _tl = new_list->tl(); + } else { + assert(new_list->hd() == NULL && new_list->sz() == 0, "Inv"); + } + assert(well_formed(), "Inv"); +} + +void RegionList::delete_after(HeapRegion* r) { + assert(well_formed(), "Precondition"); + HeapRegion* next = get_next(r); + assert(r != NULL, "Precondition"); + HeapRegion* next_tl = get_next(next); + set_next(r, next_tl); + dec_sz(); + if (next == tl()) { + assert(next_tl == NULL, "Inv"); + _tl = r; + } + assert(well_formed(), "Inv"); +} + +HeapRegion* RegionList::pop() { + assert(well_formed(), "Inv"); + HeapRegion* res = hd(); + if (res != NULL) { + _hd = get_next(res); + _sz--; + set_next(res, NULL); + if (sz() == 0) _tl = NULL; + } + assert(well_formed(), "Inv"); + return res; +} diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp new file mode 100644 index 00000000000..17b093b8e8c --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp @@ -0,0 +1,924 @@ +/* + * Copyright 2001-2007 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. + * + */ + +#ifndef SERIALGC + +// A HeapRegion is the smallest piece of a G1CollectedHeap that +// can be collected independently. + +// NOTE: Although a HeapRegion is a Space, its +// Space::initDirtyCardClosure method must not be called. +// The problem is that the existence of this method breaks +// the independence of barrier sets from remembered sets. +// The solution is to remove this method from the definition +// of a Space. + +class CompactibleSpace; +class ContiguousSpace; +class HeapRegionRemSet; +class HeapRegionRemSetIterator; +class HeapRegion; + +// A dirty card to oop closure for heap regions. It +// knows how to get the G1 heap and how to use the bitmap +// in the concurrent marker used by G1 to filter remembered +// sets. + +class HeapRegionDCTOC : public ContiguousSpaceDCTOC { +public: + // Specification of possible DirtyCardToOopClosure filtering. + enum FilterKind { + NoFilterKind, + IntoCSFilterKind, + OutOfRegionFilterKind + }; + +protected: + HeapRegion* _hr; + FilterKind _fk; + G1CollectedHeap* _g1; + + void walk_mem_region_with_cl(MemRegion mr, + HeapWord* bottom, HeapWord* top, + OopClosure* cl); + + // We don't specialize this for FilteringClosure; filtering is handled by + // the "FilterKind" mechanism. But we provide this to avoid a compiler + // warning. + void walk_mem_region_with_cl(MemRegion mr, + HeapWord* bottom, HeapWord* top, + FilteringClosure* cl) { + HeapRegionDCTOC::walk_mem_region_with_cl(mr, bottom, top, + (OopClosure*)cl); + } + + // Get the actual top of the area on which the closure will + // operate, given where the top is assumed to be (the end of the + // memory region passed to do_MemRegion) and where the object + // at the top is assumed to start. For example, an object may + // start at the top but actually extend past the assumed top, + // in which case the top becomes the end of the object. + HeapWord* get_actual_top(HeapWord* top, HeapWord* top_obj) { + return ContiguousSpaceDCTOC::get_actual_top(top, top_obj); + } + + // Walk the given memory region from bottom to (actual) top + // looking for objects and applying the oop closure (_cl) to + // them. The base implementation of this treats the area as + // blocks, where a block may or may not be an object. Sub- + // classes should override this to provide more accurate + // or possibly more efficient walking. + void walk_mem_region(MemRegion mr, HeapWord* bottom, HeapWord* top) { + Filtering_DCTOC::walk_mem_region(mr, bottom, top); + } + +public: + HeapRegionDCTOC(G1CollectedHeap* g1, + HeapRegion* hr, OopClosure* cl, + CardTableModRefBS::PrecisionStyle precision, + FilterKind fk); +}; + + +// The complicating factor is that BlockOffsetTable diverged +// significantly, and we need functionality that is only in the G1 version. +// So I copied that code, which led to an alternate G1 version of +// OffsetTableContigSpace. If the two versions of BlockOffsetTable could +// be reconciled, then G1OffsetTableContigSpace could go away. + +// The idea behind time stamps is the following. Doing a save_marks on +// all regions at every GC pause is time consuming (if I remember +// well, 10ms or so). So, we would like to do that only for regions +// that are GC alloc regions. To achieve this, we use time +// stamps. For every evacuation pause, G1CollectedHeap generates a +// unique time stamp (essentially a counter that gets +// incremented). Every time we want to call save_marks on a region, +// we set the saved_mark_word to top and also copy the current GC +// time stamp to the time stamp field of the space. Reading the +// saved_mark_word involves checking the time stamp of the +// region. If it is the same as the current GC time stamp, then we +// can safely read the saved_mark_word field, as it is valid. If the +// time stamp of the region is not the same as the current GC time +// stamp, then we instead read top, as the saved_mark_word field is +// invalid. Time stamps (on the regions and also on the +// G1CollectedHeap) are reset at every cleanup (we iterate over +// the regions anyway) and at the end of a Full GC. The current scheme +// that uses sequential unsigned ints will fail only if we have 4b +// evacuation pauses between two cleanups, which is _highly_ unlikely. + +class G1OffsetTableContigSpace: public ContiguousSpace { + friend class VMStructs; + protected: + G1BlockOffsetArrayContigSpace _offsets; + Mutex _par_alloc_lock; + volatile unsigned _gc_time_stamp; + + public: + // Constructor. If "is_zeroed" is true, the MemRegion "mr" may be + // assumed to contain zeros. + G1OffsetTableContigSpace(G1BlockOffsetSharedArray* sharedOffsetArray, + MemRegion mr, bool is_zeroed = false); + + void set_bottom(HeapWord* value); + void set_end(HeapWord* value); + + virtual HeapWord* saved_mark_word() const; + virtual void set_saved_mark(); + void reset_gc_time_stamp() { _gc_time_stamp = 0; } + + virtual void initialize(MemRegion mr, bool clear_space); + virtual void clear(); + + HeapWord* block_start(const void* p); + HeapWord* block_start_const(const void* p) const; + + // Add offset table update. + virtual HeapWord* allocate(size_t word_size); + HeapWord* par_allocate(size_t word_size); + + // MarkSweep support phase3 + virtual HeapWord* initialize_threshold(); + virtual HeapWord* cross_threshold(HeapWord* start, HeapWord* end); + + virtual void print() const; +}; + +class HeapRegion: public G1OffsetTableContigSpace { + friend class VMStructs; + private: + + // The next filter kind that should be used for a "new_dcto_cl" call with + // the "traditional" signature. + HeapRegionDCTOC::FilterKind _next_fk; + + // Requires that the region "mr" be dense with objects, and begin and end + // with an object. + void oops_in_mr_iterate(MemRegion mr, OopClosure* cl); + + // The remembered set for this region. + // (Might want to make this "inline" later, to avoid some alloc failure + // issues.) + HeapRegionRemSet* _rem_set; + + G1BlockOffsetArrayContigSpace* offsets() { return &_offsets; } + + protected: + // If this region is a member of a HeapRegionSeq, the index in that + // sequence, otherwise -1. + int _hrs_index; + + bool _humongous; // starts or continues a humongous object + bool _humongous_start; // starts a humongous object + // For a humongous region, region in which it starts. + HeapRegion* _humongous_start_region; + // For the start region of a humongous sequence, it's original end(). + HeapWord* _orig_end; + + // True iff the region is in current collection_set. + bool _in_collection_set; + + // True iff the region is on the unclean list, waiting to be zero filled. + bool _is_on_unclean_list; + + // True iff the region is on the free list, ready for allocation. + bool _is_on_free_list; + + // Is this or has it been an allocation region in the current collection + // pause. + bool _is_gc_alloc_region; + + // True iff an attempt to evacuate an object in the region failed. + bool _evacuation_failed; + + // A heap region may be a member one of a number of special subsets, each + // represented as linked lists through the field below. Currently, these + // sets include: + // The collection set. + // The set of allocation regions used in a collection pause. + // Spaces that may contain gray objects. + HeapRegion* _next_in_special_set; + + // next region in the young "generation" region set + HeapRegion* _next_young_region; + + // For parallel heapRegion traversal. + jint _claimed; + + // We use concurrent marking to determine the amount of live data + // in each heap region. + size_t _prev_marked_bytes; // Bytes known to be live via last completed marking. + size_t _next_marked_bytes; // Bytes known to be live via in-progress marking. + + // See "sort_index" method. -1 means is not in the array. + int _sort_index; + + // Means it has (or at least had) a very large RS, and should not be + // considered for membership in a collection set. + enum PopularityState { + NotPopular, + PopularPending, + Popular + }; + PopularityState _popularity; + + // + double _gc_efficiency; + // + + enum YoungType { + NotYoung, // a region is not young + ScanOnly, // a region is young and scan-only + Young, // a region is young + Survivor // a region is young and it contains + // survivor + }; + + YoungType _young_type; + int _young_index_in_cset; + SurvRateGroup* _surv_rate_group; + int _age_index; + + // The start of the unmarked area. The unmarked area extends from this + // word until the top and/or end of the region, and is the part + // of the region for which no marking was done, i.e. objects may + // have been allocated in this part since the last mark phase. + // "prev" is the top at the start of the last completed marking. + // "next" is the top at the start of the in-progress marking (if any.) + HeapWord* _prev_top_at_mark_start; + HeapWord* _next_top_at_mark_start; + // If a collection pause is in progress, this is the top at the start + // of that pause. + + // We've counted the marked bytes of objects below here. + HeapWord* _top_at_conc_mark_count; + + void init_top_at_mark_start() { + assert(_prev_marked_bytes == 0 && + _next_marked_bytes == 0, + "Must be called after zero_marked_bytes."); + HeapWord* bot = bottom(); + _prev_top_at_mark_start = bot; + _next_top_at_mark_start = bot; + _top_at_conc_mark_count = bot; + } + + jint _zfs; // A member of ZeroFillState. Protected by ZF_lock. + Thread* _zero_filler; // If _zfs is ZeroFilling, the thread that (last) + // made it so. + + void set_young_type(YoungType new_type) { + //assert(_young_type != new_type, "setting the same type" ); + // TODO: add more assertions here + _young_type = new_type; + } + + public: + // If "is_zeroed" is "true", the region "mr" can be assumed to contain zeros. + HeapRegion(G1BlockOffsetSharedArray* sharedOffsetArray, + MemRegion mr, bool is_zeroed); + + enum SomePublicConstants { + // HeapRegions are GrainBytes-aligned + // and have sizes that are multiples of GrainBytes. + LogOfHRGrainBytes = 20, + LogOfHRGrainWords = LogOfHRGrainBytes - LogHeapWordSize, + GrainBytes = 1 << LogOfHRGrainBytes, + GrainWords = 1 <= marked_bytes(), + "Can't mark more than we have."); + return used_at_mark_start_bytes - marked_bytes(); + } + + // An upper bound on the number of live bytes in the region. + size_t max_live_bytes() { return used() - garbage_bytes(); } + + void add_to_marked_bytes(size_t incr_bytes) { + _next_marked_bytes = _next_marked_bytes + incr_bytes; + guarantee( _next_marked_bytes <= used(), "invariant" ); + } + + void zero_marked_bytes() { + _prev_marked_bytes = _next_marked_bytes = 0; + } + + bool isHumongous() const { return _humongous; } + bool startsHumongous() const { return _humongous_start; } + bool continuesHumongous() const { return _humongous && ! _humongous_start; } + // For a humongous region, region in which it starts. + HeapRegion* humongous_start_region() const { + return _humongous_start_region; + } + + // Causes the current region to represent a humongous object spanning "n" + // regions. + virtual void set_startsHumongous(); + + // The regions that continue a humongous sequence should be added using + // this method, in increasing address order. + void set_continuesHumongous(HeapRegion* start); + + void add_continuingHumongousRegion(HeapRegion* cont); + + // If the region has a remembered set, return a pointer to it. + HeapRegionRemSet* rem_set() const { + return _rem_set; + } + + // True iff the region is in current collection_set. + bool in_collection_set() const { + return _in_collection_set; + } + void set_in_collection_set(bool b) { + _in_collection_set = b; + } + HeapRegion* next_in_collection_set() { + assert(in_collection_set(), "should only invoke on member of CS."); + assert(_next_in_special_set == NULL || + _next_in_special_set->in_collection_set(), + "Malformed CS."); + return _next_in_special_set; + } + void set_next_in_collection_set(HeapRegion* r) { + assert(in_collection_set(), "should only invoke on member of CS."); + assert(r == NULL || r->in_collection_set(), "Malformed CS."); + _next_in_special_set = r; + } + + // True iff it is or has been an allocation region in the current + // collection pause. + bool is_gc_alloc_region() const { + return _is_gc_alloc_region; + } + void set_is_gc_alloc_region(bool b) { + _is_gc_alloc_region = b; + } + HeapRegion* next_gc_alloc_region() { + assert(is_gc_alloc_region(), "should only invoke on member of CS."); + assert(_next_in_special_set == NULL || + _next_in_special_set->is_gc_alloc_region(), + "Malformed CS."); + return _next_in_special_set; + } + void set_next_gc_alloc_region(HeapRegion* r) { + assert(is_gc_alloc_region(), "should only invoke on member of CS."); + assert(r == NULL || r->is_gc_alloc_region(), "Malformed CS."); + _next_in_special_set = r; + } + + bool is_reserved() { + return popular(); + } + + bool is_on_free_list() { + return _is_on_free_list; + } + + void set_on_free_list(bool b) { + _is_on_free_list = b; + } + + HeapRegion* next_from_free_list() { + assert(is_on_free_list(), + "Should only invoke on free space."); + assert(_next_in_special_set == NULL || + _next_in_special_set->is_on_free_list(), + "Malformed Free List."); + return _next_in_special_set; + } + + void set_next_on_free_list(HeapRegion* r) { + assert(r == NULL || r->is_on_free_list(), "Malformed free list."); + _next_in_special_set = r; + } + + bool is_on_unclean_list() { + return _is_on_unclean_list; + } + + void set_on_unclean_list(bool b); + + HeapRegion* next_from_unclean_list() { + assert(is_on_unclean_list(), + "Should only invoke on unclean space."); + assert(_next_in_special_set == NULL || + _next_in_special_set->is_on_unclean_list(), + "Malformed unclean List."); + return _next_in_special_set; + } + + void set_next_on_unclean_list(HeapRegion* r); + + HeapRegion* get_next_young_region() { return _next_young_region; } + void set_next_young_region(HeapRegion* hr) { + _next_young_region = hr; + } + + // Allows logical separation between objects allocated before and after. + void save_marks(); + + // Reset HR stuff to default values. + void hr_clear(bool par, bool clear_space); + + void initialize(MemRegion mr, bool clear_space); + + // Ensure that "this" is zero-filled. + void ensure_zero_filled(); + // This one requires that the calling thread holds ZF_mon. + void ensure_zero_filled_locked(); + + // Get the start of the unmarked area in this region. + HeapWord* prev_top_at_mark_start() const { return _prev_top_at_mark_start; } + HeapWord* next_top_at_mark_start() const { return _next_top_at_mark_start; } + + // Apply "cl->do_oop" to (the addresses of) all reference fields in objects + // allocated in the current region before the last call to "save_mark". + void oop_before_save_marks_iterate(OopClosure* cl); + + // This call determines the "filter kind" argument that will be used for + // the next call to "new_dcto_cl" on this region with the "traditional" + // signature (i.e., the call below.) The default, in the absence of a + // preceding call to this method, is "NoFilterKind", and a call to this + // method is necessary for each such call, or else it reverts to the + // default. + // (This is really ugly, but all other methods I could think of changed a + // lot of main-line code for G1.) + void set_next_filter_kind(HeapRegionDCTOC::FilterKind nfk) { + _next_fk = nfk; + } + + DirtyCardToOopClosure* + new_dcto_closure(OopClosure* cl, + CardTableModRefBS::PrecisionStyle precision, + HeapRegionDCTOC::FilterKind fk); + +#if WHASSUP + DirtyCardToOopClosure* + new_dcto_closure(OopClosure* cl, + CardTableModRefBS::PrecisionStyle precision, + HeapWord* boundary) { + assert(boundary == NULL, "This arg doesn't make sense here."); + DirtyCardToOopClosure* res = new_dcto_closure(cl, precision, _next_fk); + _next_fk = HeapRegionDCTOC::NoFilterKind; + return res; + } +#endif + + // + // Note the start or end of marking. This tells the heap region + // that the collector is about to start or has finished (concurrently) + // marking the heap. + // + + // Note the start of a marking phase. Record the + // start of the unmarked area of the region here. + void note_start_of_marking(bool during_initial_mark) { + init_top_at_conc_mark_count(); + _next_marked_bytes = 0; + if (during_initial_mark && is_young() && !is_survivor()) + _next_top_at_mark_start = bottom(); + else + _next_top_at_mark_start = top(); + } + + // Note the end of a marking phase. Install the start of + // the unmarked area that was captured at start of marking. + void note_end_of_marking() { + _prev_top_at_mark_start = _next_top_at_mark_start; + _prev_marked_bytes = _next_marked_bytes; + _next_marked_bytes = 0; + + guarantee(_prev_marked_bytes <= + (size_t) (prev_top_at_mark_start() - bottom()) * HeapWordSize, + "invariant"); + } + + // After an evacuation, we need to update _next_top_at_mark_start + // to be the current top. Note this is only valid if we have only + // ever evacuated into this region. If we evacuate, allocate, and + // then evacuate we are in deep doodoo. + void note_end_of_copying() { + assert(top() >= _next_top_at_mark_start, + "Increase only"); + _next_top_at_mark_start = top(); + } + + // Returns "false" iff no object in the region was allocated when the + // last mark phase ended. + bool is_marked() { return _prev_top_at_mark_start != bottom(); } + + // If "is_marked()" is true, then this is the index of the region in + // an array constructed at the end of marking of the regions in a + // "desirability" order. + int sort_index() { + return _sort_index; + } + void set_sort_index(int i) { + _sort_index = i; + } + + void init_top_at_conc_mark_count() { + _top_at_conc_mark_count = bottom(); + } + + void set_top_at_conc_mark_count(HeapWord *cur) { + assert(bottom() <= cur && cur <= end(), "Sanity."); + _top_at_conc_mark_count = cur; + } + + HeapWord* top_at_conc_mark_count() { + return _top_at_conc_mark_count; + } + + void reset_during_compaction() { + guarantee( isHumongous() && startsHumongous(), + "should only be called for humongous regions"); + + zero_marked_bytes(); + init_top_at_mark_start(); + } + + bool popular() { return _popularity == Popular; } + void set_popular(bool b) { + if (b) { + _popularity = Popular; + } else { + _popularity = NotPopular; + } + } + bool popular_pending() { return _popularity == PopularPending; } + void set_popular_pending(bool b) { + if (b) { + _popularity = PopularPending; + } else { + _popularity = NotPopular; + } + } + + // + void calc_gc_efficiency(void); + double gc_efficiency() { return _gc_efficiency;} + // + + bool is_young() const { return _young_type != NotYoung; } + bool is_scan_only() const { return _young_type == ScanOnly; } + bool is_survivor() const { return _young_type == Survivor; } + + int young_index_in_cset() const { return _young_index_in_cset; } + void set_young_index_in_cset(int index) { + assert( (index == -1) || is_young(), "pre-condition" ); + _young_index_in_cset = index; + } + + int age_in_surv_rate_group() { + assert( _surv_rate_group != NULL, "pre-condition" ); + assert( _age_index > -1, "pre-condition" ); + return _surv_rate_group->age_in_group(_age_index); + } + + void recalculate_age_in_surv_rate_group() { + assert( _surv_rate_group != NULL, "pre-condition" ); + assert( _age_index > -1, "pre-condition" ); + _age_index = _surv_rate_group->recalculate_age_index(_age_index); + } + + void record_surv_words_in_group(size_t words_survived) { + assert( _surv_rate_group != NULL, "pre-condition" ); + assert( _age_index > -1, "pre-condition" ); + int age_in_group = age_in_surv_rate_group(); + _surv_rate_group->record_surviving_words(age_in_group, words_survived); + } + + int age_in_surv_rate_group_cond() { + if (_surv_rate_group != NULL) + return age_in_surv_rate_group(); + else + return -1; + } + + SurvRateGroup* surv_rate_group() { + return _surv_rate_group; + } + + void install_surv_rate_group(SurvRateGroup* surv_rate_group) { + assert( surv_rate_group != NULL, "pre-condition" ); + assert( _surv_rate_group == NULL, "pre-condition" ); + assert( is_young(), "pre-condition" ); + + _surv_rate_group = surv_rate_group; + _age_index = surv_rate_group->next_age_index(); + } + + void uninstall_surv_rate_group() { + if (_surv_rate_group != NULL) { + assert( _age_index > -1, "pre-condition" ); + assert( is_young(), "pre-condition" ); + + _surv_rate_group = NULL; + _age_index = -1; + } else { + assert( _age_index == -1, "pre-condition" ); + } + } + + void set_young() { set_young_type(Young); } + + void set_scan_only() { set_young_type(ScanOnly); } + + void set_survivor() { set_young_type(Survivor); } + + void set_not_young() { set_young_type(NotYoung); } + + // Determine if an object has been allocated since the last + // mark performed by the collector. This returns true iff the object + // is within the unmarked area of the region. + bool obj_allocated_since_prev_marking(oop obj) const { + return (HeapWord *) obj >= prev_top_at_mark_start(); + } + bool obj_allocated_since_next_marking(oop obj) const { + return (HeapWord *) obj >= next_top_at_mark_start(); + } + + // For parallel heapRegion traversal. + bool claimHeapRegion(int claimValue); + jint claim_value() { return _claimed; } + // Use this carefully: only when you're sure no one is claiming... + void set_claim_value(int claimValue) { _claimed = claimValue; } + + // Returns the "evacuation_failed" property of the region. + bool evacuation_failed() { return _evacuation_failed; } + + // Sets the "evacuation_failed" property of the region. + void set_evacuation_failed(bool b) { + _evacuation_failed = b; + + if (b) { + init_top_at_conc_mark_count(); + _next_marked_bytes = 0; + } + } + + // Requires that "mr" be entirely within the region. + // Apply "cl->do_object" to all objects that intersect with "mr". + // If the iteration encounters an unparseable portion of the region, + // or if "cl->abort()" is true after a closure application, + // terminate the iteration and return the address of the start of the + // subregion that isn't done. (The two can be distinguished by querying + // "cl->abort()".) Return of "NULL" indicates that the iteration + // completed. + HeapWord* + object_iterate_mem_careful(MemRegion mr, ObjectClosure* cl); + + HeapWord* + oops_on_card_seq_iterate_careful(MemRegion mr, + FilterOutOfRegionClosure* cl); + + // The region "mr" is entirely in "this", and starts and ends at block + // boundaries. The caller declares that all the contained blocks are + // coalesced into one. + void declare_filled_region_to_BOT(MemRegion mr) { + _offsets.single_block(mr.start(), mr.end()); + } + + // A version of block start that is guaranteed to find *some* block + // boundary at or before "p", but does not object iteration, and may + // therefore be used safely when the heap is unparseable. + HeapWord* block_start_careful(const void* p) const { + return _offsets.block_start_careful(p); + } + + // Requires that "addr" is within the region. Returns the start of the + // first ("careful") block that starts at or after "addr", or else the + // "end" of the region if there is no such block. + HeapWord* next_block_start_careful(HeapWord* addr); + + // Returns the zero-fill-state of the current region. + ZeroFillState zero_fill_state() { return (ZeroFillState)_zfs; } + bool zero_fill_is_allocated() { return _zfs == Allocated; } + Thread* zero_filler() { return _zero_filler; } + + // Indicate that the contents of the region are unknown, and therefore + // might require zero-filling. + void set_zero_fill_needed() { + set_zero_fill_state_work(NotZeroFilled); + } + void set_zero_fill_in_progress(Thread* t) { + set_zero_fill_state_work(ZeroFilling); + _zero_filler = t; + } + void set_zero_fill_complete(); + void set_zero_fill_allocated() { + set_zero_fill_state_work(Allocated); + } + + void set_zero_fill_state_work(ZeroFillState zfs); + + // This is called when a full collection shrinks the heap. + // We want to set the heap region to a value which says + // it is no longer part of the heap. For now, we'll let "NotZF" fill + // that role. + void reset_zero_fill() { + set_zero_fill_state_work(NotZeroFilled); + _zero_filler = NULL; + } + +#define HeapRegion_OOP_SINCE_SAVE_MARKS_DECL(OopClosureType, nv_suffix) \ + virtual void oop_since_save_marks_iterate##nv_suffix(OopClosureType* cl); + SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(HeapRegion_OOP_SINCE_SAVE_MARKS_DECL) + + CompactibleSpace* next_compaction_space() const; + + virtual void reset_after_compaction(); + + void print() const; + void print_on(outputStream* st) const; + + // Override + virtual void verify(bool allow_dirty) const; + +#ifdef DEBUG + HeapWord* allocate(size_t size); +#endif +}; + +// HeapRegionClosure is used for iterating over regions. +// Terminates the iteration when the "doHeapRegion" method returns "true". +class HeapRegionClosure : public StackObj { + friend class HeapRegionSeq; + friend class G1CollectedHeap; + + bool _complete; + void incomplete() { _complete = false; } + + public: + HeapRegionClosure(): _complete(true) {} + + // Typically called on each region until it returns true. + virtual bool doHeapRegion(HeapRegion* r) = 0; + + // True after iteration if the closure was applied to all heap regions + // and returned "false" in all cases. + bool complete() { return _complete; } +}; + +// A linked lists of heap regions. It leaves the "next" field +// unspecified; that's up to subtypes. +class RegionList { +protected: + virtual HeapRegion* get_next(HeapRegion* chr) = 0; + virtual void set_next(HeapRegion* chr, + HeapRegion* new_next) = 0; + + HeapRegion* _hd; + HeapRegion* _tl; + size_t _sz; + + // Protected constructor because this type is only meaningful + // when the _get/_set next functions are defined. + RegionList() : _hd(NULL), _tl(NULL), _sz(0) {} +public: + void reset() { + _hd = NULL; + _tl = NULL; + _sz = 0; + } + HeapRegion* hd() { return _hd; } + HeapRegion* tl() { return _tl; } + size_t sz() { return _sz; } + size_t length(); + + bool well_formed() { + return + ((hd() == NULL && tl() == NULL && sz() == 0) + || (hd() != NULL && tl() != NULL && sz() > 0)) + && (sz() == length()); + } + virtual void insert_before_head(HeapRegion* r); + void prepend_list(RegionList* new_list); + virtual HeapRegion* pop(); + void dec_sz() { _sz--; } + // Requires that "r" is an element of the list, and is not the tail. + void delete_after(HeapRegion* r); +}; + +class EmptyNonHRegionList: public RegionList { +protected: + // Protected constructor because this type is only meaningful + // when the _get/_set next functions are defined. + EmptyNonHRegionList() : RegionList() {} + +public: + void insert_before_head(HeapRegion* r) { + // assert(r->is_empty(), "Better be empty"); + assert(!r->isHumongous(), "Better not be humongous."); + RegionList::insert_before_head(r); + } + void prepend_list(EmptyNonHRegionList* new_list) { + // assert(new_list->hd() == NULL || new_list->hd()->is_empty(), + // "Better be empty"); + assert(new_list->hd() == NULL || !new_list->hd()->isHumongous(), + "Better not be humongous."); + // assert(new_list->tl() == NULL || new_list->tl()->is_empty(), + // "Better be empty"); + assert(new_list->tl() == NULL || !new_list->tl()->isHumongous(), + "Better not be humongous."); + RegionList::prepend_list(new_list); + } +}; + +class UncleanRegionList: public EmptyNonHRegionList { +public: + HeapRegion* get_next(HeapRegion* hr) { + return hr->next_from_unclean_list(); + } + void set_next(HeapRegion* hr, HeapRegion* new_next) { + hr->set_next_on_unclean_list(new_next); + } + + UncleanRegionList() : EmptyNonHRegionList() {} + + void insert_before_head(HeapRegion* r) { + assert(!r->is_on_free_list(), + "Better not already be on free list"); + assert(!r->is_on_unclean_list(), + "Better not already be on unclean list"); + r->set_zero_fill_needed(); + r->set_on_unclean_list(true); + EmptyNonHRegionList::insert_before_head(r); + } + void prepend_list(UncleanRegionList* new_list) { + assert(new_list->tl() == NULL || !new_list->tl()->is_on_free_list(), + "Better not already be on free list"); + assert(new_list->tl() == NULL || new_list->tl()->is_on_unclean_list(), + "Better already be marked as on unclean list"); + assert(new_list->hd() == NULL || !new_list->hd()->is_on_free_list(), + "Better not already be on free list"); + assert(new_list->hd() == NULL || new_list->hd()->is_on_unclean_list(), + "Better already be marked as on unclean list"); + EmptyNonHRegionList::prepend_list(new_list); + } + HeapRegion* pop() { + HeapRegion* res = RegionList::pop(); + if (res != NULL) res->set_on_unclean_list(false); + return res; + } +}; + +// Local Variables: *** +// c-indentation-style: gnu *** +// End: *** + +#endif // SERIALGC diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.inline.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.inline.hpp new file mode 100644 index 00000000000..0e4970ed1c1 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.inline.hpp @@ -0,0 +1,60 @@ +/* + * Copyright 2001-2007 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. + * + */ + +inline HeapWord* G1OffsetTableContigSpace::allocate(size_t size) { + HeapWord* res = ContiguousSpace::allocate(size); + if (res != NULL) { + _offsets.alloc_block(res, size); + } + return res; +} + +// Because of the requirement of keeping "_offsets" up to date with the +// allocations, we sequentialize these with a lock. Therefore, best if +// this is used for larger LAB allocations only. +inline HeapWord* G1OffsetTableContigSpace::par_allocate(size_t size) { + MutexLocker x(&_par_alloc_lock); + // This ought to be just "allocate", because of the lock above, but that + // ContiguousSpace::allocate asserts that either the allocating thread + // holds the heap lock or it is the VM thread and we're at a safepoint. + // The best I (dld) could figure was to put a field in ContiguousSpace + // meaning "locking at safepoint taken care of", and set/reset that + // here. But this will do for now, especially in light of the comment + // above. Perhaps in the future some lock-free manner of keeping the + // coordination. + HeapWord* res = ContiguousSpace::par_allocate(size); + if (res != NULL) { + _offsets.alloc_block(res, size); + } + return res; +} + +inline HeapWord* G1OffsetTableContigSpace::block_start(const void* p) { + return _offsets.block_start(p); +} + +inline HeapWord* +G1OffsetTableContigSpace::block_start_const(const void* p) const { + return _offsets.block_start_const(p); +} diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp new file mode 100644 index 00000000000..f2d262ebfb5 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp @@ -0,0 +1,1443 @@ +/* + * Copyright 2001-2007 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. + * + */ + +#include "incls/_precompiled.incl" +#include "incls/_heapRegionRemSet.cpp.incl" + +#define HRRS_VERBOSE 0 + +#define PRT_COUNT_OCCUPIED 1 + +// OtherRegionsTable + +class PerRegionTable: public CHeapObj { + friend class OtherRegionsTable; + friend class HeapRegionRemSetIterator; + + HeapRegion* _hr; + BitMap _bm; +#if PRT_COUNT_OCCUPIED + jint _occupied; +#endif + PerRegionTable* _next_free; + + PerRegionTable* next_free() { return _next_free; } + void set_next_free(PerRegionTable* prt) { _next_free = prt; } + + + static PerRegionTable* _free_list; + +#ifdef _MSC_VER + // For some reason even though the classes are marked as friend they are unable + // to access CardsPerRegion when private/protected. Only the windows c++ compiler + // says this Sun CC and linux gcc don't have a problem with access when private + + public: + +#endif // _MSC_VER + + enum SomePrivateConstants { + CardsPerRegion = HeapRegion::GrainBytes >> CardTableModRefBS::card_shift + }; + +protected: + // We need access in order to union things into the base table. + BitMap* bm() { return &_bm; } + + void recount_occupied() { + _occupied = (jint) bm()->count_one_bits(); + } + + PerRegionTable(HeapRegion* hr) : + _hr(hr), +#if PRT_COUNT_OCCUPIED + _occupied(0), +#endif + _bm(CardsPerRegion, false /* in-resource-area */) + {} + + static void free(PerRegionTable* prt) { + while (true) { + PerRegionTable* fl = _free_list; + prt->set_next_free(fl); + PerRegionTable* res = + (PerRegionTable*) + Atomic::cmpxchg_ptr(prt, &_free_list, fl); + if (res == fl) return; + } + ShouldNotReachHere(); + } + + static PerRegionTable* alloc(HeapRegion* hr) { + PerRegionTable* fl = _free_list; + while (fl != NULL) { + PerRegionTable* nxt = fl->next_free(); + PerRegionTable* res = + (PerRegionTable*) + Atomic::cmpxchg_ptr(nxt, &_free_list, fl); + if (res == fl) { + fl->init(hr); + return fl; + } else { + fl = _free_list; + } + } + assert(fl == NULL, "Loop condition."); + return new PerRegionTable(hr); + } + + void add_card_work(short from_card, bool par) { + if (!_bm.at(from_card)) { + if (par) { + if (_bm.par_at_put(from_card, 1)) { +#if PRT_COUNT_OCCUPIED + Atomic::inc(&_occupied); +#endif + } + } else { + _bm.at_put(from_card, 1); +#if PRT_COUNT_OCCUPIED + _occupied++; +#endif + } + } + } + + void add_reference_work(oop* from, bool par) { + // Must make this robust in case "from" is not in "_hr", because of + // concurrency. + +#if HRRS_VERBOSE + gclog_or_tty->print_cr(" PRT::Add_reference_work(" PTR_FORMAT "->" PTR_FORMAT").", + from, *from); +#endif + + HeapRegion* loc_hr = hr(); + // If the test below fails, then this table was reused concurrently + // with this operation. This is OK, since the old table was coarsened, + // and adding a bit to the new table is never incorrect. + if (loc_hr->is_in_reserved(from)) { + size_t hw_offset = pointer_delta((HeapWord*)from, loc_hr->bottom()); + size_t from_card = + hw_offset >> + (CardTableModRefBS::card_shift - LogHeapWordSize); + + add_card_work((short) from_card, par); + } + } + +public: + + HeapRegion* hr() const { return _hr; } + +#if PRT_COUNT_OCCUPIED + jint occupied() const { + // Overkill, but if we ever need it... + // guarantee(_occupied == _bm.count_one_bits(), "Check"); + return _occupied; + } +#else + jint occupied() const { + return _bm.count_one_bits(); + } +#endif + + void init(HeapRegion* hr) { + _hr = hr; +#if PRT_COUNT_OCCUPIED + _occupied = 0; +#endif + _bm.clear(); + } + + void add_reference(oop* from) { + add_reference_work(from, /*parallel*/ true); + } + + void seq_add_reference(oop* from) { + add_reference_work(from, /*parallel*/ false); + } + + void scrub(CardTableModRefBS* ctbs, BitMap* card_bm) { + HeapWord* hr_bot = hr()->bottom(); + int hr_first_card_index = ctbs->index_for(hr_bot); + bm()->set_intersection_at_offset(*card_bm, hr_first_card_index); +#if PRT_COUNT_OCCUPIED + recount_occupied(); +#endif + } + + void add_card(short from_card_index) { + add_card_work(from_card_index, /*parallel*/ true); + } + + void seq_add_card(short from_card_index) { + add_card_work(from_card_index, /*parallel*/ false); + } + + // (Destructively) union the bitmap of the current table into the given + // bitmap (which is assumed to be of the same size.) + void union_bitmap_into(BitMap* bm) { + bm->set_union(_bm); + } + + // Mem size in bytes. + size_t mem_size() const { + return sizeof(this) + _bm.size_in_words() * HeapWordSize; + } + + static size_t fl_mem_size() { + PerRegionTable* cur = _free_list; + size_t res = 0; + while (cur != NULL) { + res += sizeof(PerRegionTable); + cur = cur->next_free(); + } + return res; + } + + // Requires "from" to be in "hr()". + bool contains_reference(oop* from) const { + assert(hr()->is_in_reserved(from), "Precondition."); + size_t card_ind = pointer_delta(from, hr()->bottom(), + CardTableModRefBS::card_size); + return _bm.at(card_ind); + } +}; + +PerRegionTable* PerRegionTable::_free_list = NULL; + + +#define COUNT_PAR_EXPANDS 0 + +#if COUNT_PAR_EXPANDS +static jint n_par_expands = 0; +static jint n_par_contracts = 0; +static jint par_expand_list_len = 0; +static jint max_par_expand_list_len = 0; + +static void print_par_expand() { + Atomic::inc(&n_par_expands); + Atomic::inc(&par_expand_list_len); + if (par_expand_list_len > max_par_expand_list_len) { + max_par_expand_list_len = par_expand_list_len; + } + if ((n_par_expands % 10) == 0) { + gclog_or_tty->print_cr("\n\n%d par expands: %d contracts, " + "len = %d, max_len = %d\n.", + n_par_expands, n_par_contracts, par_expand_list_len, + max_par_expand_list_len); + } +} +#endif + +class PosParPRT: public PerRegionTable { + PerRegionTable** _par_tables; + + enum SomePrivateConstants { + ReserveParTableExpansion = 1 + }; + + void par_expand() { + int n = HeapRegionRemSet::num_par_rem_sets()-1; + if (n <= 0) return; + if (_par_tables == NULL) { + PerRegionTable* res = + (PerRegionTable*) + Atomic::cmpxchg_ptr((PerRegionTable*)ReserveParTableExpansion, + &_par_tables, NULL); + if (res != NULL) return; + // Otherwise, we reserved the right to do the expansion. + + PerRegionTable** ptables = NEW_C_HEAP_ARRAY(PerRegionTable*, n); + for (int i = 0; i < n; i++) { + PerRegionTable* ptable = PerRegionTable::alloc(hr()); + ptables[i] = ptable; + } + // Here we do not need an atomic. + _par_tables = ptables; +#if COUNT_PAR_EXPANDS + print_par_expand(); +#endif + // We must put this table on the expanded list. + PosParPRT* exp_head = _par_expanded_list; + while (true) { + set_next_par_expanded(exp_head); + PosParPRT* res = + (PosParPRT*) + Atomic::cmpxchg_ptr(this, &_par_expanded_list, exp_head); + if (res == exp_head) return; + // Otherwise. + exp_head = res; + } + ShouldNotReachHere(); + } + } + + void par_contract() { + assert(_par_tables != NULL, "Precondition."); + int n = HeapRegionRemSet::num_par_rem_sets()-1; + for (int i = 0; i < n; i++) { + _par_tables[i]->union_bitmap_into(bm()); + PerRegionTable::free(_par_tables[i]); + _par_tables[i] = NULL; + } +#if PRT_COUNT_OCCUPIED + // We must recount the "occupied." + recount_occupied(); +#endif + FREE_C_HEAP_ARRAY(PerRegionTable*, _par_tables); + _par_tables = NULL; +#if COUNT_PAR_EXPANDS + Atomic::inc(&n_par_contracts); + Atomic::dec(&par_expand_list_len); +#endif + } + + static PerRegionTable** _par_table_fl; + + PosParPRT* _next; + + static PosParPRT* _free_list; + + PerRegionTable** par_tables() const { + assert(uintptr_t(NULL) == 0, "Assumption."); + if (uintptr_t(_par_tables) <= ReserveParTableExpansion) + return NULL; + else + return _par_tables; + } + + PosParPRT* _next_par_expanded; + PosParPRT* next_par_expanded() { return _next_par_expanded; } + void set_next_par_expanded(PosParPRT* ppprt) { _next_par_expanded = ppprt; } + static PosParPRT* _par_expanded_list; + +public: + + PosParPRT(HeapRegion* hr) : PerRegionTable(hr), _par_tables(NULL) {} + + jint occupied() const { + jint res = PerRegionTable::occupied(); + if (par_tables() != NULL) { + for (int i = 0; i < HeapRegionRemSet::num_par_rem_sets()-1; i++) { + res += par_tables()[i]->occupied(); + } + } + return res; + } + + void init(HeapRegion* hr) { + PerRegionTable::init(hr); + _next = NULL; + if (par_tables() != NULL) { + for (int i = 0; i < HeapRegionRemSet::num_par_rem_sets()-1; i++) { + par_tables()[i]->init(hr); + } + } + } + + static void free(PosParPRT* prt) { + while (true) { + PosParPRT* fl = _free_list; + prt->set_next(fl); + PosParPRT* res = + (PosParPRT*) + Atomic::cmpxchg_ptr(prt, &_free_list, fl); + if (res == fl) return; + } + ShouldNotReachHere(); + } + + static PosParPRT* alloc(HeapRegion* hr) { + PosParPRT* fl = _free_list; + while (fl != NULL) { + PosParPRT* nxt = fl->next(); + PosParPRT* res = + (PosParPRT*) + Atomic::cmpxchg_ptr(nxt, &_free_list, fl); + if (res == fl) { + fl->init(hr); + return fl; + } else { + fl = _free_list; + } + } + assert(fl == NULL, "Loop condition."); + return new PosParPRT(hr); + } + + PosParPRT* next() const { return _next; } + void set_next(PosParPRT* nxt) { _next = nxt; } + PosParPRT** next_addr() { return &_next; } + + void add_reference(oop* from, int tid) { + // Expand if necessary. + PerRegionTable** pt = par_tables(); + if (par_tables() == NULL && tid > 0 && hr()->is_gc_alloc_region()) { + par_expand(); + pt = par_tables(); + } + if (pt != NULL) { + // We always have to assume that mods to table 0 are in parallel, + // because of the claiming scheme in parallel expansion. A thread + // with tid != 0 that finds the table to be NULL, but doesn't succeed + // in claiming the right of expanding it, will end up in the else + // clause of the above if test. That thread could be delayed, and a + // thread 0 add reference could see the table expanded, and come + // here. Both threads would be adding in parallel. But we get to + // not use atomics for tids > 0. + if (tid == 0) { + PerRegionTable::add_reference(from); + } else { + pt[tid-1]->seq_add_reference(from); + } + } else { + // Not expanded -- add to the base table. + PerRegionTable::add_reference(from); + } + } + + void scrub(CardTableModRefBS* ctbs, BitMap* card_bm) { + assert(_par_tables == NULL, "Precondition"); + PerRegionTable::scrub(ctbs, card_bm); + } + + size_t mem_size() const { + size_t res = + PerRegionTable::mem_size() + sizeof(this) - sizeof(PerRegionTable); + if (_par_tables != NULL) { + for (int i = 0; i < HeapRegionRemSet::num_par_rem_sets()-1; i++) { + res += _par_tables[i]->mem_size(); + } + } + return res; + } + + static size_t fl_mem_size() { + PosParPRT* cur = _free_list; + size_t res = 0; + while (cur != NULL) { + res += sizeof(PosParPRT); + cur = cur->next(); + } + return res; + } + + bool contains_reference(oop* from) const { + if (PerRegionTable::contains_reference(from)) return true; + if (_par_tables != NULL) { + for (int i = 0; i < HeapRegionRemSet::num_par_rem_sets()-1; i++) { + if (_par_tables[i]->contains_reference(from)) return true; + } + } + return false; + } + + static void par_contract_all(); + +}; + +void PosParPRT::par_contract_all() { + PosParPRT* hd = _par_expanded_list; + while (hd != NULL) { + PosParPRT* nxt = hd->next_par_expanded(); + PosParPRT* res = + (PosParPRT*) + Atomic::cmpxchg_ptr(nxt, &_par_expanded_list, hd); + if (res == hd) { + // We claimed the right to contract this table. + hd->set_next_par_expanded(NULL); + hd->par_contract(); + hd = _par_expanded_list; + } else { + hd = res; + } + } +} + +PosParPRT* PosParPRT::_free_list = NULL; +PosParPRT* PosParPRT::_par_expanded_list = NULL; + +jint OtherRegionsTable::_cache_probes = 0; +jint OtherRegionsTable::_cache_hits = 0; + +size_t OtherRegionsTable::_max_fine_entries = 0; +size_t OtherRegionsTable::_mod_max_fine_entries_mask = 0; +#if SAMPLE_FOR_EVICTION +size_t OtherRegionsTable::_fine_eviction_stride = 0; +size_t OtherRegionsTable::_fine_eviction_sample_size = 0; +#endif + +OtherRegionsTable::OtherRegionsTable(HeapRegion* hr) : + _g1h(G1CollectedHeap::heap()), + _m(Mutex::leaf, "An OtherRegionsTable lock", true), + _hr(hr), + _coarse_map(G1CollectedHeap::heap()->max_regions(), + false /* in-resource-area */), + _fine_grain_regions(NULL), + _n_fine_entries(0), _n_coarse_entries(0), +#if SAMPLE_FOR_EVICTION + _fine_eviction_start(0), +#endif + _sparse_table(hr) +{ + typedef PosParPRT* PosParPRTPtr; + if (_max_fine_entries == 0) { + assert(_mod_max_fine_entries_mask == 0, "Both or none."); + _max_fine_entries = (1 << G1LogRSRegionEntries); + _mod_max_fine_entries_mask = _max_fine_entries - 1; +#if SAMPLE_FOR_EVICTION + assert(_fine_eviction_sample_size == 0 + && _fine_eviction_stride == 0, "All init at same time."); + _fine_eviction_sample_size = MAX2((size_t)4, (size_t)G1LogRSRegionEntries); + _fine_eviction_stride = _max_fine_entries / _fine_eviction_sample_size; +#endif + } + _fine_grain_regions = new PosParPRTPtr[_max_fine_entries]; + if (_fine_grain_regions == NULL) + vm_exit_out_of_memory(sizeof(void*)*_max_fine_entries, + "Failed to allocate _fine_grain_entries."); + for (size_t i = 0; i < _max_fine_entries; i++) { + _fine_grain_regions[i] = NULL; + } +} + +int** OtherRegionsTable::_from_card_cache = NULL; +size_t OtherRegionsTable::_from_card_cache_max_regions = 0; +size_t OtherRegionsTable::_from_card_cache_mem_size = 0; + +void OtherRegionsTable::init_from_card_cache(size_t max_regions) { + _from_card_cache_max_regions = max_regions; + + int n_par_rs = HeapRegionRemSet::num_par_rem_sets(); + _from_card_cache = NEW_C_HEAP_ARRAY(int*, n_par_rs); + for (int i = 0; i < n_par_rs; i++) { + _from_card_cache[i] = NEW_C_HEAP_ARRAY(int, max_regions); + for (size_t j = 0; j < max_regions; j++) { + _from_card_cache[i][j] = -1; // An invalid value. + } + } + _from_card_cache_mem_size = n_par_rs * max_regions * sizeof(int); +} + +void OtherRegionsTable::shrink_from_card_cache(size_t new_n_regs) { + for (int i = 0; i < HeapRegionRemSet::num_par_rem_sets(); i++) { + assert(new_n_regs <= _from_card_cache_max_regions, "Must be within max."); + for (size_t j = new_n_regs; j < _from_card_cache_max_regions; j++) { + _from_card_cache[i][j] = -1; // An invalid value. + } + } +} + +#ifndef PRODUCT +void OtherRegionsTable::print_from_card_cache() { + for (int i = 0; i < HeapRegionRemSet::num_par_rem_sets(); i++) { + for (size_t j = 0; j < _from_card_cache_max_regions; j++) { + gclog_or_tty->print_cr("_from_card_cache[%d][%d] = %d.", + i, j, _from_card_cache[i][j]); + } + } +} +#endif + +void OtherRegionsTable::add_reference(oop* from, int tid) { + size_t cur_hrs_ind = hr()->hrs_index(); + +#if HRRS_VERBOSE + gclog_or_tty->print_cr("ORT::add_reference_work(" PTR_FORMAT "->" PTR_FORMAT ").", + from, *from); +#endif + + int from_card = (int)(uintptr_t(from) >> CardTableModRefBS::card_shift); + +#if HRRS_VERBOSE + gclog_or_tty->print_cr("Table for [" PTR_FORMAT "...): card %d (cache = %d)", + hr()->bottom(), from_card, + _from_card_cache[tid][cur_hrs_ind]); +#endif + +#define COUNT_CACHE 0 +#if COUNT_CACHE + jint p = Atomic::add(1, &_cache_probes); + if ((p % 10000) == 0) { + jint hits = _cache_hits; + gclog_or_tty->print_cr("%d/%d = %5.2f%% RS cache hits.", + _cache_hits, p, 100.0* (float)hits/(float)p); + } +#endif + if (from_card == _from_card_cache[tid][cur_hrs_ind]) { +#if HRRS_VERBOSE + gclog_or_tty->print_cr(" from-card cache hit."); +#endif +#if COUNT_CACHE + Atomic::inc(&_cache_hits); +#endif + assert(contains_reference(from), "We just added it!"); + return; + } else { + _from_card_cache[tid][cur_hrs_ind] = from_card; + } + + // Note that this may be a continued H region. + HeapRegion* from_hr = _g1h->heap_region_containing_raw(from); + size_t from_hrs_ind = (size_t)from_hr->hrs_index(); + + // If the region is already coarsened, return. + if (_coarse_map.at(from_hrs_ind)) { +#if HRRS_VERBOSE + gclog_or_tty->print_cr(" coarse map hit."); +#endif + assert(contains_reference(from), "We just added it!"); + return; + } + + // Otherwise find a per-region table to add it to. + size_t ind = from_hrs_ind & _mod_max_fine_entries_mask; + PosParPRT* prt = find_region_table(ind, from_hr); + if (prt == NULL) { + MutexLockerEx x(&_m, Mutex::_no_safepoint_check_flag); + // Confirm that it's really not there... + prt = find_region_table(ind, from_hr); + if (prt == NULL) { + + uintptr_t from_hr_bot_card_index = + uintptr_t(from_hr->bottom()) + >> CardTableModRefBS::card_shift; + int card_index = from_card - from_hr_bot_card_index; + assert(0 <= card_index && card_index < PosParPRT::CardsPerRegion, + "Must be in range."); + if (G1HRRSUseSparseTable && + _sparse_table.add_card((short) from_hrs_ind, card_index)) { + if (G1RecordHRRSOops) { + HeapRegionRemSet::record(hr(), from); +#if HRRS_VERBOSE + gclog_or_tty->print(" Added card " PTR_FORMAT " to region " + "[" PTR_FORMAT "...) for ref " PTR_FORMAT ".\n", + align_size_down(uintptr_t(from), + CardTableModRefBS::card_size), + hr()->bottom(), from); +#endif + } +#if HRRS_VERBOSE + gclog_or_tty->print_cr(" added card to sparse table."); +#endif + assert(contains_reference_locked(from), "We just added it!"); + return; + } else { +#if HRRS_VERBOSE + gclog_or_tty->print_cr(" [tid %d] sparse table entry " + "overflow(f: %d, t: %d)", + tid, from_hrs_ind, cur_hrs_ind); +#endif + } + + // Otherwise, transfer from sparse to fine-grain. + short cards[SparsePRTEntry::CardsPerEntry]; + if (G1HRRSUseSparseTable) { + bool res = _sparse_table.get_cards((short) from_hrs_ind, &cards[0]); + assert(res, "There should have been an entry"); + } + + if (_n_fine_entries == _max_fine_entries) { + prt = delete_region_table(); + } else { + prt = PosParPRT::alloc(from_hr); + } + prt->init(from_hr); + // Record the outgoing pointer in the from_region's outgoing bitmap. + from_hr->rem_set()->add_outgoing_reference(hr()); + + PosParPRT* first_prt = _fine_grain_regions[ind]; + prt->set_next(first_prt); // XXX Maybe move to init? + _fine_grain_regions[ind] = prt; + _n_fine_entries++; + + // Add in the cards from the sparse table. + if (G1HRRSUseSparseTable) { + for (int i = 0; i < SparsePRTEntry::CardsPerEntry; i++) { + short c = cards[i]; + if (c != SparsePRTEntry::NullEntry) { + prt->add_card(c); + } + } + // Now we can delete the sparse entry. + bool res = _sparse_table.delete_entry((short) from_hrs_ind); + assert(res, "It should have been there."); + } + } + assert(prt != NULL && prt->hr() == from_hr, "consequence"); + } + // Note that we can't assert "prt->hr() == from_hr", because of the + // possibility of concurrent reuse. But see head comment of + // OtherRegionsTable for why this is OK. + assert(prt != NULL, "Inv"); + + prt->add_reference(from, tid); + if (G1RecordHRRSOops) { + HeapRegionRemSet::record(hr(), from); +#if HRRS_VERBOSE + gclog_or_tty->print("Added card " PTR_FORMAT " to region " + "[" PTR_FORMAT "...) for ref " PTR_FORMAT ".\n", + align_size_down(uintptr_t(from), + CardTableModRefBS::card_size), + hr()->bottom(), from); +#endif + } + assert(contains_reference(from), "We just added it!"); +} + +PosParPRT* +OtherRegionsTable::find_region_table(size_t ind, HeapRegion* hr) const { + assert(0 <= ind && ind < _max_fine_entries, "Preconditions."); + PosParPRT* prt = _fine_grain_regions[ind]; + while (prt != NULL && prt->hr() != hr) { + prt = prt->next(); + } + // Loop postcondition is the method postcondition. + return prt; +} + + +#define DRT_CENSUS 0 + +#if DRT_CENSUS +static const int HistoSize = 6; +static int global_histo[HistoSize] = { 0, 0, 0, 0, 0, 0 }; +static int coarsenings = 0; +static int occ_sum = 0; +#endif + +jint OtherRegionsTable::_n_coarsenings = 0; + +PosParPRT* OtherRegionsTable::delete_region_table() { +#if DRT_CENSUS + int histo[HistoSize] = { 0, 0, 0, 0, 0, 0 }; + const int histo_limits[] = { 1, 4, 16, 64, 256, 2048 }; +#endif + + assert(_m.owned_by_self(), "Precondition"); + assert(_n_fine_entries == _max_fine_entries, "Precondition"); + PosParPRT* max = NULL; + jint max_occ = 0; + PosParPRT** max_prev; + size_t max_ind; + +#if SAMPLE_FOR_EVICTION + size_t i = _fine_eviction_start; + for (size_t k = 0; k < _fine_eviction_sample_size; k++) { + size_t ii = i; + // Make sure we get a non-NULL sample. + while (_fine_grain_regions[ii] == NULL) { + ii++; + if (ii == _max_fine_entries) ii = 0; + guarantee(ii != i, "We must find one."); + } + PosParPRT** prev = &_fine_grain_regions[ii]; + PosParPRT* cur = *prev; + while (cur != NULL) { + jint cur_occ = cur->occupied(); + if (max == NULL || cur_occ > max_occ) { + max = cur; + max_prev = prev; + max_ind = i; + max_occ = cur_occ; + } + prev = cur->next_addr(); + cur = cur->next(); + } + i = i + _fine_eviction_stride; + if (i >= _n_fine_entries) i = i - _n_fine_entries; + } + _fine_eviction_start++; + if (_fine_eviction_start >= _n_fine_entries) + _fine_eviction_start -= _n_fine_entries; +#else + for (int i = 0; i < _max_fine_entries; i++) { + PosParPRT** prev = &_fine_grain_regions[i]; + PosParPRT* cur = *prev; + while (cur != NULL) { + jint cur_occ = cur->occupied(); +#if DRT_CENSUS + for (int k = 0; k < HistoSize; k++) { + if (cur_occ <= histo_limits[k]) { + histo[k]++; global_histo[k]++; break; + } + } +#endif + if (max == NULL || cur_occ > max_occ) { + max = cur; + max_prev = prev; + max_ind = i; + max_occ = cur_occ; + } + prev = cur->next_addr(); + cur = cur->next(); + } + } +#endif + // XXX + guarantee(max != NULL, "Since _n_fine_entries > 0"); +#if DRT_CENSUS + gclog_or_tty->print_cr("In a coarsening: histo of occs:"); + for (int k = 0; k < HistoSize; k++) { + gclog_or_tty->print_cr(" <= %4d: %5d.", histo_limits[k], histo[k]); + } + coarsenings++; + occ_sum += max_occ; + if ((coarsenings % 100) == 0) { + gclog_or_tty->print_cr("\ncoarsenings = %d; global summary:", coarsenings); + for (int k = 0; k < HistoSize; k++) { + gclog_or_tty->print_cr(" <= %4d: %5d.", histo_limits[k], global_histo[k]); + } + gclog_or_tty->print_cr("Avg occ of deleted region = %6.2f.", + (float)occ_sum/(float)coarsenings); + } +#endif + + // Set the corresponding coarse bit. + int max_hrs_index = max->hr()->hrs_index(); + if (!_coarse_map.at(max_hrs_index)) { + _coarse_map.at_put(max_hrs_index, true); + _n_coarse_entries++; +#if 0 + gclog_or_tty->print("Coarsened entry in region [" PTR_FORMAT "...] " + "for region [" PTR_FORMAT "...] (%d coarse entries).\n", + hr()->bottom(), + max->hr()->bottom(), + _n_coarse_entries); +#endif + } + + // Unsplice. + *max_prev = max->next(); + Atomic::inc(&_n_coarsenings); + _n_fine_entries--; + return max; +} + + +// At present, this must be called stop-world single-threaded. +void OtherRegionsTable::scrub(CardTableModRefBS* ctbs, + BitMap* region_bm, BitMap* card_bm) { + // First eliminated garbage regions from the coarse map. + if (G1RSScrubVerbose) + gclog_or_tty->print_cr("Scrubbing region %d:", hr()->hrs_index()); + + assert(_coarse_map.size() == region_bm->size(), "Precondition"); + if (G1RSScrubVerbose) + gclog_or_tty->print(" Coarse map: before = %d...", _n_coarse_entries); + _coarse_map.set_intersection(*region_bm); + _n_coarse_entries = _coarse_map.count_one_bits(); + if (G1RSScrubVerbose) + gclog_or_tty->print_cr(" after = %d.", _n_coarse_entries); + + // Now do the fine-grained maps. + for (size_t i = 0; i < _max_fine_entries; i++) { + PosParPRT* cur = _fine_grain_regions[i]; + PosParPRT** prev = &_fine_grain_regions[i]; + while (cur != NULL) { + PosParPRT* nxt = cur->next(); + // If the entire region is dead, eliminate. + if (G1RSScrubVerbose) + gclog_or_tty->print_cr(" For other region %d:", cur->hr()->hrs_index()); + if (!region_bm->at(cur->hr()->hrs_index())) { + *prev = nxt; + cur->set_next(NULL); + _n_fine_entries--; + if (G1RSScrubVerbose) + gclog_or_tty->print_cr(" deleted via region map."); + PosParPRT::free(cur); + } else { + // Do fine-grain elimination. + if (G1RSScrubVerbose) + gclog_or_tty->print(" occ: before = %4d.", cur->occupied()); + cur->scrub(ctbs, card_bm); + if (G1RSScrubVerbose) + gclog_or_tty->print_cr(" after = %4d.", cur->occupied()); + // Did that empty the table completely? + if (cur->occupied() == 0) { + *prev = nxt; + cur->set_next(NULL); + _n_fine_entries--; + PosParPRT::free(cur); + } else { + prev = cur->next_addr(); + } + } + cur = nxt; + } + } + // Since we may have deleted a from_card_cache entry from the RS, clear + // the FCC. + clear_fcc(); +} + + +size_t OtherRegionsTable::occupied() const { + // Cast away const in this case. + MutexLockerEx x((Mutex*)&_m, Mutex::_no_safepoint_check_flag); + size_t sum = occ_fine(); + sum += occ_sparse(); + sum += occ_coarse(); + return sum; +} + +size_t OtherRegionsTable::occ_fine() const { + size_t sum = 0; + for (size_t i = 0; i < _max_fine_entries; i++) { + PosParPRT* cur = _fine_grain_regions[i]; + while (cur != NULL) { + sum += cur->occupied(); + cur = cur->next(); + } + } + return sum; +} + +size_t OtherRegionsTable::occ_coarse() const { + return (_n_coarse_entries * PosParPRT::CardsPerRegion); +} + +size_t OtherRegionsTable::occ_sparse() const { + return _sparse_table.occupied(); +} + +size_t OtherRegionsTable::mem_size() const { + // Cast away const in this case. + MutexLockerEx x((Mutex*)&_m, Mutex::_no_safepoint_check_flag); + size_t sum = 0; + for (size_t i = 0; i < _max_fine_entries; i++) { + PosParPRT* cur = _fine_grain_regions[i]; + while (cur != NULL) { + sum += cur->mem_size(); + cur = cur->next(); + } + } + sum += (sizeof(PosParPRT*) * _max_fine_entries); + sum += (_coarse_map.size_in_words() * HeapWordSize); + sum += (_sparse_table.mem_size()); + sum += sizeof(*this) - sizeof(_sparse_table); // Avoid double counting above. + return sum; +} + +size_t OtherRegionsTable::static_mem_size() { + return _from_card_cache_mem_size; +} + +size_t OtherRegionsTable::fl_mem_size() { + return PerRegionTable::fl_mem_size() + PosParPRT::fl_mem_size(); +} + +void OtherRegionsTable::clear_fcc() { + for (int i = 0; i < HeapRegionRemSet::num_par_rem_sets(); i++) { + _from_card_cache[i][hr()->hrs_index()] = -1; + } +} + +void OtherRegionsTable::clear() { + MutexLockerEx x(&_m, Mutex::_no_safepoint_check_flag); + for (size_t i = 0; i < _max_fine_entries; i++) { + PosParPRT* cur = _fine_grain_regions[i]; + while (cur != NULL) { + PosParPRT* nxt = cur->next(); + PosParPRT::free(cur); + cur = nxt; + } + _fine_grain_regions[i] = NULL; + } + _sparse_table.clear(); + _coarse_map.clear(); + _n_fine_entries = 0; + _n_coarse_entries = 0; + + clear_fcc(); +} + +void OtherRegionsTable::clear_incoming_entry(HeapRegion* from_hr) { + MutexLockerEx x(&_m, Mutex::_no_safepoint_check_flag); + size_t hrs_ind = (size_t)from_hr->hrs_index(); + size_t ind = hrs_ind & _mod_max_fine_entries_mask; + if (del_single_region_table(ind, from_hr)) { + assert(!_coarse_map.at(hrs_ind), "Inv"); + } else { + _coarse_map.par_at_put(hrs_ind, 0); + } + // Check to see if any of the fcc entries come from here. + int hr_ind = hr()->hrs_index(); + for (int tid = 0; tid < HeapRegionRemSet::num_par_rem_sets(); tid++) { + int fcc_ent = _from_card_cache[tid][hr_ind]; + if (fcc_ent != -1) { + HeapWord* card_addr = (HeapWord*) + (uintptr_t(fcc_ent) << CardTableModRefBS::card_shift); + if (hr()->is_in_reserved(card_addr)) { + // Clear the from card cache. + _from_card_cache[tid][hr_ind] = -1; + } + } + } +} + +bool OtherRegionsTable::del_single_region_table(size_t ind, + HeapRegion* hr) { + assert(0 <= ind && ind < _max_fine_entries, "Preconditions."); + PosParPRT** prev_addr = &_fine_grain_regions[ind]; + PosParPRT* prt = *prev_addr; + while (prt != NULL && prt->hr() != hr) { + prev_addr = prt->next_addr(); + prt = prt->next(); + } + if (prt != NULL) { + assert(prt->hr() == hr, "Loop postcondition."); + *prev_addr = prt->next(); + PosParPRT::free(prt); + _n_fine_entries--; + return true; + } else { + return false; + } +} + +bool OtherRegionsTable::contains_reference(oop* from) const { + // Cast away const in this case. + MutexLockerEx x((Mutex*)&_m, Mutex::_no_safepoint_check_flag); + return contains_reference_locked(from); +} + +bool OtherRegionsTable::contains_reference_locked(oop* from) const { + HeapRegion* hr = _g1h->heap_region_containing_raw(from); + if (hr == NULL) return false; + size_t hr_ind = hr->hrs_index(); + // Is this region in the coarse map? + if (_coarse_map.at(hr_ind)) return true; + + PosParPRT* prt = find_region_table(hr_ind & _mod_max_fine_entries_mask, + hr); + if (prt != NULL) { + return prt->contains_reference(from); + + } else { + uintptr_t from_card = + (uintptr_t(from) >> CardTableModRefBS::card_shift); + uintptr_t hr_bot_card_index = + uintptr_t(hr->bottom()) >> CardTableModRefBS::card_shift; + assert(from_card >= hr_bot_card_index, "Inv"); + int card_index = from_card - hr_bot_card_index; + return _sparse_table.contains_card((short)hr_ind, card_index); + } + + +} + + +bool HeapRegionRemSet::_par_traversal = false; + +void HeapRegionRemSet::set_par_traversal(bool b) { + assert(_par_traversal != b, "Proper alternation..."); + _par_traversal = b; +} + +int HeapRegionRemSet::num_par_rem_sets() { + // We always have at least two, so that a mutator thread can claim an + // id and add to a rem set. + return (int) MAX2(ParallelGCThreads, (size_t)2); +} + +HeapRegionRemSet::HeapRegionRemSet(G1BlockOffsetSharedArray* bosa, + HeapRegion* hr) + : _bosa(bosa), _other_regions(hr), + _outgoing_region_map(G1CollectedHeap::heap()->max_regions(), + false /* in-resource-area */), + _iter_state(Unclaimed) +{} + + +void HeapRegionRemSet::init_for_par_iteration() { + _iter_state = Unclaimed; +} + +bool HeapRegionRemSet::claim_iter() { + if (_iter_state != Unclaimed) return false; + jint res = Atomic::cmpxchg(Claimed, (jint*)(&_iter_state), Unclaimed); + return (res == Unclaimed); +} + +void HeapRegionRemSet::set_iter_complete() { + _iter_state = Complete; +} + +bool HeapRegionRemSet::iter_is_complete() { + return _iter_state == Complete; +} + + +void HeapRegionRemSet::init_iterator(HeapRegionRemSetIterator* iter) const { + iter->initialize(this); +} + +#ifndef PRODUCT +void HeapRegionRemSet::print() const { + HeapRegionRemSetIterator iter; + init_iterator(&iter); + size_t card_index; + while (iter.has_next(card_index)) { + HeapWord* card_start = + G1CollectedHeap::heap()->bot_shared()->address_for_index(card_index); + gclog_or_tty->print_cr(" Card " PTR_FORMAT ".", card_start); + } + // XXX + if (iter.n_yielded() != occupied()) { + gclog_or_tty->print_cr("Yielded disagrees with occupied:"); + gclog_or_tty->print_cr(" %6d yielded (%6d coarse, %6d fine).", + iter.n_yielded(), + iter.n_yielded_coarse(), iter.n_yielded_fine()); + gclog_or_tty->print_cr(" %6d occ (%6d coarse, %6d fine).", + occupied(), occ_coarse(), occ_fine()); + } + guarantee(iter.n_yielded() == occupied(), + "We should have yielded all the represented cards."); +} +#endif + +void HeapRegionRemSet::cleanup() { + SparsePRT::cleanup_all(); +} + +void HeapRegionRemSet::par_cleanup() { + PosParPRT::par_contract_all(); +} + +void HeapRegionRemSet::add_outgoing_reference(HeapRegion* to_hr) { + _outgoing_region_map.par_at_put(to_hr->hrs_index(), 1); +} + +void HeapRegionRemSet::clear() { + clear_outgoing_entries(); + _outgoing_region_map.clear(); + _other_regions.clear(); + assert(occupied() == 0, "Should be clear."); +} + +void HeapRegionRemSet::clear_outgoing_entries() { + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + size_t i = _outgoing_region_map.get_next_one_offset(0); + while (i < _outgoing_region_map.size()) { + HeapRegion* to_region = g1h->region_at(i); + to_region->rem_set()->clear_incoming_entry(hr()); + i = _outgoing_region_map.get_next_one_offset(i+1); + } +} + + +void HeapRegionRemSet::scrub(CardTableModRefBS* ctbs, + BitMap* region_bm, BitMap* card_bm) { + _other_regions.scrub(ctbs, region_bm, card_bm); +} + +//-------------------- Iteration -------------------- + +HeapRegionRemSetIterator:: +HeapRegionRemSetIterator() : + _hrrs(NULL), + _g1h(G1CollectedHeap::heap()), + _bosa(NULL), + _sparse_iter(size_t(G1CollectedHeap::heap()->reserved_region().start()) + >> CardTableModRefBS::card_shift) +{} + +void HeapRegionRemSetIterator::initialize(const HeapRegionRemSet* hrrs) { + _hrrs = hrrs; + _coarse_map = &_hrrs->_other_regions._coarse_map; + _fine_grain_regions = _hrrs->_other_regions._fine_grain_regions; + _bosa = _hrrs->bosa(); + + _is = Sparse; + // Set these values so that we increment to the first region. + _coarse_cur_region_index = -1; + _coarse_cur_region_cur_card = (PosParPRT::CardsPerRegion-1);; + + _cur_region_cur_card = 0; + + _fine_array_index = -1; + _fine_cur_prt = NULL; + + _n_yielded_coarse = 0; + _n_yielded_fine = 0; + _n_yielded_sparse = 0; + + _sparse_iter.init(&hrrs->_other_regions._sparse_table); +} + +bool HeapRegionRemSetIterator::coarse_has_next(size_t& card_index) { + if (_hrrs->_other_regions._n_coarse_entries == 0) return false; + // Go to the next card. + _coarse_cur_region_cur_card++; + // Was the last the last card in the current region? + if (_coarse_cur_region_cur_card == PosParPRT::CardsPerRegion) { + // Yes: find the next region. This may leave _coarse_cur_region_index + // Set to the last index, in which case there are no more coarse + // regions. + _coarse_cur_region_index = + (int) _coarse_map->get_next_one_offset(_coarse_cur_region_index + 1); + if ((size_t)_coarse_cur_region_index < _coarse_map->size()) { + _coarse_cur_region_cur_card = 0; + HeapWord* r_bot = + _g1h->region_at(_coarse_cur_region_index)->bottom(); + _cur_region_card_offset = _bosa->index_for(r_bot); + } else { + return false; + } + } + // If we didn't return false above, then we can yield a card. + card_index = _cur_region_card_offset + _coarse_cur_region_cur_card; + return true; +} + +void HeapRegionRemSetIterator::fine_find_next_non_null_prt() { + // Otherwise, find the next bucket list in the array. + _fine_array_index++; + while (_fine_array_index < (int) OtherRegionsTable::_max_fine_entries) { + _fine_cur_prt = _fine_grain_regions[_fine_array_index]; + if (_fine_cur_prt != NULL) return; + else _fine_array_index++; + } + assert(_fine_cur_prt == NULL, "Loop post"); +} + +bool HeapRegionRemSetIterator::fine_has_next(size_t& card_index) { + if (fine_has_next()) { + _cur_region_cur_card = + _fine_cur_prt->_bm.get_next_one_offset(_cur_region_cur_card + 1); + } + while (!fine_has_next()) { + if (_cur_region_cur_card == PosParPRT::CardsPerRegion) { + _cur_region_cur_card = 0; + _fine_cur_prt = _fine_cur_prt->next(); + } + if (_fine_cur_prt == NULL) { + fine_find_next_non_null_prt(); + if (_fine_cur_prt == NULL) return false; + } + assert(_fine_cur_prt != NULL && _cur_region_cur_card == 0, + "inv."); + HeapWord* r_bot = + _fine_cur_prt->hr()->bottom(); + _cur_region_card_offset = _bosa->index_for(r_bot); + _cur_region_cur_card = _fine_cur_prt->_bm.get_next_one_offset(0); + } + assert(fine_has_next(), "Or else we exited the loop via the return."); + card_index = _cur_region_card_offset + _cur_region_cur_card; + return true; +} + +bool HeapRegionRemSetIterator::fine_has_next() { + return + _fine_cur_prt != NULL && + _cur_region_cur_card < PosParPRT::CardsPerRegion; +} + +bool HeapRegionRemSetIterator::has_next(size_t& card_index) { + switch (_is) { + case Sparse: + if (_sparse_iter.has_next(card_index)) { + _n_yielded_sparse++; + return true; + } + // Otherwise, deliberate fall-through + _is = Fine; + case Fine: + if (fine_has_next(card_index)) { + _n_yielded_fine++; + return true; + } + // Otherwise, deliberate fall-through + _is = Coarse; + case Coarse: + if (coarse_has_next(card_index)) { + _n_yielded_coarse++; + return true; + } + // Otherwise... + break; + } + assert(ParallelGCThreads > 1 || + n_yielded() == _hrrs->occupied(), + "Should have yielded all the cards in the rem set " + "(in the non-par case)."); + return false; +} + + + +oop** HeapRegionRemSet::_recorded_oops = NULL; +HeapWord** HeapRegionRemSet::_recorded_cards = NULL; +HeapRegion** HeapRegionRemSet::_recorded_regions = NULL; +int HeapRegionRemSet::_n_recorded = 0; + +HeapRegionRemSet::Event* HeapRegionRemSet::_recorded_events = NULL; +int* HeapRegionRemSet::_recorded_event_index = NULL; +int HeapRegionRemSet::_n_recorded_events = 0; + +void HeapRegionRemSet::record(HeapRegion* hr, oop* f) { + if (_recorded_oops == NULL) { + assert(_n_recorded == 0 + && _recorded_cards == NULL + && _recorded_regions == NULL, + "Inv"); + _recorded_oops = NEW_C_HEAP_ARRAY(oop*, MaxRecorded); + _recorded_cards = NEW_C_HEAP_ARRAY(HeapWord*, MaxRecorded); + _recorded_regions = NEW_C_HEAP_ARRAY(HeapRegion*, MaxRecorded); + } + if (_n_recorded == MaxRecorded) { + gclog_or_tty->print_cr("Filled up 'recorded' (%d).", MaxRecorded); + } else { + _recorded_cards[_n_recorded] = + (HeapWord*)align_size_down(uintptr_t(f), + CardTableModRefBS::card_size); + _recorded_oops[_n_recorded] = f; + _recorded_regions[_n_recorded] = hr; + _n_recorded++; + } +} + +void HeapRegionRemSet::record_event(Event evnt) { + if (!G1RecordHRRSEvents) return; + + if (_recorded_events == NULL) { + assert(_n_recorded_events == 0 + && _recorded_event_index == NULL, + "Inv"); + _recorded_events = NEW_C_HEAP_ARRAY(Event, MaxRecordedEvents); + _recorded_event_index = NEW_C_HEAP_ARRAY(int, MaxRecordedEvents); + } + if (_n_recorded_events == MaxRecordedEvents) { + gclog_or_tty->print_cr("Filled up 'recorded_events' (%d).", MaxRecordedEvents); + } else { + _recorded_events[_n_recorded_events] = evnt; + _recorded_event_index[_n_recorded_events] = _n_recorded; + _n_recorded_events++; + } +} + +void HeapRegionRemSet::print_event(outputStream* str, Event evnt) { + switch (evnt) { + case Event_EvacStart: + str->print("Evac Start"); + break; + case Event_EvacEnd: + str->print("Evac End"); + break; + case Event_RSUpdateEnd: + str->print("RS Update End"); + break; + } +} + +void HeapRegionRemSet::print_recorded() { + int cur_evnt = 0; + Event cur_evnt_kind; + int cur_evnt_ind = 0; + if (_n_recorded_events > 0) { + cur_evnt_kind = _recorded_events[cur_evnt]; + cur_evnt_ind = _recorded_event_index[cur_evnt]; + } + + for (int i = 0; i < _n_recorded; i++) { + while (cur_evnt < _n_recorded_events && i == cur_evnt_ind) { + gclog_or_tty->print("Event: "); + print_event(gclog_or_tty, cur_evnt_kind); + gclog_or_tty->print_cr(""); + cur_evnt++; + if (cur_evnt < MaxRecordedEvents) { + cur_evnt_kind = _recorded_events[cur_evnt]; + cur_evnt_ind = _recorded_event_index[cur_evnt]; + } + } + gclog_or_tty->print("Added card " PTR_FORMAT " to region [" PTR_FORMAT "...]" + " for ref " PTR_FORMAT ".\n", + _recorded_cards[i], _recorded_regions[i]->bottom(), + _recorded_oops[i]); + } +} + +#ifndef PRODUCT +void HeapRegionRemSet::test() { + os::sleep(Thread::current(), (jlong)5000, false); + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + + // Run with "-XX:G1LogRSRegionEntries=2", so that 1 and 5 end up in same + // hash bucket. + HeapRegion* hr0 = g1h->region_at(0); + HeapRegion* hr1 = g1h->region_at(1); + HeapRegion* hr2 = g1h->region_at(5); + HeapRegion* hr3 = g1h->region_at(6); + HeapRegion* hr4 = g1h->region_at(7); + HeapRegion* hr5 = g1h->region_at(8); + + HeapWord* hr1_start = hr1->bottom(); + HeapWord* hr1_mid = hr1_start + HeapRegion::GrainWords/2; + HeapWord* hr1_last = hr1->end() - 1; + + HeapWord* hr2_start = hr2->bottom(); + HeapWord* hr2_mid = hr2_start + HeapRegion::GrainWords/2; + HeapWord* hr2_last = hr2->end() - 1; + + HeapWord* hr3_start = hr3->bottom(); + HeapWord* hr3_mid = hr3_start + HeapRegion::GrainWords/2; + HeapWord* hr3_last = hr3->end() - 1; + + HeapRegionRemSet* hrrs = hr0->rem_set(); + + // Make three references from region 0x101... + hrrs->add_reference((oop*)hr1_start); + hrrs->add_reference((oop*)hr1_mid); + hrrs->add_reference((oop*)hr1_last); + + hrrs->add_reference((oop*)hr2_start); + hrrs->add_reference((oop*)hr2_mid); + hrrs->add_reference((oop*)hr2_last); + + hrrs->add_reference((oop*)hr3_start); + hrrs->add_reference((oop*)hr3_mid); + hrrs->add_reference((oop*)hr3_last); + + // Now cause a coarsening. + hrrs->add_reference((oop*)hr4->bottom()); + hrrs->add_reference((oop*)hr5->bottom()); + + // Now, does iteration yield these three? + HeapRegionRemSetIterator iter; + hrrs->init_iterator(&iter); + size_t sum = 0; + size_t card_index; + while (iter.has_next(card_index)) { + HeapWord* card_start = + G1CollectedHeap::heap()->bot_shared()->address_for_index(card_index); + gclog_or_tty->print_cr(" Card " PTR_FORMAT ".", card_start); + sum++; + } + guarantee(sum == 11 - 3 + 2048, "Failure"); + guarantee(sum == hrrs->occupied(), "Failure"); +} +#endif diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp new file mode 100644 index 00000000000..bad558a6c46 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp @@ -0,0 +1,470 @@ +/* + * Copyright 2001-2007 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. + * + */ + +// Remembered set for a heap region. Represent a set of "cards" that +// contain pointers into the owner heap region. Cards are defined somewhat +// abstractly, in terms of what the "BlockOffsetTable" in use can parse. + +class G1CollectedHeap; +class G1BlockOffsetSharedArray; +class HeapRegion; +class HeapRegionRemSetIterator; +class PosParPRT; +class SparsePRT; + + +// The "_coarse_map" is a bitmap with one bit for each region, where set +// bits indicate that the corresponding region may contain some pointer +// into the owning region. + +// The "_fine_grain_entries" array is an open hash table of PerRegionTables +// (PRTs), indicating regions for which we're keeping the RS as a set of +// cards. The strategy is to cap the size of the fine-grain table, +// deleting an entry and setting the corresponding coarse-grained bit when +// we would overflow this cap. + +// We use a mixture of locking and lock-free techniques here. We allow +// threads to locate PRTs without locking, but threads attempting to alter +// a bucket list obtain a lock. This means that any failing attempt to +// find a PRT must be retried with the lock. It might seem dangerous that +// a read can find a PRT that is concurrently deleted. This is all right, +// because: +// +// 1) We only actually free PRT's at safe points (though we reuse them at +// other times). +// 2) We find PRT's in an attempt to add entries. If a PRT is deleted, +// it's _coarse_map bit is set, so the that we were attempting to add +// is represented. If a deleted PRT is re-used, a thread adding a bit, +// thinking the PRT is for a different region, does no harm. + +class OtherRegionsTable: public CHeapObj { + friend class HeapRegionRemSetIterator; + + G1CollectedHeap* _g1h; + Mutex _m; + HeapRegion* _hr; + + // These are protected by "_m". + BitMap _coarse_map; + size_t _n_coarse_entries; + static jint _n_coarsenings; + + PosParPRT** _fine_grain_regions; + size_t _n_fine_entries; + +#define SAMPLE_FOR_EVICTION 1 +#if SAMPLE_FOR_EVICTION + size_t _fine_eviction_start; + static size_t _fine_eviction_stride; + static size_t _fine_eviction_sample_size; +#endif + + SparsePRT _sparse_table; + + // These are static after init. + static size_t _max_fine_entries; + static size_t _mod_max_fine_entries_mask; + + // Requires "prt" to be the first element of the bucket list appropriate + // for "hr". If this list contains an entry for "hr", return it, + // otherwise return "NULL". + PosParPRT* find_region_table(size_t ind, HeapRegion* hr) const; + + // Find, delete, and return a candidate PosParPRT, if any exists, + // adding the deleted region to the coarse bitmap. Requires the caller + // to hold _m, and the fine-grain table to be full. + PosParPRT* delete_region_table(); + + // If a PRT for "hr" is in the bucket list indicated by "ind" (which must + // be the correct index for "hr"), delete it and return true; else return + // false. + bool del_single_region_table(size_t ind, HeapRegion* hr); + + static jint _cache_probes; + static jint _cache_hits; + + // Indexed by thread X heap region, to minimize thread contention. + static int** _from_card_cache; + static size_t _from_card_cache_max_regions; + static size_t _from_card_cache_mem_size; + +public: + OtherRegionsTable(HeapRegion* hr); + + HeapRegion* hr() const { return _hr; } + + // For now. Could "expand" some tables in the future, so that this made + // sense. + void add_reference(oop* from, int tid); + + void add_reference(oop* from) { + return add_reference(from, 0); + } + + // Removes any entries shown by the given bitmaps to contain only dead + // objects. + void scrub(CardTableModRefBS* ctbs, BitMap* region_bm, BitMap* card_bm); + + // Not const because it takes a lock. + size_t occupied() const; + size_t occ_fine() const; + size_t occ_coarse() const; + size_t occ_sparse() const; + + static jint n_coarsenings() { return _n_coarsenings; } + + // Returns size in bytes. + // Not const because it takes a lock. + size_t mem_size() const; + static size_t static_mem_size(); + static size_t fl_mem_size(); + + bool contains_reference(oop* from) const; + bool contains_reference_locked(oop* from) const; + + void clear(); + + // Specifically clear the from_card_cache. + void clear_fcc(); + + // "from_hr" is being cleared; remove any entries from it. + void clear_incoming_entry(HeapRegion* from_hr); + + // Declare the heap size (in # of regions) to the OtherRegionsTable. + // (Uses it to initialize from_card_cache). + static void init_from_card_cache(size_t max_regions); + + // Declares that only regions i s.t. 0 <= i < new_n_regs are in use. + // Make sure any entries for higher regions are invalid. + static void shrink_from_card_cache(size_t new_n_regs); + + static void print_from_card_cache(); + +}; + + +class HeapRegionRemSet : public CHeapObj { + friend class VMStructs; + friend class HeapRegionRemSetIterator; + +public: + enum Event { + Event_EvacStart, Event_EvacEnd, Event_RSUpdateEnd + }; + +private: + G1BlockOffsetSharedArray* _bosa; + G1BlockOffsetSharedArray* bosa() const { return _bosa; } + + static bool _par_traversal; + + OtherRegionsTable _other_regions; + + // One set bit for every region that has an entry for this one. + BitMap _outgoing_region_map; + + // Clear entries for the current region in any rem sets named in + // the _outgoing_region_map. + void clear_outgoing_entries(); + +#if MAYBE + // Audit the given card index. + void audit_card(size_t card_num, HeapRegion* hr, u2* rc_arr, + HeapRegionRemSet* empty_cards, size_t* one_obj_cards); + + // Assumes that "audit_stage1" has been called for "hr", to set up + // "shadow" and "new_rs" appropriately. Identifies individual popular + // objects; returns "true" if any are found. + bool audit_find_pop(HeapRegion* hr, u2* rc_arr); + + // Assumes that "audit_stage1" has been called for "hr", to set up + // "shadow" and "new_rs" appropriately. Identifies individual popular + // objects, and determines the number of entries in "new_rs" if any such + // popular objects are ignored. If this is sufficiently small, returns + // "false" to indicate that a constraint should not be introduced. + // Otherwise, returns "true" to indicate that we should go ahead with + // adding the constraint. + bool audit_stag(HeapRegion* hr, u2* rc_arr); + + + u2* alloc_rc_array(); + + SeqHeapRegionRemSet* audit_post(u2* rc_arr, size_t multi_obj_crds, + SeqHeapRegionRemSet* empty_cards); +#endif + + enum ParIterState { Unclaimed, Claimed, Complete }; + ParIterState _iter_state; + + // Unused unless G1RecordHRRSOops is true. + + static const int MaxRecorded = 1000000; + static oop** _recorded_oops; + static HeapWord** _recorded_cards; + static HeapRegion** _recorded_regions; + static int _n_recorded; + + static const int MaxRecordedEvents = 1000; + static Event* _recorded_events; + static int* _recorded_event_index; + static int _n_recorded_events; + + static void print_event(outputStream* str, Event evnt); + +public: + HeapRegionRemSet(G1BlockOffsetSharedArray* bosa, + HeapRegion* hr); + + static int num_par_rem_sets(); + static bool par_traversal() { return _par_traversal; } + static void set_par_traversal(bool b); + + HeapRegion* hr() const { + return _other_regions.hr(); + } + + size_t occupied() const { + return _other_regions.occupied(); + } + size_t occ_fine() const { + return _other_regions.occ_fine(); + } + size_t occ_coarse() const { + return _other_regions.occ_coarse(); + } + size_t occ_sparse() const { + return _other_regions.occ_sparse(); + } + + static jint n_coarsenings() { return OtherRegionsTable::n_coarsenings(); } + + /* Used in the sequential case. Returns "true" iff this addition causes + the size limit to be reached. */ + bool add_reference(oop* from) { + _other_regions.add_reference(from); + return false; + } + + /* Used in the parallel case. Returns "true" iff this addition causes + the size limit to be reached. */ + bool add_reference(oop* from, int tid) { + _other_regions.add_reference(from, tid); + return false; + } + + // Records the fact that the current region contains an outgoing + // reference into "to_hr". + void add_outgoing_reference(HeapRegion* to_hr); + + // Removes any entries shown by the given bitmaps to contain only dead + // objects. + void scrub(CardTableModRefBS* ctbs, BitMap* region_bm, BitMap* card_bm); + + // The region is being reclaimed; clear its remset, and any mention of + // entries for this region in other remsets. + void clear(); + + // Forget any entries due to pointers from "from_hr". + void clear_incoming_entry(HeapRegion* from_hr) { + _other_regions.clear_incoming_entry(from_hr); + } + +#if 0 + virtual void cleanup() = 0; +#endif + + // Should be called from single-threaded code. + void init_for_par_iteration(); + // Attempt to claim the region. Returns true iff this call caused an + // atomic transition from Unclaimed to Claimed. + bool claim_iter(); + // Sets the iteration state to "complete". + void set_iter_complete(); + // Returns "true" iff the region's iteration is complete. + bool iter_is_complete(); + + // Initialize the given iterator to iterate over this rem set. + void init_iterator(HeapRegionRemSetIterator* iter) const; + +#if 0 + // Apply the "do_card" method to the start address of every card in the + // rem set. Returns false if some application of the closure aborted. + virtual bool card_iterate(CardClosure* iter) = 0; +#endif + + // The actual # of bytes this hr_remset takes up. + size_t mem_size() { + return _other_regions.mem_size() + // This correction is necessary because the above includes the second + // part. + + sizeof(this) - sizeof(OtherRegionsTable); + } + + // Returns the memory occupancy of all static data structures associated + // with remembered sets. + static size_t static_mem_size() { + return OtherRegionsTable::static_mem_size(); + } + + // Returns the memory occupancy of all free_list data structures associated + // with remembered sets. + static size_t fl_mem_size() { + return OtherRegionsTable::fl_mem_size(); + } + + bool contains_reference(oop* from) const { + return _other_regions.contains_reference(from); + } + void print() const; + +#if MAYBE + // We are about to introduce a constraint, requiring the collection time + // of the region owning this RS to be <= "hr", and forgetting pointers + // from the owning region to "hr." Before doing so, examines this rem + // set for pointers to "hr", possibly identifying some popular objects., + // and possibly finding some cards to no longer contain pointers to "hr", + // + // These steps may prevent the the constraint from being necessary; in + // which case returns a set of cards now thought to contain no pointers + // into HR. In the normal (I assume) case, returns NULL, indicating that + // we should go ahead and add the constraint. + virtual SeqHeapRegionRemSet* audit(HeapRegion* hr) = 0; +#endif + + // Called during a stop-world phase to perform any deferred cleanups. + // The second version may be called by parallel threads after then finish + // collection work. + static void cleanup(); + static void par_cleanup(); + + // Declare the heap size (in # of regions) to the HeapRegionRemSet(s). + // (Uses it to initialize from_card_cache). + static void init_heap(size_t max_regions) { + OtherRegionsTable::init_from_card_cache(max_regions); + } + + // Declares that only regions i s.t. 0 <= i < new_n_regs are in use. + static void shrink_heap(size_t new_n_regs) { + OtherRegionsTable::shrink_from_card_cache(new_n_regs); + } + +#ifndef PRODUCT + static void print_from_card_cache() { + OtherRegionsTable::print_from_card_cache(); + } +#endif + + static void record(HeapRegion* hr, oop* f); + static void print_recorded(); + static void record_event(Event evnt); + + // Run unit tests. +#ifndef PRODUCT + static void test(); +#endif + +}; + +class HeapRegionRemSetIterator : public CHeapObj { + + // The region over which we're iterating. + const HeapRegionRemSet* _hrrs; + + // Local caching of HRRS fields. + const BitMap* _coarse_map; + PosParPRT** _fine_grain_regions; + + G1BlockOffsetSharedArray* _bosa; + G1CollectedHeap* _g1h; + + // The number yielded since initialization. + size_t _n_yielded_fine; + size_t _n_yielded_coarse; + size_t _n_yielded_sparse; + + // If true we're iterating over the coarse table; if false the fine + // table. + enum IterState { + Sparse, + Fine, + Coarse + }; + IterState _is; + + // In both kinds of iteration, heap offset of first card of current + // region. + size_t _cur_region_card_offset; + // Card offset within cur region. + size_t _cur_region_cur_card; + + // Coarse table iteration fields: + + // Current region index; + int _coarse_cur_region_index; + int _coarse_cur_region_cur_card; + + bool coarse_has_next(size_t& card_index); + + // Fine table iteration fields: + + // Index of bucket-list we're working on. + int _fine_array_index; + // Per Region Table we're doing within current bucket list. + PosParPRT* _fine_cur_prt; + + /* SparsePRT::*/ SparsePRTIter _sparse_iter; + + void fine_find_next_non_null_prt(); + + bool fine_has_next(); + bool fine_has_next(size_t& card_index); + +public: + // We require an iterator to be initialized before use, so the + // constructor does little. + HeapRegionRemSetIterator(); + + void initialize(const HeapRegionRemSet* hrrs); + + // If there remains one or more cards to be yielded, returns true and + // sets "card_index" to one of those cards (which is then considered + // yielded.) Otherwise, returns false (and leaves "card_index" + // undefined.) + bool has_next(size_t& card_index); + + size_t n_yielded_fine() { return _n_yielded_fine; } + size_t n_yielded_coarse() { return _n_yielded_coarse; } + size_t n_yielded_sparse() { return _n_yielded_sparse; } + size_t n_yielded() { + return n_yielded_fine() + n_yielded_coarse() + n_yielded_sparse(); + } +}; + +#if 0 +class CardClosure: public Closure { +public: + virtual void do_card(HeapWord* card_start) = 0; +}; + +#endif diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp new file mode 100644 index 00000000000..5be6ab2b3bb --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp @@ -0,0 +1,344 @@ +/* + * Copyright 2001-2007 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. + * + */ + +#include "incls/_precompiled.incl" +#include "incls/_heapRegionSeq.cpp.incl" + +// Local to this file. + +static int orderRegions(HeapRegion** hr1p, HeapRegion** hr2p) { + if ((*hr1p)->end() <= (*hr2p)->bottom()) return -1; + else if ((*hr2p)->end() <= (*hr1p)->bottom()) return 1; + else if (*hr1p == *hr2p) return 0; + else { + assert(false, "We should never compare distinct overlapping regions."); + } + return 0; +} + +HeapRegionSeq::HeapRegionSeq() : + _alloc_search_start(0), + // The line below is the worst bit of C++ hackery I've ever written + // (Detlefs, 11/23). You should think of it as equivalent to + // "_regions(100, true)": initialize the growable array and inform it + // that it should allocate its elem array(s) on the C heap. The first + // argument, however, is actually a comma expression (new-expr, 100). + // The purpose of the new_expr is to inform the growable array that it + // is *already* allocated on the C heap: it uses the placement syntax to + // keep it from actually doing any allocation. + _regions((ResourceObj::operator new (sizeof(GrowableArray), + (void*)&_regions, + ResourceObj::C_HEAP), + 100), + true), + _next_rr_candidate(0), + _seq_bottom(NULL) +{} + +// Private methods. + +HeapWord* +HeapRegionSeq::alloc_obj_from_region_index(int ind, size_t word_size) { + assert(G1CollectedHeap::isHumongous(word_size), + "Allocation size should be humongous"); + int cur = ind; + int first = cur; + size_t sumSizes = 0; + while (cur < _regions.length() && sumSizes < word_size) { + // Loop invariant: + // For all i in [first, cur): + // _regions.at(i)->is_empty() + // && _regions.at(i) is contiguous with its predecessor, if any + // && sumSizes is the sum of the sizes of the regions in the interval + // [first, cur) + HeapRegion* curhr = _regions.at(cur); + if (curhr->is_empty() + && !curhr->is_reserved() + && (first == cur + || (_regions.at(cur-1)->end() == + curhr->bottom()))) { + sumSizes += curhr->capacity() / HeapWordSize; + } else { + first = cur + 1; + sumSizes = 0; + } + cur++; + } + if (sumSizes >= word_size) { + _alloc_search_start = cur; + // Mark the allocated regions as allocated. + bool zf = G1CollectedHeap::heap()->allocs_are_zero_filled(); + HeapRegion* first_hr = _regions.at(first); + for (int i = first; i < cur; i++) { + HeapRegion* hr = _regions.at(i); + if (zf) + hr->ensure_zero_filled(); + { + MutexLockerEx x(ZF_mon, Mutex::_no_safepoint_check_flag); + hr->set_zero_fill_allocated(); + } + size_t sz = hr->capacity() / HeapWordSize; + HeapWord* tmp = hr->allocate(sz); + assert(tmp != NULL, "Humongous allocation failure"); + MemRegion mr = MemRegion(tmp, sz); + SharedHeap::fill_region_with_object(mr); + hr->declare_filled_region_to_BOT(mr); + if (i == first) { + first_hr->set_startsHumongous(); + } else { + assert(i > first, "sanity"); + hr->set_continuesHumongous(first_hr); + } + } + HeapWord* first_hr_bot = first_hr->bottom(); + HeapWord* obj_end = first_hr_bot + word_size; + first_hr->set_top(obj_end); + return first_hr_bot; + } else { + // If we started from the beginning, we want to know why we can't alloc. + return NULL; + } +} + +void HeapRegionSeq::print_empty_runs(bool reserved_are_empty) { + int empty_run = 0; + int n_empty = 0; + bool at_least_one_reserved = false; + int empty_run_start; + for (int i = 0; i < _regions.length(); i++) { + HeapRegion* r = _regions.at(i); + if (r->continuesHumongous()) continue; + if (r->is_empty() && (reserved_are_empty || !r->is_reserved())) { + assert(!r->isHumongous(), "H regions should not be empty."); + if (empty_run == 0) empty_run_start = i; + empty_run++; + n_empty++; + if (r->is_reserved()) { + at_least_one_reserved = true; + } + } else { + if (empty_run > 0) { + gclog_or_tty->print(" %d:%d", empty_run_start, empty_run); + if (reserved_are_empty && at_least_one_reserved) + gclog_or_tty->print("(R)"); + empty_run = 0; + at_least_one_reserved = false; + } + } + } + if (empty_run > 0) { + gclog_or_tty->print(" %d:%d", empty_run_start, empty_run); + if (reserved_are_empty && at_least_one_reserved) gclog_or_tty->print("(R)"); + } + gclog_or_tty->print_cr(" [tot = %d]", n_empty); +} + +int HeapRegionSeq::find(HeapRegion* hr) { + // FIXME: optimized for adjacent regions of fixed size. + int ind = hr->hrs_index(); + if (ind != -1) { + assert(_regions.at(ind) == hr, "Mismatch"); + } + return ind; +} + + +// Public methods. + +void HeapRegionSeq::insert(HeapRegion* hr) { + if (_regions.length() == 0 + || _regions.top()->end() <= hr->bottom()) { + hr->set_hrs_index(_regions.length()); + _regions.append(hr); + } else { + _regions.append(hr); + _regions.sort(orderRegions); + for (int i = 0; i < _regions.length(); i++) { + _regions.at(i)->set_hrs_index(i); + } + } + char* bot = (char*)_regions.at(0)->bottom(); + if (_seq_bottom == NULL || bot < _seq_bottom) _seq_bottom = bot; +} + +size_t HeapRegionSeq::length() { + return _regions.length(); +} + +size_t HeapRegionSeq::free_suffix() { + size_t res = 0; + int first = _regions.length() - 1; + int cur = first; + while (cur >= 0 && + (_regions.at(cur)->is_empty() + && !_regions.at(cur)->is_reserved() + && (first == cur + || (_regions.at(cur+1)->bottom() == + _regions.at(cur)->end())))) { + res++; + cur--; + } + return res; +} + +HeapWord* HeapRegionSeq::obj_allocate(size_t word_size) { + int cur = _alloc_search_start; + // Make sure "cur" is a valid index. + assert(cur >= 0, "Invariant."); + HeapWord* res = alloc_obj_from_region_index(cur, word_size); + if (res == NULL) + res = alloc_obj_from_region_index(0, word_size); + return res; +} + +void HeapRegionSeq::iterate(HeapRegionClosure* blk) { + iterate_from((HeapRegion*)NULL, blk); +} + +// The first argument r is the heap region at which iteration begins. +// This operation runs fastest when r is NULL, or the heap region for +// which a HeapRegionClosure most recently returned true, or the +// heap region immediately to its right in the sequence. In all +// other cases a linear search is required to find the index of r. + +void HeapRegionSeq::iterate_from(HeapRegion* r, HeapRegionClosure* blk) { + + // :::: FIXME :::: + // Static cache value is bad, especially when we start doing parallel + // remembered set update. For now just don't cache anything (the + // code in the def'd out blocks). + +#if 0 + static int cached_j = 0; +#endif + int len = _regions.length(); + int j = 0; + // Find the index of r. + if (r != NULL) { +#if 0 + assert(cached_j >= 0, "Invariant."); + if ((cached_j < len) && (r == _regions.at(cached_j))) { + j = cached_j; + } else if ((cached_j + 1 < len) && (r == _regions.at(cached_j + 1))) { + j = cached_j + 1; + } else { + j = find(r); +#endif + if (j < 0) { + j = 0; + } +#if 0 + } +#endif + } + int i; + for (i = j; i < len; i += 1) { + int res = blk->doHeapRegion(_regions.at(i)); + if (res) { +#if 0 + cached_j = i; +#endif + blk->incomplete(); + return; + } + } + for (i = 0; i < j; i += 1) { + int res = blk->doHeapRegion(_regions.at(i)); + if (res) { +#if 0 + cached_j = i; +#endif + blk->incomplete(); + return; + } + } +} + +void HeapRegionSeq::iterate_from(int idx, HeapRegionClosure* blk) { + int len = _regions.length(); + int i; + for (i = idx; i < len; i++) { + if (blk->doHeapRegion(_regions.at(i))) { + blk->incomplete(); + return; + } + } + for (i = 0; i < idx; i++) { + if (blk->doHeapRegion(_regions.at(i))) { + blk->incomplete(); + return; + } + } +} + +MemRegion HeapRegionSeq::shrink_by(size_t shrink_bytes, + size_t& num_regions_deleted) { + assert(shrink_bytes % os::vm_page_size() == 0, "unaligned"); + assert(shrink_bytes % HeapRegion::GrainBytes == 0, "unaligned"); + + if (_regions.length() == 0) { + num_regions_deleted = 0; + return MemRegion(); + } + int j = _regions.length() - 1; + HeapWord* end = _regions.at(j)->end(); + HeapWord* last_start = end; + while (j >= 0 && shrink_bytes > 0) { + HeapRegion* cur = _regions.at(j); + // We have to leave humongous regions where they are, + // and work around them. + if (cur->isHumongous()) { + return MemRegion(last_start, end); + } + cur->reset_zero_fill(); + assert(cur == _regions.top(), "Should be top"); + if (!cur->is_empty()) break; + shrink_bytes -= cur->capacity(); + num_regions_deleted++; + _regions.pop(); + last_start = cur->bottom(); + // We need to delete these somehow, but can't currently do so here: if + // we do, the ZF thread may still access the deleted region. We'll + // leave this here as a reminder that we have to do something about + // this. + // delete cur; + j--; + } + return MemRegion(last_start, end); +} + + +class PrintHeapRegionClosure : public HeapRegionClosure { +public: + bool doHeapRegion(HeapRegion* r) { + gclog_or_tty->print(PTR_FORMAT ":", r); + r->print(); + return false; + } +}; + +void HeapRegionSeq::print() { + PrintHeapRegionClosure cl; + iterate(&cl); +} diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.hpp new file mode 100644 index 00000000000..ec930f9b28d --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.hpp @@ -0,0 +1,111 @@ +/* + * Copyright 2001-2007 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. + * + */ + +class HeapRegion; +class HeapRegionClosure; + +class HeapRegionSeq: public CHeapObj { + + // _regions is kept sorted by start address order, and no two regions are + // overlapping. + GrowableArray _regions; + + // The index in "_regions" at which to start the next allocation search. + // (For efficiency only; private to obj_allocate after initialization.) + int _alloc_search_start; + + // Attempts to allocate a block of the (assumed humongous) word_size, + // starting at the region "ind". + HeapWord* alloc_obj_from_region_index(int ind, size_t word_size); + + // Currently, we're choosing collection sets in a round-robin fashion, + // starting here. + int _next_rr_candidate; + + // The bottom address of the bottom-most region, or else NULL if there + // are no regions in the sequence. + char* _seq_bottom; + + public: + // Initializes "this" to the empty sequence of regions. + HeapRegionSeq(); + + // Adds "hr" to "this" sequence. Requires "hr" not to overlap with + // any region already in "this". (Will perform better if regions are + // inserted in ascending address order.) + void insert(HeapRegion* hr); + + // Given a HeapRegion*, returns its index within _regions, + // or returns -1 if not found. + int find(HeapRegion* hr); + + // Requires the index to be valid, and return the region at the index. + HeapRegion* at(size_t i) { return _regions.at((int)i); } + + // Return the number of regions in the sequence. + size_t length(); + + // Returns the number of contiguous regions at the end of the sequence + // that are available for allocation. + size_t free_suffix(); + + // Requires "word_size" to be humongous (in the technical sense). If + // possible, allocates a contiguous subsequence of the heap regions to + // satisfy the allocation, and returns the address of the beginning of + // that sequence, otherwise returns NULL. + HeapWord* obj_allocate(size_t word_size); + + // Apply the "doHeapRegion" method of "blk" to all regions in "this", + // in address order, terminating the iteration early + // if the "doHeapRegion" method returns "true". + void iterate(HeapRegionClosure* blk); + + // Apply the "doHeapRegion" method of "blk" to all regions in "this", + // starting at "r" (or first region, if "r" is NULL), in a circular + // manner, terminating the iteration early if the "doHeapRegion" method + // returns "true". + void iterate_from(HeapRegion* r, HeapRegionClosure* blk); + + // As above, but start from a given index in the sequence + // instead of a given heap region. + void iterate_from(int idx, HeapRegionClosure* blk); + + // Requires "shrink_bytes" to be a multiple of the page size and heap + // region granularity. Deletes as many "rightmost" completely free heap + // regions from the sequence as comprise shrink_bytes bytes. Returns the + // MemRegion indicating the region those regions comprised, and sets + // "num_regions_deleted" to the number of regions deleted. + MemRegion shrink_by(size_t shrink_bytes, size_t& num_regions_deleted); + + // If "addr" falls within a region in the sequence, return that region, + // or else NULL. + HeapRegion* addr_to_region(const void* addr); + + void print(); + + // Prints out runs of empty regions. If the arg is "true" reserved + // (popular regions are considered "empty". + void print_empty_runs(bool reserved_are_empty); + +}; diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.inline.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.inline.hpp new file mode 100644 index 00000000000..31f89d1440c --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.inline.hpp @@ -0,0 +1,40 @@ +/* + * Copyright 2001-2007 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. + * + */ + +inline HeapRegion* HeapRegionSeq::addr_to_region(const void* addr) { + assert(_seq_bottom != NULL, "bad _seq_bottom in addr_to_region"); + if ((char*) addr >= _seq_bottom) { + size_t diff = (size_t) pointer_delta((HeapWord*) addr, + (HeapWord*) _seq_bottom); + int index = (int) (diff >> HeapRegion::LogOfHRGrainWords); + assert(index >= 0, "invariant / paranoia"); + if (index < _regions.length()) { + HeapRegion* hr = _regions.at(index); + assert(hr->is_in_reserved(addr), + "addr_to_region is wrong..."); + return hr; + } + } + return NULL; +} diff --git a/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp b/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp new file mode 100644 index 00000000000..7d1092bdc2a --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp @@ -0,0 +1,208 @@ +/* + * Copyright 2001-2007 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. + * + */ + +# include "incls/_precompiled.incl" +# include "incls/_ptrQueue.cpp.incl" + +PtrQueue::PtrQueue(PtrQueueSet* qset_, bool perm) : + _qset(qset_), _buf(NULL), _index(0), _active(false), + _perm(perm), _lock(NULL) +{} + +PtrQueue::~PtrQueue() { + if (!_perm && _buf != NULL) { + if (_index == _sz) { + // No work to do. + qset()->deallocate_buffer(_buf); + } else { + // We must NULL out the unused entries, then enqueue. + for (size_t i = 0; i < _index; i += oopSize) { + _buf[byte_index_to_index((int)i)] = NULL; + } + qset()->enqueue_complete_buffer(_buf); + _buf = NULL; + } + } +} + + +static int byte_index_to_index(int ind) { + assert((ind % oopSize) == 0, "Invariant."); + return ind / oopSize; +} + +static int index_to_byte_index(int byte_ind) { + return byte_ind * oopSize; +} + +void PtrQueue::enqueue_known_active(void* ptr) { + assert(0 <= _index && _index <= _sz, "Invariant."); + assert(_index == 0 || _buf != NULL, "invariant"); + + while (_index == 0) { + handle_zero_index(); + } + assert(_index > 0, "postcondition"); + + _index -= oopSize; + _buf[byte_index_to_index((int)_index)] = ptr; + assert(0 <= _index && _index <= _sz, "Invariant."); +} + +void PtrQueue::locking_enqueue_completed_buffer(void** buf) { + assert(_lock->owned_by_self(), "Required."); + _lock->unlock(); + qset()->enqueue_complete_buffer(buf); + // We must relock only because the caller will unlock, for the normal + // case. + _lock->lock_without_safepoint_check(); +} + + +PtrQueueSet::PtrQueueSet(bool notify_when_complete) : + _max_completed_queue(0), + _cbl_mon(NULL), _fl_lock(NULL), + _notify_when_complete(notify_when_complete), + _sz(0), + _completed_buffers_head(NULL), + _completed_buffers_tail(NULL), + _n_completed_buffers(0), + _process_completed_threshold(0), _process_completed(false), + _buf_free_list(NULL), _buf_free_list_sz(0) +{} + +void** PtrQueueSet::allocate_buffer() { + assert(_sz > 0, "Didn't set a buffer size."); + MutexLockerEx x(_fl_lock, Mutex::_no_safepoint_check_flag); + if (_buf_free_list != NULL) { + void** res = _buf_free_list; + _buf_free_list = (void**)_buf_free_list[0]; + _buf_free_list_sz--; + // Just override the next pointer with NULL, just in case we scan this part + // of the buffer. + res[0] = NULL; + return res; + } else { + return NEW_C_HEAP_ARRAY(void*, _sz); + } +} + +void PtrQueueSet::deallocate_buffer(void** buf) { + assert(_sz > 0, "Didn't set a buffer size."); + MutexLockerEx x(_fl_lock, Mutex::_no_safepoint_check_flag); + buf[0] = (void*)_buf_free_list; + _buf_free_list = buf; + _buf_free_list_sz++; +} + +void PtrQueueSet::reduce_free_list() { + // For now we'll adopt the strategy of deleting half. + MutexLockerEx x(_fl_lock, Mutex::_no_safepoint_check_flag); + size_t n = _buf_free_list_sz / 2; + while (n > 0) { + assert(_buf_free_list != NULL, "_buf_free_list_sz must be wrong."); + void** head = _buf_free_list; + _buf_free_list = (void**)_buf_free_list[0]; + FREE_C_HEAP_ARRAY(void*,head); + n--; + } +} + +void PtrQueueSet::enqueue_complete_buffer(void** buf, size_t index, bool ignore_max_completed) { + // I use explicit locking here because there's a bailout in the middle. + _cbl_mon->lock_without_safepoint_check(); + + Thread* thread = Thread::current(); + assert( ignore_max_completed || + thread->is_Java_thread() || + SafepointSynchronize::is_at_safepoint(), + "invariant" ); + ignore_max_completed = ignore_max_completed || !thread->is_Java_thread(); + + if (!ignore_max_completed && _max_completed_queue > 0 && + _n_completed_buffers >= (size_t) _max_completed_queue) { + _cbl_mon->unlock(); + bool b = mut_process_buffer(buf); + if (b) { + deallocate_buffer(buf); + return; + } + + // Otherwise, go ahead and enqueue the buffer. Must reaquire the lock. + _cbl_mon->lock_without_safepoint_check(); + } + + // Here we still hold the _cbl_mon. + CompletedBufferNode* cbn = new CompletedBufferNode; + cbn->buf = buf; + cbn->next = NULL; + cbn->index = index; + if (_completed_buffers_tail == NULL) { + assert(_completed_buffers_head == NULL, "Well-formedness"); + _completed_buffers_head = cbn; + _completed_buffers_tail = cbn; + } else { + _completed_buffers_tail->next = cbn; + _completed_buffers_tail = cbn; + } + _n_completed_buffers++; + + if (!_process_completed && + _n_completed_buffers == _process_completed_threshold) { + _process_completed = true; + if (_notify_when_complete) + _cbl_mon->notify_all(); + } + debug_only(assert_completed_buffer_list_len_correct_locked()); + _cbl_mon->unlock(); +} + +int PtrQueueSet::completed_buffers_list_length() { + int n = 0; + CompletedBufferNode* cbn = _completed_buffers_head; + while (cbn != NULL) { + n++; + cbn = cbn->next; + } + return n; +} + +void PtrQueueSet::assert_completed_buffer_list_len_correct() { + MutexLockerEx x(_cbl_mon, Mutex::_no_safepoint_check_flag); + assert_completed_buffer_list_len_correct_locked(); +} + +void PtrQueueSet::assert_completed_buffer_list_len_correct_locked() { + guarantee((size_t)completed_buffers_list_length() == _n_completed_buffers, + "Completed buffer length is wrong."); +} + +void PtrQueueSet::set_buffer_size(size_t sz) { + assert(_sz == 0 && sz > 0, "Should be called only once."); + _sz = sz * oopSize; +} + +void PtrQueueSet::set_process_completed_threshold(size_t sz) { + _process_completed_threshold = sz; +} diff --git a/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.hpp b/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.hpp new file mode 100644 index 00000000000..3079200615f --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.hpp @@ -0,0 +1,229 @@ +/* + * Copyright 2001-2007 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. + * + */ + +// There are various techniques that require threads to be able to log +// addresses. For example, a generational write barrier might log +// the addresses of modified old-generation objects. This type supports +// this operation. + +class PtrQueueSet; + +class PtrQueue: public CHeapObj { + +protected: + // The ptr queue set to which this queue belongs. + PtrQueueSet* _qset; + + // Whether updates should be logged. + bool _active; + + // The buffer. + void** _buf; + // The index at which an object was last enqueued. Starts at "_sz" + // (indicating an empty buffer) and goes towards zero. + size_t _index; + + // The size of the buffer. + size_t _sz; + + // If true, the queue is permanent, and doesn't need to deallocate + // its buffer in the destructor (since that obtains a lock which may not + // be legally locked by then. + bool _perm; + + // If there is a lock associated with this buffer, this is that lock. + Mutex* _lock; + + PtrQueueSet* qset() { return _qset; } + +public: + // Initialize this queue to contain a null buffer, and be part of the + // given PtrQueueSet. + PtrQueue(PtrQueueSet*, bool perm = false); + // Release any contained resources. + ~PtrQueue(); + + // Associate a lock with a ptr queue. + void set_lock(Mutex* lock) { _lock = lock; } + + void reset() { if (_buf != NULL) _index = _sz; } + + // Enqueues the given "obj". + void enqueue(void* ptr) { + if (!_active) return; + else enqueue_known_active(ptr); + } + + inline void handle_zero_index(); + void locking_enqueue_completed_buffer(void** buf); + + void enqueue_known_active(void* ptr); + + size_t size() { + assert(_sz >= _index, "Invariant."); + return _buf == NULL ? 0 : _sz - _index; + } + + // Set the "active" property of the queue to "b". An enqueue to an + // inactive thread is a no-op. Setting a queue to inactive resets its + // log to the empty state. + void set_active(bool b) { + _active = b; + if (!b && _buf != NULL) { + _index = _sz; + } else if (b && _buf != NULL) { + assert(_index == _sz, "invariant: queues are empty when activated."); + } + } + + static int byte_index_to_index(int ind) { + assert((ind % oopSize) == 0, "Invariant."); + return ind / oopSize; + } + + static int index_to_byte_index(int byte_ind) { + return byte_ind * oopSize; + } + + // To support compiler. + static ByteSize byte_offset_of_index() { + return byte_offset_of(PtrQueue, _index); + } + static ByteSize byte_width_of_index() { return in_ByteSize(sizeof(size_t)); } + + static ByteSize byte_offset_of_buf() { + return byte_offset_of(PtrQueue, _buf); + } + static ByteSize byte_width_of_buf() { return in_ByteSize(sizeof(void*)); } + + static ByteSize byte_offset_of_active() { + return byte_offset_of(PtrQueue, _active); + } + static ByteSize byte_width_of_active() { return in_ByteSize(sizeof(bool)); } + +}; + +// A PtrQueueSet represents resources common to a set of pointer queues. +// In particular, the individual queues allocate buffers from this shared +// set, and return completed buffers to the set. +// All these variables are are protected by the TLOQ_CBL_mon. XXX ??? +class PtrQueueSet: public CHeapObj { + +protected: + + class CompletedBufferNode: public CHeapObj { + public: + void** buf; + size_t index; + CompletedBufferNode* next; + CompletedBufferNode() : buf(NULL), + index(0), next(NULL){ } + }; + + Monitor* _cbl_mon; // Protects the fields below. + CompletedBufferNode* _completed_buffers_head; + CompletedBufferNode* _completed_buffers_tail; + size_t _n_completed_buffers; + size_t _process_completed_threshold; + volatile bool _process_completed; + + // This (and the interpretation of the first element as a "next" + // pointer) are protected by the TLOQ_FL_lock. + Mutex* _fl_lock; + void** _buf_free_list; + size_t _buf_free_list_sz; + + // The size of all buffers in the set. + size_t _sz; + + bool _all_active; + + // If true, notify_all on _cbl_mon when the threshold is reached. + bool _notify_when_complete; + + // Maximum number of elements allowed on completed queue: after that, + // enqueuer does the work itself. Zero indicates no maximum. + int _max_completed_queue; + + int completed_buffers_list_length(); + void assert_completed_buffer_list_len_correct_locked(); + void assert_completed_buffer_list_len_correct(); + +protected: + // A mutator thread does the the work of processing a buffer. + // Returns "true" iff the work is complete (and the buffer may be + // deallocated). + virtual bool mut_process_buffer(void** buf) { + ShouldNotReachHere(); + return false; + } + +public: + // Create an empty ptr queue set. + PtrQueueSet(bool notify_when_complete = false); + + // Because of init-order concerns, we can't pass these as constructor + // arguments. + void initialize(Monitor* cbl_mon, Mutex* fl_lock, + int max_completed_queue = 0) { + _max_completed_queue = max_completed_queue; + assert(cbl_mon != NULL && fl_lock != NULL, "Init order issue?"); + _cbl_mon = cbl_mon; _fl_lock = fl_lock; + } + + // Return an empty oop array of size _sz (required to be non-zero). + void** allocate_buffer(); + + // Return an empty buffer to the free list. The "buf" argument is + // required to be a pointer to the head of an array of length "_sz". + void deallocate_buffer(void** buf); + + // Declares that "buf" is a complete buffer. + void enqueue_complete_buffer(void** buf, size_t index = 0, + bool ignore_max_completed = false); + + bool completed_buffers_exist_dirty() { + return _n_completed_buffers > 0; + } + + bool process_completed_buffers() { return _process_completed; } + + bool active() { return _all_active; } + + // Set the buffer size. Should be called before any "enqueue" operation + // can be called. And should only be called once. + void set_buffer_size(size_t sz); + + // Get the buffer size. + size_t buffer_size() { return _sz; } + + // Set the number of completed buffers that triggers log processing. + void set_process_completed_threshold(size_t sz); + + // Must only be called at a safe point. Indicates that the buffer free + // list size may be reduced, if that is deemed desirable. + void reduce_free_list(); + + size_t completed_buffers_num() { return _n_completed_buffers; } +}; diff --git a/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.inline.hpp b/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.inline.hpp new file mode 100644 index 00000000000..c3ff2260ffd --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.inline.hpp @@ -0,0 +1,41 @@ +/* + * Copyright 2001-2007 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. + * + */ + +void PtrQueue::handle_zero_index() { + assert(0 == _index, "Precondition."); + // This thread records the full buffer and allocates a new one (while + // holding the lock if there is one). + void** buf = _buf; + _buf = qset()->allocate_buffer(); + _sz = qset()->buffer_size(); + _index = _sz; + assert(0 <= _index && _index <= _sz, "Invariant."); + if (buf != NULL) { + if (_lock) { + locking_enqueue_completed_buffer(buf); + } else { + qset()->enqueue_complete_buffer(buf); + } + } +} diff --git a/hotspot/src/share/vm/gc_implementation/g1/satbQueue.cpp b/hotspot/src/share/vm/gc_implementation/g1/satbQueue.cpp new file mode 100644 index 00000000000..a3e74a41ce0 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/satbQueue.cpp @@ -0,0 +1,160 @@ +/* + * Copyright 2001-2007 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. + * + */ + +# include "incls/_precompiled.incl" +# include "incls/_satbQueue.cpp.incl" + +void ObjPtrQueue::apply_closure(ObjectClosure* cl) { + if (_buf != NULL) { + apply_closure_to_buffer(cl, _buf, _index, _sz); + _index = _sz; + } +} + +void ObjPtrQueue::apply_closure_to_buffer(ObjectClosure* cl, + void** buf, size_t index, size_t sz) { + if (cl == NULL) return; + for (size_t i = index; i < sz; i += oopSize) { + oop obj = (oop)buf[byte_index_to_index((int)i)]; + // There can be NULL entries because of destructors. + if (obj != NULL) { + cl->do_object(obj); + } + } +} +#ifdef _MSC_VER // the use of 'this' below gets a warning, make it go away +#pragma warning( disable:4355 ) // 'this' : used in base member initializer list +#endif // _MSC_VER + + +SATBMarkQueueSet::SATBMarkQueueSet() : + PtrQueueSet(), + _closure(NULL), _par_closures(NULL), + _shared_satb_queue(this, true /*perm*/) +{} + +void SATBMarkQueueSet::initialize(Monitor* cbl_mon, Mutex* fl_lock, + int max_completed_queue, + Mutex* lock) { + PtrQueueSet::initialize(cbl_mon, fl_lock, max_completed_queue); + _shared_satb_queue.set_lock(lock); + if (ParallelGCThreads > 0) { + _par_closures = NEW_C_HEAP_ARRAY(ObjectClosure*, ParallelGCThreads); + } +} + + +void SATBMarkQueueSet::handle_zero_index_for_thread(JavaThread* t) { + t->satb_mark_queue().handle_zero_index(); +} + +void SATBMarkQueueSet::set_active_all_threads(bool b) { + _all_active = b; + for(JavaThread* t = Threads::first(); t; t = t->next()) { + t->satb_mark_queue().set_active(b); + } +} + +void SATBMarkQueueSet::set_closure(ObjectClosure* closure) { + _closure = closure; +} + +void SATBMarkQueueSet::set_par_closure(int i, ObjectClosure* par_closure) { + assert(ParallelGCThreads > 0 && _par_closures != NULL, "Precondition"); + _par_closures[i] = par_closure; +} + +void SATBMarkQueueSet::iterate_closure_all_threads() { + for(JavaThread* t = Threads::first(); t; t = t->next()) { + t->satb_mark_queue().apply_closure(_closure); + } + shared_satb_queue()->apply_closure(_closure); +} + +void SATBMarkQueueSet::par_iterate_closure_all_threads(int worker) { + SharedHeap* sh = SharedHeap::heap(); + int parity = sh->strong_roots_parity(); + + for(JavaThread* t = Threads::first(); t; t = t->next()) { + if (t->claim_oops_do(true, parity)) { + t->satb_mark_queue().apply_closure(_par_closures[worker]); + } + } + // We'll have worker 0 do this one. + if (worker == 0) { + shared_satb_queue()->apply_closure(_par_closures[0]); + } +} + +bool SATBMarkQueueSet::apply_closure_to_completed_buffer_work(bool par, + int worker) { + CompletedBufferNode* nd = NULL; + { + MutexLockerEx x(_cbl_mon, Mutex::_no_safepoint_check_flag); + if (_completed_buffers_head != NULL) { + nd = _completed_buffers_head; + _completed_buffers_head = nd->next; + if (_completed_buffers_head == NULL) _completed_buffers_tail = NULL; + _n_completed_buffers--; + if (_n_completed_buffers == 0) _process_completed = false; + } + } + ObjectClosure* cl = (par ? _par_closures[worker] : _closure); + if (nd != NULL) { + ObjPtrQueue::apply_closure_to_buffer(cl, nd->buf, 0, _sz); + deallocate_buffer(nd->buf); + delete nd; + return true; + } else { + return false; + } +} + +void SATBMarkQueueSet::abandon_partial_marking() { + CompletedBufferNode* buffers_to_delete = NULL; + { + MutexLockerEx x(_cbl_mon, Mutex::_no_safepoint_check_flag); + while (_completed_buffers_head != NULL) { + CompletedBufferNode* nd = _completed_buffers_head; + _completed_buffers_head = nd->next; + nd->next = buffers_to_delete; + buffers_to_delete = nd; + } + _completed_buffers_tail = NULL; + _n_completed_buffers = 0; + debug_only(assert_completed_buffer_list_len_correct_locked()); + } + while (buffers_to_delete != NULL) { + CompletedBufferNode* nd = buffers_to_delete; + buffers_to_delete = nd->next; + deallocate_buffer(nd->buf); + delete nd; + } + assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint."); + // So we can safely manipulate these queues. + for (JavaThread* t = Threads::first(); t; t = t->next()) { + t->satb_mark_queue().reset(); + } + shared_satb_queue()->reset(); +} diff --git a/hotspot/src/share/vm/gc_implementation/g1/satbQueue.hpp b/hotspot/src/share/vm/gc_implementation/g1/satbQueue.hpp new file mode 100644 index 00000000000..ab8bf5fa4ab --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/satbQueue.hpp @@ -0,0 +1,105 @@ +/* + * Copyright 2001-2007 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. + * + */ + +class ObjectClosure; +class JavaThread; + +// A ptrQueue whose elements are "oops", pointers to object heads. +class ObjPtrQueue: public PtrQueue { +public: + ObjPtrQueue(PtrQueueSet* qset_, bool perm = false) : + PtrQueue(qset_, perm) + {} + // Apply the closure to all elements, and reset the index to make the + // buffer empty. + void apply_closure(ObjectClosure* cl); + + // Apply the closure to all elements of "buf", down to "index" (inclusive.) + static void apply_closure_to_buffer(ObjectClosure* cl, + void** buf, size_t index, size_t sz); + +}; + + + +class SATBMarkQueueSet: public PtrQueueSet { + ObjectClosure* _closure; + ObjectClosure** _par_closures; // One per ParGCThread. + + ObjPtrQueue _shared_satb_queue; + + // Utility function to support sequential and parallel versions. If + // "par" is true, then "worker" is the par thread id; if "false", worker + // is ignored. + bool apply_closure_to_completed_buffer_work(bool par, int worker); + + +public: + SATBMarkQueueSet(); + + void initialize(Monitor* cbl_mon, Mutex* fl_lock, + int max_completed_queue = 0, + Mutex* lock = NULL); + + static void handle_zero_index_for_thread(JavaThread* t); + + // Apply "set_active(b)" to all thread tloq's. Should be called only + // with the world stopped. + void set_active_all_threads(bool b); + + // Register "blk" as "the closure" for all queues. Only one such closure + // is allowed. The "apply_closure_to_completed_buffer" method will apply + // this closure to a completed buffer, and "iterate_closure_all_threads" + // applies it to partially-filled buffers (the latter should only be done + // with the world stopped). + void set_closure(ObjectClosure* closure); + // Set the parallel closures: pointer is an array of pointers to + // closures, one for each parallel GC thread. + void set_par_closure(int i, ObjectClosure* closure); + + // If there is a registered closure for buffers, apply it to all entries + // in all currently-active buffers. This should only be applied at a + // safepoint. (Currently must not be called in parallel; this should + // change in the future.) + void iterate_closure_all_threads(); + // Parallel version of the above. + void par_iterate_closure_all_threads(int worker); + + // If there exists some completed buffer, pop it, then apply the + // registered closure to all its elements, and return true. If no + // completed buffers exist, return false. + bool apply_closure_to_completed_buffer() { + return apply_closure_to_completed_buffer_work(false, 0); + } + // Parallel version of the above. + bool par_apply_closure_to_completed_buffer(int worker) { + return apply_closure_to_completed_buffer_work(true, worker); + } + + ObjPtrQueue* shared_satb_queue() { return &_shared_satb_queue; } + + // If a marking is being abandoned, reset any unprocessed log buffers. + void abandon_partial_marking(); + +}; diff --git a/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.cpp b/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.cpp new file mode 100644 index 00000000000..af25662f603 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.cpp @@ -0,0 +1,530 @@ +/* + * Copyright 2001-2007 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. + * + */ + +#include "incls/_precompiled.incl" +#include "incls/_sparsePRT.cpp.incl" + +#define SPARSE_PRT_VERBOSE 0 + +#define UNROLL_CARD_LOOPS 1 + +void SparsePRT::init_iterator(SparsePRTIter* sprt_iter) { + sprt_iter->init(this); +} + +void SparsePRTEntry::init(short region_ind) { + _region_ind = region_ind; + _next_index = NullEntry; +#if UNROLL_CARD_LOOPS + assert(CardsPerEntry == 4, "Assumption. If changes, un-unroll."); + _cards[0] = NullEntry; + _cards[1] = NullEntry; + _cards[2] = NullEntry; + _cards[3] = NullEntry; +#else + for (int i = 0; i < CardsPerEntry; i++) _cards[i] = NullEntry; +#endif +} + +bool SparsePRTEntry::contains_card(short card_index) const { +#if UNROLL_CARD_LOOPS + assert(CardsPerEntry == 4, "Assumption. If changes, un-unroll."); + if (_cards[0] == card_index) return true; + if (_cards[1] == card_index) return true; + if (_cards[2] == card_index) return true; + if (_cards[3] == card_index) return true; +#else + for (int i = 0; i < CardsPerEntry; i++) { + if (_cards[i] == card_index) return true; + } +#endif + // Otherwise, we're full. + return false; +} + +int SparsePRTEntry::num_valid_cards() const { + int sum = 0; +#if UNROLL_CARD_LOOPS + assert(CardsPerEntry == 4, "Assumption. If changes, un-unroll."); + if (_cards[0] != NullEntry) sum++; + if (_cards[1] != NullEntry) sum++; + if (_cards[2] != NullEntry) sum++; + if (_cards[3] != NullEntry) sum++; +#else + for (int i = 0; i < CardsPerEntry; i++) { + if (_cards[i] != NulLEntry) sum++; + } +#endif + // Otherwise, we're full. + return sum; +} + +SparsePRTEntry::AddCardResult SparsePRTEntry::add_card(short card_index) { +#if UNROLL_CARD_LOOPS + assert(CardsPerEntry == 4, "Assumption. If changes, un-unroll."); + short c = _cards[0]; + if (c == card_index) return found; + if (c == NullEntry) { _cards[0] = card_index; return added; } + c = _cards[1]; + if (c == card_index) return found; + if (c == NullEntry) { _cards[1] = card_index; return added; } + c = _cards[2]; + if (c == card_index) return found; + if (c == NullEntry) { _cards[2] = card_index; return added; } + c = _cards[3]; + if (c == card_index) return found; + if (c == NullEntry) { _cards[3] = card_index; return added; } +#else + for (int i = 0; i < CardsPerEntry; i++) { + short c = _cards[i]; + if (c == card_index) return found; + if (c == NullEntry) { _cards[i] = card_index; return added; } + } +#endif + // Otherwise, we're full. + return overflow; +} + +void SparsePRTEntry::copy_cards(short* cards) const { +#if UNROLL_CARD_LOOPS + assert(CardsPerEntry == 4, "Assumption. If changes, un-unroll."); + cards[0] = _cards[0]; + cards[1] = _cards[1]; + cards[2] = _cards[2]; + cards[3] = _cards[3]; +#else + for (int i = 0; i < CardsPerEntry; i++) { + cards[i] = _cards[i]; + } +#endif +} + +void SparsePRTEntry::copy_cards(SparsePRTEntry* e) const { + copy_cards(&e->_cards[0]); +} + +// ---------------------------------------------------------------------- + +RSHashTable::RSHashTable(size_t capacity) : + _capacity(capacity), _capacity_mask(capacity-1), + _occupied_entries(0), _occupied_cards(0), + _entries(NEW_C_HEAP_ARRAY(SparsePRTEntry, capacity)), + _buckets(NEW_C_HEAP_ARRAY(short, capacity)), + _next_deleted(NULL), _deleted(false), + _free_list(NullEntry), _free_region(0) +{ + clear(); +} + +RSHashTable::~RSHashTable() { + if (_entries != NULL) { + FREE_C_HEAP_ARRAY(SparsePRTEntry, _entries); + _entries = NULL; + } + if (_buckets != NULL) { + FREE_C_HEAP_ARRAY(short, _buckets); + _buckets = NULL; + } +} + +void RSHashTable::clear() { + _occupied_entries = 0; + _occupied_cards = 0; + guarantee(_entries != NULL, "INV"); + guarantee(_buckets != NULL, "INV"); + // This will put -1 == NullEntry in the key field of all entries. + memset(_entries, -1, _capacity * sizeof(SparsePRTEntry)); + memset(_buckets, -1, _capacity * sizeof(short)); + _free_list = NullEntry; + _free_region = 0; +} + +bool RSHashTable::add_card(short region_ind, short card_index) { + SparsePRTEntry* e = entry_for_region_ind_create(region_ind); + assert(e != NULL && e->r_ind() == region_ind, + "Postcondition of call above."); + SparsePRTEntry::AddCardResult res = e->add_card(card_index); + if (res == SparsePRTEntry::added) _occupied_cards++; +#if SPARSE_PRT_VERBOSE + gclog_or_tty->print_cr(" after add_card[%d]: valid-cards = %d.", + pointer_delta(e, _entries, sizeof(SparsePRTEntry)), + e->num_valid_cards()); +#endif + assert(e->num_valid_cards() > 0, "Postcondition"); + return res != SparsePRTEntry::overflow; +} + +bool RSHashTable::get_cards(short region_ind, short* cards) { + short ind = (short) (region_ind & capacity_mask()); + short cur_ind = _buckets[ind]; + SparsePRTEntry* cur; + while (cur_ind != NullEntry && + (cur = entry(cur_ind))->r_ind() != region_ind) { + cur_ind = cur->next_index(); + } + + if (cur_ind == NullEntry) return false; + // Otherwise... + assert(cur->r_ind() == region_ind, "Postcondition of loop + test above."); + assert(cur->num_valid_cards() > 0, "Inv"); + cur->copy_cards(cards); + return true; +} + +bool RSHashTable::delete_entry(short region_ind) { + short ind = (short) (region_ind & capacity_mask()); + short* prev_loc = &_buckets[ind]; + short cur_ind = *prev_loc; + SparsePRTEntry* cur; + while (cur_ind != NullEntry && + (cur = entry(cur_ind))->r_ind() != region_ind) { + prev_loc = cur->next_index_addr(); + cur_ind = *prev_loc; + } + + if (cur_ind == NullEntry) return false; + // Otherwise, splice out "cur". + *prev_loc = cur->next_index(); + _occupied_cards -= cur->num_valid_cards(); + free_entry(cur_ind); + _occupied_entries--; + return true; +} + +SparsePRTEntry* RSHashTable::entry_for_region_ind(short region_ind) const { + assert(occupied_entries() < capacity(), "Precondition"); + short ind = (short) (region_ind & capacity_mask()); + short cur_ind = _buckets[ind]; + SparsePRTEntry* cur; + // XXX + // int k = 0; + while (cur_ind != NullEntry && + (cur = entry(cur_ind))->r_ind() != region_ind) { + /* + k++; + if (k > 10) { + gclog_or_tty->print_cr("RSHashTable::entry_for_region_ind(%d): " + "k = %d, cur_ind = %d.", region_ind, k, cur_ind); + if (k >= 1000) { + while (1) ; + } + } + */ + cur_ind = cur->next_index(); + } + + if (cur_ind != NullEntry) { + assert(cur->r_ind() == region_ind, "Loop postcondition + test"); + return cur; + } else { + return NULL; + } +} + +SparsePRTEntry* RSHashTable::entry_for_region_ind_create(short region_ind) { + SparsePRTEntry* res = entry_for_region_ind(region_ind); + if (res == NULL) { + short new_ind = alloc_entry(); + assert(0 <= new_ind && (size_t)new_ind < capacity(), "There should be room."); + res = entry(new_ind); + res->init(region_ind); + // Insert at front. + short ind = (short) (region_ind & capacity_mask()); + res->set_next_index(_buckets[ind]); + _buckets[ind] = new_ind; + _occupied_entries++; + } + return res; +} + +short RSHashTable::alloc_entry() { + short res; + if (_free_list != NullEntry) { + res = _free_list; + _free_list = entry(res)->next_index(); + return res; + } else if ((size_t) _free_region+1 < capacity()) { + res = _free_region; + _free_region++; + return res; + } else { + return NullEntry; + } +} + + +void RSHashTable::free_entry(short fi) { + entry(fi)->set_next_index(_free_list); + _free_list = fi; +} + + +void RSHashTable::add_entry(SparsePRTEntry* e) { + assert(e->num_valid_cards() > 0, "Precondition."); + SparsePRTEntry* e2 = entry_for_region_ind_create(e->r_ind()); + e->copy_cards(e2); + _occupied_cards += e2->num_valid_cards(); + assert(e2->num_valid_cards() > 0, "Postcondition."); +} + +RSHashTable* RSHashTable::_head_deleted_list = NULL; + +void RSHashTable::add_to_deleted_list(RSHashTable* rsht) { + assert(!rsht->deleted(), "Should delete only once."); + rsht->set_deleted(true); + RSHashTable* hd = _head_deleted_list; + while (true) { + rsht->_next_deleted = hd; + RSHashTable* res = + (RSHashTable*) + Atomic::cmpxchg_ptr(rsht, &_head_deleted_list, hd); + if (res == hd) return; + else hd = res; + } +} + +RSHashTable* RSHashTable::get_from_deleted_list() { + RSHashTable* hd = _head_deleted_list; + while (hd != NULL) { + RSHashTable* next = hd->next_deleted(); + RSHashTable* res = + (RSHashTable*) + Atomic::cmpxchg_ptr(next, &_head_deleted_list, hd); + if (res == hd) { + hd->set_next_deleted(NULL); + hd->set_deleted(false); + return hd; + } else { + hd = res; + } + } + return NULL; +} + +short /* RSHashTable:: */ RSHashTableIter::find_first_card_in_list() { + short res; + while (_bl_ind != RSHashTable::NullEntry) { + res = _rsht->entry(_bl_ind)->card(0); + if (res != SparsePRTEntry::NullEntry) { + return res; + } else { + _bl_ind = _rsht->entry(_bl_ind)->next_index(); + } + } + // Otherwise, none found: + return SparsePRTEntry::NullEntry; +} + +size_t /* RSHashTable:: */ RSHashTableIter::compute_card_ind(short ci) { + return + _heap_bot_card_ind + + (_rsht->entry(_bl_ind)->r_ind() * CardsPerRegion) + + ci; +} + +bool /* RSHashTable:: */ RSHashTableIter::has_next(size_t& card_index) { + _card_ind++; + short ci; + if (_card_ind < SparsePRTEntry::CardsPerEntry && + ((ci = _rsht->entry(_bl_ind)->card(_card_ind)) != + SparsePRTEntry::NullEntry)) { + card_index = compute_card_ind(ci); + return true; + } + // Otherwise, must find the next valid entry. + _card_ind = 0; + + if (_bl_ind != RSHashTable::NullEntry) { + _bl_ind = _rsht->entry(_bl_ind)->next_index(); + ci = find_first_card_in_list(); + if (ci != SparsePRTEntry::NullEntry) { + card_index = compute_card_ind(ci); + return true; + } + } + // If we didn't return above, must go to the next non-null table index. + _tbl_ind++; + while ((size_t)_tbl_ind < _rsht->capacity()) { + _bl_ind = _rsht->_buckets[_tbl_ind]; + ci = find_first_card_in_list(); + if (ci != SparsePRTEntry::NullEntry) { + card_index = compute_card_ind(ci); + return true; + } + // Otherwise, try next entry. + _tbl_ind++; + } + // Otherwise, there were no entry. + return false; +} + +bool RSHashTable::contains_card(short region_index, short card_index) const { + SparsePRTEntry* e = entry_for_region_ind(region_index); + return (e != NULL && e->contains_card(card_index)); +} + +size_t RSHashTable::mem_size() const { + return sizeof(this) + capacity() * (sizeof(SparsePRTEntry) + sizeof(short)); +} + + +// ---------------------------------------------------------------------- + +SparsePRT* SparsePRT::_head_expanded_list = NULL; + +void SparsePRT::add_to_expanded_list(SparsePRT* sprt) { + // We could expand multiple times in a pause -- only put on list once. + if (sprt->expanded()) return; + sprt->set_expanded(true); + SparsePRT* hd = _head_expanded_list; + while (true) { + sprt->_next_expanded = hd; + SparsePRT* res = + (SparsePRT*) + Atomic::cmpxchg_ptr(sprt, &_head_expanded_list, hd); + if (res == hd) return; + else hd = res; + } +} + +SparsePRT* SparsePRT::get_from_expanded_list() { + SparsePRT* hd = _head_expanded_list; + while (hd != NULL) { + SparsePRT* next = hd->next_expanded(); + SparsePRT* res = + (SparsePRT*) + Atomic::cmpxchg_ptr(next, &_head_expanded_list, hd); + if (res == hd) { + hd->set_next_expanded(NULL); + return hd; + } else { + hd = res; + } + } + return NULL; +} + + +void SparsePRT::cleanup_all() { + // First clean up all expanded tables so they agree on next and cur. + SparsePRT* sprt = get_from_expanded_list(); + while (sprt != NULL) { + sprt->cleanup(); + sprt = get_from_expanded_list(); + } + // Now delete all deleted RSHashTables. + RSHashTable* rsht = RSHashTable::get_from_deleted_list(); + while (rsht != NULL) { +#if SPARSE_PRT_VERBOSE + gclog_or_tty->print_cr("About to delete RSHT " PTR_FORMAT ".", rsht); +#endif + delete rsht; + rsht = RSHashTable::get_from_deleted_list(); + } +} + + +SparsePRT::SparsePRT(HeapRegion* hr) : + _expanded(false), _next_expanded(NULL) +{ + _cur = new RSHashTable(InitialCapacity); + _next = _cur; +} + +SparsePRT::~SparsePRT() { + assert(_next != NULL && _cur != NULL, "Inv"); + if (_cur != _next) { delete _cur; } + delete _next; +} + + +size_t SparsePRT::mem_size() const { + // We ignore "_cur" here, because it either = _next, or else it is + // on the deleted list. + return sizeof(this) + _next->mem_size(); +} + +bool SparsePRT::add_card(short region_id, short card_index) { +#if SPARSE_PRT_VERBOSE + gclog_or_tty->print_cr(" Adding card %d from region %d to region %d sparse.", + card_index, region_id, _hr->hrs_index()); +#endif + if (_next->occupied_entries() * 2 > _next->capacity()) { + expand(); + } + return _next->add_card(region_id, card_index); +} + +bool SparsePRT::get_cards(short region_id, short* cards) { + return _next->get_cards(region_id, cards); +} + +bool SparsePRT::delete_entry(short region_id) { + return _next->delete_entry(region_id); +} + +void SparsePRT::clear() { + // If they differ, _next is bigger then cur, so next has no chance of + // being the initial size. + if (_next != _cur) { + delete _next; + } + + if (_cur->capacity() != InitialCapacity) { + delete _cur; + _cur = new RSHashTable(InitialCapacity); + } else { + _cur->clear(); + } + _next = _cur; +} + +void SparsePRT::cleanup() { + // Make sure that the current and next tables agree. (Another mechanism + // takes care of deleting now-unused tables.) + _cur = _next; +} + +void SparsePRT::expand() { + RSHashTable* last = _next; + _next = new RSHashTable(last->capacity() * 2); + +#if SPARSE_PRT_VERBOSE + gclog_or_tty->print_cr(" Expanded sparse table for %d to %d.", + _hr->hrs_index(), _next->capacity()); +#endif + for (size_t i = 0; i < last->capacity(); i++) { + SparsePRTEntry* e = last->entry((int)i); + if (e->valid_entry()) { +#if SPARSE_PRT_VERBOSE + gclog_or_tty->print_cr(" During expansion, transferred entry for %d.", + e->r_ind()); +#endif + _next->add_entry(e); + } + } + if (last != _cur) + RSHashTable::add_to_deleted_list(last); + add_to_expanded_list(this); +} diff --git a/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.hpp b/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.hpp new file mode 100644 index 00000000000..e8fa9b00be1 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.hpp @@ -0,0 +1,308 @@ +/* + * Copyright 2001-2007 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. + * + */ + +// Sparse remembered set for a heap region (the "owning" region). Maps +// indices of other regions to short sequences of cards in the other region +// that might contain pointers into the owner region. + +// These tables only expand while they are accessed in parallel -- +// deletions may be done in single-threaded code. This allows us to allow +// unsynchronized reads/iterations, as long as expansions caused by +// insertions only enqueue old versions for deletions, but do not delete +// old versions synchronously. + + +class SparsePRTEntry { +public: + enum SomePublicConstants { + CardsPerEntry = (short)4, + NullEntry = (short)-1, + DeletedEntry = (short)-2 + }; + +private: + short _region_ind; + short _next_index; + short _cards[CardsPerEntry]; + +public: + + // Set the region_ind to the given value, and delete all cards. + inline void init(short region_ind); + + short r_ind() const { return _region_ind; } + bool valid_entry() const { return r_ind() >= 0; } + void set_r_ind(short rind) { _region_ind = rind; } + + short next_index() const { return _next_index; } + short* next_index_addr() { return &_next_index; } + void set_next_index(short ni) { _next_index = ni; } + + // Returns "true" iff the entry contains the given card index. + inline bool contains_card(short card_index) const; + + // Returns the number of non-NULL card entries. + inline int num_valid_cards() const; + + // Requires that the entry not contain the given card index. If there is + // space available, add the given card index to the entry and return + // "true"; otherwise, return "false" to indicate that the entry is full. + enum AddCardResult { + overflow, + found, + added + }; + inline AddCardResult add_card(short card_index); + + // Copy the current entry's cards into "cards". + inline void copy_cards(short* cards) const; + // Copy the current entry's cards into the "_card" array of "e." + inline void copy_cards(SparsePRTEntry* e) const; + + inline short card(int i) const { return _cards[i]; } +}; + + +class RSHashTable : public CHeapObj { + + friend class RSHashTableIter; + + enum SomePrivateConstants { + NullEntry = -1 + }; + + size_t _capacity; + size_t _capacity_mask; + size_t _occupied_entries; + size_t _occupied_cards; + + SparsePRTEntry* _entries; + short* _buckets; + short _free_region; + short _free_list; + + static RSHashTable* _head_deleted_list; + RSHashTable* _next_deleted; + RSHashTable* next_deleted() { return _next_deleted; } + void set_next_deleted(RSHashTable* rsht) { _next_deleted = rsht; } + bool _deleted; + void set_deleted(bool b) { _deleted = b; } + + // Requires that the caller hold a lock preventing parallel modifying + // operations, and that the the table be less than completely full. If + // an entry for "region_ind" is already in the table, finds it and + // returns its address; otherwise returns "NULL." + SparsePRTEntry* entry_for_region_ind(short region_ind) const; + + // Requires that the caller hold a lock preventing parallel modifying + // operations, and that the the table be less than completely full. If + // an entry for "region_ind" is already in the table, finds it and + // returns its address; otherwise allocates, initializes, inserts and + // returns a new entry for "region_ind". + SparsePRTEntry* entry_for_region_ind_create(short region_ind); + + // Returns the index of the next free entry in "_entries". + short alloc_entry(); + // Declares the entry "fi" to be free. (It must have already been + // deleted from any bucket lists. + void free_entry(short fi); + +public: + RSHashTable(size_t capacity); + ~RSHashTable(); + + // Attempts to ensure that the given card_index in the given region is in + // the sparse table. If successful (because the card was already + // present, or because it was successfullly added) returns "true". + // Otherwise, returns "false" to indicate that the addition would + // overflow the entry for the region. The caller must transfer these + // entries to a larger-capacity representation. + bool add_card(short region_id, short card_index); + + bool get_cards(short region_id, short* cards); + bool delete_entry(short region_id); + + bool contains_card(short region_id, short card_index) const; + + void add_entry(SparsePRTEntry* e); + + void clear(); + + size_t capacity() const { return _capacity; } + size_t capacity_mask() const { return _capacity_mask; } + size_t occupied_entries() const { return _occupied_entries; } + size_t occupied_cards() const { return _occupied_cards; } + size_t mem_size() const; + bool deleted() { return _deleted; } + + SparsePRTEntry* entry(int i) const { return &_entries[i]; } + + void print(); + + static void add_to_deleted_list(RSHashTable* rsht); + static RSHashTable* get_from_deleted_list(); + + +}; + + // ValueObj because will be embedded in HRRS iterator. +class RSHashTableIter: public CHeapObj { + short _tbl_ind; + short _bl_ind; + short _card_ind; + RSHashTable* _rsht; + size_t _heap_bot_card_ind; + + enum SomePrivateConstants { + CardsPerRegion = HeapRegion::GrainBytes >> CardTableModRefBS::card_shift + }; + + // If the bucket list pointed to by _bl_ind contains a card, sets + // _bl_ind to the index of that entry, and returns the card. + // Otherwise, returns SparseEntry::NullEnty. + short find_first_card_in_list(); + // Computes the proper card index for the card whose offset in the + // current region (as indicated by _bl_ind) is "ci". + // This is subject to errors when there is iteration concurrent with + // modification, but these errors should be benign. + size_t compute_card_ind(short ci); + + public: + RSHashTableIter(size_t heap_bot_card_ind) : + _tbl_ind(RSHashTable::NullEntry), + _bl_ind(RSHashTable::NullEntry), + _card_ind((SparsePRTEntry::CardsPerEntry-1)), + _rsht(NULL), + _heap_bot_card_ind(heap_bot_card_ind) + {} + + void init(RSHashTable* rsht) { + _rsht = rsht; + _tbl_ind = -1; // So that first increment gets to 0. + _bl_ind = RSHashTable::NullEntry; + _card_ind = (SparsePRTEntry::CardsPerEntry-1); + } + + bool has_next(size_t& card_index); + + }; + +// Concurrent accesss to a SparsePRT must be serialized by some external +// mutex. + +class SparsePRTIter; + +class SparsePRT : public CHeapObj { + // Iterations are done on the _cur hash table, since they only need to + // see entries visible at the start of a collection pause. + // All other operations are done using the _next hash table. + RSHashTable* _cur; + RSHashTable* _next; + + HeapRegion* _hr; + + enum SomeAdditionalPrivateConstants { + InitialCapacity = 16 + }; + + void expand(); + + bool _expanded; + + bool expanded() { return _expanded; } + void set_expanded(bool b) { _expanded = b; } + + SparsePRT* _next_expanded; + + SparsePRT* next_expanded() { return _next_expanded; } + void set_next_expanded(SparsePRT* nxt) { _next_expanded = nxt; } + + + static SparsePRT* _head_expanded_list; + +public: + SparsePRT(HeapRegion* hr); + + ~SparsePRT(); + + size_t occupied() const { return _next->occupied_cards(); } + size_t mem_size() const; + + // Attempts to ensure that the given card_index in the given region is in + // the sparse table. If successful (because the card was already + // present, or because it was successfullly added) returns "true". + // Otherwise, returns "false" to indicate that the addition would + // overflow the entry for the region. The caller must transfer these + // entries to a larger-capacity representation. + bool add_card(short region_id, short card_index); + + // If the table hold an entry for "region_ind", Copies its + // cards into "cards", which must be an array of length at least + // "CardsPerEntry", and returns "true"; otherwise, returns "false". + bool get_cards(short region_ind, short* cards); + + // If there is an entry for "region_ind", removes it and return "true"; + // otherwise returns "false." + bool delete_entry(short region_ind); + + // Clear the table, and reinitialize to initial capacity. + void clear(); + + // Ensure that "_cur" and "_next" point to the same table. + void cleanup(); + + // Clean up all tables on the expanded list. Called single threaded. + static void cleanup_all(); + RSHashTable* next() const { return _next; } + + + void init_iterator(SparsePRTIter* sprt_iter); + + static void add_to_expanded_list(SparsePRT* sprt); + static SparsePRT* get_from_expanded_list(); + + bool contains_card(short region_id, short card_index) const { + return _next->contains_card(region_id, card_index); + } + +#if 0 + void verify_is_cleared(); + void print(); +#endif +}; + + +class SparsePRTIter: public /* RSHashTable:: */RSHashTableIter { +public: + SparsePRTIter(size_t heap_bot_card_ind) : + /* RSHashTable:: */RSHashTableIter(heap_bot_card_ind) + {} + + void init(const SparsePRT* sprt) { + RSHashTableIter::init(sprt->next()); + } + bool has_next(size_t& card_index) { + return RSHashTableIter::has_next(card_index); + } +}; diff --git a/hotspot/src/share/vm/gc_implementation/g1/survRateGroup.cpp b/hotspot/src/share/vm/gc_implementation/g1/survRateGroup.cpp new file mode 100644 index 00000000000..0f2a5c95bc1 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/survRateGroup.cpp @@ -0,0 +1,264 @@ +/* + * Copyright 2001-2007 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. + * + */ + +#include "incls/_precompiled.incl" +#include "incls/_survRateGroup.cpp.incl" + +SurvRateGroup::SurvRateGroup(G1CollectorPolicy* g1p, + const char* name, + size_t summary_surv_rates_len) : + _g1p(g1p), _name(name), + _all_regions_allocated(0), + _curr_length(0), _scan_only_prefix(0), _setup_seq_num(0), + _array_length(0), _surv_rate(NULL), _accum_surv_rate_pred(NULL), + _accum_surv_rate(0.0), _surv_rate_pred(NULL), _last_pred(0.0), + _summary_surv_rates_len(summary_surv_rates_len), + _summary_surv_rates_max_len(0), + _summary_surv_rates(NULL) { + + // the following will set up the arrays with length 1 + _curr_length = 1; + stop_adding_regions(); + guarantee( _array_length == 1, "invariant" ); + guarantee( _surv_rate_pred[0] != NULL, "invariant" ); + _surv_rate_pred[0]->add(0.4); + all_surviving_words_recorded(false); + _curr_length = 0; + + if (summary_surv_rates_len > 0) { + size_t length = summary_surv_rates_len; + _summary_surv_rates = NEW_C_HEAP_ARRAY(NumberSeq*, length); + if (_summary_surv_rates == NULL) { + vm_exit_out_of_memory(sizeof(NumberSeq*) * length, + "Not enough space for surv rate summary"); + } + for (size_t i = 0; i < length; ++i) + _summary_surv_rates[i] = new NumberSeq(); + } + + start_adding_regions(); +} + +void +SurvRateGroup::start_adding_regions() { + _setup_seq_num = _array_length; + _curr_length = _scan_only_prefix; + _accum_surv_rate = 0.0; + +#if 0 + gclog_or_tty->print_cr("start adding regions, seq num %d, length %d", + _setup_seq_num, _curr_length); +#endif // 0 +} + +void +SurvRateGroup::stop_adding_regions() { + size_t length = _curr_length; + +#if 0 + gclog_or_tty->print_cr("stop adding regions, length %d", length); +#endif // 0 + + if (length > _array_length) { + double* old_surv_rate = _surv_rate; + double* old_accum_surv_rate_pred = _accum_surv_rate_pred; + TruncatedSeq** old_surv_rate_pred = _surv_rate_pred; + + _surv_rate = NEW_C_HEAP_ARRAY(double, length); + if (_surv_rate == NULL) { + vm_exit_out_of_memory(sizeof(double) * length, + "Not enough space for surv rate array."); + } + _accum_surv_rate_pred = NEW_C_HEAP_ARRAY(double, length); + if (_accum_surv_rate_pred == NULL) { + vm_exit_out_of_memory(sizeof(double) * length, + "Not enough space for accum surv rate pred array."); + } + _surv_rate_pred = NEW_C_HEAP_ARRAY(TruncatedSeq*, length); + if (_surv_rate == NULL) { + vm_exit_out_of_memory(sizeof(TruncatedSeq*) * length, + "Not enough space for surv rate pred array."); + } + + for (size_t i = 0; i < _array_length; ++i) + _surv_rate_pred[i] = old_surv_rate_pred[i]; + +#if 0 + gclog_or_tty->print_cr("stop adding regions, new seqs %d to %d", + _array_length, length - 1); +#endif // 0 + + for (size_t i = _array_length; i < length; ++i) { + _surv_rate_pred[i] = new TruncatedSeq(10); + // _surv_rate_pred[i]->add(last_pred); + } + + _array_length = length; + + if (old_surv_rate != NULL) + FREE_C_HEAP_ARRAY(double, old_surv_rate); + if (old_accum_surv_rate_pred != NULL) + FREE_C_HEAP_ARRAY(double, old_accum_surv_rate_pred); + if (old_surv_rate_pred != NULL) + FREE_C_HEAP_ARRAY(NumberSeq*, old_surv_rate_pred); + } + + for (size_t i = 0; i < _array_length; ++i) + _surv_rate[i] = 0.0; +} + +double +SurvRateGroup::accum_surv_rate(size_t adjustment) { + // we might relax this one in the future... + guarantee( adjustment == 0 || adjustment == 1, "pre-condition" ); + + double ret = _accum_surv_rate; + if (adjustment > 0) { + TruncatedSeq* seq = get_seq(_curr_length+1); + double surv_rate = _g1p->get_new_prediction(seq); + ret += surv_rate; + } + + return ret; +} + +int +SurvRateGroup::next_age_index() { + TruncatedSeq* seq = get_seq(_curr_length); + double surv_rate = _g1p->get_new_prediction(seq); + _accum_surv_rate += surv_rate; + + ++_curr_length; + return (int) ++_all_regions_allocated; +} + +void +SurvRateGroup::record_scan_only_prefix(size_t scan_only_prefix) { + guarantee( scan_only_prefix <= _curr_length, "pre-condition" ); + _scan_only_prefix = scan_only_prefix; +} + +void +SurvRateGroup::record_surviving_words(int age_in_group, size_t surv_words) { + guarantee( 0 <= age_in_group && (size_t) age_in_group < _curr_length, + "pre-condition" ); + guarantee( _surv_rate[age_in_group] <= 0.00001, + "should only update each slot once" ); + + double surv_rate = (double) surv_words / (double) HeapRegion::GrainWords; + _surv_rate[age_in_group] = surv_rate; + _surv_rate_pred[age_in_group]->add(surv_rate); + if ((size_t)age_in_group < _summary_surv_rates_len) { + _summary_surv_rates[age_in_group]->add(surv_rate); + if ((size_t)(age_in_group+1) > _summary_surv_rates_max_len) + _summary_surv_rates_max_len = age_in_group+1; + } +} + +void +SurvRateGroup::all_surviving_words_recorded(bool propagate) { + if (propagate && _curr_length > 0) { // conservative + double surv_rate = _surv_rate_pred[_curr_length-1]->last(); + +#if 0 + gclog_or_tty->print_cr("propagating %1.2lf from %d to %d", + surv_rate, _curr_length, _array_length - 1); +#endif // 0 + + for (size_t i = _curr_length; i < _array_length; ++i) { + guarantee( _surv_rate[i] <= 0.00001, + "the slot should not have been updated" ); + _surv_rate_pred[i]->add(surv_rate); + } + } + + double accum = 0.0; + double pred = 0.0; + for (size_t i = 0; i < _array_length; ++i) { + pred = _g1p->get_new_prediction(_surv_rate_pred[i]); + if (pred > 1.0) pred = 1.0; + accum += pred; + _accum_surv_rate_pred[i] = accum; + // gclog_or_tty->print_cr("age %3d, accum %10.2lf", i, accum); + } + _last_pred = pred; +} + +#ifndef PRODUCT +void +SurvRateGroup::print() { + gclog_or_tty->print_cr("Surv Rate Group: %s (%d entries, %d scan-only)", + _name, _curr_length, _scan_only_prefix); + for (size_t i = 0; i < _curr_length; ++i) { + gclog_or_tty->print_cr(" age %4d surv rate %6.2lf %% pred %6.2lf %%%s", + i, _surv_rate[i] * 100.0, + _g1p->get_new_prediction(_surv_rate_pred[i]) * 100.0, + (i < _scan_only_prefix) ? " S-O" : " "); + } +} + +void +SurvRateGroup::print_surv_rate_summary() { + size_t length = _summary_surv_rates_max_len; + if (length == 0) + return; + + gclog_or_tty->print_cr(""); + gclog_or_tty->print_cr("%s Rate Summary (for up to age %d)", _name, length-1); + gclog_or_tty->print_cr(" age range survival rate (avg) samples (avg)"); + gclog_or_tty->print_cr(" ---------------------------------------------------------"); + + size_t index = 0; + size_t limit = MIN2((int) length, 10); + while (index < limit) { + gclog_or_tty->print_cr(" %4d %6.2lf%% %6.2lf", + index, _summary_surv_rates[index]->avg() * 100.0, + (double) _summary_surv_rates[index]->num()); + ++index; + } + + gclog_or_tty->print_cr(" ---------------------------------------------------------"); + + int num = 0; + double sum = 0.0; + int samples = 0; + while (index < length) { + ++num; + sum += _summary_surv_rates[index]->avg() * 100.0; + samples += _summary_surv_rates[index]->num(); + ++index; + + if (index == length || num % 10 == 0) { + gclog_or_tty->print_cr(" %4d .. %4d %6.2lf%% %6.2lf", + (index-1) / 10 * 10, index-1, sum / (double) num, + (double) samples / (double) num); + sum = 0.0; + num = 0; + samples = 0; + } + } + + gclog_or_tty->print_cr(" ---------------------------------------------------------"); +} +#endif // PRODUCT diff --git a/hotspot/src/share/vm/gc_implementation/g1/survRateGroup.hpp b/hotspot/src/share/vm/gc_implementation/g1/survRateGroup.hpp new file mode 100644 index 00000000000..ce69e65f08f --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/survRateGroup.hpp @@ -0,0 +1,102 @@ +/* + * Copyright 2001-2007 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. + * + */ + +class G1CollectorPolicy; + +class SurvRateGroup : public CHeapObj { +private: + G1CollectorPolicy* _g1p; + const char* _name; + + size_t _array_length; + double* _surv_rate; + double* _accum_surv_rate_pred; + double _last_pred; + double _accum_surv_rate; + TruncatedSeq** _surv_rate_pred; + NumberSeq** _summary_surv_rates; + size_t _summary_surv_rates_len; + size_t _summary_surv_rates_max_len; + + int _all_regions_allocated; + size_t _curr_length; + size_t _scan_only_prefix; + size_t _setup_seq_num; + +public: + SurvRateGroup(G1CollectorPolicy* g1p, + const char* name, + size_t summary_surv_rates_len); + void start_adding_regions(); + void stop_adding_regions(); + void record_scan_only_prefix(size_t scan_only_prefix); + void record_surviving_words(int age_in_group, size_t surv_words); + void all_surviving_words_recorded(bool propagate); + const char* name() { return _name; } + + size_t region_num() { return _curr_length; } + size_t scan_only_length() { return _scan_only_prefix; } + double accum_surv_rate_pred(int age) { + assert(age >= 0, "must be"); + if ((size_t)age < _array_length) + return _accum_surv_rate_pred[age]; + else { + double diff = (double) (age - _array_length + 1); + return _accum_surv_rate_pred[_array_length-1] + diff * _last_pred; + } + } + + double accum_surv_rate(size_t adjustment); + + TruncatedSeq* get_seq(size_t age) { + guarantee( 0 <= age, "pre-condition" ); + if (age >= _setup_seq_num) { + guarantee( _setup_seq_num > 0, "invariant" ); + age = _setup_seq_num-1; + } + TruncatedSeq* seq = _surv_rate_pred[age]; + guarantee( seq != NULL, "invariant" ); + return seq; + } + + int next_age_index(); + int age_in_group(int age_index) { + int ret = (int) (_all_regions_allocated - age_index); + assert( ret >= 0, "invariant" ); + return ret; + } + int recalculate_age_index(int age_index) { + int new_age_index = (int) _scan_only_prefix - age_in_group(age_index); + guarantee( new_age_index >= 0, "invariant" ); + return new_age_index; + } + void finished_recalculating_age_indexes() { + _all_regions_allocated = (int) _scan_only_prefix; + } + +#ifndef PRODUCT + void print(); + void print_surv_rate_summary(); +#endif // PRODUCT +}; diff --git a/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp b/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp new file mode 100644 index 00000000000..e5753d53b42 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp @@ -0,0 +1,79 @@ +/* + * Copyright 2001-2007 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. + * + */ + +#include "incls/_precompiled.incl" +#include "incls/_vm_operations_g1.cpp.incl" + +void VM_G1CollectForAllocation::doit() { + JvmtiGCForAllocationMarker jgcm; + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + _res = g1h->satisfy_failed_allocation(_size); + assert(g1h->is_in_or_null(_res), "result not in heap"); +} + +void VM_G1CollectFull::doit() { + JvmtiGCFullMarker jgcm; + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + GCCauseSetter x(g1h, _gc_cause); + g1h->do_full_collection(false /* clear_all_soft_refs */); +} + +void VM_G1IncCollectionPause::doit() { + JvmtiGCForAllocationMarker jgcm; + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + GCCauseSetter x(g1h, GCCause::_g1_inc_collection_pause); + g1h->do_collection_pause_at_safepoint(NULL); +} + +void VM_G1PopRegionCollectionPause::doit() { + JvmtiGCForAllocationMarker jgcm; + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + g1h->do_collection_pause_at_safepoint(_pop_region); +} + + +void VM_CGC_Operation::doit() { + gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps); + TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty); + TraceTime t(_printGCMessage, PrintGC, true, gclog_or_tty); + SharedHeap* sh = SharedHeap::heap(); + // This could go away if CollectedHeap gave access to _gc_is_active... + if (sh != NULL) { + IsGCActiveMark x; + _cl->do_void(); + } else { + _cl->do_void(); + } +} + +bool VM_CGC_Operation::doit_prologue() { + Heap_lock->lock(); + SharedHeap::heap()->_thread_holds_heap_lock_for_gc = true; + return true; +} + +void VM_CGC_Operation::doit_epilogue() { + SharedHeap::heap()->_thread_holds_heap_lock_for_gc = false; + Heap_lock->unlock(); +} diff --git a/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.hpp b/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.hpp new file mode 100644 index 00000000000..a914cea3b48 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.hpp @@ -0,0 +1,114 @@ +/* + * Copyright 2001-2007 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. + * + */ + +// VM_operations for the G1 collector. +// VM_GC_Operation: +// - VM_CGC_Operation +// - VM_G1CollectFull +// - VM_G1CollectForAllocation +// - VM_G1IncCollectionPause +// - VM_G1PopRegionCollectionPause + +class VM_G1CollectFull: public VM_GC_Operation { + private: + public: + VM_G1CollectFull(int gc_count_before, + GCCause::Cause gc_cause) + : VM_GC_Operation(gc_count_before) + { + _gc_cause = gc_cause; + } + ~VM_G1CollectFull() {} + virtual VMOp_Type type() const { return VMOp_G1CollectFull; } + virtual void doit(); + virtual const char* name() const { + return "full garbage-first collection"; + } +}; + +class VM_G1CollectForAllocation: public VM_GC_Operation { + private: + HeapWord* _res; + size_t _size; // size of object to be allocated + public: + VM_G1CollectForAllocation(size_t size, int gc_count_before) + : VM_GC_Operation(gc_count_before) { + _size = size; + _res = NULL; + } + ~VM_G1CollectForAllocation() {} + virtual VMOp_Type type() const { return VMOp_G1CollectForAllocation; } + virtual void doit(); + virtual const char* name() const { + return "garbage-first collection to satisfy allocation"; + } + HeapWord* result() { return _res; } +}; + +class VM_G1IncCollectionPause: public VM_GC_Operation { + public: + VM_G1IncCollectionPause(int gc_count_before) : + VM_GC_Operation(gc_count_before) {} + virtual VMOp_Type type() const { return VMOp_G1IncCollectionPause; } + virtual void doit(); + virtual const char* name() const { + return "garbage-first incremental collection pause"; + } +}; + +class VM_G1PopRegionCollectionPause: public VM_GC_Operation { + HeapRegion* _pop_region; + public: + VM_G1PopRegionCollectionPause(int gc_count_before, HeapRegion* pop_region) : + VM_GC_Operation(gc_count_before), + _pop_region(pop_region) + {} + virtual VMOp_Type type() const { return VMOp_G1PopRegionCollectionPause; } + virtual void doit(); + virtual const char* name() const { + return "garbage-first popular region collection pause"; + } +}; + +// Concurrent GC stop-the-world operations such as initial and final mark; +// consider sharing these with CMS's counterparts. +class VM_CGC_Operation: public VM_Operation { + VoidClosure* _cl; + const char* _printGCMessage; + public: + VM_CGC_Operation(VoidClosure* cl, const char *printGCMsg) : + _cl(cl), + _printGCMessage(printGCMsg) + {} + + ~VM_CGC_Operation() {} + + virtual VMOp_Type type() const { return VMOp_CGC_Operation; } + virtual void doit(); + virtual bool doit_prologue(); + virtual void doit_epilogue(); + virtual const char* name() const { + return "concurrent gc"; + } +}; diff --git a/hotspot/src/share/vm/gc_implementation/includeDB_gc_concurrentMarkSweep b/hotspot/src/share/vm/gc_implementation/includeDB_gc_concurrentMarkSweep index f715c15c0b0..18f06dad313 100644 --- a/hotspot/src/share/vm/gc_implementation/includeDB_gc_concurrentMarkSweep +++ b/hotspot/src/share/vm/gc_implementation/includeDB_gc_concurrentMarkSweep @@ -123,17 +123,6 @@ compactibleFreeListSpace.hpp space.hpp compactingPermGenGen.cpp concurrentMarkSweepGeneration.inline.hpp -concurrentGCThread.cpp concurrentGCThread.hpp -concurrentGCThread.cpp init.hpp -concurrentGCThread.cpp instanceRefKlass.hpp -concurrentGCThread.cpp interfaceSupport.hpp -concurrentGCThread.cpp java.hpp -concurrentGCThread.cpp javaCalls.hpp -concurrentGCThread.cpp oop.inline.hpp -concurrentGCThread.cpp systemDictionary.hpp - -concurrentGCThread.hpp thread.hpp - concurrentMarkSweepGeneration.cpp cardTableRS.hpp concurrentMarkSweepGeneration.cpp cmsAdaptiveSizePolicy.hpp concurrentMarkSweepGeneration.cpp cmsCollectorPolicy.hpp @@ -165,7 +154,7 @@ concurrentMarkSweepGeneration.cpp systemDictionary.hpp concurrentMarkSweepGeneration.cpp vmCMSOperations.hpp concurrentMarkSweepGeneration.cpp vmThread.hpp -concurrentMarkSweepGeneration.hpp bitMap.hpp +concurrentMarkSweepGeneration.hpp bitMap.inline.hpp concurrentMarkSweepGeneration.hpp freeBlockDictionary.hpp concurrentMarkSweepGeneration.hpp gSpaceCounters.hpp concurrentMarkSweepGeneration.hpp gcStats.hpp diff --git a/hotspot/src/share/vm/gc_implementation/includeDB_gc_g1 b/hotspot/src/share/vm/gc_implementation/includeDB_gc_g1 new file mode 100644 index 00000000000..addde840618 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/includeDB_gc_g1 @@ -0,0 +1,349 @@ +// +// Copyright 2004-2006 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. +// +// + +// NOTE: DO NOT CHANGE THIS COPYRIGHT TO NEW STYLE - IT WILL BREAK makeDeps! + +bufferingOopClosure.hpp genOopClosures.hpp +bufferingOopClosure.hpp generation.hpp +bufferingOopClosure.hpp os.hpp + +cardTableRS.cpp concurrentMark.hpp +cardTableRS.cpp g1SATBCardTableModRefBS.hpp + +collectionSetChooser.cpp g1CollectedHeap.hpp +collectionSetChooser.cpp g1CollectorPolicy.hpp +collectionSetChooser.cpp collectionSetChooser.hpp + +collectionSetChooser.hpp heapRegion.hpp +collectionSetChooser.hpp growableArray.hpp + +concurrentG1Refine.cpp atomic.hpp +concurrentG1Refine.cpp concurrentG1Refine.hpp +concurrentG1Refine.cpp concurrentG1RefineThread.hpp +concurrentG1Refine.cpp copy.hpp +concurrentG1Refine.cpp g1CollectedHeap.hpp +concurrentG1Refine.cpp g1RemSet.hpp + +concurrentG1Refine.hpp globalDefinitions.hpp + +concurrentG1RefineThread.cpp concurrentG1Refine.hpp +concurrentG1RefineThread.cpp concurrentG1RefineThread.hpp +concurrentG1RefineThread.cpp g1CollectedHeap.hpp +concurrentG1RefineThread.cpp g1CollectorPolicy.hpp +concurrentG1RefineThread.cpp handles.inline.hpp +concurrentG1RefineThread.cpp mutexLocker.hpp +concurrentG1RefineThread.cpp resourceArea.hpp + +concurrentG1RefineThread.hpp concurrentGCThread.hpp +concurrentG1RefineThread.hpp coTracker.hpp + +concurrentMark.cpp concurrentMark.hpp +concurrentMark.cpp concurrentMarkThread.inline.hpp +concurrentMark.cpp g1CollectedHeap.inline.hpp +concurrentMark.cpp g1CollectorPolicy.hpp +concurrentMark.cpp g1RemSet.hpp +concurrentMark.cpp gcOverheadReporter.hpp +concurrentMark.cpp genOopClosures.inline.hpp +concurrentMark.cpp heapRegionRemSet.hpp +concurrentMark.cpp heapRegionSeq.inline.hpp +concurrentMark.cpp handles.inline.hpp +concurrentMark.cpp java.hpp +concurrentMark.cpp oop.inline.hpp +concurrentMark.cpp referencePolicy.hpp +concurrentMark.cpp resourceArea.hpp +concurrentMark.cpp symbolTable.hpp + +concurrentMark.hpp coTracker.hpp +concurrentMark.hpp heapRegion.hpp +concurrentMark.hpp taskqueue.hpp + +concurrentMarkThread.cpp concurrentMarkThread.inline.hpp +concurrentMarkThread.cpp g1CollectedHeap.inline.hpp +concurrentMarkThread.cpp g1CollectorPolicy.hpp +concurrentMarkThread.cpp g1MMUTracker.hpp +concurrentMarkThread.cpp resourceArea.hpp +concurrentMarkThread.cpp vm_operations_g1.hpp +concurrentMarkThread.cpp vmThread.hpp + +concurrentMarkThread.hpp concurrentGCThread.hpp + +concurrentMarkThread.inline.hpp concurrentMark.hpp +concurrentMarkThread.inline.hpp concurrentMarkThread.hpp + +concurrentZFThread.cpp concurrentZFThread.hpp +concurrentZFThread.cpp heapRegion.hpp +concurrentZFThread.cpp g1CollectedHeap.inline.hpp +concurrentZFThread.cpp copy.hpp +concurrentZFThread.cpp mutexLocker.hpp +concurrentZFThread.cpp space.inline.hpp + +concurrentZFThread.hpp concurrentGCThread.hpp +concurrentZFThread.hpp coTracker.hpp + +dirtyCardQueue.cpp atomic.hpp +dirtyCardQueue.cpp dirtyCardQueue.hpp +dirtyCardQueue.cpp heapRegionRemSet.hpp +dirtyCardQueue.cpp mutexLocker.hpp +dirtyCardQueue.cpp ptrQueue.inline.hpp +dirtyCardQueue.cpp safepoint.hpp +dirtyCardQueue.cpp thread.hpp +dirtyCardQueue.cpp thread_.inline.hpp +dirtyCardQueue.cpp workgroup.hpp + +dirtyCardQueue.hpp allocation.hpp +dirtyCardQueue.hpp ptrQueue.hpp + +g1BlockOffsetTable.cpp g1BlockOffsetTable.inline.hpp +g1BlockOffsetTable.cpp java.hpp +g1BlockOffsetTable.cpp oop.inline.hpp +g1BlockOffsetTable.cpp space.hpp + +g1BlockOffsetTable.hpp globalDefinitions.hpp +g1BlockOffsetTable.hpp memRegion.hpp +g1BlockOffsetTable.hpp virtualspace.hpp + +g1BlockOffsetTable.inline.hpp g1BlockOffsetTable.hpp +g1BlockOffsetTable.inline.hpp space.hpp + +g1CollectedHeap.cpp aprofiler.hpp +g1CollectedHeap.cpp bufferingOopClosure.hpp +g1CollectedHeap.cpp concurrentG1Refine.hpp +g1CollectedHeap.cpp concurrentG1RefineThread.hpp +g1CollectedHeap.cpp concurrentMarkThread.inline.hpp +g1CollectedHeap.cpp concurrentZFThread.hpp +g1CollectedHeap.cpp g1CollectedHeap.inline.hpp +g1CollectedHeap.cpp g1CollectorPolicy.hpp +g1CollectedHeap.cpp g1MarkSweep.hpp +g1CollectedHeap.cpp g1RemSet.hpp +g1CollectedHeap.cpp g1OopClosures.inline.hpp +g1CollectedHeap.cpp genOopClosures.inline.hpp +g1CollectedHeap.cpp gcLocker.inline.hpp +g1CollectedHeap.cpp gcOverheadReporter.hpp +g1CollectedHeap.cpp generationSpec.hpp +g1CollectedHeap.cpp heapRegionRemSet.hpp +g1CollectedHeap.cpp heapRegionSeq.inline.hpp +g1CollectedHeap.cpp icBuffer.hpp +g1CollectedHeap.cpp isGCActiveMark.hpp +g1CollectedHeap.cpp oop.inline.hpp +g1CollectedHeap.cpp oop.pcgc.inline.hpp +g1CollectedHeap.cpp parGCAllocBuffer.hpp +g1CollectedHeap.cpp vm_operations_g1.hpp +g1CollectedHeap.cpp vmThread.hpp + +g1CollectedHeap.hpp barrierSet.hpp +g1CollectedHeap.hpp heapRegion.hpp +g1CollectedHeap.hpp memRegion.hpp +g1CollectedHeap.hpp sharedHeap.hpp + +g1CollectedHeap.inline.hpp concurrentMark.hpp +g1CollectedHeap.inline.hpp g1CollectedHeap.hpp +g1CollectedHeap.inline.hpp heapRegionSeq.hpp +g1CollectedHeap.inline.hpp taskqueue.hpp + +g1CollectorPolicy.cpp concurrentG1Refine.hpp +g1CollectorPolicy.cpp concurrentMark.hpp +g1CollectorPolicy.cpp concurrentMarkThread.inline.hpp +g1CollectorPolicy.cpp debug.hpp +g1CollectorPolicy.cpp java.hpp +g1CollectorPolicy.cpp g1CollectedHeap.hpp +g1CollectorPolicy.cpp g1CollectorPolicy.hpp +g1CollectorPolicy.cpp heapRegionRemSet.hpp +g1CollectorPolicy.cpp mutexLocker.hpp + +g1CollectorPolicy.hpp collectorPolicy.hpp +g1CollectorPolicy.hpp collectionSetChooser.hpp +g1CollectorPolicy.hpp g1MMUTracker.hpp + +g1_globals.cpp g1_globals.hpp + +g1_globals.hpp globals.hpp + +globals.cpp g1_globals.hpp +top.hpp g1_globals.hpp + +g1MarkSweep.cpp aprofiler.hpp +g1MarkSweep.cpp codeCache.hpp +g1MarkSweep.cpp events.hpp +g1MarkSweep.cpp fprofiler.hpp +g1MarkSweep.hpp g1CollectedHeap.hpp +g1MarkSweep.cpp g1MarkSweep.hpp +g1MarkSweep.cpp gcLocker.hpp +g1MarkSweep.cpp genCollectedHeap.hpp +g1MarkSweep.hpp heapRegion.hpp +g1MarkSweep.cpp icBuffer.hpp +g1MarkSweep.cpp instanceRefKlass.hpp +g1MarkSweep.cpp javaClasses.hpp +g1MarkSweep.cpp jvmtiExport.hpp +g1MarkSweep.cpp copy.hpp +g1MarkSweep.cpp modRefBarrierSet.hpp +g1MarkSweep.cpp oop.inline.hpp +g1MarkSweep.cpp referencePolicy.hpp +g1MarkSweep.cpp space.hpp +g1MarkSweep.cpp symbolTable.hpp +g1MarkSweep.cpp synchronizer.hpp +g1MarkSweep.cpp systemDictionary.hpp +g1MarkSweep.cpp thread.hpp +g1MarkSweep.cpp vmSymbols.hpp +g1MarkSweep.cpp vmThread.hpp + +g1MarkSweep.hpp generation.hpp +g1MarkSweep.hpp growableArray.hpp +g1MarkSweep.hpp markOop.hpp +g1MarkSweep.hpp genMarkSweep.hpp +g1MarkSweep.hpp oop.hpp +g1MarkSweep.hpp timer.hpp +g1MarkSweep.hpp universe.hpp + +g1OopClosures.inline.hpp concurrentMark.hpp +g1OopClosures.inline.hpp g1OopClosures.hpp +g1OopClosures.inline.hpp g1CollectedHeap.hpp +g1OopClosures.inline.hpp g1RemSet.hpp + +g1MMUTracker.cpp g1MMUTracker.hpp +g1MMUTracker.cpp ostream.hpp +g1MMUTracker.cpp mutexLocker.hpp + +g1MMUTracker.hpp debug.hpp + +g1RemSet.cpp bufferingOopClosure.hpp +g1RemSet.cpp concurrentG1Refine.hpp +g1RemSet.cpp concurrentG1RefineThread.hpp +g1RemSet.cpp g1BlockOffsetTable.inline.hpp +g1RemSet.cpp g1CollectedHeap.inline.hpp +g1RemSet.cpp g1CollectorPolicy.hpp +g1RemSet.cpp g1RemSet.inline.hpp +g1RemSet.cpp g1OopClosures.inline.hpp +g1RemSet.cpp heapRegionSeq.inline.hpp +g1RemSet.cpp intHisto.hpp +g1RemSet.cpp iterator.hpp +g1RemSet.cpp oop.inline.hpp + +g1RemSet.inline.hpp g1RemSet.hpp +g1RemSet.inline.hpp heapRegionRemSet.hpp + +g1SATBCardTableModRefBS.cpp g1SATBCardTableModRefBS.hpp +g1SATBCardTableModRefBS.cpp heapRegion.hpp +g1SATBCardTableModRefBS.cpp mutexLocker.hpp +g1SATBCardTableModRefBS.cpp thread.hpp +g1SATBCardTableModRefBS.cpp thread_.inline.hpp +g1SATBCardTableModRefBS.cpp satbQueue.hpp + +g1SATBCardTableModRefBS.hpp cardTableModRefBS.hpp +g1SATBCardTableModRefBS.hpp memRegion.hpp + +heapRegion.cpp concurrentZFThread.hpp +heapRegion.cpp g1BlockOffsetTable.inline.hpp +heapRegion.cpp g1CollectedHeap.inline.hpp +heapRegion.cpp g1OopClosures.inline.hpp +heapRegion.cpp genOopClosures.inline.hpp +heapRegion.cpp heapRegion.inline.hpp +heapRegion.cpp heapRegionRemSet.hpp +heapRegion.cpp heapRegionSeq.inline.hpp +heapRegion.cpp iterator.hpp +heapRegion.cpp oop.inline.hpp + +heapRegion.hpp space.hpp +heapRegion.hpp g1BlockOffsetTable.hpp +heapRegion.hpp watermark.hpp +heapRegion.hpp g1_specialized_oop_closures.hpp +heapRegion.hpp survRateGroup.hpp + +heapRegionRemSet.hpp sparsePRT.hpp + +heapRegionRemSet.cpp allocation.hpp +heapRegionRemSet.cpp bitMap.inline.hpp +heapRegionRemSet.cpp g1BlockOffsetTable.inline.hpp +heapRegionRemSet.cpp g1CollectedHeap.inline.hpp +heapRegionRemSet.cpp heapRegionRemSet.hpp +heapRegionRemSet.cpp heapRegionSeq.inline.hpp +heapRegionRemSet.cpp globalDefinitions.hpp +heapRegionRemSet.cpp space.inline.hpp + +heapRegionSeq.cpp allocation.hpp +heapRegionSeq.cpp g1CollectedHeap.hpp +heapRegionSeq.cpp heapRegionSeq.hpp + +heapRegionSeq.hpp growableArray.hpp +heapRegionSeq.hpp heapRegion.hpp + +heapRegionSeq.inline.hpp heapRegionSeq.hpp + +klass.hpp g1OopClosures.hpp + +ptrQueue.cpp allocation.hpp +ptrQueue.cpp allocation.inline.hpp +ptrQueue.cpp mutex.hpp +ptrQueue.cpp mutexLocker.hpp +ptrQueue.cpp ptrQueue.hpp +ptrQueue.cpp ptrQueue.inline.hpp +ptrQueue.cpp thread_.inline.hpp + +ptrQueue.hpp allocation.hpp +ptrQueue.hpp sizes.hpp + +ptrQueue.inline.hpp ptrQueue.hpp + +satbQueue.cpp allocation.inline.hpp +satbQueue.cpp mutexLocker.hpp +satbQueue.cpp ptrQueue.inline.hpp +satbQueue.cpp satbQueue.hpp +satbQueue.cpp sharedHeap.hpp +satbQueue.cpp thread.hpp + +satbQueue.hpp ptrQueue.hpp + +sparsePRT.cpp allocation.inline.hpp +sparsePRT.cpp cardTableModRefBS.hpp +sparsePRT.cpp heapRegion.hpp +sparsePRT.cpp heapRegionRemSet.hpp +sparsePRT.cpp mutexLocker.hpp +sparsePRT.cpp sparsePRT.hpp +sparsePRT.cpp space.inline.hpp + +sparsePRT.hpp allocation.hpp +sparsePRT.hpp cardTableModRefBS.hpp +sparsePRT.hpp globalDefinitions.hpp +sparsePRT.hpp heapRegion.hpp +sparsePRT.hpp mutex.hpp + +specialized_oop_closures.hpp g1_specialized_oop_closures.hpp + +survRateGroup.hpp numberSeq.hpp + +survRateGroup.cpp allocation.hpp +survRateGroup.cpp g1CollectedHeap.hpp +survRateGroup.cpp g1CollectorPolicy.hpp +survRateGroup.cpp heapRegion.hpp +survRateGroup.cpp survRateGroup.hpp + +thread.cpp concurrentMarkThread.inline.hpp + +universe.cpp g1CollectedHeap.hpp +universe.cpp g1CollectorPolicy.hpp + +vm_operations_g1.hpp vmGCOperations.hpp + +vm_operations_g1.cpp vm_operations_g1.hpp +vm_operations_g1.cpp g1CollectedHeap.hpp +vm_operations_g1.cpp isGCActiveMark.hpp diff --git a/hotspot/src/share/vm/gc_implementation/includeDB_gc_parallelScavenge b/hotspot/src/share/vm/gc_implementation/includeDB_gc_parallelScavenge index 8a2a7a6127b..31c805d79ec 100644 --- a/hotspot/src/share/vm/gc_implementation/includeDB_gc_parallelScavenge +++ b/hotspot/src/share/vm/gc_implementation/includeDB_gc_parallelScavenge @@ -148,7 +148,6 @@ parallelScavengeHeap.hpp psPermGen.hpp parallelScavengeHeap.hpp psYoungGen.hpp parallelScavengeHeap.hpp ostream.hpp -parMarkBitMap.cpp bitMap.hpp parMarkBitMap.cpp bitMap.inline.hpp parMarkBitMap.cpp oop.inline.hpp parMarkBitMap.cpp os.hpp @@ -157,7 +156,6 @@ parMarkBitMap.cpp parMarkBitMap.hpp parMarkBitMap.cpp parMarkBitMap.inline.hpp parMarkBitMap.cpp psParallelCompact.hpp -parMarkBitMap.hpp bitMap.hpp parMarkBitMap.hpp bitMap.inline.hpp parMarkBitMap.hpp psVirtualspace.hpp diff --git a/hotspot/src/share/vm/gc_implementation/includeDB_gc_shared b/hotspot/src/share/vm/gc_implementation/includeDB_gc_shared index ca8a47fa2fa..e71114c8214 100644 --- a/hotspot/src/share/vm/gc_implementation/includeDB_gc_shared +++ b/hotspot/src/share/vm/gc_implementation/includeDB_gc_shared @@ -24,6 +24,23 @@ // NOTE: DO NOT CHANGE THIS COPYRIGHT TO NEW STYLE - IT WILL BREAK makeDeps! +concurrentGCThread.cpp concurrentGCThread.hpp +concurrentGCThread.cpp init.hpp +concurrentGCThread.cpp instanceRefKlass.hpp +concurrentGCThread.cpp interfaceSupport.hpp +concurrentGCThread.cpp java.hpp +concurrentGCThread.cpp javaCalls.hpp +concurrentGCThread.cpp oop.inline.hpp +concurrentGCThread.cpp systemDictionary.hpp + +concurrentGCThread.hpp thread.hpp + +coTracker.hpp globalDefinitions.hpp +coTracker.hpp numberSeq.hpp + +coTracker.cpp coTracker.hpp +coTracker.cpp os.hpp + allocationStats.cpp allocationStats.hpp allocationStats.cpp ostream.hpp @@ -37,6 +54,13 @@ gcAdaptivePolicyCounters.hpp gcPolicyCounters.hpp gcAdaptivePolicyCounters.cpp resourceArea.hpp gcAdaptivePolicyCounters.cpp gcAdaptivePolicyCounters.hpp +gcOverheadReporter.cpp allocation.inline.hpp +gcOverheadReporter.cpp concurrentGCThread.hpp +gcOverheadReporter.cpp coTracker.hpp +gcOverheadReporter.cpp gcOverheadReporter.hpp +gcOverheadReporter.cpp ostream.hpp +gcOverheadReporter.cpp thread_.inline.hpp + gSpaceCounters.cpp generation.hpp gSpaceCounters.cpp resourceArea.hpp gSpaceCounters.cpp gSpaceCounters.hpp @@ -72,3 +96,5 @@ spaceCounters.hpp immutableSpace.hpp spaceCounters.hpp mutableSpace.hpp spaceCounters.hpp perfData.hpp spaceCounters.hpp generationCounters.hpp + +vmGCOperations.cpp g1CollectedHeap.hpp diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.hpp index 3363a01155d..ca2ea6f9d9d 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.hpp @@ -192,16 +192,16 @@ private: }; inline ParMarkBitMap::ParMarkBitMap(): - _beg_bits(NULL, 0), - _end_bits(NULL, 0) + _beg_bits(), + _end_bits() { _region_start = 0; _virtual_space = 0; } inline ParMarkBitMap::ParMarkBitMap(MemRegion covered_region): - _beg_bits(NULL, 0), - _end_bits(NULL, 0) + _beg_bits(), + _end_bits() { initialize(covered_region); } @@ -325,7 +325,7 @@ ParMarkBitMap::obj_size(HeapWord* beg_addr, HeapWord* end_addr) const inline size_t ParMarkBitMap::obj_size(idx_t beg_bit) const { - const idx_t end_bit = _end_bits.find_next_one_bit(beg_bit, size()); + const idx_t end_bit = _end_bits.get_next_one_offset_inline(beg_bit, size()); assert(is_marked(beg_bit), "obj not marked"); assert(end_bit < size(), "end bit missing"); return obj_size(beg_bit, end_bit); @@ -384,13 +384,13 @@ ParMarkBitMap::bit_to_addr(idx_t bit) const inline ParMarkBitMap::idx_t ParMarkBitMap::find_obj_beg(idx_t beg, idx_t end) const { - return _beg_bits.find_next_one_bit(beg, end); + return _beg_bits.get_next_one_offset_inline_aligned_right(beg, end); } inline ParMarkBitMap::idx_t ParMarkBitMap::find_obj_end(idx_t beg, idx_t end) const { - return _end_bits.find_next_one_bit(beg, end); + return _end_bits.get_next_one_offset_inline_aligned_right(beg, end); } inline HeapWord* diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp index d26eec48882..8f049133ac5 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp @@ -184,6 +184,20 @@ class ParallelScavengeHeap : public CollectedHeap { size_t tlab_capacity(Thread* thr) const; size_t unsafe_max_tlab_alloc(Thread* thr) const; + // Can a compiler initialize a new object without store barriers? + // This permission only extends from the creation of a new object + // via a TLAB up to the first subsequent safepoint. + virtual bool can_elide_tlab_store_barriers() const { + return true; + } + + // Can a compiler elide a store barrier when it writes + // a permanent oop into the heap? Applies when the compiler + // is storing x to the heap, where x->is_perm() is true. + virtual bool can_elide_permanent_oop_store_barriers() const { + return true; + } + void oop_iterate(OopClosure* cl); void object_iterate(ObjectClosure* cl); void permanent_oop_iterate(OopClosure* cl); diff --git a/hotspot/src/share/vm/gc_implementation/shared/coTracker.cpp b/hotspot/src/share/vm/gc_implementation/shared/coTracker.cpp new file mode 100644 index 00000000000..c15fcc010e2 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/shared/coTracker.cpp @@ -0,0 +1,189 @@ +/* + * Copyright 2001-2007 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. + * + */ + +# include "incls/_precompiled.incl" +# include "incls/_coTracker.cpp.incl" + +COTracker* COTracker::_head = NULL; +double COTracker::_cpu_number = -1.0; + +void +COTracker::resetPeriod(double now_sec, double vnow_sec) { + guarantee( _enabled, "invariant" ); + _period_start_time_sec = now_sec; + _period_start_vtime_sec = vnow_sec; +} + +void +COTracker::setConcOverhead(double time_stamp_sec, + double conc_overhead) { + guarantee( _enabled, "invariant" ); + _conc_overhead = conc_overhead; + _time_stamp_sec = time_stamp_sec; + if (conc_overhead > 0.001) + _conc_overhead_seq.add(conc_overhead); +} + +void +COTracker::reset(double starting_conc_overhead) { + guarantee( _enabled, "invariant" ); + double now_sec = os::elapsedTime(); + setConcOverhead(now_sec, starting_conc_overhead); +} + +void +COTracker::start() { + guarantee( _enabled, "invariant" ); + resetPeriod(os::elapsedTime(), os::elapsedVTime()); +} + +void +COTracker::update(bool force_end) { + assert( _enabled, "invariant" ); + double end_time_sec = os::elapsedTime(); + double elapsed_time_sec = end_time_sec - _period_start_time_sec; + if (force_end || elapsed_time_sec > _update_period_sec) { + // reached the end of the period + double end_vtime_sec = os::elapsedVTime(); + double elapsed_vtime_sec = end_vtime_sec - _period_start_vtime_sec; + + double conc_overhead = elapsed_vtime_sec / elapsed_time_sec; + + setConcOverhead(end_time_sec, conc_overhead); + resetPeriod(end_time_sec, end_vtime_sec); + } +} + +void +COTracker::updateForSTW(double start_sec, double end_sec) { + if (!_enabled) + return; + + // During a STW pause, no concurrent GC thread has done any + // work. So, we can safely adjust the start of the current period by + // adding the duration of the STW pause to it, so that the STW pause + // doesn't affect the reading of the concurrent overhead (it's + // basically like excluding the time of the STW pause from the + // concurrent overhead calculation). + + double stw_duration_sec = end_sec - start_sec; + guarantee( stw_duration_sec > 0.0, "invariant" ); + + if (outOfDate(start_sec)) + _conc_overhead = 0.0; + else + _time_stamp_sec = end_sec; + _period_start_time_sec += stw_duration_sec; + _conc_overhead_seq = NumberSeq(); + + guarantee( os::elapsedTime() > _period_start_time_sec, "invariant" ); +} + +double +COTracker::predConcOverhead() { + if (_enabled) { + // tty->print(" %1.2lf", _conc_overhead_seq.maximum()); + return _conc_overhead_seq.maximum(); + } else { + // tty->print(" DD"); + return 0.0; + } +} + +void +COTracker::resetPred() { + _conc_overhead_seq = NumberSeq(); +} + +COTracker::COTracker(int group) + : _enabled(false), + _group(group), + _period_start_time_sec(-1.0), + _period_start_vtime_sec(-1.0), + _conc_overhead(-1.0), + _time_stamp_sec(-1.0), + _next(NULL) { + // GCOverheadReportingPeriodMS indicates how frequently the + // concurrent overhead will be recorded by the GC Overhead + // Reporter. We want to take readings less often than that. If we + // took readings more often than some of them might be lost. + _update_period_sec = ((double) GCOverheadReportingPeriodMS) / 1000.0 * 1.25; + _next = _head; + _head = this; + + if (_cpu_number < 0.0) + _cpu_number = (double) os::processor_count(); +} + +// statics + +void +COTracker::updateAllForSTW(double start_sec, double end_sec) { + for (COTracker* curr = _head; curr != NULL; curr = curr->_next) { + curr->updateForSTW(start_sec, end_sec); + } +} + +double +COTracker::totalConcOverhead(double now_sec) { + double total_conc_overhead = 0.0; + + for (COTracker* curr = _head; curr != NULL; curr = curr->_next) { + double conc_overhead = curr->concOverhead(now_sec); + total_conc_overhead += conc_overhead; + } + + return total_conc_overhead; +} + +double +COTracker::totalConcOverhead(double now_sec, + size_t group_num, + double* co_per_group) { + double total_conc_overhead = 0.0; + + for (size_t i = 0; i < group_num; ++i) + co_per_group[i] = 0.0; + + for (COTracker* curr = _head; curr != NULL; curr = curr->_next) { + size_t group = curr->_group; + assert( 0 <= group && group < group_num, "invariant" ); + double conc_overhead = curr->concOverhead(now_sec); + + co_per_group[group] += conc_overhead; + total_conc_overhead += conc_overhead; + } + + return total_conc_overhead; +} + +double +COTracker::totalPredConcOverhead() { + double total_pred_conc_overhead = 0.0; + for (COTracker* curr = _head; curr != NULL; curr = curr->_next) { + total_pred_conc_overhead += curr->predConcOverhead(); + curr->resetPred(); + } + return total_pred_conc_overhead / _cpu_number; +} diff --git a/hotspot/src/share/vm/gc_implementation/shared/coTracker.hpp b/hotspot/src/share/vm/gc_implementation/shared/coTracker.hpp new file mode 100644 index 00000000000..3c9fa012e57 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/shared/coTracker.hpp @@ -0,0 +1,181 @@ +/* + * Copyright 2001-2007 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. + * + */ + +// COTracker keeps track of the concurrent overhead of a GC thread. + +// A thread that needs to be tracked must, itself, start up its +// tracker with the start() method and then call the update() method +// at regular intervals. What the tracker does is to calculate the +// concurrent overhead of a process at a given update period. The +// tracker starts and when is detects that it has exceeded the given +// period, it calculates the duration of the period in wall-clock time +// and the duration of the period in vtime (i.e. how much time the +// concurrent processes really took up during this period). The ratio +// of the latter over the former is the concurrent overhead of that +// process for that period over a single CPU. This overhead is stored +// on the tracker, "timestamped" with the wall-clock time of the end +// of the period. When the concurrent overhead of this process needs +// to be queried, this last "reading" provides a good approximation +// (we assume that the concurrent overhead of a particular thread +// stays largely constant over time). The timestamp is necessary to +// detect when the process has stopped working and the recorded +// reading hasn't been updated for some time. + +// Each concurrent GC thread is considered to be part of a "group" +// (i.e. any available concurrent marking threads are part of the +// "concurrent marking thread group"). A COTracker is associated with +// a single group at construction-time. It's up to each collector to +// decide how groups will be mapped to such an id (ids should start +// from 0 and be consecutive; there's a hardcoded max group num +// defined on the GCOverheadTracker class). The notion of a group has +// been introduced to be able to identify how much overhead was +// imposed by each group, instead of getting a single value that +// covers all concurrent overhead. + +class COTracker { +private: + // It indicates whether this tracker is enabled or not. When the + // tracker is disabled, then it returns 0.0 as the latest concurrent + // overhead and several methods (reset, start, and update) are not + // supposed to be called on it. This enabling / disabling facility + // is really provided to make a bit more explicit in the code when a + // particulary tracker of a processes that doesn't run all the time + // (e.g. concurrent marking) is supposed to be used and not it's not. + bool _enabled; + + // The ID of the group associated with this tracker. + int _group; + + // The update period of the tracker. A new value for the concurrent + // overhead of the associated process will be made at intervals no + // smaller than this. + double _update_period_sec; + + // The start times (both wall-block time and vtime) of the current + // interval. + double _period_start_time_sec; + double _period_start_vtime_sec; + + // Number seq of the concurrent overhead readings within a period + NumberSeq _conc_overhead_seq; + + // The latest reading of the concurrent overhead (over a single CPU) + // imposed by the associated concurrent thread, made available at + // the indicated wall-clock time. + double _conc_overhead; + double _time_stamp_sec; + + // The number of CPUs that the host machine has (for convenience + // really, as we'd have to keep translating it into a double) + static double _cpu_number; + + // Fields that keep a list of all trackers created. This is useful, + // since it allows us to sum up the concurrent overhead without + // having to write code for a specific collector to broadcast a + // request to all its concurrent processes. + COTracker* _next; + static COTracker* _head; + + // It indicates that a new period is starting by updating the + // _period_start_time_sec and _period_start_vtime_sec fields. + void resetPeriod(double now_sec, double vnow_sec); + // It updates the latest concurrent overhead reading, taken at a + // given wall-clock time. + void setConcOverhead(double time_stamp_sec, double conc_overhead); + + // It determines whether the time stamp of the latest concurrent + // overhead reading is out of date or not. + bool outOfDate(double now_sec) { + // The latest reading is considered out of date, if it was taken + // 1.2x the update period. + return (now_sec - _time_stamp_sec) > 1.2 * _update_period_sec; + } + +public: + // The constructor which associates the tracker with a group ID. + COTracker(int group); + + // Methods to enable / disable the tracker and query whether it is enabled. + void enable() { _enabled = true; } + void disable() { _enabled = false; } + bool enabled() { return _enabled; } + + // It resets the tracker and sets concurrent overhead reading to be + // the given parameter and the associated time stamp to be now. + void reset(double starting_conc_overhead = 0.0); + // The tracker starts tracking. IT should only be called from the + // concurrent thread that is tracked by this tracker. + void start(); + // It updates the tracker and, if the current period is longer than + // the update period, the concurrent overhead reading will be + // updated. force_end being true indicates that it's the last call + // to update() by this process before the tracker is disabled (the + // tracker can be re-enabled later if necessary). It should only be + // called from the concurrent thread that is tracked by this tracker + // and while the thread has joined the STS. + void update(bool force_end = false); + // It adjusts the contents of the tracker to take into account a STW + // pause. + void updateForSTW(double start_sec, double end_sec); + + // It returns the last concurrent overhead reading over a single + // CPU. If the reading is out of date, or the tracker is disabled, + // it returns 0.0. + double concCPUOverhead(double now_sec) { + if (!_enabled || outOfDate(now_sec)) + return 0.0; + else + return _conc_overhead; + } + + // It returns the last concurrent overhead reading over all CPUs + // that the host machine has. If the reading is out of date, or the + // tracker is disabled, it returns 0.0. + double concOverhead(double now_sec) { + return concCPUOverhead(now_sec) / _cpu_number; + } + + double predConcOverhead(); + + void resetPred(); + + // statics + + // It notifies all trackers about a STW pause. + static void updateAllForSTW(double start_sec, double end_sec); + + // It returns the sum of the concurrent overhead readings of all + // available (and enabled) trackers for the given time stamp. The + // overhead is over all the CPUs of the host machine. + + static double totalConcOverhead(double now_sec); + // Like the previous method, but it also sums up the overheads per + // group number. The length of the co_per_group array must be at + // least as large group_num + static double totalConcOverhead(double now_sec, + size_t group_num, + double* co_per_group); + + static double totalPredConcOverhead(); +}; diff --git a/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp b/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp new file mode 100644 index 00000000000..8ed8b809e2a --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp @@ -0,0 +1,314 @@ +/* + * Copyright 2001-2005 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. + * + */ + +// CopyrightVersion 1.2 + +# include "incls/_precompiled.incl" +# include "incls/_concurrentGCThread.cpp.incl" + +bool ConcurrentGCThread::_should_terminate = false; +bool ConcurrentGCThread::_has_terminated = false; +int ConcurrentGCThread::_CGC_flag = CGC_nil; + +SuspendibleThreadSet ConcurrentGCThread::_sts; + +ConcurrentGCThread::ConcurrentGCThread() { + _sts.initialize(); +}; + +void ConcurrentGCThread::stopWorldAndDo(VoidClosure* op) { + MutexLockerEx x(Heap_lock, + Mutex::_no_safepoint_check_flag); + // warning("CGC: about to try stopping world"); + SafepointSynchronize::begin(); + // warning("CGC: successfully stopped world"); + op->do_void(); + SafepointSynchronize::end(); + // warning("CGC: successfully restarted world"); +} + +void ConcurrentGCThread::safepoint_synchronize() { + _sts.suspend_all(); +} + +void ConcurrentGCThread::safepoint_desynchronize() { + _sts.resume_all(); +} + +void ConcurrentGCThread::create_and_start() { + if (os::create_thread(this, os::cgc_thread)) { + // XXX: need to set this to low priority + // unless "agressive mode" set; priority + // should be just less than that of VMThread. + os::set_priority(this, NearMaxPriority); + if (!_should_terminate && !DisableStartThread) { + os::start_thread(this); + } + } +} + +void ConcurrentGCThread::initialize_in_thread() { + this->record_stack_base_and_size(); + this->initialize_thread_local_storage(); + this->set_active_handles(JNIHandleBlock::allocate_block()); + // From this time Thread::current() should be working. + assert(this == Thread::current(), "just checking"); +} + +void ConcurrentGCThread::wait_for_universe_init() { + MutexLockerEx x(CGC_lock, Mutex::_no_safepoint_check_flag); + while (!is_init_completed() && !_should_terminate) { + CGC_lock->wait(Mutex::_no_safepoint_check_flag, 200); + } +} + +void ConcurrentGCThread::terminate() { + // Signal that it is terminated + { + MutexLockerEx mu(Terminator_lock, + Mutex::_no_safepoint_check_flag); + _has_terminated = true; + Terminator_lock->notify(); + } + + // Thread destructor usually does this.. + ThreadLocalStorage::set_thread(NULL); +} + + +void SuspendibleThreadSet::initialize_work() { + MutexLocker x(STS_init_lock); + if (!_initialized) { + _m = new Monitor(Mutex::leaf, + "SuspendibleThreadSetLock", true); + _async = 0; + _async_stop = false; + _async_stopped = 0; + _initialized = true; + } +} + +void SuspendibleThreadSet::join() { + initialize(); + MutexLockerEx x(_m, Mutex::_no_safepoint_check_flag); + while (_async_stop) _m->wait(Mutex::_no_safepoint_check_flag); + _async++; + assert(_async > 0, "Huh."); +} + +void SuspendibleThreadSet::leave() { + assert(_initialized, "Must be initialized."); + MutexLockerEx x(_m, Mutex::_no_safepoint_check_flag); + _async--; + assert(_async >= 0, "Huh."); + if (_async_stop) _m->notify_all(); +} + +void SuspendibleThreadSet::yield(const char* id) { + assert(_initialized, "Must be initialized."); + if (_async_stop) { + MutexLockerEx x(_m, Mutex::_no_safepoint_check_flag); + if (_async_stop) { + _async_stopped++; + assert(_async_stopped > 0, "Huh."); + if (_async_stopped == _async) { + if (ConcGCYieldTimeout > 0) { + double now = os::elapsedTime(); + guarantee((now - _suspend_all_start) * 1000.0 < + (double)ConcGCYieldTimeout, + "Long delay; whodunit?"); + } + } + _m->notify_all(); + while (_async_stop) _m->wait(Mutex::_no_safepoint_check_flag); + _async_stopped--; + assert(_async >= 0, "Huh"); + _m->notify_all(); + } + } +} + +void SuspendibleThreadSet::suspend_all() { + initialize(); // If necessary. + if (ConcGCYieldTimeout > 0) { + _suspend_all_start = os::elapsedTime(); + } + MutexLockerEx x(_m, Mutex::_no_safepoint_check_flag); + assert(!_async_stop, "Only one at a time."); + _async_stop = true; + while (_async_stopped < _async) _m->wait(Mutex::_no_safepoint_check_flag); +} + +void SuspendibleThreadSet::resume_all() { + assert(_initialized, "Must be initialized."); + MutexLockerEx x(_m, Mutex::_no_safepoint_check_flag); + assert(_async_stopped == _async, "Huh."); + _async_stop = false; + _m->notify_all(); +} + +static void _sltLoop(JavaThread* thread, TRAPS) { + SurrogateLockerThread* slt = (SurrogateLockerThread*)thread; + slt->loop(); +} + +SurrogateLockerThread::SurrogateLockerThread() : + JavaThread(&_sltLoop), + _monitor(Mutex::nonleaf, "SLTMonitor"), + _buffer(empty) +{} + +SurrogateLockerThread* SurrogateLockerThread::make(TRAPS) { + klassOop k = + SystemDictionary::resolve_or_fail(vmSymbolHandles::java_lang_Thread(), + true, CHECK_NULL); + instanceKlassHandle klass (THREAD, k); + instanceHandle thread_oop = klass->allocate_instance_handle(CHECK_NULL); + + const char thread_name[] = "Surrogate Locker Thread (CMS)"; + Handle string = java_lang_String::create_from_str(thread_name, CHECK_NULL); + + // Initialize thread_oop to put it into the system threadGroup + Handle thread_group (THREAD, Universe::system_thread_group()); + JavaValue result(T_VOID); + JavaCalls::call_special(&result, thread_oop, + klass, + vmSymbolHandles::object_initializer_name(), + vmSymbolHandles::threadgroup_string_void_signature(), + thread_group, + string, + CHECK_NULL); + + SurrogateLockerThread* res; + { + MutexLocker mu(Threads_lock); + res = new SurrogateLockerThread(); + + // At this point it may be possible that no osthread was created for the + // JavaThread due to lack of memory. We would have to throw an exception + // in that case. However, since this must work and we do not allow + // exceptions anyway, check and abort if this fails. + if (res == NULL || res->osthread() == NULL) { + vm_exit_during_initialization("java.lang.OutOfMemoryError", + "unable to create new native thread"); + } + java_lang_Thread::set_thread(thread_oop(), res); + java_lang_Thread::set_priority(thread_oop(), NearMaxPriority); + java_lang_Thread::set_daemon(thread_oop()); + + res->set_threadObj(thread_oop()); + Threads::add(res); + Thread::start(res); + } + os::yield(); // This seems to help with initial start-up of SLT + return res; +} + +void SurrogateLockerThread::manipulatePLL(SLT_msg_type msg) { + MutexLockerEx x(&_monitor, Mutex::_no_safepoint_check_flag); + assert(_buffer == empty, "Should be empty"); + assert(msg != empty, "empty message"); + _buffer = msg; + while (_buffer != empty) { + _monitor.notify(); + _monitor.wait(Mutex::_no_safepoint_check_flag); + } +} + +// ======= Surrogate Locker Thread ============= + +void SurrogateLockerThread::loop() { + BasicLock pll_basic_lock; + SLT_msg_type msg; + debug_only(unsigned int owned = 0;) + + while (/* !isTerminated() */ 1) { + { + MutexLocker x(&_monitor); + // Since we are a JavaThread, we can't be here at a safepoint. + assert(!SafepointSynchronize::is_at_safepoint(), + "SLT is a JavaThread"); + // wait for msg buffer to become non-empty + while (_buffer == empty) { + _monitor.notify(); + _monitor.wait(); + } + msg = _buffer; + } + switch(msg) { + case acquirePLL: { + instanceRefKlass::acquire_pending_list_lock(&pll_basic_lock); + debug_only(owned++;) + break; + } + case releaseAndNotifyPLL: { + assert(owned > 0, "Don't have PLL"); + instanceRefKlass::release_and_notify_pending_list_lock(&pll_basic_lock); + debug_only(owned--;) + break; + } + case empty: + default: { + guarantee(false,"Unexpected message in _buffer"); + break; + } + } + { + MutexLocker x(&_monitor); + // Since we are a JavaThread, we can't be here at a safepoint. + assert(!SafepointSynchronize::is_at_safepoint(), + "SLT is a JavaThread"); + _buffer = empty; + _monitor.notify(); + } + } + assert(!_monitor.owned_by_self(), "Should unlock before exit."); +} + + +// ===== STS Access From Outside CGCT ===== + +void ConcurrentGCThread::stsYield(const char* id) { + assert( Thread::current()->is_ConcurrentGC_thread(), + "only a conc GC thread can call this" ); + _sts.yield(id); +} + +bool ConcurrentGCThread::stsShouldYield() { + assert( Thread::current()->is_ConcurrentGC_thread(), + "only a conc GC thread can call this" ); + return _sts.should_yield(); +} + +void ConcurrentGCThread::stsJoin() { + assert( Thread::current()->is_ConcurrentGC_thread(), + "only a conc GC thread can call this" ); + _sts.join(); +} + +void ConcurrentGCThread::stsLeave() { + assert( Thread::current()->is_ConcurrentGC_thread(), + "only a conc GC thread can call this" ); + _sts.leave(); +} diff --git a/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.hpp b/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.hpp new file mode 100644 index 00000000000..db6cc903ddf --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.hpp @@ -0,0 +1,167 @@ +/* + * Copyright 2001-2005 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. + * + */ + +class VoidClosure; + +// A SuspendibleThreadSet is (obviously) a set of threads that can be +// suspended. A thread can join and later leave the set, and periodically +// yield. If some thread (not in the set) requests, via suspend_all, that +// the threads be suspended, then the requesting thread is blocked until +// all the threads in the set have yielded or left the set. (Threads may +// not enter the set when an attempted suspension is in progress.) The +// suspending thread later calls resume_all, allowing the suspended threads +// to continue. + +class SuspendibleThreadSet { + Monitor* _m; + int _async; + bool _async_stop; + int _async_stopped; + bool _initialized; + double _suspend_all_start; + + void initialize_work(); + + public: + SuspendibleThreadSet() : _initialized(false) {} + + // Add the current thread to the set. May block if a suspension + // is in progress. + void join(); + // Removes the current thread from the set. + void leave(); + // Returns "true" iff an suspension is in progress. + bool should_yield() { return _async_stop; } + // Suspends the current thread if a suspension is in progress (for + // the duration of the suspension.) + void yield(const char* id); + // Return when all threads in the set are suspended. + void suspend_all(); + // Allow suspended threads to resume. + void resume_all(); + // Redundant initializations okay. + void initialize() { + // Double-check dirty read idiom. + if (!_initialized) initialize_work(); + } +}; + + +class ConcurrentGCThread: public NamedThread { + friend class VMStructs; + +protected: + static bool _should_terminate; + static bool _has_terminated; + + enum CGC_flag_type { + CGC_nil = 0x0, + CGC_dont_suspend = 0x1, + CGC_CGC_safepoint = 0x2, + CGC_VM_safepoint = 0x4 + }; + + static int _CGC_flag; + + static bool CGC_flag_is_set(int b) { return (_CGC_flag & b) != 0; } + static int set_CGC_flag(int b) { return _CGC_flag |= b; } + static int reset_CGC_flag(int b) { return _CGC_flag &= ~b; } + + void stopWorldAndDo(VoidClosure* op); + + // All instances share this one set. + static SuspendibleThreadSet _sts; + + // Create and start the thread (setting it's priority high.) + void create_and_start(); + + // Do initialization steps in the thread: record stack base and size, + // init thread local storage, set JNI handle block. + void initialize_in_thread(); + + // Wait until Universe::is_fully_initialized(); + void wait_for_universe_init(); + + // Record that the current thread is terminating, and will do more + // concurrent work. + void terminate(); + +public: + // Constructor + + ConcurrentGCThread(); + ~ConcurrentGCThread() {} // Exists to call NamedThread destructor. + + // Tester + bool is_ConcurrentGC_thread() const { return true; } + + static void safepoint_synchronize(); + static void safepoint_desynchronize(); + + // All overridings should probably do _sts::yield, but we allow + // overriding for distinguished debugging messages. Default is to do + // nothing. + virtual void yield() {} + + bool should_yield() { return _sts.should_yield(); } + + // they are prefixed by sts since there are already yield() and + // should_yield() (non-static) methods in this class and it was an + // easy way to differentiate them. + static void stsYield(const char* id); + static bool stsShouldYield(); + static void stsJoin(); + static void stsLeave(); + +}; + +// The SurrogateLockerThread is used by concurrent GC threads for +// manipulating Java monitors, in particular, currently for +// manipulating the pending_list_lock. XXX +class SurrogateLockerThread: public JavaThread { + friend class VMStructs; + public: + enum SLT_msg_type { + empty = 0, // no message + acquirePLL, // acquire pending list lock + releaseAndNotifyPLL // notify and release pending list lock + }; + private: + // the following are shared with the CMSThread + SLT_msg_type _buffer; // communication buffer + Monitor _monitor; // monitor controlling buffer + BasicLock _basicLock; // used for PLL locking + + public: + static SurrogateLockerThread* make(TRAPS); + + SurrogateLockerThread(); + + bool is_hidden_from_external_view() const { return true; } + + void loop(); // main method + + void manipulatePLL(SLT_msg_type msg); + +}; diff --git a/hotspot/src/share/vm/gc_implementation/shared/gcOverheadReporter.cpp b/hotspot/src/share/vm/gc_implementation/shared/gcOverheadReporter.cpp new file mode 100644 index 00000000000..02a2edb755a --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/shared/gcOverheadReporter.cpp @@ -0,0 +1,179 @@ +/* + * Copyright 2001-2007 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. + * + */ + +# include "incls/_precompiled.incl" +# include "incls/_gcOverheadReporter.cpp.incl" + +class COReportingThread : public ConcurrentGCThread { +private: + GCOverheadReporter* _reporter; + +public: + COReportingThread(GCOverheadReporter* reporter) : _reporter(reporter) { + guarantee( _reporter != NULL, "precondition" ); + create_and_start(); + } + + virtual void run() { + initialize_in_thread(); + wait_for_universe_init(); + + int period_ms = GCOverheadReportingPeriodMS; + + while ( true ) { + os::sleep(Thread::current(), period_ms, false); + + _sts.join(); + double now_sec = os::elapsedTime(); + _reporter->collect_and_record_conc_overhead(now_sec); + _sts.leave(); + } + + terminate(); + } +}; + +GCOverheadReporter* GCOverheadReporter::_reporter = NULL; + +GCOverheadReporter::GCOverheadReporter(size_t group_num, + const char* group_names[], + size_t length) + : _group_num(group_num), _prev_end_sec(0.0) { + guarantee( 0 <= group_num && group_num <= MaxGCOverheadGroupNum, + "precondition" ); + + _base = NEW_C_HEAP_ARRAY(GCOverheadReporterEntry, length); + _top = _base + length; + _curr = _base; + + for (size_t i = 0; i < group_num; ++i) { + guarantee( group_names[i] != NULL, "precondition" ); + _group_names[i] = group_names[i]; + } +} + +void +GCOverheadReporter::add(double start_sec, double end_sec, + double* conc_overhead, + double stw_overhead) { + assert( _curr <= _top, "invariant" ); + + if (_curr == _top) { + guarantee( false, "trace full" ); + return; + } + + _curr->_start_sec = start_sec; + _curr->_end_sec = end_sec; + for (size_t i = 0; i < _group_num; ++i) { + _curr->_conc_overhead[i] = + (conc_overhead != NULL) ? conc_overhead[i] : 0.0; + } + _curr->_stw_overhead = stw_overhead; + + ++_curr; +} + +void +GCOverheadReporter::collect_and_record_conc_overhead(double end_sec) { + double start_sec = _prev_end_sec; + guarantee( end_sec > start_sec, "invariant" ); + + double conc_overhead[MaxGCOverheadGroupNum]; + COTracker::totalConcOverhead(end_sec, _group_num, conc_overhead); + add_conc_overhead(start_sec, end_sec, conc_overhead); + _prev_end_sec = end_sec; +} + +void +GCOverheadReporter::record_stw_start(double start_sec) { + guarantee( start_sec > _prev_end_sec, "invariant" ); + collect_and_record_conc_overhead(start_sec); +} + +void +GCOverheadReporter::record_stw_end(double end_sec) { + double start_sec = _prev_end_sec; + COTracker::updateAllForSTW(start_sec, end_sec); + add_stw_overhead(start_sec, end_sec, 1.0); + + _prev_end_sec = end_sec; +} + +void +GCOverheadReporter::print() const { + tty->print_cr(""); + tty->print_cr("GC Overhead (%d entries)", _curr - _base); + tty->print_cr(""); + GCOverheadReporterEntry* curr = _base; + while (curr < _curr) { + double total = curr->_stw_overhead; + for (size_t i = 0; i < _group_num; ++i) + total += curr->_conc_overhead[i]; + + tty->print("OVERHEAD %12.8lf %12.8lf ", + curr->_start_sec, curr->_end_sec); + + for (size_t i = 0; i < _group_num; ++i) + tty->print("%s %12.8lf ", _group_names[i], curr->_conc_overhead[i]); + + tty->print_cr("STW %12.8lf TOT %12.8lf", curr->_stw_overhead, total); + ++curr; + } + tty->print_cr(""); +} + +// statics + +void +GCOverheadReporter::initGCOverheadReporter(size_t group_num, + const char* group_names[]) { + guarantee( _reporter == NULL, "should only be called once" ); + guarantee( 0 <= group_num && group_num <= MaxGCOverheadGroupNum, + "precondition" ); + guarantee( group_names != NULL, "pre-condition" ); + + if (GCOverheadReporting) { + _reporter = new GCOverheadReporter(group_num, group_names); + new COReportingThread(_reporter); + } +} + +void +GCOverheadReporter::recordSTWStart(double start_sec) { + if (_reporter != NULL) + _reporter->record_stw_start(start_sec); +} + +void +GCOverheadReporter::recordSTWEnd(double end_sec) { + if (_reporter != NULL) + _reporter->record_stw_end(end_sec); +} + +void +GCOverheadReporter::printGCOverhead() { + if (_reporter != NULL) + _reporter->print(); +} diff --git a/hotspot/src/share/vm/gc_implementation/shared/gcOverheadReporter.hpp b/hotspot/src/share/vm/gc_implementation/shared/gcOverheadReporter.hpp new file mode 100644 index 00000000000..c3483a68b00 --- /dev/null +++ b/hotspot/src/share/vm/gc_implementation/shared/gcOverheadReporter.hpp @@ -0,0 +1,141 @@ +/* + * Copyright 2001-2007 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. + * + */ + +// Keeps track of the GC overhead (both concurrent and STW). It stores +// it in a large array and then prints it to tty at the end of the +// execution. + +// See coTracker.hpp for the explanation on what groups are. + +// Let's set a maximum number of concurrent overhead groups, to +// statically allocate any arrays we need and not to have to +// malloc/free them. This is just a bit more convenient. +enum { + MaxGCOverheadGroupNum = 4 +}; + +typedef struct { + double _start_sec; + double _end_sec; + + double _conc_overhead[MaxGCOverheadGroupNum]; + double _stw_overhead; +} GCOverheadReporterEntry; + +class GCOverheadReporter { + friend class COReportingThread; + +private: + enum PrivateConstants { + DefaultReporterLength = 128 * 1024 + }; + + // Reference to the single instance of this class. + static GCOverheadReporter* _reporter; + + // These three references point to the array that contains the GC + // overhead entries (_base is the base of the array, _top is the + // address passed the last entry of the array, _curr is the next + // entry to be used). + GCOverheadReporterEntry* _base; + GCOverheadReporterEntry* _top; + GCOverheadReporterEntry* _curr; + + // The number of concurrent overhead groups. + size_t _group_num; + + // The wall-clock time of the end of the last recorded period of GC + // overhead. + double _prev_end_sec; + + // Names for the concurrent overhead groups. + const char* _group_names[MaxGCOverheadGroupNum]; + + // Add a new entry to the large array. conc_overhead being NULL is + // equivalent to an array full of 0.0s. conc_overhead should have a + // length of at least _group_num. + void add(double start_sec, double end_sec, + double* conc_overhead, + double stw_overhead); + + // Add an entry that represents concurrent GC overhead. + // conc_overhead must be at least of length _group_num. + // conc_overhead being NULL is equivalent to an array full of 0.0s. + void add_conc_overhead(double start_sec, double end_sec, + double* conc_overhead) { + add(start_sec, end_sec, conc_overhead, 0.0); + } + + // Add an entry that represents STW GC overhead. + void add_stw_overhead(double start_sec, double end_sec, + double stw_overhead) { + add(start_sec, end_sec, NULL, stw_overhead); + } + + // It records the start of a STW pause (i.e. it records the + // concurrent overhead up to that point) + void record_stw_start(double start_sec); + + // It records the end of a STW pause (i.e. it records the overhead + // associated with the pause and adjusts all the trackers to reflect + // the pause) + void record_stw_end(double end_sec); + + // It queries all the trackers of their concurrent overhead and + // records it. + void collect_and_record_conc_overhead(double end_sec); + + // It prints the contents of the GC overhead array + void print() const; + + + // Constructor. The same preconditions for group_num and group_names + // from initGCOverheadReporter apply here too. + GCOverheadReporter(size_t group_num, + const char* group_names[], + size_t length = DefaultReporterLength); + +public: + + // statics + + // It initialises the GCOverheadReporter and launches the concurrent + // overhead reporting thread. Both actions happen only if the + // GCOverheadReporting parameter is set. The length of the + // group_names array should be >= group_num and group_num should be + // <= MaxGCOverheadGroupNum. Entries group_namnes[0..group_num-1] + // should not be NULL. + static void initGCOverheadReporter(size_t group_num, + const char* group_names[]); + + // The following three are provided for convenience and they are + // wrappers around record_stw_start(start_sec), record_stw_end(end_sec), + // and print(). Each of these checks whether GC overhead reporting + // is on (i.e. _reporter != NULL) and, if it is, calls the + // corresponding method. Saves from repeating this pattern again and + // again from the places where they need to be called. + static void recordSTWStart(double start_sec); + static void recordSTWEnd(double end_sec); + static void printGCOverhead(); +}; diff --git a/hotspot/src/share/vm/gc_implementation/shared/vmGCOperations.cpp b/hotspot/src/share/vm/gc_implementation/shared/vmGCOperations.cpp index 7cab57dd727..687b6eb6c42 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/vmGCOperations.cpp +++ b/hotspot/src/share/vm/gc_implementation/shared/vmGCOperations.cpp @@ -74,6 +74,7 @@ bool VM_GC_Operation::doit_prologue() { // If the GC count has changed someone beat us to the collection // Get the Heap_lock after the pending_list_lock. Heap_lock->lock(); + // Check invocations if (skip_operation()) { // skip collection @@ -82,6 +83,8 @@ bool VM_GC_Operation::doit_prologue() { _prologue_succeeded = false; } else { _prologue_succeeded = true; + SharedHeap* sh = SharedHeap::heap(); + if (sh != NULL) sh->_thread_holds_heap_lock_for_gc = true; } return _prologue_succeeded; } @@ -90,6 +93,8 @@ bool VM_GC_Operation::doit_prologue() { void VM_GC_Operation::doit_epilogue() { assert(Thread::current()->is_Java_thread(), "just checking"); // Release the Heap_lock first. + SharedHeap* sh = SharedHeap::heap(); + if (sh != NULL) sh->_thread_holds_heap_lock_for_gc = false; Heap_lock->unlock(); release_and_notify_pending_list_lock(); } @@ -148,12 +153,27 @@ void VM_GenCollectFull::doit() { void VM_GenCollectForPermanentAllocation::doit() { JvmtiGCForAllocationMarker jgcm; notify_gc_begin(true); - GenCollectedHeap* gch = GenCollectedHeap::heap(); - GCCauseSetter gccs(gch, _gc_cause); - gch->do_full_collection(gch->must_clear_all_soft_refs(), - gch->n_gens() - 1); - _res = gch->perm_gen()->allocate(_size, false); - assert(gch->is_in_reserved_or_null(_res), "result not in heap"); + SharedHeap* heap = (SharedHeap*)Universe::heap(); + GCCauseSetter gccs(heap, _gc_cause); + switch (heap->kind()) { + case (CollectedHeap::GenCollectedHeap): { + GenCollectedHeap* gch = (GenCollectedHeap*)heap; + gch->do_full_collection(gch->must_clear_all_soft_refs(), + gch->n_gens() - 1); + break; + } +#ifndef SERIALGC + case (CollectedHeap::G1CollectedHeap): { + G1CollectedHeap* g1h = (G1CollectedHeap*)heap; + g1h->do_full_collection(_gc_cause == GCCause::_last_ditch_collection); + break; + } +#endif // SERIALGC + default: + ShouldNotReachHere(); + } + _res = heap->perm_gen()->allocate(_size, false); + assert(heap->is_in_reserved_or_null(_res), "result not in heap"); if (_res == NULL && GC_locker::is_active_and_needs_gc()) { set_gc_locked(); } diff --git a/hotspot/src/share/vm/gc_interface/collectedHeap.cpp b/hotspot/src/share/vm/gc_interface/collectedHeap.cpp index ecfab9ed6cd..d33552d57a2 100644 --- a/hotspot/src/share/vm/gc_interface/collectedHeap.cpp +++ b/hotspot/src/share/vm/gc_interface/collectedHeap.cpp @@ -138,13 +138,6 @@ oop CollectedHeap::new_store_barrier(oop new_obj) { return new_obj; } -bool CollectedHeap::can_elide_permanent_oop_store_barriers() const { - // %%% This needs refactoring. (It was gating logic from the server compiler.) - guarantee(kind() < CollectedHeap::G1CollectedHeap, ""); - return !UseConcMarkSweepGC; -} - - HeapWord* CollectedHeap::allocate_new_tlab(size_t size) { guarantee(false, "thread-local allocation buffers not supported"); return NULL; diff --git a/hotspot/src/share/vm/gc_interface/collectedHeap.hpp b/hotspot/src/share/vm/gc_interface/collectedHeap.hpp index ef55f14676e..e5d33d17651 100644 --- a/hotspot/src/share/vm/gc_interface/collectedHeap.hpp +++ b/hotspot/src/share/vm/gc_interface/collectedHeap.hpp @@ -364,10 +364,8 @@ class CollectedHeap : public CHeapObj { // Can a compiler initialize a new object without store barriers? // This permission only extends from the creation of a new object // via a TLAB up to the first subsequent safepoint. - virtual bool can_elide_tlab_store_barriers() const { - guarantee(kind() < CollectedHeap::G1CollectedHeap, "else change or refactor this"); - return true; - } + virtual bool can_elide_tlab_store_barriers() const = 0; + // If a compiler is eliding store barriers for TLAB-allocated objects, // there is probably a corresponding slow path which can produce // an object allocated anywhere. The compiler's runtime support @@ -379,12 +377,10 @@ class CollectedHeap : public CHeapObj { // Can a compiler elide a store barrier when it writes // a permanent oop into the heap? Applies when the compiler // is storing x to the heap, where x->is_perm() is true. - virtual bool can_elide_permanent_oop_store_barriers() const; + virtual bool can_elide_permanent_oop_store_barriers() const = 0; // Does this heap support heap inspection (+PrintClassHistogram?) - virtual bool supports_heap_inspection() const { - return false; // Until RFE 5023697 is implemented - } + virtual bool supports_heap_inspection() const = 0; // Perform a collection of the heap; intended for use in implementing // "System.gc". This probably implies as full a collection as the diff --git a/hotspot/src/share/vm/gc_interface/collectedHeap.inline.hpp b/hotspot/src/share/vm/gc_interface/collectedHeap.inline.hpp index 556cd490f96..bb394cacd35 100644 --- a/hotspot/src/share/vm/gc_interface/collectedHeap.inline.hpp +++ b/hotspot/src/share/vm/gc_interface/collectedHeap.inline.hpp @@ -121,7 +121,7 @@ HeapWord* CollectedHeap::common_mem_allocate_noinit(size_t size, bool is_noref, return result; } } - bool gc_overhead_limit_was_exceeded; + bool gc_overhead_limit_was_exceeded = false; result = Universe::heap()->mem_allocate(size, is_noref, false, diff --git a/hotspot/src/share/vm/gc_interface/gcCause.hpp b/hotspot/src/share/vm/gc_interface/gcCause.hpp index e512b0265e8..bae001c9ca7 100644 --- a/hotspot/src/share/vm/gc_interface/gcCause.hpp +++ b/hotspot/src/share/vm/gc_interface/gcCause.hpp @@ -60,6 +60,8 @@ class GCCause : public AllStatic { _old_generation_too_full_to_scavenge, _adaptive_size_policy, + _g1_inc_collection_pause, _g1_pop_region_collection_pause, + _last_ditch_collection, _last_gc_cause }; @@ -68,12 +70,14 @@ class GCCause : public AllStatic { return (cause == GCCause::_java_lang_system_gc || cause == GCCause::_jvmti_force_gc); } + inline static bool is_serviceability_requested_gc(GCCause::Cause cause) { return (cause == GCCause::_jvmti_force_gc || cause == GCCause::_heap_inspection || cause == GCCause::_heap_dump); } + // Return a string describing the GCCause. static const char* to_string(GCCause::Cause cause); // Return true if the GCCause is for a full collection. diff --git a/hotspot/src/share/vm/includeDB_compiler1 b/hotspot/src/share/vm/includeDB_compiler1 index ae500d2f6d7..99c1ba347e4 100644 --- a/hotspot/src/share/vm/includeDB_compiler1 +++ b/hotspot/src/share/vm/includeDB_compiler1 @@ -36,6 +36,9 @@ c1_CFGPrinter.cpp c1_ValueStack.hpp c1_CFGPrinter.hpp c1_Compilation.hpp c1_CFGPrinter.hpp c1_Instruction.hpp +cardTableModRefBS.cpp c1_LIR.hpp +cardTableModRefBS.cpp c1_LIRGenerator.hpp + c1_Canonicalizer.cpp c1_Canonicalizer.hpp c1_Canonicalizer.cpp c1_InstructionPrinter.hpp c1_Canonicalizer.cpp ciArray.hpp @@ -55,6 +58,7 @@ c1_CodeStubs_.cpp c1_FrameMap.hpp c1_CodeStubs_.cpp c1_LIRAssembler.hpp c1_CodeStubs_.cpp c1_MacroAssembler.hpp c1_CodeStubs_.cpp c1_Runtime1.hpp +c1_CodeStubs_.cpp g1SATBCardTableModRefBS.hpp c1_CodeStubs_.cpp nativeInst_.hpp c1_CodeStubs_.cpp sharedRuntime.hpp c1_CodeStubs_.cpp vmreg_.inline.hpp @@ -141,6 +145,7 @@ c1_globals_.hpp macros.hpp c1_globals_.hpp globalDefinitions.hpp c1_globals_.hpp macros.hpp +c1_GraphBuilder.cpp bitMap.inline.hpp c1_GraphBuilder.cpp bytecode.hpp c1_GraphBuilder.cpp c1_CFGPrinter.hpp c1_GraphBuilder.cpp c1_Canonicalizer.hpp @@ -158,6 +163,7 @@ c1_GraphBuilder.hpp c1_ValueStack.hpp c1_GraphBuilder.hpp ciMethodData.hpp c1_GraphBuilder.hpp ciStreams.hpp +c1_IR.cpp bitMap.inline.hpp c1_IR.cpp c1_Compilation.hpp c1_IR.cpp c1_FrameMap.hpp c1_IR.cpp c1_GraphBuilder.hpp @@ -232,33 +238,36 @@ c1_LIRAssembler_.cpp sharedRuntime.hpp c1_LIRAssembler_.hpp generate_platform_dependent_include -c1_LIRGenerator.cpp c1_Compilation.hpp -c1_LIRGenerator.cpp c1_FrameMap.hpp -c1_LIRGenerator.cpp c1_Instruction.hpp -c1_LIRGenerator.cpp c1_LIRAssembler.hpp -c1_LIRGenerator.cpp c1_LIRGenerator.hpp -c1_LIRGenerator.cpp c1_ValueStack.hpp -c1_LIRGenerator.cpp ciArrayKlass.hpp -c1_LIRGenerator.cpp ciInstance.hpp -c1_LIRGenerator.cpp sharedRuntime.hpp +c1_LIRGenerator.cpp bitMap.inline.hpp +c1_LIRGenerator.cpp c1_Compilation.hpp +c1_LIRGenerator.cpp c1_FrameMap.hpp +c1_LIRGenerator.cpp c1_Instruction.hpp +c1_LIRGenerator.cpp c1_LIRAssembler.hpp +c1_LIRGenerator.cpp c1_LIRGenerator.hpp +c1_LIRGenerator.cpp c1_ValueStack.hpp +c1_LIRGenerator.cpp ciArrayKlass.hpp +c1_LIRGenerator.cpp ciInstance.hpp +c1_LIRGenerator.cpp heapRegion.hpp +c1_LIRGenerator.cpp sharedRuntime.hpp -c1_LIRGenerator.hpp c1_Instruction.hpp -c1_LIRGenerator.hpp c1_LIR.hpp -c1_LIRGenerator.hpp ciMethodData.hpp -c1_LIRGenerator.hpp sizes.hpp +c1_LIRGenerator.hpp c1_Instruction.hpp +c1_LIRGenerator.hpp c1_LIR.hpp +c1_LIRGenerator.hpp ciMethodData.hpp +c1_LIRGenerator.hpp sizes.hpp -c1_LIRGenerator_.cpp c1_Compilation.hpp -c1_LIRGenerator_.cpp c1_FrameMap.hpp -c1_LIRGenerator_.cpp c1_Instruction.hpp -c1_LIRGenerator_.cpp c1_LIRAssembler.hpp -c1_LIRGenerator_.cpp c1_LIRGenerator.hpp -c1_LIRGenerator_.cpp c1_Runtime1.hpp -c1_LIRGenerator_.cpp c1_ValueStack.hpp -c1_LIRGenerator_.cpp ciArray.hpp -c1_LIRGenerator_.cpp ciObjArrayKlass.hpp -c1_LIRGenerator_.cpp ciTypeArrayKlass.hpp -c1_LIRGenerator_.cpp sharedRuntime.hpp +c1_LIRGenerator_.cpp c1_Compilation.hpp +c1_LIRGenerator_.cpp c1_FrameMap.hpp +c1_LIRGenerator_.cpp c1_Instruction.hpp +c1_LIRGenerator_.cpp c1_LIRAssembler.hpp +c1_LIRGenerator_.cpp c1_LIRGenerator.hpp +c1_LIRGenerator_.cpp c1_Runtime1.hpp +c1_LIRGenerator_.cpp c1_ValueStack.hpp +c1_LIRGenerator_.cpp ciArray.hpp +c1_LIRGenerator_.cpp ciObjArrayKlass.hpp +c1_LIRGenerator_.cpp ciTypeArrayKlass.hpp +c1_LIRGenerator_.cpp sharedRuntime.hpp +c1_LinearScan.cpp bitMap.inline.hpp c1_LinearScan.cpp c1_CFGPrinter.hpp c1_LinearScan.cpp c1_Compilation.hpp c1_LinearScan.cpp c1_FrameMap.hpp @@ -275,6 +284,7 @@ c1_LinearScan.hpp c1_Instruction.hpp c1_LinearScan.hpp c1_LIR.hpp c1_LinearScan.hpp c1_LIRGenerator.hpp +c1_LinearScan_.cpp bitMap.inline.hpp c1_LinearScan_.cpp c1_Instruction.hpp c1_LinearScan_.cpp c1_LinearScan.hpp @@ -297,6 +307,7 @@ c1_MacroAssembler_.cpp systemDictionary.hpp c1_MacroAssembler_.hpp generate_platform_dependent_include +c1_Optimizer.cpp bitMap.inline.hpp c1_Optimizer.cpp c1_Canonicalizer.hpp c1_Optimizer.cpp c1_Optimizer.hpp c1_Optimizer.cpp c1_ValueMap.hpp @@ -362,6 +373,7 @@ c1_Runtime1_.cpp signature.hpp c1_Runtime1_.cpp vframeArray.hpp c1_Runtime1_.cpp vmreg_.inline.hpp +c1_ValueMap.cpp bitMap.inline.hpp c1_ValueMap.cpp c1_Canonicalizer.hpp c1_ValueMap.cpp c1_IR.hpp c1_ValueMap.cpp c1_ValueMap.hpp @@ -432,4 +444,3 @@ thread.cpp c1_Compiler.hpp top.hpp c1_globals.hpp vmStructs.hpp c1_Runtime1.hpp - diff --git a/hotspot/src/share/vm/includeDB_compiler2 b/hotspot/src/share/vm/includeDB_compiler2 index 43233ad41dd..f6288dd9816 100644 --- a/hotspot/src/share/vm/includeDB_compiler2 +++ b/hotspot/src/share/vm/includeDB_compiler2 @@ -461,10 +461,13 @@ globals.cpp c2_globals.hpp graphKit.cpp addnode.hpp graphKit.cpp barrierSet.hpp graphKit.cpp cardTableModRefBS.hpp +graphKit.cpp g1SATBCardTableModRefBS.hpp graphKit.cpp collectedHeap.hpp graphKit.cpp compileLog.hpp graphKit.cpp deoptimization.hpp graphKit.cpp graphKit.hpp +graphKit.cpp heapRegion.hpp +graphKit.cpp idealKit.hpp graphKit.cpp locknode.hpp graphKit.cpp machnode.hpp graphKit.cpp parse.hpp @@ -484,6 +487,7 @@ idealKit.cpp addnode.hpp idealKit.cpp callnode.hpp idealKit.cpp cfgnode.hpp idealKit.cpp idealKit.hpp +idealKit.cpp runtime.hpp idealKit.hpp connode.hpp idealKit.hpp mulnode.hpp @@ -915,9 +919,11 @@ runtime.cpp compilerOracle.hpp runtime.cpp connode.hpp runtime.cpp copy.hpp runtime.cpp fprofiler.hpp +runtime.cpp g1SATBCardTableModRefBS.hpp runtime.cpp gcLocker.inline.hpp runtime.cpp graphKit.hpp runtime.cpp handles.inline.hpp +runtime.cpp heapRegion.hpp runtime.cpp icBuffer.hpp runtime.cpp interfaceSupport.hpp runtime.cpp interpreter.hpp diff --git a/hotspot/src/share/vm/includeDB_core b/hotspot/src/share/vm/includeDB_core index 616a974bb20..b1682d4dbaa 100644 --- a/hotspot/src/share/vm/includeDB_core +++ b/hotspot/src/share/vm/includeDB_core @@ -287,6 +287,10 @@ attachListener.hpp allocation.hpp attachListener.hpp debug.hpp attachListener.hpp ostream.hpp +barrierSet.cpp barrierSet.hpp +barrierSet.cpp collectedHeap.hpp +barrierSet.cpp universe.hpp + barrierSet.hpp memRegion.hpp barrierSet.hpp oopsHierarchy.hpp @@ -294,7 +298,7 @@ barrierSet.inline.hpp barrierSet.hpp barrierSet.inline.hpp cardTableModRefBS.hpp bcEscapeAnalyzer.cpp bcEscapeAnalyzer.hpp -bcEscapeAnalyzer.cpp bitMap.hpp +bcEscapeAnalyzer.cpp bitMap.inline.hpp bcEscapeAnalyzer.cpp bytecode.hpp bcEscapeAnalyzer.cpp ciConstant.hpp bcEscapeAnalyzer.cpp ciField.hpp @@ -319,13 +323,12 @@ biasedLocking.cpp vm_operations.hpp biasedLocking.hpp growableArray.hpp biasedLocking.hpp handles.hpp -bitMap.cpp bitMap.hpp +bitMap.cpp allocation.inline.hpp bitMap.cpp bitMap.inline.hpp bitMap.cpp copy.hpp bitMap.cpp os_.inline.hpp bitMap.hpp allocation.hpp -bitMap.hpp ostream.hpp bitMap.hpp top.hpp bitMap.inline.hpp atomic.hpp @@ -644,6 +647,7 @@ ciKlassKlass.hpp ciSymbol.hpp ciMethod.cpp abstractCompiler.hpp ciMethod.cpp allocation.inline.hpp ciMethod.cpp bcEscapeAnalyzer.hpp +ciMethod.cpp bitMap.inline.hpp ciMethod.cpp ciCallProfile.hpp ciMethod.cpp ciExceptionHandler.hpp ciMethod.cpp ciInstanceKlass.hpp @@ -1757,7 +1761,7 @@ genRemSet.cpp genRemSet.hpp genRemSet.hpp oop.hpp -generateOopMap.cpp bitMap.hpp +generateOopMap.cpp bitMap.inline.hpp generateOopMap.cpp bytecodeStream.hpp generateOopMap.cpp generateOopMap.hpp generateOopMap.cpp handles.inline.hpp @@ -1805,6 +1809,8 @@ generation.inline.hpp genCollectedHeap.hpp generation.inline.hpp generation.hpp generation.inline.hpp space.hpp +genOopClosures.hpp oop.hpp + generationSpec.cpp compactPermGen.hpp generationSpec.cpp defNewGeneration.hpp generationSpec.cpp filemap.hpp @@ -2216,6 +2222,11 @@ invocationCounter.hpp allocation.hpp invocationCounter.hpp exceptions.hpp invocationCounter.hpp handles.hpp +intHisto.cpp intHisto.hpp + +intHisto.hpp allocation.hpp +intHisto.hpp growableArray.hpp + iterator.cpp iterator.hpp iterator.cpp oop.inline.hpp @@ -2815,6 +2826,7 @@ methodKlass.hpp klassOop.hpp methodKlass.hpp methodOop.hpp methodLiveness.cpp allocation.inline.hpp +methodLiveness.cpp bitMap.inline.hpp methodLiveness.cpp bytecode.hpp methodLiveness.cpp bytecodes.hpp methodLiveness.cpp ciMethod.hpp @@ -2961,6 +2973,11 @@ nmethod.cpp xmlstream.hpp nmethod.hpp codeBlob.hpp nmethod.hpp pcDesc.hpp +numberSeq.cpp debug.hpp +numberSeq.cpp numberSeq.hpp +numberSeq.cpp globalDefinitions.hpp +numberSeq.cpp allocation.inline.hpp + objArrayKlass.cpp collectedHeap.inline.hpp objArrayKlass.cpp copy.hpp objArrayKlass.cpp genOopClosures.inline.hpp @@ -3403,8 +3420,6 @@ referencePolicy.cpp javaClasses.hpp referencePolicy.cpp referencePolicy.hpp referencePolicy.cpp universe.hpp -referencePolicy.hpp oop.hpp - referenceProcessor.cpp collectedHeap.hpp referenceProcessor.cpp collectedHeap.inline.hpp referenceProcessor.cpp java.hpp @@ -3746,6 +3761,8 @@ space.inline.hpp universe.hpp specialized_oop_closures.cpp ostream.hpp specialized_oop_closures.cpp specialized_oop_closures.hpp +specialized_oop_closures.hpp atomic.hpp + stackMapFrame.cpp globalDefinitions.hpp stackMapFrame.cpp handles.inline.hpp stackMapFrame.cpp oop.inline.hpp @@ -3988,7 +4005,6 @@ taskqueue.cpp thread_.inline.hpp taskqueue.hpp allocation.hpp taskqueue.hpp allocation.inline.hpp -taskqueue.hpp debug.hpp taskqueue.hpp mutex.hpp taskqueue.hpp orderAccess_.inline.hpp @@ -4026,6 +4042,7 @@ templateInterpreter_.hpp generate_platform_dependent_include templateInterpreterGenerator_.hpp generate_platform_dependent_include +templateTable.cpp collectedHeap.hpp templateTable.cpp templateTable.hpp templateTable.cpp timer.hpp @@ -4530,6 +4547,7 @@ vm_operations.cpp compileBroker.hpp vm_operations.cpp compilerOracle.hpp vm_operations.cpp deoptimization.hpp vm_operations.cpp interfaceSupport.hpp +vm_operations.cpp isGCActiveMark.hpp vm_operations.cpp resourceArea.hpp vm_operations.cpp threadService.hpp vm_operations.cpp thread_.inline.hpp diff --git a/hotspot/src/share/vm/includeDB_gc_parallel b/hotspot/src/share/vm/includeDB_gc_parallel index 31939d06567..5cdfe2cbfef 100644 --- a/hotspot/src/share/vm/includeDB_gc_parallel +++ b/hotspot/src/share/vm/includeDB_gc_parallel @@ -21,6 +21,10 @@ // have any questions. // +assembler_.cpp g1SATBCardTableModRefBS.hpp +assembler_.cpp g1CollectedHeap.inline.hpp +assembler_.cpp heapRegion.hpp + collectorPolicy.cpp cmsAdaptiveSizePolicy.hpp collectorPolicy.cpp cmsGCAdaptivePolicyCounters.hpp @@ -37,6 +41,9 @@ heapDumper.cpp parallelScavengeHeap.hpp heapInspection.cpp parallelScavengeHeap.hpp +instanceKlass.cpp heapRegionSeq.inline.hpp +instanceKlass.cpp g1CollectedHeap.inline.hpp +instanceKlass.cpp g1OopClosures.inline.hpp instanceKlass.cpp oop.pcgc.inline.hpp instanceKlass.cpp psPromotionManager.inline.hpp instanceKlass.cpp psScavenge.inline.hpp @@ -48,6 +55,9 @@ instanceKlassKlass.cpp psPromotionManager.inline.hpp instanceKlassKlass.cpp psScavenge.inline.hpp instanceKlassKlass.cpp parOopClosures.inline.hpp +instanceRefKlass.cpp heapRegionSeq.inline.hpp +instanceRefKlass.cpp g1CollectedHeap.inline.hpp +instanceRefKlass.cpp g1OopClosures.inline.hpp instanceRefKlass.cpp oop.pcgc.inline.hpp instanceRefKlass.cpp psPromotionManager.inline.hpp instanceRefKlass.cpp psScavenge.inline.hpp @@ -70,6 +80,7 @@ memoryPool.hpp compactibleFreeListSpace.hpp memoryService.cpp cmsPermGen.hpp memoryService.cpp concurrentMarkSweepGeneration.hpp +memoryService.cpp g1CollectedHeap.inline.hpp memoryService.cpp parNewGeneration.hpp memoryService.cpp parallelScavengeHeap.hpp memoryService.cpp psMemoryPool.hpp @@ -80,6 +91,9 @@ memoryService.cpp psYoungGen.hpp methodDataKlass.cpp oop.pcgc.inline.hpp methodDataKlass.cpp psScavenge.inline.hpp +objArrayKlass.cpp heapRegionSeq.inline.hpp +objArrayKlass.cpp g1CollectedHeap.inline.hpp +objArrayKlass.cpp g1OopClosures.inline.hpp objArrayKlass.cpp oop.pcgc.inline.hpp objArrayKlass.cpp psPromotionManager.inline.hpp objArrayKlass.cpp psScavenge.inline.hpp @@ -122,6 +136,9 @@ safepoint.cpp concurrentMarkSweepThread.hpp thread.cpp concurrentMarkSweepThread.hpp thread.cpp pcTasks.hpp +thread.hpp dirtyCardQueue.hpp +thread.hpp satbQueue.hpp + universe.cpp parallelScavengeHeap.hpp universe.cpp cmsCollectorPolicy.hpp universe.cpp cmsAdaptiveSizePolicy.hpp diff --git a/hotspot/src/share/vm/includeDB_jvmti b/hotspot/src/share/vm/includeDB_jvmti index 7110bb1bf4e..b6b4ee5e960 100644 --- a/hotspot/src/share/vm/includeDB_jvmti +++ b/hotspot/src/share/vm/includeDB_jvmti @@ -209,6 +209,7 @@ jvmtiManageCapabilities.cpp jvmtiManageCapabilities.hpp jvmtiManageCapabilities.hpp allocation.hpp jvmtiManageCapabilities.hpp jvmti.h +jvmtiRedefineClasses.cpp bitMap.inline.hpp jvmtiRedefineClasses.cpp codeCache.hpp jvmtiRedefineClasses.cpp deoptimization.hpp jvmtiRedefineClasses.cpp gcLocker.hpp diff --git a/hotspot/src/share/vm/interpreter/templateTable.cpp b/hotspot/src/share/vm/interpreter/templateTable.cpp index c302af297e1..756b3f66516 100644 --- a/hotspot/src/share/vm/interpreter/templateTable.cpp +++ b/hotspot/src/share/vm/interpreter/templateTable.cpp @@ -172,6 +172,7 @@ Template TemplateTable::_template_table_wide[Bytecodes::number Template* TemplateTable::_desc; InterpreterMacroAssembler* TemplateTable::_masm; +BarrierSet* TemplateTable::_bs; void TemplateTable::def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(), char filler) { @@ -244,6 +245,8 @@ void TemplateTable::initialize() { // Initialize table TraceTime timer("TemplateTable initialization", TraceStartupTime); + _bs = Universe::heap()->barrier_set(); + // For better readability const char _ = ' '; const int ____ = 0; diff --git a/hotspot/src/share/vm/interpreter/templateTable.hpp b/hotspot/src/share/vm/interpreter/templateTable.hpp index 4f40a7ac291..af6bf870db9 100644 --- a/hotspot/src/share/vm/interpreter/templateTable.hpp +++ b/hotspot/src/share/vm/interpreter/templateTable.hpp @@ -82,6 +82,7 @@ class TemplateTable: AllStatic { static Template* _desc; // the current template to be generated static Bytecodes::Code bytecode() { return _desc->bytecode(); } + static BarrierSet* _bs; // Cache the barrier set. public: //%note templates_1 static InterpreterMacroAssembler* _masm; // the assembler used when generating templates diff --git a/hotspot/src/share/vm/memory/allocation.hpp b/hotspot/src/share/vm/memory/allocation.hpp index 4bdcbc1ccfa..26482ebf792 100644 --- a/hotspot/src/share/vm/memory/allocation.hpp +++ b/hotspot/src/share/vm/memory/allocation.hpp @@ -338,6 +338,12 @@ class ResourceObj ALLOCATION_SUPER_CLASS_SPEC { DEBUG_ONLY(((ResourceObj *)res)->_allocation = RESOURCE_AREA;) return res; } + void* operator new(size_t size, void* where, allocation_type type) { + void* res = where; + // Set allocation type in the resource object + DEBUG_ONLY(((ResourceObj *)res)->_allocation = type;) + return res; + } void operator delete(void* p); }; diff --git a/hotspot/src/share/vm/memory/barrierSet.cpp b/hotspot/src/share/vm/memory/barrierSet.cpp new file mode 100644 index 00000000000..23308805a60 --- /dev/null +++ b/hotspot/src/share/vm/memory/barrierSet.cpp @@ -0,0 +1,36 @@ +/* + * Copyright 1997-2006 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. + * + */ + +# include "incls/_precompiled.incl" +# include "incls/_barrierSet.cpp.incl" + +// count is in HeapWord's +void BarrierSet::static_write_ref_array_pre(HeapWord* start, size_t count) { + Universe::heap()->barrier_set()->write_ref_array_pre(MemRegion(start, start + count)); +} + +// count is in HeapWord's +void BarrierSet::static_write_ref_array_post(HeapWord* start, size_t count) { + Universe::heap()->barrier_set()->write_ref_array_work(MemRegion(start, start + count)); +} diff --git a/hotspot/src/share/vm/memory/barrierSet.hpp b/hotspot/src/share/vm/memory/barrierSet.hpp index aa56fa9e883..1a6a9bad98b 100644 --- a/hotspot/src/share/vm/memory/barrierSet.hpp +++ b/hotspot/src/share/vm/memory/barrierSet.hpp @@ -32,6 +32,8 @@ public: ModRef, CardTableModRef, CardTableExtension, + G1SATBCT, + G1SATBCTLogging, Other, Uninit }; @@ -42,14 +44,16 @@ protected: public: + BarrierSet() { _kind = Uninit; } // To get around prohibition on RTTI. - virtual BarrierSet::Name kind() { return _kind; } + BarrierSet::Name kind() { return _kind; } virtual bool is_a(BarrierSet::Name bsn) = 0; // These operations indicate what kind of barriers the BarrierSet has. virtual bool has_read_ref_barrier() = 0; virtual bool has_read_prim_barrier() = 0; virtual bool has_write_ref_barrier() = 0; + virtual bool has_write_ref_pre_barrier() = 0; virtual bool has_write_prim_barrier() = 0; // These functions indicate whether a particular access of the given @@ -57,7 +61,8 @@ public: virtual bool read_ref_needs_barrier(void* field) = 0; virtual bool read_prim_needs_barrier(HeapWord* field, size_t bytes) = 0; virtual bool write_ref_needs_barrier(void* field, oop new_val) = 0; - virtual bool write_prim_needs_barrier(HeapWord* field, size_t bytes, juint val1, juint val2) = 0; + virtual bool write_prim_needs_barrier(HeapWord* field, size_t bytes, + juint val1, juint val2) = 0; // The first four operations provide a direct implementation of the // barrier set. An interpreter loop, for example, could call these @@ -75,6 +80,13 @@ public: // (For efficiency reasons, this operation is specialized for certain // barrier types. Semantically, it should be thought of as a call to the // virtual "_work" function below, which must implement the barrier.) + // First the pre-write versions... + inline void write_ref_field_pre(void* field, oop new_val); +protected: + virtual void write_ref_field_pre_work(void* field, oop new_val) {}; +public: + + // ...then the post-write version. inline void write_ref_field(void* field, oop new_val); protected: virtual void write_ref_field_work(void* field, oop new_val) = 0; @@ -92,6 +104,7 @@ public: // the particular barrier. virtual bool has_read_ref_array_opt() = 0; virtual bool has_read_prim_array_opt() = 0; + virtual bool has_write_ref_array_pre_opt() { return true; } virtual bool has_write_ref_array_opt() = 0; virtual bool has_write_prim_array_opt() = 0; @@ -104,7 +117,13 @@ public: virtual void read_ref_array(MemRegion mr) = 0; virtual void read_prim_array(MemRegion mr) = 0; + virtual void write_ref_array_pre(MemRegion mr) {} inline void write_ref_array(MemRegion mr); + + // Static versions, suitable for calling from generated code. + static void static_write_ref_array_pre(HeapWord* start, size_t count); + static void static_write_ref_array_post(HeapWord* start, size_t count); + protected: virtual void write_ref_array_work(MemRegion mr) = 0; public: @@ -120,33 +139,6 @@ protected: virtual void write_region_work(MemRegion mr) = 0; public: - // The remaining sets of operations are called by compilers or other code - // generators to insert barriers into generated code. There may be - // several such code generators; the signatures of these - // barrier-generating functions may differ from generator to generator. - // There will be a set of four function signatures for each code - // generator, which accomplish the generation of barriers of the four - // kinds listed above. - -#ifdef TBD - // Generates code to invoke the barrier, if any, necessary when reading - // the ref field at "offset" in "obj". - virtual void gen_read_ref_field() = 0; - - // Generates code to invoke the barrier, if any, necessary when reading - // the primitive field of "bytes" bytes at offset" in "obj". - virtual void gen_read_prim_field() = 0; - - // Generates code to invoke the barrier, if any, necessary when writing - // "new_val" into the ref field at "offset" in "obj". - virtual void gen_write_ref_field() = 0; - - // Generates code to invoke the barrier, if any, necessary when writing - // the "bytes"-byte value "new_val" into the primitive field at "offset" - // in "obj". - virtual void gen_write_prim_field() = 0; -#endif - // Some barrier sets create tables whose elements correspond to parts of // the heap; the CardTableModRefBS is an example. Such barrier sets will // normally reserve space for such tables, and commit parts of the table diff --git a/hotspot/src/share/vm/memory/barrierSet.inline.hpp b/hotspot/src/share/vm/memory/barrierSet.inline.hpp index ab89a4d4668..e58e97db5ed 100644 --- a/hotspot/src/share/vm/memory/barrierSet.inline.hpp +++ b/hotspot/src/share/vm/memory/barrierSet.inline.hpp @@ -26,6 +26,14 @@ // performance-critical calls when when the barrier is the most common // card-table kind. +void BarrierSet::write_ref_field_pre(void* field, oop new_val) { + if (kind() == CardTableModRef) { + ((CardTableModRefBS*)this)->inline_write_ref_field_pre(field, new_val); + } else { + write_ref_field_pre_work(field, new_val); + } +} + void BarrierSet::write_ref_field(void* field, oop new_val) { if (kind() == CardTableModRef) { ((CardTableModRefBS*)this)->inline_write_ref_field(field, new_val); diff --git a/hotspot/src/share/vm/memory/blockOffsetTable.cpp b/hotspot/src/share/vm/memory/blockOffsetTable.cpp index b1d0c62b898..078dc413537 100644 --- a/hotspot/src/share/vm/memory/blockOffsetTable.cpp +++ b/hotspot/src/share/vm/memory/blockOffsetTable.cpp @@ -184,7 +184,7 @@ BlockOffsetArray::set_remainder_to_point_to_start_incl(size_t start_card, size_t "Offset card has an unexpected value"); size_t start_card_for_region = start_card; u_char offset = max_jubyte; - for (int i = 0; i <= N_powers-1; i++) { + for (int i = 0; i < N_powers; i++) { // -1 so that the the card with the actual offset is counted. Another -1 // so that the reach ends in this region and not at the start // of the next. diff --git a/hotspot/src/share/vm/memory/blockOffsetTable.hpp b/hotspot/src/share/vm/memory/blockOffsetTable.hpp index fc76fc9208c..a4b6199e8be 100644 --- a/hotspot/src/share/vm/memory/blockOffsetTable.hpp +++ b/hotspot/src/share/vm/memory/blockOffsetTable.hpp @@ -208,6 +208,7 @@ public: ////////////////////////////////////////////////////////////////////////// class BlockOffsetArray: public BlockOffsetTable { friend class VMStructs; + friend class G1BlockOffsetArray; // temp. until we restructure and cleanup protected: // The following enums are used by do_block_internal() below enum Action { diff --git a/hotspot/src/share/vm/memory/cardTableModRefBS.cpp b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp index fab92e0f698..3bff5788e4a 100644 --- a/hotspot/src/share/vm/memory/cardTableModRefBS.cpp +++ b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp @@ -299,6 +299,17 @@ void CardTableModRefBS::write_ref_field_work(void* field, oop newVal) { } +bool CardTableModRefBS::claim_card(size_t card_index) { + jbyte val = _byte_map[card_index]; + if (val != claimed_card_val()) { + jbyte res = Atomic::cmpxchg((jbyte) claimed_card_val(), &_byte_map[card_index], val); + if (res == val) + return true; + else return false; + } + return false; +} + void CardTableModRefBS::non_clean_card_iterate(Space* sp, MemRegion mr, DirtyCardToOopClosure* dcto_cl, @@ -398,7 +409,7 @@ void CardTableModRefBS::dirty_MemRegion(MemRegion mr) { } } -void CardTableModRefBS::invalidate(MemRegion mr) { +void CardTableModRefBS::invalidate(MemRegion mr, bool whole_heap) { for (int i = 0; i < _cur_covered_regions; i++) { MemRegion mri = mr.intersection(_covered[i]); if (!mri.is_empty()) dirty_MemRegion(mri); @@ -426,11 +437,15 @@ void CardTableModRefBS::clear(MemRegion mr) { } } +void CardTableModRefBS::dirty(MemRegion mr) { + jbyte* first = byte_for(mr.start()); + jbyte* last = byte_after(mr.last()); + memset(first, dirty_card, last-first); +} + // NOTES: // (1) Unlike mod_oop_in_space_iterate() above, dirty_card_iterate() // iterates over dirty cards ranges in increasing address order. -// (2) Unlike, e.g., dirty_card_range_after_preclean() below, -// this method does not make the dirty cards prelceaned. void CardTableModRefBS::dirty_card_iterate(MemRegion mr, MemRegionClosure* cl) { for (int i = 0; i < _cur_covered_regions; i++) { @@ -456,7 +471,9 @@ void CardTableModRefBS::dirty_card_iterate(MemRegion mr, } } -MemRegion CardTableModRefBS::dirty_card_range_after_preclean(MemRegion mr) { +MemRegion CardTableModRefBS::dirty_card_range_after_reset(MemRegion mr, + bool reset, + int reset_val) { for (int i = 0; i < _cur_covered_regions; i++) { MemRegion mri = mr.intersection(_covered[i]); if (!mri.is_empty()) { @@ -473,8 +490,10 @@ MemRegion CardTableModRefBS::dirty_card_range_after_preclean(MemRegion mr) { dirty_cards++, next_entry++); MemRegion cur_cards(addr_for(cur_entry), dirty_cards*card_size_in_words); - for (size_t i = 0; i < dirty_cards; i++) { - cur_entry[i] = precleaned_card; + if (reset) { + for (size_t i = 0; i < dirty_cards; i++) { + cur_entry[i] = reset_val; + } } return cur_cards; } diff --git a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp index dcc457111df..a2fdbf94f8a 100644 --- a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp +++ b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp @@ -54,6 +54,7 @@ class CardTableModRefBS: public ModRefBarrierSet { clean_card = -1, dirty_card = 0, precleaned_card = 1, + claimed_card = 3, last_card = 4, CT_MR_BS_last_reserved = 10 }; @@ -150,17 +151,6 @@ class CardTableModRefBS: public ModRefBarrierSet { return byte_for(p) + 1; } - // Mapping from card marking array entry to address of first word - HeapWord* addr_for(const jbyte* p) const { - assert(p >= _byte_map && p < _byte_map + _byte_map_size, - "out of bounds access to card marking array"); - size_t delta = pointer_delta(p, byte_map_base, sizeof(jbyte)); - HeapWord* result = (HeapWord*) (delta << card_shift); - assert(_whole_heap.contains(result), - "out of bounds accessor from card marking array"); - return result; - } - // Iterate over the portion of the card-table which covers the given // region mr in the given space and apply cl to any dirty sub-regions // of mr. cl and dcto_cl must either be the same closure or cl must @@ -263,16 +253,22 @@ public: card_size_in_words = card_size / sizeof(HeapWord) }; + static int clean_card_val() { return clean_card; } + static int dirty_card_val() { return dirty_card; } + static int claimed_card_val() { return claimed_card; } + static int precleaned_card_val() { return precleaned_card; } + // For RTTI simulation. - BarrierSet::Name kind() { return BarrierSet::CardTableModRef; } bool is_a(BarrierSet::Name bsn) { - return bsn == BarrierSet::CardTableModRef || bsn == BarrierSet::ModRef; + return bsn == BarrierSet::CardTableModRef || ModRefBarrierSet::is_a(bsn); } CardTableModRefBS(MemRegion whole_heap, int max_covered_regions); // *** Barrier set functions. + bool has_write_ref_pre_barrier() { return false; } + inline bool write_ref_needs_barrier(void* field, oop new_val) { // Note that this assumes the perm gen is the highest generation // in the address space @@ -315,11 +311,33 @@ public: // *** Card-table-barrier-specific things. + inline void inline_write_ref_field_pre(void* field, oop newVal) {} + inline void inline_write_ref_field(void* field, oop newVal) { jbyte* byte = byte_for(field); *byte = dirty_card; } + // These are used by G1, when it uses the card table as a temporary data + // structure for card claiming. + bool is_card_dirty(size_t card_index) { + return _byte_map[card_index] == dirty_card_val(); + } + + void mark_card_dirty(size_t card_index) { + _byte_map[card_index] = dirty_card_val(); + } + + bool is_card_claimed(size_t card_index) { + return _byte_map[card_index] == claimed_card_val(); + } + + bool claim_card(size_t card_index); + + bool is_card_clean(size_t card_index) { + return _byte_map[card_index] == clean_card_val(); + } + // Card marking array base (adjusted for heap low boundary) // This would be the 0th element of _byte_map, if the heap started at 0x0. // But since the heap starts at some higher address, this points to somewhere @@ -344,8 +362,9 @@ public: } // ModRefBS functions. - void invalidate(MemRegion mr); + virtual void invalidate(MemRegion mr, bool whole_heap = false); void clear(MemRegion mr); + void dirty(MemRegion mr); void mod_oop_in_space_iterate(Space* sp, OopClosure* cl, bool clear = false, bool before_save_marks = false); @@ -375,18 +394,39 @@ public: static uintx ct_max_alignment_constraint(); - // Apply closure cl to the dirty cards lying completely - // within MemRegion mr, setting the cards to precleaned. - void dirty_card_iterate(MemRegion mr, MemRegionClosure* cl); + // Apply closure "cl" to the dirty cards containing some part of + // MemRegion "mr". + void dirty_card_iterate(MemRegion mr, MemRegionClosure* cl); // Return the MemRegion corresponding to the first maximal run - // of dirty cards lying completely within MemRegion mr, after - // marking those cards precleaned. - MemRegion dirty_card_range_after_preclean(MemRegion mr); + // of dirty cards lying completely within MemRegion mr. + // If reset is "true", then sets those card table entries to the given + // value. + MemRegion dirty_card_range_after_reset(MemRegion mr, bool reset, + int reset_val); // Set all the dirty cards in the given region to precleaned state. void preclean_dirty_cards(MemRegion mr); + // Provide read-only access to the card table array. + const jbyte* byte_for_const(const void* p) const { + return byte_for(p); + } + const jbyte* byte_after_const(const void* p) const { + return byte_after(p); + } + + // Mapping from card marking array entry to address of first word + HeapWord* addr_for(const jbyte* p) const { + assert(p >= _byte_map && p < _byte_map + _byte_map_size, + "out of bounds access to card marking array"); + size_t delta = pointer_delta(p, byte_map_base, sizeof(jbyte)); + HeapWord* result = (HeapWord*) (delta << card_shift); + assert(_whole_heap.contains(result), + "out of bounds accessor from card marking array"); + return result; + } + // Mapping from address to card marking array index. int index_for(void* p) { assert(_whole_heap.contains(p), @@ -402,6 +442,7 @@ public: static size_t par_chunk_heapword_alignment() { return CardsPerStrideChunk * card_size_in_words; } + }; class CardTableRS; diff --git a/hotspot/src/share/vm/memory/cardTableRS.cpp b/hotspot/src/share/vm/memory/cardTableRS.cpp index e84cc57f085..263c4f4a84c 100644 --- a/hotspot/src/share/vm/memory/cardTableRS.cpp +++ b/hotspot/src/share/vm/memory/cardTableRS.cpp @@ -27,10 +27,25 @@ CardTableRS::CardTableRS(MemRegion whole_heap, int max_covered_regions) : - GenRemSet(&_ct_bs), - _ct_bs(whole_heap, max_covered_regions), - _cur_youngergen_card_val(youngergenP1_card) + GenRemSet(), + _cur_youngergen_card_val(youngergenP1_card), + _regions_to_iterate(max_covered_regions - 1) { +#ifndef SERIALGC + if (UseG1GC) { + if (G1RSBarrierUseQueue) { + _ct_bs = new G1SATBCardTableLoggingModRefBS(whole_heap, + max_covered_regions); + } else { + _ct_bs = new G1SATBCardTableModRefBS(whole_heap, max_covered_regions); + } + } else { + _ct_bs = new CardTableModRefBSForCTRS(whole_heap, max_covered_regions); + } +#else + _ct_bs = new CardTableModRefBSForCTRS(whole_heap, max_covered_regions); +#endif + set_bs(_ct_bs); _last_cur_val_in_gen = new jbyte[GenCollectedHeap::max_gens + 1]; if (_last_cur_val_in_gen == NULL) { vm_exit_during_initialization("Could not last_cur_val_in_gen array."); @@ -38,20 +53,19 @@ CardTableRS::CardTableRS(MemRegion whole_heap, for (int i = 0; i < GenCollectedHeap::max_gens + 1; i++) { _last_cur_val_in_gen[i] = clean_card_val(); } - _ct_bs.set_CTRS(this); + _ct_bs->set_CTRS(this); } void CardTableRS::resize_covered_region(MemRegion new_region) { - _ct_bs.resize_covered_region(new_region); + _ct_bs->resize_covered_region(new_region); } jbyte CardTableRS::find_unused_youngergenP_card_value() { - GenCollectedHeap* gch = GenCollectedHeap::heap(); for (jbyte v = youngergenP1_card; v < cur_youngergen_and_prev_nonclean_card; v++) { bool seen = false; - for (int g = 0; g < gch->n_gens()+1; g++) { + for (int g = 0; g < _regions_to_iterate; g++) { if (_last_cur_val_in_gen[g] == v) { seen = true; break; @@ -221,11 +235,11 @@ void CardTableRS::write_ref_field_gc_par(void* field, oop new_val) { void CardTableRS::younger_refs_in_space_iterate(Space* sp, OopsInGenClosure* cl) { - DirtyCardToOopClosure* dcto_cl = sp->new_dcto_cl(cl, _ct_bs.precision(), + DirtyCardToOopClosure* dcto_cl = sp->new_dcto_cl(cl, _ct_bs->precision(), cl->gen_boundary()); ClearNoncleanCardWrapper clear_cl(dcto_cl, this); - _ct_bs.non_clean_card_iterate(sp, sp->used_region_at_save_marks(), + _ct_bs->non_clean_card_iterate(sp, sp->used_region_at_save_marks(), dcto_cl, &clear_cl, false); } @@ -549,7 +563,7 @@ void CardTableRS::verify() { if (ch->kind() == CollectedHeap::GenCollectedHeap) { GenCollectedHeap::heap()->generation_iterate(&blk, false); - _ct_bs.verify(); + _ct_bs->verify(); // If the old gen collections also collect perm, then we are only // interested in perm-to-young pointers, not perm-to-old pointers. diff --git a/hotspot/src/share/vm/memory/cardTableRS.hpp b/hotspot/src/share/vm/memory/cardTableRS.hpp index c2180de67d3..10513fe80fe 100644 --- a/hotspot/src/share/vm/memory/cardTableRS.hpp +++ b/hotspot/src/share/vm/memory/cardTableRS.hpp @@ -44,7 +44,7 @@ class CardTableRS: public GenRemSet { return CardTableModRefBS::card_is_dirty_wrt_gen_iter(cv); } - CardTableModRefBSForCTRS _ct_bs; + CardTableModRefBSForCTRS* _ct_bs; virtual void younger_refs_in_space_iterate(Space* sp, OopsInGenClosure* cl); @@ -73,6 +73,8 @@ class CardTableRS: public GenRemSet { jbyte _cur_youngergen_card_val; + int _regions_to_iterate; + jbyte cur_youngergen_card_val() { return _cur_youngergen_card_val; } @@ -96,7 +98,7 @@ public: CardTableRS* as_CardTableRS() { return this; } - CardTableModRefBS* ct_bs() { return &_ct_bs; } + CardTableModRefBS* ct_bs() { return _ct_bs; } // Override. void prepare_for_younger_refs_iterate(bool parallel); @@ -107,7 +109,7 @@ public: void younger_refs_iterate(Generation* g, OopsInGenClosure* blk); void inline_write_ref_field_gc(void* field, oop new_val) { - jbyte* byte = _ct_bs.byte_for(field); + jbyte* byte = _ct_bs->byte_for(field); *byte = youngergen_card; } void write_ref_field_gc_work(void* field, oop new_val) { @@ -122,25 +124,27 @@ public: void resize_covered_region(MemRegion new_region); bool is_aligned(HeapWord* addr) { - return _ct_bs.is_card_aligned(addr); + return _ct_bs->is_card_aligned(addr); } void verify(); void verify_aligned_region_empty(MemRegion mr); - void clear(MemRegion mr) { _ct_bs.clear(mr); } + void clear(MemRegion mr) { _ct_bs->clear(mr); } void clear_into_younger(Generation* gen, bool clear_perm); - void invalidate(MemRegion mr) { _ct_bs.invalidate(mr); } + void invalidate(MemRegion mr, bool whole_heap = false) { + _ct_bs->invalidate(mr, whole_heap); + } void invalidate_or_clear(Generation* gen, bool younger, bool perm); static uintx ct_max_alignment_constraint() { return CardTableModRefBS::ct_max_alignment_constraint(); } - jbyte* byte_for(void* p) { return _ct_bs.byte_for(p); } - jbyte* byte_after(void* p) { return _ct_bs.byte_after(p); } - HeapWord* addr_for(jbyte* p) { return _ct_bs.addr_for(p); } + jbyte* byte_for(void* p) { return _ct_bs->byte_for(p); } + jbyte* byte_after(void* p) { return _ct_bs->byte_after(p); } + HeapWord* addr_for(jbyte* p) { return _ct_bs->addr_for(p); } bool is_prev_nonclean_card_val(jbyte v) { return diff --git a/hotspot/src/share/vm/memory/collectorPolicy.cpp b/hotspot/src/share/vm/memory/collectorPolicy.cpp index b26158e247b..d90fdc8c4cf 100644 --- a/hotspot/src/share/vm/memory/collectorPolicy.cpp +++ b/hotspot/src/share/vm/memory/collectorPolicy.cpp @@ -31,11 +31,11 @@ void CollectorPolicy::initialize_flags() { if (PermSize > MaxPermSize) { MaxPermSize = PermSize; } - PermSize = align_size_down(PermSize, min_alignment()); + PermSize = MAX2(min_alignment(), align_size_down_(PermSize, min_alignment())); MaxPermSize = align_size_up(MaxPermSize, max_alignment()); - MinPermHeapExpansion = align_size_down(MinPermHeapExpansion, min_alignment()); - MaxPermHeapExpansion = align_size_down(MaxPermHeapExpansion, min_alignment()); + MinPermHeapExpansion = MAX2(min_alignment(), align_size_down_(MinPermHeapExpansion, min_alignment())); + MaxPermHeapExpansion = MAX2(min_alignment(), align_size_down_(MaxPermHeapExpansion, min_alignment())); MinHeapDeltaBytes = align_size_up(MinHeapDeltaBytes, min_alignment()); @@ -55,25 +55,21 @@ void CollectorPolicy::initialize_flags() { void CollectorPolicy::initialize_size_info() { // User inputs from -mx and ms are aligned - _initial_heap_byte_size = align_size_up(Arguments::initial_heap_size(), - min_alignment()); - set_min_heap_byte_size(align_size_up(Arguments::min_heap_size(), - min_alignment())); - set_max_heap_byte_size(align_size_up(MaxHeapSize, max_alignment())); - - // Check validity of heap parameters from launcher + set_initial_heap_byte_size(Arguments::initial_heap_size()); if (initial_heap_byte_size() == 0) { set_initial_heap_byte_size(NewSize + OldSize); - } else { - Universe::check_alignment(initial_heap_byte_size(), min_alignment(), - "initial heap"); } + set_initial_heap_byte_size(align_size_up(_initial_heap_byte_size, + min_alignment())); + + set_min_heap_byte_size(Arguments::min_heap_size()); if (min_heap_byte_size() == 0) { set_min_heap_byte_size(NewSize + OldSize); - } else { - Universe::check_alignment(min_heap_byte_size(), min_alignment(), - "initial heap"); } + set_min_heap_byte_size(align_size_up(_min_heap_byte_size, + min_alignment())); + + set_max_heap_byte_size(align_size_up(MaxHeapSize, max_alignment())); // Check heap parameter properties if (initial_heap_byte_size() < M) { @@ -121,8 +117,6 @@ GenRemSet* CollectorPolicy::create_rem_set(MemRegion whole_heap, int max_covered_regions) { switch (rem_set_name()) { case GenRemSet::CardTable: { - if (barrier_set_name() != BarrierSet::CardTableModRef) - vm_exit_during_initialization("Mismatch between RS and BS."); CardTableRS* res = new CardTableRS(whole_heap, max_covered_regions); return res; } @@ -345,7 +339,7 @@ void GenCollectorPolicy::initialize_size_info() { // At this point all three sizes have been checked against the // maximum sizes but have not been checked for consistency - // amoung the three. + // among the three. // Final check min <= initial <= max set_min_gen0_size(MIN2(_min_gen0_size, _max_gen0_size)); diff --git a/hotspot/src/share/vm/memory/collectorPolicy.hpp b/hotspot/src/share/vm/memory/collectorPolicy.hpp index da98dfd0106..1a7e14aeb80 100644 --- a/hotspot/src/share/vm/memory/collectorPolicy.hpp +++ b/hotspot/src/share/vm/memory/collectorPolicy.hpp @@ -39,10 +39,12 @@ // Forward declarations. class GenCollectorPolicy; class TwoGenerationCollectorPolicy; +class AdaptiveSizePolicy; #ifndef SERIALGC class ConcurrentMarkSweepPolicy; +class G1CollectorPolicy; #endif // SERIALGC -class AdaptiveSizePolicy; + class GCPolicyCounters; class PermanentGenerationSpec; class MarkSweepPolicy; @@ -55,7 +57,7 @@ class CollectorPolicy : public CHeapObj { // Requires that the concrete subclass sets the alignment constraints // before calling. virtual void initialize_flags(); - virtual void initialize_size_info() = 0; + virtual void initialize_size_info(); // Initialize "_permanent_generation" to a spec for the given kind of // Perm Gen. void initialize_perm_generation(PermGen::Name pgnm); @@ -91,17 +93,18 @@ class CollectorPolicy : public CHeapObj { enum Name { CollectorPolicyKind, TwoGenerationCollectorPolicyKind, - TrainPolicyKind, ConcurrentMarkSweepPolicyKind, - ASConcurrentMarkSweepPolicyKind + ASConcurrentMarkSweepPolicyKind, + G1CollectorPolicyKind }; // Identification methods. - virtual GenCollectorPolicy* as_generation_policy() { return NULL; } + virtual GenCollectorPolicy* as_generation_policy() { return NULL; } virtual TwoGenerationCollectorPolicy* as_two_generation_policy() { return NULL; } virtual MarkSweepPolicy* as_mark_sweep_policy() { return NULL; } #ifndef SERIALGC virtual ConcurrentMarkSweepPolicy* as_concurrent_mark_sweep_policy() { return NULL; } + virtual G1CollectorPolicy* as_g1_policy() { return NULL; } #endif // SERIALGC // Note that these are not virtual. bool is_generation_policy() { return as_generation_policy() != NULL; } @@ -109,10 +112,13 @@ class CollectorPolicy : public CHeapObj { bool is_mark_sweep_policy() { return as_mark_sweep_policy() != NULL; } #ifndef SERIALGC bool is_concurrent_mark_sweep_policy() { return as_concurrent_mark_sweep_policy() != NULL; } + bool is_g1_policy() { return as_g1_policy() != NULL; } #else // SERIALGC bool is_concurrent_mark_sweep_policy() { return false; } + bool is_g1_policy() { return false; } #endif // SERIALGC + virtual PermanentGenerationSpec *permanent_generation() { assert(_permanent_generation != NULL, "Sanity check"); return _permanent_generation; diff --git a/hotspot/src/share/vm/memory/defNewGeneration.cpp b/hotspot/src/share/vm/memory/defNewGeneration.cpp index d13c9e9adff..9f76cf63997 100644 --- a/hotspot/src/share/vm/memory/defNewGeneration.cpp +++ b/hotspot/src/share/vm/memory/defNewGeneration.cpp @@ -214,20 +214,26 @@ void DefNewGeneration::compute_space_boundaries(uintx minimum_eden_size) { MemRegion fromMR((HeapWord*)from_start, (HeapWord*)to_start); MemRegion toMR ((HeapWord*)to_start, (HeapWord*)to_end); - eden()->initialize(edenMR, (minimum_eden_size == 0)); - // If minumum_eden_size != 0, we will not have cleared any - // portion of eden above its top. This can cause newly - // expanded space not to be mangled if using ZapUnusedHeapArea. - // We explicitly do such mangling here. - if (ZapUnusedHeapArea && (minimum_eden_size != 0)) { - eden()->mangle_unused_area(); + eden()->set_bounds(edenMR); + if (minimum_eden_size == 0) { + // The "minimum_eden_size" is really the amount of eden occupied by + // allocated objects -- if this is zero, then we can clear the space. + eden()->clear(); + } else { + // Otherwise, we will not have cleared eden. This can cause newly + // expanded space not to be mangled if using ZapUnusedHeapArea. + // We explicitly do such mangling here. + if (ZapUnusedHeapArea) { + eden()->mangle_unused_area(); + } } - from()->initialize(fromMR, true); - to()->initialize(toMR , true); - eden()->set_next_compaction_space(from()); + from()->set_bounds(fromMR); from()->clear(); + to()->set_bounds(toMR); to()->clear(); + // Make sure we compact eden, then from. // The to-space is normally empty before a compaction so need // not be considered. The exception is during promotion // failure handling when to-space can contain live objects. + eden()->set_next_compaction_space(from()); from()->set_next_compaction_space(NULL); } diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.hpp b/hotspot/src/share/vm/memory/genCollectedHeap.hpp index 54dce33bb80..145f129bd8e 100644 --- a/hotspot/src/share/vm/memory/genCollectedHeap.hpp +++ b/hotspot/src/share/vm/memory/genCollectedHeap.hpp @@ -252,6 +252,21 @@ public: virtual size_t unsafe_max_tlab_alloc(Thread* thr) const; virtual HeapWord* allocate_new_tlab(size_t size); + // Can a compiler initialize a new object without store barriers? + // This permission only extends from the creation of a new object + // via a TLAB up to the first subsequent safepoint. + virtual bool can_elide_tlab_store_barriers() const { + return true; + } + + // Can a compiler elide a store barrier when it writes + // a permanent oop into the heap? Applies when the compiler + // is storing x to the heap, where x->is_perm() is true. + virtual bool can_elide_permanent_oop_store_barriers() const { + // CMS needs to see all, even intra-generational, ref updates. + return !UseConcMarkSweepGC; + } + // The "requestor" generation is performing some garbage collection // action for which it would be useful to have scratch space. The // requestor promises to allocate no more than "max_alloc_words" in any diff --git a/hotspot/src/share/vm/memory/genMarkSweep.hpp b/hotspot/src/share/vm/memory/genMarkSweep.hpp index c2c43704fcc..cbedd85c70c 100644 --- a/hotspot/src/share/vm/memory/genMarkSweep.hpp +++ b/hotspot/src/share/vm/memory/genMarkSweep.hpp @@ -24,6 +24,7 @@ class GenMarkSweep : public MarkSweep { friend class VM_MarkSweep; + friend class G1MarkSweep; public: static void invoke_at_safepoint(int level, ReferenceProcessor* rp, bool clear_all_softrefs); diff --git a/hotspot/src/share/vm/memory/genOopClosures.hpp b/hotspot/src/share/vm/memory/genOopClosures.hpp index d0f142f65a3..517db0b8341 100644 --- a/hotspot/src/share/vm/memory/genOopClosures.hpp +++ b/hotspot/src/share/vm/memory/genOopClosures.hpp @@ -56,6 +56,9 @@ class OopsInGenClosure : public OopClosure { // pointers must call the method below. template void do_barrier(T* p); + // Version for use by closures that may be called in parallel code. + void par_do_barrier(oop* p); + public: OopsInGenClosure() : OopClosure(NULL), _orig_gen(NULL), _gen(NULL), _gen_boundary(NULL), _rs(NULL) {}; diff --git a/hotspot/src/share/vm/memory/genOopClosures.inline.hpp b/hotspot/src/share/vm/memory/genOopClosures.inline.hpp index a6699d74b18..d1a42839a9c 100644 --- a/hotspot/src/share/vm/memory/genOopClosures.inline.hpp +++ b/hotspot/src/share/vm/memory/genOopClosures.inline.hpp @@ -48,6 +48,16 @@ template inline void OopsInGenClosure::do_barrier(T* p) { } } +inline void OopsInGenClosure::par_do_barrier(oop* p) { + assert(generation()->is_in_reserved(p), "expected ref in generation"); + oop obj = *p; + assert(obj != NULL, "expected non-null object"); + // If p points to a younger generation, mark the card. + if ((HeapWord*)obj < gen_boundary()) { + rs()->write_ref_field_gc_par(p, obj); + } +} + // NOTE! Any changes made here should also be made // in FastScanClosure::do_oop_work() template inline void ScanClosure::do_oop_work(T* p) { diff --git a/hotspot/src/share/vm/memory/genRemSet.hpp b/hotspot/src/share/vm/memory/genRemSet.hpp index c2ef23061af..13a5c2c20e3 100644 --- a/hotspot/src/share/vm/memory/genRemSet.hpp +++ b/hotspot/src/share/vm/memory/genRemSet.hpp @@ -42,6 +42,7 @@ public: }; GenRemSet(BarrierSet * bs) : _bs(bs) {} + GenRemSet() : _bs(NULL) {} virtual Name rs_kind() = 0; @@ -53,6 +54,9 @@ public: // Return the barrier set associated with "this." BarrierSet* bs() { return _bs; } + // Set the barrier set. + void set_bs(BarrierSet* bs) { _bs = bs; } + // Do any (sequential) processing necessary to prepare for (possibly // "parallel", if that arg is true) calls to younger_refs_iterate. virtual void prepare_for_younger_refs_iterate(bool parallel) = 0; @@ -116,7 +120,10 @@ public: // Informs the RS that refs in the given "mr" may have changed // arbitrarily, and therefore may contain old-to-young pointers. - virtual void invalidate(MemRegion mr) = 0; + // If "whole heap" is true, then this invalidation is part of an + // invalidation of the whole heap, which an implementation might + // handle differently than that of a sub-part of the heap. + virtual void invalidate(MemRegion mr, bool whole_heap = false) = 0; // Informs the RS that refs in this generation // may have changed arbitrarily, and therefore may contain diff --git a/hotspot/src/share/vm/memory/heapInspection.cpp b/hotspot/src/share/vm/memory/heapInspection.cpp index 9fc47755608..7d0c6155de1 100644 --- a/hotspot/src/share/vm/memory/heapInspection.cpp +++ b/hotspot/src/share/vm/memory/heapInspection.cpp @@ -238,11 +238,14 @@ void HeapInspection::heap_inspection(outputStream* st) { HeapWord* ref; CollectedHeap* heap = Universe::heap(); + bool is_shared_heap = false; switch (heap->kind()) { + case CollectedHeap::G1CollectedHeap: case CollectedHeap::GenCollectedHeap: { - GenCollectedHeap* gch = (GenCollectedHeap*)heap; - gch->gc_prologue(false /* !full */); // get any necessary locks - ref = gch->perm_gen()->used_region().start(); + is_shared_heap = true; + SharedHeap* sh = (SharedHeap*)heap; + sh->gc_prologue(false /* !full */); // get any necessary locks, etc. + ref = sh->perm_gen()->used_region().start(); break; } #ifndef SERIALGC @@ -284,9 +287,9 @@ void HeapInspection::heap_inspection(outputStream* st) { } st->flush(); - if (Universe::heap()->kind() == CollectedHeap::GenCollectedHeap) { - GenCollectedHeap* gch = GenCollectedHeap::heap(); - gch->gc_epilogue(false /* !full */); // release all acquired locks + if (is_shared_heap) { + SharedHeap* sh = (SharedHeap*)heap; + sh->gc_epilogue(false /* !full */); // release all acquired locks, etc. } } diff --git a/hotspot/src/share/vm/memory/iterator.hpp b/hotspot/src/share/vm/memory/iterator.hpp index 1b92ddd4bc5..ab05643513c 100644 --- a/hotspot/src/share/vm/memory/iterator.hpp +++ b/hotspot/src/share/vm/memory/iterator.hpp @@ -26,9 +26,23 @@ class ReferenceProcessor; +// Closure provides abortability. + +class Closure : public StackObj { + protected: + bool _abort; + void set_abort() { _abort = true; } + public: + Closure() : _abort(false) {} + // A subtype can use this mechanism to indicate to some iterator mapping + // functions that the iteration should cease. + bool abort() { return _abort; } + void clear_abort() { _abort = false; } +}; + // OopClosure is used for iterating through roots (oop*) -class OopClosure : public StackObj { +class OopClosure : public Closure { public: ReferenceProcessor* _ref_processor; OopClosure(ReferenceProcessor* rp) : _ref_processor(rp) { } @@ -55,11 +69,16 @@ class OopClosure : public StackObj { Prefetch::style prefetch_style() { // Note that this is non-virtual. return Prefetch::do_none; } + + // True iff this closure may be safely applied more than once to an oop + // location without an intervening "major reset" (like the end of a GC). + virtual bool idempotent() { return false; } + virtual bool apply_to_weak_ref_discovered_field() { return false; } }; // ObjectClosure is used for iterating through an object space -class ObjectClosure : public StackObj { +class ObjectClosure : public Closure { public: // Called for each object. virtual void do_object(oop obj) = 0; diff --git a/hotspot/src/share/vm/memory/modRefBarrierSet.hpp b/hotspot/src/share/vm/memory/modRefBarrierSet.hpp index c85a18e7ac5..7e3dc84f610 100644 --- a/hotspot/src/share/vm/memory/modRefBarrierSet.hpp +++ b/hotspot/src/share/vm/memory/modRefBarrierSet.hpp @@ -31,6 +31,13 @@ class Generation; class ModRefBarrierSet: public BarrierSet { public: + + ModRefBarrierSet() { _kind = BarrierSet::ModRef; } + + bool is_a(BarrierSet::Name bsn) { + return bsn == BarrierSet::ModRef; + } + // Barriers only on ref writes. bool has_read_ref_barrier() { return false; } bool has_read_prim_barrier() { return false; } @@ -85,8 +92,10 @@ public: bool clear = false, bool before_save_marks = false) = 0; - // Causes all refs in "mr" to be assumed to be modified. - virtual void invalidate(MemRegion mr) = 0; + // Causes all refs in "mr" to be assumed to be modified. If "whole_heap" + // is true, the caller asserts that the entire heap is being invalidated, + // which may admit an optimized implementation for some barriers. + virtual void invalidate(MemRegion mr, bool whole_heap = false) = 0; // The caller guarantees that "mr" contains no references. (Perhaps it's // objects have been moved elsewhere.) diff --git a/hotspot/src/share/vm/memory/referenceProcessor.cpp b/hotspot/src/share/vm/memory/referenceProcessor.cpp index c9ba9b81c43..7f6cfa5fe33 100644 --- a/hotspot/src/share/vm/memory/referenceProcessor.cpp +++ b/hotspot/src/share/vm/memory/referenceProcessor.cpp @@ -91,7 +91,8 @@ ReferenceProcessor::create_ref_processor(MemRegion span, bool mt_discovery, BoolObjectClosure* is_alive_non_header, int parallel_gc_threads, - bool mt_processing) { + bool mt_processing, + bool dl_needs_barrier) { int mt_degree = 1; if (parallel_gc_threads > 1) { mt_degree = parallel_gc_threads; @@ -99,7 +100,8 @@ ReferenceProcessor::create_ref_processor(MemRegion span, ReferenceProcessor* rp = new ReferenceProcessor(span, atomic_discovery, mt_discovery, mt_degree, - mt_processing && (parallel_gc_threads > 0)); + mt_processing && (parallel_gc_threads > 0), + dl_needs_barrier); if (rp == NULL) { vm_exit_during_initialization("Could not allocate ReferenceProcessor object"); } @@ -111,10 +113,13 @@ ReferenceProcessor::ReferenceProcessor(MemRegion span, bool atomic_discovery, bool mt_discovery, int mt_degree, - bool mt_processing) : + bool mt_processing, + bool discovered_list_needs_barrier) : _discovering_refs(false), _enqueuing_is_done(false), _is_alive_non_header(NULL), + _discovered_list_needs_barrier(discovered_list_needs_barrier), + _bs(NULL), _processing_is_mt(mt_processing), _next_id(0) { @@ -135,6 +140,10 @@ ReferenceProcessor::ReferenceProcessor(MemRegion span, _discoveredSoftRefs[i].set_head(sentinel_ref()); _discoveredSoftRefs[i].set_length(0); } + // If we do barreirs, cache a copy of the barrier set. + if (discovered_list_needs_barrier) { + _bs = Universe::heap()->barrier_set(); + } } #ifndef PRODUCT @@ -727,10 +736,15 @@ ReferenceProcessor::abandon_partial_discovered_list(DiscoveredList& refs_list) { refs_list.set_length(0); } -void -ReferenceProcessor::abandon_partial_discovered_list_arr(DiscoveredList refs_lists[]) { - for (int i = 0; i < _num_q; i++) { - abandon_partial_discovered_list(refs_lists[i]); +void ReferenceProcessor::abandon_partial_discovery() { + // loop over the lists + for (int i = 0; i < _num_q * subclasses_of_ref; i++) { + if (TraceReferenceGC && PrintGCDetails && ((i % _num_q) == 0)) { + gclog_or_tty->print_cr( + "\nAbandoning %s discovered list", + list_name(i)); + } + abandon_partial_discovered_list(_discoveredSoftRefs[i]); } } @@ -994,7 +1008,16 @@ ReferenceProcessor::add_to_discovered_list_mt(DiscoveredList& refs_list, assert(_discovery_is_mt, "!_discovery_is_mt should have been handled by caller"); // First we must make sure this object is only enqueued once. CAS in a non null // discovered_addr. - oop retest = oopDesc::atomic_compare_exchange_oop(refs_list.head(), discovered_addr, + oop current_head = refs_list.head(); + + // Note: In the case of G1, this pre-barrier is strictly + // not necessary because the only case we are interested in + // here is when *discovered_addr is NULL, so this will expand to + // nothing. As a result, I am just manually eliding this out for G1. + if (_discovered_list_needs_barrier && !UseG1GC) { + _bs->write_ref_field_pre((void*)discovered_addr, current_head); guarantee(false, "Needs to be fixed: YSR"); + } + oop retest = oopDesc::atomic_compare_exchange_oop(current_head, discovered_addr, NULL); if (retest == NULL) { // This thread just won the right to enqueue the object. @@ -1002,6 +1025,10 @@ ReferenceProcessor::add_to_discovered_list_mt(DiscoveredList& refs_list, // is necessary. refs_list.set_head(obj); refs_list.set_length(refs_list.length() + 1); + if (_discovered_list_needs_barrier) { + _bs->write_ref_field((void*)discovered_addr, current_head); guarantee(false, "Needs to be fixed: YSR"); + } + } else { // If retest was non NULL, another thread beat us to it: // The reference has already been discovered... @@ -1073,8 +1100,8 @@ bool ReferenceProcessor::discover_reference(oop obj, ReferenceType rt) { } } - HeapWord* discovered_addr = java_lang_ref_Reference::discovered_addr(obj); - oop discovered = java_lang_ref_Reference::discovered(obj); + HeapWord* const discovered_addr = java_lang_ref_Reference::discovered_addr(obj); + const oop discovered = java_lang_ref_Reference::discovered(obj); assert(discovered->is_oop_or_null(), "bad discovered field"); if (discovered != NULL) { // The reference has already been discovered... @@ -1094,7 +1121,7 @@ bool ReferenceProcessor::discover_reference(oop obj, ReferenceType rt) { // discovered twice except by concurrent collectors that potentially // trace the same Reference object twice. assert(UseConcMarkSweepGC, - "Only possible with a concurrent collector"); + "Only possible with an incremental-update concurrent collector"); return true; } } @@ -1122,12 +1149,24 @@ bool ReferenceProcessor::discover_reference(oop obj, ReferenceType rt) { return false; // nothing special needs to be done } - // We do a raw store here, the field will be visited later when - // processing the discovered references. if (_discovery_is_mt) { add_to_discovered_list_mt(*list, obj, discovered_addr); } else { - oop_store_raw(discovered_addr, list->head()); + // If "_discovered_list_needs_barrier", we do write barriers when + // updating the discovered reference list. Otherwise, we do a raw store + // here: the field will be visited later when processing the discovered + // references. + oop current_head = list->head(); + // As in the case further above, since we are over-writing a NULL + // pre-value, we can safely elide the pre-barrier here for the case of G1. + assert(discovered == NULL, "control point invariant"); + if (_discovered_list_needs_barrier && !UseG1GC) { // safe to elide for G1 + _bs->write_ref_field_pre((oop*)discovered_addr, current_head); + } + oop_store_raw(discovered_addr, current_head); + if (_discovered_list_needs_barrier) { + _bs->write_ref_field((oop*)discovered_addr, current_head); + } list->set_head(obj); list->set_length(list->length() + 1); } diff --git a/hotspot/src/share/vm/memory/referenceProcessor.hpp b/hotspot/src/share/vm/memory/referenceProcessor.hpp index e11f9564509..cbdfdd0b8fe 100644 --- a/hotspot/src/share/vm/memory/referenceProcessor.hpp +++ b/hotspot/src/share/vm/memory/referenceProcessor.hpp @@ -54,6 +54,14 @@ class ReferenceProcessor : public CHeapObj { bool _discovery_is_atomic; // if discovery is atomic wrt // other collectors in configuration bool _discovery_is_mt; // true if reference discovery is MT. + // If true, setting "next" field of a discovered refs list requires + // write barrier(s). (Must be true if used in a collector in which + // elements of a discovered list may be moved during discovery: for + // example, a collector like Garbage-First that moves objects during a + // long-term concurrent marking phase that does weak reference + // discovery.) + bool _discovered_list_needs_barrier; + BarrierSet* _bs; // Cached copy of BarrierSet. bool _enqueuing_is_done; // true if all weak references enqueued bool _processing_is_mt; // true during phases when // reference processing is MT. @@ -196,7 +204,6 @@ class ReferenceProcessor : public CHeapObj { void verify_ok_to_handle_reflists() PRODUCT_RETURN; void abandon_partial_discovered_list(DiscoveredList& refs_list); - void abandon_partial_discovered_list_arr(DiscoveredList refs_lists[]); // Calculate the number of jni handles. unsigned int count_jni_refs(); @@ -217,6 +224,8 @@ class ReferenceProcessor : public CHeapObj { _discovery_is_atomic(true), _enqueuing_is_done(false), _discovery_is_mt(false), + _discovered_list_needs_barrier(false), + _bs(NULL), _is_alive_non_header(NULL), _num_q(0), _processing_is_mt(false), @@ -224,8 +233,10 @@ class ReferenceProcessor : public CHeapObj { {} ReferenceProcessor(MemRegion span, bool atomic_discovery, - bool mt_discovery, int mt_degree = 1, - bool mt_processing = false); + bool mt_discovery, + int mt_degree = 1, + bool mt_processing = false, + bool discovered_list_needs_barrier = false); // Allocates and initializes a reference processor. static ReferenceProcessor* create_ref_processor( @@ -234,8 +245,8 @@ class ReferenceProcessor : public CHeapObj { bool mt_discovery, BoolObjectClosure* is_alive_non_header = NULL, int parallel_gc_threads = 1, - bool mt_processing = false); - + bool mt_processing = false, + bool discovered_list_needs_barrier = false); // RefDiscoveryPolicy values enum { ReferenceBasedDiscovery = 0, @@ -296,6 +307,11 @@ class ReferenceProcessor : public CHeapObj { // Enqueue references at end of GC (called by the garbage collector) bool enqueue_discovered_references(AbstractRefProcTaskExecutor* task_executor = NULL); + // If a discovery is in process that is being superceded, abandon it: all + // the discovered lists will be empty, and all the objects on them will + // have NULL discovered fields. Must be called only at a safepoint. + void abandon_partial_discovery(); + // debugging void verify_no_references_recorded() PRODUCT_RETURN; static void verify(); diff --git a/hotspot/src/share/vm/memory/sharedHeap.cpp b/hotspot/src/share/vm/memory/sharedHeap.cpp index 015f9807a06..cf5ef796185 100644 --- a/hotspot/src/share/vm/memory/sharedHeap.cpp +++ b/hotspot/src/share/vm/memory/sharedHeap.cpp @@ -57,15 +57,24 @@ SharedHeap::SharedHeap(CollectorPolicy* policy_) : } _sh = this; // ch is static, should be set only once. if ((UseParNewGC || - (UseConcMarkSweepGC && CMSParallelRemarkEnabled)) && + (UseConcMarkSweepGC && CMSParallelRemarkEnabled) || + UseG1GC) && ParallelGCThreads > 0) { - _workers = new WorkGang("Parallel GC Threads", ParallelGCThreads, true); + _workers = new WorkGang("Parallel GC Threads", ParallelGCThreads, + /* are_GC_task_threads */true, + /* are_ConcurrentGC_threads */false); if (_workers == NULL) { vm_exit_during_initialization("Failed necessary allocation."); } } } +bool SharedHeap::heap_lock_held_for_gc() { + Thread* t = Thread::current(); + return Heap_lock->owned_by_self() + || ( (t->is_GC_task_thread() || t->is_VM_thread()) + && _thread_holds_heap_lock_for_gc); +} void SharedHeap::set_par_threads(int t) { _n_par_threads = t; @@ -280,10 +289,11 @@ void SharedHeap::fill_region_with_object(MemRegion mr) { } // Some utilities. -void SharedHeap::print_size_transition(size_t bytes_before, +void SharedHeap::print_size_transition(outputStream* out, + size_t bytes_before, size_t bytes_after, size_t capacity) { - tty->print(" %d%s->%d%s(%d%s)", + out->print(" %d%s->%d%s(%d%s)", byte_size_in_proper_unit(bytes_before), proper_unit_for_byte_size(bytes_before), byte_size_in_proper_unit(bytes_after), diff --git a/hotspot/src/share/vm/memory/sharedHeap.hpp b/hotspot/src/share/vm/memory/sharedHeap.hpp index caf9e171f7a..662f011c7ab 100644 --- a/hotspot/src/share/vm/memory/sharedHeap.hpp +++ b/hotspot/src/share/vm/memory/sharedHeap.hpp @@ -44,6 +44,9 @@ class KlassHandle; class SharedHeap : public CollectedHeap { friend class VMStructs; + friend class VM_GC_Operation; + friend class VM_CGC_Operation; + private: // For claiming strong_roots tasks. SubTasksDone* _process_strong_tasks; @@ -82,6 +85,14 @@ protected: // function. SharedHeap(CollectorPolicy* policy_); + // Returns true if the calling thread holds the heap lock, + // or the calling thread is a par gc thread and the heap_lock is held + // by the vm thread doing a gc operation. + bool heap_lock_held_for_gc(); + // True if the heap_lock is held by the a non-gc thread invoking a gc + // operation. + bool _thread_holds_heap_lock_for_gc; + public: static SharedHeap* heap() { return _sh; } @@ -97,8 +108,8 @@ public: void set_perm(PermGen* perm_gen) { _perm_gen = perm_gen; } - // A helper function that fills an allocated-but-not-yet-initialized - // region with a garbage object. + // A helper function that fills a region of the heap with + // with a single object. static void fill_region_with_object(MemRegion mr); // Minimum garbage fill object size @@ -214,13 +225,12 @@ public: // "SharedHeap" can use in the implementation of its virtual // functions. -protected: +public: // Do anything common to GC's. virtual void gc_prologue(bool full) = 0; virtual void gc_epilogue(bool full) = 0; -public: // // New methods from CollectedHeap // @@ -266,7 +276,8 @@ public: } // Some utilities. - void print_size_transition(size_t bytes_before, + void print_size_transition(outputStream* out, + size_t bytes_before, size_t bytes_after, size_t capacity); }; diff --git a/hotspot/src/share/vm/memory/space.cpp b/hotspot/src/share/vm/memory/space.cpp index eeab52e60a0..b69ed53a1a8 100644 --- a/hotspot/src/share/vm/memory/space.cpp +++ b/hotspot/src/share/vm/memory/space.cpp @@ -105,7 +105,7 @@ void DirtyCardToOopClosure::do_MemRegion(MemRegion mr) { "Only ones we deal with for now."); assert(_precision != CardTableModRefBS::ObjHeadPreciseArray || - _last_bottom == NULL || + _cl->idempotent() || _last_bottom == NULL || top <= _last_bottom, "Not decreasing"); NOT_PRODUCT(_last_bottom = mr.start()); @@ -144,7 +144,14 @@ void DirtyCardToOopClosure::do_MemRegion(MemRegion mr) { walk_mem_region(mr, bottom_obj, top); } - _min_done = bottom; + // An idempotent closure might be applied in any order, so we don't + // record a _min_done for it. + if (!_cl->idempotent()) { + _min_done = bottom; + } else { + assert(_min_done == _last_explicit_min_done, + "Don't update _min_done for idempotent cl"); + } } DirtyCardToOopClosure* Space::new_dcto_cl(OopClosure* cl, @@ -232,13 +239,17 @@ ContiguousSpace::new_dcto_cl(OopClosure* cl, return new ContiguousSpaceDCTOC(this, cl, precision, boundary); } -void Space::initialize(MemRegion mr, bool clear_space) { +void Space::set_bounds(MemRegion mr) { HeapWord* bottom = mr.start(); HeapWord* end = mr.end(); assert(Universe::on_page_boundary(bottom) && Universe::on_page_boundary(end), "invalid space boundaries"); set_bottom(bottom); set_end(end); +} + +void Space::initialize(MemRegion mr, bool clear_space) { + set_bounds(mr); if (clear_space) clear(); } @@ -246,20 +257,35 @@ void Space::clear() { if (ZapUnusedHeapArea) mangle_unused_area(); } -void ContiguousSpace::initialize(MemRegion mr, bool clear_space) -{ - CompactibleSpace::initialize(mr, clear_space); - _concurrent_iteration_safe_limit = top(); +void CompactibleSpace::initialize(MemRegion mr, bool clear_space) { + Space::initialize(mr, false); // We'll do the clearing if there's + // clearing to be done. + _compaction_top = bottom(); + _next_compaction_space = NULL; + if (clear_space) clear(); +} + +void CompactibleSpace::clear() { + _compaction_top = bottom(); + Space::clear(); +} + +void ContiguousSpace::initialize(MemRegion mr, bool clear_space) { + CompactibleSpace::initialize(mr, false); // We'll do the clearing if there's + // clearing to be done. + set_top(bottom()); + set_saved_mark(); + if (clear_space) clear(); } void ContiguousSpace::clear() { set_top(bottom()); set_saved_mark(); - Space::clear(); + CompactibleSpace::clear(); } bool Space::is_in(const void* p) const { - HeapWord* b = block_start(p); + HeapWord* b = block_start_const(p); return b != NULL && block_is_obj(b); } @@ -271,8 +297,17 @@ bool ContiguousSpace::is_free_block(const HeapWord* p) const { return p >= _top; } +void OffsetTableContigSpace::initialize(MemRegion mr, bool clear_space) { + // false ==> we'll do the clearing if there's clearing to be done. + ContiguousSpace::initialize(mr, false); + _offsets.zero_bottom_entry(); + _offsets.initialize_threshold(); + if (clear_space) clear(); +} + void OffsetTableContigSpace::clear() { ContiguousSpace::clear(); + _offsets.zero_bottom_entry(); _offsets.initialize_threshold(); } @@ -297,12 +332,6 @@ void ContiguousSpace::mangle_region(MemRegion mr) { debug_only(Copy::fill_to_words(mr.start(), mr.word_size(), badHeapWord)); } -void CompactibleSpace::initialize(MemRegion mr, bool clear_space) { - Space::initialize(mr, clear_space); - _compaction_top = bottom(); - _next_compaction_space = NULL; -} - HeapWord* CompactibleSpace::forward(oop q, size_t size, CompactPoint* cp, HeapWord* compact_top) { // q is alive @@ -477,8 +506,8 @@ void ContiguousSpace::verify(bool allow_dirty) const { } guarantee(p == top(), "end of last object must match end of space"); if (top() != end()) { - guarantee(top() == block_start(end()-1) && - top() == block_start(top()), + guarantee(top() == block_start_const(end()-1) && + top() == block_start_const(top()), "top should be start of unallocated block, if it exists"); } } @@ -710,7 +739,7 @@ ALL_SINCE_SAVE_MARKS_CLOSURES(ContigSpace_OOP_SINCE_SAVE_MARKS_DEFN) #undef ContigSpace_OOP_SINCE_SAVE_MARKS_DEFN // Very general, slow implementation. -HeapWord* ContiguousSpace::block_start(const void* p) const { +HeapWord* ContiguousSpace::block_start_const(const void* p) const { assert(MemRegion(bottom(), end()).contains(p), "p not in space"); if (p >= top()) { return top(); @@ -913,7 +942,8 @@ void OffsetTableContigSpace::verify(bool allow_dirty) const { // For a sampling of objects in the space, find it using the // block offset table. if (blocks == BLOCK_SAMPLE_INTERVAL) { - guarantee(p == block_start(p + (size/2)), "check offset computation"); + guarantee(p == block_start_const(p + (size/2)), + "check offset computation"); blocks = 0; } else { blocks++; diff --git a/hotspot/src/share/vm/memory/space.hpp b/hotspot/src/share/vm/memory/space.hpp index 37f726e5b3f..a45490a595b 100644 --- a/hotspot/src/share/vm/memory/space.hpp +++ b/hotspot/src/share/vm/memory/space.hpp @@ -105,7 +105,7 @@ class Space: public CHeapObj { virtual void set_bottom(HeapWord* value) { _bottom = value; } virtual void set_end(HeapWord* value) { _end = value; } - HeapWord* saved_mark_word() const { return _saved_mark_word; } + virtual HeapWord* saved_mark_word() const { return _saved_mark_word; } void set_saved_mark_word(HeapWord* p) { _saved_mark_word = p; } MemRegionClosure* preconsumptionDirtyCardClosure() const { @@ -131,8 +131,18 @@ class Space: public CHeapObj { return MemRegion(bottom(), saved_mark_word()); } - // Initialization + // Initialization. + // "initialize" should be called once on a space, before it is used for + // any purpose. The "mr" arguments gives the bounds of the space, and + // the "clear_space" argument should be true unless the memory in "mr" is + // known to be zeroed. virtual void initialize(MemRegion mr, bool clear_space); + + // Sets the bounds (bottom and end) of the current space to those of "mr." + void set_bounds(MemRegion mr); + + // The "clear" method must be called on a region that may have + // had allocation performed in it, but is now to be considered empty. virtual void clear(); // For detecting GC bugs. Should only be called at GC boundaries, since @@ -216,7 +226,13 @@ class Space: public CHeapObj { // "block" that contains "p". We say "block" instead of "object" since // some heaps may not pack objects densely; a chunk may either be an // object or a non-object. If "p" is not in the space, return NULL. - virtual HeapWord* block_start(const void* p) const = 0; + virtual HeapWord* block_start_const(const void* p) const = 0; + + // The non-const version may have benevolent side effects on the data + // structure supporting these calls, possibly speeding up future calls. + // The default implementation, however, is simply to call the const + // version. + inline virtual HeapWord* block_start(const void* p); // Requires "addr" to be the start of a chunk, and returns its size. // "addr + size" is required to be the start of a new chunk, or the end @@ -282,12 +298,13 @@ protected: CardTableModRefBS::PrecisionStyle _precision; HeapWord* _boundary; // If non-NULL, process only non-NULL oops // pointing below boundary. - HeapWord* _min_done; // ObjHeadPreciseArray precision requires + HeapWord* _min_done; // ObjHeadPreciseArray precision requires // a downwards traversal; this is the // lowest location already done (or, // alternatively, the lowest address that // shouldn't be done again. NULL means infinity.) NOT_PRODUCT(HeapWord* _last_bottom;) + NOT_PRODUCT(HeapWord* _last_explicit_min_done;) // Get the actual top of the area on which the closure will // operate, given where the top is assumed to be (the end of the @@ -311,13 +328,15 @@ public: HeapWord* boundary) : _sp(sp), _cl(cl), _precision(precision), _boundary(boundary), _min_done(NULL) { - NOT_PRODUCT(_last_bottom = NULL;) + NOT_PRODUCT(_last_bottom = NULL); + NOT_PRODUCT(_last_explicit_min_done = NULL); } void do_MemRegion(MemRegion mr); void set_min_done(HeapWord* min_done) { _min_done = min_done; + NOT_PRODUCT(_last_explicit_min_done = _min_done); } #ifndef PRODUCT void set_last_bottom(HeapWord* last_bottom) { @@ -355,6 +374,7 @@ private: public: virtual void initialize(MemRegion mr, bool clear_space); + virtual void clear(); // Used temporarily during a compaction phase to hold the value // top should have when compaction is complete. @@ -511,7 +531,7 @@ protected: /* prefetch beyond q */ \ Prefetch::write(q, interval); \ /* size_t size = oop(q)->size(); changing this for cms for perm gen */\ - size_t size = block_size(q); \ + size_t size = block_size(q); \ compact_top = cp->space->forward(oop(q), size, cp, compact_top); \ q += size; \ end_of_live = q; \ @@ -575,68 +595,68 @@ protected: cp->space->set_compaction_top(compact_top); \ } -#define SCAN_AND_ADJUST_POINTERS(adjust_obj_size) { \ - /* adjust all the interior pointers to point at the new locations of objects \ - * Used by MarkSweep::mark_sweep_phase3() */ \ +#define SCAN_AND_ADJUST_POINTERS(adjust_obj_size) { \ + /* adjust all the interior pointers to point at the new locations of objects \ + * Used by MarkSweep::mark_sweep_phase3() */ \ \ - HeapWord* q = bottom(); \ - HeapWord* t = _end_of_live; /* Established by "prepare_for_compaction". */ \ + HeapWord* q = bottom(); \ + HeapWord* t = _end_of_live; /* Established by "prepare_for_compaction". */ \ \ - assert(_first_dead <= _end_of_live, "Stands to reason, no?"); \ + assert(_first_dead <= _end_of_live, "Stands to reason, no?"); \ \ - if (q < t && _first_dead > q && \ + if (q < t && _first_dead > q && \ !oop(q)->is_gc_marked()) { \ /* we have a chunk of the space which hasn't moved and we've \ * reinitialized the mark word during the previous pass, so we can't \ - * use is_gc_marked for the traversal. */ \ + * use is_gc_marked for the traversal. */ \ HeapWord* end = _first_dead; \ \ - while (q < end) { \ - /* I originally tried to conjoin "block_start(q) == q" to the \ - * assertion below, but that doesn't work, because you can't \ - * accurately traverse previous objects to get to the current one \ - * after their pointers (including pointers into permGen) have been \ - * updated, until the actual compaction is done. dld, 4/00 */ \ - assert(block_is_obj(q), \ - "should be at block boundaries, and should be looking at objs"); \ + while (q < end) { \ + /* I originally tried to conjoin "block_start(q) == q" to the \ + * assertion below, but that doesn't work, because you can't \ + * accurately traverse previous objects to get to the current one \ + * after their pointers (including pointers into permGen) have been \ + * updated, until the actual compaction is done. dld, 4/00 */ \ + assert(block_is_obj(q), \ + "should be at block boundaries, and should be looking at objs"); \ \ VALIDATE_MARK_SWEEP_ONLY(MarkSweep::track_interior_pointers(oop(q))); \ \ - /* point all the oops to the new location */ \ - size_t size = oop(q)->adjust_pointers(); \ - size = adjust_obj_size(size); \ + /* point all the oops to the new location */ \ + size_t size = oop(q)->adjust_pointers(); \ + size = adjust_obj_size(size); \ \ VALIDATE_MARK_SWEEP_ONLY(MarkSweep::check_interior_pointers()); \ - \ - VALIDATE_MARK_SWEEP_ONLY(MarkSweep::validate_live_oop(oop(q), size)); \ - \ - q += size; \ - } \ \ - if (_first_dead == t) { \ - q = t; \ - } else { \ - /* $$$ This is funky. Using this to read the previously written \ - * LiveRange. See also use below. */ \ + VALIDATE_MARK_SWEEP_ONLY(MarkSweep::validate_live_oop(oop(q), size)); \ + \ + q += size; \ + } \ + \ + if (_first_dead == t) { \ + q = t; \ + } else { \ + /* $$$ This is funky. Using this to read the previously written \ + * LiveRange. See also use below. */ \ q = (HeapWord*)oop(_first_dead)->mark()->decode_pointer(); \ - } \ - } \ + } \ + } \ \ const intx interval = PrefetchScanIntervalInBytes; \ \ - debug_only(HeapWord* prev_q = NULL); \ - while (q < t) { \ - /* prefetch beyond q */ \ + debug_only(HeapWord* prev_q = NULL); \ + while (q < t) { \ + /* prefetch beyond q */ \ Prefetch::write(q, interval); \ - if (oop(q)->is_gc_marked()) { \ - /* q is alive */ \ + if (oop(q)->is_gc_marked()) { \ + /* q is alive */ \ VALIDATE_MARK_SWEEP_ONLY(MarkSweep::track_interior_pointers(oop(q))); \ - /* point all the oops to the new location */ \ - size_t size = oop(q)->adjust_pointers(); \ - size = adjust_obj_size(size); \ - VALIDATE_MARK_SWEEP_ONLY(MarkSweep::check_interior_pointers()); \ + /* point all the oops to the new location */ \ + size_t size = oop(q)->adjust_pointers(); \ + size = adjust_obj_size(size); \ + VALIDATE_MARK_SWEEP_ONLY(MarkSweep::check_interior_pointers()); \ VALIDATE_MARK_SWEEP_ONLY(MarkSweep::validate_live_oop(oop(q), size)); \ - debug_only(prev_q = q); \ + debug_only(prev_q = q); \ q += size; \ } else { \ /* q is not a live object, so its mark should point at the next \ @@ -716,6 +736,8 @@ protected: } \ } \ \ + /* Let's remember if we were empty before we did the compaction. */ \ + bool was_empty = used_region().is_empty(); \ /* Reset space after compaction is complete */ \ reset_after_compaction(); \ /* We do this clear, below, since it has overloaded meanings for some */ \ @@ -723,8 +745,8 @@ protected: /* compacted into will have had their offset table thresholds updated */ \ /* continuously, but those that weren't need to have their thresholds */ \ /* re-initialized. Also mangles unused area for debugging. */ \ - if (is_empty()) { \ - clear(); \ + if (used_region().is_empty()) { \ + if (!was_empty) clear(); \ } else { \ if (ZapUnusedHeapArea) mangle_unused_area(); \ } \ @@ -750,8 +772,8 @@ class ContiguousSpace: public CompactibleSpace { HeapWord* top() const { return _top; } void set_top(HeapWord* value) { _top = value; } - void set_saved_mark() { _saved_mark_word = top(); } - void reset_saved_mark() { _saved_mark_word = bottom(); } + virtual void set_saved_mark() { _saved_mark_word = top(); } + void reset_saved_mark() { _saved_mark_word = bottom(); } virtual void clear(); @@ -843,7 +865,7 @@ class ContiguousSpace: public CompactibleSpace { virtual void object_iterate_from(WaterMark mark, ObjectClosure* blk); // Very inefficient implementation. - virtual HeapWord* block_start(const void* p) const; + virtual HeapWord* block_start_const(const void* p) const; size_t block_size(const HeapWord* p) const; // If a block is in the allocated area, it is an object. bool block_is_obj(const HeapWord* p) const { return p < top(); } @@ -1000,9 +1022,10 @@ class OffsetTableContigSpace: public ContiguousSpace { void set_bottom(HeapWord* value); void set_end(HeapWord* value); + virtual void initialize(MemRegion mr, bool clear_space); void clear(); - inline HeapWord* block_start(const void* p) const; + inline HeapWord* block_start_const(const void* p) const; // Add offset table update. virtual inline HeapWord* allocate(size_t word_size); diff --git a/hotspot/src/share/vm/memory/space.inline.hpp b/hotspot/src/share/vm/memory/space.inline.hpp index 6ca9bf2b1a0..c63d0c68cc7 100644 --- a/hotspot/src/share/vm/memory/space.inline.hpp +++ b/hotspot/src/share/vm/memory/space.inline.hpp @@ -22,6 +22,10 @@ * */ +inline HeapWord* Space::block_start(const void* p) { + return block_start_const(p); +} + inline HeapWord* OffsetTableContigSpace::allocate(size_t size) { HeapWord* res = ContiguousSpace::allocate(size); if (res != NULL) { @@ -50,7 +54,8 @@ inline HeapWord* OffsetTableContigSpace::par_allocate(size_t size) { return res; } -inline HeapWord* OffsetTableContigSpace::block_start(const void* p) const { +inline HeapWord* +OffsetTableContigSpace::block_start_const(const void* p) const { return _offsets.block_start(p); } diff --git a/hotspot/src/share/vm/memory/specialized_oop_closures.hpp b/hotspot/src/share/vm/memory/specialized_oop_closures.hpp index 9a3e774e74d..cf5062033c8 100644 --- a/hotspot/src/share/vm/memory/specialized_oop_closures.hpp +++ b/hotspot/src/share/vm/memory/specialized_oop_closures.hpp @@ -59,6 +59,12 @@ class CMSInnerParMarkAndPushClosure; // This is split into several because of a Visual C++ 6.0 compiler bug // where very long macros cause the compiler to crash +// Some other heap might define further specialized closures. +#ifndef FURTHER_SPECIALIZED_OOP_OOP_ITERATE_CLOSURES +#define FURTHER_SPECIALIZED_OOP_OOP_ITERATE_CLOSURES(f) \ + /* None */ +#endif + #define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_S(f) \ f(ScanClosure,_nv) \ f(FastScanClosure,_nv) \ @@ -77,7 +83,7 @@ class CMSInnerParMarkAndPushClosure; SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_P(f) #ifndef SERIALGC -#define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_3(f) \ +#define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(f) \ f(MarkRefsIntoAndScanClosure,_nv) \ f(Par_MarkRefsIntoAndScanClosure,_nv) \ f(PushAndMarkClosure,_nv) \ @@ -85,11 +91,13 @@ class CMSInnerParMarkAndPushClosure; f(PushOrMarkClosure,_nv) \ f(Par_PushOrMarkClosure,_nv) \ f(CMSKeepAliveClosure,_nv) \ - f(CMSInnerParMarkAndPushClosure,_nv) + f(CMSInnerParMarkAndPushClosure,_nv) \ + FURTHER_SPECIALIZED_OOP_OOP_ITERATE_CLOSURES(f) #else // SERIALGC -#define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_3(f) +#define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(f) #endif // SERIALGC + // We separate these out, because sometime the general one has // a different definition from the specialized ones, and sometimes it // doesn't. @@ -98,8 +106,8 @@ class CMSInnerParMarkAndPushClosure; f(OopClosure,_v) \ SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_1(f) -#define ALL_OOP_OOP_ITERATE_CLOSURES_3(f) \ - SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_3(f) +#define ALL_OOP_OOP_ITERATE_CLOSURES_2(f) \ + SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(f) #ifndef SERIALGC // This macro applies an argument macro to all OopClosures for which we @@ -125,6 +133,13 @@ class CMSInnerParMarkAndPushClosure; // The "root_class" is the most general class to define; this may be // "OopClosure" in some applications and "OopsInGenClosure" in others. + +// Some other heap might define further specialized closures. +#ifndef FURTHER_SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES +#define FURTHER_SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(f) \ + /* None */ +#endif + #define SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES_YOUNG_S(f) \ f(ScanClosure,_nv) \ f(FastScanClosure,_nv) @@ -132,7 +147,8 @@ class CMSInnerParMarkAndPushClosure; #ifndef SERIALGC #define SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES_YOUNG_P(f) \ f(ParScanWithBarrierClosure,_nv) \ - f(ParScanWithoutBarrierClosure,_nv) + f(ParScanWithoutBarrierClosure,_nv) \ + FURTHER_SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(f) #else // SERIALGC #define SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES_YOUNG_P(f) #endif // SERIALGC @@ -179,13 +195,15 @@ public: #if ENABLE_SPECIALIZATION_STATS private: - static int _numCallsAll; + static bool _init; + static bool _wrapped; + static jint _numCallsAll; - static int _numCallsTotal[NUM_Kinds]; - static int _numCalls_nv[NUM_Kinds]; + static jint _numCallsTotal[NUM_Kinds]; + static jint _numCalls_nv[NUM_Kinds]; - static int _numDoOopCallsTotal[NUM_Kinds]; - static int _numDoOopCalls_nv[NUM_Kinds]; + static jint _numDoOopCallsTotal[NUM_Kinds]; + static jint _numDoOopCalls_nv[NUM_Kinds]; public: #endif static void clear() PRODUCT_RETURN; @@ -203,22 +221,22 @@ public: #if ENABLE_SPECIALIZATION_STATS inline void SpecializationStats::record_call() { - _numCallsAll++;; + Atomic::inc(&_numCallsAll); } inline void SpecializationStats::record_iterate_call_v(Kind k) { - _numCallsTotal[k]++; + Atomic::inc(&_numCallsTotal[k]); } inline void SpecializationStats::record_iterate_call_nv(Kind k) { - _numCallsTotal[k]++; - _numCalls_nv[k]++; + Atomic::inc(&_numCallsTotal[k]); + Atomic::inc(&_numCalls_nv[k]); } inline void SpecializationStats::record_do_oop_call_v(Kind k) { - _numDoOopCallsTotal[k]++; + Atomic::inc(&_numDoOopCallsTotal[k]); } inline void SpecializationStats::record_do_oop_call_nv(Kind k) { - _numDoOopCallsTotal[k]++; - _numDoOopCalls_nv[k]++; + Atomic::inc(&_numDoOopCallsTotal[k]); + Atomic::inc(&_numDoOopCalls_nv[k]); } #else // !ENABLE_SPECIALIZATION_STATS diff --git a/hotspot/src/share/vm/memory/universe.cpp b/hotspot/src/share/vm/memory/universe.cpp index d69016370ad..2668b267c6a 100644 --- a/hotspot/src/share/vm/memory/universe.cpp +++ b/hotspot/src/share/vm/memory/universe.cpp @@ -734,6 +734,15 @@ jint Universe::initialize_heap() { fatal("UseParallelGC not supported in java kernel vm."); #endif // SERIALGC + } else if (UseG1GC) { +#ifndef SERIALGC + G1CollectorPolicy* g1p = new G1CollectorPolicy_BestRegionsFirst(); + G1CollectedHeap* g1h = new G1CollectedHeap(g1p); + Universe::_collectedHeap = g1h; +#else // SERIALGC + fatal("UseG1GC not supported in java kernel vm."); +#endif // SERIALGC + } else { GenCollectorPolicy *gc_policy; @@ -933,7 +942,10 @@ bool universe_post_init() { // This needs to be done before the first scavenge/gc, since // it's an input to soft ref clearing policy. - Universe::update_heap_info_at_gc(); + { + MutexLocker x(Heap_lock); + Universe::update_heap_info_at_gc(); + } // ("weak") refs processing infrastructure initialization Universe::heap()->post_initialize(); @@ -1189,10 +1201,11 @@ uintptr_t Universe::verify_klass_mask() { // ???: What if a CollectedHeap doesn't have a permanent generation? ShouldNotReachHere(); break; - case CollectedHeap::GenCollectedHeap: { - GenCollectedHeap* gch = (GenCollectedHeap*) Universe::heap(); - permanent_reserved = gch->perm_gen()->reserved(); - break; + case CollectedHeap::GenCollectedHeap: + case CollectedHeap::G1CollectedHeap: { + SharedHeap* sh = (SharedHeap*) Universe::heap(); + permanent_reserved = sh->perm_gen()->reserved(); + break; } #ifndef SERIALGC case CollectedHeap::ParallelScavengeHeap: { diff --git a/hotspot/src/share/vm/oops/generateOopMap.cpp b/hotspot/src/share/vm/oops/generateOopMap.cpp index bff8ccbecf4..4a9741c0fc8 100644 --- a/hotspot/src/share/vm/oops/generateOopMap.cpp +++ b/hotspot/src/share/vm/oops/generateOopMap.cpp @@ -370,21 +370,8 @@ void CellTypeState::print(outputStream *os) { void GenerateOopMap ::initialize_bb() { _gc_points = 0; _bb_count = 0; - int size = binsToHold(method()->code_size()); - _bb_hdr_bits = NEW_RESOURCE_ARRAY(uintptr_t,size); - memset(_bb_hdr_bits, 0, size*sizeof(uintptr_t)); -} - -void GenerateOopMap ::set_bbmark_bit(int bci) { - int idx = bci >> LogBitsPerWord; - uintptr_t bit = (uintptr_t)1 << (bci & (BitsPerWord-1)); - _bb_hdr_bits[idx] |= bit; -} - -void GenerateOopMap ::clear_bbmark_bit(int bci) { - int idx = bci >> LogBitsPerWord; - uintptr_t bit = (uintptr_t)1 << (bci & (BitsPerWord-1)); - _bb_hdr_bits[idx] &= (~bit); + _bb_hdr_bits.clear(); + _bb_hdr_bits.resize(method()->code_size()); } void GenerateOopMap::bb_mark_fct(GenerateOopMap *c, int bci, int *data) { @@ -952,6 +939,17 @@ void GenerateOopMap::init_basic_blocks() { _basic_blocks[bbNo-1]._end_bci = prev_bci; + // Check that the correct number of basicblocks was found + if (bbNo !=_bb_count) { + if (bbNo < _bb_count) { + verify_error("jump into the middle of instruction?"); + return; + } else { + verify_error("extra basic blocks - should not happen?"); + return; + } + } + _max_monitors = monitor_count; // Now that we have a bound on the depth of the monitor stack, we can @@ -985,17 +983,6 @@ void GenerateOopMap::init_basic_blocks() { } #endif - // Check that the correct number of basicblocks was found - if (bbNo !=_bb_count) { - if (bbNo < _bb_count) { - verify_error("jump into the middle of instruction?"); - return; - } else { - verify_error("extra basic blocks - should not happen?"); - return; - } - } - // Mark all alive blocks mark_reachable_code(); } @@ -1022,21 +1009,22 @@ void GenerateOopMap::update_basic_blocks(int bci, int delta, int new_method_size) { assert(new_method_size >= method()->code_size() + delta, "new method size is too small"); - int newWords = binsToHold(new_method_size); - uintptr_t * new_bb_hdr_bits = NEW_RESOURCE_ARRAY(uintptr_t, newWords); + BitMap::bm_word_t* new_bb_hdr_bits = + NEW_RESOURCE_ARRAY(BitMap::bm_word_t, + BitMap::word_align_up(new_method_size)); + _bb_hdr_bits.set_map(new_bb_hdr_bits); + _bb_hdr_bits.set_size(new_method_size); + _bb_hdr_bits.clear(); - BitMap bb_bits(new_bb_hdr_bits, new_method_size); - bb_bits.clear(); for(int k = 0; k < _bb_count; k++) { if (_basic_blocks[k]._bci > bci) { _basic_blocks[k]._bci += delta; _basic_blocks[k]._end_bci += delta; } - bb_bits.at_put(_basic_blocks[k]._bci, true); + _bb_hdr_bits.at_put(_basic_blocks[k]._bci, true); } - _bb_hdr_bits = new_bb_hdr_bits ; } // diff --git a/hotspot/src/share/vm/oops/generateOopMap.hpp b/hotspot/src/share/vm/oops/generateOopMap.hpp index f29982b3abf..432902ef362 100644 --- a/hotspot/src/share/vm/oops/generateOopMap.hpp +++ b/hotspot/src/share/vm/oops/generateOopMap.hpp @@ -341,16 +341,22 @@ class GenerateOopMap VALUE_OBJ_CLASS_SPEC { BasicBlock * _basic_blocks; // Array of basicblock info int _gc_points; int _bb_count; - uintptr_t * _bb_hdr_bits; + BitMap _bb_hdr_bits; // Basicblocks methods void initialize_bb (); void mark_bbheaders_and_count_gc_points(); - bool is_bb_header (int bci) const { return (_bb_hdr_bits[bci >> LogBitsPerWord] & ((uintptr_t)1 << (bci & (BitsPerWord-1)))) != 0; } + bool is_bb_header (int bci) const { + return _bb_hdr_bits.at(bci); + } int gc_points () const { return _gc_points; } int bb_count () const { return _bb_count; } - void set_bbmark_bit (int bci); - void clear_bbmark_bit (int bci); + void set_bbmark_bit (int bci) { + _bb_hdr_bits.at_put(bci, true); + } + void clear_bbmark_bit (int bci) { + _bb_hdr_bits.at_put(bci, false); + } BasicBlock * get_basic_block_at (int bci) const; BasicBlock * get_basic_block_containing (int bci) const; void interp_bb (BasicBlock *bb); diff --git a/hotspot/src/share/vm/oops/instanceKlass.cpp b/hotspot/src/share/vm/oops/instanceKlass.cpp index 2ce60748519..60652a0dd39 100644 --- a/hotspot/src/share/vm/oops/instanceKlass.cpp +++ b/hotspot/src/share/vm/oops/instanceKlass.cpp @@ -1515,10 +1515,9 @@ void instanceKlass::oop_follow_contents(ParCompactionManager* cm, // closure's do_header() method dicates whether the given closure should be // applied to the klass ptr in the object header. -#define InstanceKlass_OOP_OOP_ITERATE_DEFN(OopClosureType, nv_suffix) \ - \ -int instanceKlass::oop_oop_iterate##nv_suffix(oop obj, \ - OopClosureType* closure) {\ +#define InstanceKlass_OOP_OOP_ITERATE_DEFN(OopClosureType, nv_suffix) \ + \ +int instanceKlass::oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure) { \ SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::ik);\ /* header */ \ if (closure->do_header()) { \ @@ -1533,6 +1532,26 @@ int instanceKlass::oop_oop_iterate##nv_suffix(oop obj, \ return size_helper(); \ } +#ifndef SERIALGC +#define InstanceKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN(OopClosureType, nv_suffix) \ + \ +int instanceKlass::oop_oop_iterate_backwards##nv_suffix(oop obj, \ + OopClosureType* closure) { \ + SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::ik); \ + /* header */ \ + if (closure->do_header()) { \ + obj->oop_iterate_header(closure); \ + } \ + /* instance variables */ \ + InstanceKlass_OOP_MAP_REVERSE_ITERATE( \ + obj, \ + SpecializationStats::record_do_oop_call##nv_suffix(SpecializationStats::ik);\ + (closure)->do_oop##nv_suffix(p), \ + assert_is_in_closed_subset) \ + return size_helper(); \ +} +#endif // !SERIALGC + #define InstanceKlass_OOP_OOP_ITERATE_DEFN_m(OopClosureType, nv_suffix) \ \ int instanceKlass::oop_oop_iterate##nv_suffix##_m(oop obj, \ @@ -1550,9 +1569,13 @@ int instanceKlass::oop_oop_iterate##nv_suffix##_m(oop obj, \ } ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceKlass_OOP_OOP_ITERATE_DEFN) -ALL_OOP_OOP_ITERATE_CLOSURES_3(InstanceKlass_OOP_OOP_ITERATE_DEFN) +ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceKlass_OOP_OOP_ITERATE_DEFN) ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceKlass_OOP_OOP_ITERATE_DEFN_m) -ALL_OOP_OOP_ITERATE_CLOSURES_3(InstanceKlass_OOP_OOP_ITERATE_DEFN_m) +ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceKlass_OOP_OOP_ITERATE_DEFN_m) +#ifndef SERIALGC +ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN) +ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN) +#endif // !SERIALGC void instanceKlass::iterate_static_fields(OopClosure* closure) { InstanceKlass_OOP_ITERATE( \ diff --git a/hotspot/src/share/vm/oops/instanceKlass.hpp b/hotspot/src/share/vm/oops/instanceKlass.hpp index b7b71d930ff..421cd9a47bd 100644 --- a/hotspot/src/share/vm/oops/instanceKlass.hpp +++ b/hotspot/src/share/vm/oops/instanceKlass.hpp @@ -656,13 +656,21 @@ class instanceKlass: public Klass { return oop_oop_iterate_v_m(obj, blk, mr); } -#define InstanceKlass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \ - int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* blk); \ - int oop_oop_iterate##nv_suffix##_m(oop obj, OopClosureType* blk, \ +#define InstanceKlass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \ + int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* blk); \ + int oop_oop_iterate##nv_suffix##_m(oop obj, OopClosureType* blk, \ MemRegion mr); ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceKlass_OOP_OOP_ITERATE_DECL) - ALL_OOP_OOP_ITERATE_CLOSURES_3(InstanceKlass_OOP_OOP_ITERATE_DECL) + ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceKlass_OOP_OOP_ITERATE_DECL) + +#ifndef SERIALGC +#define InstanceKlass_OOP_OOP_ITERATE_BACKWARDS_DECL(OopClosureType, nv_suffix) \ + int oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* blk); + + ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceKlass_OOP_OOP_ITERATE_BACKWARDS_DECL) + ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceKlass_OOP_OOP_ITERATE_BACKWARDS_DECL) +#endif // !SERIALGC void iterate_static_fields(OopClosure* closure); void iterate_static_fields(OopClosure* closure, MemRegion mr); diff --git a/hotspot/src/share/vm/oops/instanceRefKlass.cpp b/hotspot/src/share/vm/oops/instanceRefKlass.cpp index 634a8c7fb9e..cb043808fec 100644 --- a/hotspot/src/share/vm/oops/instanceRefKlass.cpp +++ b/hotspot/src/share/vm/oops/instanceRefKlass.cpp @@ -176,6 +176,11 @@ int instanceRefKlass::oop_adjust_pointers(oop obj) { } #define InstanceRefKlass_SPECIALIZED_OOP_ITERATE(T, nv_suffix, contains) \ + if (closure->apply_to_weak_ref_discovered_field()) { \ + T* disc_addr = (T*)java_lang_ref_Reference::discovered_addr(obj); \ + closure->do_oop##nv_suffix(disc_addr); \ + } \ + \ T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj); \ oop referent = oopDesc::load_decode_heap_oop(referent_addr); \ if (referent != NULL && contains(referent_addr)) { \ @@ -219,6 +224,25 @@ oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure) { } \ } +#ifndef SERIALGC +#define InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN(OopClosureType, nv_suffix) \ + \ +int instanceRefKlass:: \ +oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* closure) { \ + /* Get size before changing pointers */ \ + SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);\ + \ + int size = instanceKlass::oop_oop_iterate_backwards##nv_suffix(obj, closure); \ + \ + if (UseCompressedOops) { \ + InstanceRefKlass_SPECIALIZED_OOP_ITERATE(narrowOop, nv_suffix, contains); \ + } else { \ + InstanceRefKlass_SPECIALIZED_OOP_ITERATE(oop, nv_suffix, contains); \ + } \ +} +#endif // !SERIALGC + + #define InstanceRefKlass_OOP_OOP_ITERATE_DEFN_m(OopClosureType, nv_suffix) \ \ int instanceRefKlass:: \ @@ -236,9 +260,13 @@ oop_oop_iterate##nv_suffix##_m(oop obj, } ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_DEFN) -ALL_OOP_OOP_ITERATE_CLOSURES_3(InstanceRefKlass_OOP_OOP_ITERATE_DEFN) +ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_DEFN) +#ifndef SERIALGC +ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN) +ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DEFN) +#endif // SERIALGC ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_DEFN_m) -ALL_OOP_OOP_ITERATE_CLOSURES_3(InstanceRefKlass_OOP_OOP_ITERATE_DEFN_m) +ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_DEFN_m) #ifndef SERIALGC template @@ -423,7 +451,7 @@ void instanceRefKlass::oop_verify_on(oop obj, outputStream* st) { // Verify next field oop next = java_lang_ref_Reference::next(obj); if (next != NULL) { - guarantee(next->is_oop(), "next field verify fa iled"); + guarantee(next->is_oop(), "next field verify failed"); guarantee(next->is_instanceRef(), "next field verify failed"); if (gch != NULL && !gch->is_in_youngest(obj)) { // We do a specific remembered set check here since the next field is diff --git a/hotspot/src/share/vm/oops/instanceRefKlass.hpp b/hotspot/src/share/vm/oops/instanceRefKlass.hpp index ed8b11998bc..501d8172677 100644 --- a/hotspot/src/share/vm/oops/instanceRefKlass.hpp +++ b/hotspot/src/share/vm/oops/instanceRefKlass.hpp @@ -72,7 +72,15 @@ class instanceRefKlass: public instanceKlass { int oop_oop_iterate##nv_suffix##_m(oop obj, OopClosureType* blk, MemRegion mr); ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_DECL) - ALL_OOP_OOP_ITERATE_CLOSURES_3(InstanceRefKlass_OOP_OOP_ITERATE_DECL) + ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_DECL) + +#ifndef SERIALGC +#define InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DECL(OopClosureType, nv_suffix) \ + int oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* blk); + + ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DECL) + ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DECL) +#endif // !SERIALGC static void release_and_notify_pending_list_lock(BasicLock *pending_list_basic_lock); static void acquire_pending_list_lock(BasicLock *pending_list_basic_lock); diff --git a/hotspot/src/share/vm/oops/klass.hpp b/hotspot/src/share/vm/oops/klass.hpp index d8aac3de60d..39f6b96e15a 100644 --- a/hotspot/src/share/vm/oops/klass.hpp +++ b/hotspot/src/share/vm/oops/klass.hpp @@ -134,14 +134,14 @@ class Klass_vtbl { // Every subclass on which vtbl_value is called must include this macro. // Delay the installation of the klassKlass pointer until after the // the vtable for a new klass has been installed (after the call to new()). -#define DEFINE_ALLOCATE_PERMANENT(thisKlass) \ +#define DEFINE_ALLOCATE_PERMANENT(thisKlass) \ void* allocate_permanent(KlassHandle& klass_klass, int size, TRAPS) const { \ - void* result = new(klass_klass, size, THREAD) thisKlass(); \ - if (HAS_PENDING_EXCEPTION) return NULL; \ - klassOop new_klass = ((Klass*) result)->as_klassOop(); \ - OrderAccess::storestore(); \ - post_new_init_klass(klass_klass, new_klass, size); \ - return result; \ + void* result = new(klass_klass, size, THREAD) thisKlass(); \ + if (HAS_PENDING_EXCEPTION) return NULL; \ + klassOop new_klass = ((Klass*) result)->as_klassOop(); \ + OrderAccess::storestore(); \ + post_new_init_klass(klass_klass, new_klass, size); \ + return result; \ } bool null_vtbl() { return *(intptr_t*)this == 0; } @@ -694,6 +694,14 @@ class Klass : public Klass_vtbl { return oop_oop_iterate(obj, blk); } +#ifndef SERIALGC + // In case we don't have a specialized backward scanner use forward + // iteration. + virtual int oop_oop_iterate_backwards_v(oop obj, OopClosure* blk) { + return oop_oop_iterate_v(obj, blk); + } +#endif // !SERIALGC + // Iterates "blk" over all the oops in "obj" (of type "this") within "mr". // (I don't see why the _m should be required, but without it the Solaris // C++ gives warning messages about overridings of the "oop_oop_iterate" @@ -722,7 +730,19 @@ class Klass : public Klass_vtbl { } SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_1(Klass_OOP_OOP_ITERATE_DECL) - SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_3(Klass_OOP_OOP_ITERATE_DECL) + SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(Klass_OOP_OOP_ITERATE_DECL) + +#ifndef SERIALGC +#define Klass_OOP_OOP_ITERATE_BACKWARDS_DECL(OopClosureType, nv_suffix) \ + virtual int oop_oop_iterate_backwards##nv_suffix(oop obj, \ + OopClosureType* blk) { \ + /* Default implementation reverts to general version. */ \ + return oop_oop_iterate_backwards_v(obj, blk); \ + } + + SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_1(Klass_OOP_OOP_ITERATE_BACKWARDS_DECL) + SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(Klass_OOP_OOP_ITERATE_BACKWARDS_DECL) +#endif // !SERIALGC virtual void array_klasses_do(void f(klassOop k)) {} virtual void with_array_klasses_do(void f(klassOop k)); diff --git a/hotspot/src/share/vm/oops/markOop.hpp b/hotspot/src/share/vm/oops/markOop.hpp index ac42fef74f2..c38355c7f36 100644 --- a/hotspot/src/share/vm/oops/markOop.hpp +++ b/hotspot/src/share/vm/oops/markOop.hpp @@ -216,11 +216,7 @@ class markOopDesc: public oopDesc { static markOop INFLATING() { return (markOop) 0; } // inflate-in-progress // Should this header be preserved during GC? - bool must_be_preserved(oop obj_containing_mark) const { - if (!UseBiasedLocking) - return (!is_unlocked() || !has_no_hash()); - return must_be_preserved_with_bias(obj_containing_mark); - } + inline bool must_be_preserved(oop obj_containing_mark) const; inline bool must_be_preserved_with_bias(oop obj_containing_mark) const; // Should this header (including its age bits) be preserved in the @@ -240,22 +236,14 @@ class markOopDesc: public oopDesc { // observation is that promotion failures are quite rare and // reducing the number of mark words preserved during them isn't a // high priority. - bool must_be_preserved_for_promotion_failure(oop obj_containing_mark) const { - if (!UseBiasedLocking) - return (this != prototype()); - return must_be_preserved_with_bias_for_promotion_failure(obj_containing_mark); - } + inline bool must_be_preserved_for_promotion_failure(oop obj_containing_mark) const; inline bool must_be_preserved_with_bias_for_promotion_failure(oop obj_containing_mark) const; // Should this header be preserved during a scavenge where CMS is // the old generation? // (This is basically the same body as must_be_preserved_for_promotion_failure(), // but takes the klassOop as argument instead) - bool must_be_preserved_for_cms_scavenge(klassOop klass_of_obj_containing_mark) const { - if (!UseBiasedLocking) - return (this != prototype()); - return must_be_preserved_with_bias_for_cms_scavenge(klass_of_obj_containing_mark); - } + inline bool must_be_preserved_for_cms_scavenge(klassOop klass_of_obj_containing_mark) const; inline bool must_be_preserved_with_bias_for_cms_scavenge(klassOop klass_of_obj_containing_mark) const; // WARNING: The following routines are used EXCLUSIVELY by diff --git a/hotspot/src/share/vm/oops/markOop.inline.hpp b/hotspot/src/share/vm/oops/markOop.inline.hpp index 46774b201d9..396c11e7549 100644 --- a/hotspot/src/share/vm/oops/markOop.inline.hpp +++ b/hotspot/src/share/vm/oops/markOop.inline.hpp @@ -39,6 +39,12 @@ inline bool markOopDesc::must_be_preserved_with_bias(oop obj_containing_mark) co return (!is_unlocked() || !has_no_hash()); } +inline bool markOopDesc::must_be_preserved(oop obj_containing_mark) const { + if (!UseBiasedLocking) + return (!is_unlocked() || !has_no_hash()); + return must_be_preserved_with_bias(obj_containing_mark); +} + // Should this header (including its age bits) be preserved in the // case of a promotion failure during scavenge? inline bool markOopDesc::must_be_preserved_with_bias_for_promotion_failure(oop obj_containing_mark) const { @@ -59,6 +65,13 @@ inline bool markOopDesc::must_be_preserved_with_bias_for_promotion_failure(oop o return (this != prototype()); } +inline bool markOopDesc::must_be_preserved_for_promotion_failure(oop obj_containing_mark) const { + if (!UseBiasedLocking) + return (this != prototype()); + return must_be_preserved_with_bias_for_promotion_failure(obj_containing_mark); +} + + // Should this header (including its age bits) be preserved in the // case of a scavenge in which CMS is the old generation? inline bool markOopDesc::must_be_preserved_with_bias_for_cms_scavenge(klassOop klass_of_obj_containing_mark) const { @@ -70,6 +83,11 @@ inline bool markOopDesc::must_be_preserved_with_bias_for_cms_scavenge(klassOop k } return (this != prototype()); } +inline bool markOopDesc::must_be_preserved_for_cms_scavenge(klassOop klass_of_obj_containing_mark) const { + if (!UseBiasedLocking) + return (this != prototype()); + return must_be_preserved_with_bias_for_cms_scavenge(klass_of_obj_containing_mark); +} inline markOop markOopDesc::prototype_for_object(oop obj) { #ifdef ASSERT diff --git a/hotspot/src/share/vm/oops/objArrayKlass.cpp b/hotspot/src/share/vm/oops/objArrayKlass.cpp index 193249bcf8e..c9838645ec8 100644 --- a/hotspot/src/share/vm/oops/objArrayKlass.cpp +++ b/hotspot/src/share/vm/oops/objArrayKlass.cpp @@ -86,14 +86,18 @@ template void objArrayKlass::do_copy(arrayOop s, T* src, const size_t word_len = objArrayOopDesc::array_size(length); - // For performance reasons, we assume we are using a card marking write - // barrier. The assert will fail if this is not the case. BarrierSet* bs = Universe::heap()->barrier_set(); + // For performance reasons, we assume we are that the write barrier we + // are using has optimized modes for arrays of references. At least one + // of the asserts below will fail if this is not the case. assert(bs->has_write_ref_array_opt(), "Barrier set must have ref array opt"); + assert(bs->has_write_ref_array_pre_opt(), "For pre-barrier as well."); + MemRegion dst_mr = MemRegion((HeapWord*)dst, word_len); if (s == d) { // since source and destination are equal we do not need conversion checks. assert(length > 0, "sanity check"); + bs->write_ref_array_pre(dst_mr); Copy::conjoint_oops_atomic(src, dst, length); } else { // We have to make sure all elements conform to the destination array @@ -101,6 +105,7 @@ template void objArrayKlass::do_copy(arrayOop s, T* src, klassOop stype = objArrayKlass::cast(s->klass())->element_klass(); if (stype == bound || Klass::cast(stype)->is_subtype_of(bound)) { // elements are guaranteed to be subtypes, so no check necessary + bs->write_ref_array_pre(dst_mr); Copy::conjoint_oops_atomic(src, dst, length); } else { // slow case: need individual subtype checks @@ -110,8 +115,13 @@ template void objArrayKlass::do_copy(arrayOop s, T* src, for (T* p = dst; from < end; from++, p++) { // XXX this is going to be slow. T element = *from; - if (oopDesc::is_null(element) || - Klass::cast(oopDesc::decode_heap_oop_not_null(element)->klass())->is_subtype_of(bound)) { + // even slower now + bool element_is_null = oopDesc::is_null(element); + oop new_val = element_is_null ? oop(NULL) + : oopDesc::decode_heap_oop_not_null(element); + if (element_is_null || + Klass::cast((new_val->klass()))->is_subtype_of(bound)) { + bs->write_ref_field_pre(p, new_val); *p = *from; } else { // We must do a barrier to cover the partial copy. @@ -401,11 +411,11 @@ int objArrayKlass::oop_oop_iterate_range##nv_suffix(oop obj, } ALL_OOP_OOP_ITERATE_CLOSURES_1(ObjArrayKlass_OOP_OOP_ITERATE_DEFN) -ALL_OOP_OOP_ITERATE_CLOSURES_3(ObjArrayKlass_OOP_OOP_ITERATE_DEFN) +ALL_OOP_OOP_ITERATE_CLOSURES_2(ObjArrayKlass_OOP_OOP_ITERATE_DEFN) ALL_OOP_OOP_ITERATE_CLOSURES_1(ObjArrayKlass_OOP_OOP_ITERATE_DEFN_m) -ALL_OOP_OOP_ITERATE_CLOSURES_3(ObjArrayKlass_OOP_OOP_ITERATE_DEFN_m) +ALL_OOP_OOP_ITERATE_CLOSURES_2(ObjArrayKlass_OOP_OOP_ITERATE_DEFN_m) ALL_OOP_OOP_ITERATE_CLOSURES_1(ObjArrayKlass_OOP_OOP_ITERATE_DEFN_r) -ALL_OOP_OOP_ITERATE_CLOSURES_3(ObjArrayKlass_OOP_OOP_ITERATE_DEFN_r) +ALL_OOP_OOP_ITERATE_CLOSURES_2(ObjArrayKlass_OOP_OOP_ITERATE_DEFN_r) int objArrayKlass::oop_adjust_pointers(oop obj) { assert(obj->is_objArray(), "obj must be obj array"); diff --git a/hotspot/src/share/vm/oops/objArrayKlass.hpp b/hotspot/src/share/vm/oops/objArrayKlass.hpp index 6fabe837bc8..d5d1b24fe5a 100644 --- a/hotspot/src/share/vm/oops/objArrayKlass.hpp +++ b/hotspot/src/share/vm/oops/objArrayKlass.hpp @@ -111,7 +111,7 @@ class objArrayKlass : public arrayKlass { int start, int end); ALL_OOP_OOP_ITERATE_CLOSURES_1(ObjArrayKlass_OOP_OOP_ITERATE_DECL) - ALL_OOP_OOP_ITERATE_CLOSURES_3(ObjArrayKlass_OOP_OOP_ITERATE_DECL) + ALL_OOP_OOP_ITERATE_CLOSURES_2(ObjArrayKlass_OOP_OOP_ITERATE_DECL) // JVM support jint compute_modifier_flags(TRAPS) const; diff --git a/hotspot/src/share/vm/oops/objArrayOop.cpp b/hotspot/src/share/vm/oops/objArrayOop.cpp index c1ae6830a8e..d2a37b2b7e1 100644 --- a/hotspot/src/share/vm/oops/objArrayOop.cpp +++ b/hotspot/src/share/vm/oops/objArrayOop.cpp @@ -33,4 +33,4 @@ int objArrayOopDesc::oop_iterate_range(OopClosureType* blk, int start, int end) } ALL_OOP_OOP_ITERATE_CLOSURES_1(ObjArrayOop_OOP_ITERATE_DEFN) -ALL_OOP_OOP_ITERATE_CLOSURES_3(ObjArrayOop_OOP_ITERATE_DEFN) +ALL_OOP_OOP_ITERATE_CLOSURES_2(ObjArrayOop_OOP_ITERATE_DEFN) diff --git a/hotspot/src/share/vm/oops/objArrayOop.hpp b/hotspot/src/share/vm/oops/objArrayOop.hpp index 6f12c0f1fa1..22e12acb397 100644 --- a/hotspot/src/share/vm/oops/objArrayOop.hpp +++ b/hotspot/src/share/vm/oops/objArrayOop.hpp @@ -29,6 +29,8 @@ class objArrayOopDesc : public arrayOopDesc { friend class objArrayKlass; friend class Runtime1; friend class psPromotionManager; + friend class CSMarkOopClosure; + friend class G1ParScanPartialArrayClosure; template T* obj_at_addr(int index) const { assert(is_within_bounds(index), "index out of bounds"); @@ -88,5 +90,5 @@ class objArrayOopDesc : public arrayOopDesc { int oop_iterate_range(OopClosureType* blk, int start, int end); ALL_OOP_OOP_ITERATE_CLOSURES_1(ObjArrayOop_OOP_ITERATE_DECL) - ALL_OOP_OOP_ITERATE_CLOSURES_3(ObjArrayOop_OOP_ITERATE_DECL) + ALL_OOP_OOP_ITERATE_CLOSURES_2(ObjArrayOop_OOP_ITERATE_DECL) }; diff --git a/hotspot/src/share/vm/oops/oop.hpp b/hotspot/src/share/vm/oops/oop.hpp index eb7959096d0..7c796edf9d0 100644 --- a/hotspot/src/share/vm/oops/oop.hpp +++ b/hotspot/src/share/vm/oops/oop.hpp @@ -358,12 +358,21 @@ class oopDesc { static void set_bs(BarrierSet* bs) { _bs = bs; } // iterators, returns size of object -#define OOP_ITERATE_DECL(OopClosureType, nv_suffix) \ +#define OOP_ITERATE_DECL(OopClosureType, nv_suffix) \ int oop_iterate(OopClosureType* blk); \ int oop_iterate(OopClosureType* blk, MemRegion mr); // Only in mr. ALL_OOP_OOP_ITERATE_CLOSURES_1(OOP_ITERATE_DECL) - ALL_OOP_OOP_ITERATE_CLOSURES_3(OOP_ITERATE_DECL) + ALL_OOP_OOP_ITERATE_CLOSURES_2(OOP_ITERATE_DECL) + +#ifndef SERIALGC + +#define OOP_ITERATE_BACKWARDS_DECL(OopClosureType, nv_suffix) \ + int oop_iterate_backwards(OopClosureType* blk); + + ALL_OOP_OOP_ITERATE_CLOSURES_1(OOP_ITERATE_BACKWARDS_DECL) + ALL_OOP_OOP_ITERATE_CLOSURES_2(OOP_ITERATE_BACKWARDS_DECL) +#endif void oop_iterate_header(OopClosure* blk); void oop_iterate_header(OopClosure* blk, MemRegion mr); diff --git a/hotspot/src/share/vm/oops/oop.inline.hpp b/hotspot/src/share/vm/oops/oop.inline.hpp index 222c0d4c262..be8780ba2cd 100644 --- a/hotspot/src/share/vm/oops/oop.inline.hpp +++ b/hotspot/src/share/vm/oops/oop.inline.hpp @@ -380,10 +380,11 @@ inline int oopDesc::size_given_klass(Klass* klass) { s = (int)((size_t)round_to(size_in_bytes, MinObjAlignmentInBytes) / HeapWordSize); - // UseParNewGC can change the length field of an "old copy" of an object - // array in the young gen so it indicates the stealable portion of - // an already copied array. This will cause the first disjunct below - // to fail if the sizes are computed across such a concurrent change. + // UseParNewGC, UseParallelGC and UseG1GC can change the length field + // of an "old copy" of an object array in the young gen so it indicates + // the grey portion of an already copied array. This will cause the first + // disjunct below to fail if the two comparands are computed across such + // a concurrent change. // UseParNewGC also runs with promotion labs (which look like int // filler arrays) which are subject to changing their declared size // when finally retiring a PLAB; this also can cause the first disjunct @@ -393,13 +394,11 @@ inline int oopDesc::size_given_klass(Klass* klass) { // is_objArray() && is_forwarded() // covers first scenario above // || is_typeArray() // covers second scenario above // If and when UseParallelGC uses the same obj array oop stealing/chunking - // technique, or when G1 is integrated (and currently uses this array chunking - // technique) we will need to suitably modify the assertion. + // technique, we will need to suitably modify the assertion. assert((s == klass->oop_size(this)) || - (((UseParNewGC || UseParallelGC) && - Universe::heap()->is_gc_active()) && - (is_typeArray() || - (is_objArray() && is_forwarded()))), + (Universe::heap()->is_gc_active() && + ((is_typeArray() && UseParNewGC) || + (is_objArray() && is_forwarded() && (UseParNewGC || UseParallelGC || UseG1GC)))), "wrong array object size"); } else { // Must be zero, so bite the bullet and take the virtual call. @@ -426,16 +425,22 @@ inline void update_barrier_set(void* p, oop v) { oopDesc::bs()->write_ref_field(p, v); } +inline void update_barrier_set_pre(void* p, oop v) { + oopDesc::bs()->write_ref_field_pre(p, v); +} + template inline void oop_store(T* p, oop v) { if (always_do_update_barrier) { oop_store((volatile T*)p, v); } else { + update_barrier_set_pre(p, v); oopDesc::encode_store_heap_oop(p, v); update_barrier_set(p, v); } } template inline void oop_store(volatile T* p, oop v) { + update_barrier_set_pre((void*)p, v); // Used by release_obj_field_put, so use release_store_ptr. oopDesc::release_encode_store_heap_oop(p, v); update_barrier_set((void*)p, v); @@ -683,8 +688,19 @@ inline int oopDesc::oop_iterate(OopClosureType* blk, MemRegion mr) { \ } ALL_OOP_OOP_ITERATE_CLOSURES_1(OOP_ITERATE_DEFN) -ALL_OOP_OOP_ITERATE_CLOSURES_3(OOP_ITERATE_DEFN) +ALL_OOP_OOP_ITERATE_CLOSURES_2(OOP_ITERATE_DEFN) +#ifndef SERIALGC +#define OOP_ITERATE_BACKWARDS_DEFN(OopClosureType, nv_suffix) \ + \ +inline int oopDesc::oop_iterate_backwards(OopClosureType* blk) { \ + SpecializationStats::record_call(); \ + return blueprint()->oop_oop_iterate_backwards##nv_suffix(this, blk); \ +} + +ALL_OOP_OOP_ITERATE_CLOSURES_1(OOP_ITERATE_BACKWARDS_DEFN) +ALL_OOP_OOP_ITERATE_CLOSURES_2(OOP_ITERATE_BACKWARDS_DEFN) +#endif // !SERIALGC inline bool oopDesc::is_shared() const { return CompactingPermGenGen::is_shared(this); diff --git a/hotspot/src/share/vm/opto/graphKit.cpp b/hotspot/src/share/vm/opto/graphKit.cpp index 49e05b8425e..338e277c9d2 100644 --- a/hotspot/src/share/vm/opto/graphKit.cpp +++ b/hotspot/src/share/vm/opto/graphKit.cpp @@ -1180,6 +1180,12 @@ Node* GraphKit::null_check_common(Node* value, BasicType type, else reason = Deoptimization::Reason_div0_check; + // %%% Since Reason_unhandled is not recorded on a per-bytecode basis, + // ciMethodData::has_trap_at will return a conservative -1 if any + // must-be-null assertion has failed. This could cause performance + // problems for a method after its first do_null_assert failure. + // Consider using 'Reason_class_check' instead? + // To cause an implicit null check, we set the not-null probability // to the maximum (PROB_MAX). For an explicit check the probablity // is set to a smaller value. @@ -1366,6 +1372,10 @@ void GraphKit::pre_barrier(Node* ctl, BarrierSet* bs = Universe::heap()->barrier_set(); set_control(ctl); switch (bs->kind()) { + case BarrierSet::G1SATBCT: + case BarrierSet::G1SATBCTLogging: + g1_write_barrier_pre(obj, adr, adr_idx, val, val_type, bt); + break; case BarrierSet::CardTableModRef: case BarrierSet::CardTableExtension: @@ -1390,6 +1400,10 @@ void GraphKit::post_barrier(Node* ctl, BarrierSet* bs = Universe::heap()->barrier_set(); set_control(ctl); switch (bs->kind()) { + case BarrierSet::G1SATBCT: + case BarrierSet::G1SATBCTLogging: + g1_write_barrier_post(store, obj, adr, adr_idx, val, bt, use_precise); + break; case BarrierSet::CardTableModRef: case BarrierSet::CardTableExtension: @@ -3176,3 +3190,251 @@ InitializeNode* AllocateNode::initialization() { } return NULL; } + +void GraphKit::g1_write_barrier_pre(Node* obj, + Node* adr, + uint alias_idx, + Node* val, + const Type* val_type, + BasicType bt) { + IdealKit ideal(gvn(), control(), merged_memory(), true); +#define __ ideal. + __ declares_done(); + + Node* thread = __ thread(); + + Node* no_ctrl = NULL; + Node* no_base = __ top(); + Node* zero = __ ConI(0); + + float likely = PROB_LIKELY(0.999); + float unlikely = PROB_UNLIKELY(0.999); + + BasicType active_type = in_bytes(PtrQueue::byte_width_of_active()) == 4 ? T_INT : T_BYTE; + assert(in_bytes(PtrQueue::byte_width_of_active()) == 4 || in_bytes(PtrQueue::byte_width_of_active()) == 1, "flag width"); + + // Offsets into the thread + const int marking_offset = in_bytes(JavaThread::satb_mark_queue_offset() + // 648 + PtrQueue::byte_offset_of_active()); + const int index_offset = in_bytes(JavaThread::satb_mark_queue_offset() + // 656 + PtrQueue::byte_offset_of_index()); + const int buffer_offset = in_bytes(JavaThread::satb_mark_queue_offset() + // 652 + PtrQueue::byte_offset_of_buf()); + // Now the actual pointers into the thread + + // set_control( ctl); + + Node* marking_adr = __ AddP(no_base, thread, __ ConX(marking_offset)); + Node* buffer_adr = __ AddP(no_base, thread, __ ConX(buffer_offset)); + Node* index_adr = __ AddP(no_base, thread, __ ConX(index_offset)); + + // Now some of the values + + Node* marking = __ load(no_ctrl, marking_adr, TypeInt::INT, active_type, Compile::AliasIdxRaw); + Node* index = __ load(no_ctrl, index_adr, TypeInt::INT, T_INT, Compile::AliasIdxRaw); + Node* buffer = __ load(no_ctrl, buffer_adr, TypeRawPtr::NOTNULL, T_ADDRESS, Compile::AliasIdxRaw); + + // if (!marking) + __ if_then(marking, BoolTest::ne, zero); { + + const Type* t1 = adr->bottom_type(); + const Type* t2 = val->bottom_type(); + + Node* orig = __ load(no_ctrl, adr, val_type, bt, alias_idx); + // if (orig != NULL) + __ if_then(orig, BoolTest::ne, null()); { + + // load original value + // alias_idx correct?? + + // is the queue for this thread full? + __ if_then(index, BoolTest::ne, zero, likely); { + + // decrement the index + Node* next_index = __ SubI(index, __ ConI(sizeof(intptr_t))); + Node* next_indexX = next_index; +#ifdef _LP64 + // We could refine the type for what it's worth + // const TypeLong* lidxtype = TypeLong::make(CONST64(0), get_size_from_queue); + next_indexX = _gvn.transform( new (C, 2) ConvI2LNode(next_index, TypeLong::make(0, max_jlong, Type::WidenMax)) ); +#endif // _LP64 + + // Now get the buffer location we will log the original value into and store it + + Node *log_addr = __ AddP(no_base, buffer, next_indexX); + // __ store(__ ctrl(), log_addr, orig, T_OBJECT, C->get_alias_index(TypeOopPtr::BOTTOM)); + __ store(__ ctrl(), log_addr, orig, T_OBJECT, Compile::AliasIdxRaw); + + + // update the index + // __ store(__ ctrl(), index_adr, next_index, T_INT, Compile::AliasIdxRaw); + // This is a hack to force this store to occur before the oop store that is coming up + __ store(__ ctrl(), index_adr, next_index, T_INT, C->get_alias_index(TypeOopPtr::BOTTOM)); + + } __ else_(); { + + // logging buffer is full, call the runtime + const TypeFunc *tf = OptoRuntime::g1_wb_pre_Type(); + // __ make_leaf_call(tf, OptoRuntime::g1_wb_pre_Java(), "g1_wb_pre", orig, thread); + __ make_leaf_call(tf, CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), "g1_wb_pre", orig, thread); + } __ end_if(); + } __ end_if(); + } __ end_if(); + + __ drain_delay_transform(); + set_control( __ ctrl()); + set_all_memory( __ merged_memory()); + +#undef __ +} + +// +// Update the card table and add card address to the queue +// +void GraphKit::g1_mark_card(IdealKit* ideal, Node* card_adr, Node* store, Node* index, Node* index_adr, Node* buffer, const TypeFunc* tf) { +#define __ ideal-> + Node* zero = __ ConI(0); + Node* no_base = __ top(); + BasicType card_bt = T_BYTE; + // Smash zero into card. MUST BE ORDERED WRT TO STORE + __ storeCM(__ ctrl(), card_adr, zero, store, card_bt, Compile::AliasIdxRaw); + + // Now do the queue work + __ if_then(index, BoolTest::ne, zero); { + + Node* next_index = __ SubI(index, __ ConI(sizeof(intptr_t))); + Node* next_indexX = next_index; +#ifdef _LP64 + // We could refine the type for what it's worth + // const TypeLong* lidxtype = TypeLong::make(CONST64(0), get_size_from_queue); + next_indexX = _gvn.transform( new (C, 2) ConvI2LNode(next_index, TypeLong::make(0, max_jlong, Type::WidenMax)) ); +#endif // _LP64 + Node* log_addr = __ AddP(no_base, buffer, next_indexX); + + __ store(__ ctrl(), log_addr, card_adr, T_ADDRESS, Compile::AliasIdxRaw); + __ store(__ ctrl(), index_adr, next_index, T_INT, Compile::AliasIdxRaw); + + } __ else_(); { + __ make_leaf_call(tf, CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post), "g1_wb_post", card_adr, __ thread()); + } __ end_if(); +#undef __ +} + +void GraphKit::g1_write_barrier_post(Node* store, + Node* obj, + Node* adr, + uint alias_idx, + Node* val, + BasicType bt, + bool use_precise) { + // If we are writing a NULL then we need no post barrier + + if (val != NULL && val->is_Con() && val->bottom_type() == TypePtr::NULL_PTR) { + // Must be NULL + const Type* t = val->bottom_type(); + assert(t == Type::TOP || t == TypePtr::NULL_PTR, "must be NULL"); + // No post barrier if writing NULLx + return; + } + + if (!use_precise) { + // All card marks for a (non-array) instance are in one place: + adr = obj; + } + // (Else it's an array (or unknown), and we want more precise card marks.) + assert(adr != NULL, ""); + + IdealKit ideal(gvn(), control(), merged_memory(), true); +#define __ ideal. + __ declares_done(); + + Node* thread = __ thread(); + + Node* no_ctrl = NULL; + Node* no_base = __ top(); + float likely = PROB_LIKELY(0.999); + float unlikely = PROB_UNLIKELY(0.999); + Node* zero = __ ConI(0); + Node* zeroX = __ ConX(0); + + // Get the alias_index for raw card-mark memory + const TypePtr* card_type = TypeRawPtr::BOTTOM; + + const TypeFunc *tf = OptoRuntime::g1_wb_post_Type(); + + // Get the address of the card table + CardTableModRefBS* ct = + (CardTableModRefBS*)(Universe::heap()->barrier_set()); + Node *card_table = __ makecon(TypeRawPtr::make((address)ct->byte_map_base)); + // Get base of card map + assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code"); + + + // Offsets into the thread + const int index_offset = in_bytes(JavaThread::dirty_card_queue_offset() + + PtrQueue::byte_offset_of_index()); + const int buffer_offset = in_bytes(JavaThread::dirty_card_queue_offset() + + PtrQueue::byte_offset_of_buf()); + + // Pointers into the thread + + Node* buffer_adr = __ AddP(no_base, thread, __ ConX(buffer_offset)); + Node* index_adr = __ AddP(no_base, thread, __ ConX(index_offset)); + + // Now some values + + Node* index = __ load(no_ctrl, index_adr, TypeInt::INT, T_INT, Compile::AliasIdxRaw); + Node* buffer = __ load(no_ctrl, buffer_adr, TypeRawPtr::NOTNULL, T_ADDRESS, Compile::AliasIdxRaw); + + + // Convert the store obj pointer to an int prior to doing math on it + // Use addr not obj gets accurate card marks + + // Node* cast = __ CastPX(no_ctrl, adr /* obj */); + + // Must use ctrl to prevent "integerized oop" existing across safepoint + Node* cast = __ CastPX(__ ctrl(), ( use_precise ? adr : obj )); + + // Divide pointer by card size + Node* card_offset = __ URShiftX( cast, __ ConI(CardTableModRefBS::card_shift) ); + + // Combine card table base and card offset + Node *card_adr = __ AddP(no_base, card_table, card_offset ); + + // If we know the value being stored does it cross regions? + + if (val != NULL) { + // Does the store cause us to cross regions? + + // Should be able to do an unsigned compare of region_size instead of + // and extra shift. Do we have an unsigned compare?? + // Node* region_size = __ ConI(1 << HeapRegion::LogOfHRGrainBytes); + Node* xor_res = __ URShiftX ( __ XorX( cast, __ CastPX(__ ctrl(), val)), __ ConI(HeapRegion::LogOfHRGrainBytes)); + + // if (xor_res == 0) same region so skip + __ if_then(xor_res, BoolTest::ne, zeroX); { + + // No barrier if we are storing a NULL + __ if_then(val, BoolTest::ne, null(), unlikely); { + + // Ok must mark the card if not already dirty + + // load the original value of the card + Node* card_val = __ load(__ ctrl(), card_adr, TypeInt::INT, T_BYTE, Compile::AliasIdxRaw); + + __ if_then(card_val, BoolTest::ne, zero); { + g1_mark_card(&ideal, card_adr, store, index, index_adr, buffer, tf); + } __ end_if(); + } __ end_if(); + } __ end_if(); + } else { + g1_mark_card(&ideal, card_adr, store, index, index_adr, buffer, tf); + } + + + __ drain_delay_transform(); + set_control( __ ctrl()); + set_all_memory( __ merged_memory()); +#undef __ + +} diff --git a/hotspot/src/share/vm/opto/graphKit.hpp b/hotspot/src/share/vm/opto/graphKit.hpp index c9ea0262561..0817ed3bfcb 100644 --- a/hotspot/src/share/vm/opto/graphKit.hpp +++ b/hotspot/src/share/vm/opto/graphKit.hpp @@ -24,6 +24,7 @@ class FastLockNode; class FastUnlockNode; +class IdealKit; class Parse; class RootNode; @@ -581,6 +582,27 @@ class GraphKit : public Phase { && Universe::heap()->can_elide_tlab_store_barriers()); } + // G1 pre/post barriers + void g1_write_barrier_pre(Node* obj, + Node* adr, + uint alias_idx, + Node* val, + const Type* val_type, + BasicType bt); + + void g1_write_barrier_post(Node* store, + Node* obj, + Node* adr, + uint alias_idx, + Node* val, + BasicType bt, + bool use_precise); + // Helper function for g1 + private: + void g1_mark_card(IdealKit* ideal, Node* card_adr, Node* store, Node* index, Node* index_adr, + Node* buffer, const TypeFunc* tf); + + public: // Helper function to round double arguments before a call void round_double_arguments(ciMethod* dest_method); void round_double_result(ciMethod* dest_method); diff --git a/hotspot/src/share/vm/opto/lcm.cpp b/hotspot/src/share/vm/opto/lcm.cpp index 13c3d774cff..4cc6409f616 100644 --- a/hotspot/src/share/vm/opto/lcm.cpp +++ b/hotspot/src/share/vm/opto/lcm.cpp @@ -585,7 +585,7 @@ bool Block::schedule_local(PhaseCFG *cfg, Matcher &matcher, int *ready_cnt, Vect // A few node types require changing a required edge to a precedence edge // before allocation. - if( UseConcMarkSweepGC ) { + if( UseConcMarkSweepGC || UseG1GC ) { if( n->is_Mach() && n->as_Mach()->ideal_Opcode() == Op_StoreCM ) { // Note: Required edges with an index greater than oper_input_base // are not supported by the allocator. diff --git a/hotspot/src/share/vm/opto/macro.cpp b/hotspot/src/share/vm/opto/macro.cpp index d537c1d6c6e..584112222b7 100644 --- a/hotspot/src/share/vm/opto/macro.cpp +++ b/hotspot/src/share/vm/opto/macro.cpp @@ -923,21 +923,7 @@ void PhaseMacroExpand::expand_allocate_common( Node* eden_end_adr; set_eden_pointers(eden_top_adr, eden_end_adr); - uint raw_idx = C->get_alias_index(TypeRawPtr::BOTTOM); assert(ctrl != NULL, "must have control"); - - // Load Eden::end. Loop invariant and hoisted. - // - // Note: We set the control input on "eden_end" and "old_eden_top" when using - // a TLAB to work around a bug where these values were being moved across - // a safepoint. These are not oops, so they cannot be include in the oop - // map, but the can be changed by a GC. The proper way to fix this would - // be to set the raw memory state when generating a SafepointNode. However - // this will require extensive changes to the loop optimization in order to - // prevent a degradation of the optimization. - // See comment in memnode.hpp, around line 227 in class LoadPNode. - Node* eden_end = make_load(ctrl, mem, eden_end_adr, 0, TypeRawPtr::BOTTOM, T_ADDRESS); - // We need a Region and corresponding Phi's to merge the slow-path and fast-path results. // they will not be used if "always_slow" is set enum { slow_result_path = 1, fast_result_path = 2 }; @@ -957,12 +943,15 @@ void PhaseMacroExpand::expand_allocate_common( initial_slow_test = BoolNode::make_predicate(initial_slow_test, &_igvn); } - if (DTraceAllocProbes) { + if (DTraceAllocProbes || + !UseTLAB && (!Universe::heap()->supports_inline_contig_alloc() || + (UseConcMarkSweepGC && CMSIncrementalMode))) { // Force slow-path allocation always_slow = true; initial_slow_test = NULL; } + enum { too_big_or_final_path = 1, need_gc_path = 2 }; Node *slow_region = NULL; Node *toobig_false = ctrl; @@ -991,6 +980,23 @@ void PhaseMacroExpand::expand_allocate_common( Node *slow_mem = mem; // save the current memory state for slow path // generate the fast allocation code unless we know that the initial test will always go slow if (!always_slow) { + Node* eden_top_adr; + Node* eden_end_adr; + + set_eden_pointers(eden_top_adr, eden_end_adr); + + // Load Eden::end. Loop invariant and hoisted. + // + // Note: We set the control input on "eden_end" and "old_eden_top" when using + // a TLAB to work around a bug where these values were being moved across + // a safepoint. These are not oops, so they cannot be include in the oop + // map, but the can be changed by a GC. The proper way to fix this would + // be to set the raw memory state when generating a SafepointNode. However + // this will require extensive changes to the loop optimization in order to + // prevent a degradation of the optimization. + // See comment in memnode.hpp, around line 227 in class LoadPNode. + Node *eden_end = make_load(ctrl, mem, eden_end_adr, 0, TypeRawPtr::BOTTOM, T_ADDRESS); + // allocate the Region and Phi nodes for the result result_region = new (C, 3) RegionNode(3); result_phi_rawmem = new (C, 3) PhiNode( result_region, Type::MEMORY, TypeRawPtr::BOTTOM ); diff --git a/hotspot/src/share/vm/opto/runtime.cpp b/hotspot/src/share/vm/opto/runtime.cpp index aedfceb51af..7b5effc8182 100644 --- a/hotspot/src/share/vm/opto/runtime.cpp +++ b/hotspot/src/share/vm/opto/runtime.cpp @@ -44,6 +44,8 @@ address OptoRuntime::_multianewarray2_Java = NULL; address OptoRuntime::_multianewarray3_Java = NULL; address OptoRuntime::_multianewarray4_Java = NULL; address OptoRuntime::_multianewarray5_Java = NULL; +address OptoRuntime::_g1_wb_pre_Java = NULL; +address OptoRuntime::_g1_wb_post_Java = NULL; address OptoRuntime::_vtable_must_compile_Java = NULL; address OptoRuntime::_complete_monitor_locking_Java = NULL; address OptoRuntime::_rethrow_Java = NULL; @@ -89,6 +91,8 @@ void OptoRuntime::generate(ciEnv* env) { gen(env, _multianewarray3_Java , multianewarray3_Type , multianewarray3_C , 0 , true , false, false); gen(env, _multianewarray4_Java , multianewarray4_Type , multianewarray4_C , 0 , true , false, false); gen(env, _multianewarray5_Java , multianewarray5_Type , multianewarray5_C , 0 , true , false, false); + gen(env, _g1_wb_pre_Java , g1_wb_pre_Type , SharedRuntime::g1_wb_pre , 0 , false, false, false); + gen(env, _g1_wb_post_Java , g1_wb_post_Type , SharedRuntime::g1_wb_post , 0 , false, false, false); gen(env, _complete_monitor_locking_Java , complete_monitor_enter_Type , SharedRuntime::complete_monitor_locking_C , 0 , false, false, false); gen(env, _rethrow_Java , rethrow_Type , rethrow_C , 2 , true , false, true ); @@ -385,6 +389,33 @@ const TypeFunc *OptoRuntime::multianewarray5_Type() { return multianewarray_Type(5); } +const TypeFunc *OptoRuntime::g1_wb_pre_Type() { + const Type **fields = TypeTuple::fields(2); + fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // original field value + fields[TypeFunc::Parms+1] = TypeRawPtr::NOTNULL; // thread + const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2, fields); + + // create result type (range) + fields = TypeTuple::fields(0); + const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields); + + return TypeFunc::make(domain, range); +} + +const TypeFunc *OptoRuntime::g1_wb_post_Type() { + + const Type **fields = TypeTuple::fields(2); + fields[TypeFunc::Parms+0] = TypeRawPtr::NOTNULL; // Card addr + fields[TypeFunc::Parms+1] = TypeRawPtr::NOTNULL; // thread + const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2, fields); + + // create result type (range) + fields = TypeTuple::fields(0); + const TypeTuple *range = TypeTuple::make(TypeFunc::Parms, fields); + + return TypeFunc::make(domain, range); +} + const TypeFunc *OptoRuntime::uncommon_trap_Type() { // create input type (domain) const Type **fields = TypeTuple::fields(1); diff --git a/hotspot/src/share/vm/opto/runtime.hpp b/hotspot/src/share/vm/opto/runtime.hpp index 50f11712046..8a51b2facce 100644 --- a/hotspot/src/share/vm/opto/runtime.hpp +++ b/hotspot/src/share/vm/opto/runtime.hpp @@ -108,6 +108,8 @@ class OptoRuntime : public AllStatic { static address _multianewarray3_Java; static address _multianewarray4_Java; static address _multianewarray5_Java; + static address _g1_wb_pre_Java; + static address _g1_wb_post_Java; static address _vtable_must_compile_Java; static address _complete_monitor_locking_Java; static address _rethrow_Java; @@ -140,6 +142,8 @@ class OptoRuntime : public AllStatic { static void multianewarray3_C(klassOopDesc* klass, int len1, int len2, int len3, JavaThread *thread); static void multianewarray4_C(klassOopDesc* klass, int len1, int len2, int len3, int len4, JavaThread *thread); static void multianewarray5_C(klassOopDesc* klass, int len1, int len2, int len3, int len4, int len5, JavaThread *thread); + static void g1_wb_pre_C(oopDesc* orig, JavaThread* thread); + static void g1_wb_post_C(void* card_addr, JavaThread* thread); public: // Slow-path Locking and Unlocking @@ -195,6 +199,8 @@ private: static address multianewarray3_Java() { return _multianewarray3_Java; } static address multianewarray4_Java() { return _multianewarray4_Java; } static address multianewarray5_Java() { return _multianewarray5_Java; } + static address g1_wb_pre_Java() { return _g1_wb_pre_Java; } + static address g1_wb_post_Java() { return _g1_wb_post_Java; } static address vtable_must_compile_stub() { return _vtable_must_compile_Java; } static address complete_monitor_locking_Java() { return _complete_monitor_locking_Java; } @@ -232,6 +238,8 @@ private: static const TypeFunc* multianewarray3_Type(); // multianewarray static const TypeFunc* multianewarray4_Type(); // multianewarray static const TypeFunc* multianewarray5_Type(); // multianewarray + static const TypeFunc* g1_wb_pre_Type(); + static const TypeFunc* g1_wb_post_Type(); static const TypeFunc* complete_monitor_enter_Type(); static const TypeFunc* complete_monitor_exit_Type(); static const TypeFunc* uncommon_trap_Type(); diff --git a/hotspot/src/share/vm/prims/jvm.cpp b/hotspot/src/share/vm/prims/jvm.cpp index deaba3a9ed7..222794fe2b2 100644 --- a/hotspot/src/share/vm/prims/jvm.cpp +++ b/hotspot/src/share/vm/prims/jvm.cpp @@ -377,7 +377,11 @@ JVM_END JVM_ENTRY_NO_ENV(jlong, JVM_FreeMemory(void)) JVMWrapper("JVM_FreeMemory"); CollectedHeap* ch = Universe::heap(); - size_t n = ch->capacity() - ch->used(); + size_t n; + { + MutexLocker x(Heap_lock); + n = ch->capacity() - ch->used(); + } return convert_size_t_to_jlong(n); JVM_END diff --git a/hotspot/src/share/vm/prims/jvmtiExport.cpp b/hotspot/src/share/vm/prims/jvmtiExport.cpp index 7bb33674d87..a3894b3d66e 100644 --- a/hotspot/src/share/vm/prims/jvmtiExport.cpp +++ b/hotspot/src/share/vm/prims/jvmtiExport.cpp @@ -2433,18 +2433,7 @@ JvmtiGCMarker::JvmtiGCMarker(bool full) : _full(full), _invocation_count(0) { // so we record the number of collections so that it can be checked in // the destructor. if (!_full) { - if (Universe::heap()->kind() == CollectedHeap::GenCollectedHeap) { - GenCollectedHeap* gch = GenCollectedHeap::heap(); - assert(gch->n_gens() == 2, "configuration not recognized"); - _invocation_count = (unsigned int)gch->get_gen(1)->stat_record()->invocations; - } else { -#ifndef SERIALGC - assert(Universe::heap()->kind() == CollectedHeap::ParallelScavengeHeap, "checking"); - _invocation_count = PSMarkSweep::total_invocations(); -#else // SERIALGC - fatal("SerialGC only supported in this configuration."); -#endif // SERIALGC - } + _invocation_count = Universe::heap()->total_full_collections(); } // Do clean up tasks that need to be done at a safepoint @@ -2466,20 +2455,7 @@ JvmtiGCMarker::~JvmtiGCMarker() { // generation but could have ended up doing a "full" GC - check the // GC count to see. if (!_full) { - if (Universe::heap()->kind() == CollectedHeap::GenCollectedHeap) { - GenCollectedHeap* gch = GenCollectedHeap::heap(); - if (_invocation_count != (unsigned int)gch->get_gen(1)->stat_record()->invocations) { - _full = true; - } - } else { -#ifndef SERIALGC - if (_invocation_count != PSMarkSweep::total_invocations()) { - _full = true; - } -#else // SERIALGC - fatal("SerialGC only supported in this configuration."); -#endif // SERIALGC - } + _full = (_invocation_count != Universe::heap()->total_full_collections()); } // Full collection probably means the perm generation has been GC'ed diff --git a/hotspot/src/share/vm/prims/jvmtiTagMap.cpp b/hotspot/src/share/vm/prims/jvmtiTagMap.cpp index 30d9fee4611..88440fef0be 100644 --- a/hotspot/src/share/vm/prims/jvmtiTagMap.cpp +++ b/hotspot/src/share/vm/prims/jvmtiTagMap.cpp @@ -400,16 +400,28 @@ MemRegion JvmtiTagMap::_young_gen; // get the memory region used for the young generation void JvmtiTagMap::get_young_generation() { - if (Universe::heap()->kind() == CollectedHeap::GenCollectedHeap) { - GenCollectedHeap* gch = GenCollectedHeap::heap(); - _young_gen = gch->get_gen(0)->reserved(); - } else { + CollectedHeap* ch = Universe::heap(); + switch (ch->kind()) { + case (CollectedHeap::GenCollectedHeap): { + _young_gen = ((GenCollectedHeap*)ch)->get_gen(0)->reserved(); + break; + } #ifndef SERIALGC - ParallelScavengeHeap* psh = ParallelScavengeHeap::heap(); - _young_gen= psh->young_gen()->reserved(); -#else // SERIALGC - fatal("SerialGC only supported in this configuration."); -#endif // SERIALGC + case (CollectedHeap::ParallelScavengeHeap): { + _young_gen = ((ParallelScavengeHeap*)ch)->young_gen()->reserved(); + break; + } + case (CollectedHeap::G1CollectedHeap): { + // Until a more satisfactory solution is implemented, all + // oops in the tag map will require rehash at each gc. + // This is a correct, if extremely inefficient solution. + // See RFE 6621729 for related commentary. + _young_gen = ch->reserved_region(); + break; + } +#endif // !SERIALGC + default: + ShouldNotReachHere(); } } diff --git a/hotspot/src/share/vm/prims/unsafe.cpp b/hotspot/src/share/vm/prims/unsafe.cpp index 899a99296be..951bf213e57 100644 --- a/hotspot/src/share/vm/prims/unsafe.cpp +++ b/hotspot/src/share/vm/prims/unsafe.cpp @@ -891,6 +891,7 @@ UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSwapObject(JNIEnv *env, jobject unsafe, oop e = JNIHandles::resolve(e_h); oop p = JNIHandles::resolve(obj); HeapWord* addr = (HeapWord *)index_oop_from_field_offset_long(p, offset); + update_barrier_set_pre((void*)addr, e); oop res = oopDesc::atomic_compare_exchange_oop(x, addr, e); jboolean success = (res == e); if (success) diff --git a/hotspot/src/share/vm/runtime/aprofiler.hpp b/hotspot/src/share/vm/runtime/aprofiler.hpp index 3a7b9b01ba2..bb0d1f95c56 100644 --- a/hotspot/src/share/vm/runtime/aprofiler.hpp +++ b/hotspot/src/share/vm/runtime/aprofiler.hpp @@ -33,6 +33,7 @@ class AllocationProfiler: AllStatic { friend class GenCollectedHeap; + friend class G1CollectedHeap; friend class MarkSweep; private: static bool _active; // tells whether profiler is active diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp index aa8331bfd40..0d22c053cff 100644 --- a/hotspot/src/share/vm/runtime/arguments.cpp +++ b/hotspot/src/share/vm/runtime/arguments.cpp @@ -922,18 +922,17 @@ static void no_shared_spaces() { // UseParNewGC and not explicitly set ParallelGCThreads we // set it, unless this is a single cpu machine. void Arguments::set_parnew_gc_flags() { - assert(!UseSerialGC && !UseParallelGC, "control point invariant"); + assert(!UseSerialGC && !UseParallelGC && !UseG1GC, + "control point invariant"); + assert(UseParNewGC, "Error"); // Turn off AdaptiveSizePolicy by default for parnew until it is // complete. - if (UseParNewGC && - FLAG_IS_DEFAULT(UseAdaptiveSizePolicy)) { + if (FLAG_IS_DEFAULT(UseAdaptiveSizePolicy)) { FLAG_SET_DEFAULT(UseAdaptiveSizePolicy, false); } - if (FLAG_IS_DEFAULT(UseParNewGC) && ParallelGCThreads > 1) { - FLAG_SET_DEFAULT(UseParNewGC, true); - } else if (UseParNewGC && ParallelGCThreads == 0) { + if (ParallelGCThreads == 0) { FLAG_SET_DEFAULT(ParallelGCThreads, Abstract_VM_Version::parallel_worker_threads()); if (FLAG_IS_DEFAULT(ParallelGCThreads) && ParallelGCThreads == 1) { @@ -969,15 +968,12 @@ void Arguments::set_parnew_gc_flags() { // further optimization and tuning efforts, and would almost // certainly gain from analysis of platform and environment. void Arguments::set_cms_and_parnew_gc_flags() { - if (UseSerialGC || UseParallelGC) { - return; - } - + assert(!UseSerialGC && !UseParallelGC, "Error"); assert(UseConcMarkSweepGC, "CMS is expected to be on here"); // If we are using CMS, we prefer to UseParNewGC, // unless explicitly forbidden. - if (!UseParNewGC && FLAG_IS_DEFAULT(UseParNewGC)) { + if (FLAG_IS_DEFAULT(UseParNewGC)) { FLAG_SET_ERGO(bool, UseParNewGC, true); } @@ -1157,6 +1153,7 @@ void Arguments::set_ergonomics_flags() { // machine class and automatic selection policy. if (!UseSerialGC && !UseConcMarkSweepGC && + !UseG1GC && !UseParNewGC && !DumpSharedSpaces && FLAG_IS_DEFAULT(UseParallelGC)) { @@ -1174,7 +1171,7 @@ void Arguments::set_ergonomics_flags() { // field offset to determine free list chunk markers. // Check that UseCompressedOops can be set with the max heap size allocated // by ergonomics. - if (!UseConcMarkSweepGC && MaxHeapSize <= max_heap_for_compressed_oops()) { + if (!UseG1GC && !UseConcMarkSweepGC && MaxHeapSize <= max_heap_for_compressed_oops()) { if (FLAG_IS_DEFAULT(UseCompressedOops)) { FLAG_SET_ERGO(bool, UseCompressedOops, true); } @@ -1183,6 +1180,8 @@ void Arguments::set_ergonomics_flags() { // If specified, give a warning if (UseConcMarkSweepGC){ warning("Compressed Oops does not work with CMS"); + } else if (UseG1GC) { + warning("Compressed Oops does not work with UseG1GC"); } else { warning( "Max heap size too large for Compressed Oops"); @@ -1196,6 +1195,7 @@ void Arguments::set_ergonomics_flags() { } void Arguments::set_parallel_gc_flags() { + assert(UseParallelGC || UseParallelOldGC, "Error"); // If parallel old was requested, automatically enable parallel scavenge. if (UseParallelOldGC && !UseParallelGC && FLAG_IS_DEFAULT(UseParallelGC)) { FLAG_SET_DEFAULT(UseParallelGC, true); @@ -1207,51 +1207,8 @@ void Arguments::set_parallel_gc_flags() { FLAG_SET_ERGO(uintx, ParallelGCThreads, Abstract_VM_Version::parallel_worker_threads()); - if (FLAG_IS_DEFAULT(MaxHeapSize)) { - const uint64_t reasonable_fraction = - os::physical_memory() / DefaultMaxRAMFraction; - const uint64_t maximum_size = (uint64_t) - (FLAG_IS_DEFAULT(DefaultMaxRAM) && UseCompressedOops ? - MIN2(max_heap_for_compressed_oops(), DefaultMaxRAM) : - DefaultMaxRAM); - size_t reasonable_max = - (size_t) os::allocatable_physical_memory(reasonable_fraction); - if (reasonable_max > maximum_size) { - reasonable_max = maximum_size; - } - if (PrintGCDetails && Verbose) { - // Cannot use gclog_or_tty yet. - tty->print_cr(" Max heap size for server class platform " - SIZE_FORMAT, reasonable_max); - } - // If the initial_heap_size has not been set with -Xms, - // then set it as fraction of size of physical memory - // respecting the maximum and minimum sizes of the heap. - if (initial_heap_size() == 0) { - const uint64_t reasonable_initial_fraction = - os::physical_memory() / DefaultInitialRAMFraction; - const size_t reasonable_initial = - (size_t) os::allocatable_physical_memory(reasonable_initial_fraction); - const size_t minimum_size = NewSize + OldSize; - set_initial_heap_size(MAX2(MIN2(reasonable_initial, reasonable_max), - minimum_size)); - // Currently the minimum size and the initial heap sizes are the same. - set_min_heap_size(initial_heap_size()); - if (PrintGCDetails && Verbose) { - // Cannot use gclog_or_tty yet. - tty->print_cr(" Initial heap size for server class platform " - SIZE_FORMAT, initial_heap_size()); - } - } else { - // An minimum size was specified on the command line. Be sure - // that the maximum size is consistent. - if (initial_heap_size() > reasonable_max) { - reasonable_max = initial_heap_size(); - } - } - FLAG_SET_ERGO(uintx, MaxHeapSize, (uintx) reasonable_max); - } - + // PS is a server collector, setup the heap sizes accordingly. + set_server_heap_size(); // If InitialSurvivorRatio or MinSurvivorRatio were not specified, but the // SurvivorRatio has been set, reset their default values to SurvivorRatio + // 2. By doing this we make SurvivorRatio also work for Parallel Scavenger. @@ -1279,6 +1236,70 @@ void Arguments::set_parallel_gc_flags() { } } +void Arguments::set_g1_gc_flags() { + assert(UseG1GC, "Error"); + // G1 is a server collector, setup the heap sizes accordingly. + set_server_heap_size(); +#ifdef COMPILER1 + FastTLABRefill = false; +#endif + FLAG_SET_DEFAULT(ParallelGCThreads, + Abstract_VM_Version::parallel_worker_threads()); + if (ParallelGCThreads == 0) { + FLAG_SET_DEFAULT(ParallelGCThreads, + Abstract_VM_Version::parallel_worker_threads +()); + } + no_shared_spaces(); +} + +void Arguments::set_server_heap_size() { + if (FLAG_IS_DEFAULT(MaxHeapSize)) { + const uint64_t reasonable_fraction = + os::physical_memory() / DefaultMaxRAMFraction; + const uint64_t maximum_size = (uint64_t) + (FLAG_IS_DEFAULT(DefaultMaxRAM) && UseCompressedOops ? + MIN2(max_heap_for_compressed_oops(), DefaultMaxRAM) : + DefaultMaxRAM); + size_t reasonable_max = + (size_t) os::allocatable_physical_memory(reasonable_fraction); + if (reasonable_max > maximum_size) { + reasonable_max = maximum_size; + } + if (PrintGCDetails && Verbose) { + // Cannot use gclog_or_tty yet. + tty->print_cr(" Max heap size for server class platform " + SIZE_FORMAT, reasonable_max); + } + // If the initial_heap_size has not been set with -Xms, + // then set it as fraction of size of physical memory + // respecting the maximum and minimum sizes of the heap. + if (initial_heap_size() == 0) { + const uint64_t reasonable_initial_fraction = + os::physical_memory() / DefaultInitialRAMFraction; + const size_t reasonable_initial = + (size_t) os::allocatable_physical_memory(reasonable_initial_fraction); + const size_t minimum_size = NewSize + OldSize; + set_initial_heap_size(MAX2(MIN2(reasonable_initial, reasonable_max), + minimum_size)); + // Currently the minimum size and the initial heap sizes are the same. + set_min_heap_size(initial_heap_size()); + if (PrintGCDetails && Verbose) { + // Cannot use gclog_or_tty yet. + tty->print_cr(" Initial heap size for server class platform " + SIZE_FORMAT, initial_heap_size()); + } + } else { + // A minimum size was specified on the command line. Be sure + // that the maximum size is consistent. + if (initial_heap_size() > reasonable_max) { + reasonable_max = initial_heap_size(); + } + } + FLAG_SET_ERGO(uintx, MaxHeapSize, (uintx) reasonable_max); + } +} + // This must be called after ergonomics because we want bytecode rewriting // if the server compiler is used, or if UseSharedSpaces is disabled. void Arguments::set_bytecode_flags() { @@ -1362,12 +1383,13 @@ static void set_serial_gc_flags() { FLAG_SET_DEFAULT(UseConcMarkSweepGC, false); FLAG_SET_DEFAULT(UseParallelGC, false); FLAG_SET_DEFAULT(UseParallelOldGC, false); + FLAG_SET_DEFAULT(UseG1GC, false); } static bool verify_serial_gc_flags() { return (UseSerialGC && - !(UseParNewGC || UseConcMarkSweepGC || UseParallelGC || - UseParallelOldGC)); + !(UseParNewGC || UseConcMarkSweepGC || UseG1GC || + UseParallelGC || UseParallelOldGC)); } // Check consistency of GC selection @@ -1470,8 +1492,8 @@ bool Arguments::check_vm_args_consistency() { status = status && verify_percentage(GCHeapFreeLimit, "GCHeapFreeLimit"); // Check user specified sharing option conflict with Parallel GC - bool cannot_share = (UseConcMarkSweepGC || UseParallelGC || - UseParallelOldGC || UseParNewGC || + bool cannot_share = (UseConcMarkSweepGC || UseG1GC || UseParNewGC || + UseParallelGC || UseParallelOldGC || SOLARIS_ONLY(UseISM) NOT_SOLARIS(UseLargePages)); if (cannot_share) { @@ -1511,11 +1533,6 @@ bool Arguments::check_vm_args_consistency() { "The CMS collector (-XX:+UseConcMarkSweepGC) must be " "selected in order\nto use CMSIncrementalMode.\n"); status = false; - } else if (!UseTLAB) { - jio_fprintf(defaultStream::error_stream(), - "error: CMSIncrementalMode requires thread-local " - "allocation buffers\n(-XX:+UseTLAB).\n"); - status = false; } else { status = status && verify_percentage(CMSIncrementalDutyCycle, "CMSIncrementalDutyCycle"); @@ -1535,13 +1552,6 @@ bool Arguments::check_vm_args_consistency() { } } - if (UseNUMA && !UseTLAB) { - jio_fprintf(defaultStream::error_stream(), - "error: NUMA allocator (-XX:+UseNUMA) requires thread-local " - "allocation\nbuffers (-XX:+UseTLAB).\n"); - status = false; - } - // CMS space iteration, which FLSVerifyAllHeapreferences entails, // insists that we hold the requisite locks so that the iteration is // MT-safe. For the verification at start-up and shut-down, we don't @@ -2330,10 +2340,15 @@ jint Arguments::finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_req SOLARIS_ONLY(FLAG_SET_DEFAULT(UseMPSS, false)); SOLARIS_ONLY(FLAG_SET_DEFAULT(UseISM, false)); } + #else if (!FLAG_IS_DEFAULT(OptoLoopAlignment) && FLAG_IS_DEFAULT(MaxLoopPad)) { FLAG_SET_DEFAULT(MaxLoopPad, OptoLoopAlignment-1); } + // Temporary disable bulk zeroing reduction with G1. See CR 6627983. + if (UseG1GC) { + FLAG_SET_DEFAULT(ReduceBulkZeroing, false); + } #endif if (!check_vm_args_consistency()) { @@ -2485,12 +2500,29 @@ jint Arguments::parse(const JavaVMInitArgs* args) { } } + // Parse JavaVMInitArgs structure passed in, as well as JAVA_TOOL_OPTIONS and _JAVA_OPTIONS jint result = parse_vm_init_args(args); if (result != JNI_OK) { return result; } + // These are hacks until G1 is fully supported and tested + // but lets you force -XX:+UseG1GC in PRT and get it where it (mostly) works + if (UseG1GC) { + if (UseConcMarkSweepGC || UseParNewGC || UseParallelGC || UseParallelOldGC || UseSerialGC) { +#ifndef PRODUCT + tty->print_cr("-XX:+UseG1GC is incompatible with other collectors, using UseG1GC"); +#endif // PRODUCT + UseConcMarkSweepGC = false; + UseParNewGC = false; + UseParallelGC = false; + UseParallelOldGC = false; + UseSerialGC = false; + } + no_shared_spaces(); + } + #ifndef PRODUCT if (TraceBytecodesAt != 0) { TraceBytecodes = true; @@ -2536,6 +2568,12 @@ jint Arguments::parse(const JavaVMInitArgs* args) { // Set some flags for ParNew set_parnew_gc_flags(); } + // Temporary; make the "if" an "else-if" before + // we integrate G1. XXX + if (UseG1GC) { + // Set some flags for garbage-first, if needed. + set_g1_gc_flags(); + } #ifdef SERIALGC assert(verify_serial_gc_flags(), "SerialGC unset"); diff --git a/hotspot/src/share/vm/runtime/arguments.hpp b/hotspot/src/share/vm/runtime/arguments.hpp index b806f4800f8..3e9006db782 100644 --- a/hotspot/src/share/vm/runtime/arguments.hpp +++ b/hotspot/src/share/vm/runtime/arguments.hpp @@ -294,10 +294,14 @@ class Arguments : AllStatic { // CMS/ParNew garbage collectors static void set_parnew_gc_flags(); static void set_cms_and_parnew_gc_flags(); - // UseParallelGC + // UseParallel[Old]GC static void set_parallel_gc_flags(); + // Garbage-First (UseG1GC) + static void set_g1_gc_flags(); // GC ergonomics static void set_ergonomics_flags(); + // Setup heap size for a server platform + static void set_server_heap_size(); // Based on automatic selection criteria, should the // low pause collector be used. static bool should_auto_select_low_pause_collector(); diff --git a/hotspot/src/share/vm/runtime/globals.cpp b/hotspot/src/share/vm/runtime/globals.cpp index ffd62d14a66..7d6750b2e4c 100644 --- a/hotspot/src/share/vm/runtime/globals.cpp +++ b/hotspot/src/share/vm/runtime/globals.cpp @@ -174,6 +174,9 @@ void Flag::print_as_flag(outputStream* st) { static Flag flagTable[] = { RUNTIME_FLAGS(RUNTIME_DEVELOP_FLAG_STRUCT, RUNTIME_PD_DEVELOP_FLAG_STRUCT, RUNTIME_PRODUCT_FLAG_STRUCT, RUNTIME_PD_PRODUCT_FLAG_STRUCT, RUNTIME_DIAGNOSTIC_FLAG_STRUCT, RUNTIME_NOTPRODUCT_FLAG_STRUCT, RUNTIME_MANAGEABLE_FLAG_STRUCT, RUNTIME_PRODUCT_RW_FLAG_STRUCT, RUNTIME_LP64_PRODUCT_FLAG_STRUCT) RUNTIME_OS_FLAGS(RUNTIME_DEVELOP_FLAG_STRUCT, RUNTIME_PD_DEVELOP_FLAG_STRUCT, RUNTIME_PRODUCT_FLAG_STRUCT, RUNTIME_PD_PRODUCT_FLAG_STRUCT, RUNTIME_DIAGNOSTIC_FLAG_STRUCT, RUNTIME_NOTPRODUCT_FLAG_STRUCT) +#ifndef SERIALGC + G1_FLAGS(RUNTIME_DEVELOP_FLAG_STRUCT, RUNTIME_PD_DEVELOP_FLAG_STRUCT, RUNTIME_PRODUCT_FLAG_STRUCT, RUNTIME_PD_PRODUCT_FLAG_STRUCT, RUNTIME_DIAGNOSTIC_FLAG_STRUCT, RUNTIME_NOTPRODUCT_FLAG_STRUCT, RUNTIME_MANAGEABLE_FLAG_STRUCT, RUNTIME_PRODUCT_RW_FLAG_STRUCT) +#endif // SERIALGC #ifdef COMPILER1 C1_FLAGS(C1_DEVELOP_FLAG_STRUCT, C1_PD_DEVELOP_FLAG_STRUCT, C1_PRODUCT_FLAG_STRUCT, C1_PD_PRODUCT_FLAG_STRUCT, C1_NOTPRODUCT_FLAG_STRUCT) #endif diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index 5b2c1fda1d6..add7585c97e 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -1106,7 +1106,10 @@ class CommandLineFlags { /* gc */ \ \ product(bool, UseSerialGC, false, \ - "Tells whether the VM should use serial garbage collector") \ + "Use the serial garbage collector") \ + \ + product(bool, UseG1GC, false, \ + "Use the Garbage-First garbage collector") \ \ product(bool, UseParallelGC, false, \ "Use the Parallel Scavenge garbage collector") \ @@ -1169,6 +1172,9 @@ class CommandLineFlags { develop(bool, TraceChunkTasksQueuing, false, \ "Trace the queuing of the chunk tasks") \ \ + product(uintx, ParallelMarkingThreads, 0, \ + "Number of marking threads concurrent gc will use") \ + \ product(uintx, YoungPLABSize, 4096, \ "Size of young gen promotion labs (in HeapWords)") \ \ @@ -1265,6 +1271,12 @@ class CommandLineFlags { "The amount of young gen chosen by default per GC worker " \ "thread available ") \ \ + product(bool, GCOverheadReporting, false, \ + "Enables the GC overhead reporting facility") \ + \ + product(intx, GCOverheadReportingPeriodMS, 100, \ + "Reporting period for conc GC overhead reporting, in ms ") \ + \ product(bool, CMSIncrementalMode, false, \ "Whether CMS GC should operate in \"incremental\" mode") \ \ @@ -1593,6 +1605,9 @@ class CommandLineFlags { product(bool, ZeroTLAB, false, \ "Zero out the newly created TLAB") \ \ + product(bool, FastTLABRefill, true, \ + "Use fast TLAB refill code") \ + \ product(bool, PrintTLAB, false, \ "Print various TLAB related information") \ \ @@ -2790,6 +2805,12 @@ class CommandLineFlags { "how many entries we'll try to leave on the stack during " \ "parallel GC") \ \ + product(intx, DCQBarrierQueueBufferSize, 256, \ + "Number of elements in a dirty card queue buffer") \ + \ + product(intx, DCQBarrierProcessCompletedThreshold, 5, \ + "Number of completed dirty card buffers to trigger processing.") \ + \ /* stack parameters */ \ product_pd(intx, StackYellowPages, \ "Number of yellow zone (recoverable overflows) pages") \ diff --git a/hotspot/src/share/vm/runtime/globals_extension.hpp b/hotspot/src/share/vm/runtime/globals_extension.hpp index ffb8071b250..7475960efb9 100644 --- a/hotspot/src/share/vm/runtime/globals_extension.hpp +++ b/hotspot/src/share/vm/runtime/globals_extension.hpp @@ -74,21 +74,16 @@ #endif typedef enum { - RUNTIME_FLAGS(RUNTIME_DEVELOP_FLAG_MEMBER, RUNTIME_PD_DEVELOP_FLAG_MEMBER, RUNTIME_PRODUCT_FLAG_MEMBER, - RUNTIME_PD_PRODUCT_FLAG_MEMBER, RUNTIME_DIAGNOSTIC_FLAG_MEMBER, - RUNTIME_NOTPRODUCT_FLAG_MEMBER, RUNTIME_MANAGEABLE_FLAG_MEMBER, - RUNTIME_PRODUCT_RW_FLAG_MEMBER, - RUNTIME_LP64_PRODUCT_FLAG_MEMBER) - RUNTIME_OS_FLAGS(RUNTIME_DEVELOP_FLAG_MEMBER, RUNTIME_PD_DEVELOP_FLAG_MEMBER, RUNTIME_PRODUCT_FLAG_MEMBER, - RUNTIME_PD_PRODUCT_FLAG_MEMBER, RUNTIME_DIAGNOSTIC_FLAG_MEMBER, - RUNTIME_NOTPRODUCT_FLAG_MEMBER) + RUNTIME_FLAGS(RUNTIME_DEVELOP_FLAG_MEMBER, RUNTIME_PD_DEVELOP_FLAG_MEMBER, RUNTIME_PRODUCT_FLAG_MEMBER, RUNTIME_PD_PRODUCT_FLAG_MEMBER, RUNTIME_DIAGNOSTIC_FLAG_MEMBER, RUNTIME_NOTPRODUCT_FLAG_MEMBER, RUNTIME_MANAGEABLE_FLAG_MEMBER, RUNTIME_PRODUCT_RW_FLAG_MEMBER, RUNTIME_LP64_PRODUCT_FLAG_MEMBER) + RUNTIME_OS_FLAGS(RUNTIME_DEVELOP_FLAG_MEMBER, RUNTIME_PD_DEVELOP_FLAG_MEMBER, RUNTIME_PRODUCT_FLAG_MEMBER, RUNTIME_PD_PRODUCT_FLAG_MEMBER, RUNTIME_DIAGNOSTIC_FLAG_MEMBER, RUNTIME_NOTPRODUCT_FLAG_MEMBER) +#ifndef KERNEL + G1_FLAGS(RUNTIME_DEVELOP_FLAG_MEMBER, RUNTIME_PD_DEVELOP_FLAG_MEMBER, RUNTIME_PRODUCT_FLAG_MEMBER, RUNTIME_PD_PRODUCT_FLAG_MEMBER, RUNTIME_DIAGNOSTIC_FLAG_MEMBER, RUNTIME_NOTPRODUCT_FLAG_MEMBER, RUNTIME_MANAGEABLE_FLAG_MEMBER, RUNTIME_PRODUCT_RW_FLAG_MEMBER) +#endif #ifdef COMPILER1 - C1_FLAGS(C1_DEVELOP_FLAG_MEMBER, C1_PD_DEVELOP_FLAG_MEMBER, C1_PRODUCT_FLAG_MEMBER, C1_PD_PRODUCT_FLAG_MEMBER, - C1_NOTPRODUCT_FLAG_MEMBER) + C1_FLAGS(C1_DEVELOP_FLAG_MEMBER, C1_PD_DEVELOP_FLAG_MEMBER, C1_PRODUCT_FLAG_MEMBER, C1_PD_PRODUCT_FLAG_MEMBER, C1_NOTPRODUCT_FLAG_MEMBER) #endif #ifdef COMPILER2 - C2_FLAGS(C2_DEVELOP_FLAG_MEMBER, C2_PD_DEVELOP_FLAG_MEMBER, C2_PRODUCT_FLAG_MEMBER, C2_PD_PRODUCT_FLAG_MEMBER, - C2_DIAGNOSTIC_FLAG_MEMBER, C2_NOTPRODUCT_FLAG_MEMBER) + C2_FLAGS(C2_DEVELOP_FLAG_MEMBER, C2_PD_DEVELOP_FLAG_MEMBER, C2_PRODUCT_FLAG_MEMBER, C2_PD_PRODUCT_FLAG_MEMBER, C2_DIAGNOSTIC_FLAG_MEMBER, C2_NOTPRODUCT_FLAG_MEMBER) #endif NUM_CommandLineFlag } CommandLineFlag; @@ -144,24 +139,45 @@ typedef enum { #endif typedef enum { - RUNTIME_FLAGS(RUNTIME_DEVELOP_FLAG_MEMBER_WITH_TYPE, RUNTIME_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE, - RUNTIME_PRODUCT_FLAG_MEMBER_WITH_TYPE, RUNTIME_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE, + RUNTIME_FLAGS(RUNTIME_DEVELOP_FLAG_MEMBER_WITH_TYPE, + RUNTIME_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE, + RUNTIME_PRODUCT_FLAG_MEMBER_WITH_TYPE, + RUNTIME_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE, RUNTIME_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE, RUNTIME_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE, RUNTIME_MANAGEABLE_FLAG_MEMBER_WITH_TYPE, RUNTIME_PRODUCT_RW_FLAG_MEMBER_WITH_TYPE, RUNTIME_LP64_PRODUCT_FLAG_MEMBER_WITH_TYPE) -RUNTIME_OS_FLAGS(RUNTIME_DEVELOP_FLAG_MEMBER_WITH_TYPE, RUNTIME_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE, - RUNTIME_PRODUCT_FLAG_MEMBER_WITH_TYPE, RUNTIME_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE, - RUNTIME_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE, - RUNTIME_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE) + RUNTIME_OS_FLAGS(RUNTIME_DEVELOP_FLAG_MEMBER_WITH_TYPE, + RUNTIME_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE, + RUNTIME_PRODUCT_FLAG_MEMBER_WITH_TYPE, + RUNTIME_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE, + RUNTIME_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE, + RUNTIME_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE) +#ifndef KERNEL + G1_FLAGS(RUNTIME_DEVELOP_FLAG_MEMBER_WITH_TYPE, + RUNTIME_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE, + RUNTIME_PRODUCT_FLAG_MEMBER_WITH_TYPE, + RUNTIME_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE, + RUNTIME_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE, + RUNTIME_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE, + RUNTIME_MANAGEABLE_FLAG_MEMBER_WITH_TYPE, + RUNTIME_PRODUCT_RW_FLAG_MEMBER_WITH_TYPE) +#endif // KERNEL #ifdef COMPILER1 - C1_FLAGS(C1_DEVELOP_FLAG_MEMBER_WITH_TYPE, C1_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE, C1_PRODUCT_FLAG_MEMBER_WITH_TYPE, - C1_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE, C1_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE) + C1_FLAGS(C1_DEVELOP_FLAG_MEMBER_WITH_TYPE, + C1_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE, + C1_PRODUCT_FLAG_MEMBER_WITH_TYPE, + C1_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE, + C1_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE) #endif #ifdef COMPILER2 - C2_FLAGS(C2_DEVELOP_FLAG_MEMBER_WITH_TYPE, C2_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE, C2_PRODUCT_FLAG_MEMBER_WITH_TYPE, - C2_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE, C2_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE, C2_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE) + C2_FLAGS(C2_DEVELOP_FLAG_MEMBER_WITH_TYPE, + C2_PD_DEVELOP_FLAG_MEMBER_WITH_TYPE, + C2_PRODUCT_FLAG_MEMBER_WITH_TYPE, + C2_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE, + C2_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE, + C2_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE) #endif NUM_CommandLineFlagWithType } CommandLineFlagWithType; diff --git a/hotspot/src/share/vm/runtime/mutexLocker.cpp b/hotspot/src/share/vm/runtime/mutexLocker.cpp index a639519d26d..91269572c03 100644 --- a/hotspot/src/share/vm/runtime/mutexLocker.cpp +++ b/hotspot/src/share/vm/runtime/mutexLocker.cpp @@ -47,7 +47,7 @@ Mutex* JfieldIdCreation_lock = NULL; Monitor* JNICritical_lock = NULL; Mutex* JvmtiThreadState_lock = NULL; Monitor* JvmtiPendingEvent_lock = NULL; -Mutex* Heap_lock = NULL; +Monitor* Heap_lock = NULL; Mutex* ExpandHeap_lock = NULL; Mutex* AdapterHandlerLibrary_lock = NULL; Mutex* SignatureHandlerLibrary_lock = NULL; @@ -67,7 +67,18 @@ Mutex* STS_init_lock = NULL; Monitor* SLT_lock = NULL; Monitor* iCMS_lock = NULL; Monitor* FullGCCount_lock = NULL; +Monitor* CMark_lock = NULL; +Monitor* ZF_mon = NULL; +Monitor* Cleanup_mon = NULL; +Monitor* G1ConcRefine_mon = NULL; +Mutex* SATB_Q_FL_lock = NULL; +Monitor* SATB_Q_CBL_mon = NULL; +Mutex* Shared_SATB_Q_lock = NULL; +Mutex* DirtyCardQ_FL_lock = NULL; +Monitor* DirtyCardQ_CBL_mon = NULL; +Mutex* Shared_DirtyCardQ_lock = NULL; Mutex* ParGCRareEvent_lock = NULL; +Mutex* EvacFailureStack_lock = NULL; Mutex* DerivedPointerTableGC_lock = NULL; Mutex* Compile_lock = NULL; Monitor* MethodCompileQueue_lock = NULL; @@ -102,6 +113,9 @@ Mutex* PerfDataMemAlloc_lock = NULL; Mutex* PerfDataManager_lock = NULL; Mutex* OopMapCacheAlloc_lock = NULL; +Mutex* MMUTracker_lock = NULL; +Mutex* HotCardCache_lock = NULL; + Monitor* GCTaskManager_lock = NULL; Mutex* Management_lock = NULL; @@ -150,6 +164,23 @@ void mutex_init() { def(iCMS_lock , Monitor, special, true ); // CMS incremental mode start/stop notification def(FullGCCount_lock , Monitor, leaf, true ); // in support of ExplicitGCInvokesConcurrent } + if (UseG1GC) { + def(CMark_lock , Monitor, nonleaf, true ); // coordinate concurrent mark thread + def(ZF_mon , Monitor, leaf, true ); + def(Cleanup_mon , Monitor, nonleaf, true ); + def(G1ConcRefine_mon , Monitor, nonleaf, 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 ); + + def(DirtyCardQ_FL_lock , Mutex , special, true ); + def(DirtyCardQ_CBL_mon , Monitor, nonleaf, true ); + def(Shared_DirtyCardQ_lock , Mutex, nonleaf, true ); + + def(MMUTracker_lock , Mutex , leaf , true ); + def(HotCardCache_lock , Mutex , special , true ); + def(EvacFailureStack_lock , Mutex , nonleaf , true ); + } def(ParGCRareEvent_lock , Mutex , leaf , true ); def(DerivedPointerTableGC_lock , Mutex, leaf, true ); def(CodeCache_lock , Mutex , special, true ); @@ -203,7 +234,7 @@ void mutex_init() { def(SLT_lock , Monitor, nonleaf, false ); // used in CMS GC for locking PLL lock } - def(Heap_lock , Mutex , nonleaf+1, false); + def(Heap_lock , Monitor, nonleaf+1, false); def(JfieldIdCreation_lock , Mutex , nonleaf+1, true ); // jfieldID, Used in VM_Operation def(JNICachedItableIndex_lock , Mutex , nonleaf+1, false); // Used to cache an itable index during JNI invoke diff --git a/hotspot/src/share/vm/runtime/mutexLocker.hpp b/hotspot/src/share/vm/runtime/mutexLocker.hpp index e21367cb960..c6835da6cee 100644 --- a/hotspot/src/share/vm/runtime/mutexLocker.hpp +++ b/hotspot/src/share/vm/runtime/mutexLocker.hpp @@ -38,7 +38,7 @@ extern Mutex* JfieldIdCreation_lock; // a lock on creating JNI stati extern Monitor* JNICritical_lock; // a lock used while entering and exiting JNI critical regions, allows GC to sometimes get in extern Mutex* JvmtiThreadState_lock; // a lock on modification of JVMTI thread data extern Monitor* JvmtiPendingEvent_lock; // a lock on the JVMTI pending events list -extern Mutex* Heap_lock; // a lock on the heap +extern Monitor* Heap_lock; // a lock on the heap extern Mutex* ExpandHeap_lock; // a lock on expanding the heap extern Mutex* AdapterHandlerLibrary_lock; // a lock on the AdapterHandlerLibrary extern Mutex* SignatureHandlerLibrary_lock; // a lock on the SignatureHandlerLibrary @@ -60,8 +60,30 @@ extern Mutex* STS_init_lock; // coordinate initialization of extern Monitor* SLT_lock; // used in CMS GC for acquiring PLL extern Monitor* iCMS_lock; // CMS incremental mode start/stop notification extern Monitor* FullGCCount_lock; // in support of "concurrent" full gc +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 Monitor* G1ConcRefine_mon; // used for G1 conc-refine + // coordination. + +extern Mutex* SATB_Q_FL_lock; // Protects SATB Q + // buffer free list. +extern Monitor* SATB_Q_CBL_mon; // Protects SATB Q + // completed buffer queue. +extern Mutex* Shared_SATB_Q_lock; // Lock protecting SATB + // queue shared by + // non-Java threads. + +extern Mutex* DirtyCardQ_FL_lock; // Protects dirty card Q + // buffer free list. +extern Monitor* DirtyCardQ_CBL_mon; // Protects dirty card Q + // completed buffer queue. +extern Mutex* Shared_DirtyCardQ_lock; // Lock protecting dirty card + // queue shared by + // non-Java threads. // (see option ExplicitGCInvokesConcurrent) extern Mutex* ParGCRareEvent_lock; // Synchronizes various (rare) parallel GC ops. +extern Mutex* EvacFailureStack_lock; // guards the evac failure scan stack extern Mutex* Compile_lock; // a lock held when Compilation is updating code (used to block CodeCache traversal, CHA updates, etc) extern Monitor* MethodCompileQueue_lock; // a lock held when method compilations are enqueued, dequeued #ifdef TIERED @@ -93,6 +115,10 @@ extern Mutex* PerfDataManager_lock; // a long on access to PerfData extern Mutex* ParkerFreeList_lock; extern Mutex* OopMapCacheAlloc_lock; // protects allocation of oop_map caches +extern Mutex* MMUTracker_lock; // protects the MMU + // tracker data structures +extern Mutex* HotCardCache_lock; // protects the hot card cache + extern Mutex* Management_lock; // a lock used to serialize JVM management extern Monitor* LowMemory_lock; // a lock used for low memory detection diff --git a/hotspot/src/share/vm/runtime/os.hpp b/hotspot/src/share/vm/runtime/os.hpp index 547b25d434c..2560fad7855 100644 --- a/hotspot/src/share/vm/runtime/os.hpp +++ b/hotspot/src/share/vm/runtime/os.hpp @@ -105,6 +105,18 @@ class os: AllStatic { static jlong elapsed_counter(); static jlong elapsed_frequency(); + // The "virtual time" of a thread is the amount of time a thread has + // actually run. The first function indicates whether the OS supports + // this functionality for the current thread, and if so: + // * the second enables vtime tracking (if that is required). + // * the third tells whether vtime is enabled. + // * the fourth returns the elapsed virtual time for the current + // thread. + static bool supports_vtime(); + static bool enable_vtime(); + static bool vtime_enabled(); + static double elapsedVTime(); + // Return current local time in a string (YYYY-MM-DD HH:MM:SS). // It is MT safe, but not async-safe, as reading time zone // information may require a lock on some platforms. diff --git a/hotspot/src/share/vm/runtime/sharedRuntime.cpp b/hotspot/src/share/vm/runtime/sharedRuntime.cpp index 59219cda39d..778a4f5eaf3 100644 --- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp +++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp @@ -111,6 +111,25 @@ void SharedRuntime::print_ic_miss_histogram() { } #endif // PRODUCT +#ifndef SERIALGC + +// G1 write-barrier pre: executed before a pointer store. +JRT_LEAF(void, SharedRuntime::g1_wb_pre(oopDesc* orig, JavaThread *thread)) + if (orig == NULL) { + assert(false, "should be optimized out"); + return; + } + // store the original value that was in the field reference + thread->satb_mark_queue().enqueue(orig); +JRT_END + +// G1 write-barrier post: executed after a pointer store. +JRT_LEAF(void, SharedRuntime::g1_wb_post(void* card_addr, JavaThread* thread)) + thread->dirty_card_queue().enqueue(card_addr); +JRT_END + +#endif // !SERIALGC + JRT_LEAF(jlong, SharedRuntime::lmul(jlong y, jlong x)) return x * y; diff --git a/hotspot/src/share/vm/runtime/sharedRuntime.hpp b/hotspot/src/share/vm/runtime/sharedRuntime.hpp index 22bb552ddc9..bdeac14aee6 100644 --- a/hotspot/src/share/vm/runtime/sharedRuntime.hpp +++ b/hotspot/src/share/vm/runtime/sharedRuntime.hpp @@ -99,6 +99,12 @@ class SharedRuntime: AllStatic { static address raw_exception_handler_for_return_address(address return_address); static address exception_handler_for_return_address(address return_address); +#ifndef SERIALGC + // G1 write barriers + static void g1_wb_pre(oopDesc* orig, JavaThread *thread); + static void g1_wb_post(void* card_addr, JavaThread* thread); +#endif // !SERIALGC + // exception handling and implicit exceptions static address compute_compiled_exc_handler(nmethod* nm, address ret_pc, Handle& exception, bool force_unwind, bool top_frame_only); diff --git a/hotspot/src/share/vm/runtime/task.cpp b/hotspot/src/share/vm/runtime/task.cpp index 68959a120d2..4921b07a456 100644 --- a/hotspot/src/share/vm/runtime/task.cpp +++ b/hotspot/src/share/vm/runtime/task.cpp @@ -67,7 +67,6 @@ void PeriodicTask::real_time_tick(size_t delay_time) { PeriodicTask::PeriodicTask(size_t interval_time) : _counter(0), _interval(interval_time) { - assert(is_init_completed(), "Periodic tasks should not start during VM initialization"); // Sanity check the interval time assert(_interval >= PeriodicTask::min_interval && _interval <= PeriodicTask::max_interval && diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp index 21f8a4b76ee..3599887a2b7 100644 --- a/hotspot/src/share/vm/runtime/thread.cpp +++ b/hotspot/src/share/vm/runtime/thread.cpp @@ -1138,6 +1138,10 @@ void WatcherThread::print_on(outputStream* st) const { void JavaThread::initialize() { // Initialize fields + + // Set the claimed par_id to -1 (ie not claiming any par_ids) + set_claimed_par_id(-1); + set_saved_exception_pc(NULL); set_threadObj(NULL); _anchor.clear(); @@ -1209,7 +1213,18 @@ void JavaThread::initialize() { pd_initialize(); } -JavaThread::JavaThread(bool is_attaching) : Thread() { +#ifndef SERIALGC +SATBMarkQueueSet JavaThread::_satb_mark_queue_set; +DirtyCardQueueSet JavaThread::_dirty_card_queue_set; +#endif // !SERIALGC + +JavaThread::JavaThread(bool is_attaching) : + Thread() +#ifndef SERIALGC + , _satb_mark_queue(&_satb_mark_queue_set), + _dirty_card_queue(&_dirty_card_queue_set) +#endif // !SERIALGC +{ initialize(); _is_attaching = is_attaching; } @@ -1255,7 +1270,13 @@ void JavaThread::block_if_vm_exited() { // Remove this ifdef when C1 is ported to the compiler interface. static void compiler_thread_entry(JavaThread* thread, TRAPS); -JavaThread::JavaThread(ThreadFunction entry_point, size_t stack_sz) : Thread() { +JavaThread::JavaThread(ThreadFunction entry_point, size_t stack_sz) : + Thread() +#ifndef SERIALGC + , _satb_mark_queue(&_satb_mark_queue_set), + _dirty_card_queue(&_dirty_card_queue_set) +#endif // !SERIALGC +{ if (TraceThreadEvents) { tty->print_cr("creating thread %p", this); } @@ -3034,9 +3055,14 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) { #ifndef SERIALGC // Support for ConcurrentMarkSweep. This should be cleaned up - // and better encapsulated. XXX YSR - if (UseConcMarkSweepGC) { - ConcurrentMarkSweepThread::makeSurrogateLockerThread(THREAD); + // and better encapsulated. The ugly nested if test would go away + // once things are properly refactored. XXX YSR + if (UseConcMarkSweepGC || UseG1GC) { + if (UseConcMarkSweepGC) { + ConcurrentMarkSweepThread::makeSurrogateLockerThread(THREAD); + } else { + ConcurrentMarkThread::makeSurrogateLockerThread(THREAD); + } if (HAS_PENDING_EXCEPTION) { vm_exit_during_initialization(Handle(THREAD, PENDING_EXCEPTION)); } diff --git a/hotspot/src/share/vm/runtime/thread.hpp b/hotspot/src/share/vm/runtime/thread.hpp index 72277e039b3..8d05504bb6a 100644 --- a/hotspot/src/share/vm/runtime/thread.hpp +++ b/hotspot/src/share/vm/runtime/thread.hpp @@ -783,6 +783,18 @@ class JavaThread: public Thread { } _jmp_ring[ jump_ring_buffer_size ]; #endif /* PRODUCT */ +#ifndef SERIALGC + // Support for G1 barriers + + ObjPtrQueue _satb_mark_queue; // Thread-local log for SATB barrier. + // Set of all such queues. + static SATBMarkQueueSet _satb_mark_queue_set; + + DirtyCardQueue _dirty_card_queue; // Thread-local log for dirty cards. + // Set of all such queues. + static DirtyCardQueueSet _dirty_card_queue_set; +#endif // !SERIALGC + friend class VMThread; friend class ThreadWaitTransition; friend class VM_Exit; @@ -1168,6 +1180,11 @@ class JavaThread: public Thread { static ByteSize do_not_unlock_if_synchronized_offset() { return byte_offset_of(JavaThread, _do_not_unlock_if_synchronized); } +#ifndef SERIALGC + static ByteSize satb_mark_queue_offset() { return byte_offset_of(JavaThread, _satb_mark_queue); } + static ByteSize dirty_card_queue_offset() { return byte_offset_of(JavaThread, _dirty_card_queue); } +#endif // !SERIALGC + // Returns the jni environment for this thread JNIEnv* jni_environment() { return &_jni_environment; } @@ -1414,6 +1431,20 @@ public: _stack_size_at_create = value; } +#ifndef SERIALGC + // SATB marking queue support + ObjPtrQueue& satb_mark_queue() { return _satb_mark_queue; } + static SATBMarkQueueSet& satb_mark_queue_set() { + return _satb_mark_queue_set; + } + + // Dirty card queue support + DirtyCardQueue& dirty_card_queue() { return _dirty_card_queue; } + static DirtyCardQueueSet& dirty_card_queue_set() { + return _dirty_card_queue_set; + } +#endif // !SERIALGC + // Machine dependent stuff #include "incls/_thread_pd.hpp.incl" @@ -1445,6 +1476,14 @@ public: // clearing/querying jni attach status bool is_attaching() const { return _is_attaching; } void set_attached() { _is_attaching = false; OrderAccess::fence(); } +private: + // This field is used to determine if a thread has claimed + // a par_id: it is -1 if the thread has not claimed a par_id; + // otherwise its value is the par_id that has been claimed. + int _claimed_par_id; +public: + int get_claimed_par_id() { return _claimed_par_id; } + void set_claimed_par_id(int id) { _claimed_par_id = id;} }; // Inline implementation of JavaThread::current diff --git a/hotspot/src/share/vm/runtime/virtualspace.cpp b/hotspot/src/share/vm/runtime/virtualspace.cpp index 23b75dc9dd4..ed0d837dea1 100644 --- a/hotspot/src/share/vm/runtime/virtualspace.cpp +++ b/hotspot/src/share/vm/runtime/virtualspace.cpp @@ -235,24 +235,16 @@ void ReservedSpace::initialize(size_t size, size_t alignment, bool large, // increase size to a multiple of the desired alignment size = align_size_up(size, alignment); size_t extra_size = size + alignment; - char* extra_base = os::reserve_memory(extra_size, NULL, alignment); - if (extra_base == NULL) return; - // Do manual alignement - base = (char*) align_size_up((uintptr_t) extra_base, alignment); - assert(base >= extra_base, "just checking"); - // Release unused areas - size_t unused_bottom_size = base - extra_base; - size_t unused_top_size = extra_size - size - unused_bottom_size; - assert(unused_bottom_size % os::vm_allocation_granularity() == 0, - "size not allocation aligned"); - assert(unused_top_size % os::vm_allocation_granularity() == 0, - "size not allocation aligned"); - if (unused_bottom_size > 0) { - os::release_memory(extra_base, unused_bottom_size); - } - if (unused_top_size > 0) { - os::release_memory(base + size, unused_top_size); - } + do { + char* extra_base = os::reserve_memory(extra_size, NULL, alignment); + if (extra_base == NULL) return; + // Do manual alignement + base = (char*) align_size_up((uintptr_t) extra_base, alignment); + assert(base >= extra_base, "just checking"); + // Re-reserve the region at the aligned base address. + os::release_memory(extra_base, extra_size); + base = os::reserve_memory(size, base); + } while (base == NULL); } } // Done diff --git a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp index 561389eaa92..db336c44ebe 100644 --- a/hotspot/src/share/vm/runtime/vmStructs.cpp +++ b/hotspot/src/share/vm/runtime/vmStructs.cpp @@ -302,7 +302,7 @@ static inline uint64_t cast_uint64_t(size_t x) nonstatic_field(CardTableModRefBS, _guard_region, MemRegion) \ nonstatic_field(CardTableModRefBS, byte_map_base, jbyte*) \ \ - nonstatic_field(CardTableRS, _ct_bs, CardTableModRefBS) \ + nonstatic_field(CardTableRS, _ct_bs, CardTableModRefBSForCTRS*) \ \ nonstatic_field(CollectedHeap, _reserved, MemRegion) \ nonstatic_field(SharedHeap, _perm_gen, PermGen*) \ @@ -993,6 +993,7 @@ static inline uint64_t cast_uint64_t(size_t x) declare_toplevel_type(BarrierSet) \ declare_type(ModRefBarrierSet, BarrierSet) \ declare_type(CardTableModRefBS, ModRefBarrierSet) \ + declare_type(CardTableModRefBSForCTRS, CardTableModRefBS) \ declare_toplevel_type(GenRemSet) \ declare_type(CardTableRS, GenRemSet) \ declare_toplevel_type(BlockOffsetSharedArray) \ @@ -1020,6 +1021,10 @@ static inline uint64_t cast_uint64_t(size_t x) declare_toplevel_type(BlockOffsetSharedArray*) \ declare_toplevel_type(GenRemSet*) \ declare_toplevel_type(CardTableRS*) \ + declare_toplevel_type(CardTableModRefBS*) \ + declare_toplevel_type(CardTableModRefBS**) \ + declare_toplevel_type(CardTableModRefBSForCTRS*) \ + declare_toplevel_type(CardTableModRefBSForCTRS**) \ declare_toplevel_type(CollectedHeap*) \ declare_toplevel_type(ContiguousSpace*) \ declare_toplevel_type(DefNewGeneration*) \ diff --git a/hotspot/src/share/vm/runtime/vm_operations.hpp b/hotspot/src/share/vm/runtime/vm_operations.hpp index 54264ad0dde..333e84c453b 100644 --- a/hotspot/src/share/vm/runtime/vm_operations.hpp +++ b/hotspot/src/share/vm/runtime/vm_operations.hpp @@ -53,8 +53,13 @@ template(ParallelGCFailedAllocation) \ template(ParallelGCFailedPermanentAllocation) \ template(ParallelGCSystemGC) \ + template(CGC_Operation) \ template(CMS_Initial_Mark) \ template(CMS_Final_Remark) \ + template(G1CollectFull) \ + template(G1CollectForAllocation) \ + template(G1IncCollectionPause) \ + template(G1PopRegionCollectionPause) \ template(EnableBiasedLocking) \ template(RevokeBias) \ template(BulkRevokeBias) \ diff --git a/hotspot/src/share/vm/services/heapDumper.cpp b/hotspot/src/share/vm/services/heapDumper.cpp index 1a30c05b5c1..6da45528b96 100644 --- a/hotspot/src/share/vm/services/heapDumper.cpp +++ b/hotspot/src/share/vm/services/heapDumper.cpp @@ -1578,17 +1578,8 @@ void VM_HeapDumper::doit() { } // Write the file header - use 1.0.2 for large heaps, otherwise 1.0.1 - size_t used; + size_t used = ch->used(); const char* header; -#ifndef SERIALGC - if (Universe::heap()->kind() == CollectedHeap::GenCollectedHeap) { - used = GenCollectedHeap::heap()->used(); - } else { - used = ParallelScavengeHeap::heap()->used(); - } -#else // SERIALGC - used = GenCollectedHeap::heap()->used(); -#endif // SERIALGC if (used > (size_t)SegmentedHeapDumpThreshold) { set_segmented_dump(); header = "JAVA PROFILE 1.0.2"; diff --git a/hotspot/src/share/vm/services/memoryService.cpp b/hotspot/src/share/vm/services/memoryService.cpp index 176f11e89bb..1d243828c77 100644 --- a/hotspot/src/share/vm/services/memoryService.cpp +++ b/hotspot/src/share/vm/services/memoryService.cpp @@ -59,9 +59,13 @@ void MemoryService::set_universe_heap(CollectedHeap* heap) { add_parallel_scavenge_heap_info(ParallelScavengeHeap::heap()); break; } + case CollectedHeap::G1CollectedHeap : { + G1CollectedHeap::g1_unimplemented(); + return; + } #endif // SERIALGC default: { - guarantee(false, "Not recognized kind of heap"); + guarantee(false, "Unrecognized kind of heap"); } } diff --git a/hotspot/src/share/vm/utilities/bitMap.cpp b/hotspot/src/share/vm/utilities/bitMap.cpp index b1d466b3e29..13f4721ca56 100644 --- a/hotspot/src/share/vm/utilities/bitMap.cpp +++ b/hotspot/src/share/vm/utilities/bitMap.cpp @@ -26,54 +26,59 @@ # include "incls/_bitMap.cpp.incl" -BitMap::BitMap(idx_t* map, idx_t size_in_bits) { +BitMap::BitMap(bm_word_t* map, idx_t size_in_bits) : + _map(map), _size(size_in_bits) +{ + assert(sizeof(bm_word_t) == BytesPerWord, "Implementation assumption."); assert(size_in_bits >= 0, "just checking"); - _map = map; - _size = size_in_bits; } -BitMap::BitMap(idx_t size_in_bits) { - assert(size_in_bits >= 0, "just checking"); - _size = size_in_bits; - _map = NEW_RESOURCE_ARRAY(idx_t, size_in_words()); +BitMap::BitMap(idx_t size_in_bits, bool in_resource_area) : + _map(NULL), _size(0) +{ + assert(sizeof(bm_word_t) == BytesPerWord, "Implementation assumption."); + resize(size_in_bits, in_resource_area); } -void BitMap::resize(idx_t size_in_bits) { +void BitMap::verify_index(idx_t index) const { + assert(index < _size, "BitMap index out of bounds"); +} + +void BitMap::verify_range(idx_t beg_index, idx_t end_index) const { +#ifdef ASSERT + assert(beg_index <= end_index, "BitMap range error"); + // Note that [0,0) and [size,size) are both valid ranges. + if (end_index != _size) verify_index(end_index); +#endif +} + +void BitMap::resize(idx_t size_in_bits, bool in_resource_area) { assert(size_in_bits >= 0, "just checking"); - size_t old_size_in_words = size_in_words(); - uintptr_t* old_map = map(); + idx_t old_size_in_words = size_in_words(); + bm_word_t* old_map = map(); + _size = size_in_bits; - size_t new_size_in_words = size_in_words(); - _map = NEW_RESOURCE_ARRAY(idx_t, new_size_in_words); - Copy::disjoint_words((HeapWord*) old_map, (HeapWord*) _map, MIN2(old_size_in_words, new_size_in_words)); + idx_t new_size_in_words = size_in_words(); + if (in_resource_area) { + _map = NEW_RESOURCE_ARRAY(bm_word_t, new_size_in_words); + } else { + if (old_map != NULL) FREE_C_HEAP_ARRAY(bm_word_t, _map); + _map = NEW_C_HEAP_ARRAY(bm_word_t, new_size_in_words); + } + Copy::disjoint_words((HeapWord*)old_map, (HeapWord*) _map, + MIN2(old_size_in_words, new_size_in_words)); if (new_size_in_words > old_size_in_words) { clear_range_of_words(old_size_in_words, size_in_words()); } } -// Returns a bit mask for a range of bits [beg, end) within a single word. Each -// bit in the mask is 0 if the bit is in the range, 1 if not in the range. The -// returned mask can be used directly to clear the range, or inverted to set the -// range. Note: end must not be 0. -inline BitMap::idx_t -BitMap::inverted_bit_mask_for_range(idx_t beg, idx_t end) const { - assert(end != 0, "does not work when end == 0"); - assert(beg == end || word_index(beg) == word_index(end - 1), - "must be a single-word range"); - idx_t mask = bit_mask(beg) - 1; // low (right) bits - if (bit_in_word(end) != 0) { - mask |= ~(bit_mask(end) - 1); // high (left) bits - } - return mask; -} - void BitMap::set_range_within_word(idx_t beg, idx_t end) { // With a valid range (beg <= end), this test ensures that end != 0, as // required by inverted_bit_mask_for_range. Also avoids an unnecessary write. if (beg != end) { - idx_t mask = inverted_bit_mask_for_range(beg, end); + bm_word_t mask = inverted_bit_mask_for_range(beg, end); *word_addr(beg) |= ~mask; } } @@ -82,7 +87,7 @@ void BitMap::clear_range_within_word(idx_t beg, idx_t end) { // With a valid range (beg <= end), this test ensures that end != 0, as // required by inverted_bit_mask_for_range. Also avoids an unnecessary write. if (beg != end) { - idx_t mask = inverted_bit_mask_for_range(beg, end); + bm_word_t mask = inverted_bit_mask_for_range(beg, end); *word_addr(beg) &= mask; } } @@ -105,20 +110,6 @@ void BitMap::par_put_range_within_word(idx_t beg, idx_t end, bool value) { } } -inline void BitMap::set_large_range_of_words(idx_t beg, idx_t end) { - memset(_map + beg, ~(unsigned char)0, (end - beg) * sizeof(uintptr_t)); -} - -inline void BitMap::clear_large_range_of_words(idx_t beg, idx_t end) { - memset(_map + beg, 0, (end - beg) * sizeof(uintptr_t)); -} - -inline BitMap::idx_t BitMap::word_index_round_up(idx_t bit) const { - idx_t bit_rounded_up = bit + (BitsPerWord - 1); - // Check for integer arithmetic overflow. - return bit_rounded_up > bit ? word_index(bit_rounded_up) : size_in_words(); -} - void BitMap::set_range(idx_t beg, idx_t end) { verify_range(beg, end); @@ -187,6 +178,64 @@ void BitMap::clear_large_range(idx_t beg, idx_t end) { clear_range_within_word(bit_index(end_full_word), end); } +void BitMap::mostly_disjoint_range_union(BitMap* from_bitmap, + idx_t from_start_index, + idx_t to_start_index, + size_t word_num) { + // Ensure that the parameters are correct. + // These shouldn't be that expensive to check, hence I left them as + // guarantees. + guarantee(from_bitmap->bit_in_word(from_start_index) == 0, + "it should be aligned on a word boundary"); + guarantee(bit_in_word(to_start_index) == 0, + "it should be aligned on a word boundary"); + guarantee(word_num >= 2, "word_num should be at least 2"); + + intptr_t* from = (intptr_t*) from_bitmap->word_addr(from_start_index); + intptr_t* to = (intptr_t*) word_addr(to_start_index); + + if (*from != 0) { + // if it's 0, then there's no point in doing the CAS + while (true) { + intptr_t old_value = *to; + intptr_t new_value = old_value | *from; + intptr_t res = Atomic::cmpxchg_ptr(new_value, to, old_value); + if (res == old_value) break; + } + } + ++from; + ++to; + + for (size_t i = 0; i < word_num - 2; ++i) { + if (*from != 0) { + // if it's 0, then there's no point in doing the CAS + assert(*to == 0, "nobody else should be writing here"); + intptr_t new_value = *from; + *to = new_value; + } + + ++from; + ++to; + } + + if (*from != 0) { + // if it's 0, then there's no point in doing the CAS + while (true) { + intptr_t old_value = *to; + intptr_t new_value = old_value | *from; + intptr_t res = Atomic::cmpxchg_ptr(new_value, to, old_value); + if (res == old_value) break; + } + } + + // the -1 is because we didn't advance them after the final CAS + assert(from == + (intptr_t*) from_bitmap->word_addr(from_start_index) + word_num - 1, + "invariant"); + assert(to == (intptr_t*) word_addr(to_start_index) + word_num - 1, + "invariant"); +} + void BitMap::at_put(idx_t offset, bool value) { if (value) { set_bit(offset); @@ -282,11 +331,11 @@ void BitMap::par_at_put_large_range(idx_t beg, idx_t end, bool value) { bool BitMap::contains(const BitMap other) const { assert(size() == other.size(), "must have same size"); - uintptr_t* dest_map = map(); - uintptr_t* other_map = other.map(); + bm_word_t* dest_map = map(); + bm_word_t* other_map = other.map(); idx_t size = size_in_words(); for (idx_t index = 0; index < size_in_words(); index++) { - uintptr_t word_union = dest_map[index] | other_map[index]; + bm_word_t word_union = dest_map[index] | other_map[index]; // If this has more bits set than dest_map[index], then other is not a // subset. if (word_union != dest_map[index]) return false; @@ -296,8 +345,8 @@ bool BitMap::contains(const BitMap other) const { bool BitMap::intersects(const BitMap other) const { assert(size() == other.size(), "must have same size"); - uintptr_t* dest_map = map(); - uintptr_t* other_map = other.map(); + bm_word_t* dest_map = map(); + bm_word_t* other_map = other.map(); idx_t size = size_in_words(); for (idx_t index = 0; index < size_in_words(); index++) { if ((dest_map[index] & other_map[index]) != 0) return true; @@ -308,8 +357,8 @@ bool BitMap::intersects(const BitMap other) const { void BitMap::set_union(BitMap other) { assert(size() == other.size(), "must have same size"); - idx_t* dest_map = map(); - idx_t* other_map = other.map(); + bm_word_t* dest_map = map(); + bm_word_t* other_map = other.map(); idx_t size = size_in_words(); for (idx_t index = 0; index < size_in_words(); index++) { dest_map[index] = dest_map[index] | other_map[index]; @@ -319,8 +368,8 @@ void BitMap::set_union(BitMap other) { void BitMap::set_difference(BitMap other) { assert(size() == other.size(), "must have same size"); - idx_t* dest_map = map(); - idx_t* other_map = other.map(); + bm_word_t* dest_map = map(); + bm_word_t* other_map = other.map(); idx_t size = size_in_words(); for (idx_t index = 0; index < size_in_words(); index++) { dest_map[index] = dest_map[index] & ~(other_map[index]); @@ -330,8 +379,8 @@ void BitMap::set_difference(BitMap other) { void BitMap::set_intersection(BitMap other) { assert(size() == other.size(), "must have same size"); - idx_t* dest_map = map(); - idx_t* other_map = other.map(); + bm_word_t* dest_map = map(); + bm_word_t* other_map = other.map(); idx_t size = size_in_words(); for (idx_t index = 0; index < size; index++) { dest_map[index] = dest_map[index] & other_map[index]; @@ -339,11 +388,26 @@ void BitMap::set_intersection(BitMap other) { } +void BitMap::set_intersection_at_offset(BitMap other, idx_t offset) { + assert(other.size() >= offset, "offset not in range"); + assert(other.size() - offset >= size(), "other not large enough"); + // XXX Ideally, we would remove this restriction. + guarantee((offset % (sizeof(bm_word_t) * BitsPerByte)) == 0, + "Only handle aligned cases so far."); + bm_word_t* dest_map = map(); + bm_word_t* other_map = other.map(); + idx_t offset_word_ind = word_index(offset); + idx_t size = size_in_words(); + for (idx_t index = 0; index < size; index++) { + dest_map[index] = dest_map[index] & other_map[offset_word_ind + index]; + } +} + bool BitMap::set_union_with_result(BitMap other) { assert(size() == other.size(), "must have same size"); bool changed = false; - idx_t* dest_map = map(); - idx_t* other_map = other.map(); + bm_word_t* dest_map = map(); + bm_word_t* other_map = other.map(); idx_t size = size_in_words(); for (idx_t index = 0; index < size; index++) { idx_t temp = map(index) | other_map[index]; @@ -357,11 +421,11 @@ bool BitMap::set_union_with_result(BitMap other) { bool BitMap::set_difference_with_result(BitMap other) { assert(size() == other.size(), "must have same size"); bool changed = false; - idx_t* dest_map = map(); - idx_t* other_map = other.map(); + bm_word_t* dest_map = map(); + bm_word_t* other_map = other.map(); idx_t size = size_in_words(); for (idx_t index = 0; index < size; index++) { - idx_t temp = dest_map[index] & ~(other_map[index]); + bm_word_t temp = dest_map[index] & ~(other_map[index]); changed = changed || (temp != dest_map[index]); dest_map[index] = temp; } @@ -372,12 +436,12 @@ bool BitMap::set_difference_with_result(BitMap other) { bool BitMap::set_intersection_with_result(BitMap other) { assert(size() == other.size(), "must have same size"); bool changed = false; - idx_t* dest_map = map(); - idx_t* other_map = other.map(); + bm_word_t* dest_map = map(); + bm_word_t* other_map = other.map(); idx_t size = size_in_words(); for (idx_t index = 0; index < size; index++) { - idx_t orig = dest_map[index]; - idx_t temp = orig & other_map[index]; + bm_word_t orig = dest_map[index]; + bm_word_t temp = orig & other_map[index]; changed = changed || (temp != orig); dest_map[index] = temp; } @@ -387,8 +451,8 @@ bool BitMap::set_intersection_with_result(BitMap other) { void BitMap::set_from(BitMap other) { assert(size() == other.size(), "must have same size"); - idx_t* dest_map = map(); - idx_t* other_map = other.map(); + bm_word_t* dest_map = map(); + bm_word_t* other_map = other.map(); idx_t size = size_in_words(); for (idx_t index = 0; index < size; index++) { dest_map[index] = other_map[index]; @@ -398,8 +462,8 @@ void BitMap::set_from(BitMap other) { bool BitMap::is_same(BitMap other) { assert(size() == other.size(), "must have same size"); - idx_t* dest_map = map(); - idx_t* other_map = other.map(); + bm_word_t* dest_map = map(); + bm_word_t* other_map = other.map(); idx_t size = size_in_words(); for (idx_t index = 0; index < size; index++) { if (dest_map[index] != other_map[index]) return false; @@ -408,24 +472,24 @@ bool BitMap::is_same(BitMap other) { } bool BitMap::is_full() const { - uintptr_t* word = map(); + bm_word_t* word = map(); idx_t rest = size(); for (; rest >= (idx_t) BitsPerWord; rest -= BitsPerWord) { - if (*word != (uintptr_t) AllBits) return false; + if (*word != (bm_word_t) AllBits) return false; word++; } - return rest == 0 || (*word | ~right_n_bits((int)rest)) == (uintptr_t) AllBits; + return rest == 0 || (*word | ~right_n_bits((int)rest)) == (bm_word_t) AllBits; } bool BitMap::is_empty() const { - uintptr_t* word = map(); + bm_word_t* word = map(); idx_t rest = size(); for (; rest >= (idx_t) BitsPerWord; rest -= BitsPerWord) { - if (*word != (uintptr_t) NoBits) return false; + if (*word != (bm_word_t) NoBits) return false; word++; } - return rest == 0 || (*word & right_n_bits((int)rest)) == (uintptr_t) NoBits; + return rest == 0 || (*word & right_n_bits((int)rest)) == (bm_word_t) NoBits; } void BitMap::clear_large() { @@ -436,7 +500,7 @@ void BitMap::clear_large() { // then modifications in and to the left of the _bit_ being // currently sampled will not be seen. Note also that the // interval [leftOffset, rightOffset) is right open. -void BitMap::iterate(BitMapClosure* blk, idx_t leftOffset, idx_t rightOffset) { +bool BitMap::iterate(BitMapClosure* blk, idx_t leftOffset, idx_t rightOffset) { verify_range(leftOffset, rightOffset); idx_t startIndex = word_index(leftOffset); @@ -445,106 +509,71 @@ void BitMap::iterate(BitMapClosure* blk, idx_t leftOffset, idx_t rightOffset) { offset < rightOffset && index < endIndex; offset = (++index) << LogBitsPerWord) { idx_t rest = map(index) >> (offset & (BitsPerWord - 1)); - for (; offset < rightOffset && rest != (uintptr_t)NoBits; offset++) { + for (; offset < rightOffset && rest != (bm_word_t)NoBits; offset++) { if (rest & 1) { - blk->do_bit(offset); + if (!blk->do_bit(offset)) return false; // resample at each closure application // (see, for instance, CMS bug 4525989) rest = map(index) >> (offset & (BitsPerWord -1)); - // XXX debugging: remove - // The following assertion assumes that closure application - // doesn't clear bits (may not be true in general, e.g. G1). - assert(rest & 1, - "incorrect shift or closure application can clear bits?"); } rest = rest >> 1; } } + return true; } -BitMap::idx_t BitMap::get_next_one_offset(idx_t l_offset, - idx_t r_offset) const { - assert(l_offset <= size(), "BitMap index out of bounds"); - assert(r_offset <= size(), "BitMap index out of bounds"); - assert(l_offset <= r_offset, "l_offset > r_offset ?"); +BitMap::idx_t* BitMap::_pop_count_table = NULL; - if (l_offset == r_offset) { - return l_offset; - } - idx_t index = word_index(l_offset); - idx_t r_index = word_index(r_offset-1) + 1; - idx_t res_offset = l_offset; - - // check bits including and to the _left_ of offset's position - idx_t pos = bit_in_word(res_offset); - idx_t res = map(index) >> pos; - if (res != (uintptr_t)NoBits) { - // find the position of the 1-bit - for (; !(res & 1); res_offset++) { - res = res >> 1; +void BitMap::init_pop_count_table() { + if (_pop_count_table == NULL) { + BitMap::idx_t *table = NEW_C_HEAP_ARRAY(idx_t, 256); + for (uint i = 0; i < 256; i++) { + table[i] = num_set_bits(i); } - assert(res_offset >= l_offset, "just checking"); - return MIN2(res_offset, r_offset); - } - // skip over all word length 0-bit runs - for (index++; index < r_index; index++) { - res = map(index); - if (res != (uintptr_t)NoBits) { - // found a 1, return the offset - for (res_offset = index << LogBitsPerWord; !(res & 1); - res_offset++) { - res = res >> 1; - } - assert(res & 1, "tautology; see loop condition"); - assert(res_offset >= l_offset, "just checking"); - return MIN2(res_offset, r_offset); + + intptr_t res = Atomic::cmpxchg_ptr((intptr_t) table, + (intptr_t*) &_pop_count_table, + (intptr_t) NULL_WORD); + if (res != NULL_WORD) { + guarantee( _pop_count_table == (void*) res, "invariant" ); + FREE_C_HEAP_ARRAY(bm_word_t, table); } } - return r_offset; } -BitMap::idx_t BitMap::get_next_zero_offset(idx_t l_offset, - idx_t r_offset) const { - assert(l_offset <= size(), "BitMap index out of bounds"); - assert(r_offset <= size(), "BitMap index out of bounds"); - assert(l_offset <= r_offset, "l_offset > r_offset ?"); +BitMap::idx_t BitMap::num_set_bits(bm_word_t w) { + idx_t bits = 0; - if (l_offset == r_offset) { - return l_offset; - } - idx_t index = word_index(l_offset); - idx_t r_index = word_index(r_offset-1) + 1; - idx_t res_offset = l_offset; - - // check bits including and to the _left_ of offset's position - idx_t pos = res_offset & (BitsPerWord - 1); - idx_t res = (map(index) >> pos) | left_n_bits((int)pos); - - if (res != (uintptr_t)AllBits) { - // find the position of the 0-bit - for (; res & 1; res_offset++) { - res = res >> 1; + while (w != 0) { + while ((w & 1) == 0) { + w >>= 1; } - assert(res_offset >= l_offset, "just checking"); - return MIN2(res_offset, r_offset); + bits++; + w >>= 1; } - // skip over all word length 1-bit runs - for (index++; index < r_index; index++) { - res = map(index); - if (res != (uintptr_t)AllBits) { - // found a 0, return the offset - for (res_offset = index << LogBitsPerWord; res & 1; - res_offset++) { - res = res >> 1; - } - assert(!(res & 1), "tautology; see loop condition"); - assert(res_offset >= l_offset, "just checking"); - return MIN2(res_offset, r_offset); - } - } - return r_offset; + return bits; } +BitMap::idx_t BitMap::num_set_bits_from_table(unsigned char c) { + assert(_pop_count_table != NULL, "precondition"); + return _pop_count_table[c]; +} + +BitMap::idx_t BitMap::count_one_bits() const { + init_pop_count_table(); // If necessary. + idx_t sum = 0; + typedef unsigned char uchar; + for (idx_t i = 0; i < size_in_words(); i++) { + bm_word_t w = map()[i]; + for (size_t j = 0; j < sizeof(bm_word_t); j++) { + sum += num_set_bits_from_table(uchar(w & 255)); + w >>= 8; + } + } + return sum; +} + + #ifndef PRODUCT void BitMap::print_on(outputStream* st) const { @@ -558,7 +587,7 @@ void BitMap::print_on(outputStream* st) const { #endif -BitMap2D::BitMap2D(uintptr_t* map, idx_t size_in_slots, idx_t bits_per_slot) +BitMap2D::BitMap2D(bm_word_t* map, idx_t size_in_slots, idx_t bits_per_slot) : _bits_per_slot(bits_per_slot) , _map(map, size_in_slots * bits_per_slot) { diff --git a/hotspot/src/share/vm/utilities/bitMap.hpp b/hotspot/src/share/vm/utilities/bitMap.hpp index 961a2f1b34e..899d65a07df 100644 --- a/hotspot/src/share/vm/utilities/bitMap.hpp +++ b/hotspot/src/share/vm/utilities/bitMap.hpp @@ -22,25 +22,19 @@ * */ -// Closure for iterating over BitMaps +// Forward decl; +class BitMapClosure; -class BitMapClosure VALUE_OBJ_CLASS_SPEC { - public: - // Callback when bit in map is set - virtual void do_bit(size_t offset) = 0; -}; - - -// Operations for bitmaps represented as arrays of unsigned 32- or 64-bit -// integers (uintptr_t). -// -// Bit offsets are numbered from 0 to size-1 +// Operations for bitmaps represented as arrays of unsigned integers. +// Bit offsets are numbered from 0 to size-1. class BitMap VALUE_OBJ_CLASS_SPEC { friend class BitMap2D; public: typedef size_t idx_t; // Type used for bit and word indices. + typedef uintptr_t bm_word_t; // Element type of array that represents + // the bitmap. // Hints for range sizes. typedef enum { @@ -48,8 +42,8 @@ class BitMap VALUE_OBJ_CLASS_SPEC { } RangeSizeHint; private: - idx_t* _map; // First word in bitmap - idx_t _size; // Size of bitmap (in bits) + bm_word_t* _map; // First word in bitmap + idx_t _size; // Size of bitmap (in bits) // Puts the given value at the given offset, using resize() to size // the bitmap appropriately if needed using factor-of-two expansion. @@ -62,7 +56,7 @@ class BitMap VALUE_OBJ_CLASS_SPEC { // Return a mask that will select the specified bit, when applied to the word // containing the bit. - static idx_t bit_mask(idx_t bit) { return (idx_t)1 << bit_in_word(bit); } + static bm_word_t bit_mask(idx_t bit) { return (bm_word_t)1 << bit_in_word(bit); } // Return the index of the word containing the specified bit. static idx_t word_index(idx_t bit) { return bit >> LogBitsPerWord; } @@ -71,66 +65,68 @@ class BitMap VALUE_OBJ_CLASS_SPEC { static idx_t bit_index(idx_t word) { return word << LogBitsPerWord; } // Return the array of bitmap words, or a specific word from it. - idx_t* map() const { return _map; } - idx_t map(idx_t word) const { return _map[word]; } + bm_word_t* map() const { return _map; } + bm_word_t map(idx_t word) const { return _map[word]; } // Return a pointer to the word containing the specified bit. - idx_t* word_addr(idx_t bit) const { return map() + word_index(bit); } + bm_word_t* word_addr(idx_t bit) const { return map() + word_index(bit); } // Set a word to a specified value or to all ones; clear a word. - void set_word (idx_t word, idx_t val) { _map[word] = val; } + void set_word (idx_t word, bm_word_t val) { _map[word] = val; } void set_word (idx_t word) { set_word(word, ~(uintptr_t)0); } void clear_word(idx_t word) { _map[word] = 0; } // Utilities for ranges of bits. Ranges are half-open [beg, end). // Ranges within a single word. - inline idx_t inverted_bit_mask_for_range(idx_t beg, idx_t end) const; - inline void set_range_within_word (idx_t beg, idx_t end); - inline void clear_range_within_word (idx_t beg, idx_t end); - inline void par_put_range_within_word (idx_t beg, idx_t end, bool value); + bm_word_t inverted_bit_mask_for_range(idx_t beg, idx_t end) const; + void set_range_within_word (idx_t beg, idx_t end); + void clear_range_within_word (idx_t beg, idx_t end); + void par_put_range_within_word (idx_t beg, idx_t end, bool value); // Ranges spanning entire words. - inline void set_range_of_words (idx_t beg, idx_t end); - inline void clear_range_of_words (idx_t beg, idx_t end); - inline void set_large_range_of_words (idx_t beg, idx_t end); - inline void clear_large_range_of_words (idx_t beg, idx_t end); + void set_range_of_words (idx_t beg, idx_t end); + void clear_range_of_words (idx_t beg, idx_t end); + void set_large_range_of_words (idx_t beg, idx_t end); + void clear_large_range_of_words (idx_t beg, idx_t end); // The index of the first full word in a range. - inline idx_t word_index_round_up(idx_t bit) const; + idx_t word_index_round_up(idx_t bit) const; // Verification, statistics. - void verify_index(idx_t index) const { - assert(index < _size, "BitMap index out of bounds"); - } + void verify_index(idx_t index) const; + void verify_range(idx_t beg_index, idx_t end_index) const; - void verify_range(idx_t beg_index, idx_t end_index) const { -#ifdef ASSERT - assert(beg_index <= end_index, "BitMap range error"); - // Note that [0,0) and [size,size) are both valid ranges. - if (end_index != _size) verify_index(end_index); -#endif - } + static idx_t* _pop_count_table; + static void init_pop_count_table(); + static idx_t num_set_bits(bm_word_t w); + static idx_t num_set_bits_from_table(unsigned char c); public: // Constructs a bitmap with no map, and size 0. BitMap() : _map(NULL), _size(0) {} - // Construction - BitMap(idx_t* map, idx_t size_in_bits); + // Constructs a bitmap with the given map and size. + BitMap(bm_word_t* map, idx_t size_in_bits); - // Allocates necessary data structure in resource area - BitMap(idx_t size_in_bits); + // Constructs an empty bitmap of the given size (that is, this clears the + // new bitmap). Allocates the map array in resource area if + // "in_resource_area" is true, else in the C heap. + BitMap(idx_t size_in_bits, bool in_resource_area = true); - void set_map(idx_t* map) { _map = map; } + // Set the map and size. + void set_map(bm_word_t* map) { _map = map; } void set_size(idx_t size_in_bits) { _size = size_in_bits; } - // Allocates necessary data structure in resource area. + // Allocates necessary data structure, either in the resource area + // or in the C heap, as indicated by "in_resource_area." // Preserves state currently in bit map by copying data. // Zeros any newly-addressable bits. - // Does not perform any frees (i.e., of current _map). - void resize(idx_t size_in_bits); + // If "in_resource_area" is false, frees the current map. + // (Note that this assumes that all calls to "resize" on the same BitMap + // use the same value for "in_resource_area".) + void resize(idx_t size_in_bits, bool in_resource_area = true); // Accessing idx_t size() const { return _size; } @@ -157,11 +153,11 @@ class BitMap VALUE_OBJ_CLASS_SPEC { // Set or clear the specified bit. inline void set_bit(idx_t bit); - inline void clear_bit(idx_t bit); + void clear_bit(idx_t bit); // Atomically set or clear the specified bit. - inline bool par_set_bit(idx_t bit); - inline bool par_clear_bit(idx_t bit); + bool par_set_bit(idx_t bit); + bool par_clear_bit(idx_t bit); // Put the given value at the given offset. The parallel version // will CAS the value into the bitmap and is quite a bit slower. @@ -183,23 +179,61 @@ class BitMap VALUE_OBJ_CLASS_SPEC { // Update a range of bits, using a hint about the size. Currently only // inlines the predominant case of a 1-bit range. Works best when hint is a // compile-time constant. - inline void set_range(idx_t beg, idx_t end, RangeSizeHint hint); - inline void clear_range(idx_t beg, idx_t end, RangeSizeHint hint); - inline void par_set_range(idx_t beg, idx_t end, RangeSizeHint hint); - inline void par_clear_range (idx_t beg, idx_t end, RangeSizeHint hint); + void set_range(idx_t beg, idx_t end, RangeSizeHint hint); + void clear_range(idx_t beg, idx_t end, RangeSizeHint hint); + void par_set_range(idx_t beg, idx_t end, RangeSizeHint hint); + void par_clear_range (idx_t beg, idx_t end, RangeSizeHint hint); + + // It performs the union operation between subsets of equal length + // of two bitmaps (the target bitmap of the method and the + // from_bitmap) and stores the result to the target bitmap. The + // from_start_index represents the first bit index of the subrange + // of the from_bitmap. The to_start_index is the equivalent of the + // target bitmap. Both indexes should be word-aligned, i.e. they + // should correspond to the first bit on a bitmap word (it's up to + // the caller to ensure this; the method does check it). The length + // of the subset is specified with word_num and it is in number of + // bitmap words. The caller should ensure that this is at least 2 + // (smaller ranges are not support to save extra checks). Again, + // this is checked in the method. + // + // Atomicity concerns: it is assumed that any contention on the + // target bitmap with other threads will happen on the first and + // last words; the ones in between will be "owned" exclusively by + // the calling thread and, in fact, they will already be 0. So, the + // method performs a CAS on the first word, copies the next + // word_num-2 words, and finally performs a CAS on the last word. + void mostly_disjoint_range_union(BitMap* from_bitmap, + idx_t from_start_index, + idx_t to_start_index, + size_t word_num); + // Clearing - void clear(); void clear_large(); + inline void clear(); - // Iteration support - void iterate(BitMapClosure* blk, idx_t leftIndex, idx_t rightIndex); - inline void iterate(BitMapClosure* blk) { + // Iteration support. Returns "true" if the iteration completed, false + // if the iteration terminated early (because the closure "blk" returned + // false). + bool iterate(BitMapClosure* blk, idx_t leftIndex, idx_t rightIndex); + bool iterate(BitMapClosure* blk) { // call the version that takes an interval - iterate(blk, 0, size()); + return iterate(blk, 0, size()); } - // Looking for 1's and 0's to the "right" + // Looking for 1's and 0's at indices equal to or greater than "l_index", + // stopping if none has been found before "r_index", and returning + // "r_index" (which must be at most "size") in that case. + idx_t get_next_one_offset_inline (idx_t l_index, idx_t r_index) const; + idx_t get_next_zero_offset_inline(idx_t l_index, idx_t r_index) const; + + // Like "get_next_one_offset_inline", except requires that "r_index" is + // aligned to bitsizeof(bm_word_t). + idx_t get_next_one_offset_inline_aligned_right(idx_t l_index, + idx_t r_index) const; + + // Non-inline versionsof the above. idx_t get_next_one_offset (idx_t l_index, idx_t r_index) const; idx_t get_next_zero_offset(idx_t l_index, idx_t r_index) const; @@ -210,12 +244,8 @@ class BitMap VALUE_OBJ_CLASS_SPEC { return get_next_zero_offset(offset, size()); } - - - // Find the next one bit in the range [beg_bit, end_bit), or return end_bit if - // no one bit is found. Equivalent to get_next_one_offset(), but inline for - // use in performance-critical code. - inline idx_t find_next_one_bit(idx_t beg_bit, idx_t end_bit) const; + // Returns the number of bits set in the bitmap. + idx_t count_one_bits() const; // Set operations. void set_union(BitMap bits); @@ -232,6 +262,15 @@ class BitMap VALUE_OBJ_CLASS_SPEC { bool set_difference_with_result(BitMap bits); bool set_intersection_with_result(BitMap bits); + // Requires the submap of "bits" starting at offset to be at least as + // large as "this". Modifies "this" to be the intersection of its + // current contents and the submap of "bits" starting at "offset" of the + // same length as "this." + // (For expedience, currently requires the offset to be aligned to the + // bitsize of a uintptr_t. This should go away in the future though it + // will probably remain a good case to optimize.) + void set_intersection_at_offset(BitMap bits, idx_t offset); + void set_from(BitMap bits); bool is_same(BitMap bits); @@ -248,58 +287,13 @@ class BitMap VALUE_OBJ_CLASS_SPEC { #endif }; -inline void BitMap::set_bit(idx_t bit) { - verify_index(bit); - *word_addr(bit) |= bit_mask(bit); -} - -inline void BitMap::clear_bit(idx_t bit) { - verify_index(bit); - *word_addr(bit) &= ~bit_mask(bit); -} - -inline void BitMap::set_range(idx_t beg, idx_t end, RangeSizeHint hint) { - if (hint == small_range && end - beg == 1) { - set_bit(beg); - } else { - if (hint == large_range) { - set_large_range(beg, end); - } else { - set_range(beg, end); - } - } -} - -inline void BitMap::clear_range(idx_t beg, idx_t end, RangeSizeHint hint) { - if (hint == small_range && end - beg == 1) { - clear_bit(beg); - } else { - if (hint == large_range) { - clear_large_range(beg, end); - } else { - clear_range(beg, end); - } - } -} - -inline void BitMap::par_set_range(idx_t beg, idx_t end, RangeSizeHint hint) { - if (hint == small_range && end - beg == 1) { - par_at_put(beg, true); - } else { - if (hint == large_range) { - par_at_put_large_range(beg, end, true); - } else { - par_at_put_range(beg, end, true); - } - } -} - // Convenience class wrapping BitMap which provides multiple bits per slot. class BitMap2D VALUE_OBJ_CLASS_SPEC { public: - typedef size_t idx_t; // Type used for bit and word indices. - + typedef BitMap::idx_t idx_t; // Type used for bit and word indices. + typedef BitMap::bm_word_t bm_word_t; // Element type of array that + // represents the bitmap. private: BitMap _map; idx_t _bits_per_slot; @@ -314,7 +308,7 @@ class BitMap2D VALUE_OBJ_CLASS_SPEC { public: // Construction. bits_per_slot must be greater than 0. - BitMap2D(uintptr_t* map, idx_t size_in_slots, idx_t bits_per_slot); + BitMap2D(bm_word_t* map, idx_t size_in_slots, idx_t bits_per_slot); // Allocates necessary data structure in resource area. bits_per_slot must be greater than 0. BitMap2D(idx_t size_in_slots, idx_t bits_per_slot); @@ -359,38 +353,14 @@ class BitMap2D VALUE_OBJ_CLASS_SPEC { _map.at_put_grow(bit_index(slot_index, bit_within_slot_index), value); } - void clear() { - _map.clear(); - } + void clear(); }; +// Closure for iterating over BitMaps - -inline void BitMap::set_range_of_words(idx_t beg, idx_t end) { - uintptr_t* map = _map; - for (idx_t i = beg; i < end; ++i) map[i] = ~(uintptr_t)0; -} - - -inline void BitMap::clear_range_of_words(idx_t beg, idx_t end) { - uintptr_t* map = _map; - for (idx_t i = beg; i < end; ++i) map[i] = 0; -} - - -inline void BitMap::clear() { - clear_range_of_words(0, size_in_words()); -} - - -inline void BitMap::par_clear_range(idx_t beg, idx_t end, RangeSizeHint hint) { - if (hint == small_range && end - beg == 1) { - par_at_put(beg, false); - } else { - if (hint == large_range) { - par_at_put_large_range(beg, end, false); - } else { - par_at_put_range(beg, end, false); - } - } -} +class BitMapClosure VALUE_OBJ_CLASS_SPEC { + public: + // Callback when bit in map is set. Should normally return "true"; + // return of false indicates that the bitmap iteration should terminate. + virtual bool do_bit(BitMap::idx_t offset) = 0; +}; diff --git a/hotspot/src/share/vm/utilities/bitMap.inline.hpp b/hotspot/src/share/vm/utilities/bitMap.inline.hpp index 5e656d99e63..3f59e01a57d 100644 --- a/hotspot/src/share/vm/utilities/bitMap.inline.hpp +++ b/hotspot/src/share/vm/utilities/bitMap.inline.hpp @@ -22,6 +22,17 @@ * */ + +inline void BitMap::set_bit(idx_t bit) { + verify_index(bit); + *word_addr(bit) |= bit_mask(bit); +} + +inline void BitMap::clear_bit(idx_t bit) { + verify_index(bit); + *word_addr(bit) &= ~bit_mask(bit); +} + inline bool BitMap::par_set_bit(idx_t bit) { verify_index(bit); volatile idx_t* const addr = word_addr(bit); @@ -64,42 +75,236 @@ inline bool BitMap::par_clear_bit(idx_t bit) { } while (true); } -inline BitMap::idx_t -BitMap::find_next_one_bit(idx_t beg_bit, idx_t end_bit) const -{ - verify_range(beg_bit, end_bit); - assert(bit_in_word(end_bit) == 0, "end_bit not word-aligned"); - - if (beg_bit == end_bit) { - return beg_bit; +inline void BitMap::set_range(idx_t beg, idx_t end, RangeSizeHint hint) { + if (hint == small_range && end - beg == 1) { + set_bit(beg); + } else { + if (hint == large_range) { + set_large_range(beg, end); + } else { + set_range(beg, end); + } } +} - idx_t index = word_index(beg_bit); - idx_t r_index = word_index(end_bit); - idx_t res_bit = beg_bit; +inline void BitMap::clear_range(idx_t beg, idx_t end, RangeSizeHint hint) { + if (hint == small_range && end - beg == 1) { + clear_bit(beg); + } else { + if (hint == large_range) { + clear_large_range(beg, end); + } else { + clear_range(beg, end); + } + } +} + +inline void BitMap::par_set_range(idx_t beg, idx_t end, RangeSizeHint hint) { + if (hint == small_range && end - beg == 1) { + par_at_put(beg, true); + } else { + if (hint == large_range) { + par_at_put_large_range(beg, end, true); + } else { + par_at_put_range(beg, end, true); + } + } +} + +inline void BitMap::set_range_of_words(idx_t beg, idx_t end) { + bm_word_t* map = _map; + for (idx_t i = beg; i < end; ++i) map[i] = ~(uintptr_t)0; +} + + +inline void BitMap::clear_range_of_words(idx_t beg, idx_t end) { + bm_word_t* map = _map; + for (idx_t i = beg; i < end; ++i) map[i] = 0; +} + + +inline void BitMap::clear() { + clear_range_of_words(0, size_in_words()); +} + + +inline void BitMap::par_clear_range(idx_t beg, idx_t end, RangeSizeHint hint) { + if (hint == small_range && end - beg == 1) { + par_at_put(beg, false); + } else { + if (hint == large_range) { + par_at_put_large_range(beg, end, false); + } else { + par_at_put_range(beg, end, false); + } + } +} + +inline BitMap::idx_t +BitMap::get_next_one_offset_inline(idx_t l_offset, idx_t r_offset) const { + assert(l_offset <= size(), "BitMap index out of bounds"); + assert(r_offset <= size(), "BitMap index out of bounds"); + assert(l_offset <= r_offset, "l_offset > r_offset ?"); + + if (l_offset == r_offset) { + return l_offset; + } + idx_t index = word_index(l_offset); + idx_t r_index = word_index(r_offset-1) + 1; + idx_t res_offset = l_offset; // check bits including and to the _left_ of offset's position - idx_t res = map(index) >> bit_in_word(res_bit); - if (res != (uintptr_t) NoBits) { + idx_t pos = bit_in_word(res_offset); + idx_t res = map(index) >> pos; + if (res != (uintptr_t)NoBits) { // find the position of the 1-bit - for (; !(res & 1); res_bit++) { + for (; !(res & 1); res_offset++) { res = res >> 1; } - assert(res_bit >= beg_bit && res_bit < end_bit, "just checking"); - return res_bit; + assert(res_offset >= l_offset && + res_offset < r_offset, "just checking"); + return MIN2(res_offset, r_offset); } // skip over all word length 0-bit runs for (index++; index < r_index; index++) { res = map(index); - if (res != (uintptr_t) NoBits) { + if (res != (uintptr_t)NoBits) { // found a 1, return the offset - for (res_bit = bit_index(index); !(res & 1); res_bit++) { + for (res_offset = bit_index(index); !(res & 1); res_offset++) { res = res >> 1; } assert(res & 1, "tautology; see loop condition"); - assert(res_bit >= beg_bit && res_bit < end_bit, "just checking"); - return res_bit; + assert(res_offset >= l_offset, "just checking"); + return MIN2(res_offset, r_offset); } } - return end_bit; + return r_offset; +} + +inline BitMap::idx_t +BitMap::get_next_zero_offset_inline(idx_t l_offset, idx_t r_offset) const { + assert(l_offset <= size(), "BitMap index out of bounds"); + assert(r_offset <= size(), "BitMap index out of bounds"); + assert(l_offset <= r_offset, "l_offset > r_offset ?"); + + if (l_offset == r_offset) { + return l_offset; + } + idx_t index = word_index(l_offset); + idx_t r_index = word_index(r_offset-1) + 1; + idx_t res_offset = l_offset; + + // check bits including and to the _left_ of offset's position + idx_t pos = res_offset & (BitsPerWord - 1); + idx_t res = (map(index) >> pos) | left_n_bits((int)pos); + + if (res != (uintptr_t)AllBits) { + // find the position of the 0-bit + for (; res & 1; res_offset++) { + res = res >> 1; + } + assert(res_offset >= l_offset, "just checking"); + return MIN2(res_offset, r_offset); + } + // skip over all word length 1-bit runs + for (index++; index < r_index; index++) { + res = map(index); + if (res != (uintptr_t)AllBits) { + // found a 0, return the offset + for (res_offset = index << LogBitsPerWord; res & 1; + res_offset++) { + res = res >> 1; + } + assert(!(res & 1), "tautology; see loop condition"); + assert(res_offset >= l_offset, "just checking"); + return MIN2(res_offset, r_offset); + } + } + return r_offset; +} + +inline BitMap::idx_t +BitMap::get_next_one_offset_inline_aligned_right(idx_t l_offset, + idx_t r_offset) const +{ + verify_range(l_offset, r_offset); + assert(bit_in_word(r_offset) == 0, "r_offset not word-aligned"); + + if (l_offset == r_offset) { + return l_offset; + } + idx_t index = word_index(l_offset); + idx_t r_index = word_index(r_offset); + idx_t res_offset = l_offset; + + // check bits including and to the _left_ of offset's position + idx_t res = map(index) >> bit_in_word(res_offset); + if (res != (uintptr_t)NoBits) { + // find the position of the 1-bit + for (; !(res & 1); res_offset++) { + res = res >> 1; + } + assert(res_offset >= l_offset && + res_offset < r_offset, "just checking"); + return res_offset; + } + // skip over all word length 0-bit runs + for (index++; index < r_index; index++) { + res = map(index); + if (res != (uintptr_t)NoBits) { + // found a 1, return the offset + for (res_offset = bit_index(index); !(res & 1); res_offset++) { + res = res >> 1; + } + assert(res & 1, "tautology; see loop condition"); + assert(res_offset >= l_offset && res_offset < r_offset, "just checking"); + return res_offset; + } + } + return r_offset; +} + + +// Returns a bit mask for a range of bits [beg, end) within a single word. Each +// bit in the mask is 0 if the bit is in the range, 1 if not in the range. The +// returned mask can be used directly to clear the range, or inverted to set the +// range. Note: end must not be 0. +inline BitMap::bm_word_t +BitMap::inverted_bit_mask_for_range(idx_t beg, idx_t end) const { + assert(end != 0, "does not work when end == 0"); + assert(beg == end || word_index(beg) == word_index(end - 1), + "must be a single-word range"); + bm_word_t mask = bit_mask(beg) - 1; // low (right) bits + if (bit_in_word(end) != 0) { + mask |= ~(bit_mask(end) - 1); // high (left) bits + } + return mask; +} + +inline void BitMap::set_large_range_of_words(idx_t beg, idx_t end) { + memset(_map + beg, ~(unsigned char)0, (end - beg) * sizeof(uintptr_t)); +} + +inline void BitMap::clear_large_range_of_words(idx_t beg, idx_t end) { + memset(_map + beg, 0, (end - beg) * sizeof(uintptr_t)); +} + +inline BitMap::idx_t BitMap::word_index_round_up(idx_t bit) const { + idx_t bit_rounded_up = bit + (BitsPerWord - 1); + // Check for integer arithmetic overflow. + return bit_rounded_up > bit ? word_index(bit_rounded_up) : size_in_words(); +} + +inline BitMap::idx_t BitMap::get_next_one_offset(idx_t l_offset, + idx_t r_offset) const { + return get_next_one_offset_inline(l_offset, r_offset); +} + +inline BitMap::idx_t BitMap::get_next_zero_offset(idx_t l_offset, + idx_t r_offset) const { + return get_next_zero_offset_inline(l_offset, r_offset); +} + +inline void BitMap2D::clear() { + _map.clear(); } diff --git a/hotspot/src/share/vm/utilities/debug.cpp b/hotspot/src/share/vm/utilities/debug.cpp index 05360107789..24d6f0ddeab 100644 --- a/hotspot/src/share/vm/utilities/debug.cpp +++ b/hotspot/src/share/vm/utilities/debug.cpp @@ -666,7 +666,7 @@ public: oop target; void do_oop(oop* o) { if (o != NULL && *o == target) { - tty->print_cr("0x%08x", o); + tty->print_cr(INTPTR_FORMAT, o); } } void do_oop(narrowOop* o) { ShouldNotReachHere(); } @@ -685,13 +685,13 @@ public: static void findref(intptr_t x) { - GenCollectedHeap *gch = GenCollectedHeap::heap(); + CollectedHeap *ch = Universe::heap(); LookForRefInGenClosure lookFor; lookFor.target = (oop) x; LookForRefInObjectClosure look_in_object((oop) x); tty->print_cr("Searching heap:"); - gch->object_iterate(&look_in_object); + ch->object_iterate(&look_in_object); tty->print_cr("Searching strong roots:"); Universe::oops_do(&lookFor, false); diff --git a/hotspot/src/share/vm/utilities/intHisto.cpp b/hotspot/src/share/vm/utilities/intHisto.cpp new file mode 100644 index 00000000000..ad0e488c781 --- /dev/null +++ b/hotspot/src/share/vm/utilities/intHisto.cpp @@ -0,0 +1,64 @@ +/* + * Copyright 2001-2007 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. + * + */ + +# include "incls/_precompiled.incl" +# include "incls/_intHisto.cpp.incl" + +IntHistogram::IntHistogram(int est, int max) : _max(max), _tot(0) { + assert(0 <= est && est <= max, "Preconditions"); + _elements = new (ResourceObj::C_HEAP) GrowableArray(est, true); + guarantee(_elements != NULL, "alloc failure"); +} + +void IntHistogram::add_entry(int outcome) { + if (outcome > _max) outcome = _max; + int new_count = _elements->at_grow(outcome) + 1; + _elements->at_put(outcome, new_count); + _tot++; +} + +int IntHistogram::entries_for_outcome(int outcome) { + return _elements->at_grow(outcome); +} + +void IntHistogram::print_on(outputStream* st) const { + double tot_d = (double)_tot; + st->print_cr("Outcome # of occurrences %% of occurrences"); + st->print_cr("-----------------------------------------------"); + for (int i=0; i < _elements->length()-2; i++) { + int cnt = _elements->at(i); + if (cnt != 0) { + st->print_cr("%7d %10d %8.4f", + i, cnt, (double)cnt/tot_d); + } + } + // Does it have any max entries? + if (_elements->length()-1 == _max) { + int cnt = _elements->at(_max); + st->print_cr(">= %4d %10d %8.4f", + _max, cnt, (double)cnt/tot_d); + } + st->print_cr("-----------------------------------------------"); + st->print_cr(" All %10d %8.4f", _tot, 1.0); +} diff --git a/hotspot/src/share/vm/utilities/intHisto.hpp b/hotspot/src/share/vm/utilities/intHisto.hpp new file mode 100644 index 00000000000..c2ca1973de3 --- /dev/null +++ b/hotspot/src/share/vm/utilities/intHisto.hpp @@ -0,0 +1,70 @@ +/* + * Copyright 2001-2007 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. + * + */ + +// This class implements a simple histogram. + +// A histogram summarizes a series of "measurements", each of which is +// assumed (required in this implementation) to have an outcome that is a +// non-negative integer. The histogram efficiently maps measurement outcomes +// to the number of measurements had that outcome. + +// To print the results, invoke print() on your Histogram*. + +// Note: there is already an existing "Histogram" class, in file +// histogram.{hpp,cpp}, but to my mind that's not a histogram, it's a table +// mapping strings to counts. To be a histogram (IMHO) it needs to map +// numbers (in fact, integers) to number of occurrences of that number. + +// ysr: (i am not sure i agree with the above note.) i suspect we want to have a +// histogram template that will map an arbitrary type (with a defined order +// relation) to a count. + + +class IntHistogram : public CHeapObj { + protected: + int _max; + int _tot; + GrowableArray* _elements; + +public: + // Create a new, empty table. "est" is an estimate of the maximum outcome + // that will be added, and "max" is an outcome such that all outcomes at + // least that large will be bundled with it. + IntHistogram(int est, int max); + // Add a measurement with the given outcome to the sequence. + void add_entry(int outcome); + // Return the number of entries recorded so far with the given outcome. + int entries_for_outcome(int outcome); + // Return the total number of entries recorded so far. + int total_entries() { return _tot; } + // Return the number of entries recorded so far with the given outcome as + // a fraction of the total number recorded so far. + double fraction_for_outcome(int outcome) { + return + (double)entries_for_outcome(outcome)/ + (double)total_entries(); + } + // Print the histogram on the given output stream. + void print_on(outputStream* st) const; +}; diff --git a/hotspot/src/share/vm/utilities/numberSeq.cpp b/hotspot/src/share/vm/utilities/numberSeq.cpp new file mode 100644 index 00000000000..7cd06b28c78 --- /dev/null +++ b/hotspot/src/share/vm/utilities/numberSeq.cpp @@ -0,0 +1,243 @@ +/* + * Copyright 2001-2007 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. + * + */ + +# include "incls/_precompiled.incl" +# include "incls/_numberSeq.cpp.incl" + +AbsSeq::AbsSeq(double alpha) : + _num(0), _sum(0.0), _sum_of_squares(0.0), + _davg(0.0), _dvariance(0.0), _alpha(alpha) { +} + +void AbsSeq::add(double val) { + if (_num == 0) { + // if the sequence is empty, the davg is the same as the value + _davg = val; + // and the variance is 0 + _dvariance = 0.0; + } else { + // otherwise, calculate both + _davg = (1.0 - _alpha) * val + _alpha * _davg; + double diff = val - _davg; + _dvariance = (1.0 - _alpha) * diff * diff + _alpha * _dvariance; + } +} + +double AbsSeq::avg() const { + if (_num == 0) + return 0.0; + else + return _sum / total(); +} + +double AbsSeq::variance() const { + if (_num <= 1) + return 0.0; + + double x_bar = avg(); + double result = _sum_of_squares / total() - x_bar * x_bar; + if (result < 0.0) { + // due to loss-of-precision errors, the variance might be negative + // by a small bit + + // guarantee(-0.1 < result && result < 0.0, + // "if variance is negative, it should be very small"); + result = 0.0; + } + return result; +} + +double AbsSeq::sd() const { + double var = variance(); + guarantee( var >= 0.0, "variance should not be negative" ); + return sqrt(var); +} + +double AbsSeq::davg() const { + return _davg; +} + +double AbsSeq::dvariance() const { + if (_num <= 1) + return 0.0; + + double result = _dvariance; + if (result < 0.0) { + // due to loss-of-precision errors, the variance might be negative + // by a small bit + + guarantee(-0.1 < result && result < 0.0, + "if variance is negative, it should be very small"); + result = 0.0; + } + return result; +} + +double AbsSeq::dsd() const { + double var = dvariance(); + guarantee( var >= 0.0, "variance should not be negative" ); + return sqrt(var); +} + +NumberSeq::NumberSeq(double alpha) : + AbsSeq(alpha), _maximum(0.0), _last(0.0) { +} + +bool NumberSeq::check_nums(NumberSeq *total, int n, NumberSeq **parts) { + for (int i = 0; i < n; ++i) { + if (parts[i] != NULL && total->num() != parts[i]->num()) + return false; + } + return true; +} + +NumberSeq::NumberSeq(NumberSeq *total, int n, NumberSeq **parts) { + guarantee(check_nums(total, n, parts), "all seq lengths should match"); + double sum = total->sum(); + for (int i = 0; i < n; ++i) { + if (parts[i] != NULL) + sum -= parts[i]->sum(); + } + + _num = total->num(); + _sum = sum; + + // we do not calculate these... + _sum_of_squares = -1.0; + _maximum = -1.0; + _davg = -1.0; + _dvariance = -1.0; +} + +void NumberSeq::add(double val) { + AbsSeq::add(val); + + _last = val; + if (_num == 0) { + _maximum = val; + } else { + if (val > _maximum) + _maximum = val; + } + _sum += val; + _sum_of_squares += val * val; + ++_num; +} + + +TruncatedSeq::TruncatedSeq(int length, double alpha): + AbsSeq(alpha), _length(length), _next(0) { + _sequence = NEW_C_HEAP_ARRAY(double, _length); + for (int i = 0; i < _length; ++i) + _sequence[i] = 0.0; +} + +void TruncatedSeq::add(double val) { + AbsSeq::add(val); + + // get the oldest value in the sequence... + double old_val = _sequence[_next]; + // ...remove it from the sum and sum of squares + _sum -= old_val; + _sum_of_squares -= old_val * old_val; + + // ...and update them with the new value + _sum += val; + _sum_of_squares += val * val; + + // now replace the old value with the new one + _sequence[_next] = val; + _next = (_next + 1) % _length; + + // only increase it if the buffer is not full + if (_num < _length) + ++_num; + + guarantee( variance() > -1.0, "variance should be >= 0" ); +} + +// can't easily keep track of this incrementally... +double TruncatedSeq::maximum() const { + if (_num == 0) + return 0.0; + double ret = _sequence[0]; + for (int i = 1; i < _num; ++i) { + double val = _sequence[i]; + if (val > ret) + ret = val; + } + return ret; +} + +double TruncatedSeq::last() const { + if (_num == 0) + return 0.0; + unsigned last_index = (_next + _length - 1) % _length; + return _sequence[last_index]; +} + +double TruncatedSeq::oldest() const { + if (_num == 0) + return 0.0; + else if (_num < _length) + // index 0 always oldest value until the array is full + return _sequence[0]; + else { + // since the array is full, _next is over the oldest value + return _sequence[_next]; + } +} + +double TruncatedSeq::predict_next() const { + if (_num == 0) + return 0.0; + + double num = (double) _num; + double x_squared_sum = 0.0; + double x_sum = 0.0; + double y_sum = 0.0; + double xy_sum = 0.0; + double x_avg = 0.0; + double y_avg = 0.0; + + int first = (_next + _length - _num) % _length; + for (int i = 0; i < _num; ++i) { + double x = (double) i; + double y = _sequence[(first + i) % _length]; + + x_squared_sum += x * x; + x_sum += x; + y_sum += y; + xy_sum += x * y; + } + x_avg = x_sum / num; + y_avg = y_sum / num; + + double Sxx = x_squared_sum - x_sum * x_sum / num; + double Sxy = xy_sum - x_sum * y_sum / num; + double b1 = Sxy / Sxx; + double b0 = y_avg - b1 * x_avg; + + return b0 + b1 * num; +} diff --git a/hotspot/src/share/vm/utilities/numberSeq.hpp b/hotspot/src/share/vm/utilities/numberSeq.hpp new file mode 100644 index 00000000000..4366c8bf1e0 --- /dev/null +++ b/hotspot/src/share/vm/utilities/numberSeq.hpp @@ -0,0 +1,117 @@ +/* + * Copyright 2001-2007 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. + * + */ + +/** + ** This file contains a few classes that represent number sequence, + ** x1, x2, x3, ..., xN, and can calculate their avg, max, and sd. + ** + ** Here's a quick description of the classes: + ** + ** AbsSeq: abstract superclass + ** NumberSeq: the sequence is assumed to be very long and the + ** maximum, avg, sd, davg, and dsd are calculated over all its elements + ** TruncatedSeq: this class keeps track of the last L elements + ** of the sequence and calculates avg, max, and sd only over them + **/ + +#define DEFAULT_ALPHA_VALUE 0.7 + +class AbsSeq { +private: + void init(double alpha); + +protected: + int _num; // the number of elements in the sequence + double _sum; // the sum of the elements in the sequence + double _sum_of_squares; // the sum of squares of the elements in the sequence + + double _davg; // decaying average + double _dvariance; // decaying variance + double _alpha; // factor for the decaying average / variance + + // This is what we divide with to get the average. In a standard + // number sequence, this should just be the number of elements in it. + virtual double total() const { return (double) _num; }; + +public: + AbsSeq(double alpha = DEFAULT_ALPHA_VALUE); + + virtual void add(double val); // adds a new element to the sequence + void add(unsigned val) { add((double) val); } + virtual double maximum() const = 0; // maximum element in the sequence + virtual double last() const = 0; // last element added in the sequence + + // the number of elements in the sequence + int num() const { return _num; } + // the sum of the elements in the sequence + double sum() const { return _sum; } + + double avg() const; // the average of the sequence + double variance() const; // the variance of the sequence + double sd() const; // the standard deviation of the sequence + + double davg() const; // decaying average + double dvariance() const; // decaying variance + double dsd() const; // decaying "standard deviation" +}; + +class NumberSeq: public AbsSeq { +private: + bool check_nums(NumberSeq* total, int n, NumberSeq** parts); + +protected: + double _last; + double _maximum; // keep track of maximum value + +public: + NumberSeq(double alpha = DEFAULT_ALPHA_VALUE); + NumberSeq(NumberSeq* total, int n_parts, NumberSeq** parts); + + virtual void add(double val); + virtual double maximum() const { return _maximum; } + virtual double last() const { return _last; } +}; + +class TruncatedSeq: public AbsSeq { +private: + enum PrivateConstants { + DefaultSeqLength = 10 + }; + void init(); +protected: + double *_sequence; // buffers the last L elements in the sequence + int _length; // this is L + int _next; // oldest slot in the array, i.e. next to be overwritten + +public: + // accepts a value for L + TruncatedSeq(int length = DefaultSeqLength, + double alpha = DEFAULT_ALPHA_VALUE); + virtual void add(double val); + virtual double maximum() const; + virtual double last() const; // the last value added to the sequence + + double oldest() const; // the oldest valid value in the sequence + double predict_next() const; // prediction based on linear regression +}; diff --git a/hotspot/src/share/vm/utilities/ostream.cpp b/hotspot/src/share/vm/utilities/ostream.cpp index f50e8ba0a07..958c20f74a1 100644 --- a/hotspot/src/share/vm/utilities/ostream.cpp +++ b/hotspot/src/share/vm/utilities/ostream.cpp @@ -188,6 +188,17 @@ void outputStream::stamp() { print_raw(buf); } +void outputStream::stamp(bool guard, + const char* prefix, + const char* suffix) { + if (!guard) { + return; + } + print_raw(prefix); + stamp(); + print_raw(suffix); +} + void outputStream::date_stamp(bool guard, const char* prefix, const char* suffix) { diff --git a/hotspot/src/share/vm/utilities/ostream.hpp b/hotspot/src/share/vm/utilities/ostream.hpp index 7232b485096..afd8ad2bccd 100644 --- a/hotspot/src/share/vm/utilities/ostream.hpp +++ b/hotspot/src/share/vm/utilities/ostream.hpp @@ -86,6 +86,10 @@ class outputStream : public ResourceObj { // Time stamp TimeStamp& time_stamp() { return _stamp; } void stamp(); + void stamp(bool guard, const char* prefix, const char* suffix); + void stamp(bool guard) { + stamp(guard, "", ": "); + } // Date stamp void date_stamp(bool guard, const char* prefix, const char* suffix); // A simplified call that includes a suffix of ": " diff --git a/hotspot/src/share/vm/utilities/taskqueue.cpp b/hotspot/src/share/vm/utilities/taskqueue.cpp index 691a85031df..4a9789b53df 100644 --- a/hotspot/src/share/vm/utilities/taskqueue.cpp +++ b/hotspot/src/share/vm/utilities/taskqueue.cpp @@ -65,7 +65,8 @@ void ParallelTaskTerminator::sleep(uint millis) { os::sleep(Thread::current(), millis, false); } -bool ParallelTaskTerminator::offer_termination() { +bool +ParallelTaskTerminator::offer_termination(TerminatorTerminator* terminator) { Atomic::inc(&_offered_termination); juint yield_count = 0; @@ -91,7 +92,8 @@ bool ParallelTaskTerminator::offer_termination() { sleep(WorkStealingSleepMillis); } - if (peek_in_queue_set()) { + if (peek_in_queue_set() || + (terminator != NULL && terminator->should_exit_termination())) { Atomic::dec(&_offered_termination); return false; } diff --git a/hotspot/src/share/vm/utilities/taskqueue.hpp b/hotspot/src/share/vm/utilities/taskqueue.hpp index 6e883d9e673..9e89d7f2cb2 100644 --- a/hotspot/src/share/vm/utilities/taskqueue.hpp +++ b/hotspot/src/share/vm/utilities/taskqueue.hpp @@ -120,6 +120,11 @@ public: return dirty_size(_bottom, get_top()); } + void set_empty() { + _bottom = 0; + _age = Age(); + } + // Maximum number of elements allowed in the queue. This is two less // than the actual queue size, for somewhat complicated reasons. juint max_elems() { return n() - 2; } @@ -155,6 +160,9 @@ public: // Delete any resource associated with the queue. ~GenericTaskQueue(); + // apply the closure to all elements in the task queue + void oops_do(OopClosure* f); + private: // Element array. volatile E* _elems; @@ -171,6 +179,24 @@ void GenericTaskQueue::initialize() { guarantee(_elems != NULL, "Allocation failed."); } +template +void GenericTaskQueue::oops_do(OopClosure* f) { + // tty->print_cr("START OopTaskQueue::oops_do"); + int iters = size(); + juint index = _bottom; + for (int i = 0; i < iters; ++i) { + index = decrement_index(index); + // tty->print_cr(" doing entry %d," INTPTR_T " -> " INTPTR_T, + // index, &_elems[index], _elems[index]); + E* t = (E*)&_elems[index]; // cast away volatility + oop* p = (oop*)t; + assert((*t)->is_oop_or_null(), "Not an oop or null"); + f->do_oop(p); + } + // tty->print_cr("END OopTaskQueue::oops_do"); +} + + template bool GenericTaskQueue::push_slow(E t, juint dirty_n_elems) { if (dirty_n_elems == n() - 1) { @@ -383,6 +409,12 @@ bool GenericTaskQueueSet::peek() { return false; } +// When to terminate from the termination protocol. +class TerminatorTerminator: public CHeapObj { +public: + virtual bool should_exit_termination() = 0; +}; + // A class to aid in the termination of a set of parallel tasks using // TaskQueueSet's for work stealing. @@ -407,7 +439,14 @@ public: // else is. If returns "true", all threads are terminated. If returns // "false", available work has been observed in one of the task queues, // so the global task is not complete. - bool offer_termination(); + bool offer_termination() { + return offer_termination(NULL); + } + + // As above, but it also terminates of the should_exit_termination() + // method of the terminator parameter returns true. If terminator is + // NULL, then it is ignored. + bool offer_termination(TerminatorTerminator* terminator); // Reset the terminator, so that it may be reused again. // The caller is responsible for ensuring that this is done diff --git a/hotspot/src/share/vm/utilities/workgroup.cpp b/hotspot/src/share/vm/utilities/workgroup.cpp index bdf650bbca7..d0f7b5eba79 100644 --- a/hotspot/src/share/vm/utilities/workgroup.cpp +++ b/hotspot/src/share/vm/utilities/workgroup.cpp @@ -28,13 +28,19 @@ // Definitions of WorkGang methods. AbstractWorkGang::AbstractWorkGang(const char* name, - bool are_GC_threads) : + bool are_GC_task_threads, + bool are_ConcurrentGC_threads) : _name(name), - _are_GC_threads(are_GC_threads) { + _are_GC_task_threads(are_GC_task_threads), + _are_ConcurrentGC_threads(are_ConcurrentGC_threads) { + + assert(!(are_GC_task_threads && are_ConcurrentGC_threads), + "They cannot both be STW GC and Concurrent threads" ); + // Other initialization. _monitor = new Monitor(/* priority */ Mutex::leaf, /* name */ "WorkGroup monitor", - /* allow_vm_block */ are_GC_threads); + /* allow_vm_block */ are_GC_task_threads); assert(monitor() != NULL, "Failed to allocate monitor"); _terminate = false; _task = NULL; @@ -44,16 +50,21 @@ AbstractWorkGang::AbstractWorkGang(const char* name, } WorkGang::WorkGang(const char* name, - int workers, - bool are_GC_threads) : - AbstractWorkGang(name, are_GC_threads) { + int workers, + bool are_GC_task_threads, + bool are_ConcurrentGC_threads) : + AbstractWorkGang(name, are_GC_task_threads, are_ConcurrentGC_threads) +{ // Save arguments. _total_workers = workers; + if (TraceWorkGang) { tty->print_cr("Constructing work gang %s with %d threads", name, workers); } _gang_workers = NEW_C_HEAP_ARRAY(GangWorker*, workers); - assert(gang_workers() != NULL, "Failed to allocate gang workers"); + if (gang_workers() == NULL) { + vm_exit_out_of_memory(0, "Cannot create GangWorker array."); + } for (int worker = 0; worker < total_workers(); worker += 1) { GangWorker* new_worker = new GangWorker(this, worker); assert(new_worker != NULL, "Failed to allocate GangWorker"); @@ -285,7 +296,11 @@ void GangWorker::loop() { } bool GangWorker::is_GC_task_thread() const { - return gang()->are_GC_threads(); + return gang()->are_GC_task_threads(); +} + +bool GangWorker::is_ConcurrentGC_thread() const { + return gang()->are_ConcurrentGC_threads(); } void GangWorker::print_on(outputStream* st) const { @@ -312,26 +327,43 @@ const char* AbstractGangTask::name() const { WorkGangBarrierSync::WorkGangBarrierSync() : _monitor(Mutex::safepoint, "work gang barrier sync", true), - _n_workers(0), _n_completed(0) { + _n_workers(0), _n_completed(0), _should_reset(false) { } WorkGangBarrierSync::WorkGangBarrierSync(int n_workers, const char* name) : _monitor(Mutex::safepoint, name, true), - _n_workers(n_workers), _n_completed(0) { + _n_workers(n_workers), _n_completed(0), _should_reset(false) { } void WorkGangBarrierSync::set_n_workers(int n_workers) { _n_workers = n_workers; _n_completed = 0; + _should_reset = false; } void WorkGangBarrierSync::enter() { MutexLockerEx x(monitor(), Mutex::_no_safepoint_check_flag); + if (should_reset()) { + // The should_reset() was set and we are the first worker to enter + // the sync barrier. We will zero the n_completed() count which + // effectively resets the barrier. + zero_completed(); + set_should_reset(false); + } inc_completed(); if (n_completed() == n_workers()) { + // At this point we would like to reset the barrier to be ready in + // case it is used again. However, we cannot set n_completed() to + // 0, even after the notify_all(), given that some other workers + // might still be waiting for n_completed() to become == + // n_workers(). So, if we set n_completed() to 0, those workers + // will get stuck (as they will wake up, see that n_completed() != + // n_workers() and go back to sleep). Instead, we raise the + // should_reset() flag and the barrier will be reset the first + // time a worker enters it again. + set_should_reset(true); monitor()->notify_all(); - } - else { + } else { while (n_completed() != n_workers()) { monitor()->wait(/* no_safepoint_check */ true); } @@ -442,3 +474,122 @@ bool SequentialSubTasksDone::all_tasks_completed() { } return false; } + +bool FreeIdSet::_stat_init = false; +FreeIdSet* FreeIdSet::_sets[NSets]; +bool FreeIdSet::_safepoint; + +FreeIdSet::FreeIdSet(int sz, Monitor* mon) : + _sz(sz), _mon(mon), _hd(0), _waiters(0), _index(-1), _claimed(0) +{ + _ids = new int[sz]; + for (int i = 0; i < sz; i++) _ids[i] = i+1; + _ids[sz-1] = end_of_list; // end of list. + if (_stat_init) { + for (int j = 0; j < NSets; j++) _sets[j] = NULL; + _stat_init = true; + } + // Add to sets. (This should happen while the system is still single-threaded.) + for (int j = 0; j < NSets; j++) { + if (_sets[j] == NULL) { + _sets[j] = this; + _index = j; + break; + } + } + guarantee(_index != -1, "Too many FreeIdSets in use!"); +} + +FreeIdSet::~FreeIdSet() { + _sets[_index] = NULL; +} + +void FreeIdSet::set_safepoint(bool b) { + _safepoint = b; + if (b) { + for (int j = 0; j < NSets; j++) { + if (_sets[j] != NULL && _sets[j]->_waiters > 0) { + Monitor* mon = _sets[j]->_mon; + mon->lock_without_safepoint_check(); + mon->notify_all(); + mon->unlock(); + } + } + } +} + +#define FID_STATS 0 + +int FreeIdSet::claim_par_id() { +#if FID_STATS + thread_t tslf = thr_self(); + tty->print("claim_par_id[%d]: sz = %d, claimed = %d\n", tslf, _sz, _claimed); +#endif + MutexLockerEx x(_mon, Mutex::_no_safepoint_check_flag); + while (!_safepoint && _hd == end_of_list) { + _waiters++; +#if FID_STATS + if (_waiters > 5) { + tty->print("claim_par_id waiting[%d]: %d waiters, %d claimed.\n", + tslf, _waiters, _claimed); + } +#endif + _mon->wait(Mutex::_no_safepoint_check_flag); + _waiters--; + } + if (_hd == end_of_list) { +#if FID_STATS + tty->print("claim_par_id[%d]: returning EOL.\n", tslf); +#endif + return -1; + } else { + int res = _hd; + _hd = _ids[res]; + _ids[res] = claimed; // For debugging. + _claimed++; +#if FID_STATS + tty->print("claim_par_id[%d]: returning %d, claimed = %d.\n", + tslf, res, _claimed); +#endif + return res; + } +} + +bool FreeIdSet::claim_perm_id(int i) { + assert(0 <= i && i < _sz, "Out of range."); + MutexLockerEx x(_mon, Mutex::_no_safepoint_check_flag); + int prev = end_of_list; + int cur = _hd; + while (cur != end_of_list) { + if (cur == i) { + if (prev == end_of_list) { + _hd = _ids[cur]; + } else { + _ids[prev] = _ids[cur]; + } + _ids[cur] = claimed; + _claimed++; + return true; + } else { + prev = cur; + cur = _ids[cur]; + } + } + return false; + +} + +void FreeIdSet::release_par_id(int id) { + MutexLockerEx x(_mon, Mutex::_no_safepoint_check_flag); + assert(_ids[id] == claimed, "Precondition."); + _ids[id] = _hd; + _hd = id; + _claimed--; +#if FID_STATS + tty->print("[%d] release_par_id(%d), waiters =%d, claimed = %d.\n", + thr_self(), id, _waiters, _claimed); +#endif + if (_waiters > 0) + // Notify all would be safer, but this is OK, right? + _mon->notify_all(); +} diff --git a/hotspot/src/share/vm/utilities/workgroup.hpp b/hotspot/src/share/vm/utilities/workgroup.hpp index 3797a3f76c2..fb2ec0603fd 100644 --- a/hotspot/src/share/vm/utilities/workgroup.hpp +++ b/hotspot/src/share/vm/utilities/workgroup.hpp @@ -72,7 +72,8 @@ class AbstractWorkGang: public CHeapObj { // Here's the public interface to this class. public: // Constructor and destructor. - AbstractWorkGang(const char* name, bool are_GC_threads); + AbstractWorkGang(const char* name, bool are_GC_task_threads, + bool are_ConcurrentGC_threads); ~AbstractWorkGang(); // Run a task, returns when the task is done (or terminated). virtual void run_task(AbstractGangTask* task) = 0; @@ -83,7 +84,8 @@ public: const char* name() const; protected: // Initialize only instance data. - const bool _are_GC_threads; + const bool _are_GC_task_threads; + const bool _are_ConcurrentGC_threads; // Printing support. const char* _name; // The monitor which protects these data, @@ -130,8 +132,11 @@ public: int finished_workers() const { return _finished_workers; } - bool are_GC_threads() const { - return _are_GC_threads; + bool are_GC_task_threads() const { + return _are_GC_task_threads; + } + bool are_ConcurrentGC_threads() const { + return _are_ConcurrentGC_threads; } // Predicates. bool is_idle() const { @@ -190,7 +195,8 @@ public: class WorkGang: public AbstractWorkGang { public: // Constructor - WorkGang(const char* name, int workers, bool are_GC_threads); + WorkGang(const char* name, int workers, + bool are_GC_task_threads, bool are_ConcurrentGC_threads); // Run a task, returns when the task is done (or terminated). virtual void run_task(AbstractGangTask* task); }; @@ -206,6 +212,7 @@ public: virtual void run(); // Predicate for Thread virtual bool is_GC_task_thread() const; + virtual bool is_ConcurrentGC_thread() const; // Printing void print_on(outputStream* st) const; virtual void print() const { print_on(tty); } @@ -228,12 +235,17 @@ protected: Monitor _monitor; int _n_workers; int _n_completed; + bool _should_reset; - Monitor* monitor() { return &_monitor; } - int n_workers() { return _n_workers; } - int n_completed() { return _n_completed; } + Monitor* monitor() { return &_monitor; } + int n_workers() { return _n_workers; } + int n_completed() { return _n_completed; } + bool should_reset() { return _should_reset; } - void inc_completed() { _n_completed++; } + void zero_completed() { _n_completed = 0; } + void inc_completed() { _n_completed++; } + + void set_should_reset(bool v) { _should_reset = v; } public: WorkGangBarrierSync(); @@ -343,3 +355,42 @@ public: // cleanup if necessary. bool all_tasks_completed(); }; + +// Represents a set of free small integer ids. +class FreeIdSet { + enum { + end_of_list = -1, + claimed = -2 + }; + + int _sz; + Monitor* _mon; + + int* _ids; + int _hd; + int _waiters; + int _claimed; + + static bool _safepoint; + typedef FreeIdSet* FreeIdSetPtr; + static const int NSets = 10; + static FreeIdSetPtr _sets[NSets]; + static bool _stat_init; + int _index; + +public: + FreeIdSet(int sz, Monitor* mon); + ~FreeIdSet(); + + static void set_safepoint(bool b); + + // Attempt to claim the given id permanently. Returns "true" iff + // successful. + bool claim_perm_id(int i); + + // Returns an unclaimed parallel id (waiting for one to be released if + // necessary). Returns "-1" if a GC wakes up a wait for an id. + int claim_par_id(); + + void release_par_id(int id); +}; diff --git a/hotspot/src/share/vm/utilities/yieldingWorkgroup.cpp b/hotspot/src/share/vm/utilities/yieldingWorkgroup.cpp index d4c0ea92d11..dd144285f44 100644 --- a/hotspot/src/share/vm/utilities/yieldingWorkgroup.cpp +++ b/hotspot/src/share/vm/utilities/yieldingWorkgroup.cpp @@ -31,8 +31,8 @@ class GangWorker; class WorkData; YieldingFlexibleWorkGang::YieldingFlexibleWorkGang( - const char* name, int workers, bool are_GC_threads) : - AbstractWorkGang(name, are_GC_threads) { + const char* name, int workers, bool are_GC_task_threads) : + AbstractWorkGang(name, are_GC_task_threads, false) { // Save arguments. _total_workers = workers; assert(_total_workers > 0, "Must have more than 1 worker"); diff --git a/hotspot/src/share/vm/utilities/yieldingWorkgroup.hpp b/hotspot/src/share/vm/utilities/yieldingWorkgroup.hpp index d7890f17d70..cd96ff08a55 100644 --- a/hotspot/src/share/vm/utilities/yieldingWorkgroup.hpp +++ b/hotspot/src/share/vm/utilities/yieldingWorkgroup.hpp @@ -143,7 +143,8 @@ class YieldingFlexibleWorkGang: public AbstractWorkGang { // Here's the public interface to this class. public: // Constructor and destructor. - YieldingFlexibleWorkGang(const char* name, int workers, bool are_GC_threads); + YieldingFlexibleWorkGang(const char* name, int workers, + bool are_GC_task_threads); YieldingFlexibleGangTask* yielding_task() const { assert(task() == NULL || task()->is_YieldingFlexibleGang_task(), From a82afd549a27c53f54421d52729374220f654e3f Mon Sep 17 00:00:00 2001 From: Igor Veresov Date: Wed, 11 Jun 2008 05:12:19 -0700 Subject: [PATCH 002/267] 6710665: G1: guarantee(_cm->out_of_regions() && _cm->region_stack_empty() && _task_queue->size() == 0, ...) Remove the incorrect assumptions from guarantee()s. Reviewed-by: ysr, tonyp --- .../vm/gc_implementation/g1/concurrentMark.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp index 4200691d4b5..d4975e8b6c2 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp @@ -3751,8 +3751,10 @@ void CMTask::do_marking_step(double time_target_ms) { if (!has_aborted()) { // We cannot check whether the global stack is empty, since other - // tasks might be pushing objects to it concurrently. - tmp_guarantee_CM( _cm->out_of_regions() && _cm->region_stack_empty(), + // tasks might be pushing objects to it concurrently. We also cannot + // check if the region stack is empty because if a thread is aborting + // it can push a partially done region back. + tmp_guarantee_CM( _cm->out_of_regions(), "at this point we should be out of regions" ); if (_cm->verbose_low()) @@ -3774,9 +3776,10 @@ void CMTask::do_marking_step(double time_target_ms) { // we could. Let's try to do some stealing... // We cannot check whether the global stack is empty, since other - // tasks might be pushing objects to it concurrently. + // tasks might be pushing objects to it concurrently. We also cannot + // check if the region stack is empty because if a thread is aborting + // it can push a partially done region back. guarantee( _cm->out_of_regions() && - _cm->region_stack_empty() && _task_queue->size() == 0, "only way to reach here" ); if (_cm->verbose_low()) @@ -3811,9 +3814,10 @@ void CMTask::do_marking_step(double time_target_ms) { // termination protocol. if (!has_aborted()) { // We cannot check whether the global stack is empty, since other - // tasks might be concurrently pushing objects on it. + // tasks might be concurrently pushing objects on it. We also cannot + // check if the region stack is empty because if a thread is aborting + // it can push a partially done region back. guarantee( _cm->out_of_regions() && - _cm->region_stack_empty() && _task_queue->size() == 0, "only way to reach here" ); if (_cm->verbose_low()) From b6c292d65db954132d426ae5c36992cb00d2afd6 Mon Sep 17 00:00:00 2001 From: "Y. Srinivas Ramakrishna" Date: Mon, 23 Jun 2008 16:49:37 -0700 Subject: [PATCH 003/267] 6718086: CMS assert: _concurrent_iteration_safe_limit update missed Initialize the field correctly in ContiguousSpace's constructor and initialize() methods, using the latter for the survivor spaces upon initial construction or a subsequent resizing of the young generation. Add some missing Space sub-class constructors. Reviewed-by: apetrusenko --- hotspot/src/share/vm/memory/defNewGeneration.cpp | 4 ++-- hotspot/src/share/vm/memory/space.cpp | 1 + hotspot/src/share/vm/memory/space.hpp | 10 +++++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/hotspot/src/share/vm/memory/defNewGeneration.cpp b/hotspot/src/share/vm/memory/defNewGeneration.cpp index 9f76cf63997..46b6c16e626 100644 --- a/hotspot/src/share/vm/memory/defNewGeneration.cpp +++ b/hotspot/src/share/vm/memory/defNewGeneration.cpp @@ -227,8 +227,8 @@ void DefNewGeneration::compute_space_boundaries(uintx minimum_eden_size) { eden()->mangle_unused_area(); } } - from()->set_bounds(fromMR); from()->clear(); - to()->set_bounds(toMR); to()->clear(); + from()->initialize(fromMR, true /* clear */); + to()->initialize( toMR, true /* clear */); // Make sure we compact eden, then from. // The to-space is normally empty before a compaction so need // not be considered. The exception is during promotion diff --git a/hotspot/src/share/vm/memory/space.cpp b/hotspot/src/share/vm/memory/space.cpp index 58c526b2f2e..00f37c049f1 100644 --- a/hotspot/src/share/vm/memory/space.cpp +++ b/hotspot/src/share/vm/memory/space.cpp @@ -276,6 +276,7 @@ void ContiguousSpace::initialize(MemRegion mr, bool clear_space) { set_top(bottom()); set_saved_mark(); if (clear_space) clear(); + set_concurrent_iteration_safe_limit(top()); } void ContiguousSpace::clear() { diff --git a/hotspot/src/share/vm/memory/space.hpp b/hotspot/src/share/vm/memory/space.hpp index a45490a595b..9fb138c5d07 100644 --- a/hotspot/src/share/vm/memory/space.hpp +++ b/hotspot/src/share/vm/memory/space.hpp @@ -373,6 +373,9 @@ private: CompactibleSpace* _next_compaction_space; public: + CompactibleSpace() : + _compaction_top(NULL), _next_compaction_space(NULL) {} + virtual void initialize(MemRegion mr, bool clear_space); virtual void clear(); @@ -766,6 +769,10 @@ class ContiguousSpace: public CompactibleSpace { inline HeapWord* par_allocate_impl(size_t word_size, HeapWord* end_value); public: + ContiguousSpace() : + _top(NULL), + _concurrent_iteration_safe_limit(NULL) {} + virtual void initialize(MemRegion mr, bool clear_space); // Accessors @@ -970,7 +977,8 @@ class EdenSpace : public ContiguousSpace { HeapWord* _soft_end; public: - EdenSpace(DefNewGeneration* gen) : _gen(gen) { _soft_end = NULL; } + EdenSpace(DefNewGeneration* gen) : + _gen(gen), _soft_end(NULL) {} // Get/set just the 'soft' limit. HeapWord* soft_end() { return _soft_end; } From a0b0fb42fdcda30e16276872bf74ec1f3ea71515 Mon Sep 17 00:00:00 2001 From: "Y. Srinivas Ramakrishna" Date: Thu, 26 Jun 2008 11:43:34 -0700 Subject: [PATCH 004/267] 6718811: Mismerge of 6680469:macro.cpp Fixed the mismerge by deleting the lines that were inadvertently left in place. Reviewed-by: iveresov --- hotspot/src/share/vm/opto/macro.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/hotspot/src/share/vm/opto/macro.cpp b/hotspot/src/share/vm/opto/macro.cpp index 908f071634a..87be89bca4d 100644 --- a/hotspot/src/share/vm/opto/macro.cpp +++ b/hotspot/src/share/vm/opto/macro.cpp @@ -919,10 +919,6 @@ void PhaseMacroExpand::expand_allocate_common( mem = mem->as_MergeMem()->memory_at(Compile::AliasIdxRaw); } - Node* eden_top_adr; - Node* eden_end_adr; - set_eden_pointers(eden_top_adr, eden_end_adr); - assert(ctrl != NULL, "must have control"); // We need a Region and corresponding Phi's to merge the slow-path and fast-path results. // they will not be used if "always_slow" is set From d44be8e3a0d9b7751478ab040c5eac6b61b29b01 Mon Sep 17 00:00:00 2001 From: "Y. Srinivas Ramakrishna" Date: Mon, 30 Jun 2008 17:04:59 -0700 Subject: [PATCH 005/267] 6618726: Introduce -XX:+UnlockExperimentalVMOptions flag Experimental() flags will protect features of an experimental nature that are not supported in the regular product build. Made UseG1GC an experimental flag. Reviewed-by: jmasa, kamg, coleenp --- .../vm/gc_implementation/g1/g1_globals.cpp | 3 ++- .../vm/gc_implementation/g1/g1_globals.hpp | 4 +-- hotspot/src/share/vm/runtime/globals.cpp | 17 ++++++++---- hotspot/src/share/vm/runtime/globals.hpp | 27 +++++++++++++++---- .../share/vm/runtime/globals_extension.hpp | 8 ++++-- hotspot/src/share/vm/services/management.cpp | 6 ++--- 6 files changed, 47 insertions(+), 18 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.cpp index 14dfe800bec..065ad42fc78 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.cpp @@ -27,5 +27,6 @@ G1_FLAGS(MATERIALIZE_DEVELOPER_FLAG, MATERIALIZE_PD_DEVELOPER_FLAG, \ MATERIALIZE_PRODUCT_FLAG, MATERIALIZE_PD_PRODUCT_FLAG, \ - MATERIALIZE_DIAGNOSTIC_FLAG, MATERIALIZE_NOTPRODUCT_FLAG, \ + MATERIALIZE_DIAGNOSTIC_FLAG, MATERIALIZE_EXPERIMENTAL_FLAG, \ + MATERIALIZE_NOTPRODUCT_FLAG, \ MATERIALIZE_MANAGEABLE_FLAG, MATERIALIZE_PRODUCT_RW_FLAG) diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp index d1b81c2f22c..72a684812d5 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp @@ -26,7 +26,7 @@ // Defines all globals flags used by the garbage-first compiler. // -#define G1_FLAGS(develop, develop_pd, product, product_pd, diagnostic, notproduct, manageable, product_rw) \ +#define G1_FLAGS(develop, develop_pd, product, product_pd, diagnostic, experimental, notproduct, manageable, product_rw) \ \ product(intx, ParallelGCG1AllocBufferSize, 4*K, \ "Size of parallel G1 allocation buffers in to-space.") \ @@ -284,4 +284,4 @@ product(intx, G1MaxSurvivorRegions, 0, \ "The maximum number of survivor regions") -G1_FLAGS(DECLARE_DEVELOPER_FLAG, DECLARE_PD_DEVELOPER_FLAG, DECLARE_PRODUCT_FLAG, DECLARE_PD_PRODUCT_FLAG, DECLARE_DIAGNOSTIC_FLAG, DECLARE_NOTPRODUCT_FLAG, DECLARE_MANAGEABLE_FLAG, DECLARE_PRODUCT_RW_FLAG) +G1_FLAGS(DECLARE_DEVELOPER_FLAG, DECLARE_PD_DEVELOPER_FLAG, DECLARE_PRODUCT_FLAG, DECLARE_PD_PRODUCT_FLAG, DECLARE_DIAGNOSTIC_FLAG, DECLARE_EXPERIMENTAL_FLAG, DECLARE_NOTPRODUCT_FLAG, DECLARE_MANAGEABLE_FLAG, DECLARE_PRODUCT_RW_FLAG) diff --git a/hotspot/src/share/vm/runtime/globals.cpp b/hotspot/src/share/vm/runtime/globals.cpp index 7d6750b2e4c..6a5d9cf9220 100644 --- a/hotspot/src/share/vm/runtime/globals.cpp +++ b/hotspot/src/share/vm/runtime/globals.cpp @@ -28,7 +28,8 @@ RUNTIME_FLAGS(MATERIALIZE_DEVELOPER_FLAG, MATERIALIZE_PD_DEVELOPER_FLAG, \ MATERIALIZE_PRODUCT_FLAG, MATERIALIZE_PD_PRODUCT_FLAG, \ - MATERIALIZE_DIAGNOSTIC_FLAG, MATERIALIZE_NOTPRODUCT_FLAG, \ + MATERIALIZE_DIAGNOSTIC_FLAG, MATERIALIZE_EXPERIMENTAL_FLAG, \ + MATERIALIZE_NOTPRODUCT_FLAG, \ MATERIALIZE_MANAGEABLE_FLAG, MATERIALIZE_PRODUCT_RW_FLAG, \ MATERIALIZE_LP64_PRODUCT_FLAG) @@ -37,12 +38,16 @@ RUNTIME_OS_FLAGS(MATERIALIZE_DEVELOPER_FLAG, MATERIALIZE_PD_DEVELOPER_FLAG, \ MATERIALIZE_DIAGNOSTIC_FLAG, MATERIALIZE_NOTPRODUCT_FLAG) bool Flag::is_unlocker() const { - return strcmp(name, "UnlockDiagnosticVMOptions") == 0; + return strcmp(name, "UnlockDiagnosticVMOptions") == 0 || + strcmp(name, "UnlockExperimentalVMOptions") == 0; + } bool Flag::is_unlocked() const { if (strcmp(kind, "{diagnostic}") == 0) { return UnlockDiagnosticVMOptions; + } else if (strcmp(kind, "{experimental}") == 0) { + return UnlockExperimentalVMOptions; } else { return true; } @@ -125,6 +130,7 @@ void Flag::print_as_flag(outputStream* st) { #define RUNTIME_PRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{product}", DEFAULT }, #define RUNTIME_PD_PRODUCT_FLAG_STRUCT(type, name, doc) { #type, XSTR(name), &name, "{pd product}", DEFAULT }, #define RUNTIME_DIAGNOSTIC_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{diagnostic}", DEFAULT }, +#define RUNTIME_EXPERIMENTAL_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{experimental}", DEFAULT }, #define RUNTIME_MANAGEABLE_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{manageable}", DEFAULT }, #define RUNTIME_PRODUCT_RW_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{product rw}", DEFAULT }, @@ -172,10 +178,10 @@ void Flag::print_as_flag(outputStream* st) { static Flag flagTable[] = { - RUNTIME_FLAGS(RUNTIME_DEVELOP_FLAG_STRUCT, RUNTIME_PD_DEVELOP_FLAG_STRUCT, RUNTIME_PRODUCT_FLAG_STRUCT, RUNTIME_PD_PRODUCT_FLAG_STRUCT, RUNTIME_DIAGNOSTIC_FLAG_STRUCT, RUNTIME_NOTPRODUCT_FLAG_STRUCT, RUNTIME_MANAGEABLE_FLAG_STRUCT, RUNTIME_PRODUCT_RW_FLAG_STRUCT, RUNTIME_LP64_PRODUCT_FLAG_STRUCT) + RUNTIME_FLAGS(RUNTIME_DEVELOP_FLAG_STRUCT, RUNTIME_PD_DEVELOP_FLAG_STRUCT, RUNTIME_PRODUCT_FLAG_STRUCT, RUNTIME_PD_PRODUCT_FLAG_STRUCT, RUNTIME_DIAGNOSTIC_FLAG_STRUCT, RUNTIME_EXPERIMENTAL_FLAG_STRUCT, RUNTIME_NOTPRODUCT_FLAG_STRUCT, RUNTIME_MANAGEABLE_FLAG_STRUCT, RUNTIME_PRODUCT_RW_FLAG_STRUCT, RUNTIME_LP64_PRODUCT_FLAG_STRUCT) RUNTIME_OS_FLAGS(RUNTIME_DEVELOP_FLAG_STRUCT, RUNTIME_PD_DEVELOP_FLAG_STRUCT, RUNTIME_PRODUCT_FLAG_STRUCT, RUNTIME_PD_PRODUCT_FLAG_STRUCT, RUNTIME_DIAGNOSTIC_FLAG_STRUCT, RUNTIME_NOTPRODUCT_FLAG_STRUCT) #ifndef SERIALGC - G1_FLAGS(RUNTIME_DEVELOP_FLAG_STRUCT, RUNTIME_PD_DEVELOP_FLAG_STRUCT, RUNTIME_PRODUCT_FLAG_STRUCT, RUNTIME_PD_PRODUCT_FLAG_STRUCT, RUNTIME_DIAGNOSTIC_FLAG_STRUCT, RUNTIME_NOTPRODUCT_FLAG_STRUCT, RUNTIME_MANAGEABLE_FLAG_STRUCT, RUNTIME_PRODUCT_RW_FLAG_STRUCT) + G1_FLAGS(RUNTIME_DEVELOP_FLAG_STRUCT, RUNTIME_PD_DEVELOP_FLAG_STRUCT, RUNTIME_PRODUCT_FLAG_STRUCT, RUNTIME_PD_PRODUCT_FLAG_STRUCT, RUNTIME_DIAGNOSTIC_FLAG_STRUCT, RUNTIME_EXPERIMENTAL_FLAG_STRUCT, RUNTIME_NOTPRODUCT_FLAG_STRUCT, RUNTIME_MANAGEABLE_FLAG_STRUCT, RUNTIME_PRODUCT_RW_FLAG_STRUCT) #endif // SERIALGC #ifdef COMPILER1 C1_FLAGS(C1_DEVELOP_FLAG_STRUCT, C1_PD_DEVELOP_FLAG_STRUCT, C1_PRODUCT_FLAG_STRUCT, C1_PD_PRODUCT_FLAG_STRUCT, C1_NOTPRODUCT_FLAG_STRUCT) @@ -199,7 +205,8 @@ Flag* Flag::find_flag(char* name, size_t length) { for (Flag* current = &flagTable[0]; current->name; current++) { if (str_equal(current->name, name, length)) { if (!(current->is_unlocked() || current->is_unlocker())) { - // disable use of diagnostic flags until they are unlocked + // disable use of diagnostic or experimental flags until they + // are explicitly unlocked return NULL; } return current; diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index b76ad241924..670acee1c76 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -255,7 +255,19 @@ class CommandLineFlags { // diagnostic information about VM problems. To use a VM diagnostic // option, you must first specify +UnlockDiagnosticVMOptions. // (This master switch also affects the behavior of -Xprintflags.) - +// +// experimental flags are in support of features that are not +// part of the officially supported product, but are available +// for experimenting with. They could, for example, be performance +// features that may not have undergone full or rigorous QA, but which may +// help performance in some cases and released for experimentation +// by the community of users and developers. This flag also allows one to +// be able to build a fully supported product that nonetheless also +// ships with some unsupported, lightly tested, experimental features. +// Like the UnlockDiagnosticVMOptions flag above, there is a corresponding +// UnlockExperimentalVMOptions flag, which allows the control and +// modification of the experimental flags. +// // manageable flags are writeable external product flags. // They are dynamically writeable through the JDK management interface // (com.sun.management.HotSpotDiagnosticMXBean API) and also through JConsole. @@ -285,7 +297,7 @@ class CommandLineFlags { // Note that when there is a need to support develop flags to be writeable, // it can be done in the same way as product_rw. -#define RUNTIME_FLAGS(develop, develop_pd, product, product_pd, diagnostic, notproduct, manageable, product_rw, lp64_product) \ +#define RUNTIME_FLAGS(develop, develop_pd, product, product_pd, diagnostic, experimental, notproduct, manageable, product_rw, lp64_product) \ \ lp64_product(bool, UseCompressedOops, false, \ "Use 32-bit object references in 64-bit VM. " \ @@ -304,7 +316,10 @@ class CommandLineFlags { "Prints flags that appeared on the command line") \ \ diagnostic(bool, UnlockDiagnosticVMOptions, trueInDebug, \ - "Enable processing of flags relating to field diagnostics") \ + "Enable normal processing of flags relating to field diagnostics")\ + \ + experimental(bool, UnlockExperimentalVMOptions, false, \ + "Enable normal processing of flags relating to experimental features")\ \ product(bool, JavaMonitorsInStackTrace, true, \ "Print info. about Java monitor locks when the stacks are dumped")\ @@ -1114,7 +1129,7 @@ class CommandLineFlags { product(bool, UseSerialGC, false, \ "Use the serial garbage collector") \ \ - product(bool, UseG1GC, false, \ + experimental(bool, UseG1GC, false, \ "Use the Garbage-First garbage collector") \ \ product(bool, UseParallelGC, false, \ @@ -3241,6 +3256,7 @@ class CommandLineFlags { #define DECLARE_PRODUCT_FLAG(type, name, value, doc) extern "C" type name; #define DECLARE_PD_PRODUCT_FLAG(type, name, doc) extern "C" type name; #define DECLARE_DIAGNOSTIC_FLAG(type, name, value, doc) extern "C" type name; +#define DECLARE_EXPERIMENTAL_FLAG(type, name, value, doc) extern "C" type name; #define DECLARE_MANAGEABLE_FLAG(type, name, value, doc) extern "C" type name; #define DECLARE_PRODUCT_RW_FLAG(type, name, value, doc) extern "C" type name; #ifdef PRODUCT @@ -3263,6 +3279,7 @@ class CommandLineFlags { #define MATERIALIZE_PRODUCT_FLAG(type, name, value, doc) type name = value; #define MATERIALIZE_PD_PRODUCT_FLAG(type, name, doc) type name = pd_##name; #define MATERIALIZE_DIAGNOSTIC_FLAG(type, name, value, doc) type name = value; +#define MATERIALIZE_EXPERIMENTAL_FLAG(type, name, value, doc) type name = value; #define MATERIALIZE_MANAGEABLE_FLAG(type, name, value, doc) type name = value; #define MATERIALIZE_PRODUCT_RW_FLAG(type, name, value, doc) type name = value; #ifdef PRODUCT @@ -3280,6 +3297,6 @@ class CommandLineFlags { #define MATERIALIZE_LP64_PRODUCT_FLAG(type, name, value, doc) /* flag is constant */ #endif // _LP64 -RUNTIME_FLAGS(DECLARE_DEVELOPER_FLAG, DECLARE_PD_DEVELOPER_FLAG, DECLARE_PRODUCT_FLAG, DECLARE_PD_PRODUCT_FLAG, DECLARE_DIAGNOSTIC_FLAG, DECLARE_NOTPRODUCT_FLAG, DECLARE_MANAGEABLE_FLAG, DECLARE_PRODUCT_RW_FLAG, DECLARE_LP64_PRODUCT_FLAG) +RUNTIME_FLAGS(DECLARE_DEVELOPER_FLAG, DECLARE_PD_DEVELOPER_FLAG, DECLARE_PRODUCT_FLAG, DECLARE_PD_PRODUCT_FLAG, DECLARE_DIAGNOSTIC_FLAG, DECLARE_EXPERIMENTAL_FLAG, DECLARE_NOTPRODUCT_FLAG, DECLARE_MANAGEABLE_FLAG, DECLARE_PRODUCT_RW_FLAG, DECLARE_LP64_PRODUCT_FLAG) RUNTIME_OS_FLAGS(DECLARE_DEVELOPER_FLAG, DECLARE_PD_DEVELOPER_FLAG, DECLARE_PRODUCT_FLAG, DECLARE_PD_PRODUCT_FLAG, DECLARE_DIAGNOSTIC_FLAG, DECLARE_NOTPRODUCT_FLAG) diff --git a/hotspot/src/share/vm/runtime/globals_extension.hpp b/hotspot/src/share/vm/runtime/globals_extension.hpp index 7475960efb9..53d4fb02f96 100644 --- a/hotspot/src/share/vm/runtime/globals_extension.hpp +++ b/hotspot/src/share/vm/runtime/globals_extension.hpp @@ -30,6 +30,7 @@ #define RUNTIME_PRODUCT_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name), #define RUNTIME_PD_PRODUCT_FLAG_MEMBER(type, name, doc) FLAG_MEMBER(name), #define RUNTIME_DIAGNOSTIC_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name), +#define RUNTIME_EXPERIMENTAL_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name), #define RUNTIME_MANAGEABLE_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name), #define RUNTIME_PRODUCT_RW_FLAG_MEMBER(type, name, value, doc) FLAG_MEMBER(name), #ifdef PRODUCT @@ -74,10 +75,10 @@ #endif typedef enum { - RUNTIME_FLAGS(RUNTIME_DEVELOP_FLAG_MEMBER, RUNTIME_PD_DEVELOP_FLAG_MEMBER, RUNTIME_PRODUCT_FLAG_MEMBER, RUNTIME_PD_PRODUCT_FLAG_MEMBER, RUNTIME_DIAGNOSTIC_FLAG_MEMBER, RUNTIME_NOTPRODUCT_FLAG_MEMBER, RUNTIME_MANAGEABLE_FLAG_MEMBER, RUNTIME_PRODUCT_RW_FLAG_MEMBER, RUNTIME_LP64_PRODUCT_FLAG_MEMBER) + RUNTIME_FLAGS(RUNTIME_DEVELOP_FLAG_MEMBER, RUNTIME_PD_DEVELOP_FLAG_MEMBER, RUNTIME_PRODUCT_FLAG_MEMBER, RUNTIME_PD_PRODUCT_FLAG_MEMBER, RUNTIME_DIAGNOSTIC_FLAG_MEMBER, RUNTIME_EXPERIMENTAL_FLAG_MEMBER, RUNTIME_NOTPRODUCT_FLAG_MEMBER, RUNTIME_MANAGEABLE_FLAG_MEMBER, RUNTIME_PRODUCT_RW_FLAG_MEMBER, RUNTIME_LP64_PRODUCT_FLAG_MEMBER) RUNTIME_OS_FLAGS(RUNTIME_DEVELOP_FLAG_MEMBER, RUNTIME_PD_DEVELOP_FLAG_MEMBER, RUNTIME_PRODUCT_FLAG_MEMBER, RUNTIME_PD_PRODUCT_FLAG_MEMBER, RUNTIME_DIAGNOSTIC_FLAG_MEMBER, RUNTIME_NOTPRODUCT_FLAG_MEMBER) #ifndef KERNEL - G1_FLAGS(RUNTIME_DEVELOP_FLAG_MEMBER, RUNTIME_PD_DEVELOP_FLAG_MEMBER, RUNTIME_PRODUCT_FLAG_MEMBER, RUNTIME_PD_PRODUCT_FLAG_MEMBER, RUNTIME_DIAGNOSTIC_FLAG_MEMBER, RUNTIME_NOTPRODUCT_FLAG_MEMBER, RUNTIME_MANAGEABLE_FLAG_MEMBER, RUNTIME_PRODUCT_RW_FLAG_MEMBER) + G1_FLAGS(RUNTIME_DEVELOP_FLAG_MEMBER, RUNTIME_PD_DEVELOP_FLAG_MEMBER, RUNTIME_PRODUCT_FLAG_MEMBER, RUNTIME_PD_PRODUCT_FLAG_MEMBER, RUNTIME_DIAGNOSTIC_FLAG_MEMBER, RUNTIME_EXPERIMENTAL_FLAG_MEMBER, RUNTIME_NOTPRODUCT_FLAG_MEMBER, RUNTIME_MANAGEABLE_FLAG_MEMBER, RUNTIME_PRODUCT_RW_FLAG_MEMBER) #endif #ifdef COMPILER1 C1_FLAGS(C1_DEVELOP_FLAG_MEMBER, C1_PD_DEVELOP_FLAG_MEMBER, C1_PRODUCT_FLAG_MEMBER, C1_PD_PRODUCT_FLAG_MEMBER, C1_NOTPRODUCT_FLAG_MEMBER) @@ -95,6 +96,7 @@ typedef enum { #define RUNTIME_PRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type), #define RUNTIME_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE(type, name, doc) FLAG_MEMBER_WITH_TYPE(name,type), #define RUNTIME_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type), +#define RUNTIME_EXPERIMENTAL_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type), #define RUNTIME_MANAGEABLE_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type), #define RUNTIME_PRODUCT_RW_FLAG_MEMBER_WITH_TYPE(type, name, value, doc) FLAG_MEMBER_WITH_TYPE(name,type), #ifdef PRODUCT @@ -144,6 +146,7 @@ typedef enum { RUNTIME_PRODUCT_FLAG_MEMBER_WITH_TYPE, RUNTIME_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE, RUNTIME_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE, + RUNTIME_EXPERIMENTAL_FLAG_MEMBER_WITH_TYPE, RUNTIME_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE, RUNTIME_MANAGEABLE_FLAG_MEMBER_WITH_TYPE, RUNTIME_PRODUCT_RW_FLAG_MEMBER_WITH_TYPE, @@ -160,6 +163,7 @@ typedef enum { RUNTIME_PRODUCT_FLAG_MEMBER_WITH_TYPE, RUNTIME_PD_PRODUCT_FLAG_MEMBER_WITH_TYPE, RUNTIME_DIAGNOSTIC_FLAG_MEMBER_WITH_TYPE, + RUNTIME_EXPERIMENTAL_FLAG_MEMBER_WITH_TYPE, RUNTIME_NOTPRODUCT_FLAG_MEMBER_WITH_TYPE, RUNTIME_MANAGEABLE_FLAG_MEMBER_WITH_TYPE, RUNTIME_PRODUCT_RW_FLAG_MEMBER_WITH_TYPE) diff --git a/hotspot/src/share/vm/services/management.cpp b/hotspot/src/share/vm/services/management.cpp index 88e5f1e5b88..387deee7325 100644 --- a/hotspot/src/share/vm/services/management.cpp +++ b/hotspot/src/share/vm/services/management.cpp @@ -886,7 +886,7 @@ static jint get_num_flags() { int count = 0; for (int i = 0; i < nFlags; i++) { Flag* flag = &Flag::flags[i]; - // Exclude the diagnostic flags + // Exclude the locked (diagnostic, experimental) flags if (flag->is_unlocked() || flag->is_unlocker()) { count++; } @@ -1487,7 +1487,7 @@ JVM_ENTRY(jobjectArray, jmm_GetVMGlobalNames(JNIEnv *env)) int num_entries = 0; for (int i = 0; i < nFlags; i++) { Flag* flag = &Flag::flags[i]; - // Exclude the diagnostic flags + // Exclude the locked (experimental, diagnostic) flags if (flag->is_unlocked() || flag->is_unlocker()) { Handle s = java_lang_String::create_from_str(flag->name, CHECK_0); flags_ah->obj_at_put(num_entries, s()); @@ -1616,7 +1616,7 @@ JVM_ENTRY(jint, jmm_GetVMGlobals(JNIEnv *env, int num_entries = 0; for (int i = 0; i < nFlags && num_entries < count; i++) { Flag* flag = &Flag::flags[i]; - // Exclude the diagnostic flags + // Exclude the locked (diagnostic, experimental) flags if (flag->is_unlocked() || flag->is_unlocker()) { add_global_entry(env, null_h, &globals[num_entries], flag, THREAD); num_entries++; From 07198ddeda4cfa36804b8fbe1b74fabd0c7aa25c Mon Sep 17 00:00:00 2001 From: Igor Veresov Date: Thu, 3 Jul 2008 03:17:29 -0700 Subject: [PATCH 006/267] 6702387: G1: assertion failure: assert(p == current_top || oop(p)->is_oop(),"p is not a block start") Do not coalesce dead and moved objects when removing self-forwarding pointers during the evacuation failure. Also fixed a issue in a BOT refinement code for TLABs. Reviewed-by: tonyp, jcoomes --- .../g1/g1BlockOffsetTable.cpp | 6 +- .../gc_implementation/g1/g1CollectedHeap.cpp | 90 +++++++++---------- 2 files changed, 45 insertions(+), 51 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp index c125fbe5d5b..4d9d7f0ce6c 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp @@ -412,7 +412,11 @@ G1BlockOffsetArray::forward_to_block_containing_addr_slow(HeapWord* q, // offset table was actually a lab allocation, and was divided into // several objects subsequently. Fix this situation as we answer the // query, by updating entries as we cross them. - size_t next_index = _array->index_for(n) + 1; + + // If the fist object's end q is at the card boundary. Start refining + // with the corresponding card (the value of the entry will be basically + // set to 0). If the object crosses the boundary -- start from the next card. + size_t next_index = _array->index_for(n) + !_array->is_card_boundary(n); HeapWord* next_boundary = _array->address_for_index(next_index); if (csp() != NULL) { if (addr >= csp()->top()) return csp()->top(); diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index a4d96e02359..82db0c37e07 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -2750,68 +2750,59 @@ private: G1CollectedHeap* _g1; ConcurrentMark* _cm; HeapRegion* _hr; - HeapWord* _last_self_forwarded_end; size_t _prev_marked_bytes; size_t _next_marked_bytes; public: RemoveSelfPointerClosure(G1CollectedHeap* g1, HeapRegion* hr) : _g1(g1), _cm(_g1->concurrent_mark()), _hr(hr), - _last_self_forwarded_end(_hr->bottom()), _prev_marked_bytes(0), _next_marked_bytes(0) {} size_t prev_marked_bytes() { return _prev_marked_bytes; } size_t next_marked_bytes() { return _next_marked_bytes; } - void fill_remainder() { - HeapWord* limit = _hr->top(); - MemRegion mr(_last_self_forwarded_end, limit); - if (!mr.is_empty()) { + // The original idea here was to coalesce evacuated and dead objects. + // However that caused complications with the block offset table (BOT). + // In particular if there were two TLABs, one of them partially refined. + // |----- TLAB_1--------|----TLAB_2-~~~(partially refined part)~~~| + // The BOT entries of the unrefined part of TLAB_2 point to the start + // of TLAB_2. If the last object of the TLAB_1 and the first object + // of TLAB_2 are coalesced, then the cards of the unrefined part + // would point into middle of the filler object. + // + // The current approach is to not coalesce and leave the BOT contents intact. + void do_object(oop obj) { + if (obj->is_forwarded() && obj->forwardee() == obj) { + // The object failed to move. + assert(!_g1->is_obj_dead(obj), "We should not be preserving dead objs."); + _cm->markPrev(obj); + assert(_cm->isPrevMarked(obj), "Should be marked!"); + _prev_marked_bytes += (obj->size() * HeapWordSize); + if (_g1->mark_in_progress() && !_g1->is_obj_ill(obj)) { + _cm->markAndGrayObjectIfNecessary(obj); + } + obj->set_mark(markOopDesc::prototype()); + // While we were processing RSet buffers during the + // collection, we actually didn't scan any cards on the + // collection set, since we didn't want to update remebered + // sets with entries that point into the collection set, given + // that live objects fromthe collection set are about to move + // and such entries will be stale very soon. This change also + // dealt with a reliability issue which involved scanning a + // card in the collection set and coming across an array that + // was being chunked and looking malformed. The problem is + // that, if evacuation fails, we might have remembered set + // entries missing given that we skipped cards on the + // collection set. So, we'll recreate such entries now. + RecreateRSetEntriesClosure cl(_g1, _hr); + obj->oop_iterate(&cl); + assert(_cm->isPrevMarked(obj), "Should be marked!"); + } else { + // The object has been either evacuated or is dead. Fill it with a + // dummy object. + MemRegion mr((HeapWord*)obj, obj->size()); SharedHeap::fill_region_with_object(mr); _cm->clearRangeBothMaps(mr); - _hr->declare_filled_region_to_BOT(mr); - } - } - - void do_object(oop obj) { - if (obj->is_forwarded()) { - if (obj->forwardee() == obj) { - assert(!_g1->is_obj_dead(obj), "We should not be preserving dead objs."); - _cm->markPrev(obj); - assert(_cm->isPrevMarked(obj), "Should be marked!"); - _prev_marked_bytes += (obj->size() * HeapWordSize); - if (_g1->mark_in_progress() && !_g1->is_obj_ill(obj)) { - _cm->markAndGrayObjectIfNecessary(obj); - } - HeapWord* obj_start = (HeapWord*)obj; - if (obj_start > _last_self_forwarded_end) { - MemRegion mr(_last_self_forwarded_end, obj_start); - SharedHeap::fill_region_with_object(mr); - assert(_cm->isPrevMarked(obj), "Should be marked!"); - _cm->clearRangeBothMaps(mr); - assert(_cm->isPrevMarked(obj), "Should be marked!"); - _hr->declare_filled_region_to_BOT(mr); - } - _last_self_forwarded_end = obj_start + obj->size(); - obj->set_mark(markOopDesc::prototype()); - - // While we were processing RSet buffers during the - // collection, we actually didn't scan any cards on the - // collection set, since we didn't want to update remebered - // sets with entries that point into the collection set, given - // that live objects fromthe collection set are about to move - // and such entries will be stale very soon. This change also - // dealt with a reliability issue which involved scanning a - // card in the collection set and coming across an array that - // was being chunked and looking malformed. The problem is - // that, if evacuation fails, we might have remembered set - // entries missing given that we skipped cards on the - // collection set. So, we'll recreate such entries now. - RecreateRSetEntriesClosure cl(_g1, _hr); - obj->oop_iterate(&cl); - - assert(_cm->isPrevMarked(obj), "Should be marked!"); - } } } }; @@ -2826,7 +2817,6 @@ void G1CollectedHeap::remove_self_forwarding_pointers() { RemoveSelfPointerClosure rspc(_g1h, cur); assert(cur->in_collection_set(), "bad CS"); cur->object_iterate(&rspc); - rspc.fill_remainder(); // A number of manipulations to make the TAMS be the current top, // and the marked bytes be the ones observed in the iteration. From 2703662478b0fc245defe1d6a0611e463564c989 Mon Sep 17 00:00:00 2001 From: Igor Veresov Date: Thu, 10 Jul 2008 09:29:54 -0700 Subject: [PATCH 007/267] 6723570: G1: assertion failure: p == current_top or oop(p)->is_oop(),"p is not a block start" (revisited!) Fixed the incorrect assigment to G1OffsetTableContigSpace::_gc_time_stamp. Also added a little more paranoia to operations on a global timestamp. Reviewed-by: tonyp --- .../src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp | 3 ++- .../src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp | 8 +++++++- hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp | 4 ++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index 82db0c37e07..bf892425c82 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -2279,7 +2279,8 @@ G1CollectedHeap::do_collection_pause_at_safepoint(HeapRegion* popular_region) { assert(Thread::current() == VMThread::vm_thread(), "should be in vm thread"); guarantee(!is_gc_active(), "collection is not reentrant"); assert(regions_accounted_for(), "Region leakage!"); - ++_gc_time_stamp; + + increment_gc_time_stamp(); if (g1_policy()->in_young_gc_mode()) { assert(check_young_list_well_formed(), diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp index 4cc1db22d50..b47a983d970 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp @@ -247,7 +247,7 @@ private: NumberSeq _pop_obj_rc_at_copy; void print_popularity_summary_info() const; - unsigned _gc_time_stamp; + volatile unsigned _gc_time_stamp; size_t* _surviving_young_words; @@ -653,6 +653,12 @@ public: void reset_gc_time_stamp() { _gc_time_stamp = 0; + OrderAccess::fence(); + } + + void increment_gc_time_stamp() { + ++_gc_time_stamp; + OrderAccess::fence(); } void iterate_dirty_card_closure(bool concurrent, int worker_i); diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp index 05435f54c14..824adbf874e 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp @@ -793,8 +793,8 @@ void G1OffsetTableContigSpace::set_saved_mark() { // will pick up the right saved_mark_word() as the high water mark // of the region. Either way, the behaviour will be correct. ContiguousSpace::set_saved_mark(); - OrderAccess::release_store_ptr((volatile intptr_t*) &_gc_time_stamp, - (intptr_t) curr_gc_time_stamp); + _gc_time_stamp = curr_gc_time_stamp; + OrderAccess::fence(); } } From 09fd47bcefc6e067870cb87d079ec110422a5c6e Mon Sep 17 00:00:00 2001 From: Igor Veresov Date: Wed, 30 Jul 2008 10:45:52 -0700 Subject: [PATCH 008/267] 6652160: G1: assert(cur_used_bytes == _g1->recalculate_used(),"It should!") at g1CollectorPolicy.cpp:1425 In attempt_allocation_slow() wait for the concurrent cleanup to complete before modifying _summary_bytes_used. Reviewed-by: jmasa, apetrusenko --- .../src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index bf892425c82..7e61e4f4916 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -648,6 +648,12 @@ G1CollectedHeap::attempt_allocation_slow(size_t word_size, "Prevent a regression of this bug."); } else { + // We may have concurrent cleanup working at the time. Wait for it + // to complete. In the future we would probably want to make the + // concurrent cleanup truly concurrent by decoupling it from the + // allocation. + if (!SafepointSynchronize::is_at_safepoint()) + wait_for_cleanup_complete(); // If we do a collection pause, this will be reset to a non-NULL // value. If we don't, nulling here ensures that we allocate a new // region below. From e2b3310cb65c12e1155c8aff1bd7e2f5c8d36a52 Mon Sep 17 00:00:00 2001 From: Antonios Printezis Date: Wed, 6 Aug 2008 11:57:31 -0400 Subject: [PATCH 009/267] 6722565: G1: assert !r->is_on_unclean_list() fires Under certain circumstances, two cleanup threads can claim and process the same region. Reviewed-by: apetrusenko, ysr --- .../gc_implementation/g1/concurrentMark.cpp | 26 +++- .../gc_implementation/g1/g1CollectedHeap.cpp | 137 +++++++++++++++--- .../gc_implementation/g1/g1CollectedHeap.hpp | 5 +- .../g1/g1CollectorPolicy.cpp | 6 +- .../vm/gc_implementation/g1/heapRegion.cpp | 13 +- .../vm/gc_implementation/g1/heapRegion.hpp | 22 ++- 6 files changed, 168 insertions(+), 41 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp index d4975e8b6c2..036e0e7fcf3 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp @@ -1423,7 +1423,8 @@ public: NULL /* CO tracker */); calccl.no_yield(); if (ParallelGCThreads > 0) { - _g1h->heap_region_par_iterate_chunked(&calccl, i, 1); + _g1h->heap_region_par_iterate_chunked(&calccl, i, + HeapRegion::FinalCountClaimValue); } else { _g1h->heap_region_iterate(&calccl); } @@ -1502,7 +1503,8 @@ public: &_par_cleanup_thread_state[i]->list, i); if (ParallelGCThreads > 0) { - _g1h->heap_region_par_iterate_chunked(&g1_note_end, i, 2); + _g1h->heap_region_par_iterate_chunked(&g1_note_end, i, + HeapRegion::NoteEndClaimValue); } else { _g1h->heap_region_iterate(&g1_note_end); } @@ -1545,7 +1547,8 @@ public: void work(int i) { if (ParallelGCThreads > 0) { - _g1rs->scrub_par(_region_bm, _card_bm, i, 3); + _g1rs->scrub_par(_region_bm, _card_bm, i, + HeapRegion::ScrubRemSetClaimValue); } else { _g1rs->scrub(_region_bm, _card_bm); } @@ -1610,10 +1613,18 @@ void ConcurrentMark::cleanup() { G1ParFinalCountTask g1_par_count_task(g1h, nextMarkBitMap(), &_region_bm, &_card_bm); if (ParallelGCThreads > 0) { + assert(g1h->check_heap_region_claim_values( + HeapRegion::InitialClaimValue), + "sanity check"); + int n_workers = g1h->workers()->total_workers(); g1h->set_par_threads(n_workers); g1h->workers()->run_task(&g1_par_count_task); g1h->set_par_threads(0); + + assert(g1h->check_heap_region_claim_values( + HeapRegion::FinalCountClaimValue), + "sanity check"); } else { g1_par_count_task.work(0); } @@ -1654,6 +1665,9 @@ void ConcurrentMark::cleanup() { g1h->set_par_threads(n_workers); g1h->workers()->run_task(&g1_par_note_end_task); g1h->set_par_threads(0); + + assert(g1h->check_heap_region_claim_values(HeapRegion::NoteEndClaimValue), + "sanity check"); } else { g1_par_note_end_task.work(0); } @@ -1665,7 +1679,7 @@ void ConcurrentMark::cleanup() { (note_end_end - note_end_start)*1000.0); } - // Now we "scrub" remembered sets. Note that we must do this before the + // call below, since it affects the metric by which we sort the heap // regions. if (G1ScrubRemSets) { @@ -1676,6 +1690,10 @@ void ConcurrentMark::cleanup() { g1h->set_par_threads(n_workers); g1h->workers()->run_task(&g1_par_scrub_rs_task); g1h->set_par_threads(0); + + assert(g1h->check_heap_region_claim_values( + HeapRegion::ScrubRemSetClaimValue), + "sanity check"); } else { g1_par_scrub_rs_task.work(0); } diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index 7e61e4f4916..43565be9b35 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -1715,39 +1715,130 @@ G1CollectedHeap::heap_region_iterate_from(int idx, HeapRegionClosure* cl) { HeapRegion* G1CollectedHeap::region_at(size_t idx) { return _hrs->at(idx); } -const int OverpartitionFactor = 4; void G1CollectedHeap::heap_region_par_iterate_chunked(HeapRegionClosure* cl, int worker, jint claim_value) { - // We break up the heap regions into blocks of size ParallelGCThreads (to - // decrease iteration costs). - const size_t nregions = n_regions(); - const size_t n_thrds = (ParallelGCThreads > 0 ? ParallelGCThreads : 1); - const size_t partitions = n_thrds * OverpartitionFactor; - const size_t BlkSize = MAX2(nregions/partitions, (size_t)1); - const size_t n_blocks = (nregions + BlkSize - 1)/BlkSize; - assert(ParallelGCThreads > 0 || worker == 0, "Precondition"); - const int init_idx = (int) (n_blocks/n_thrds * worker); - for (size_t blk = 0; blk < n_blocks; blk++) { - size_t idx = init_idx + blk; - if (idx >= n_blocks) idx = idx - n_blocks; - size_t reg_idx = idx * BlkSize; - assert(reg_idx < nregions, "Because we rounded blk up."); - HeapRegion* r = region_at(reg_idx); + const size_t regions = n_regions(); + const size_t worker_num = (ParallelGCThreads > 0 ? ParallelGCThreads : 1); + // try to spread out the starting points of the workers + const size_t start_index = regions / worker_num * (size_t) worker; + + // each worker will actually look at all regions + for (size_t count = 0; count < regions; ++count) { + const size_t index = (start_index + count) % regions; + assert(0 <= index && index < regions, "sanity"); + HeapRegion* r = region_at(index); + // we'll ignore "continues humongous" regions (we'll process them + // when we come across their corresponding "start humongous" + // region) and regions already claimed + if (r->claim_value() == claim_value || r->continuesHumongous()) { + continue; + } + // OK, try to claim it if (r->claimHeapRegion(claim_value)) { - for (size_t j = 0; j < BlkSize; j++) { - size_t reg_idx2 = reg_idx + j; - if (reg_idx2 == nregions) break; - HeapRegion* r2 = region_at(reg_idx2); - if (j > 0) r2->set_claim_value(claim_value); - bool res = cl->doHeapRegion(r2); - guarantee(!res, "Should not abort."); + // success! + assert(!r->continuesHumongous(), "sanity"); + if (r->startsHumongous()) { + // If the region is "starts humongous" we'll iterate over its + // "continues humongous" first; in fact we'll do them + // first. The order is important. In on case, calling the + // closure on the "starts humongous" region might de-allocate + // and clear all its "continues humongous" regions and, as a + // result, we might end up processing them twice. So, we'll do + // them first (notice: most closures will ignore them anyway) and + // then we'll do the "starts humongous" region. + for (size_t ch_index = index + 1; ch_index < regions; ++ch_index) { + HeapRegion* chr = region_at(ch_index); + + // if the region has already been claimed or it's not + // "continues humongous" we're done + if (chr->claim_value() == claim_value || + !chr->continuesHumongous()) { + break; + } + + // Noone should have claimed it directly. We can given + // that we claimed its "starts humongous" region. + assert(chr->claim_value() != claim_value, "sanity"); + assert(chr->humongous_start_region() == r, "sanity"); + + if (chr->claimHeapRegion(claim_value)) { + // we should always be able to claim it; noone else should + // be trying to claim this region + + bool res2 = cl->doHeapRegion(chr); + assert(!res2, "Should not abort"); + + // Right now, this holds (i.e., no closure that actually + // does something with "continues humongous" regions + // clears them). We might have to weaken it in the future, + // but let's leave these two asserts here for extra safety. + assert(chr->continuesHumongous(), "should still be the case"); + assert(chr->humongous_start_region() == r, "sanity"); + } else { + guarantee(false, "we should not reach here"); + } + } } + + assert(!r->continuesHumongous(), "sanity"); + bool res = cl->doHeapRegion(r); + assert(!res, "Should not abort"); } } } +#ifdef ASSERT +// This checks whether all regions in the heap have the correct claim +// value. I also piggy-backed on this a check to ensure that the +// humongous_start_region() information on "continues humongous" +// regions is correct. + +class CheckClaimValuesClosure : public HeapRegionClosure { +private: + jint _claim_value; + size_t _failures; + HeapRegion* _sh_region; +public: + CheckClaimValuesClosure(jint claim_value) : + _claim_value(claim_value), _failures(0), _sh_region(NULL) { } + bool doHeapRegion(HeapRegion* r) { + if (r->claim_value() != _claim_value) { + gclog_or_tty->print_cr("Region ["PTR_FORMAT","PTR_FORMAT"), " + "claim value = %d, should be %d", + r->bottom(), r->end(), r->claim_value(), + _claim_value); + ++_failures; + } + if (!r->isHumongous()) { + _sh_region = NULL; + } else if (r->startsHumongous()) { + _sh_region = r; + } else if (r->continuesHumongous()) { + if (r->humongous_start_region() != _sh_region) { + gclog_or_tty->print_cr("Region ["PTR_FORMAT","PTR_FORMAT"), " + "HS = "PTR_FORMAT", should be "PTR_FORMAT, + r->bottom(), r->end(), + r->humongous_start_region(), + _sh_region); + ++_failures; + } + } + return false; + } + size_t failures() { + return _failures; + } +}; + +bool G1CollectedHeap::check_heap_region_claim_values(jint claim_value) { + CheckClaimValuesClosure cl(claim_value); + heap_region_iterate(&cl); + return cl.failures() == 0; +} +#endif // ASSERT + void G1CollectedHeap::collection_set_iterate(HeapRegionClosure* cl) { HeapRegion* r = g1_policy()->collection_set(); while (r != NULL) { diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp index b47a983d970..3cb980e205c 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp @@ -873,7 +873,6 @@ public: HeapRegion* region_at(size_t idx); - // Divide the heap region sequence into "chunks" of some size (the number // of regions divided by the number of parallel threads times some // overpartition factor, currently 4). Assumes that this will be called @@ -891,6 +890,10 @@ public: int worker, jint claim_value); +#ifdef ASSERT + bool check_heap_region_claim_values(jint claim_value); +#endif // ASSERT + // Iterate over the regions (if any) in the current collection set. void collection_set_iterate(HeapRegionClosure* blk); diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp index accea783c21..97e697c8073 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp @@ -2897,7 +2897,8 @@ public: void work(int i) { ParKnownGarbageHRClosure parKnownGarbageCl(_hrSorted, _chunk_size, i); // Back to zero for the claim value. - _g1->heap_region_par_iterate_chunked(&parKnownGarbageCl, i, 0); + _g1->heap_region_par_iterate_chunked(&parKnownGarbageCl, i, + HeapRegion::InitialClaimValue); jint regions_added = parKnownGarbageCl.marked_regions_added(); _hrSorted->incNumMarkedHeapRegions(regions_added); if (G1PrintParCleanupStats) { @@ -2933,6 +2934,9 @@ record_concurrent_mark_cleanup_end(size_t freed_bytes, ParKnownGarbageTask parKnownGarbageTask(_collectionSetChooser, (int) ChunkSize); _g1->workers()->run_task(&parKnownGarbageTask); + + assert(_g1->check_heap_region_claim_values(HeapRegion::InitialClaimValue), + "sanity check"); } else { KnownGarbageClosure knownGarbagecl(_collectionSetChooser); _g1->heap_region_iterate(&knownGarbagecl); diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp index 824adbf874e..7bdde6af0a4 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp @@ -263,8 +263,7 @@ HeapRegion::new_dcto_closure(OopClosure* cl, } void HeapRegion::hr_clear(bool par, bool clear_space) { - _humongous = false; - _humongous_start = false; + _humongous_type = NotHumongous; _humongous_start_region = NULL; _in_collection_set = false; _is_gc_alloc_region = false; @@ -284,7 +283,7 @@ void HeapRegion::hr_clear(bool par, bool clear_space) { // If this is parallel, this will be done later. HeapRegionRemSet* hrrs = rem_set(); if (hrrs != NULL) hrrs->clear(); - _claimed = 0; + _claimed = InitialClaimValue; } zero_marked_bytes(); set_sort_index(-1); @@ -305,7 +304,7 @@ void HeapRegion::calc_gc_efficiency() { // void HeapRegion::set_startsHumongous() { - _humongous_start = true; _humongous = true; + _humongous_type = StartsHumongous; _humongous_start_region = this; assert(end() == _orig_end, "Should be normal before alloc."); } @@ -368,11 +367,11 @@ HeapRegion(G1BlockOffsetSharedArray* sharedOffsetArray, : G1OffsetTableContigSpace(sharedOffsetArray, mr, is_zeroed), _next_fk(HeapRegionDCTOC::NoFilterKind), _hrs_index(-1), - _humongous(false), _humongous_start(false), _humongous_start_region(NULL), + _humongous_type(NotHumongous), _humongous_start_region(NULL), _in_collection_set(false), _is_gc_alloc_region(false), _is_on_free_list(false), _is_on_unclean_list(false), _next_in_special_set(NULL), _orig_end(NULL), - _claimed(0), _evacuation_failed(false), + _claimed(InitialClaimValue), _evacuation_failed(false), _prev_marked_bytes(0), _next_marked_bytes(0), _sort_index(-1), _popularity(NotPopular), _young_type(NotYoung), _next_young_region(NULL), @@ -426,7 +425,7 @@ CompactibleSpace* HeapRegion::next_compaction_space() const { void HeapRegion::set_continuesHumongous(HeapRegion* start) { // The order is important here. start->add_continuingHumongousRegion(this); - _humongous = true; _humongous_start = false; + _humongous_type = ContinuesHumongous; _humongous_start_region = start; } diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp index 17b093b8e8c..2413893dde8 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp @@ -168,6 +168,12 @@ class HeapRegion: public G1OffsetTableContigSpace { friend class VMStructs; private: + enum HumongousType { + NotHumongous = 0, + StartsHumongous, + ContinuesHumongous + }; + // The next filter kind that should be used for a "new_dcto_cl" call with // the "traditional" signature. HeapRegionDCTOC::FilterKind _next_fk; @@ -188,8 +194,7 @@ class HeapRegion: public G1OffsetTableContigSpace { // sequence, otherwise -1. int _hrs_index; - bool _humongous; // starts or continues a humongous object - bool _humongous_start; // starts a humongous object + HumongousType _humongous_type; // For a humongous region, region in which it starts. HeapRegion* _humongous_start_region; // For the start region of a humongous sequence, it's original end(). @@ -308,6 +313,13 @@ class HeapRegion: public G1OffsetTableContigSpace { MaxAge = 2, NoOfAges = MaxAge+1 }; + enum ClaimValues { + InitialClaimValue = 0, + FinalCountClaimValue = 1, + NoteEndClaimValue = 2, + ScrubRemSetClaimValue = 3 + }; + // Concurrent refinement requires contiguous heap regions (in which TLABs // might be allocated) to be zero-filled. Each region therefore has a // zero-fill-state. @@ -355,9 +367,9 @@ class HeapRegion: public G1OffsetTableContigSpace { _prev_marked_bytes = _next_marked_bytes = 0; } - bool isHumongous() const { return _humongous; } - bool startsHumongous() const { return _humongous_start; } - bool continuesHumongous() const { return _humongous && ! _humongous_start; } + bool isHumongous() const { return _humongous_type != NotHumongous; } + bool startsHumongous() const { return _humongous_type == StartsHumongous; } + bool continuesHumongous() const { return _humongous_type == ContinuesHumongous; } // For a humongous region, region in which it starts. HeapRegion* humongous_start_region() const { return _humongous_start_region; From 48d3ec16608f825f8fe69b3a7f49a71790434f1b Mon Sep 17 00:00:00 2001 From: Igor Veresov Date: Fri, 22 Aug 2008 11:48:25 -0700 Subject: [PATCH 010/267] 6735416: G1: runThese javasoft.sqe.tests.lang.thrd011.thrd01101.thrd01101 fails 6622418: G1: assert(false,"Non-balanced monitor enter/exit!") fails The mark-sweep compact (which we use for full gc) wrapper did not save the mark words for biased locked objects. The fix is to trivially call the appropriate methods. Reviewed-by: tonyp, ysr --- hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp | 6 +++++- hotspot/src/share/vm/gc_implementation/includeDB_gc_g1 | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp index 2a4c7acdc8c..3c5eccb4a7b 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp @@ -50,6 +50,10 @@ void G1MarkSweep::invoke_at_safepoint(ReferenceProcessor* rp, allocate_stacks(); + // We should save the marks of the currently locked biased monitors. + // The marking doesn't preserve the marks of biased objects. + BiasedLocking::preserve_marks(); + mark_sweep_phase1(marked_for_unloading, clear_all_softrefs); if (G1VerifyConcMark) { @@ -67,7 +71,7 @@ void G1MarkSweep::invoke_at_safepoint(ReferenceProcessor* rp, mark_sweep_phase4(); GenMarkSweep::restore_marks(); - + BiasedLocking::restore_marks(); GenMarkSweep::deallocate_stacks(); // We must invalidate the perm-gen rs, so that it gets rebuilt. diff --git a/hotspot/src/share/vm/gc_implementation/includeDB_gc_g1 b/hotspot/src/share/vm/gc_implementation/includeDB_gc_g1 index db46c52f7d3..18881904b8b 100644 --- a/hotspot/src/share/vm/gc_implementation/includeDB_gc_g1 +++ b/hotspot/src/share/vm/gc_implementation/includeDB_gc_g1 @@ -19,7 +19,7 @@ // 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. -// +// // // NOTE: DO NOT CHANGE THIS COPYRIGHT TO NEW STYLE - IT WILL BREAK makeDeps! @@ -100,7 +100,7 @@ concurrentZFThread.cpp space.inline.hpp concurrentZFThread.hpp concurrentGCThread.hpp concurrentZFThread.hpp coTracker.hpp - + dirtyCardQueue.cpp atomic.hpp dirtyCardQueue.cpp dirtyCardQueue.hpp dirtyCardQueue.cpp heapRegionRemSet.hpp @@ -183,6 +183,7 @@ globals.cpp g1_globals.hpp top.hpp g1_globals.hpp g1MarkSweep.cpp aprofiler.hpp +g1MarkSweep.cpp biasedLocking.hpp g1MarkSweep.cpp codeCache.hpp g1MarkSweep.cpp events.hpp g1MarkSweep.cpp fprofiler.hpp From cd9045f4e8aef52eee458dfcfde4ecaf4f5b4904 Mon Sep 17 00:00:00 2001 From: Antonios Printezis Date: Tue, 26 Aug 2008 00:46:03 -0400 Subject: [PATCH 011/267] 6740930: G1: compilation failure with latest gcc Include DB fix to resolve a compilation issue with the latest gcc. Reviewed-by: iveresov, ysr --- hotspot/src/share/vm/gc_implementation/includeDB_gc_g1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hotspot/src/share/vm/gc_implementation/includeDB_gc_g1 b/hotspot/src/share/vm/gc_implementation/includeDB_gc_g1 index 18881904b8b..53770855458 100644 --- a/hotspot/src/share/vm/gc_implementation/includeDB_gc_g1 +++ b/hotspot/src/share/vm/gc_implementation/includeDB_gc_g1 @@ -266,7 +266,7 @@ heapRegion.cpp oop.inline.hpp heapRegion.hpp space.hpp heapRegion.hpp spaceDecorator.hpp -heapRegion.hpp g1BlockOffsetTable.hpp +heapRegion.hpp g1BlockOffsetTable.inline.hpp heapRegion.hpp watermark.hpp heapRegion.hpp g1_specialized_oop_closures.hpp heapRegion.hpp survRateGroup.hpp From aa6165d767aa16ac9f2befeed9f5b30718efa769 Mon Sep 17 00:00:00 2001 From: "Y. Srinivas Ramakrishna" Date: Tue, 26 Aug 2008 14:54:48 -0700 Subject: [PATCH 012/267] 6722116: CMS: Incorrect overflow handling when using parallel concurrent marking Fixed CMSConcMarkingTask::reset() to store the restart address upon a marking stack overflow and to use it as the base, suitably aligned, for restarting the scan in CMSConcMarkingTask::do_scan_and_mark(). Reviewed-by: jcoomes, tonyp --- .../compactibleFreeListSpace.cpp | 11 ++- .../concurrentMarkSweepGeneration.cpp | 95 ++++++++++++------- 2 files changed, 69 insertions(+), 37 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp index af9a9ecf3dc..8eba79902db 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp @@ -2790,10 +2790,11 @@ initialize_sequential_subtasks_for_rescan(int n_threads) { assert(n_threads > 0, "Unexpected n_threads argument"); const size_t task_size = rescan_task_size(); size_t n_tasks = (used_region().word_size() + task_size - 1)/task_size; - assert((used_region().start() + (n_tasks - 1)*task_size < - used_region().end()) && - (used_region().start() + n_tasks*task_size >= - used_region().end()), "n_task calculation incorrect"); + assert((n_tasks == 0) == used_region().is_empty(), "n_tasks incorrect"); + assert(n_tasks == 0 || + ((used_region().start() + (n_tasks - 1)*task_size < used_region().end()) && + (used_region().start() + n_tasks*task_size >= used_region().end())), + "n_tasks calculation incorrect"); SequentialSubTasksDone* pst = conc_par_seq_tasks(); assert(!pst->valid(), "Clobbering existing data?"); pst->set_par_threads(n_threads); @@ -2833,7 +2834,7 @@ initialize_sequential_subtasks_for_marking(int n_threads, assert(n_tasks == 0 || ((span.start() + (n_tasks - 1)*task_size < span.end()) && (span.start() + n_tasks*task_size >= span.end())), - "n_task calculation incorrect"); + "n_tasks calculation incorrect"); SequentialSubTasksDone* pst = conc_par_seq_tasks(); assert(!pst->valid(), "Clobbering existing data?"); pst->set_par_threads(n_threads); diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp index 697ce756825..d10d9844890 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp @@ -3650,6 +3650,7 @@ class CMSConcMarkingTask: public YieldingFlexibleGangTask { CompactibleFreeListSpace* _cms_space; CompactibleFreeListSpace* _perm_space; HeapWord* _global_finger; + HeapWord* _restart_addr; // Exposed here for yielding support Mutex* const _bit_map_lock; @@ -3680,7 +3681,7 @@ class CMSConcMarkingTask: public YieldingFlexibleGangTask { _term.set_task(this); assert(_cms_space->bottom() < _perm_space->bottom(), "Finger incorrectly initialized below"); - _global_finger = _cms_space->bottom(); + _restart_addr = _global_finger = _cms_space->bottom(); } @@ -3698,6 +3699,10 @@ class CMSConcMarkingTask: public YieldingFlexibleGangTask { bool result() { return _result; } void reset(HeapWord* ra) { + assert(_global_finger >= _cms_space->end(), "Postcondition of ::work(i)"); + assert(_global_finger >= _perm_space->end(), "Postcondition of ::work(i)"); + assert(ra < _perm_space->end(), "ra too large"); + _restart_addr = _global_finger = ra; _term.reset_for_reuse(); } @@ -3842,16 +3847,24 @@ void CMSConcMarkingTask::do_scan_and_mark(int i, CompactibleFreeListSpace* sp) { int n_tasks = pst->n_tasks(); // We allow that there may be no tasks to do here because // we are restarting after a stack overflow. - assert(pst->valid() || n_tasks == 0, "Uninitializd use?"); + assert(pst->valid() || n_tasks == 0, "Uninitialized use?"); int nth_task = 0; - HeapWord* start = sp->bottom(); + HeapWord* aligned_start = sp->bottom(); + if (sp->used_region().contains(_restart_addr)) { + // Align down to a card boundary for the start of 0th task + // for this space. + aligned_start = + (HeapWord*)align_size_down((uintptr_t)_restart_addr, + CardTableModRefBS::card_size); + } + size_t chunk_size = sp->marking_task_size(); while (!pst->is_task_claimed(/* reference */ nth_task)) { // Having claimed the nth task in this space, // compute the chunk that it corresponds to: - MemRegion span = MemRegion(start + nth_task*chunk_size, - start + (nth_task+1)*chunk_size); + MemRegion span = MemRegion(aligned_start + nth_task*chunk_size, + aligned_start + (nth_task+1)*chunk_size); // Try and bump the global finger via a CAS; // note that we need to do the global finger bump // _before_ taking the intersection below, because @@ -3866,26 +3879,40 @@ void CMSConcMarkingTask::do_scan_and_mark(int i, CompactibleFreeListSpace* sp) { // beyond the "top" address of the space. span = span.intersection(sp->used_region()); if (!span.is_empty()) { // Non-null task - // We want to skip the first object because - // the protocol is to scan any object in its entirety - // that _starts_ in this span; a fortiori, any - // object starting in an earlier span is scanned - // as part of an earlier claimed task. - // Below we use the "careful" version of block_start - // so we do not try to navigate uninitialized objects. - HeapWord* prev_obj = sp->block_start_careful(span.start()); - // Below we use a variant of block_size that uses the - // Printezis bits to avoid waiting for allocated - // objects to become initialized/parsable. - while (prev_obj < span.start()) { - size_t sz = sp->block_size_no_stall(prev_obj, _collector); - if (sz > 0) { - prev_obj += sz; + HeapWord* prev_obj; + assert(!span.contains(_restart_addr) || nth_task == 0, + "Inconsistency"); + if (nth_task == 0) { + // For the 0th task, we'll not need to compute a block_start. + if (span.contains(_restart_addr)) { + // In the case of a restart because of stack overflow, + // we might additionally skip a chunk prefix. + prev_obj = _restart_addr; } else { - // In this case we may end up doing a bit of redundant - // scanning, but that appears unavoidable, short of - // locking the free list locks; see bug 6324141. - break; + prev_obj = span.start(); + } + } else { + // We want to skip the first object because + // the protocol is to scan any object in its entirety + // that _starts_ in this span; a fortiori, any + // object starting in an earlier span is scanned + // as part of an earlier claimed task. + // Below we use the "careful" version of block_start + // so we do not try to navigate uninitialized objects. + prev_obj = sp->block_start_careful(span.start()); + // Below we use a variant of block_size that uses the + // Printezis bits to avoid waiting for allocated + // objects to become initialized/parsable. + while (prev_obj < span.start()) { + size_t sz = sp->block_size_no_stall(prev_obj, _collector); + if (sz > 0) { + prev_obj += sz; + } else { + // In this case we may end up doing a bit of redundant + // scanning, but that appears unavoidable, short of + // locking the free list locks; see bug 6324141. + break; + } } } if (prev_obj < span.end()) { @@ -3938,12 +3965,14 @@ class Par_ConcMarkingClosure: public OopClosure { void handle_stack_overflow(HeapWord* lost); }; -// Grey object rescan during work stealing phase -- -// the salient assumption here is that stolen oops must -// always be initialized, so we do not need to check for -// uninitialized objects before scanning here. +// Grey object scanning during work stealing phase -- +// the salient assumption here is that any references +// that are in these stolen objects being scanned must +// already have been initialized (else they would not have +// been published), so we do not need to check for +// uninitialized objects before pushing here. void Par_ConcMarkingClosure::do_oop(oop obj) { - assert(obj->is_oop_or_null(), "expected an oop or NULL"); + assert(obj->is_oop_or_null(true), "expected an oop or NULL"); HeapWord* addr = (HeapWord*)obj; // Check if oop points into the CMS generation // and is not marked @@ -4001,7 +4030,7 @@ void Par_ConcMarkingClosure::trim_queue(size_t max) { // in CMSCollector's _restart_address. void Par_ConcMarkingClosure::handle_stack_overflow(HeapWord* lost) { // We need to do this under a mutex to prevent other - // workers from interfering with the expansion below. + // workers from interfering with the work done below. MutexLockerEx ml(_overflow_stack->par_lock(), Mutex::_no_safepoint_check_flag); // Remember the least grey address discarded @@ -6554,7 +6583,7 @@ void Par_MarkRefsIntoAndScanClosure::do_oop(oop obj) { if (obj != NULL) { // Ignore mark word because this could be an already marked oop // that may be chained at the end of the overflow list. - assert(obj->is_oop(), "expected an oop"); + assert(obj->is_oop(true), "expected an oop"); HeapWord* addr = (HeapWord*)obj; if (_span.contains(addr) && !_bit_map->isMarked(addr)) { @@ -7289,6 +7318,8 @@ Par_PushOrMarkClosure::Par_PushOrMarkClosure(CMSCollector* collector, _should_remember_klasses(collector->should_unload_classes()) { } +// Assumes thread-safe access by callers, who are +// responsible for mutual exclusion. void CMSCollector::lower_restart_addr(HeapWord* low) { assert(_span.contains(low), "Out of bounds addr"); if (_restart_addr == NULL) { @@ -7314,7 +7345,7 @@ void PushOrMarkClosure::handle_stack_overflow(HeapWord* lost) { // in CMSCollector's _restart_address. void Par_PushOrMarkClosure::handle_stack_overflow(HeapWord* lost) { // We need to do this under a mutex to prevent other - // workers from interfering with the expansion below. + // workers from interfering with the work done below. MutexLockerEx ml(_overflow_stack->par_lock(), Mutex::_no_safepoint_check_flag); // Remember the least grey address discarded From 6358686351b27cae6e5ccd228e9026f61a895e9d Mon Sep 17 00:00:00 2001 From: Jon Masamitsu Date: Thu, 4 Sep 2008 14:49:08 -0700 Subject: [PATCH 013/267] 6743059: Error in spaceDecorator.cpp "optimized" build Changed the guard on the definition of the method value in HeapWord from ASSERT to not PRODUCT. Reviewed-by: iveresov, apetrusenko --- hotspot/src/share/vm/utilities/globalDefinitions.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hotspot/src/share/vm/utilities/globalDefinitions.hpp b/hotspot/src/share/vm/utilities/globalDefinitions.hpp index 258a70f0154..f87bfad69ac 100644 --- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp +++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp @@ -99,7 +99,7 @@ class HeapWord { friend class VMStructs; private: char* i; -#ifdef ASSERT +#ifndef PRODUCT public: char* value() { return i; } #endif From eee15b163e38d080565e36ee6fc24a3f1401d8fe Mon Sep 17 00:00:00 2001 From: Chuck Rasbold Date: Wed, 17 Sep 2008 08:29:17 -0700 Subject: [PATCH 014/267] 6711100: 64bit fastdebug server vm crashes with assert(_base == Int,"Not an Int") Insert CastII nodes to narrow type of load_array_length() node Reviewed-by: never, kvn --- hotspot/src/share/vm/opto/callnode.cpp | 33 +++++++++++++++ hotspot/src/share/vm/opto/callnode.hpp | 15 ++++--- hotspot/src/share/vm/opto/graphKit.cpp | 56 +++++++++++++------------ hotspot/src/share/vm/opto/memnode.cpp | 45 ++++++++++++++++++-- hotspot/src/share/vm/opto/memnode.hpp | 1 + hotspot/src/share/vm/opto/parse2.cpp | 12 ++++-- hotspot/src/share/vm/opto/type.cpp | 11 +++-- hotspot/src/share/vm/opto/type.hpp | 2 +- hotspot/test/compiler/6711100/Test.java | 53 +++++++++++++++++++++++ 9 files changed, 181 insertions(+), 47 deletions(-) create mode 100644 hotspot/test/compiler/6711100/Test.java diff --git a/hotspot/src/share/vm/opto/callnode.cpp b/hotspot/src/share/vm/opto/callnode.cpp index 2e54ce71801..8e8fc24da20 100644 --- a/hotspot/src/share/vm/opto/callnode.cpp +++ b/hotspot/src/share/vm/opto/callnode.cpp @@ -1034,6 +1034,39 @@ AllocateNode::AllocateNode(Compile* C, const TypeFunc *atype, //============================================================================= uint AllocateArrayNode::size_of() const { return sizeof(*this); } +// Retrieve the length from the AllocateArrayNode. Narrow the type with a +// CastII, if appropriate. If we are not allowed to create new nodes, and +// a CastII is appropriate, return NULL. +Node *AllocateArrayNode::make_ideal_length(const TypeOopPtr* oop_type, PhaseTransform *phase, bool allow_new_nodes) { + Node *length = in(AllocateNode::ALength); + assert(length != NULL, "length is not null"); + + const TypeInt* length_type = phase->find_int_type(length); + const TypeAryPtr* ary_type = oop_type->isa_aryptr(); + + if (ary_type != NULL && length_type != NULL) { + const TypeInt* narrow_length_type = ary_type->narrow_size_type(length_type); + if (narrow_length_type != length_type) { + // Assert one of: + // - the narrow_length is 0 + // - the narrow_length is not wider than length + assert(narrow_length_type == TypeInt::ZERO || + (narrow_length_type->_hi <= length_type->_hi && + narrow_length_type->_lo >= length_type->_lo), + "narrow type must be narrower than length type"); + + // Return NULL if new nodes are not allowed + if (!allow_new_nodes) return NULL; + // Create a cast which is control dependent on the initialization to + // propagate the fact that the array length must be positive. + length = new (phase->C, 2) CastIINode(length, narrow_length_type); + length->set_req(0, initialization()->proj_out(0)); + } + } + + return length; +} + //============================================================================= uint LockNode::size_of() const { return sizeof(*this); } diff --git a/hotspot/src/share/vm/opto/callnode.hpp b/hotspot/src/share/vm/opto/callnode.hpp index 0f9b26e154c..20192ddf0f6 100644 --- a/hotspot/src/share/vm/opto/callnode.hpp +++ b/hotspot/src/share/vm/opto/callnode.hpp @@ -755,6 +755,15 @@ public: virtual int Opcode() const; virtual uint size_of() const; // Size is bigger + // Dig the length operand out of a array allocation site. + Node* Ideal_length() { + return in(AllocateNode::ALength); + } + + // Dig the length operand out of a array allocation site and narrow the + // type with a CastII, if necesssary + Node* make_ideal_length(const TypeOopPtr* ary_type, PhaseTransform *phase, bool can_create = true); + // Pattern-match a possible usage of AllocateArrayNode. // Return null if no allocation is recognized. static AllocateArrayNode* Ideal_array_allocation(Node* ptr, PhaseTransform* phase) { @@ -762,12 +771,6 @@ public: return (allo == NULL || !allo->is_AllocateArray()) ? NULL : allo->as_AllocateArray(); } - - // Dig the length operand out of a (possible) array allocation site. - static Node* Ideal_length(Node* ptr, PhaseTransform* phase) { - AllocateArrayNode* allo = Ideal_array_allocation(ptr, phase); - return (allo == NULL) ? NULL : allo->in(AllocateNode::ALength); - } }; //------------------------------AbstractLockNode----------------------------------- diff --git a/hotspot/src/share/vm/opto/graphKit.cpp b/hotspot/src/share/vm/opto/graphKit.cpp index 2fcb90f4e45..78c7d971ad2 100644 --- a/hotspot/src/share/vm/opto/graphKit.cpp +++ b/hotspot/src/share/vm/opto/graphKit.cpp @@ -1049,10 +1049,19 @@ Node* GraphKit::load_object_klass(Node* obj) { //-------------------------load_array_length----------------------------------- Node* GraphKit::load_array_length(Node* array) { // Special-case a fresh allocation to avoid building nodes: - Node* alen = AllocateArrayNode::Ideal_length(array, &_gvn); - if (alen != NULL) return alen; - Node *r_adr = basic_plus_adr(array, arrayOopDesc::length_offset_in_bytes()); - return _gvn.transform( new (C, 3) LoadRangeNode(0, immutable_memory(), r_adr, TypeInt::POS)); + AllocateArrayNode* alloc = AllocateArrayNode::Ideal_array_allocation(array, &_gvn); + Node *alen; + if (alloc == NULL) { + Node *r_adr = basic_plus_adr(array, arrayOopDesc::length_offset_in_bytes()); + alen = _gvn.transform( new (C, 3) LoadRangeNode(0, immutable_memory(), r_adr, TypeInt::POS)); + } else { + alen = alloc->Ideal_length(); + Node* ccast = alloc->make_ideal_length(_gvn.type(array)->is_aryptr(), &_gvn); + if (ccast != alen) { + alen = _gvn.transform(ccast); + } + } + return alen; } //------------------------------do_null_check---------------------------------- @@ -2833,20 +2842,18 @@ Node* GraphKit::set_output_for_allocation(AllocateNode* alloc, assert(just_allocated_object(control()) == javaoop, "just allocated"); #ifdef ASSERT - { // Verify that the AllocateNode::Ideal_foo recognizers work: - Node* kn = alloc->in(AllocateNode::KlassNode); - Node* ln = alloc->in(AllocateNode::ALength); - assert(AllocateNode::Ideal_klass(rawoop, &_gvn) == kn, - "Ideal_klass works"); - assert(AllocateNode::Ideal_klass(javaoop, &_gvn) == kn, - "Ideal_klass works"); + { // Verify that the AllocateNode::Ideal_allocation recognizers work: + assert(AllocateNode::Ideal_allocation(rawoop, &_gvn) == alloc, + "Ideal_allocation works"); + assert(AllocateNode::Ideal_allocation(javaoop, &_gvn) == alloc, + "Ideal_allocation works"); if (alloc->is_AllocateArray()) { - assert(AllocateArrayNode::Ideal_length(rawoop, &_gvn) == ln, - "Ideal_length works"); - assert(AllocateArrayNode::Ideal_length(javaoop, &_gvn) == ln, - "Ideal_length works"); + assert(AllocateArrayNode::Ideal_array_allocation(rawoop, &_gvn) == alloc->as_AllocateArray(), + "Ideal_allocation works"); + assert(AllocateArrayNode::Ideal_array_allocation(javaoop, &_gvn) == alloc->as_AllocateArray(), + "Ideal_allocation works"); } else { - assert(ln->is_top(), "no length, please"); + assert(alloc->in(AllocateNode::ALength)->is_top(), "no length, please"); } } #endif //ASSERT @@ -3095,25 +3102,20 @@ Node* GraphKit::new_array(Node* klass_node, // array klass (maybe variable) // (This happens via a non-constant argument to inline_native_newArray.) // In any case, the value of klass_node provides the desired array type. const TypeInt* length_type = _gvn.find_int_type(length); - const TypeInt* narrow_length_type = NULL; const TypeOopPtr* ary_type = _gvn.type(klass_node)->is_klassptr()->as_instance_type(); if (ary_type->isa_aryptr() && length_type != NULL) { // Try to get a better type than POS for the size ary_type = ary_type->is_aryptr()->cast_to_size(length_type); - narrow_length_type = ary_type->is_aryptr()->size(); - if (narrow_length_type == length_type) - narrow_length_type = NULL; } Node* javaoop = set_output_for_allocation(alloc, ary_type, raw_mem_only); - // Cast length on remaining path to be positive: - if (narrow_length_type != NULL) { - Node* ccast = new (C, 2) CastIINode(length, narrow_length_type); - ccast->set_req(0, control()); - _gvn.set_type_bottom(ccast); - record_for_igvn(ccast); - if (map()->find_edge(length) >= 0) { + // Cast length on remaining path to be as narrow as possible + if (map()->find_edge(length) >= 0) { + Node* ccast = alloc->make_ideal_length(ary_type, &_gvn); + if (ccast != length) { + _gvn.set_type_bottom(ccast); + record_for_igvn(ccast); replace_in_map(length, ccast); } } diff --git a/hotspot/src/share/vm/opto/memnode.cpp b/hotspot/src/share/vm/opto/memnode.cpp index 56f7ef736c9..ea7e062aef9 100644 --- a/hotspot/src/share/vm/opto/memnode.cpp +++ b/hotspot/src/share/vm/opto/memnode.cpp @@ -1887,6 +1887,38 @@ const Type *LoadRangeNode::Value( PhaseTransform *phase ) const { return tap->size(); } +//-------------------------------Ideal--------------------------------------- +// Feed through the length in AllocateArray(...length...)._length. +Node *LoadRangeNode::Ideal(PhaseGVN *phase, bool can_reshape) { + Node* p = MemNode::Ideal_common(phase, can_reshape); + if (p) return (p == NodeSentinel) ? NULL : p; + + // Take apart the address into an oop and and offset. + // Return 'this' if we cannot. + Node* adr = in(MemNode::Address); + intptr_t offset = 0; + Node* base = AddPNode::Ideal_base_and_offset(adr, phase, offset); + if (base == NULL) return NULL; + const TypeAryPtr* tary = phase->type(adr)->isa_aryptr(); + if (tary == NULL) return NULL; + + // We can fetch the length directly through an AllocateArrayNode. + // This works even if the length is not constant (clone or newArray). + if (offset == arrayOopDesc::length_offset_in_bytes()) { + AllocateArrayNode* alloc = AllocateArrayNode::Ideal_array_allocation(base, phase); + if (alloc != NULL) { + Node* allocated_length = alloc->Ideal_length(); + Node* len = alloc->make_ideal_length(tary, phase); + if (allocated_length != len) { + // New CastII improves on this. + return len; + } + } + } + + return NULL; +} + //------------------------------Identity--------------------------------------- // Feed through the length in AllocateArray(...length...)._length. Node* LoadRangeNode::Identity( PhaseTransform *phase ) { @@ -1905,15 +1937,22 @@ Node* LoadRangeNode::Identity( PhaseTransform *phase ) { // We can fetch the length directly through an AllocateArrayNode. // This works even if the length is not constant (clone or newArray). if (offset == arrayOopDesc::length_offset_in_bytes()) { - Node* allocated_length = AllocateArrayNode::Ideal_length(base, phase); - if (allocated_length != NULL) { - return allocated_length; + AllocateArrayNode* alloc = AllocateArrayNode::Ideal_array_allocation(base, phase); + if (alloc != NULL) { + Node* allocated_length = alloc->Ideal_length(); + // Do not allow make_ideal_length to allocate a CastII node. + Node* len = alloc->make_ideal_length(tary, phase, false); + if (allocated_length == len) { + // Return allocated_length only if it would not be improved by a CastII. + return allocated_length; + } } } return this; } + //============================================================================= //---------------------------StoreNode::make----------------------------------- // Polymorphic factory method: diff --git a/hotspot/src/share/vm/opto/memnode.hpp b/hotspot/src/share/vm/opto/memnode.hpp index dff9dad102e..2b40a676c45 100644 --- a/hotspot/src/share/vm/opto/memnode.hpp +++ b/hotspot/src/share/vm/opto/memnode.hpp @@ -241,6 +241,7 @@ public: virtual int Opcode() const; virtual const Type *Value( PhaseTransform *phase ) const; virtual Node *Identity( PhaseTransform *phase ); + virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); }; //------------------------------LoadLNode-------------------------------------- diff --git a/hotspot/src/share/vm/opto/parse2.cpp b/hotspot/src/share/vm/opto/parse2.cpp index cc1d6b3e430..0f40fdd962e 100644 --- a/hotspot/src/share/vm/opto/parse2.cpp +++ b/hotspot/src/share/vm/opto/parse2.cpp @@ -100,16 +100,17 @@ Node* Parse::array_addressing(BasicType type, int vals, const Type* *result2) { // Do the range check if (GenerateRangeChecks && need_range_check) { - // Range is constant in array-oop, so we can use the original state of mem - Node* len = load_array_length(ary); Node* tst; if (sizetype->_hi <= 0) { - // If the greatest array bound is negative, we can conclude that we're + // The greatest array bound is negative, so we can conclude that we're // compiling unreachable code, but the unsigned compare trick used below // only works with non-negative lengths. Instead, hack "tst" to be zero so // the uncommon_trap path will always be taken. tst = _gvn.intcon(0); } else { + // Range is constant in array-oop, so we can use the original state of mem + Node* len = load_array_length(ary); + // Test length vs index (standard trick using unsigned compare) Node* chk = _gvn.transform( new (C, 3) CmpUNode(idx, len) ); BoolTest::mask btest = BoolTest::lt; @@ -137,9 +138,12 @@ Node* Parse::array_addressing(BasicType type, int vals, const Type* *result2) { // Check for always knowing you are throwing a range-check exception if (stopped()) return top(); - Node* ptr = array_element_address( ary, idx, type, sizetype); + Node* ptr = array_element_address(ary, idx, type, sizetype); if (result2 != NULL) *result2 = elemtype; + + assert(ptr != top(), "top should go hand-in-hand with stopped"); + return ptr; } diff --git a/hotspot/src/share/vm/opto/type.cpp b/hotspot/src/share/vm/opto/type.cpp index 243b44c4263..3e9b66ba32e 100644 --- a/hotspot/src/share/vm/opto/type.cpp +++ b/hotspot/src/share/vm/opto/type.cpp @@ -3157,17 +3157,18 @@ static jint max_array_length(BasicType etype) { // Narrow the given size type to the index range for the given array base type. // Return NULL if the resulting int type becomes empty. -const TypeInt* TypeAryPtr::narrow_size_type(const TypeInt* size, BasicType elem) { +const TypeInt* TypeAryPtr::narrow_size_type(const TypeInt* size) const { jint hi = size->_hi; jint lo = size->_lo; jint min_lo = 0; - jint max_hi = max_array_length(elem); + jint max_hi = max_array_length(elem()->basic_type()); //if (index_not_size) --max_hi; // type of a valid array index, FTR bool chg = false; if (lo < min_lo) { lo = min_lo; chg = true; } if (hi > max_hi) { hi = max_hi; chg = true; } + // Negative length arrays will produce weird intermediate dead fath-path code if (lo > hi) - return NULL; + return TypeInt::ZERO; if (!chg) return size; return TypeInt::make(lo, hi, Type::WidenMin); @@ -3176,9 +3177,7 @@ const TypeInt* TypeAryPtr::narrow_size_type(const TypeInt* size, BasicType elem) //-------------------------------cast_to_size---------------------------------- const TypeAryPtr* TypeAryPtr::cast_to_size(const TypeInt* new_size) const { assert(new_size != NULL, ""); - new_size = narrow_size_type(new_size, elem()->basic_type()); - if (new_size == NULL) // Negative length arrays will produce weird - new_size = TypeInt::ZERO; // intermediate dead fast-path goo + new_size = narrow_size_type(new_size); if (new_size == size()) return this; const TypeAry* new_ary = TypeAry::make(elem(), new_size); return make(ptr(), const_oop(), new_ary, klass(), klass_is_exact(), _offset, _instance_id); diff --git a/hotspot/src/share/vm/opto/type.hpp b/hotspot/src/share/vm/opto/type.hpp index 68366edca9b..69bc06a7384 100644 --- a/hotspot/src/share/vm/opto/type.hpp +++ b/hotspot/src/share/vm/opto/type.hpp @@ -840,6 +840,7 @@ public: virtual const TypeOopPtr *cast_to_instance_id(int instance_id) const; virtual const TypeAryPtr* cast_to_size(const TypeInt* size) const; + virtual const TypeInt* narrow_size_type(const TypeInt* size) const; virtual bool empty(void) const; // TRUE if type is vacuous virtual const TypePtr *add_offset( intptr_t offset ) const; @@ -865,7 +866,6 @@ public: } static const TypeAryPtr *_array_body_type[T_CONFLICT+1]; // sharpen the type of an int which is used as an array size - static const TypeInt* narrow_size_type(const TypeInt* size, BasicType elem); #ifndef PRODUCT virtual void dump2( Dict &d, uint depth, outputStream *st ) const; // Specialized per-Type dumping #endif diff --git a/hotspot/test/compiler/6711100/Test.java b/hotspot/test/compiler/6711100/Test.java new file mode 100644 index 00000000000..e1f0135b99d --- /dev/null +++ b/hotspot/test/compiler/6711100/Test.java @@ -0,0 +1,53 @@ +/* + * 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. + * + * 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 6711100 + * @summary 64bit fastdebug server vm crashes with assert(_base == Int,"Not an Int") + * @run main/othervm -Xcomp -XX:CompileOnly=Test. Test + */ + +public class Test { + + static byte b; + + // The server compiler chokes on compiling + // this method when f() is not inlined + public Test() { + b = (new byte[1])[(new byte[f()])[-1]]; + } + + protected static int f() { + return 1; + } + + public static void main(String[] args) { + try { + Test t = new Test(); + } catch (ArrayIndexOutOfBoundsException e) { + } + } +} + + From 4b1e2422991c80ad2eb8685274509f51d6c7a9a4 Mon Sep 17 00:00:00 2001 From: Tom Rodriguez Date: Wed, 17 Sep 2008 12:59:52 -0700 Subject: [PATCH 015/267] 6384206: Phis which are later unneeded are impairing our ability to inline based on static types Reviewed-by: rasbold, jrose --- hotspot/src/share/vm/ci/ciMethodBlocks.cpp | 13 +- hotspot/src/share/vm/ci/ciMethodBlocks.hpp | 5 +- hotspot/src/share/vm/ci/ciTypeFlow.cpp | 848 +++++++++++++++----- hotspot/src/share/vm/ci/ciTypeFlow.hpp | 256 +++++- hotspot/src/share/vm/includeDB_compiler2 | 2 + hotspot/src/share/vm/opto/bytecodeInfo.cpp | 37 - hotspot/src/share/vm/opto/cfgnode.cpp | 6 +- hotspot/src/share/vm/opto/compile.cpp | 6 +- hotspot/src/share/vm/opto/compile.hpp | 3 + hotspot/src/share/vm/opto/doCall.cpp | 2 +- hotspot/src/share/vm/opto/graphKit.cpp | 4 +- hotspot/src/share/vm/opto/loopTransform.cpp | 2 + hotspot/src/share/vm/opto/loopnode.cpp | 50 +- hotspot/src/share/vm/opto/loopnode.hpp | 2 + hotspot/src/share/vm/opto/loopopts.cpp | 4 + hotspot/src/share/vm/opto/matcher.cpp | 2 +- hotspot/src/share/vm/opto/parse.hpp | 25 +- hotspot/src/share/vm/opto/parse1.cpp | 216 +++-- 18 files changed, 1082 insertions(+), 401 deletions(-) diff --git a/hotspot/src/share/vm/ci/ciMethodBlocks.cpp b/hotspot/src/share/vm/ci/ciMethodBlocks.cpp index 2810523f4fc..4f7e52559e6 100644 --- a/hotspot/src/share/vm/ci/ciMethodBlocks.cpp +++ b/hotspot/src/share/vm/ci/ciMethodBlocks.cpp @@ -49,7 +49,7 @@ bool ciMethodBlocks::is_block_start(int bci) { // first half. Returns the range beginning at bci. ciBlock *ciMethodBlocks::split_block_at(int bci) { ciBlock *former_block = block_containing(bci); - ciBlock *new_block = new(_arena) ciBlock(_method, _num_blocks++, this, former_block->start_bci()); + ciBlock *new_block = new(_arena) ciBlock(_method, _num_blocks++, former_block->start_bci()); _blocks->append(new_block); assert(former_block != NULL, "must not be NULL"); new_block->set_limit_bci(bci); @@ -83,7 +83,7 @@ ciBlock *ciMethodBlocks::make_block_at(int bci) { if (cb == NULL ) { // This is our first time visiting this bytecode. Create // a fresh block and assign it this starting point. - ciBlock *nb = new(_arena) ciBlock(_method, _num_blocks++, this, bci); + ciBlock *nb = new(_arena) ciBlock(_method, _num_blocks++, bci); _blocks->append(nb); _bci_to_block[bci] = nb; return nb; @@ -98,6 +98,11 @@ ciBlock *ciMethodBlocks::make_block_at(int bci) { } } +ciBlock *ciMethodBlocks::make_dummy_block() { + ciBlock *dum = new(_arena) ciBlock(_method, -1, 0); + return dum; +} + void ciMethodBlocks::do_analysis() { ciBytecodeStream s(_method); ciBlock *cur_block = block_containing(0); @@ -253,7 +258,7 @@ ciMethodBlocks::ciMethodBlocks(Arena *arena, ciMethod *meth): _method(meth), Copy::zero_to_words((HeapWord*) _bci_to_block, b2bsize / sizeof(HeapWord)); // create initial block covering the entire method - ciBlock *b = new(arena) ciBlock(_method, _num_blocks++, this, 0); + ciBlock *b = new(arena) ciBlock(_method, _num_blocks++, 0); _blocks->append(b); _bci_to_block[0] = b; @@ -334,7 +339,7 @@ void ciMethodBlocks::dump() { #endif -ciBlock::ciBlock(ciMethod *method, int index, ciMethodBlocks *mb, int start_bci) : +ciBlock::ciBlock(ciMethod *method, int index, int start_bci) : #ifndef PRODUCT _method(method), #endif diff --git a/hotspot/src/share/vm/ci/ciMethodBlocks.hpp b/hotspot/src/share/vm/ci/ciMethodBlocks.hpp index edfdf19b07e..f1a07513d1f 100644 --- a/hotspot/src/share/vm/ci/ciMethodBlocks.hpp +++ b/hotspot/src/share/vm/ci/ciMethodBlocks.hpp @@ -48,6 +48,8 @@ public: int num_blocks() { return _num_blocks;} void clear_processed(); + ciBlock *make_dummy_block(); // a block not associated with a bci + #ifndef PRODUCT void dump(); #endif @@ -81,7 +83,7 @@ public: fall_through_bci = -1 }; - ciBlock(ciMethod *method, int index, ciMethodBlocks *mb, int start_bci); + ciBlock(ciMethod *method, int index, int start_bci); int start_bci() const { return _start_bci; } int limit_bci() const { return _limit_bci; } int control_bci() const { return _control_bci; } @@ -94,7 +96,6 @@ public: int ex_limit_bci() const { return _ex_limit_bci; } bool contains(int bci) const { return start_bci() <= bci && bci < limit_bci(); } - // flag handling bool processed() const { return (_flags & Processed) != 0; } bool is_handler() const { return (_flags & Handler) != 0; } diff --git a/hotspot/src/share/vm/ci/ciTypeFlow.cpp b/hotspot/src/share/vm/ci/ciTypeFlow.cpp index df053f35ea4..2054ee5b536 100644 --- a/hotspot/src/share/vm/ci/ciTypeFlow.cpp +++ b/hotspot/src/share/vm/ci/ciTypeFlow.cpp @@ -338,8 +338,10 @@ ciTypeFlow::StateVector::StateVector(ciTypeFlow* analyzer) { } _trap_bci = -1; _trap_index = 0; + _def_locals.clear(); } + // ------------------------------------------------------------------ // ciTypeFlow::get_start_state // @@ -735,7 +737,7 @@ void ciTypeFlow::StateVector::do_multianewarray(ciBytecodeStream* str) { void ciTypeFlow::StateVector::do_new(ciBytecodeStream* str) { bool will_link; ciKlass* klass = str->get_klass(will_link); - if (!will_link) { + if (!will_link || str->is_unresolved_klass()) { trap(str, klass, str->get_klass_index()); } else { push_object(klass); @@ -1268,7 +1270,9 @@ bool ciTypeFlow::StateVector::apply_one_bytecode(ciBytecodeStream* str) { } case Bytecodes::_iinc: { - check_int(local(str->get_index())); + int lnum = str->get_index(); + check_int(local(lnum)); + store_to_local(lnum); break; } case Bytecodes::_iload: load_local_int(str->get_index()); break; @@ -1506,6 +1510,46 @@ void ciTypeFlow::StateVector::print_on(outputStream* st) const { } #endif + +// ------------------------------------------------------------------ +// ciTypeFlow::SuccIter::next +// +void ciTypeFlow::SuccIter::next() { + int succ_ct = _pred->successors()->length(); + int next = _index + 1; + if (next < succ_ct) { + _index = next; + _succ = _pred->successors()->at(next); + return; + } + for (int i = next - succ_ct; i < _pred->exceptions()->length(); i++) { + // Do not compile any code for unloaded exception types. + // Following compiler passes are responsible for doing this also. + ciInstanceKlass* exception_klass = _pred->exc_klasses()->at(i); + if (exception_klass->is_loaded()) { + _index = next; + _succ = _pred->exceptions()->at(i); + return; + } + next++; + } + _index = -1; + _succ = NULL; +} + +// ------------------------------------------------------------------ +// ciTypeFlow::SuccIter::set_succ +// +void ciTypeFlow::SuccIter::set_succ(Block* succ) { + int succ_ct = _pred->successors()->length(); + if (_index < succ_ct) { + _pred->successors()->at_put(_index, succ); + } else { + int idx = _index - succ_ct; + _pred->exceptions()->at_put(idx, succ); + } +} + // ciTypeFlow::Block // // A basic block. @@ -1526,10 +1570,11 @@ ciTypeFlow::Block::Block(ciTypeFlow* outer, _jsrs = new_jsrs; _next = NULL; _on_work_list = false; - _pre_order = -1; assert(!has_pre_order(), ""); - _private_copy = false; + _backedge_copy = false; + _exception_entry = false; _trap_bci = -1; _trap_index = 0; + df_init(); if (CITraceTypeFlow) { tty->print_cr(">> Created new block"); @@ -1541,55 +1586,13 @@ ciTypeFlow::Block::Block(ciTypeFlow* outer, } // ------------------------------------------------------------------ -// ciTypeFlow::Block::clone_loop_head -// -ciTypeFlow::Block* -ciTypeFlow::Block::clone_loop_head(ciTypeFlow* analyzer, - int branch_bci, - ciTypeFlow::Block* target, - ciTypeFlow::JsrSet* jsrs) { - // Loop optimizations are not performed on Tier1 compiles. Do nothing. - if (analyzer->env()->comp_level() < CompLevel_full_optimization) { - return target; - } - - // The current block ends with a branch. - // - // If the target block appears to be the test-clause of a for loop, and - // it is not too large, and it has not yet been cloned, clone it. - // The pre-existing copy becomes the private clone used only by - // the initial iteration of the loop. (We know we are simulating - // the initial iteration right now, since we have never calculated - // successors before for this block.) - - if (branch_bci <= start() - && (target->limit() - target->start()) <= CICloneLoopTestLimit - && target->private_copy_count() == 0) { - // Setting the private_copy bit ensures that the target block cannot be - // reached by any other paths, such as fall-in from the loop body. - // The private copy will be accessible only on successor lists - // created up to this point. - target->set_private_copy(true); - if (CITraceTypeFlow) { - tty->print(">> Cloning a test-clause block "); - print_value_on(tty); - tty->cr(); - } - // If the target is the current block, then later on a new copy of the - // target block will be created when its bytecodes are reached by - // an alternate path. (This is the case for loops with the loop - // head at the bci-wise bottom of the loop, as with pre-1.4.2 javac.) - // - // Otherwise, duplicate the target block now and use it immediately. - // (The case for loops with the loop head at the bci-wise top of the - // loop, as with 1.4.2 javac.) - // - // In either case, the new copy of the block will remain public. - if (target != this) { - target = analyzer->block_at(branch_bci, jsrs); - } - } - return target; +// ciTypeFlow::Block::df_init +void ciTypeFlow::Block::df_init() { + _pre_order = -1; assert(!has_pre_order(), ""); + _post_order = -1; assert(!has_post_order(), ""); + _loop = NULL; + _irreducible_entry = false; + _rpo_next = NULL; } // ------------------------------------------------------------------ @@ -1644,7 +1647,6 @@ ciTypeFlow::Block::successors(ciBytecodeStream* str, case Bytecodes::_ifnull: case Bytecodes::_ifnonnull: // Our successors are the branch target and the next bci. branch_bci = str->get_dest(); - clone_loop_head(analyzer, branch_bci, this, jsrs); _successors = new (arena) GrowableArray(arena, 2, 0, NULL); assert(_successors->length() == IF_NOT_TAKEN, ""); @@ -1658,14 +1660,7 @@ ciTypeFlow::Block::successors(ciBytecodeStream* str, _successors = new (arena) GrowableArray(arena, 1, 0, NULL); assert(_successors->length() == GOTO_TARGET, ""); - target = analyzer->block_at(branch_bci, jsrs); - // If the target block has not been visited yet, and looks like - // a two-way branch, attempt to clone it if it is a loop head. - if (target->_successors != NULL - && target->_successors->length() == (IF_TAKEN + 1)) { - target = clone_loop_head(analyzer, branch_bci, target, jsrs); - } - _successors->append(target); + _successors->append(analyzer->block_at(branch_bci, jsrs)); break; case Bytecodes::_jsr: @@ -1801,65 +1796,60 @@ void ciTypeFlow::Block::compute_exceptions() { } // ------------------------------------------------------------------ -// ciTypeFlow::Block::is_simpler_than -// -// A relation used to order our work list. We work on a block earlier -// if it has a smaller jsr stack or it occurs earlier in the program -// text. -// -// Note: maybe we should redo this functionality to make blocks -// which correspond to exceptions lower priority. -bool ciTypeFlow::Block::is_simpler_than(ciTypeFlow::Block* other) { - if (other == NULL) { - return true; - } else { - int size1 = _jsrs->size(); - int size2 = other->_jsrs->size(); - if (size1 < size2) { - return true; - } else if (size2 < size1) { - return false; - } else { -#if 0 - if (size1 > 0) { - int r1 = _jsrs->record_at(0)->return_address(); - int r2 = _jsrs->record_at(0)->return_address(); - if (r1 < r2) { - return true; - } else if (r2 < r1) { - return false; - } else { - int e1 = _jsrs->record_at(0)->return_address(); - int e2 = _jsrs->record_at(0)->return_address(); - if (e1 < e2) { - return true; - } else if (e2 < e1) { - return false; - } - } - } -#endif - return (start() <= other->start()); - } - } +// ciTypeFlow::Block::set_backedge_copy +// Use this only to make a pre-existing public block into a backedge copy. +void ciTypeFlow::Block::set_backedge_copy(bool z) { + assert(z || (z == is_backedge_copy()), "cannot make a backedge copy public"); + _backedge_copy = z; } // ------------------------------------------------------------------ -// ciTypeFlow::Block::set_private_copy -// Use this only to make a pre-existing public block into a private copy. -void ciTypeFlow::Block::set_private_copy(bool z) { - assert(z || (z == is_private_copy()), "cannot make a private copy public"); - _private_copy = z; +// ciTypeFlow::Block::is_clonable_exit +// +// At most 2 normal successors, one of which continues looping, +// and all exceptional successors must exit. +bool ciTypeFlow::Block::is_clonable_exit(ciTypeFlow::Loop* lp) { + int normal_cnt = 0; + int in_loop_cnt = 0; + for (SuccIter iter(this); !iter.done(); iter.next()) { + Block* succ = iter.succ(); + if (iter.is_normal_ctrl()) { + if (++normal_cnt > 2) return false; + if (lp->contains(succ->loop())) { + if (++in_loop_cnt > 1) return false; + } + } else { + if (lp->contains(succ->loop())) return false; + } + } + return in_loop_cnt == 1; +} + +// ------------------------------------------------------------------ +// ciTypeFlow::Block::looping_succ +// +ciTypeFlow::Block* ciTypeFlow::Block::looping_succ(ciTypeFlow::Loop* lp) { + assert(successors()->length() <= 2, "at most 2 normal successors"); + for (SuccIter iter(this); !iter.done(); iter.next()) { + Block* succ = iter.succ(); + if (lp->contains(succ->loop())) { + return succ; + } + } + return NULL; } #ifndef PRODUCT // ------------------------------------------------------------------ // ciTypeFlow::Block::print_value_on void ciTypeFlow::Block::print_value_on(outputStream* st) const { - if (has_pre_order()) st->print("#%-2d ", pre_order()); + if (has_pre_order()) st->print("#%-2d ", pre_order()); + if (has_rpo()) st->print("rpo#%-2d ", rpo()); st->print("[%d - %d)", start(), limit()); + if (is_loop_head()) st->print(" lphd"); + if (is_irreducible_entry()) st->print(" irred"); if (_jsrs->size() > 0) { st->print("/"); _jsrs->print_on(st); } - if (is_private_copy()) st->print("/private_copy"); + if (is_backedge_copy()) st->print("/backedge_copy"); } // ------------------------------------------------------------------ @@ -1871,6 +1861,16 @@ void ciTypeFlow::Block::print_on(outputStream* st) const { st->print_cr(" ==================================================== "); st->print (" "); print_value_on(st); + st->print(" Stored locals: "); def_locals()->print_on(st, outer()->method()->max_locals()); tty->cr(); + if (loop() && loop()->parent() != NULL) { + st->print(" loops:"); + Loop* lp = loop(); + do { + st->print(" %d<-%d", lp->head()->pre_order(),lp->tail()->pre_order()); + if (lp->is_irreducible()) st->print("(ir)"); + lp = lp->parent(); + } while (lp->parent() != NULL); + } st->cr(); _state->print_on(st); if (_successors == NULL) { @@ -1907,6 +1907,21 @@ void ciTypeFlow::Block::print_on(outputStream* st) const { } #endif +#ifndef PRODUCT +// ------------------------------------------------------------------ +// ciTypeFlow::LocalSet::print_on +void ciTypeFlow::LocalSet::print_on(outputStream* st, int limit) const { + st->print("{"); + for (int i = 0; i < max; i++) { + if (test(i)) st->print(" %d", i); + } + if (limit > max) { + st->print(" %d..%d ", max, limit); + } + st->print(" }"); +} +#endif + // ciTypeFlow // // This is a pass over the bytecodes which computes the following: @@ -1922,12 +1937,11 @@ ciTypeFlow::ciTypeFlow(ciEnv* env, ciMethod* method, int osr_bci) { _max_locals = method->max_locals(); _max_stack = method->max_stack(); _code_size = method->code_size(); + _has_irreducible_entry = false; _osr_bci = osr_bci; _failure_reason = NULL; assert(start_bci() >= 0 && start_bci() < code_size() , "correct osr_bci argument"); - _work_list = NULL; - _next_pre_order = 0; _ciblock_count = _methodBlocks->num_blocks(); _idx_to_blocklist = NEW_ARENA_ARRAY(arena(), GrowableArray*, _ciblock_count); @@ -1949,12 +1963,6 @@ ciTypeFlow::Block* ciTypeFlow::work_list_next() { _work_list = next_block->next(); next_block->set_next(NULL); next_block->set_on_work_list(false); - if (!next_block->has_pre_order()) { - // Assign "pre_order" as each new block is taken from the work list. - // This number may be used by following phases to order block visits. - assert(!have_block_count(), "must not have mapped blocks yet") - next_block->set_pre_order(_next_pre_order++); - } return next_block; } @@ -1962,30 +1970,37 @@ ciTypeFlow::Block* ciTypeFlow::work_list_next() { // ciTypeFlow::add_to_work_list // // Add a basic block to our work list. +// List is sorted by decreasing postorder sort (same as increasing RPO) void ciTypeFlow::add_to_work_list(ciTypeFlow::Block* block) { assert(!block->is_on_work_list(), "must not already be on work list"); if (CITraceTypeFlow) { - tty->print(">> Adding block%s ", block->has_pre_order() ? " (again)" : ""); + tty->print(">> Adding block "); block->print_value_on(tty); tty->print_cr(" to the work list : "); } block->set_on_work_list(true); - if (block->is_simpler_than(_work_list)) { + + // decreasing post order sort + + Block* prev = NULL; + Block* current = _work_list; + int po = block->post_order(); + while (current != NULL) { + if (!current->has_post_order() || po > current->post_order()) + break; + prev = current; + current = current->next(); + } + if (prev == NULL) { block->set_next(_work_list); _work_list = block; } else { - Block *temp = _work_list; - while (!block->is_simpler_than(temp->next())) { - if (CITraceTypeFlow) { - tty->print("."); - } - temp = temp->next(); - } - block->set_next(temp->next()); - temp->set_next(block); + block->set_next(current); + prev->set_next(block); } + if (CITraceTypeFlow) { tty->cr(); } @@ -2008,7 +2023,7 @@ ciTypeFlow::Block* ciTypeFlow::block_at(int bci, ciTypeFlow::JsrSet* jsrs, Creat assert(ciblk->start_bci() == bci, "bad ciBlock boundaries"); Block* block = get_block_for(ciblk->index(), jsrs, option); - assert(block == NULL? (option == no_create): block->is_private_copy() == (option == create_private_copy), "create option consistent with result"); + assert(block == NULL? (option == no_create): block->is_backedge_copy() == (option == create_backedge_copy), "create option consistent with result"); if (CITraceTypeFlow) { if (block != NULL) { @@ -2072,8 +2087,9 @@ void ciTypeFlow::flow_exceptions(GrowableArray* exceptions, } if (block->meet_exception(exception_klass, state)) { - // Block was modified. Add it to the work list. - if (!block->is_on_work_list()) { + // Block was modified and has PO. Add it to the work list. + if (block->has_post_order() && + !block->is_on_work_list()) { add_to_work_list(block); } } @@ -2091,8 +2107,9 @@ void ciTypeFlow::flow_successors(GrowableArray* successors, for (int i = 0; i < len; i++) { Block* block = successors->at(i); if (block->meet(state)) { - // Block was modified. Add it to the work list. - if (!block->is_on_work_list()) { + // Block was modified and has PO. Add it to the work list. + if (block->has_post_order() && + !block->is_on_work_list()) { add_to_work_list(block); } } @@ -2133,6 +2150,111 @@ bool ciTypeFlow::can_trap(ciBytecodeStream& str) { return true; } +// ------------------------------------------------------------------ +// ciTypeFlow::clone_loop_heads +// +// Clone the loop heads +bool ciTypeFlow::clone_loop_heads(Loop* lp, StateVector* temp_vector, JsrSet* temp_set) { + bool rslt = false; + for (PreorderLoops iter(loop_tree_root()); !iter.done(); iter.next()) { + lp = iter.current(); + Block* head = lp->head(); + if (lp == loop_tree_root() || + lp->is_irreducible() || + !head->is_clonable_exit(lp)) + continue; + + // check not already cloned + if (head->backedge_copy_count() != 0) + continue; + + // check _no_ shared head below us + Loop* ch; + for (ch = lp->child(); ch != NULL && ch->head() != head; ch = ch->sibling()); + if (ch != NULL) + continue; + + // Clone head + Block* new_head = head->looping_succ(lp); + Block* clone = clone_loop_head(lp, temp_vector, temp_set); + // Update lp's info + clone->set_loop(lp); + lp->set_head(new_head); + lp->set_tail(clone); + // And move original head into outer loop + head->set_loop(lp->parent()); + + rslt = true; + } + return rslt; +} + +// ------------------------------------------------------------------ +// ciTypeFlow::clone_loop_head +// +// Clone lp's head and replace tail's successors with clone. +// +// | +// v +// head <-> body +// | +// v +// exit +// +// new_head +// +// | +// v +// head ----------\ +// | | +// | v +// | clone <-> body +// | | +// | /--/ +// | | +// v v +// exit +// +ciTypeFlow::Block* ciTypeFlow::clone_loop_head(Loop* lp, StateVector* temp_vector, JsrSet* temp_set) { + Block* head = lp->head(); + Block* tail = lp->tail(); + if (CITraceTypeFlow) { + tty->print(">> Requesting clone of loop head "); head->print_value_on(tty); + tty->print(" for predecessor "); tail->print_value_on(tty); + tty->cr(); + } + Block* clone = block_at(head->start(), head->jsrs(), create_backedge_copy); + assert(clone->backedge_copy_count() == 1, "one backedge copy for all back edges"); + + assert(!clone->has_pre_order(), "just created"); + clone->set_next_pre_order(); + + // Insert clone after (orig) tail in reverse post order + clone->set_rpo_next(tail->rpo_next()); + tail->set_rpo_next(clone); + + // tail->head becomes tail->clone + for (SuccIter iter(tail); !iter.done(); iter.next()) { + if (iter.succ() == head) { + iter.set_succ(clone); + break; + } + } + flow_block(tail, temp_vector, temp_set); + if (head == tail) { + // For self-loops, clone->head becomes clone->clone + flow_block(clone, temp_vector, temp_set); + for (SuccIter iter(clone); !iter.done(); iter.next()) { + if (iter.succ() == head) { + iter.set_succ(clone); + break; + } + } + } + flow_block(clone, temp_vector, temp_set); + + return clone; +} // ------------------------------------------------------------------ // ciTypeFlow::flow_block @@ -2159,11 +2281,14 @@ void ciTypeFlow::flow_block(ciTypeFlow::Block* block, // Grab the state from the current block. block->copy_state_into(state); + state->def_locals()->clear(); GrowableArray* exceptions = block->exceptions(); GrowableArray* exc_klasses = block->exc_klasses(); bool has_exceptions = exceptions->length() > 0; + bool exceptions_used = false; + ciBytecodeStream str(method()); str.reset_to_bci(start); Bytecodes::Code code; @@ -2172,6 +2297,7 @@ void ciTypeFlow::flow_block(ciTypeFlow::Block* block, // Check for exceptional control flow from this point. if (has_exceptions && can_trap(str)) { flow_exceptions(exceptions, exc_klasses, state); + exceptions_used = true; } // Apply the effects of the current bytecode to our state. bool res = state->apply_one_bytecode(&str); @@ -2189,9 +2315,14 @@ void ciTypeFlow::flow_block(ciTypeFlow::Block* block, block->print_on(tty); } + // Save set of locals defined in this block + block->def_locals()->add(state->def_locals()); + // Record (no) successors. block->successors(&str, state, jsrs); + assert(!has_exceptions || exceptions_used, "Not removing exceptions"); + // Discontinue interpretation of this Block. return; } @@ -2202,6 +2333,7 @@ void ciTypeFlow::flow_block(ciTypeFlow::Block* block, // Check for exceptional control flow from this point. if (has_exceptions && can_trap(str)) { flow_exceptions(exceptions, exc_klasses, state); + exceptions_used = true; } // Fix the JsrSet to reflect effect of the bytecode. @@ -2218,10 +2350,305 @@ void ciTypeFlow::flow_block(ciTypeFlow::Block* block, successors = block->successors(&str, NULL, NULL); } + // Save set of locals defined in this block + block->def_locals()->add(state->def_locals()); + + // Remove untaken exception paths + if (!exceptions_used) + exceptions->clear(); + // Pass our state to successors. flow_successors(successors, state); } +// ------------------------------------------------------------------ +// ciTypeFlow::PostOrderLoops::next +// +// Advance to next loop tree using a postorder, left-to-right traversal. +void ciTypeFlow::PostorderLoops::next() { + assert(!done(), "must not be done."); + if (_current->sibling() != NULL) { + _current = _current->sibling(); + while (_current->child() != NULL) { + _current = _current->child(); + } + } else { + _current = _current->parent(); + } +} + +// ------------------------------------------------------------------ +// ciTypeFlow::PreOrderLoops::next +// +// Advance to next loop tree using a preorder, left-to-right traversal. +void ciTypeFlow::PreorderLoops::next() { + assert(!done(), "must not be done."); + if (_current->child() != NULL) { + _current = _current->child(); + } else if (_current->sibling() != NULL) { + _current = _current->sibling(); + } else { + while (_current != _root && _current->sibling() == NULL) { + _current = _current->parent(); + } + if (_current == _root) { + _current = NULL; + assert(done(), "must be done."); + } else { + assert(_current->sibling() != NULL, "must be more to do"); + _current = _current->sibling(); + } + } +} + +// ------------------------------------------------------------------ +// ciTypeFlow::Loop::sorted_merge +// +// Merge the branch lp into this branch, sorting on the loop head +// pre_orders. Returns the leaf of the merged branch. +// Child and sibling pointers will be setup later. +// Sort is (looking from leaf towards the root) +// descending on primary key: loop head's pre_order, and +// ascending on secondary key: loop tail's pre_order. +ciTypeFlow::Loop* ciTypeFlow::Loop::sorted_merge(Loop* lp) { + Loop* leaf = this; + Loop* prev = NULL; + Loop* current = leaf; + while (lp != NULL) { + int lp_pre_order = lp->head()->pre_order(); + // Find insertion point for "lp" + while (current != NULL) { + if (current == lp) + return leaf; // Already in list + if (current->head()->pre_order() < lp_pre_order) + break; + if (current->head()->pre_order() == lp_pre_order && + current->tail()->pre_order() > lp->tail()->pre_order()) { + break; + } + prev = current; + current = current->parent(); + } + Loop* next_lp = lp->parent(); // Save future list of items to insert + // Insert lp before current + lp->set_parent(current); + if (prev != NULL) { + prev->set_parent(lp); + } else { + leaf = lp; + } + prev = lp; // Inserted item is new prev[ious] + lp = next_lp; // Next item to insert + } + return leaf; +} + +// ------------------------------------------------------------------ +// ciTypeFlow::build_loop_tree +// +// Incrementally build loop tree. +void ciTypeFlow::build_loop_tree(Block* blk) { + assert(!blk->is_post_visited(), "precondition"); + Loop* innermost = NULL; // merge of loop tree branches over all successors + + for (SuccIter iter(blk); !iter.done(); iter.next()) { + Loop* lp = NULL; + Block* succ = iter.succ(); + if (!succ->is_post_visited()) { + // Found backedge since predecessor post visited, but successor is not + assert(succ->pre_order() <= blk->pre_order(), "should be backedge"); + + // Create a LoopNode to mark this loop. + lp = new (arena()) Loop(succ, blk); + if (succ->loop() == NULL) + succ->set_loop(lp); + // succ->loop will be updated to innermost loop on a later call, when blk==succ + + } else { // Nested loop + lp = succ->loop(); + + // If succ is loop head, find outer loop. + while (lp != NULL && lp->head() == succ) { + lp = lp->parent(); + } + if (lp == NULL) { + // Infinite loop, it's parent is the root + lp = loop_tree_root(); + } + } + + // Check for irreducible loop. + // Successor has already been visited. If the successor's loop head + // has already been post-visited, then this is another entry into the loop. + while (lp->head()->is_post_visited() && lp != loop_tree_root()) { + _has_irreducible_entry = true; + lp->set_irreducible(succ); + if (!succ->is_on_work_list()) { + // Assume irreducible entries need more data flow + add_to_work_list(succ); + } + lp = lp->parent(); + assert(lp != NULL, "nested loop must have parent by now"); + } + + // Merge loop tree branch for all successors. + innermost = innermost == NULL ? lp : innermost->sorted_merge(lp); + + } // end loop + + if (innermost == NULL) { + assert(blk->successors()->length() == 0, "CFG exit"); + blk->set_loop(loop_tree_root()); + } else if (innermost->head() == blk) { + // If loop header, complete the tree pointers + if (blk->loop() != innermost) { +#if ASSERT + assert(blk->loop()->head() == innermost->head(), "same head"); + Loop* dl; + for (dl = innermost; dl != NULL && dl != blk->loop(); dl = dl->parent()); + assert(dl == blk->loop(), "blk->loop() already in innermost list"); +#endif + blk->set_loop(innermost); + } + innermost->def_locals()->add(blk->def_locals()); + Loop* l = innermost; + Loop* p = l->parent(); + while (p && l->head() == blk) { + l->set_sibling(p->child()); // Put self on parents 'next child' + p->set_child(l); // Make self the first child of parent + p->def_locals()->add(l->def_locals()); + l = p; // Walk up the parent chain + p = l->parent(); + } + } else { + blk->set_loop(innermost); + innermost->def_locals()->add(blk->def_locals()); + } +} + +// ------------------------------------------------------------------ +// ciTypeFlow::Loop::contains +// +// Returns true if lp is nested loop. +bool ciTypeFlow::Loop::contains(ciTypeFlow::Loop* lp) const { + assert(lp != NULL, ""); + if (this == lp || head() == lp->head()) return true; + int depth1 = depth(); + int depth2 = lp->depth(); + if (depth1 > depth2) + return false; + while (depth1 < depth2) { + depth2--; + lp = lp->parent(); + } + return this == lp; +} + +// ------------------------------------------------------------------ +// ciTypeFlow::Loop::depth +// +// Loop depth +int ciTypeFlow::Loop::depth() const { + int dp = 0; + for (Loop* lp = this->parent(); lp != NULL; lp = lp->parent()) + dp++; + return dp; +} + +#ifndef PRODUCT +// ------------------------------------------------------------------ +// ciTypeFlow::Loop::print +void ciTypeFlow::Loop::print(outputStream* st, int indent) const { + for (int i = 0; i < indent; i++) st->print(" "); + st->print("%d<-%d %s", + is_root() ? 0 : this->head()->pre_order(), + is_root() ? 0 : this->tail()->pre_order(), + is_irreducible()?" irr":""); + st->print(" defs: "); + def_locals()->print_on(st, _head->outer()->method()->max_locals()); + st->cr(); + for (Loop* ch = child(); ch != NULL; ch = ch->sibling()) + ch->print(st, indent+2); +} +#endif + +// ------------------------------------------------------------------ +// ciTypeFlow::df_flow_types +// +// Perform the depth first type flow analysis. Helper for flow_types. +void ciTypeFlow::df_flow_types(Block* start, + bool do_flow, + StateVector* temp_vector, + JsrSet* temp_set) { + int dft_len = 100; + GrowableArray stk(arena(), dft_len, 0, NULL); + + ciBlock* dummy = _methodBlocks->make_dummy_block(); + JsrSet* root_set = new JsrSet(NULL, 0); + Block* root_head = new (arena()) Block(this, dummy, root_set); + Block* root_tail = new (arena()) Block(this, dummy, root_set); + root_head->set_pre_order(0); + root_head->set_post_order(0); + root_tail->set_pre_order(max_jint); + root_tail->set_post_order(max_jint); + set_loop_tree_root(new (arena()) Loop(root_head, root_tail)); + + stk.push(start); + + _next_pre_order = 0; // initialize pre_order counter + _rpo_list = NULL; + int next_po = 0; // initialize post_order counter + + // Compute RPO and the control flow graph + int size; + while ((size = stk.length()) > 0) { + Block* blk = stk.top(); // Leave node on stack + if (!blk->is_visited()) { + // forward arc in graph + assert (!blk->has_pre_order(), ""); + blk->set_next_pre_order(); + + if (_next_pre_order >= MaxNodeLimit / 2) { + // Too many basic blocks. Bail out. + // This can happen when try/finally constructs are nested to depth N, + // and there is O(2**N) cloning of jsr bodies. See bug 4697245! + // "MaxNodeLimit / 2" is used because probably the parser will + // generate at least twice that many nodes and bail out. + record_failure("too many basic blocks"); + return; + } + if (do_flow) { + flow_block(blk, temp_vector, temp_set); + if (failing()) return; // Watch for bailouts. + } + } else if (!blk->is_post_visited()) { + // cross or back arc + for (SuccIter iter(blk); !iter.done(); iter.next()) { + Block* succ = iter.succ(); + if (!succ->is_visited()) { + stk.push(succ); + } + } + if (stk.length() == size) { + // There were no additional children, post visit node now + stk.pop(); // Remove node from stack + + build_loop_tree(blk); + blk->set_post_order(next_po++); // Assign post order + prepend_to_rpo_list(blk); + assert(blk->is_post_visited(), ""); + + if (blk->is_loop_head() && !blk->is_on_work_list()) { + // Assume loop heads need more data flow + add_to_work_list(blk); + } + } + } else { + stk.pop(); // Remove post-visited node from stack + } + } +} + // ------------------------------------------------------------------ // ciTypeFlow::flow_types // @@ -2233,91 +2660,93 @@ void ciTypeFlow::flow_types() { JsrSet* temp_set = new JsrSet(NULL, 16); // Create the method entry block. - Block* block = block_at(start_bci(), temp_set); - block->set_pre_order(_next_pre_order++); - assert(block->is_start(), "start block must have order #0"); + Block* start = block_at(start_bci(), temp_set); // Load the initial state into it. const StateVector* start_state = get_start_state(); if (failing()) return; - block->meet(start_state); - add_to_work_list(block); + start->meet(start_state); - // Trickle away. - while (!work_list_empty()) { - Block* block = work_list_next(); - flow_block(block, temp_vector, temp_set); + // Depth first visit + df_flow_types(start, true /*do flow*/, temp_vector, temp_set); + if (failing()) return; + assert(_rpo_list == start, "must be start"); - // NodeCountCutoff is the number of nodes at which the parser - // will bail out. Probably if we already have lots of BBs, - // the parser will generate at least twice that many nodes and bail out. - // Therefore, this is a conservatively large limit at which to - // bail out in the pre-parse typeflow pass. - int block_limit = MaxNodeLimit / 2; + // Any loops found? + if (loop_tree_root()->child() != NULL && + env()->comp_level() >= CompLevel_full_optimization) { + // Loop optimizations are not performed on Tier1 compiles. - if (_next_pre_order >= block_limit) { - // Too many basic blocks. Bail out. - // - // This can happen when try/finally constructs are nested to depth N, - // and there is O(2**N) cloning of jsr bodies. See bug 4697245! - record_failure("too many basic blocks"); - return; + bool changed = clone_loop_heads(loop_tree_root(), temp_vector, temp_set); + + // If some loop heads were cloned, recompute postorder and loop tree + if (changed) { + loop_tree_root()->set_child(NULL); + for (Block* blk = _rpo_list; blk != NULL;) { + Block* next = blk->rpo_next(); + blk->df_init(); + blk = next; + } + df_flow_types(start, false /*no flow*/, temp_vector, temp_set); } + } - // Watch for bailouts. - if (failing()) return; + if (CITraceTypeFlow) { + tty->print_cr("\nLoop tree"); + loop_tree_root()->print(); + } + + // Continue flow analysis until fixed point reached + + debug_only(int max_block = _next_pre_order;) + + while (!work_list_empty()) { + Block* blk = work_list_next(); + assert (blk->has_post_order(), "post order assigned above"); + + flow_block(blk, temp_vector, temp_set); + + assert (max_block == _next_pre_order, "no new blocks"); + assert (!failing(), "no more bailouts"); } } // ------------------------------------------------------------------ // ciTypeFlow::map_blocks // -// Create the block map, which indexes blocks in pre_order. +// Create the block map, which indexes blocks in reverse post-order. void ciTypeFlow::map_blocks() { assert(_block_map == NULL, "single initialization"); - int pre_order_limit = _next_pre_order; - _block_map = NEW_ARENA_ARRAY(arena(), Block*, pre_order_limit); - assert(pre_order_limit == block_count(), ""); - int po; - for (po = 0; po < pre_order_limit; po++) { - debug_only(_block_map[po] = NULL); + int block_ct = _next_pre_order; + _block_map = NEW_ARENA_ARRAY(arena(), Block*, block_ct); + assert(block_ct == block_count(), ""); + + Block* blk = _rpo_list; + for (int m = 0; m < block_ct; m++) { + int rpo = blk->rpo(); + assert(rpo == m, "should be sequential"); + _block_map[rpo] = blk; + blk = blk->rpo_next(); } - ciMethodBlocks *mblks = _methodBlocks; - ciBlock* current = NULL; - int limit_bci = code_size(); - for (int bci = 0; bci < limit_bci; bci++) { - ciBlock* ciblk = mblks->block_containing(bci); - if (ciblk != NULL && ciblk != current) { - current = ciblk; - int curidx = ciblk->index(); - int block_count = (_idx_to_blocklist[curidx] == NULL) ? 0 : _idx_to_blocklist[curidx]->length(); - for (int i = 0; i < block_count; i++) { - Block* block = _idx_to_blocklist[curidx]->at(i); - if (!block->has_pre_order()) continue; - int po = block->pre_order(); - assert(_block_map[po] == NULL, "unique ref to block"); - assert(0 <= po && po < pre_order_limit, ""); - _block_map[po] = block; - } - } - } - for (po = 0; po < pre_order_limit; po++) { - assert(_block_map[po] != NULL, "must not drop any blocks"); - Block* block = _block_map[po]; + assert(blk == NULL, "should be done"); + + for (int j = 0; j < block_ct; j++) { + assert(_block_map[j] != NULL, "must not drop any blocks"); + Block* block = _block_map[j]; // Remove dead blocks from successor lists: for (int e = 0; e <= 1; e++) { GrowableArray* l = e? block->exceptions(): block->successors(); - for (int i = 0; i < l->length(); i++) { - Block* s = l->at(i); - if (!s->has_pre_order()) { + for (int k = 0; k < l->length(); k++) { + Block* s = l->at(k); + if (!s->has_post_order()) { if (CITraceTypeFlow) { tty->print("Removing dead %s successor of #%d: ", (e? "exceptional": "normal"), block->pre_order()); s->print_value_on(tty); tty->cr(); } l->remove(s); - --i; + --k; } } } @@ -2329,7 +2758,7 @@ void ciTypeFlow::map_blocks() { // // Find a block with this ciBlock which has a compatible JsrSet. // If no such block exists, create it, unless the option is no_create. -// If the option is create_private_copy, always create a fresh private copy. +// If the option is create_backedge_copy, always create a fresh backedge copy. ciTypeFlow::Block* ciTypeFlow::get_block_for(int ciBlockIndex, ciTypeFlow::JsrSet* jsrs, CreateOption option) { Arena* a = arena(); GrowableArray* blocks = _idx_to_blocklist[ciBlockIndex]; @@ -2342,11 +2771,11 @@ ciTypeFlow::Block* ciTypeFlow::get_block_for(int ciBlockIndex, ciTypeFlow::JsrSe _idx_to_blocklist[ciBlockIndex] = blocks; } - if (option != create_private_copy) { + if (option != create_backedge_copy) { int len = blocks->length(); for (int i = 0; i < len; i++) { Block* block = blocks->at(i); - if (!block->is_private_copy() && block->is_compatible_with(jsrs)) { + if (!block->is_backedge_copy() && block->is_compatible_with(jsrs)) { return block; } } @@ -2357,15 +2786,15 @@ ciTypeFlow::Block* ciTypeFlow::get_block_for(int ciBlockIndex, ciTypeFlow::JsrSe // We did not find a compatible block. Create one. Block* new_block = new (a) Block(this, _methodBlocks->block(ciBlockIndex), jsrs); - if (option == create_private_copy) new_block->set_private_copy(true); + if (option == create_backedge_copy) new_block->set_backedge_copy(true); blocks->append(new_block); return new_block; } // ------------------------------------------------------------------ -// ciTypeFlow::private_copy_count +// ciTypeFlow::backedge_copy_count // -int ciTypeFlow::private_copy_count(int ciBlockIndex, ciTypeFlow::JsrSet* jsrs) const { +int ciTypeFlow::backedge_copy_count(int ciBlockIndex, ciTypeFlow::JsrSet* jsrs) const { GrowableArray* blocks = _idx_to_blocklist[ciBlockIndex]; if (blocks == NULL) { @@ -2376,7 +2805,7 @@ int ciTypeFlow::private_copy_count(int ciBlockIndex, ciTypeFlow::JsrSet* jsrs) c int len = blocks->length(); for (int i = 0; i < len; i++) { Block* block = blocks->at(i); - if (block->is_private_copy() && block->is_compatible_with(jsrs)) { + if (block->is_backedge_copy() && block->is_compatible_with(jsrs)) { count++; } } @@ -2405,10 +2834,12 @@ void ciTypeFlow::do_flow() { if (failing()) { return; } - if (CIPrintTypeFlow || CITraceTypeFlow) { - print_on(tty); - } + map_blocks(); + + if (CIPrintTypeFlow || CITraceTypeFlow) { + rpo_print_on(tty); + } } // ------------------------------------------------------------------ @@ -2466,4 +2897,19 @@ void ciTypeFlow::print_on(outputStream* st) const { st->print_cr("********************************************************"); st->cr(); } + +void ciTypeFlow::rpo_print_on(outputStream* st) const { + st->print_cr("********************************************************"); + st->print ("TypeFlow for "); + method()->name()->print_symbol_on(st); + int limit_bci = code_size(); + st->print_cr(" %d bytes", limit_bci); + for (Block* blk = _rpo_list; blk != NULL; blk = blk->rpo_next()) { + blk->print_on(st); + st->print_cr("--------------------------------------------------------"); + st->cr(); + } + st->print_cr("********************************************************"); + st->cr(); +} #endif diff --git a/hotspot/src/share/vm/ci/ciTypeFlow.hpp b/hotspot/src/share/vm/ci/ciTypeFlow.hpp index 9b5193ba54b..bcfbca594db 100644 --- a/hotspot/src/share/vm/ci/ciTypeFlow.hpp +++ b/hotspot/src/share/vm/ci/ciTypeFlow.hpp @@ -34,11 +34,13 @@ private: int _max_locals; int _max_stack; int _code_size; + bool _has_irreducible_entry; const char* _failure_reason; public: class StateVector; + class Loop; class Block; // Build a type flow analyzer @@ -55,6 +57,7 @@ public: int max_stack() const { return _max_stack; } int max_cells() const { return _max_locals + _max_stack; } int code_size() const { return _code_size; } + bool has_irreducible_entry() const { return _has_irreducible_entry; } // Represents information about an "active" jsr call. This // class represents a call to the routine at some entry address @@ -125,6 +128,19 @@ public: void print_on(outputStream* st) const PRODUCT_RETURN; }; + class LocalSet VALUE_OBJ_CLASS_SPEC { + private: + enum Constants { max = 63 }; + uint64_t _bits; + public: + LocalSet() : _bits(0) {} + void add(uint32_t i) { if (i < (uint32_t)max) _bits |= (1LL << i); } + void add(LocalSet* ls) { _bits |= ls->_bits; } + bool test(uint32_t i) const { return i < (uint32_t)max ? (_bits>>i)&1U : true; } + void clear() { _bits = 0; } + void print_on(outputStream* st, int limit) const PRODUCT_RETURN; + }; + // Used as a combined index for locals and temps enum Cell { Cell_0, Cell_max = INT_MAX @@ -142,6 +158,8 @@ public: int _trap_bci; int _trap_index; + LocalSet _def_locals; // For entire block + static ciType* type_meet_internal(ciType* t1, ciType* t2, ciTypeFlow* analyzer); public: @@ -181,6 +199,9 @@ public: int monitor_count() const { return _monitor_count; } void set_monitor_count(int mc) { _monitor_count = mc; } + LocalSet* def_locals() { return &_def_locals; } + const LocalSet* def_locals() const { return &_def_locals; } + static Cell start_cell() { return (Cell)0; } static Cell next_cell(Cell c) { return (Cell)(((int)c) + 1); } Cell limit_cell() const { @@ -250,6 +271,10 @@ public: return type->basic_type() == T_DOUBLE; } + void store_to_local(int lnum) { + _def_locals.add((uint) lnum); + } + void push_translate(ciType* type); void push_int() { @@ -358,6 +383,7 @@ public: "must be reference type or return address"); overwrite_local_double_long(index); set_type_at(local(index), type); + store_to_local(index); } void load_local_double(int index) { @@ -376,6 +402,8 @@ public: overwrite_local_double_long(index); set_type_at(local(index), type); set_type_at(local(index+1), type2); + store_to_local(index); + store_to_local(index+1); } void load_local_float(int index) { @@ -388,6 +416,7 @@ public: assert(is_float(type), "must be float type"); overwrite_local_double_long(index); set_type_at(local(index), type); + store_to_local(index); } void load_local_int(int index) { @@ -400,6 +429,7 @@ public: assert(is_int(type), "must be int type"); overwrite_local_double_long(index); set_type_at(local(index), type); + store_to_local(index); } void load_local_long(int index) { @@ -418,6 +448,8 @@ public: overwrite_local_double_long(index); set_type_at(local(index), type); set_type_at(local(index+1), type2); + store_to_local(index); + store_to_local(index+1); } // Stop interpretation of this path with a trap. @@ -450,13 +482,31 @@ public: }; // Parameter for "find_block" calls: - // Describes the difference between a public and private copy. + // Describes the difference between a public and backedge copy. enum CreateOption { create_public_copy, - create_private_copy, + create_backedge_copy, no_create }; + // Successor iterator + class SuccIter : public StackObj { + private: + Block* _pred; + int _index; + Block* _succ; + public: + SuccIter() : _pred(NULL), _index(-1), _succ(NULL) {} + SuccIter(Block* pred) : _pred(pred), _index(-1), _succ(NULL) { next(); } + int index() { return _index; } + Block* pred() { return _pred; } // Return predecessor + bool done() { return _index < 0; } // Finished? + Block* succ() { return _succ; } // Return current successor + void next(); // Advance + void set_succ(Block* succ); // Update current successor + bool is_normal_ctrl() { return index() < _pred->successors()->length(); } + }; + // A basic block class Block : public ResourceObj { private: @@ -470,15 +520,24 @@ public: int _trap_bci; int _trap_index; - // A reasonable approximation to pre-order, provided.to the client. + // pre_order, assigned at first visit. Used as block ID and "visited" tag int _pre_order; - // Has this block been cloned for some special purpose? - bool _private_copy; + // A post-order, used to compute the reverse post order (RPO) provided to the client + int _post_order; // used to compute rpo + + // Has this block been cloned for a loop backedge? + bool _backedge_copy; // A pointer used for our internal work list - Block* _next; - bool _on_work_list; + Block* _next; + bool _on_work_list; // on the work list + Block* _rpo_next; // Reverse post order list + + // Loop info + Loop* _loop; // nearest loop + bool _irreducible_entry; // entry to irreducible loop + bool _exception_entry; // entry to exception handler ciBlock* ciblock() const { return _ciblock; } StateVector* state() const { return _state; } @@ -504,10 +563,11 @@ public: int start() const { return _ciblock->start_bci(); } int limit() const { return _ciblock->limit_bci(); } int control() const { return _ciblock->control_bci(); } + JsrSet* jsrs() const { return _jsrs; } - bool is_private_copy() const { return _private_copy; } - void set_private_copy(bool z); - int private_copy_count() const { return outer()->private_copy_count(ciblock()->index(), _jsrs); } + bool is_backedge_copy() const { return _backedge_copy; } + void set_backedge_copy(bool z); + int backedge_copy_count() const { return outer()->backedge_copy_count(ciblock()->index(), _jsrs); } // access to entry state int stack_size() const { return _state->stack_size(); } @@ -515,6 +575,20 @@ public: ciType* local_type_at(int i) const { return _state->local_type_at(i); } ciType* stack_type_at(int i) const { return _state->stack_type_at(i); } + // Data flow on locals + bool is_invariant_local(uint v) const { + assert(is_loop_head(), "only loop heads"); + // Find outermost loop with same loop head + Loop* lp = loop(); + while (lp->parent() != NULL) { + if (lp->parent()->head() != lp->head()) break; + lp = lp->parent(); + } + return !lp->def_locals()->test(v); + } + LocalSet* def_locals() { return _state->def_locals(); } + const LocalSet* def_locals() const { return _state->def_locals(); } + // Get the successors for this Block. GrowableArray* successors(ciBytecodeStream* str, StateVector* state, @@ -524,13 +598,6 @@ public: return _successors; } - // Helper function for "successors" when making private copies of - // loop heads for C2. - Block * clone_loop_head(ciTypeFlow* analyzer, - int branch_bci, - Block* target, - JsrSet* jsrs); - // Get the exceptional successors for this Block. GrowableArray* exceptions() { if (_exceptions == NULL) { @@ -584,17 +651,126 @@ public: bool is_on_work_list() const { return _on_work_list; } bool has_pre_order() const { return _pre_order >= 0; } - void set_pre_order(int po) { assert(!has_pre_order() && po >= 0, ""); _pre_order = po; } + void set_pre_order(int po) { assert(!has_pre_order(), ""); _pre_order = po; } int pre_order() const { assert(has_pre_order(), ""); return _pre_order; } + void set_next_pre_order() { set_pre_order(outer()->inc_next_pre_order()); } bool is_start() const { return _pre_order == outer()->start_block_num(); } - // A ranking used in determining order within the work list. - bool is_simpler_than(Block* other); + // Reverse post order + void df_init(); + bool has_post_order() const { return _post_order >= 0; } + void set_post_order(int po) { assert(!has_post_order() && po >= 0, ""); _post_order = po; } + void reset_post_order(int o){ _post_order = o; } + int post_order() const { assert(has_post_order(), ""); return _post_order; } + + bool has_rpo() const { return has_post_order() && outer()->have_block_count(); } + int rpo() const { assert(has_rpo(), ""); return outer()->block_count() - post_order() - 1; } + void set_rpo_next(Block* b) { _rpo_next = b; } + Block* rpo_next() { return _rpo_next; } + + // Loops + Loop* loop() const { return _loop; } + void set_loop(Loop* lp) { _loop = lp; } + bool is_loop_head() const { return _loop && _loop->head() == this; } + void set_irreducible_entry(bool c) { _irreducible_entry = c; } + bool is_irreducible_entry() const { return _irreducible_entry; } + bool is_visited() const { return has_pre_order(); } + bool is_post_visited() const { return has_post_order(); } + bool is_clonable_exit(Loop* lp); + Block* looping_succ(Loop* lp); // Successor inside of loop + bool is_single_entry_loop_head() const { + if (!is_loop_head()) return false; + for (Loop* lp = loop(); lp != NULL && lp->head() == this; lp = lp->parent()) + if (lp->is_irreducible()) return false; + return true; + } void print_value_on(outputStream* st) const PRODUCT_RETURN; void print_on(outputStream* st) const PRODUCT_RETURN; }; + // Loop + class Loop : public ResourceObj { + private: + Loop* _parent; + Loop* _sibling; // List of siblings, null terminated + Loop* _child; // Head of child list threaded thru sibling pointer + Block* _head; // Head of loop + Block* _tail; // Tail of loop + bool _irreducible; + LocalSet _def_locals; + + public: + Loop(Block* head, Block* tail) : + _head(head), _tail(tail), + _parent(NULL), _sibling(NULL), _child(NULL), + _irreducible(false), _def_locals() {} + + Loop* parent() const { return _parent; } + Loop* sibling() const { return _sibling; } + Loop* child() const { return _child; } + Block* head() const { return _head; } + Block* tail() const { return _tail; } + void set_parent(Loop* p) { _parent = p; } + void set_sibling(Loop* s) { _sibling = s; } + void set_child(Loop* c) { _child = c; } + void set_head(Block* hd) { _head = hd; } + void set_tail(Block* tl) { _tail = tl; } + + int depth() const; // nesting depth + + // Returns true if lp is a nested loop or us. + bool contains(Loop* lp) const; + bool contains(Block* blk) const { return contains(blk->loop()); } + + // Data flow on locals + LocalSet* def_locals() { return &_def_locals; } + const LocalSet* def_locals() const { return &_def_locals; } + + // Merge the branch lp into this branch, sorting on the loop head + // pre_orders. Returns the new branch. + Loop* sorted_merge(Loop* lp); + + // Mark non-single entry to loop + void set_irreducible(Block* entry) { + _irreducible = true; + entry->set_irreducible_entry(true); + } + bool is_irreducible() const { return _irreducible; } + + bool is_root() const { return _tail->pre_order() == max_jint; } + + void print(outputStream* st = tty, int indent = 0) const PRODUCT_RETURN; + }; + + // Postorder iteration over the loop tree. + class PostorderLoops : public StackObj { + private: + Loop* _root; + Loop* _current; + public: + PostorderLoops(Loop* root) : _root(root), _current(root) { + while (_current->child() != NULL) { + _current = _current->child(); + } + } + bool done() { return _current == NULL; } // Finished iterating? + void next(); // Advance to next loop + Loop* current() { return _current; } // Return current loop. + }; + + // Preorder iteration over the loop tree. + class PreorderLoops : public StackObj { + private: + Loop* _root; + Loop* _current; + public: + PreorderLoops(Loop* root) : _root(root), _current(root) {} + bool done() { return _current == NULL; } // Finished iterating? + void next(); // Advance to next loop + Loop* current() { return _current; } // Return current loop. + }; + // Standard indexes of successors, for various bytecodes. enum { FALL_THROUGH = 0, // normal control @@ -619,6 +795,12 @@ private: // Tells if a given instruction is able to generate an exception edge. bool can_trap(ciBytecodeStream& str); + // Clone the loop heads. Returns true if any cloning occurred. + bool clone_loop_heads(Loop* lp, StateVector* temp_vector, JsrSet* temp_set); + + // Clone lp's head and replace tail's successors with clone. + Block* clone_loop_head(Loop* lp, StateVector* temp_vector, JsrSet* temp_set); + public: // Return the block beginning at bci which has a JsrSet compatible // with jsrs. @@ -627,8 +809,8 @@ public: // block factory Block* get_block_for(int ciBlockIndex, JsrSet* jsrs, CreateOption option = create_public_copy); - // How many of the blocks have the private_copy bit set? - int private_copy_count(int ciBlockIndex, JsrSet* jsrs) const; + // How many of the blocks have the backedge_copy bit set? + int backedge_copy_count(int ciBlockIndex, JsrSet* jsrs) const; // Return an existing block containing bci which has a JsrSet compatible // with jsrs, or NULL if there is none. @@ -651,11 +833,18 @@ public: return _block_map[po]; } Block* start_block() const { return pre_order_at(start_block_num()); } int start_block_num() const { return 0; } + Block* rpo_at(int rpo) const { assert(0 <= rpo && rpo < block_count(), "out of bounds"); + return _block_map[rpo]; } + int next_pre_order() { return _next_pre_order; } + int inc_next_pre_order() { return _next_pre_order++; } private: // A work list used during flow analysis. Block* _work_list; + // List of blocks in reverse post order + Block* _rpo_list; + // Next Block::_pre_order. After mapping, doubles as block_count. int _next_pre_order; @@ -668,6 +857,15 @@ private: // Add a basic block to our work list. void add_to_work_list(Block* block); + // Prepend a basic block to rpo list. + void prepend_to_rpo_list(Block* blk) { + blk->set_rpo_next(_rpo_list); + _rpo_list = blk; + } + + // Root of the loop tree + Loop* _loop_tree_root; + // State used for make_jsr_record int _jsr_count; GrowableArray* _jsr_records; @@ -677,6 +875,9 @@ public: // does not already exist. JsrRecord* make_jsr_record(int entry_address, int return_address); + void set_loop_tree_root(Loop* ltr) { _loop_tree_root = ltr; } + Loop* loop_tree_root() { return _loop_tree_root; } + private: // Get the initial state for start_bci: const StateVector* get_start_state(); @@ -703,6 +904,15 @@ private: // necessary. void flow_types(); + // Perform the depth first type flow analysis. Helper for flow_types. + void df_flow_types(Block* start, + bool do_flow, + StateVector* temp_vector, + JsrSet* temp_set); + + // Incrementally build loop tree. + void build_loop_tree(Block* blk); + // Create the block map, which indexes blocks in pre_order. void map_blocks(); @@ -711,4 +921,6 @@ public: void do_flow(); void print_on(outputStream* st) const PRODUCT_RETURN; + + void rpo_print_on(outputStream* st) const PRODUCT_RETURN; }; diff --git a/hotspot/src/share/vm/includeDB_compiler2 b/hotspot/src/share/vm/includeDB_compiler2 index 07ae8a87096..799c30f4ae9 100644 --- a/hotspot/src/share/vm/includeDB_compiler2 +++ b/hotspot/src/share/vm/includeDB_compiler2 @@ -582,6 +582,7 @@ locknode.hpp subnode.hpp loopTransform.cpp addnode.hpp loopTransform.cpp allocation.inline.hpp loopTransform.cpp connode.hpp +loopTransform.cpp compileLog.hpp loopTransform.cpp divnode.hpp loopTransform.cpp loopnode.hpp loopTransform.cpp mulnode.hpp @@ -597,6 +598,7 @@ loopnode.cpp addnode.hpp loopnode.cpp allocation.inline.hpp loopnode.cpp callnode.hpp loopnode.cpp ciMethodData.hpp +loopnode.cpp compileLog.hpp loopnode.cpp connode.hpp loopnode.cpp divnode.hpp loopnode.cpp loopnode.hpp diff --git a/hotspot/src/share/vm/opto/bytecodeInfo.cpp b/hotspot/src/share/vm/opto/bytecodeInfo.cpp index 847988efe8d..38623fd5f76 100644 --- a/hotspot/src/share/vm/opto/bytecodeInfo.cpp +++ b/hotspot/src/share/vm/opto/bytecodeInfo.cpp @@ -25,19 +25,6 @@ #include "incls/_precompiled.incl" #include "incls/_bytecodeInfo.cpp.incl" -// These variables are declared in parse1.cpp -extern int explicit_null_checks_inserted; -extern int explicit_null_checks_elided; -extern int explicit_null_checks_inserted_old; -extern int explicit_null_checks_elided_old; -extern int nodes_created_old; -extern int nodes_created; -extern int methods_parsed_old; -extern int methods_parsed; -extern int methods_seen; -extern int methods_seen_old; - - //============================================================================= //------------------------------InlineTree------------------------------------- InlineTree::InlineTree( Compile* c, const InlineTree *caller_tree, ciMethod* callee, JVMState* caller_jvms, int caller_bci, float site_invoke_ratio ) @@ -517,27 +504,3 @@ InlineTree* InlineTree::find_subtree_from_root(InlineTree* root, JVMState* jvms, } return iltp; } - -// ---------------------------------------------------------------------------- -#ifndef PRODUCT - -static void per_method_stats() { - // Compute difference between this method's cumulative totals and old totals - int explicit_null_checks_cur = explicit_null_checks_inserted - explicit_null_checks_inserted_old; - int elided_null_checks_cur = explicit_null_checks_elided - explicit_null_checks_elided_old; - - // Print differences - if( explicit_null_checks_cur ) - tty->print_cr("XXX Explicit NULL checks inserted: %d", explicit_null_checks_cur); - if( elided_null_checks_cur ) - tty->print_cr("XXX Explicit NULL checks removed at parse time: %d", elided_null_checks_cur); - - // Store the current cumulative totals - nodes_created_old = nodes_created; - methods_parsed_old = methods_parsed; - methods_seen_old = methods_seen; - explicit_null_checks_inserted_old = explicit_null_checks_inserted; - explicit_null_checks_elided_old = explicit_null_checks_elided; -} - -#endif diff --git a/hotspot/src/share/vm/opto/cfgnode.cpp b/hotspot/src/share/vm/opto/cfgnode.cpp index 0e7b2845dbc..b37cb27ddb9 100644 --- a/hotspot/src/share/vm/opto/cfgnode.cpp +++ b/hotspot/src/share/vm/opto/cfgnode.cpp @@ -1665,7 +1665,11 @@ Node *PhiNode::Ideal(PhaseGVN *phase, bool can_reshape) { // compress paths and change unreachable cycles to TOP // If not, we can update the input infinitely along a MergeMem cycle // Equivalent code is in MemNode::Ideal_common - Node *m = phase->transform(n); + Node *m = phase->transform(n); + if (outcnt() == 0) { // Above transform() may kill us! + progress = phase->C->top(); + break; + } // If tranformed to a MergeMem, get the desired slice // Otherwise the returned node represents memory for every slice Node *new_mem = (m->is_MergeMem()) ? diff --git a/hotspot/src/share/vm/opto/compile.cpp b/hotspot/src/share/vm/opto/compile.cpp index 8f833042bf2..24ac979323b 100644 --- a/hotspot/src/share/vm/opto/compile.cpp +++ b/hotspot/src/share/vm/opto/compile.cpp @@ -467,6 +467,7 @@ Compile::Compile( ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, int osr } } set_print_assembly(print_opto_assembly); + set_parsed_irreducible_loop(false); #endif if (ProfileTraps) { @@ -550,6 +551,8 @@ Compile::Compile( ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, int osr rethrow_exceptions(kit.transfer_exceptions_into_jvms()); } + print_method("Before RemoveUseless"); + // Remove clutter produced by parsing. if (!failing()) { ResourceMark rm; @@ -615,8 +618,6 @@ Compile::Compile( ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, int osr if (failing()) return; NOT_PRODUCT( verify_graph_edges(); ) - print_method("Before Matching"); - #ifndef PRODUCT if (PrintIdeal) { ttyLocker ttyl; // keep the following output all in one block @@ -720,6 +721,7 @@ Compile::Compile( ciEnv* ci_env, TraceTime t1(NULL, &_t_totalCompilation, TimeCompiler, false); TraceTime t2(NULL, &_t_stubCompilation, TimeCompiler, false); set_print_assembly(PrintFrameConverterAssembly); + set_parsed_irreducible_loop(false); #endif CompileWrapper cw(this); Init(/*AliasLevel=*/ 0); diff --git a/hotspot/src/share/vm/opto/compile.hpp b/hotspot/src/share/vm/opto/compile.hpp index 455df6bda30..3310bb99003 100644 --- a/hotspot/src/share/vm/opto/compile.hpp +++ b/hotspot/src/share/vm/opto/compile.hpp @@ -160,6 +160,7 @@ class Compile : public Phase { bool _print_assembly; // True if we should dump assembly code for this compilation #ifndef PRODUCT bool _trace_opto_output; + bool _parsed_irreducible_loop; // True if ciTypeFlow detected irreducible loops during parsing #endif // Compilation environment. @@ -319,6 +320,8 @@ class Compile : public Phase { } #ifndef PRODUCT bool trace_opto_output() const { return _trace_opto_output; } + bool parsed_irreducible_loop() const { return _parsed_irreducible_loop; } + void set_parsed_irreducible_loop(bool z) { _parsed_irreducible_loop = z; } #endif void begin_method() { diff --git a/hotspot/src/share/vm/opto/doCall.cpp b/hotspot/src/share/vm/opto/doCall.cpp index 99772d4450c..66cb13b9f28 100644 --- a/hotspot/src/share/vm/opto/doCall.cpp +++ b/hotspot/src/share/vm/opto/doCall.cpp @@ -795,7 +795,7 @@ ciMethod* Parse::optimize_inlining(ciMethod* caller, int bci, ciInstanceKlass* k ciInstanceKlass *ikl = receiver_type->klass()->as_instance_klass(); if (ikl->is_loaded() && ikl->is_initialized() && !ikl->is_interface() && - (ikl == actual_receiver || ikl->is_subclass_of(actual_receiver))) { + (ikl == actual_receiver || ikl->is_subtype_of(actual_receiver))) { // ikl is a same or better type than the original actual_receiver, // e.g. static receiver from bytecodes. actual_receiver = ikl; diff --git a/hotspot/src/share/vm/opto/graphKit.cpp b/hotspot/src/share/vm/opto/graphKit.cpp index 78c7d971ad2..17f5647765f 100644 --- a/hotspot/src/share/vm/opto/graphKit.cpp +++ b/hotspot/src/share/vm/opto/graphKit.cpp @@ -587,7 +587,7 @@ PreserveJVMState::PreserveJVMState(GraphKit* kit, bool clone_map) { #ifdef ASSERT _bci = kit->bci(); Parse* parser = kit->is_Parse(); - int block = (parser == NULL || parser->block() == NULL) ? -1 : parser->block()->pre_order(); + int block = (parser == NULL || parser->block() == NULL) ? -1 : parser->block()->rpo(); _block = block; #endif } @@ -596,7 +596,7 @@ PreserveJVMState::~PreserveJVMState() { #ifdef ASSERT assert(kit->bci() == _bci, "bci must not shift"); Parse* parser = kit->is_Parse(); - int block = (parser == NULL || parser->block() == NULL) ? -1 : parser->block()->pre_order(); + int block = (parser == NULL || parser->block() == NULL) ? -1 : parser->block()->rpo(); assert(block == _block, "block must not shift"); #endif kit->set_map(_map); diff --git a/hotspot/src/share/vm/opto/loopTransform.cpp b/hotspot/src/share/vm/opto/loopTransform.cpp index dbce2580158..3955f79d14e 100644 --- a/hotspot/src/share/vm/opto/loopTransform.cpp +++ b/hotspot/src/share/vm/opto/loopTransform.cpp @@ -1012,6 +1012,8 @@ void PhaseIdealLoop::do_unroll( IdealLoopTree *loop, Node_List &old_new, bool ad if (!has_ctrl(old)) set_loop(nnn, loop); } + + loop->record_for_igvn(); } //------------------------------do_maximally_unroll---------------------------- diff --git a/hotspot/src/share/vm/opto/loopnode.cpp b/hotspot/src/share/vm/opto/loopnode.cpp index 7e853e6a1f8..7e375992f1d 100644 --- a/hotspot/src/share/vm/opto/loopnode.cpp +++ b/hotspot/src/share/vm/opto/loopnode.cpp @@ -1279,7 +1279,7 @@ void IdealLoopTree::counted_loop( PhaseIdealLoop *phase ) { // Visit all children, looking for Phis for (DUIterator i = cl->outs(); cl->has_out(i); i++) { Node *out = cl->out(i); - if (!out->is_Phi()) continue; // Looking for phis + if (!out->is_Phi() || out == phi) continue; // Looking for other phis PhiNode* phi2 = out->as_Phi(); Node *incr2 = phi2->in( LoopNode::LoopBackControl ); // Look for induction variables of the form: X += constant @@ -1388,6 +1388,37 @@ void IdealLoopTree::dump( ) const { #endif +static void log_loop_tree(IdealLoopTree* root, IdealLoopTree* loop, CompileLog* log) { + if (loop == root) { + if (loop->_child != NULL) { + log->begin_head("loop_tree"); + log->end_head(); + if( loop->_child ) log_loop_tree(root, loop->_child, log); + log->tail("loop_tree"); + assert(loop->_next == NULL, "what?"); + } + } else { + Node* head = loop->_head; + log->begin_head("loop"); + log->print(" idx='%d' ", head->_idx); + if (loop->_irreducible) log->print("irreducible='1' "); + if (head->is_Loop()) { + if (head->as_Loop()->is_inner_loop()) log->print("inner_loop='1' "); + if (head->as_Loop()->is_partial_peel_loop()) log->print("partial_peel_loop='1' "); + } + if (head->is_CountedLoop()) { + CountedLoopNode* cl = head->as_CountedLoop(); + if (cl->is_pre_loop()) log->print("pre_loop='%d' ", cl->main_idx()); + if (cl->is_main_loop()) log->print("main_loop='%d' ", cl->_idx); + if (cl->is_post_loop()) log->print("post_loop='%d' ", cl->main_idx()); + } + log->end_head(); + if( loop->_child ) log_loop_tree(root, loop->_child, log); + log->tail("loop"); + if( loop->_next ) log_loop_tree(root, loop->_next, log); + } +} + //============================================================================= //------------------------------PhaseIdealLoop--------------------------------- // Create a PhaseLoop. Build the ideal Loop tree. Map each Ideal Node to @@ -1624,10 +1655,13 @@ PhaseIdealLoop::PhaseIdealLoop( PhaseIterGVN &igvn, const PhaseIdealLoop *verify // Cleanup any modified bits _igvn.optimize(); - // Do not repeat loop optimizations if irreducible loops are present - // by claiming no-progress. - if( _has_irreducible_loops ) - C->clear_major_progress(); + // disable assert until issue with split_flow_path is resolved (6742111) + // assert(!_has_irreducible_loops || C->parsed_irreducible_loop() || C->is_osr_compilation(), + // "shouldn't introduce irreducible loops"); + + if (C->log() != NULL) { + log_loop_tree(_ltree_root, _ltree_root, C->log()); + } } #ifndef PRODUCT @@ -2732,11 +2766,7 @@ void PhaseIdealLoop::dump( ) const { } void PhaseIdealLoop::dump( IdealLoopTree *loop, uint idx, Node_List &rpo_list ) const { - - // Indent by loop nesting depth - for( uint x = 0; x < loop->_nest; x++ ) - tty->print(" "); - tty->print_cr("---- Loop N%d-N%d ----", loop->_head->_idx,loop->_tail->_idx); + loop->dump_head(); // Now scan for CFG nodes in the same loop for( uint j=idx; j > 0; j-- ) { diff --git a/hotspot/src/share/vm/opto/loopnode.hpp b/hotspot/src/share/vm/opto/loopnode.hpp index 629b4b2e5d1..968cf865365 100644 --- a/hotspot/src/share/vm/opto/loopnode.hpp +++ b/hotspot/src/share/vm/opto/loopnode.hpp @@ -192,6 +192,8 @@ public: int is_main_no_pre_loop() const { return _loop_flags & Main_Has_No_Pre_Loop; } void set_main_no_pre_loop() { _loop_flags |= Main_Has_No_Pre_Loop; } + int main_idx() const { return _main_idx; } + void set_pre_loop (CountedLoopNode *main) { assert(is_normal_loop(),""); _loop_flags |= Pre ; _main_idx = main->_idx; } void set_main_loop ( ) { assert(is_normal_loop(),""); _loop_flags |= Main; } diff --git a/hotspot/src/share/vm/opto/loopopts.cpp b/hotspot/src/share/vm/opto/loopopts.cpp index 36ceb61a351..e0f55603b7a 100644 --- a/hotspot/src/share/vm/opto/loopopts.cpp +++ b/hotspot/src/share/vm/opto/loopopts.cpp @@ -2667,6 +2667,10 @@ void PhaseIdealLoop::reorg_offsets( IdealLoopTree *loop ) { // Fix this by adjusting to use the post-increment trip counter. Node *phi = cl->phi(); if( !phi ) return; // Dead infinite loop + + // Shape messed up, probably by iteration_split_impl + if (phi->in(LoopNode::LoopBackControl) != cl->incr()) return; + bool progress = true; while (progress) { progress = false; diff --git a/hotspot/src/share/vm/opto/matcher.cpp b/hotspot/src/share/vm/opto/matcher.cpp index f8ff59632ae..3844afd6b26 100644 --- a/hotspot/src/share/vm/opto/matcher.cpp +++ b/hotspot/src/share/vm/opto/matcher.cpp @@ -273,7 +273,7 @@ void Matcher::match( ) { find_shared( C->root() ); find_shared( C->top() ); - C->print_method("Before Matching", 2); + C->print_method("Before Matching"); // Swap out to old-space; emptying new-space Arena *old = C->node_arena()->move_contents(C->old_arena()); diff --git a/hotspot/src/share/vm/opto/parse.hpp b/hotspot/src/share/vm/opto/parse.hpp index bf344cb6f5f..0a68a35237e 100644 --- a/hotspot/src/share/vm/opto/parse.hpp +++ b/hotspot/src/share/vm/opto/parse.hpp @@ -167,9 +167,19 @@ class Parse : public GraphKit { int start() const { return flow()->start(); } int limit() const { return flow()->limit(); } - int pre_order() const { return flow()->pre_order(); } + int rpo() const { return flow()->rpo(); } int start_sp() const { return flow()->stack_size(); } + bool is_loop_head() const { return flow()->is_loop_head(); } + bool is_SEL_head() const { return flow()->is_single_entry_loop_head(); } + bool is_SEL_backedge(Block* pred) const{ return is_SEL_head() && pred->rpo() >= rpo(); } + bool is_invariant_local(uint i) const { + const JVMState* jvms = start_map()->jvms(); + if (!jvms->is_loc(i)) return false; + return flow()->is_invariant_local(i - jvms->locoff()); + } + bool can_elide_SEL_phi(uint i) const { assert(is_SEL_head(),""); return is_invariant_local(i); } + const Type* peek(int off=0) const { return stack_type_at(start_sp() - (off+1)); } const Type* stack_type_at(int i) const; @@ -305,7 +315,7 @@ class Parse : public GraphKit { // entry_bci() -- see osr_bci, etc. ciTypeFlow* flow() const { return _flow; } - // blocks() -- see pre_order_at, start_block, etc. + // blocks() -- see rpo_at, start_block, etc. int block_count() const { return _block_count; } GraphKit& exits() { return _exits; } @@ -330,12 +340,12 @@ class Parse : public GraphKit { // Must this parse be aborted? bool failing() { return C->failing(); } - Block* pre_order_at(int po) { - assert(0 <= po && po < _block_count, "oob"); - return &_blocks[po]; + Block* rpo_at(int rpo) { + assert(0 <= rpo && rpo < _block_count, "oob"); + return &_blocks[rpo]; } Block* start_block() { - return pre_order_at(flow()->start_block()->pre_order()); + return rpo_at(flow()->start_block()->rpo()); } // Can return NULL if the flow pass did not complete a block. Block* successor_for_bci(int bci) { @@ -359,9 +369,6 @@ class Parse : public GraphKit { // Parse all the basic blocks. void do_all_blocks(); - // Helper for do_all_blocks; makes one pass in pre-order. - void visit_blocks(); - // Parse the current basic block void do_one_block(); diff --git a/hotspot/src/share/vm/opto/parse1.cpp b/hotspot/src/share/vm/opto/parse1.cpp index d26d075f627..b896faca492 100644 --- a/hotspot/src/share/vm/opto/parse1.cpp +++ b/hotspot/src/share/vm/opto/parse1.cpp @@ -29,17 +29,17 @@ // the most. Some of the non-static variables are needed in bytecodeInfo.cpp // and eventually should be encapsulated in a proper class (gri 8/18/98). -int nodes_created = 0; int nodes_created_old = 0; -int methods_parsed = 0; int methods_parsed_old = 0; -int methods_seen = 0; int methods_seen_old = 0; +int nodes_created = 0; +int methods_parsed = 0; +int methods_seen = 0; +int blocks_parsed = 0; +int blocks_seen = 0; -int explicit_null_checks_inserted = 0, explicit_null_checks_inserted_old = 0; -int explicit_null_checks_elided = 0, explicit_null_checks_elided_old = 0; +int explicit_null_checks_inserted = 0; +int explicit_null_checks_elided = 0; int all_null_checks_found = 0, implicit_null_checks = 0; int implicit_null_throws = 0; -int parse_idx = 0; -size_t parse_arena = 0; int reclaim_idx = 0; int reclaim_in = 0; int reclaim_node = 0; @@ -61,6 +61,7 @@ void Parse::print_statistics() { tty->cr(); if (methods_seen != methods_parsed) tty->print_cr("Reasons for parse failures (NOT cumulative):"); + tty->print_cr("Blocks parsed: %d Blocks seen: %d", blocks_parsed, blocks_seen); if( explicit_null_checks_inserted ) tty->print_cr("%d original NULL checks - %d elided (%2d%%); optimizer leaves %d,", explicit_null_checks_inserted, explicit_null_checks_elided, (100*explicit_null_checks_elided)/explicit_null_checks_inserted, all_null_checks_found); @@ -373,6 +374,12 @@ Parse::Parse(JVMState* caller, ciMethod* parse_method, float expected_uses) C->record_method_not_compilable_all_tiers(_flow->failure_reason()); } +#ifndef PRODUCT + if (_flow->has_irreducible_entry()) { + C->set_parsed_irreducible_loop(true); + } +#endif + if (_expected_uses <= 0) { _prof_factor = 1; } else { @@ -556,118 +563,93 @@ Parse::Parse(JVMState* caller, ciMethod* parse_method, float expected_uses) set_map(entry_map); do_exits(); - // Collect a few more statistics. - parse_idx += C->unique(); - parse_arena += C->node_arena()->used(); - if (log) log->done("parse nodes='%d' memory='%d'", C->unique(), C->node_arena()->used()); } //---------------------------do_all_blocks------------------------------------- void Parse::do_all_blocks() { - _blocks_merged = 0; - _blocks_parsed = 0; + bool has_irreducible = flow()->has_irreducible_entry(); - int old_blocks_merged = -1; - int old_blocks_parsed = -1; + // Walk over all blocks in Reverse Post-Order. + while (true) { + bool progress = false; + for (int rpo = 0; rpo < block_count(); rpo++) { + Block* block = rpo_at(rpo); - for (int tries = 0; ; tries++) { - visit_blocks(); - if (failing()) return; // Check for bailout + if (block->is_parsed()) continue; - // No need for a work list. The outer loop is hardly ever repeated. - // The following loop traverses the blocks in a reasonable pre-order, - // as produced by the ciTypeFlow pass. - - // This loop can be taken more than once if there are two entries to - // a loop (irreduceable CFG), and the edge which ciTypeFlow chose - // as the first predecessor to the loop goes dead in the parser, - // due to parse-time optimization. (Could happen with obfuscated code.) - - // Look for progress, or the lack of it: - if (_blocks_parsed == block_count()) { - // That's all, folks. - if (TraceOptoParse) { - tty->print_cr("All blocks parsed."); + if (!block->is_merged()) { + // Dead block, no state reaches this block + continue; } - break; + + // Prepare to parse this block. + load_state_from(block); + + if (stopped()) { + // Block is dead. + continue; + } + + blocks_parsed++; + + progress = true; + if (block->is_loop_head() || block->is_handler() || has_irreducible && !block->is_ready()) { + // Not all preds have been parsed. We must build phis everywhere. + // (Note that dead locals do not get phis built, ever.) + ensure_phis_everywhere(); + + // Leave behind an undisturbed copy of the map, for future merges. + set_map(clone_map()); + } + + if (control()->is_Region() && !block->is_loop_head() && !has_irreducible && !block->is_handler()) { + // In the absence of irreducible loops, the Region and Phis + // associated with a merge that doesn't involve a backedge can + // be simplfied now since the RPO parsing order guarantees + // that any path which was supposed to reach here has already + // been parsed or must be dead. + Node* c = control(); + Node* result = _gvn.transform_no_reclaim(control()); + if (c != result && TraceOptoParse) { + tty->print_cr("Block #%d replace %d with %d", block->rpo(), c->_idx, result->_idx); + } + if (result != top()) { + record_for_igvn(result); + } + } + + // Parse the block. + do_one_block(); + + // Check for bailouts. + if (failing()) return; } - // How much work was done this time around? - int new_blocks_merged = _blocks_merged - old_blocks_merged; - int new_blocks_parsed = _blocks_parsed - old_blocks_parsed; - if (new_blocks_merged == 0) { - if (TraceOptoParse) { - tty->print_cr("All live blocks parsed; %d dead blocks.", block_count() - _blocks_parsed); - } - // No new blocks have become parseable. Some blocks are just dead. + // with irreducible loops multiple passes might be necessary to parse everything + if (!has_irreducible || !progress) { break; } - assert(new_blocks_parsed > 0, "must make progress"); - assert(tries < block_count(), "the pre-order cannot be this bad!"); - - old_blocks_merged = _blocks_merged; - old_blocks_parsed = _blocks_parsed; } + blocks_seen += block_count(); + #ifndef PRODUCT // Make sure there are no half-processed blocks remaining. // Every remaining unprocessed block is dead and may be ignored now. - for (int po = 0; po < block_count(); po++) { - Block* block = pre_order_at(po); + for (int rpo = 0; rpo < block_count(); rpo++) { + Block* block = rpo_at(rpo); if (!block->is_parsed()) { if (TraceOptoParse) { - tty->print("Skipped dead block %d at bci:%d", po, block->start()); - assert(!block->is_merged(), "no half-processed blocks"); + tty->print_cr("Skipped dead block %d at bci:%d", rpo, block->start()); } + assert(!block->is_merged(), "no half-processed blocks"); } } #endif } -//---------------------------visit_blocks-------------------------------------- -void Parse::visit_blocks() { - // Walk over all blocks, parsing every one that has been reached (merged). - for (int po = 0; po < block_count(); po++) { - Block* block = pre_order_at(po); - - if (block->is_parsed()) { - // Do not parse twice. - continue; - } - - if (!block->is_merged()) { - // No state on this block. It had not yet been reached. - // Delay reaching it until later. - continue; - } - - // Prepare to parse this block. - load_state_from(block); - - if (stopped()) { - // Block is dead. - continue; - } - - if (!block->is_ready() || block->is_handler()) { - // Not all preds have been parsed. We must build phis everywhere. - // (Note that dead locals do not get phis built, ever.) - ensure_phis_everywhere(); - - // Leave behind an undisturbed copy of the map, for future merges. - set_map(clone_map()); - } - - // Ready or not, parse the block. - do_one_block(); - - // Check for bailouts. - if (failing()) return; - } -} - //-------------------------------build_exits---------------------------------- // Build normal and exceptional exit merge points. void Parse::build_exits() { @@ -1134,24 +1116,24 @@ void Parse::init_blocks() { _blocks = NEW_RESOURCE_ARRAY(Block, _block_count); Copy::zero_to_bytes(_blocks, sizeof(Block)*_block_count); - int po; + int rpo; // Initialize the structs. - for (po = 0; po < block_count(); po++) { - Block* block = pre_order_at(po); - block->init_node(this, po); + for (rpo = 0; rpo < block_count(); rpo++) { + Block* block = rpo_at(rpo); + block->init_node(this, rpo); } // Collect predecessor and successor information. - for (po = 0; po < block_count(); po++) { - Block* block = pre_order_at(po); + for (rpo = 0; rpo < block_count(); rpo++) { + Block* block = rpo_at(rpo); block->init_graph(this); } } //-------------------------------init_node------------------------------------- -void Parse::Block::init_node(Parse* outer, int po) { - _flow = outer->flow()->pre_order_at(po); +void Parse::Block::init_node(Parse* outer, int rpo) { + _flow = outer->flow()->rpo_at(rpo); _pred_count = 0; _preds_parsed = 0; _count = 0; @@ -1177,7 +1159,7 @@ void Parse::Block::init_graph(Parse* outer) { int p = 0; for (int i = 0; i < ns+ne; i++) { ciTypeFlow::Block* tf2 = (i < ns) ? tfs->at(i) : tfe->at(i-ns); - Block* block2 = outer->pre_order_at(tf2->pre_order()); + Block* block2 = outer->rpo_at(tf2->rpo()); _successors[i] = block2; // Accumulate pred info for the other block, too. @@ -1368,10 +1350,11 @@ void Parse::do_one_block() { int nt = b->all_successors(); tty->print("Parsing block #%d at bci [%d,%d), successors: ", - block()->pre_order(), block()->start(), block()->limit()); + block()->rpo(), block()->start(), block()->limit()); for (int i = 0; i < nt; i++) { - tty->print((( i < ns) ? " %d" : " %d(e)"), b->successor_at(i)->pre_order()); + tty->print((( i < ns) ? " %d" : " %d(e)"), b->successor_at(i)->rpo()); } + if (b->is_loop_head()) tty->print(" lphd"); tty->print_cr(""); } @@ -1501,7 +1484,7 @@ void Parse::handle_missing_successor(int target_bci) { #ifndef PRODUCT Block* b = block(); int trap_bci = b->flow()->has_trap()? b->flow()->trap_bci(): -1; - tty->print_cr("### Missing successor at bci:%d for block #%d (trap_bci:%d)", target_bci, b->pre_order(), trap_bci); + tty->print_cr("### Missing successor at bci:%d for block #%d (trap_bci:%d)", target_bci, b->rpo(), trap_bci); #endif ShouldNotReachHere(); } @@ -1509,7 +1492,7 @@ void Parse::handle_missing_successor(int target_bci) { //--------------------------merge_common--------------------------------------- void Parse::merge_common(Parse::Block* target, int pnum) { if (TraceOptoParse) { - tty->print("Merging state at block #%d bci:%d", target->pre_order(), target->start()); + tty->print("Merging state at block #%d bci:%d", target->rpo(), target->start()); } // Zap extra stack slots to top @@ -1534,6 +1517,7 @@ void Parse::merge_common(Parse::Block* target, int pnum) { // which must not be allowed into this block's map.) if (pnum > PhiNode::Input // Known multiple inputs. || target->is_handler() // These have unpredictable inputs. + || target->is_loop_head() // Known multiple inputs || control()->is_Region()) { // We must hide this guy. // Add a Region to start the new basic block. Phis will be added // later lazily. @@ -1575,15 +1559,21 @@ void Parse::merge_common(Parse::Block* target, int pnum) { // Compute where to merge into // Merge incoming control path - r->set_req(pnum, newin->control()); + r->init_req(pnum, newin->control()); if (pnum == 1) { // Last merge for this Region? - _gvn.transform_no_reclaim(r); + if (!block()->flow()->is_irreducible_entry()) { + Node* result = _gvn.transform_no_reclaim(r); + if (r != result && TraceOptoParse) { + tty->print_cr("Block #%d replace %d with %d", block()->rpo(), r->_idx, result->_idx); + } + } record_for_igvn(r); } // Update all the non-control inputs to map: assert(TypeFunc::Parms == newin->jvms()->locoff(), "parser map should contain only youngest jvms"); + bool check_elide_phi = target->is_SEL_backedge(save_block); for (uint j = 1; j < newin->req(); j++) { Node* m = map()->in(j); // Current state of target. Node* n = newin->in(j); // Incoming change to target state. @@ -1603,7 +1593,11 @@ void Parse::merge_common(Parse::Block* target, int pnum) { merge_memory_edges(n->as_MergeMem(), pnum, nophi); continue; default: // All normal stuff - if (phi == NULL) phi = ensure_phi(j, nophi); + if (phi == NULL) { + if (!check_elide_phi || !target->can_elide_SEL_phi(j)) { + phi = ensure_phi(j, nophi); + } + } break; } } @@ -1736,9 +1730,13 @@ void Parse::ensure_phis_everywhere() { uint nof_monitors = map()->jvms()->nof_monitors(); assert(TypeFunc::Parms == map()->jvms()->locoff(), "parser map should contain only youngest jvms"); + bool check_elide_phi = block()->is_SEL_head(); for (uint i = TypeFunc::Parms; i < monoff; i++) { - ensure_phi(i); + if (!check_elide_phi || !block()->can_elide_SEL_phi(i)) { + ensure_phi(i); + } } + // Even monitors need Phis, though they are well-structured. // This is true for OSR methods, and also for the rare cases where // a monitor object is the subject of a replace_in_map operation. From c03ab32ab5e91f7b72518df7002b54aadc1d00c4 Mon Sep 17 00:00:00 2001 From: Antonios Printezis Date: Mon, 22 Sep 2008 09:56:49 -0400 Subject: [PATCH 016/267] 6742641: G1: NullPointerException during GCOld An update buffer is not processed correctly, which causes roots into the collection set not to be scanned and, hence, for the heap to be corrupted. The cause is that an object is accessed after it has been explicitly deleted, which causes a race. Reviewed-by: jcoomes, ysr --- hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp b/hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp index 53de081cc25..28159924298 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp @@ -208,12 +208,13 @@ apply_closure_to_completed_buffer_helper(int worker_i, nd->index, _sz, true, worker_i); void** buf = nd->buf; + size_t index = nd->index; delete nd; if (b) { deallocate_buffer(buf); return true; // In normal case, go on to next buffer. } else { - enqueue_complete_buffer(buf, nd->index, true); + enqueue_complete_buffer(buf, index, true); return false; } } else { From b15796424e5b7b504b7a447774ef950347f8515a Mon Sep 17 00:00:00 2001 From: Vladimir Kozlov Date: Tue, 23 Sep 2008 12:29:06 -0700 Subject: [PATCH 017/267] 6747051: Improve code and implicit null check generation for compressed oops Push DecodeN node below the Null check to the non-null path to use the mach node without 0 test. Reviewed-by: rasbold, never --- hotspot/src/share/vm/asm/assembler.cpp | 3 - hotspot/src/share/vm/opto/cfgnode.cpp | 45 ++++++++ hotspot/src/share/vm/opto/compile.cpp | 137 +++++++++++++++++++++---- hotspot/src/share/vm/opto/connode.cpp | 4 +- hotspot/src/share/vm/opto/matcher.cpp | 50 +++++++-- hotspot/src/share/vm/opto/matcher.hpp | 2 +- 6 files changed, 209 insertions(+), 32 deletions(-) diff --git a/hotspot/src/share/vm/asm/assembler.cpp b/hotspot/src/share/vm/asm/assembler.cpp index dcf1f0dcd94..1767c48e4bd 100644 --- a/hotspot/src/share/vm/asm/assembler.cpp +++ b/hotspot/src/share/vm/asm/assembler.cpp @@ -249,8 +249,6 @@ void AbstractAssembler::block_comment(const char* comment) { bool MacroAssembler::needs_explicit_null_check(intptr_t offset) { // Exception handler checks the nmethod's implicit null checks table // only when this method returns false. -#ifndef SPARC - // Sparc does not have based addressing if (UseCompressedOops) { // The first page after heap_base is unmapped and // the 'offset' is equal to [heap_base + offset] for @@ -261,7 +259,6 @@ bool MacroAssembler::needs_explicit_null_check(intptr_t offset) { offset = (intptr_t)(pointer_delta((void*)offset, (void*)heap_base, 1)); } } -#endif // SPARC return offset < 0 || os::vm_page_size() <= offset; } diff --git a/hotspot/src/share/vm/opto/cfgnode.cpp b/hotspot/src/share/vm/opto/cfgnode.cpp index b37cb27ddb9..60508de55b3 100644 --- a/hotspot/src/share/vm/opto/cfgnode.cpp +++ b/hotspot/src/share/vm/opto/cfgnode.cpp @@ -1769,6 +1769,51 @@ Node *PhiNode::Ideal(PhaseGVN *phase, bool can_reshape) { } } +#ifdef _LP64 + // Push DecodeN down through phi. + // The rest of phi graph will transform by split EncodeP node though phis up. + if (UseCompressedOops && can_reshape && progress == NULL) { + bool may_push = true; + bool has_decodeN = false; + Node* in_decodeN = NULL; + for (uint i=1; iis_DecodeN() && ii->bottom_type() == bottom_type()) { + has_decodeN = true; + in_decodeN = ii->in(1); + } else if (!ii->is_Phi()) { + may_push = false; + } + } + + if (has_decodeN && may_push) { + PhaseIterGVN *igvn = phase->is_IterGVN(); + // Note: in_decodeN is used only to define the type of new phi here. + PhiNode *new_phi = PhiNode::make_blank(in(0), in_decodeN); + uint orig_cnt = req(); + for (uint i=1; iis_DecodeN()) { + assert(ii->bottom_type() == bottom_type(), "sanity"); + new_ii = ii->in(1); + } else { + assert(ii->is_Phi(), "sanity"); + if (ii->as_Phi() == this) { + new_ii = new_phi; + } else { + new_ii = new (phase->C, 2) EncodePNode(ii, in_decodeN->bottom_type()); + igvn->register_new_node_with_optimizer(new_ii); + } + } + new_phi->set_req(i, new_ii); + } + igvn->register_new_node_with_optimizer(new_phi, this); + progress = new (phase->C, 2) DecodeNNode(new_phi, bottom_type()); + } + } +#endif + return progress; // Return any progress } diff --git a/hotspot/src/share/vm/opto/compile.cpp b/hotspot/src/share/vm/opto/compile.cpp index 24ac979323b..91ae2e6b8f5 100644 --- a/hotspot/src/share/vm/opto/compile.cpp +++ b/hotspot/src/share/vm/opto/compile.cpp @@ -2075,6 +2075,44 @@ static void final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &fpu ) { } #ifdef _LP64 + case Op_CastPP: + if (n->in(1)->is_DecodeN() && UseImplicitNullCheckForNarrowOop) { + Compile* C = Compile::current(); + Node* in1 = n->in(1); + const Type* t = n->bottom_type(); + Node* new_in1 = in1->clone(); + new_in1->as_DecodeN()->set_type(t); + + if (!Matcher::clone_shift_expressions) { + // + // x86, ARM and friends can handle 2 adds in addressing mode + // and Matcher can fold a DecodeN node into address by using + // a narrow oop directly and do implicit NULL check in address: + // + // [R12 + narrow_oop_reg<<3 + offset] + // NullCheck narrow_oop_reg + // + // On other platforms (Sparc) we have to keep new DecodeN node and + // use it to do implicit NULL check in address: + // + // decode_not_null narrow_oop_reg, base_reg + // [base_reg + offset] + // NullCheck base_reg + // + // Pin the new DecodeN node to non-null path on these patforms (Sparc) + // to keep the information to which NULL check the new DecodeN node + // corresponds to use it as value in implicit_null_check(). + // + new_in1->set_req(0, n->in(0)); + } + + n->subsume_by(new_in1); + if (in1->outcnt() == 0) { + in1->disconnect_inputs(NULL); + } + } + break; + case Op_CmpP: // Do this transformation here to preserve CmpPNode::sub() and // other TypePtr related Ideal optimizations (for example, ptr nullness). @@ -2094,24 +2132,44 @@ static void final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &fpu ) { } else if (in2->Opcode() == Op_ConP) { const Type* t = in2->bottom_type(); if (t == TypePtr::NULL_PTR && UseImplicitNullCheckForNarrowOop) { - if (Matcher::clone_shift_expressions) { - // x86, ARM and friends can handle 2 adds in addressing mode. - // Decode a narrow oop and do implicit NULL check in address - // [R12 + narrow_oop_reg<<3 + offset] - new_in2 = ConNode::make(C, TypeNarrowOop::NULL_PTR); - } else { - // Don't replace CmpP(o ,null) if 'o' is used in AddP - // to generate implicit NULL check on Sparc where - // narrow oops can't be used in address. - uint i = 0; - for (; i < in1->outcnt(); i++) { - if (in1->raw_out(i)->is_AddP()) - break; - } - if (i >= in1->outcnt()) { - new_in2 = ConNode::make(C, TypeNarrowOop::NULL_PTR); - } - } + new_in2 = ConNode::make(C, TypeNarrowOop::NULL_PTR); + // + // This transformation together with CastPP transformation above + // will generated code for implicit NULL checks for compressed oops. + // + // The original code after Optimize() + // + // LoadN memory, narrow_oop_reg + // decode narrow_oop_reg, base_reg + // CmpP base_reg, NULL + // CastPP base_reg // NotNull + // Load [base_reg + offset], val_reg + // + // after these transformations will be + // + // LoadN memory, narrow_oop_reg + // CmpN narrow_oop_reg, NULL + // decode_not_null narrow_oop_reg, base_reg + // Load [base_reg + offset], val_reg + // + // and the uncommon path (== NULL) will use narrow_oop_reg directly + // since narrow oops can be used in debug info now (see the code in + // final_graph_reshaping_walk()). + // + // At the end the code will be matched to + // on x86: + // + // Load_narrow_oop memory, narrow_oop_reg + // Load [R12 + narrow_oop_reg<<3 + offset], val_reg + // NullCheck narrow_oop_reg + // + // and on sparc: + // + // Load_narrow_oop memory, narrow_oop_reg + // decode_not_null narrow_oop_reg, base_reg + // Load [base_reg + offset], val_reg + // NullCheck base_reg + // } else if (t->isa_oopptr()) { new_in2 = ConNode::make(C, t->make_narrowoop()); } @@ -2128,6 +2186,49 @@ static void final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &fpu ) { } } break; + + case Op_DecodeN: + assert(!n->in(1)->is_EncodeP(), "should be optimized out"); + break; + + case Op_EncodeP: { + Node* in1 = n->in(1); + if (in1->is_DecodeN()) { + n->subsume_by(in1->in(1)); + } else if (in1->Opcode() == Op_ConP) { + Compile* C = Compile::current(); + const Type* t = in1->bottom_type(); + if (t == TypePtr::NULL_PTR) { + n->subsume_by(ConNode::make(C, TypeNarrowOop::NULL_PTR)); + } else if (t->isa_oopptr()) { + n->subsume_by(ConNode::make(C, t->make_narrowoop())); + } + } + if (in1->outcnt() == 0) { + in1->disconnect_inputs(NULL); + } + break; + } + + case Op_Phi: + if (n->as_Phi()->bottom_type()->isa_narrowoop()) { + // The EncodeP optimization may create Phi with the same edges + // for all paths. It is not handled well by Register Allocator. + Node* unique_in = n->in(1); + assert(unique_in != NULL, ""); + uint cnt = n->req(); + for (uint i = 2; i < cnt; i++) { + Node* m = n->in(i); + assert(m != NULL, ""); + if (unique_in != m) + unique_in = NULL; + } + if (unique_in != NULL) { + n->subsume_by(unique_in); + } + } + break; + #endif case Op_ModI: diff --git a/hotspot/src/share/vm/opto/connode.cpp b/hotspot/src/share/vm/opto/connode.cpp index ceebd76a6bb..7e1cafefa57 100644 --- a/hotspot/src/share/vm/opto/connode.cpp +++ b/hotspot/src/share/vm/opto/connode.cpp @@ -433,8 +433,8 @@ Node *ConstraintCastNode::Ideal_DU_postCCP( PhaseCCP *ccp ) { // If not converting int->oop, throw away cast after constant propagation Node *CastPPNode::Ideal_DU_postCCP( PhaseCCP *ccp ) { const Type *t = ccp->type(in(1)); - if (!t->isa_oop_ptr()) { - return NULL; // do not transform raw pointers + if (!t->isa_oop_ptr() || in(1)->is_DecodeN()) { + return NULL; // do not transform raw pointers or narrow oops } return ConstraintCastNode::Ideal_DU_postCCP(ccp); } diff --git a/hotspot/src/share/vm/opto/matcher.cpp b/hotspot/src/share/vm/opto/matcher.cpp index 3844afd6b26..1fc7915b9d6 100644 --- a/hotspot/src/share/vm/opto/matcher.cpp +++ b/hotspot/src/share/vm/opto/matcher.cpp @@ -840,7 +840,7 @@ Node *Matcher::xform( Node *n, int max_stack ) { _new2old_map.map(m->_idx, n); #endif if (m->in(0) != NULL) // m might be top - collect_null_checks(m); + collect_null_checks(m, n); } else { // Else just a regular 'ol guy m = n->clone(); // So just clone into new-space #ifdef ASSERT @@ -1478,12 +1478,19 @@ MachNode *Matcher::ReduceInst( State *s, int rule, Node *&mem ) { m = _mem_node; assert(m != NULL && m->is_Mem(), "expecting memory node"); } - if (m->adr_type() != mach->adr_type()) { + const Type* mach_at = mach->adr_type(); + // DecodeN node consumed by an address may have different type + // then its input. Don't compare types for such case. + if (m->adr_type() != mach_at && m->in(MemNode::Address)->is_AddP() && + m->in(MemNode::Address)->in(AddPNode::Address)->is_DecodeN()) { + mach_at = m->adr_type(); + } + if (m->adr_type() != mach_at) { m->dump(); tty->print_cr("mach:"); mach->dump(1); } - assert(m->adr_type() == mach->adr_type(), "matcher should not change adr type"); + assert(m->adr_type() == mach_at, "matcher should not change adr type"); } #endif } @@ -1995,7 +2002,7 @@ void Matcher::dump_old2new_map() { // it. Used by later implicit-null-check handling. Actually collects // either an IfTrue or IfFalse for the common NOT-null path, AND the ideal // value being tested. -void Matcher::collect_null_checks( Node *proj ) { +void Matcher::collect_null_checks( Node *proj, Node *orig_proj ) { Node *iff = proj->in(0); if( iff->Opcode() == Op_If ) { // During matching If's have Bool & Cmp side-by-side @@ -2008,20 +2015,47 @@ void Matcher::collect_null_checks( Node *proj ) { if (ct == TypePtr::NULL_PTR || (opc == Op_CmpN && ct == TypeNarrowOop::NULL_PTR)) { + bool push_it = false; if( proj->Opcode() == Op_IfTrue ) { extern int all_null_checks_found; all_null_checks_found++; if( b->_test._test == BoolTest::ne ) { - _null_check_tests.push(proj); - _null_check_tests.push(cmp->in(1)); + push_it = true; } } else { assert( proj->Opcode() == Op_IfFalse, "" ); if( b->_test._test == BoolTest::eq ) { - _null_check_tests.push(proj); - _null_check_tests.push(cmp->in(1)); + push_it = true; } } + if( push_it ) { + _null_check_tests.push(proj); + Node* val = cmp->in(1); +#ifdef _LP64 + if (UseCompressedOops && !Matcher::clone_shift_expressions && + val->bottom_type()->isa_narrowoop()) { + // + // Look for DecodeN node which should be pinned to orig_proj. + // On platforms (Sparc) which can not handle 2 adds + // in addressing mode we have to keep a DecodeN node and + // use it to do implicit NULL check in address. + // + // DecodeN node was pinned to non-null path (orig_proj) during + // CastPP transformation in final_graph_reshaping_impl(). + // + uint cnt = orig_proj->outcnt(); + for (uint i = 0; i < orig_proj->outcnt(); i++) { + Node* d = orig_proj->raw_out(i); + if (d->is_DecodeN() && d->in(1) == val) { + val = d; + val->set_req(0, NULL); // Unpin now. + break; + } + } + } +#endif + _null_check_tests.push(val); + } } } } diff --git a/hotspot/src/share/vm/opto/matcher.hpp b/hotspot/src/share/vm/opto/matcher.hpp index 20de817c8b8..d4ba9ef10e8 100644 --- a/hotspot/src/share/vm/opto/matcher.hpp +++ b/hotspot/src/share/vm/opto/matcher.hpp @@ -166,7 +166,7 @@ public: // List of IfFalse or IfTrue Nodes that indicate a taken null test. // List is valid in the post-matching space. Node_List _null_check_tests; - void collect_null_checks( Node *proj ); + void collect_null_checks( Node *proj, Node *orig_proj ); void validate_null_checks( ); Matcher( Node_List &proj_list ); From 42be28cecede317bd6e734ad9a3e34e29bdd85ce Mon Sep 17 00:00:00 2001 From: Chuck Rasbold Date: Wed, 24 Sep 2008 15:56:36 -0700 Subject: [PATCH 018/267] 6750588: assert(lrg._area >= 0,"negative spill area") running NSK stmp0101 test Handle NaN costs more carefully Reviewed-by: kvn, never --- hotspot/src/share/vm/opto/ifg.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/hotspot/src/share/vm/opto/ifg.cpp b/hotspot/src/share/vm/opto/ifg.cpp index e7f55aa5b09..2f4e5176453 100644 --- a/hotspot/src/share/vm/opto/ifg.cpp +++ b/hotspot/src/share/vm/opto/ifg.cpp @@ -485,8 +485,9 @@ uint PhaseChaitin::build_ifg_physical( ResourceArea *a ) { // Liveout things are presumed live for the whole block. We accumulate // 'area' accordingly. If they get killed in the block, we'll subtract // the unused part of the block from the area. - double cost = b->_freq * double(last_inst-last_phi); - assert( cost >= 0, "negative spill cost" ); + int inst_count = last_inst - last_phi; + double cost = (inst_count <= 0) ? 0.0 : b->_freq * double(inst_count); + assert(!(cost < 0.0), "negative spill cost" ); IndexSetIterator elements(&liveout); uint lidx; while ((lidx = elements.next()) != 0) { @@ -590,7 +591,7 @@ uint PhaseChaitin::build_ifg_physical( ResourceArea *a ) { } else { // Else it is live // A DEF also ends 'area' partway through the block. lrgs(r)._area -= cost; - assert( lrgs(r)._area >= 0, "negative spill area" ); + assert(!(lrgs(r)._area < 0.0), "negative spill area" ); // Insure high score for immediate-use spill copies so they get a color if( n->is_SpillCopy() @@ -703,8 +704,9 @@ uint PhaseChaitin::build_ifg_physical( ResourceArea *a ) { } // End of if normal register-allocated value - cost -= b->_freq; // Area remaining in the block - if( cost < 0.0 ) cost = 0.0; // Cost goes negative in the Phi area + // Area remaining in the block + inst_count--; + cost = (inst_count <= 0) ? 0.0 : b->_freq * double(inst_count); // Make all inputs live if( !n->is_Phi() ) { // Phi function uses come from prior block @@ -751,7 +753,7 @@ uint PhaseChaitin::build_ifg_physical( ResourceArea *a ) { assert( pressure[0] == count_int_pressure (&liveout), "" ); assert( pressure[1] == count_float_pressure(&liveout), "" ); } - assert( lrg._area >= 0, "negative spill area" ); + assert(!(lrg._area < 0.0), "negative spill area" ); } } } // End of reverse pass over all instructions in block From ac161a1e1716738c77708fb54180f62af0880480 Mon Sep 17 00:00:00 2001 From: Volker Simonis Date: Thu, 25 Sep 2008 12:50:51 -0700 Subject: [PATCH 019/267] 6744783: HotSpot segfaults if given -XX options with an empty string argument Reviewed-by: kamg, kvn --- hotspot/src/share/vm/prims/jvmtiTrace.cpp | 2 +- hotspot/src/share/vm/runtime/globals.cpp | 7 +++++-- hotspot/src/share/vm/runtime/globals.hpp | 6 +++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/hotspot/src/share/vm/prims/jvmtiTrace.cpp b/hotspot/src/share/vm/prims/jvmtiTrace.cpp index 2fff2cfc2da..09d30fbda16 100644 --- a/hotspot/src/share/vm/prims/jvmtiTrace.cpp +++ b/hotspot/src/share/vm/prims/jvmtiTrace.cpp @@ -73,7 +73,7 @@ void JvmtiTrace::initialize() { const char *very_end; const char *curr; - if (strlen(TraceJVMTI)) { + if (TraceJVMTI != NULL) { curr = TraceJVMTI; } else { curr = ""; // hack in fixed tracing here diff --git a/hotspot/src/share/vm/runtime/globals.cpp b/hotspot/src/share/vm/runtime/globals.cpp index 5adadcb98b5..5e1774f5e4e 100644 --- a/hotspot/src/share/vm/runtime/globals.cpp +++ b/hotspot/src/share/vm/runtime/globals.cpp @@ -355,8 +355,11 @@ bool CommandLineFlags::ccstrAtPut(char* name, size_t len, ccstr* value, FlagValu if (result == NULL) return false; if (!result->is_ccstr()) return false; ccstr old_value = result->get_ccstr(); - char* new_value = NEW_C_HEAP_ARRAY(char, strlen(*value)+1); - strcpy(new_value, *value); + char* new_value = NULL; + if (*value != NULL) { + new_value = NEW_C_HEAP_ARRAY(char, strlen(*value)+1); + strcpy(new_value, *value); + } result->set_ccstr(new_value); if (result->origin == DEFAULT && old_value != NULL) { // Prior value is NOT heap allocated, but was a literal constant. diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index 4f4b9b54bcd..3529f29f20b 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -692,7 +692,7 @@ class CommandLineFlags { diagnostic(bool, PrintAssembly, false, \ "Print assembly code (using external disassembler.so)") \ \ - diagnostic(ccstr, PrintAssemblyOptions, false, \ + diagnostic(ccstr, PrintAssemblyOptions, NULL, \ "Options string passed to disassembler.so") \ \ diagnostic(bool, PrintNMethods, false, \ @@ -833,7 +833,7 @@ class CommandLineFlags { "Use LWP-based instead of libthread-based synchronization " \ "(SPARC only)") \ \ - product(ccstr, SyncKnobs, "", \ + product(ccstr, SyncKnobs, NULL, \ "(Unstable) Various monitor synchronization tunables") \ \ product(intx, EmitSync, 0, \ @@ -1017,7 +1017,7 @@ class CommandLineFlags { notproduct(bool, TraceJVMCalls, false, \ "Trace JVM calls") \ \ - product(ccstr, TraceJVMTI, "", \ + product(ccstr, TraceJVMTI, NULL, \ "Trace flags for JVMTI functions and events") \ \ /* This option can change an EMCP method into an obsolete method. */ \ From 32addb490d62aac647ad37ab6fe5c7133048ebfa Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Fri, 26 Sep 2008 13:33:15 -0400 Subject: [PATCH 020/267] 6719149: Wrong "java/lang/String should not be loaded yet" assertion in fastdebug bits with UseStringCache Assertion is invalid because java.lang.String may be initialized just before this assertion. Reviewed-by: phh --- hotspot/src/share/vm/runtime/thread.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp index 1de74558377..ba22c1d9b4b 100644 --- a/hotspot/src/share/vm/runtime/thread.cpp +++ b/hotspot/src/share/vm/runtime/thread.cpp @@ -2964,10 +2964,6 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) { if (UseStringCache) { // Forcibly initialize java/lang/String and mutate the private // static final "stringCacheEnabled" field before we start creating instances -#ifdef ASSERT - klassOop tmp_k = SystemDictionary::find(vmSymbolHandles::java_lang_String(), Handle(), Handle(), CHECK_0); - assert(tmp_k == NULL, "java/lang/String should not be loaded yet"); -#endif klassOop k_o = SystemDictionary::resolve_or_null(vmSymbolHandles::java_lang_String(), Handle(), Handle(), CHECK_0); KlassHandle k = KlassHandle(THREAD, k_o); guarantee(k.not_null(), "Must find java/lang/String"); From 4204f82a1ae4e3b03aad20283374c2e173613d0f Mon Sep 17 00:00:00 2001 From: Igor Veresov Date: Sat, 27 Sep 2008 00:33:13 -0700 Subject: [PATCH 021/267] 6740923: NUMA allocator: Ensure the progress of adaptive chunk resizing Treat a chuck where the allocation has failed as fully used. Reviewed-by: ysr --- .../parallelScavenge/parallelScavengeHeap.cpp | 2 +- .../shared/immutableSpace.hpp | 3 +- .../shared/mutableNUMASpace.cpp | 31 +++++++++++++++++-- .../shared/mutableNUMASpace.hpp | 21 +++++++++++-- 4 files changed, 51 insertions(+), 6 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp index 5936c776a47..315cfe1c63e 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp @@ -402,7 +402,7 @@ HeapWord* ParallelScavengeHeap::mem_allocate( return result; } if (!is_tlab && - size >= (young_gen()->eden_space()->capacity_in_words() / 2)) { + size >= (young_gen()->eden_space()->capacity_in_words(Thread::current()) / 2)) { result = old_gen()->allocate(size, is_tlab); if (result != NULL) { return result; diff --git a/hotspot/src/share/vm/gc_implementation/shared/immutableSpace.hpp b/hotspot/src/share/vm/gc_implementation/shared/immutableSpace.hpp index 3f28ec710e4..39166412d8b 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/immutableSpace.hpp +++ b/hotspot/src/share/vm/gc_implementation/shared/immutableSpace.hpp @@ -50,7 +50,8 @@ class ImmutableSpace: public CHeapObj { size_t capacity_in_bytes() const { return capacity_in_words() * HeapWordSize; } // Size computations. Sizes are in heapwords. - size_t capacity_in_words() const { return pointer_delta(end(), bottom()); } + size_t capacity_in_words() const { return pointer_delta(end(), bottom()); } + virtual size_t capacity_in_words(Thread*) const { return capacity_in_words(); } // Iteration. virtual void oop_iterate(OopClosure* cl); diff --git a/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp b/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp index 344c6add09a..4779daf69df 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp +++ b/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp @@ -181,6 +181,25 @@ size_t MutableNUMASpace::unsafe_max_tlab_alloc(Thread *thr) const { return lgrp_spaces()->at(i)->space()->free_in_bytes(); } + +size_t MutableNUMASpace::capacity_in_words(Thread* thr) const { + guarantee(thr != NULL, "No thread"); + int lgrp_id = thr->lgrp_id(); + if (lgrp_id == -1) { + if (lgrp_spaces()->length() > 0) { + return capacity_in_words() / lgrp_spaces()->length(); + } else { + assert(false, "There should be at least one locality group"); + return 0; + } + } + int i = lgrp_spaces()->find(&lgrp_id, LGRPSpace::equals); + if (i == -1) { + return 0; + } + return lgrp_spaces()->at(i)->space()->capacity_in_words(); +} + // Check if the NUMA topology has changed. Add and remove spaces if needed. // The update can be forced by setting the force parameter equal to true. bool MutableNUMASpace::update_layout(bool force) { @@ -722,7 +741,8 @@ HeapWord* MutableNUMASpace::allocate(size_t size) { i = os::random() % lgrp_spaces()->length(); } - MutableSpace *s = lgrp_spaces()->at(i)->space(); + LGRPSpace* ls = lgrp_spaces()->at(i); + MutableSpace *s = ls->space(); HeapWord *p = s->allocate(size); if (p != NULL) { @@ -743,6 +763,9 @@ HeapWord* MutableNUMASpace::allocate(size_t size) { *(int*)i = 0; } } + if (p == NULL) { + ls->set_allocation_failed(); + } return p; } @@ -761,7 +784,8 @@ HeapWord* MutableNUMASpace::cas_allocate(size_t size) { if (i == -1) { i = os::random() % lgrp_spaces()->length(); } - MutableSpace *s = lgrp_spaces()->at(i)->space(); + LGRPSpace *ls = lgrp_spaces()->at(i); + MutableSpace *s = ls->space(); HeapWord *p = s->cas_allocate(size); if (p != NULL) { size_t remainder = pointer_delta(s->end(), p + size); @@ -790,6 +814,9 @@ HeapWord* MutableNUMASpace::cas_allocate(size_t size) { *(int*)i = 0; } } + if (p == NULL) { + ls->set_allocation_failed(); + } return p; } diff --git a/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.hpp b/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.hpp index e3d824481f4..f7ca2462545 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.hpp +++ b/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.hpp @@ -60,6 +60,7 @@ class MutableNUMASpace : public MutableSpace { MutableSpace* _space; MemRegion _invalid_region; AdaptiveWeightedAverage *_alloc_rate; + bool _allocation_failed; struct SpaceStats { size_t _local_space, _remote_space, _unbiased_space, _uncommited_space; @@ -81,7 +82,7 @@ class MutableNUMASpace : public MutableSpace { char* last_page_scanned() { return _last_page_scanned; } void set_last_page_scanned(char* p) { _last_page_scanned = p; } public: - LGRPSpace(int l) : _lgrp_id(l), _last_page_scanned(NULL) { + LGRPSpace(int l) : _lgrp_id(l), _last_page_scanned(NULL), _allocation_failed(false) { _space = new MutableSpace(); _alloc_rate = new AdaptiveWeightedAverage(NUMAChunkResizeWeight); } @@ -103,8 +104,21 @@ class MutableNUMASpace : public MutableSpace { return *(int*)lgrp_id_value == p->lgrp_id(); } + // Report a failed allocation. + void set_allocation_failed() { _allocation_failed = true; } + void sample() { - alloc_rate()->sample(space()->used_in_bytes()); + // If there was a failed allocation make allocation rate equal + // to the size of the whole chunk. This ensures the progress of + // the adaptation process. + size_t alloc_rate_sample; + if (_allocation_failed) { + alloc_rate_sample = space()->capacity_in_bytes(); + _allocation_failed = false; + } else { + alloc_rate_sample = space()->used_in_bytes(); + } + alloc_rate()->sample(alloc_rate_sample); } MemRegion invalid_region() const { return _invalid_region; } @@ -190,6 +204,9 @@ class MutableNUMASpace : public MutableSpace { virtual void ensure_parsability(); virtual size_t used_in_words() const; virtual size_t free_in_words() const; + + using MutableSpace::capacity_in_words; + virtual size_t capacity_in_words(Thread* thr) const; virtual size_t tlab_capacity(Thread* thr) const; virtual size_t unsafe_max_tlab_alloc(Thread* thr) const; From 2e52e9dff24e9efe85e70f39ce2d8e685d9a52e6 Mon Sep 17 00:00:00 2001 From: John Coomes Date: Tue, 30 Sep 2008 11:49:31 -0700 Subject: [PATCH 022/267] 6716466: par compact - remove VerifyParallelOldWithMarkSweep code Reviewed-by: jmasa --- hotspot/src/share/vm/code/nmethod.cpp | 6 +- .../parallelScavenge/parallelScavengeHeap.cpp | 4 - .../parallelScavenge/psMarkSweep.cpp | 7 +- .../parallelScavenge/psMarkSweepDecorator.cpp | 30 ++-- .../parallelScavenge/psOldGen.cpp | 2 - .../parallelScavenge/psParallelCompact.cpp | 144 ------------------ .../parallelScavenge/psPermGen.cpp | 2 - .../shared/markSweep.inline.hpp | 7 - hotspot/src/share/vm/runtime/globals.hpp | 7 - 9 files changed, 12 insertions(+), 197 deletions(-) diff --git a/hotspot/src/share/vm/code/nmethod.cpp b/hotspot/src/share/vm/code/nmethod.cpp index 282a4876262..6baa28690db 100644 --- a/hotspot/src/share/vm/code/nmethod.cpp +++ b/hotspot/src/share/vm/code/nmethod.cpp @@ -1350,11 +1350,7 @@ bool nmethod::can_unload(BoolObjectClosure* is_alive, return false; } } - if (!UseParallelOldGC || !VerifyParallelOldWithMarkSweep) { - // Cannot do this test if verification of the UseParallelOldGC - // code using the PSMarkSweep code is being done. - assert(unloading_occurred, "Inconsistency in unloading"); - } + assert(unloading_occurred, "Inconsistency in unloading"); make_unloaded(is_alive, obj); return true; } diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp index 315cfe1c63e..2d5334b780c 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp @@ -210,10 +210,6 @@ void ParallelScavengeHeap::post_initialize() { PSScavenge::initialize(); if (UseParallelOldGC) { PSParallelCompact::post_initialize(); - if (VerifyParallelOldWithMarkSweep) { - // Will be used for verification of par old. - PSMarkSweep::initialize(); - } } else { PSMarkSweep::initialize(); } diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp index d42d4fc26df..92c272a66fe 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp @@ -35,9 +35,7 @@ void PSMarkSweep::initialize() { _ref_processor = new ReferenceProcessor(mr, true, // atomic_discovery false); // mt_discovery - if (!UseParallelOldGC || !VerifyParallelOldWithMarkSweep) { - _counters = new CollectorCounters("PSMarkSweep", 1); - } + _counters = new CollectorCounters("PSMarkSweep", 1); } // This method contains all heap specific policy for invoking mark sweep. @@ -518,9 +516,6 @@ void PSMarkSweep::mark_sweep_phase1(bool clear_all_softrefs) { follow_stack(); // Process reference objects found during marking - - // Skipping the reference processing for VerifyParallelOldWithMarkSweep - // affects the marking (makes it different). { ReferencePolicy *soft_ref_policy; if (clear_all_softrefs) { diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp index 489cdea7272..40fb6a1b1b6 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp @@ -152,20 +152,15 @@ void PSMarkSweepDecorator::precompact() { oop(q)->forward_to(oop(compact_top)); assert(oop(q)->is_gc_marked(), "encoding the pointer should preserve the mark"); } else { - // Don't clear the mark since it's confuses parallel old - // verification. - if (!UseParallelOldGC || !VerifyParallelOldWithMarkSweep) { - // if the object isn't moving we can just set the mark to the default - // mark and handle it specially later on. - oop(q)->init_mark(); - } + // if the object isn't moving we can just set the mark to the default + // mark and handle it specially later on. + oop(q)->init_mark(); assert(oop(q)->forwardee() == NULL, "should be forwarded to NULL"); } // Update object start array - if (!UseParallelOldGC || !VerifyParallelOldWithMarkSweep) { - if (start_array) - start_array->allocate_block(compact_top); + if (start_array) { + start_array->allocate_block(compact_top); } VALIDATE_MARK_SWEEP_ONLY(MarkSweep::register_live_oop(oop(q), size)); @@ -219,19 +214,14 @@ void PSMarkSweepDecorator::precompact() { assert(oop(q)->is_gc_marked(), "encoding the pointer should preserve the mark"); } else { // if the object isn't moving we can just set the mark to the default - // Don't clear the mark since it's confuses parallel old - // verification. - if (!UseParallelOldGC || !VerifyParallelOldWithMarkSweep) { - // mark and handle it specially later on. - oop(q)->init_mark(); - } + // mark and handle it specially later on. + oop(q)->init_mark(); assert(oop(q)->forwardee() == NULL, "should be forwarded to NULL"); } - if (!UseParallelOldGC || !VerifyParallelOldWithMarkSweep) { - // Update object start array - if (start_array) - start_array->allocate_block(compact_top); + // Update object start array + if (start_array) { + start_array->allocate_block(compact_top); } VALIDATE_MARK_SWEEP_ONLY(MarkSweep::register_live_oop(oop(q), sz)); diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp index 71b80fb3087..ec7916bc795 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp @@ -152,9 +152,7 @@ void PSOldGen::precompact() { assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity"); // Reset start array first. - debug_only(if (!UseParallelOldGC || !VerifyParallelOldWithMarkSweep) {) start_array()->reset(); - debug_only(}) object_mark_sweep()->precompact(); diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp index 1abdd88ac65..fb0d7ec6e2d 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp @@ -100,93 +100,6 @@ GrowableArray* PSParallelCompact::_last_gc_live_oops_moved_to = NULL; GrowableArray * PSParallelCompact::_last_gc_live_oops_size = NULL; #endif -// XXX beg - verification code; only works while we also mark in object headers -static void -verify_mark_bitmap(ParMarkBitMap& _mark_bitmap) -{ - ParallelScavengeHeap* heap = PSParallelCompact::gc_heap(); - - PSPermGen* perm_gen = heap->perm_gen(); - PSOldGen* old_gen = heap->old_gen(); - PSYoungGen* young_gen = heap->young_gen(); - - MutableSpace* perm_space = perm_gen->object_space(); - MutableSpace* old_space = old_gen->object_space(); - MutableSpace* eden_space = young_gen->eden_space(); - MutableSpace* from_space = young_gen->from_space(); - MutableSpace* to_space = young_gen->to_space(); - - // 'from_space' here is the survivor space at the lower address. - if (to_space->bottom() < from_space->bottom()) { - from_space = to_space; - to_space = young_gen->from_space(); - } - - HeapWord* boundaries[12]; - unsigned int bidx = 0; - const unsigned int bidx_max = sizeof(boundaries) / sizeof(boundaries[0]); - - boundaries[0] = perm_space->bottom(); - boundaries[1] = perm_space->top(); - boundaries[2] = old_space->bottom(); - boundaries[3] = old_space->top(); - boundaries[4] = eden_space->bottom(); - boundaries[5] = eden_space->top(); - boundaries[6] = from_space->bottom(); - boundaries[7] = from_space->top(); - boundaries[8] = to_space->bottom(); - boundaries[9] = to_space->top(); - boundaries[10] = to_space->end(); - boundaries[11] = to_space->end(); - - BitMap::idx_t beg_bit = 0; - BitMap::idx_t end_bit; - BitMap::idx_t tmp_bit; - const BitMap::idx_t last_bit = _mark_bitmap.size(); - do { - HeapWord* addr = _mark_bitmap.bit_to_addr(beg_bit); - if (_mark_bitmap.is_marked(beg_bit)) { - oop obj = (oop)addr; - assert(obj->is_gc_marked(), "obj header is not marked"); - end_bit = _mark_bitmap.find_obj_end(beg_bit, last_bit); - const size_t size = _mark_bitmap.obj_size(beg_bit, end_bit); - assert(size == (size_t)obj->size(), "end bit wrong?"); - beg_bit = _mark_bitmap.find_obj_beg(beg_bit + 1, last_bit); - assert(beg_bit > end_bit, "bit set in middle of an obj"); - } else { - if (addr >= boundaries[bidx] && addr < boundaries[bidx + 1]) { - // a dead object in the current space. - oop obj = (oop)addr; - end_bit = _mark_bitmap.addr_to_bit(addr + obj->size()); - assert(!obj->is_gc_marked(), "obj marked in header, not in bitmap"); - tmp_bit = beg_bit + 1; - beg_bit = _mark_bitmap.find_obj_beg(tmp_bit, end_bit); - assert(beg_bit == end_bit, "beg bit set in unmarked obj"); - beg_bit = _mark_bitmap.find_obj_end(tmp_bit, end_bit); - assert(beg_bit == end_bit, "end bit set in unmarked obj"); - } else if (addr < boundaries[bidx + 2]) { - // addr is between top in the current space and bottom in the next. - end_bit = beg_bit + pointer_delta(boundaries[bidx + 2], addr); - tmp_bit = beg_bit; - beg_bit = _mark_bitmap.find_obj_beg(tmp_bit, end_bit); - assert(beg_bit == end_bit, "beg bit set above top"); - beg_bit = _mark_bitmap.find_obj_end(tmp_bit, end_bit); - assert(beg_bit == end_bit, "end bit set above top"); - bidx += 2; - } else if (bidx < bidx_max - 2) { - bidx += 2; // ??? - } else { - tmp_bit = beg_bit; - beg_bit = _mark_bitmap.find_obj_beg(tmp_bit, last_bit); - assert(beg_bit == last_bit, "beg bit set outside heap"); - beg_bit = _mark_bitmap.find_obj_end(tmp_bit, last_bit); - assert(beg_bit == last_bit, "end bit set outside heap"); - } - } - } while (beg_bit < last_bit); -} -// XXX end - verification code; only works while we also mark in object headers - #ifndef PRODUCT const char* PSParallelCompact::space_names[] = { "perm", "old ", "eden", "from", "to " @@ -1584,11 +1497,6 @@ void PSParallelCompact::summary_phase(ParCompactionManager* cm, // trace("2"); #ifdef ASSERT - if (VerifyParallelOldWithMarkSweep && - (PSParallelCompact::total_invocations() % - VerifyParallelOldWithMarkSweepInterval) == 0) { - verify_mark_bitmap(_mark_bitmap); - } if (TraceParallelOldGCMarkingPhase) { tty->print_cr("add_obj_count=" SIZE_FORMAT " " "add_obj_bytes=" SIZE_FORMAT, @@ -2038,39 +1946,9 @@ void PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) { } #endif // #ifndef PRODUCT -#ifdef ASSERT - if (VerifyParallelOldWithMarkSweep && - (PSParallelCompact::total_invocations() % - VerifyParallelOldWithMarkSweepInterval) == 0) { - gclog_or_tty->print_cr("Verify marking with mark_sweep_phase1()"); - if (PrintGCDetails && Verbose) { - gclog_or_tty->print_cr("mark_sweep_phase1:"); - } - // Clear the discovered lists so that discovered objects - // don't look like they have been discovered twice. - ref_processor()->clear_discovered_references(); - - PSMarkSweep::allocate_stacks(); - MemRegion mr = Universe::heap()->reserved_region(); - PSMarkSweep::ref_processor()->enable_discovery(); - PSMarkSweep::mark_sweep_phase1(maximum_heap_compaction); - } -#endif - bool max_on_system_gc = UseMaximumCompactionOnSystemGC && is_system_gc; summary_phase(vmthread_cm, maximum_heap_compaction || max_on_system_gc); -#ifdef ASSERT - if (VerifyParallelOldWithMarkSweep && - (PSParallelCompact::total_invocations() % - VerifyParallelOldWithMarkSweepInterval) == 0) { - if (PrintGCDetails && Verbose) { - gclog_or_tty->print_cr("mark_sweep_phase2:"); - } - PSMarkSweep::mark_sweep_phase2(); - } -#endif - COMPILER2_PRESENT(assert(DerivedPointerTable::is_active(), "Sanity")); COMPILER2_PRESENT(DerivedPointerTable::set_active(false)); @@ -2078,28 +1956,6 @@ void PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) { // needed by the compaction for filling holes in the dense prefix. adjust_roots(); -#ifdef ASSERT - if (VerifyParallelOldWithMarkSweep && - (PSParallelCompact::total_invocations() % - VerifyParallelOldWithMarkSweepInterval) == 0) { - // Do a separate verify phase so that the verify - // code can use the the forwarding pointers to - // check the new pointer calculation. The restore_marks() - // has to be done before the real compact. - vmthread_cm->set_action(ParCompactionManager::VerifyUpdate); - compact_perm(vmthread_cm); - compact_serial(vmthread_cm); - vmthread_cm->set_action(ParCompactionManager::ResetObjects); - compact_perm(vmthread_cm); - compact_serial(vmthread_cm); - vmthread_cm->set_action(ParCompactionManager::UpdateAndCopy); - - // For debugging only - PSMarkSweep::restore_marks(); - PSMarkSweep::deallocate_stacks(); - } -#endif - compaction_start.update(); // Does the perm gen always have to be done serially because // klasses are used in the update of an object? diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPermGen.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPermGen.cpp index 53b3010ecee..5fd5f5539d1 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPermGen.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPermGen.cpp @@ -123,8 +123,6 @@ void PSPermGen::move_and_update(ParCompactionManager* cm) { void PSPermGen::precompact() { // Reset start array first. - debug_only(if (!UseParallelOldGC || !VerifyParallelOldWithMarkSweep) {) _start_array.reset(); - debug_only(}) object_mark_sweep()->precompact(); } diff --git a/hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp b/hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp index fdcf48db842..7596433cc27 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp +++ b/hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp @@ -23,13 +23,6 @@ */ inline void MarkSweep::mark_object(oop obj) { -#ifndef SERIALGC - if (UseParallelOldGC && VerifyParallelOldWithMarkSweep) { - assert(PSParallelCompact::mark_bitmap()->is_marked(obj), - "Should be marked in the marking bitmap"); - } -#endif // SERIALGC - // some marks may contain information we need to preserve so we store them away // and overwrite the mark. We'll restore it at the end of markSweep. markOop mark = obj->mark(); diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index c6549c1fd3b..f07dbd15332 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -1189,13 +1189,6 @@ class CommandLineFlags { product(uintx, ParallelCMSThreads, 0, \ "Max number of threads CMS will use for concurrent work") \ \ - develop(bool, VerifyParallelOldWithMarkSweep, false, \ - "Use the MarkSweep code to verify phases of Parallel Old") \ - \ - develop(uintx, VerifyParallelOldWithMarkSweepInterval, 1, \ - "Interval at which the MarkSweep code is used to verify " \ - "phases of Parallel Old") \ - \ develop(bool, ParallelOldMTUnsafeMarkBitMap, false, \ "Use the Parallel Old MT unsafe in marking the bitmap") \ \ From d40b6daac9a275b9f19763e60e48d70c7ba1bfa2 Mon Sep 17 00:00:00 2001 From: Tom Rodriguez Date: Tue, 30 Sep 2008 11:56:01 -0700 Subject: [PATCH 023/267] 6753795: HotSpot crash in strlen() when JVMTI is used Test for null instead of strlen Reviewed-by: rasbold --- hotspot/src/share/vm/prims/jvmtiEnvBase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hotspot/src/share/vm/prims/jvmtiEnvBase.cpp b/hotspot/src/share/vm/prims/jvmtiEnvBase.cpp index 62591145feb..cae4a6a76d5 100644 --- a/hotspot/src/share/vm/prims/jvmtiEnvBase.cpp +++ b/hotspot/src/share/vm/prims/jvmtiEnvBase.cpp @@ -121,7 +121,7 @@ JvmtiEnvBase::JvmtiEnvBase() : _env_event_enable() { JvmtiEventController::env_initialize((JvmtiEnv*)this); #ifdef JVMTI_TRACE - _jvmti_external.functions = strlen(TraceJVMTI)? &jvmtiTrace_Interface : &jvmti_Interface; + _jvmti_external.functions = TraceJVMTI != NULL ? &jvmtiTrace_Interface : &jvmti_Interface; #else _jvmti_external.functions = &jvmti_Interface; #endif From f2851186bbf1a4269f36f03517c4606d127d35a0 Mon Sep 17 00:00:00 2001 From: John Coomes Date: Tue, 30 Sep 2008 12:20:22 -0700 Subject: [PATCH 024/267] 6725697: par compact - rename class ChunkData to RegionData Reviewed-by: iveresov, tonyp --- .../parallelScavenge/pcTasks.cpp | 41 +- .../parallelScavenge/pcTasks.hpp | 22 +- .../parallelScavenge/psCompactionManager.cpp | 96 +- .../parallelScavenge/psCompactionManager.hpp | 69 +- .../parallelScavenge/psParallelCompact.cpp | 1230 +++++++++-------- .../parallelScavenge/psParallelCompact.hpp | 539 ++++---- hotspot/src/share/vm/runtime/globals.hpp | 10 +- hotspot/src/share/vm/utilities/taskqueue.cpp | 54 +- hotspot/src/share/vm/utilities/taskqueue.hpp | 28 +- 9 files changed, 1049 insertions(+), 1040 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp index 2237542f523..7a3ebaf9fd3 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp @@ -146,7 +146,7 @@ void RefProcTaskExecutor::execute(ProcessTask& task) { ParallelScavengeHeap* heap = PSParallelCompact::gc_heap(); uint parallel_gc_threads = heap->gc_task_manager()->workers(); - ChunkTaskQueueSet* qset = ParCompactionManager::chunk_array(); + RegionTaskQueueSet* qset = ParCompactionManager::region_array(); ParallelTaskTerminator terminator(parallel_gc_threads, qset); GCTaskQueue* q = GCTaskQueue::create(); for(uint i=0; iis_gc_active(), "called outside gc"); - NOT_PRODUCT(TraceTime tm("StealChunkCompactionTask", + NOT_PRODUCT(TraceTime tm("StealRegionCompactionTask", PrintGCDetails && TraceParallelOldGCTasks, true, gclog_or_tty)); ParCompactionManager* cm = ParCompactionManager::gc_thread_compaction_manager(which); - // Has to drain stacks first because there may be chunks on + // Has to drain stacks first because there may be regions on // preloaded onto the stack and this thread may never have // done a draining task. Are the draining tasks needed? - cm->drain_chunk_stacks(); + cm->drain_region_stacks(); - size_t chunk_index = 0; + size_t region_index = 0; int random_seed = 17; // If we're the termination task, try 10 rounds of stealing before // setting the termination flag while(true) { - if (ParCompactionManager::steal(which, &random_seed, chunk_index)) { - PSParallelCompact::fill_and_update_chunk(cm, chunk_index); - cm->drain_chunk_stacks(); + if (ParCompactionManager::steal(which, &random_seed, region_index)) { + PSParallelCompact::fill_and_update_region(cm, region_index); + cm->drain_region_stacks(); } else { if (terminator()->offer_termination()) { break; @@ -249,11 +249,10 @@ void StealChunkCompactionTask::do_it(GCTaskManager* manager, uint which) { UpdateDensePrefixTask::UpdateDensePrefixTask( PSParallelCompact::SpaceId space_id, - size_t chunk_index_start, - size_t chunk_index_end) : - _space_id(space_id), _chunk_index_start(chunk_index_start), - _chunk_index_end(chunk_index_end) -{} + size_t region_index_start, + size_t region_index_end) : + _space_id(space_id), _region_index_start(region_index_start), + _region_index_end(region_index_end) {} void UpdateDensePrefixTask::do_it(GCTaskManager* manager, uint which) { @@ -265,8 +264,8 @@ void UpdateDensePrefixTask::do_it(GCTaskManager* manager, uint which) { PSParallelCompact::update_and_deadwood_in_dense_prefix(cm, _space_id, - _chunk_index_start, - _chunk_index_end); + _region_index_start, + _region_index_end); } void DrainStacksCompactionTask::do_it(GCTaskManager* manager, uint which) { @@ -278,6 +277,6 @@ void DrainStacksCompactionTask::do_it(GCTaskManager* manager, uint which) { ParCompactionManager* cm = ParCompactionManager::gc_thread_compaction_manager(which); - // Process any chunks already in the compaction managers stacks. - cm->drain_chunk_stacks(); + // Process any regions already in the compaction managers stacks. + cm->drain_region_stacks(); } diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.hpp index 69b23ac5b3c..f41b77c3d04 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.hpp @@ -188,18 +188,18 @@ class StealMarkingTask : public GCTask { }; // -// StealChunkCompactionTask +// StealRegionCompactionTask // // This task is used to distribute work to idle threads. // -class StealChunkCompactionTask : public GCTask { +class StealRegionCompactionTask : public GCTask { private: ParallelTaskTerminator* const _terminator; public: - StealChunkCompactionTask(ParallelTaskTerminator* t); + StealRegionCompactionTask(ParallelTaskTerminator* t); - char* name() { return (char *)"steal-chunk-task"; } + char* name() { return (char *)"steal-region-task"; } ParallelTaskTerminator* terminator() { return _terminator; } virtual void do_it(GCTaskManager* manager, uint which); @@ -215,15 +215,15 @@ class StealChunkCompactionTask : public GCTask { class UpdateDensePrefixTask : public GCTask { private: PSParallelCompact::SpaceId _space_id; - size_t _chunk_index_start; - size_t _chunk_index_end; + size_t _region_index_start; + size_t _region_index_end; public: char* name() { return (char *)"update-dense_prefix-task"; } UpdateDensePrefixTask(PSParallelCompact::SpaceId space_id, - size_t chunk_index_start, - size_t chunk_index_end); + size_t region_index_start, + size_t region_index_end); virtual void do_it(GCTaskManager* manager, uint which); }; @@ -231,17 +231,17 @@ class UpdateDensePrefixTask : public GCTask { // // DrainStacksCompactionTask // -// This task processes chunks that have been added to the stacks of each +// This task processes regions that have been added to the stacks of each // compaction manager. // // Trying to use one draining thread does not work because there are no // guarantees about which task will be picked up by which thread. For example, -// if thread A gets all the preloaded chunks, thread A may not get a draining +// if thread A gets all the preloaded regions, thread A may not get a draining // task (they may all be done by other threads). // class DrainStacksCompactionTask : public GCTask { public: - char* name() { return (char *)"drain-chunk-task"; } + char* name() { return (char *)"drain-region-task"; } virtual void do_it(GCTaskManager* manager, uint which); }; diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp index ba3684a1977..651cd420f26 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp @@ -30,7 +30,7 @@ ParCompactionManager** ParCompactionManager::_manager_array = NULL; OopTaskQueueSet* ParCompactionManager::_stack_array = NULL; ObjectStartArray* ParCompactionManager::_start_array = NULL; ParMarkBitMap* ParCompactionManager::_mark_bitmap = NULL; -ChunkTaskQueueSet* ParCompactionManager::_chunk_array = NULL; +RegionTaskQueueSet* ParCompactionManager::_region_array = NULL; ParCompactionManager::ParCompactionManager() : _action(CopyAndUpdate) { @@ -46,13 +46,13 @@ ParCompactionManager::ParCompactionManager() : // We want the overflow stack to be permanent _overflow_stack = new (ResourceObj::C_HEAP) GrowableArray(10, true); -#ifdef USE_ChunkTaskQueueWithOverflow - chunk_stack()->initialize(); +#ifdef USE_RegionTaskQueueWithOverflow + region_stack()->initialize(); #else - chunk_stack()->initialize(); + region_stack()->initialize(); // We want the overflow stack to be permanent - _chunk_overflow_stack = + _region_overflow_stack = new (ResourceObj::C_HEAP) GrowableArray(10, true); #endif @@ -86,18 +86,18 @@ void ParCompactionManager::initialize(ParMarkBitMap* mbm) { _stack_array = new OopTaskQueueSet(parallel_gc_threads); guarantee(_stack_array != NULL, "Count not initialize promotion manager"); - _chunk_array = new ChunkTaskQueueSet(parallel_gc_threads); - guarantee(_chunk_array != NULL, "Count not initialize promotion manager"); + _region_array = new RegionTaskQueueSet(parallel_gc_threads); + guarantee(_region_array != NULL, "Count not initialize promotion manager"); // Create and register the ParCompactionManager(s) for the worker threads. for(uint i=0; iregister_queue(i, _manager_array[i]->marking_stack()); -#ifdef USE_ChunkTaskQueueWithOverflow - chunk_array()->register_queue(i, _manager_array[i]->chunk_stack()->task_queue()); +#ifdef USE_RegionTaskQueueWithOverflow + region_array()->register_queue(i, _manager_array[i]->region_stack()->task_queue()); #else - chunk_array()->register_queue(i, _manager_array[i]->chunk_stack()); + region_array()->register_queue(i, _manager_array[i]->region_stack()); #endif } @@ -153,31 +153,31 @@ oop ParCompactionManager::retrieve_for_scanning() { return NULL; } -// Save chunk on a stack -void ParCompactionManager::save_for_processing(size_t chunk_index) { +// Save region on a stack +void ParCompactionManager::save_for_processing(size_t region_index) { #ifdef ASSERT const ParallelCompactData& sd = PSParallelCompact::summary_data(); - ParallelCompactData::ChunkData* const chunk_ptr = sd.chunk(chunk_index); - assert(chunk_ptr->claimed(), "must be claimed"); - assert(chunk_ptr->_pushed++ == 0, "should only be pushed once"); + ParallelCompactData::RegionData* const region_ptr = sd.region(region_index); + assert(region_ptr->claimed(), "must be claimed"); + assert(region_ptr->_pushed++ == 0, "should only be pushed once"); #endif - chunk_stack_push(chunk_index); + region_stack_push(region_index); } -void ParCompactionManager::chunk_stack_push(size_t chunk_index) { +void ParCompactionManager::region_stack_push(size_t region_index) { -#ifdef USE_ChunkTaskQueueWithOverflow - chunk_stack()->save(chunk_index); +#ifdef USE_RegionTaskQueueWithOverflow + region_stack()->save(region_index); #else - if(!chunk_stack()->push(chunk_index)) { - chunk_overflow_stack()->push(chunk_index); + if(!region_stack()->push(region_index)) { + region_overflow_stack()->push(region_index); } #endif } -bool ParCompactionManager::retrieve_for_processing(size_t& chunk_index) { -#ifdef USE_ChunkTaskQueueWithOverflow - return chunk_stack()->retrieve(chunk_index); +bool ParCompactionManager::retrieve_for_processing(size_t& region_index) { +#ifdef USE_RegionTaskQueueWithOverflow + return region_stack()->retrieve(region_index); #else // Should not be used in the parallel case ShouldNotReachHere(); @@ -230,14 +230,14 @@ void ParCompactionManager::drain_marking_stacks(OopClosure* blk) { assert(overflow_stack()->length() == 0, "Sanity"); } -void ParCompactionManager::drain_chunk_overflow_stack() { - size_t chunk_index = (size_t) -1; - while(chunk_stack()->retrieve_from_overflow(chunk_index)) { - PSParallelCompact::fill_and_update_chunk(this, chunk_index); +void ParCompactionManager::drain_region_overflow_stack() { + size_t region_index = (size_t) -1; + while(region_stack()->retrieve_from_overflow(region_index)) { + PSParallelCompact::fill_and_update_region(this, region_index); } } -void ParCompactionManager::drain_chunk_stacks() { +void ParCompactionManager::drain_region_stacks() { #ifdef ASSERT ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap(); assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity"); @@ -249,42 +249,42 @@ void ParCompactionManager::drain_chunk_stacks() { #if 1 // def DO_PARALLEL - the serial code hasn't been updated do { -#ifdef USE_ChunkTaskQueueWithOverflow +#ifdef USE_RegionTaskQueueWithOverflow // Drain overflow stack first, so other threads can steal from // claimed stack while we work. - size_t chunk_index = (size_t) -1; - while(chunk_stack()->retrieve_from_overflow(chunk_index)) { - PSParallelCompact::fill_and_update_chunk(this, chunk_index); + size_t region_index = (size_t) -1; + while(region_stack()->retrieve_from_overflow(region_index)) { + PSParallelCompact::fill_and_update_region(this, region_index); } - while (chunk_stack()->retrieve_from_stealable_queue(chunk_index)) { - PSParallelCompact::fill_and_update_chunk(this, chunk_index); + while (region_stack()->retrieve_from_stealable_queue(region_index)) { + PSParallelCompact::fill_and_update_region(this, region_index); } - } while (!chunk_stack()->is_empty()); + } while (!region_stack()->is_empty()); #else // Drain overflow stack first, so other threads can steal from // claimed stack while we work. - while(!chunk_overflow_stack()->is_empty()) { - size_t chunk_index = chunk_overflow_stack()->pop(); - PSParallelCompact::fill_and_update_chunk(this, chunk_index); + while(!region_overflow_stack()->is_empty()) { + size_t region_index = region_overflow_stack()->pop(); + PSParallelCompact::fill_and_update_region(this, region_index); } - size_t chunk_index = -1; + size_t region_index = -1; // obj is a reference!!! - while (chunk_stack()->pop_local(chunk_index)) { + while (region_stack()->pop_local(region_index)) { // It would be nice to assert about the type of objects we might // pop, but they can come from anywhere, unfortunately. - PSParallelCompact::fill_and_update_chunk(this, chunk_index); + PSParallelCompact::fill_and_update_region(this, region_index); } - } while((chunk_stack()->size() != 0) || - (chunk_overflow_stack()->length() != 0)); + } while((region_stack()->size() != 0) || + (region_overflow_stack()->length() != 0)); #endif -#ifdef USE_ChunkTaskQueueWithOverflow - assert(chunk_stack()->is_empty(), "Sanity"); +#ifdef USE_RegionTaskQueueWithOverflow + assert(region_stack()->is_empty(), "Sanity"); #else - assert(chunk_stack()->size() == 0, "Sanity"); - assert(chunk_overflow_stack()->length() == 0, "Sanity"); + assert(region_stack()->size() == 0, "Sanity"); + assert(region_overflow_stack()->length() == 0, "Sanity"); #endif #else oop obj; diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.hpp index d09266c5434..68268d39d34 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.hpp @@ -52,7 +52,7 @@ class ParCompactionManager : public CHeapObj { friend class ParallelTaskTerminator; friend class ParMarkBitMap; friend class PSParallelCompact; - friend class StealChunkCompactionTask; + friend class StealRegionCompactionTask; friend class UpdateAndFillClosure; friend class RefProcTaskExecutor; @@ -72,27 +72,27 @@ class ParCompactionManager : public CHeapObj { // ------------------------ End don't putback if not needed private: - static ParCompactionManager** _manager_array; - static OopTaskQueueSet* _stack_array; - static ObjectStartArray* _start_array; - static ChunkTaskQueueSet* _chunk_array; - static PSOldGen* _old_gen; + static ParCompactionManager** _manager_array; + static OopTaskQueueSet* _stack_array; + static ObjectStartArray* _start_array; + static RegionTaskQueueSet* _region_array; + static PSOldGen* _old_gen; - OopTaskQueue _marking_stack; - GrowableArray* _overflow_stack; + OopTaskQueue _marking_stack; + GrowableArray* _overflow_stack; // Is there a way to reuse the _marking_stack for the - // saving empty chunks? For now just create a different + // saving empty regions? For now just create a different // type of TaskQueue. -#ifdef USE_ChunkTaskQueueWithOverflow - ChunkTaskQueueWithOverflow _chunk_stack; +#ifdef USE_RegionTaskQueueWithOverflow + RegionTaskQueueWithOverflow _region_stack; #else - ChunkTaskQueue _chunk_stack; - GrowableArray* _chunk_overflow_stack; + RegionTaskQueue _region_stack; + GrowableArray* _region_overflow_stack; #endif #if 1 // does this happen enough to need a per thread stack? - GrowableArray* _revisit_klass_stack; + GrowableArray* _revisit_klass_stack; #endif static ParMarkBitMap* _mark_bitmap; @@ -100,21 +100,22 @@ class ParCompactionManager : public CHeapObj { static PSOldGen* old_gen() { return _old_gen; } static ObjectStartArray* start_array() { return _start_array; } - static OopTaskQueueSet* stack_array() { return _stack_array; } + static OopTaskQueueSet* stack_array() { return _stack_array; } static void initialize(ParMarkBitMap* mbm); protected: // Array of tasks. Needed by the ParallelTaskTerminator. - static ChunkTaskQueueSet* chunk_array() { return _chunk_array; } - - OopTaskQueue* marking_stack() { return &_marking_stack; } - GrowableArray* overflow_stack() { return _overflow_stack; } -#ifdef USE_ChunkTaskQueueWithOverflow - ChunkTaskQueueWithOverflow* chunk_stack() { return &_chunk_stack; } + static RegionTaskQueueSet* region_array() { return _region_array; } + OopTaskQueue* marking_stack() { return &_marking_stack; } + GrowableArray* overflow_stack() { return _overflow_stack; } +#ifdef USE_RegionTaskQueueWithOverflow + RegionTaskQueueWithOverflow* region_stack() { return &_region_stack; } #else - ChunkTaskQueue* chunk_stack() { return &_chunk_stack; } - GrowableArray* chunk_overflow_stack() { return _chunk_overflow_stack; } + RegionTaskQueue* region_stack() { return &_region_stack; } + GrowableArray* region_overflow_stack() { + return _region_overflow_stack; + } #endif // Pushes onto the marking stack. If the marking stack is full, @@ -123,9 +124,9 @@ class ParCompactionManager : public CHeapObj { // Do not implement an equivalent stack_pop. Deal with the // marking stack and overflow stack directly. - // Pushes onto the chunk stack. If the chunk stack is full, - // pushes onto the chunk overflow stack. - void chunk_stack_push(size_t chunk_index); + // Pushes onto the region stack. If the region stack is full, + // pushes onto the region overflow stack. + void region_stack_push(size_t region_index); public: Action action() { return _action; } @@ -160,10 +161,10 @@ class ParCompactionManager : public CHeapObj { // Get a oop for scanning. If returns null, no oop were found. oop retrieve_for_scanning(); - // Save chunk for later processing. Must not fail. - void save_for_processing(size_t chunk_index); - // Get a chunk for processing. If returns null, no chunk were found. - bool retrieve_for_processing(size_t& chunk_index); + // Save region for later processing. Must not fail. + void save_for_processing(size_t region_index); + // Get a region for processing. If returns null, no region were found. + bool retrieve_for_processing(size_t& region_index); // Access function for compaction managers static ParCompactionManager* gc_thread_compaction_manager(int index); @@ -172,18 +173,18 @@ class ParCompactionManager : public CHeapObj { return stack_array()->steal(queue_num, seed, t); } - static bool steal(int queue_num, int* seed, ChunkTask& t) { - return chunk_array()->steal(queue_num, seed, t); + static bool steal(int queue_num, int* seed, RegionTask& t) { + return region_array()->steal(queue_num, seed, t); } // Process tasks remaining on any stack void drain_marking_stacks(OopClosure *blk); // Process tasks remaining on any stack - void drain_chunk_stacks(); + void drain_region_stacks(); // Process tasks remaining on any stack - void drain_chunk_overflow_stack(); + void drain_region_overflow_stack(); // Debugging support #ifdef ASSERT diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp index fb0d7ec6e2d..c7150478749 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp @@ -28,12 +28,13 @@ #include // All sizes are in HeapWords. -const size_t ParallelCompactData::Log2ChunkSize = 9; // 512 words -const size_t ParallelCompactData::ChunkSize = (size_t)1 << Log2ChunkSize; -const size_t ParallelCompactData::ChunkSizeBytes = ChunkSize << LogHeapWordSize; -const size_t ParallelCompactData::ChunkSizeOffsetMask = ChunkSize - 1; -const size_t ParallelCompactData::ChunkAddrOffsetMask = ChunkSizeBytes - 1; -const size_t ParallelCompactData::ChunkAddrMask = ~ChunkAddrOffsetMask; +const size_t ParallelCompactData::Log2RegionSize = 9; // 512 words +const size_t ParallelCompactData::RegionSize = (size_t)1 << Log2RegionSize; +const size_t ParallelCompactData::RegionSizeBytes = + RegionSize << LogHeapWordSize; +const size_t ParallelCompactData::RegionSizeOffsetMask = RegionSize - 1; +const size_t ParallelCompactData::RegionAddrOffsetMask = RegionSizeBytes - 1; +const size_t ParallelCompactData::RegionAddrMask = ~RegionAddrOffsetMask; // 32-bit: 128 words covers 4 bitmap words // 64-bit: 128 words covers 2 bitmap words @@ -42,25 +43,25 @@ const size_t ParallelCompactData::BlockSize = (size_t)1 << Log2BlockSize; const size_t ParallelCompactData::BlockOffsetMask = BlockSize - 1; const size_t ParallelCompactData::BlockMask = ~BlockOffsetMask; -const size_t ParallelCompactData::BlocksPerChunk = ChunkSize / BlockSize; +const size_t ParallelCompactData::BlocksPerRegion = RegionSize / BlockSize; -const ParallelCompactData::ChunkData::chunk_sz_t -ParallelCompactData::ChunkData::dc_shift = 27; +const ParallelCompactData::RegionData::region_sz_t +ParallelCompactData::RegionData::dc_shift = 27; -const ParallelCompactData::ChunkData::chunk_sz_t -ParallelCompactData::ChunkData::dc_mask = ~0U << dc_shift; +const ParallelCompactData::RegionData::region_sz_t +ParallelCompactData::RegionData::dc_mask = ~0U << dc_shift; -const ParallelCompactData::ChunkData::chunk_sz_t -ParallelCompactData::ChunkData::dc_one = 0x1U << dc_shift; +const ParallelCompactData::RegionData::region_sz_t +ParallelCompactData::RegionData::dc_one = 0x1U << dc_shift; -const ParallelCompactData::ChunkData::chunk_sz_t -ParallelCompactData::ChunkData::los_mask = ~dc_mask; +const ParallelCompactData::RegionData::region_sz_t +ParallelCompactData::RegionData::los_mask = ~dc_mask; -const ParallelCompactData::ChunkData::chunk_sz_t -ParallelCompactData::ChunkData::dc_claimed = 0x8U << dc_shift; +const ParallelCompactData::RegionData::region_sz_t +ParallelCompactData::RegionData::dc_claimed = 0x8U << dc_shift; -const ParallelCompactData::ChunkData::chunk_sz_t -ParallelCompactData::ChunkData::dc_completed = 0xcU << dc_shift; +const ParallelCompactData::RegionData::region_sz_t +ParallelCompactData::RegionData::dc_completed = 0xcU << dc_shift; #ifdef ASSERT short ParallelCompactData::BlockData::_cur_phase = 0; @@ -105,7 +106,7 @@ const char* PSParallelCompact::space_names[] = { "perm", "old ", "eden", "from", "to " }; -void PSParallelCompact::print_chunk_ranges() +void PSParallelCompact::print_region_ranges() { tty->print_cr("space bottom top end new_top"); tty->print_cr("------ ---------- ---------- ---------- ----------"); @@ -116,31 +117,31 @@ void PSParallelCompact::print_chunk_ranges() SIZE_FORMAT_W(10) " " SIZE_FORMAT_W(10) " " SIZE_FORMAT_W(10) " " SIZE_FORMAT_W(10) " ", id, space_names[id], - summary_data().addr_to_chunk_idx(space->bottom()), - summary_data().addr_to_chunk_idx(space->top()), - summary_data().addr_to_chunk_idx(space->end()), - summary_data().addr_to_chunk_idx(_space_info[id].new_top())); + summary_data().addr_to_region_idx(space->bottom()), + summary_data().addr_to_region_idx(space->top()), + summary_data().addr_to_region_idx(space->end()), + summary_data().addr_to_region_idx(_space_info[id].new_top())); } } void -print_generic_summary_chunk(size_t i, const ParallelCompactData::ChunkData* c) +print_generic_summary_region(size_t i, const ParallelCompactData::RegionData* c) { -#define CHUNK_IDX_FORMAT SIZE_FORMAT_W(7) -#define CHUNK_DATA_FORMAT SIZE_FORMAT_W(5) +#define REGION_IDX_FORMAT SIZE_FORMAT_W(7) +#define REGION_DATA_FORMAT SIZE_FORMAT_W(5) ParallelCompactData& sd = PSParallelCompact::summary_data(); - size_t dci = c->destination() ? sd.addr_to_chunk_idx(c->destination()) : 0; - tty->print_cr(CHUNK_IDX_FORMAT " " PTR_FORMAT " " - CHUNK_IDX_FORMAT " " PTR_FORMAT " " - CHUNK_DATA_FORMAT " " CHUNK_DATA_FORMAT " " - CHUNK_DATA_FORMAT " " CHUNK_IDX_FORMAT " %d", + size_t dci = c->destination() ? sd.addr_to_region_idx(c->destination()) : 0; + tty->print_cr(REGION_IDX_FORMAT " " PTR_FORMAT " " + REGION_IDX_FORMAT " " PTR_FORMAT " " + REGION_DATA_FORMAT " " REGION_DATA_FORMAT " " + REGION_DATA_FORMAT " " REGION_IDX_FORMAT " %d", i, c->data_location(), dci, c->destination(), c->partial_obj_size(), c->live_obj_size(), - c->data_size(), c->source_chunk(), c->destination_count()); + c->data_size(), c->source_region(), c->destination_count()); -#undef CHUNK_IDX_FORMAT -#undef CHUNK_DATA_FORMAT +#undef REGION_IDX_FORMAT +#undef REGION_DATA_FORMAT } void @@ -149,14 +150,14 @@ print_generic_summary_data(ParallelCompactData& summary_data, HeapWord* const end_addr) { size_t total_words = 0; - size_t i = summary_data.addr_to_chunk_idx(beg_addr); - const size_t last = summary_data.addr_to_chunk_idx(end_addr); + size_t i = summary_data.addr_to_region_idx(beg_addr); + const size_t last = summary_data.addr_to_region_idx(end_addr); HeapWord* pdest = 0; while (i <= last) { - ParallelCompactData::ChunkData* c = summary_data.chunk(i); + ParallelCompactData::RegionData* c = summary_data.region(i); if (c->data_size() != 0 || c->destination() != pdest) { - print_generic_summary_chunk(i, c); + print_generic_summary_region(i, c); total_words += c->data_size(); pdest = c->destination(); } @@ -178,16 +179,16 @@ print_generic_summary_data(ParallelCompactData& summary_data, } void -print_initial_summary_chunk(size_t i, - const ParallelCompactData::ChunkData* c, - bool newline = true) +print_initial_summary_region(size_t i, + const ParallelCompactData::RegionData* c, + bool newline = true) { tty->print(SIZE_FORMAT_W(5) " " PTR_FORMAT " " SIZE_FORMAT_W(5) " " SIZE_FORMAT_W(5) " " SIZE_FORMAT_W(5) " " SIZE_FORMAT_W(5) " %d", i, c->destination(), c->partial_obj_size(), c->live_obj_size(), - c->data_size(), c->source_chunk(), c->destination_count()); + c->data_size(), c->source_region(), c->destination_count()); if (newline) tty->cr(); } @@ -198,47 +199,48 @@ print_initial_summary_data(ParallelCompactData& summary_data, return; } - const size_t chunk_size = ParallelCompactData::ChunkSize; - HeapWord* const top_aligned_up = summary_data.chunk_align_up(space->top()); - const size_t end_chunk = summary_data.addr_to_chunk_idx(top_aligned_up); - const ParallelCompactData::ChunkData* c = summary_data.chunk(end_chunk - 1); + const size_t region_size = ParallelCompactData::RegionSize; + typedef ParallelCompactData::RegionData RegionData; + HeapWord* const top_aligned_up = summary_data.region_align_up(space->top()); + const size_t end_region = summary_data.addr_to_region_idx(top_aligned_up); + const RegionData* c = summary_data.region(end_region - 1); HeapWord* end_addr = c->destination() + c->data_size(); const size_t live_in_space = pointer_delta(end_addr, space->bottom()); - // Print (and count) the full chunks at the beginning of the space. - size_t full_chunk_count = 0; - size_t i = summary_data.addr_to_chunk_idx(space->bottom()); - while (i < end_chunk && summary_data.chunk(i)->data_size() == chunk_size) { - print_initial_summary_chunk(i, summary_data.chunk(i)); - ++full_chunk_count; + // Print (and count) the full regions at the beginning of the space. + size_t full_region_count = 0; + size_t i = summary_data.addr_to_region_idx(space->bottom()); + while (i < end_region && summary_data.region(i)->data_size() == region_size) { + print_initial_summary_region(i, summary_data.region(i)); + ++full_region_count; ++i; } - size_t live_to_right = live_in_space - full_chunk_count * chunk_size; + size_t live_to_right = live_in_space - full_region_count * region_size; double max_reclaimed_ratio = 0.0; - size_t max_reclaimed_ratio_chunk = 0; + size_t max_reclaimed_ratio_region = 0; size_t max_dead_to_right = 0; size_t max_live_to_right = 0; - // Print the 'reclaimed ratio' for chunks while there is something live in the - // chunk or to the right of it. The remaining chunks are empty (and + // Print the 'reclaimed ratio' for regions while there is something live in + // the region or to the right of it. The remaining regions are empty (and // uninteresting), and computing the ratio will result in division by 0. - while (i < end_chunk && live_to_right > 0) { - c = summary_data.chunk(i); - HeapWord* const chunk_addr = summary_data.chunk_to_addr(i); - const size_t used_to_right = pointer_delta(space->top(), chunk_addr); + while (i < end_region && live_to_right > 0) { + c = summary_data.region(i); + HeapWord* const region_addr = summary_data.region_to_addr(i); + const size_t used_to_right = pointer_delta(space->top(), region_addr); const size_t dead_to_right = used_to_right - live_to_right; const double reclaimed_ratio = double(dead_to_right) / live_to_right; if (reclaimed_ratio > max_reclaimed_ratio) { max_reclaimed_ratio = reclaimed_ratio; - max_reclaimed_ratio_chunk = i; + max_reclaimed_ratio_region = i; max_dead_to_right = dead_to_right; max_live_to_right = live_to_right; } - print_initial_summary_chunk(i, c, false); + print_initial_summary_region(i, c, false); tty->print_cr(" %12.10f " SIZE_FORMAT_W(10) " " SIZE_FORMAT_W(10), reclaimed_ratio, dead_to_right, live_to_right); @@ -246,14 +248,14 @@ print_initial_summary_data(ParallelCompactData& summary_data, ++i; } - // Any remaining chunks are empty. Print one more if there is one. - if (i < end_chunk) { - print_initial_summary_chunk(i, summary_data.chunk(i)); + // Any remaining regions are empty. Print one more if there is one. + if (i < end_region) { + print_initial_summary_region(i, summary_data.region(i)); } tty->print_cr("max: " SIZE_FORMAT_W(4) " d2r=" SIZE_FORMAT_W(10) " " "l2r=" SIZE_FORMAT_W(10) " max_ratio=%14.12f", - max_reclaimed_ratio_chunk, max_dead_to_right, + max_reclaimed_ratio_region, max_dead_to_right, max_live_to_right, max_reclaimed_ratio); } @@ -285,9 +287,9 @@ ParallelCompactData::ParallelCompactData() { _region_start = 0; - _chunk_vspace = 0; - _chunk_data = 0; - _chunk_count = 0; + _region_vspace = 0; + _region_data = 0; + _region_count = 0; _block_vspace = 0; _block_data = 0; @@ -300,16 +302,16 @@ bool ParallelCompactData::initialize(MemRegion covered_region) const size_t region_size = covered_region.word_size(); DEBUG_ONLY(_region_end = _region_start + region_size;) - assert(chunk_align_down(_region_start) == _region_start, + assert(region_align_down(_region_start) == _region_start, "region start not aligned"); - assert((region_size & ChunkSizeOffsetMask) == 0, - "region size not a multiple of ChunkSize"); + assert((region_size & RegionSizeOffsetMask) == 0, + "region size not a multiple of RegionSize"); - bool result = initialize_chunk_data(region_size); + bool result = initialize_region_data(region_size); // Initialize the block data if it will be used for updating pointers, or if // this is a debug build. - if (!UseParallelOldGCChunkPointerCalc || trueInDebug) { + if (!UseParallelOldGCRegionPointerCalc || trueInDebug) { result = result && initialize_block_data(region_size); } @@ -342,13 +344,13 @@ ParallelCompactData::create_vspace(size_t count, size_t element_size) return 0; } -bool ParallelCompactData::initialize_chunk_data(size_t region_size) +bool ParallelCompactData::initialize_region_data(size_t region_size) { - const size_t count = (region_size + ChunkSizeOffsetMask) >> Log2ChunkSize; - _chunk_vspace = create_vspace(count, sizeof(ChunkData)); - if (_chunk_vspace != 0) { - _chunk_data = (ChunkData*)_chunk_vspace->reserved_low_addr(); - _chunk_count = count; + const size_t count = (region_size + RegionSizeOffsetMask) >> Log2RegionSize; + _region_vspace = create_vspace(count, sizeof(RegionData)); + if (_region_vspace != 0) { + _region_data = (RegionData*)_region_vspace->reserved_low_addr(); + _region_count = count; return true; } return false; @@ -371,35 +373,35 @@ void ParallelCompactData::clear() if (_block_data) { memset(_block_data, 0, _block_vspace->committed_size()); } - memset(_chunk_data, 0, _chunk_vspace->committed_size()); + memset(_region_data, 0, _region_vspace->committed_size()); } -void ParallelCompactData::clear_range(size_t beg_chunk, size_t end_chunk) { - assert(beg_chunk <= _chunk_count, "beg_chunk out of range"); - assert(end_chunk <= _chunk_count, "end_chunk out of range"); - assert(ChunkSize % BlockSize == 0, "ChunkSize not a multiple of BlockSize"); +void ParallelCompactData::clear_range(size_t beg_region, size_t end_region) { + assert(beg_region <= _region_count, "beg_region out of range"); + assert(end_region <= _region_count, "end_region out of range"); + assert(RegionSize % BlockSize == 0, "RegionSize not a multiple of BlockSize"); - const size_t chunk_cnt = end_chunk - beg_chunk; + const size_t region_cnt = end_region - beg_region; if (_block_data) { - const size_t blocks_per_chunk = ChunkSize / BlockSize; - const size_t beg_block = beg_chunk * blocks_per_chunk; - const size_t block_cnt = chunk_cnt * blocks_per_chunk; + const size_t blocks_per_region = RegionSize / BlockSize; + const size_t beg_block = beg_region * blocks_per_region; + const size_t block_cnt = region_cnt * blocks_per_region; memset(_block_data + beg_block, 0, block_cnt * sizeof(BlockData)); } - memset(_chunk_data + beg_chunk, 0, chunk_cnt * sizeof(ChunkData)); + memset(_region_data + beg_region, 0, region_cnt * sizeof(RegionData)); } -HeapWord* ParallelCompactData::partial_obj_end(size_t chunk_idx) const +HeapWord* ParallelCompactData::partial_obj_end(size_t region_idx) const { - const ChunkData* cur_cp = chunk(chunk_idx); - const ChunkData* const end_cp = chunk(chunk_count() - 1); + const RegionData* cur_cp = region(region_idx); + const RegionData* const end_cp = region(region_count() - 1); - HeapWord* result = chunk_to_addr(chunk_idx); + HeapWord* result = region_to_addr(region_idx); if (cur_cp < end_cp) { do { result += cur_cp->partial_obj_size(); - } while (cur_cp->partial_obj_size() == ChunkSize && ++cur_cp < end_cp); + } while (cur_cp->partial_obj_size() == RegionSize && ++cur_cp < end_cp); } return result; } @@ -407,56 +409,56 @@ HeapWord* ParallelCompactData::partial_obj_end(size_t chunk_idx) const void ParallelCompactData::add_obj(HeapWord* addr, size_t len) { const size_t obj_ofs = pointer_delta(addr, _region_start); - const size_t beg_chunk = obj_ofs >> Log2ChunkSize; - const size_t end_chunk = (obj_ofs + len - 1) >> Log2ChunkSize; + const size_t beg_region = obj_ofs >> Log2RegionSize; + const size_t end_region = (obj_ofs + len - 1) >> Log2RegionSize; DEBUG_ONLY(Atomic::inc_ptr(&add_obj_count);) DEBUG_ONLY(Atomic::add_ptr(len, &add_obj_size);) - if (beg_chunk == end_chunk) { - // All in one chunk. - _chunk_data[beg_chunk].add_live_obj(len); + if (beg_region == end_region) { + // All in one region. + _region_data[beg_region].add_live_obj(len); return; } - // First chunk. - const size_t beg_ofs = chunk_offset(addr); - _chunk_data[beg_chunk].add_live_obj(ChunkSize - beg_ofs); + // First region. + const size_t beg_ofs = region_offset(addr); + _region_data[beg_region].add_live_obj(RegionSize - beg_ofs); klassOop klass = ((oop)addr)->klass(); - // Middle chunks--completely spanned by this object. - for (size_t chunk = beg_chunk + 1; chunk < end_chunk; ++chunk) { - _chunk_data[chunk].set_partial_obj_size(ChunkSize); - _chunk_data[chunk].set_partial_obj_addr(addr); + // Middle regions--completely spanned by this object. + for (size_t region = beg_region + 1; region < end_region; ++region) { + _region_data[region].set_partial_obj_size(RegionSize); + _region_data[region].set_partial_obj_addr(addr); } - // Last chunk. - const size_t end_ofs = chunk_offset(addr + len - 1); - _chunk_data[end_chunk].set_partial_obj_size(end_ofs + 1); - _chunk_data[end_chunk].set_partial_obj_addr(addr); + // Last region. + const size_t end_ofs = region_offset(addr + len - 1); + _region_data[end_region].set_partial_obj_size(end_ofs + 1); + _region_data[end_region].set_partial_obj_addr(addr); } void ParallelCompactData::summarize_dense_prefix(HeapWord* beg, HeapWord* end) { - assert(chunk_offset(beg) == 0, "not ChunkSize aligned"); - assert(chunk_offset(end) == 0, "not ChunkSize aligned"); + assert(region_offset(beg) == 0, "not RegionSize aligned"); + assert(region_offset(end) == 0, "not RegionSize aligned"); - size_t cur_chunk = addr_to_chunk_idx(beg); - const size_t end_chunk = addr_to_chunk_idx(end); + size_t cur_region = addr_to_region_idx(beg); + const size_t end_region = addr_to_region_idx(end); HeapWord* addr = beg; - while (cur_chunk < end_chunk) { - _chunk_data[cur_chunk].set_destination(addr); - _chunk_data[cur_chunk].set_destination_count(0); - _chunk_data[cur_chunk].set_source_chunk(cur_chunk); - _chunk_data[cur_chunk].set_data_location(addr); + while (cur_region < end_region) { + _region_data[cur_region].set_destination(addr); + _region_data[cur_region].set_destination_count(0); + _region_data[cur_region].set_source_region(cur_region); + _region_data[cur_region].set_data_location(addr); - // Update live_obj_size so the chunk appears completely full. - size_t live_size = ChunkSize - _chunk_data[cur_chunk].partial_obj_size(); - _chunk_data[cur_chunk].set_live_obj_size(live_size); + // Update live_obj_size so the region appears completely full. + size_t live_size = RegionSize - _region_data[cur_region].partial_obj_size(); + _region_data[cur_region].set_live_obj_size(live_size); - ++cur_chunk; - addr += ChunkSize; + ++cur_region; + addr += RegionSize; } } @@ -465,7 +467,7 @@ bool ParallelCompactData::summarize(HeapWord* target_beg, HeapWord* target_end, HeapWord** target_next, HeapWord** source_next) { // This is too strict. - // assert(chunk_offset(source_beg) == 0, "not ChunkSize aligned"); + // assert(region_offset(source_beg) == 0, "not RegionSize aligned"); if (TraceParallelOldGCSummaryPhase) { tty->print_cr("tb=" PTR_FORMAT " te=" PTR_FORMAT " " @@ -477,85 +479,86 @@ bool ParallelCompactData::summarize(HeapWord* target_beg, HeapWord* target_end, source_next != 0 ? *source_next : (HeapWord*) 0); } - size_t cur_chunk = addr_to_chunk_idx(source_beg); - const size_t end_chunk = addr_to_chunk_idx(chunk_align_up(source_end)); + size_t cur_region = addr_to_region_idx(source_beg); + const size_t end_region = addr_to_region_idx(region_align_up(source_end)); HeapWord *dest_addr = target_beg; - while (cur_chunk < end_chunk) { - size_t words = _chunk_data[cur_chunk].data_size(); + while (cur_region < end_region) { + size_t words = _region_data[cur_region].data_size(); #if 1 assert(pointer_delta(target_end, dest_addr) >= words, "source region does not fit into target region"); #else - // XXX - need some work on the corner cases here. If the chunk does not - // fit, then must either make sure any partial_obj from the chunk fits, or - // 'undo' the initial part of the partial_obj that is in the previous chunk. + // XXX - need some work on the corner cases here. If the region does not + // fit, then must either make sure any partial_obj from the region fits, or + // "undo" the initial part of the partial_obj that is in the previous + // region. if (dest_addr + words >= target_end) { // Let the caller know where to continue. *target_next = dest_addr; - *source_next = chunk_to_addr(cur_chunk); + *source_next = region_to_addr(cur_region); return false; } #endif // #if 1 - _chunk_data[cur_chunk].set_destination(dest_addr); + _region_data[cur_region].set_destination(dest_addr); - // Set the destination_count for cur_chunk, and if necessary, update - // source_chunk for a destination chunk. The source_chunk field is updated - // if cur_chunk is the first (left-most) chunk to be copied to a destination - // chunk. + // Set the destination_count for cur_region, and if necessary, update + // source_region for a destination region. The source_region field is + // updated if cur_region is the first (left-most) region to be copied to a + // destination region. // - // The destination_count calculation is a bit subtle. A chunk that has data - // that compacts into itself does not count itself as a destination. This - // maintains the invariant that a zero count means the chunk is available - // and can be claimed and then filled. + // The destination_count calculation is a bit subtle. A region that has + // data that compacts into itself does not count itself as a destination. + // This maintains the invariant that a zero count means the region is + // available and can be claimed and then filled. if (words > 0) { HeapWord* const last_addr = dest_addr + words - 1; - const size_t dest_chunk_1 = addr_to_chunk_idx(dest_addr); - const size_t dest_chunk_2 = addr_to_chunk_idx(last_addr); + const size_t dest_region_1 = addr_to_region_idx(dest_addr); + const size_t dest_region_2 = addr_to_region_idx(last_addr); #if 0 - // Initially assume that the destination chunks will be the same and + // Initially assume that the destination regions will be the same and // adjust the value below if necessary. Under this assumption, if - // cur_chunk == dest_chunk_2, then cur_chunk will be compacted completely - // into itself. - uint destination_count = cur_chunk == dest_chunk_2 ? 0 : 1; - if (dest_chunk_1 != dest_chunk_2) { - // Destination chunks differ; adjust destination_count. + // cur_region == dest_region_2, then cur_region will be compacted + // completely into itself. + uint destination_count = cur_region == dest_region_2 ? 0 : 1; + if (dest_region_1 != dest_region_2) { + // Destination regions differ; adjust destination_count. destination_count += 1; - // Data from cur_chunk will be copied to the start of dest_chunk_2. - _chunk_data[dest_chunk_2].set_source_chunk(cur_chunk); - } else if (chunk_offset(dest_addr) == 0) { - // Data from cur_chunk will be copied to the start of the destination - // chunk. - _chunk_data[dest_chunk_1].set_source_chunk(cur_chunk); + // Data from cur_region will be copied to the start of dest_region_2. + _region_data[dest_region_2].set_source_region(cur_region); + } else if (region_offset(dest_addr) == 0) { + // Data from cur_region will be copied to the start of the destination + // region. + _region_data[dest_region_1].set_source_region(cur_region); } #else - // Initially assume that the destination chunks will be different and + // Initially assume that the destination regions will be different and // adjust the value below if necessary. Under this assumption, if - // cur_chunk == dest_chunk2, then cur_chunk will be compacted partially - // into dest_chunk_1 and partially into itself. - uint destination_count = cur_chunk == dest_chunk_2 ? 1 : 2; - if (dest_chunk_1 != dest_chunk_2) { - // Data from cur_chunk will be copied to the start of dest_chunk_2. - _chunk_data[dest_chunk_2].set_source_chunk(cur_chunk); + // cur_region == dest_region2, then cur_region will be compacted partially + // into dest_region_1 and partially into itself. + uint destination_count = cur_region == dest_region_2 ? 1 : 2; + if (dest_region_1 != dest_region_2) { + // Data from cur_region will be copied to the start of dest_region_2. + _region_data[dest_region_2].set_source_region(cur_region); } else { - // Destination chunks are the same; adjust destination_count. + // Destination regions are the same; adjust destination_count. destination_count -= 1; - if (chunk_offset(dest_addr) == 0) { - // Data from cur_chunk will be copied to the start of the destination - // chunk. - _chunk_data[dest_chunk_1].set_source_chunk(cur_chunk); + if (region_offset(dest_addr) == 0) { + // Data from cur_region will be copied to the start of the destination + // region. + _region_data[dest_region_1].set_source_region(cur_region); } } #endif // #if 0 - _chunk_data[cur_chunk].set_destination_count(destination_count); - _chunk_data[cur_chunk].set_data_location(chunk_to_addr(cur_chunk)); + _region_data[cur_region].set_destination_count(destination_count); + _region_data[cur_region].set_data_location(region_to_addr(cur_region)); dest_addr += words; } - ++cur_chunk; + ++cur_region; } *target_next = dest_addr; @@ -565,8 +568,8 @@ bool ParallelCompactData::summarize(HeapWord* target_beg, HeapWord* target_end, bool ParallelCompactData::partial_obj_ends_in_block(size_t block_index) { HeapWord* block_addr = block_to_addr(block_index); HeapWord* block_end_addr = block_addr + BlockSize; - size_t chunk_index = addr_to_chunk_idx(block_addr); - HeapWord* partial_obj_end_addr = partial_obj_end(chunk_index); + size_t region_index = addr_to_region_idx(block_addr); + HeapWord* partial_obj_end_addr = partial_obj_end(region_index); // An object that ends at the end of the block, ends // in the block (the last word of the object is to @@ -581,8 +584,8 @@ bool ParallelCompactData::partial_obj_ends_in_block(size_t block_index) { HeapWord* ParallelCompactData::calc_new_pointer(HeapWord* addr) { HeapWord* result = NULL; - if (UseParallelOldGCChunkPointerCalc) { - result = chunk_calc_new_pointer(addr); + if (UseParallelOldGCRegionPointerCalc) { + result = region_calc_new_pointer(addr); } else { result = block_calc_new_pointer(addr); } @@ -595,7 +598,7 @@ HeapWord* ParallelCompactData::calc_new_pointer(HeapWord* addr) { // the object is dead. But don't wast the cycles to explicitly check // that it is dead since only live objects should be passed in. -HeapWord* ParallelCompactData::chunk_calc_new_pointer(HeapWord* addr) { +HeapWord* ParallelCompactData::region_calc_new_pointer(HeapWord* addr) { assert(addr != NULL, "Should detect NULL oop earlier"); assert(PSParallelCompact::gc_heap()->is_in(addr), "addr not in heap"); #ifdef ASSERT @@ -605,30 +608,30 @@ HeapWord* ParallelCompactData::chunk_calc_new_pointer(HeapWord* addr) { #endif assert(PSParallelCompact::mark_bitmap()->is_marked(addr), "obj not marked"); - // Chunk covering the object. - size_t chunk_index = addr_to_chunk_idx(addr); - const ChunkData* const chunk_ptr = chunk(chunk_index); - HeapWord* const chunk_addr = chunk_align_down(addr); + // Region covering the object. + size_t region_index = addr_to_region_idx(addr); + const RegionData* const region_ptr = region(region_index); + HeapWord* const region_addr = region_align_down(addr); - assert(addr < chunk_addr + ChunkSize, "Chunk does not cover object"); - assert(addr_to_chunk_ptr(chunk_addr) == chunk_ptr, "sanity check"); + assert(addr < region_addr + RegionSize, "Region does not cover object"); + assert(addr_to_region_ptr(region_addr) == region_ptr, "sanity check"); - HeapWord* result = chunk_ptr->destination(); + HeapWord* result = region_ptr->destination(); - // If all the data in the chunk is live, then the new location of the object - // can be calculated from the destination of the chunk plus the offset of the - // object in the chunk. - if (chunk_ptr->data_size() == ChunkSize) { - result += pointer_delta(addr, chunk_addr); + // If all the data in the region is live, then the new location of the object + // can be calculated from the destination of the region plus the offset of the + // object in the region. + if (region_ptr->data_size() == RegionSize) { + result += pointer_delta(addr, region_addr); return result; } // The new location of the object is - // chunk destination + - // size of the partial object extending onto the chunk + - // sizes of the live objects in the Chunk that are to the left of addr - const size_t partial_obj_size = chunk_ptr->partial_obj_size(); - HeapWord* const search_start = chunk_addr + partial_obj_size; + // region destination + + // size of the partial object extending onto the region + + // sizes of the live objects in the Region that are to the left of addr + const size_t partial_obj_size = region_ptr->partial_obj_size(); + HeapWord* const search_start = region_addr + partial_obj_size; const ParMarkBitMap* bitmap = PSParallelCompact::mark_bitmap(); size_t live_to_left = bitmap->live_words_in_range(search_start, oop(addr)); @@ -648,37 +651,37 @@ HeapWord* ParallelCompactData::block_calc_new_pointer(HeapWord* addr) { #endif assert(PSParallelCompact::mark_bitmap()->is_marked(addr), "obj not marked"); - // Chunk covering the object. - size_t chunk_index = addr_to_chunk_idx(addr); - const ChunkData* const chunk_ptr = chunk(chunk_index); - HeapWord* const chunk_addr = chunk_align_down(addr); + // Region covering the object. + size_t region_index = addr_to_region_idx(addr); + const RegionData* const region_ptr = region(region_index); + HeapWord* const region_addr = region_align_down(addr); - assert(addr < chunk_addr + ChunkSize, "Chunk does not cover object"); - assert(addr_to_chunk_ptr(chunk_addr) == chunk_ptr, "sanity check"); + assert(addr < region_addr + RegionSize, "Region does not cover object"); + assert(addr_to_region_ptr(region_addr) == region_ptr, "sanity check"); - HeapWord* result = chunk_ptr->destination(); + HeapWord* result = region_ptr->destination(); - // If all the data in the chunk is live, then the new location of the object - // can be calculated from the destination of the chunk plus the offset of the - // object in the chunk. - if (chunk_ptr->data_size() == ChunkSize) { - result += pointer_delta(addr, chunk_addr); + // If all the data in the region is live, then the new location of the object + // can be calculated from the destination of the region plus the offset of the + // object in the region. + if (region_ptr->data_size() == RegionSize) { + result += pointer_delta(addr, region_addr); return result; } // The new location of the object is - // chunk destination + + // region destination + // block offset + // sizes of the live objects in the Block that are to the left of addr const size_t block_offset = addr_to_block_ptr(addr)->offset(); - HeapWord* const search_start = chunk_addr + block_offset; + HeapWord* const search_start = region_addr + block_offset; const ParMarkBitMap* bitmap = PSParallelCompact::mark_bitmap(); size_t live_to_left = bitmap->live_words_in_range(search_start, oop(addr)); result += block_offset + live_to_left; assert(result <= addr, "object cannot move to the right"); - assert(result == chunk_calc_new_pointer(addr), "Should match"); + assert(result == region_calc_new_pointer(addr), "Should match"); return result; } @@ -705,15 +708,15 @@ void ParallelCompactData::verify_clear(const PSVirtualSpace* vspace) void ParallelCompactData::verify_clear() { - verify_clear(_chunk_vspace); + verify_clear(_region_vspace); verify_clear(_block_vspace); } #endif // #ifdef ASSERT #ifdef NOT_PRODUCT -ParallelCompactData::ChunkData* debug_chunk(size_t chunk_index) { +ParallelCompactData::RegionData* debug_region(size_t region_index) { ParallelCompactData& sd = PSParallelCompact::summary_data(); - return sd.chunk(chunk_index); + return sd.region(region_index); } #endif @@ -866,10 +869,10 @@ PSParallelCompact::clear_data_covering_space(SpaceId id) const idx_t end_bit = BitMap::word_align_up(_mark_bitmap.addr_to_bit(top)); _mark_bitmap.clear_range(beg_bit, end_bit); - const size_t beg_chunk = _summary_data.addr_to_chunk_idx(bot); - const size_t end_chunk = - _summary_data.addr_to_chunk_idx(_summary_data.chunk_align_up(max_top)); - _summary_data.clear_range(beg_chunk, end_chunk); + const size_t beg_region = _summary_data.addr_to_region_idx(bot); + const size_t end_region = + _summary_data.addr_to_region_idx(_summary_data.region_align_up(max_top)); + _summary_data.clear_range(beg_region, end_region); } void PSParallelCompact::pre_compact(PreGCValues* pre_gc_values) @@ -985,19 +988,19 @@ HeapWord* PSParallelCompact::compute_dense_prefix_via_density(const SpaceId id, bool maximum_compaction) { - const size_t chunk_size = ParallelCompactData::ChunkSize; + const size_t region_size = ParallelCompactData::RegionSize; const ParallelCompactData& sd = summary_data(); const MutableSpace* const space = _space_info[id].space(); - HeapWord* const top_aligned_up = sd.chunk_align_up(space->top()); - const ChunkData* const beg_cp = sd.addr_to_chunk_ptr(space->bottom()); - const ChunkData* const end_cp = sd.addr_to_chunk_ptr(top_aligned_up); + HeapWord* const top_aligned_up = sd.region_align_up(space->top()); + const RegionData* const beg_cp = sd.addr_to_region_ptr(space->bottom()); + const RegionData* const end_cp = sd.addr_to_region_ptr(top_aligned_up); - // Skip full chunks at the beginning of the space--they are necessarily part + // Skip full regions at the beginning of the space--they are necessarily part // of the dense prefix. size_t full_count = 0; - const ChunkData* cp; - for (cp = beg_cp; cp < end_cp && cp->data_size() == chunk_size; ++cp) { + const RegionData* cp; + for (cp = beg_cp; cp < end_cp && cp->data_size() == region_size; ++cp) { ++full_count; } @@ -1006,7 +1009,7 @@ PSParallelCompact::compute_dense_prefix_via_density(const SpaceId id, const bool interval_ended = gcs_since_max > HeapMaximumCompactionInterval; if (maximum_compaction || cp == end_cp || interval_ended) { _maximum_compaction_gc_num = total_invocations(); - return sd.chunk_to_addr(cp); + return sd.region_to_addr(cp); } HeapWord* const new_top = _space_info[id].new_top(); @@ -1029,52 +1032,53 @@ PSParallelCompact::compute_dense_prefix_via_density(const SpaceId id, } // XXX - Use binary search? - HeapWord* dense_prefix = sd.chunk_to_addr(cp); - const ChunkData* full_cp = cp; - const ChunkData* const top_cp = sd.addr_to_chunk_ptr(space->top() - 1); + HeapWord* dense_prefix = sd.region_to_addr(cp); + const RegionData* full_cp = cp; + const RegionData* const top_cp = sd.addr_to_region_ptr(space->top() - 1); while (cp < end_cp) { - HeapWord* chunk_destination = cp->destination(); - const size_t cur_deadwood = pointer_delta(dense_prefix, chunk_destination); + HeapWord* region_destination = cp->destination(); + const size_t cur_deadwood = pointer_delta(dense_prefix, region_destination); if (TraceParallelOldGCDensePrefix && Verbose) { tty->print_cr("c#=" SIZE_FORMAT_W(4) " dst=" PTR_FORMAT " " "dp=" SIZE_FORMAT_W(8) " " "cdw=" SIZE_FORMAT_W(8), - sd.chunk(cp), chunk_destination, + sd.region(cp), region_destination, dense_prefix, cur_deadwood); } if (cur_deadwood >= deadwood_goal) { - // Found the chunk that has the correct amount of deadwood to the left. - // This typically occurs after crossing a fairly sparse set of chunks, so - // iterate backwards over those sparse chunks, looking for the chunk that - // has the lowest density of live objects 'to the right.' - size_t space_to_left = sd.chunk(cp) * chunk_size; + // Found the region that has the correct amount of deadwood to the left. + // This typically occurs after crossing a fairly sparse set of regions, so + // iterate backwards over those sparse regions, looking for the region + // that has the lowest density of live objects 'to the right.' + size_t space_to_left = sd.region(cp) * region_size; size_t live_to_left = space_to_left - cur_deadwood; size_t space_to_right = space_capacity - space_to_left; size_t live_to_right = space_live - live_to_left; double density_to_right = double(live_to_right) / space_to_right; while (cp > full_cp) { --cp; - const size_t prev_chunk_live_to_right = live_to_right - cp->data_size(); - const size_t prev_chunk_space_to_right = space_to_right + chunk_size; - double prev_chunk_density_to_right = - double(prev_chunk_live_to_right) / prev_chunk_space_to_right; - if (density_to_right <= prev_chunk_density_to_right) { + const size_t prev_region_live_to_right = live_to_right - + cp->data_size(); + const size_t prev_region_space_to_right = space_to_right + region_size; + double prev_region_density_to_right = + double(prev_region_live_to_right) / prev_region_space_to_right; + if (density_to_right <= prev_region_density_to_right) { return dense_prefix; } if (TraceParallelOldGCDensePrefix && Verbose) { tty->print_cr("backing up from c=" SIZE_FORMAT_W(4) " d2r=%10.8f " - "pc_d2r=%10.8f", sd.chunk(cp), density_to_right, - prev_chunk_density_to_right); + "pc_d2r=%10.8f", sd.region(cp), density_to_right, + prev_region_density_to_right); } - dense_prefix -= chunk_size; - live_to_right = prev_chunk_live_to_right; - space_to_right = prev_chunk_space_to_right; - density_to_right = prev_chunk_density_to_right; + dense_prefix -= region_size; + live_to_right = prev_region_live_to_right; + space_to_right = prev_region_space_to_right; + density_to_right = prev_region_density_to_right; } return dense_prefix; } - dense_prefix += chunk_size; + dense_prefix += region_size; ++cp; } @@ -1087,8 +1091,8 @@ void PSParallelCompact::print_dense_prefix_stats(const char* const algorithm, const bool maximum_compaction, HeapWord* const addr) { - const size_t chunk_idx = summary_data().addr_to_chunk_idx(addr); - ChunkData* const cp = summary_data().chunk(chunk_idx); + const size_t region_idx = summary_data().addr_to_region_idx(addr); + RegionData* const cp = summary_data().region(region_idx); const MutableSpace* const space = _space_info[id].space(); HeapWord* const new_top = _space_info[id].new_top(); @@ -1104,7 +1108,7 @@ void PSParallelCompact::print_dense_prefix_stats(const char* const algorithm, "d2l=" SIZE_FORMAT " d2l%%=%6.4f " "d2r=" SIZE_FORMAT " l2r=" SIZE_FORMAT " ratio=%10.8f", - algorithm, addr, chunk_idx, + algorithm, addr, region_idx, space_live, dead_to_left, dead_to_left_pct, dead_to_right, live_to_right, @@ -1166,52 +1170,52 @@ double PSParallelCompact::dead_wood_limiter(double density, size_t min_percent) return MAX2(limit, 0.0); } -ParallelCompactData::ChunkData* -PSParallelCompact::first_dead_space_chunk(const ChunkData* beg, - const ChunkData* end) +ParallelCompactData::RegionData* +PSParallelCompact::first_dead_space_region(const RegionData* beg, + const RegionData* end) { - const size_t chunk_size = ParallelCompactData::ChunkSize; + const size_t region_size = ParallelCompactData::RegionSize; ParallelCompactData& sd = summary_data(); - size_t left = sd.chunk(beg); - size_t right = end > beg ? sd.chunk(end) - 1 : left; + size_t left = sd.region(beg); + size_t right = end > beg ? sd.region(end) - 1 : left; // Binary search. while (left < right) { // Equivalent to (left + right) / 2, but does not overflow. const size_t middle = left + (right - left) / 2; - ChunkData* const middle_ptr = sd.chunk(middle); + RegionData* const middle_ptr = sd.region(middle); HeapWord* const dest = middle_ptr->destination(); - HeapWord* const addr = sd.chunk_to_addr(middle); + HeapWord* const addr = sd.region_to_addr(middle); assert(dest != NULL, "sanity"); assert(dest <= addr, "must move left"); if (middle > left && dest < addr) { right = middle - 1; - } else if (middle < right && middle_ptr->data_size() == chunk_size) { + } else if (middle < right && middle_ptr->data_size() == region_size) { left = middle + 1; } else { return middle_ptr; } } - return sd.chunk(left); + return sd.region(left); } -ParallelCompactData::ChunkData* -PSParallelCompact::dead_wood_limit_chunk(const ChunkData* beg, - const ChunkData* end, - size_t dead_words) +ParallelCompactData::RegionData* +PSParallelCompact::dead_wood_limit_region(const RegionData* beg, + const RegionData* end, + size_t dead_words) { ParallelCompactData& sd = summary_data(); - size_t left = sd.chunk(beg); - size_t right = end > beg ? sd.chunk(end) - 1 : left; + size_t left = sd.region(beg); + size_t right = end > beg ? sd.region(end) - 1 : left; // Binary search. while (left < right) { // Equivalent to (left + right) / 2, but does not overflow. const size_t middle = left + (right - left) / 2; - ChunkData* const middle_ptr = sd.chunk(middle); + RegionData* const middle_ptr = sd.region(middle); HeapWord* const dest = middle_ptr->destination(); - HeapWord* const addr = sd.chunk_to_addr(middle); + HeapWord* const addr = sd.region_to_addr(middle); assert(dest != NULL, "sanity"); assert(dest <= addr, "must move left"); @@ -1224,13 +1228,13 @@ PSParallelCompact::dead_wood_limit_chunk(const ChunkData* beg, return middle_ptr; } } - return sd.chunk(left); + return sd.region(left); } // The result is valid during the summary phase, after the initial summarization // of each space into itself, and before final summarization. inline double -PSParallelCompact::reclaimed_ratio(const ChunkData* const cp, +PSParallelCompact::reclaimed_ratio(const RegionData* const cp, HeapWord* const bottom, HeapWord* const top, HeapWord* const new_top) @@ -1244,12 +1248,13 @@ PSParallelCompact::reclaimed_ratio(const ChunkData* const cp, assert(top >= new_top, "summary data problem?"); assert(new_top > bottom, "space is empty; should not be here"); assert(new_top >= cp->destination(), "sanity"); - assert(top >= sd.chunk_to_addr(cp), "sanity"); + assert(top >= sd.region_to_addr(cp), "sanity"); HeapWord* const destination = cp->destination(); const size_t dense_prefix_live = pointer_delta(destination, bottom); const size_t compacted_region_live = pointer_delta(new_top, destination); - const size_t compacted_region_used = pointer_delta(top, sd.chunk_to_addr(cp)); + const size_t compacted_region_used = pointer_delta(top, + sd.region_to_addr(cp)); const size_t reclaimable = compacted_region_used - compacted_region_live; const double divisor = dense_prefix_live + 1.25 * compacted_region_live; @@ -1257,39 +1262,40 @@ PSParallelCompact::reclaimed_ratio(const ChunkData* const cp, } // Return the address of the end of the dense prefix, a.k.a. the start of the -// compacted region. The address is always on a chunk boundary. +// compacted region. The address is always on a region boundary. // -// Completely full chunks at the left are skipped, since no compaction can occur -// in those chunks. Then the maximum amount of dead wood to allow is computed, -// based on the density (amount live / capacity) of the generation; the chunk -// with approximately that amount of dead space to the left is identified as the -// limit chunk. Chunks between the last completely full chunk and the limit -// chunk are scanned and the one that has the best (maximum) reclaimed_ratio() -// is selected. +// Completely full regions at the left are skipped, since no compaction can +// occur in those regions. Then the maximum amount of dead wood to allow is +// computed, based on the density (amount live / capacity) of the generation; +// the region with approximately that amount of dead space to the left is +// identified as the limit region. Regions between the last completely full +// region and the limit region are scanned and the one that has the best +// (maximum) reclaimed_ratio() is selected. HeapWord* PSParallelCompact::compute_dense_prefix(const SpaceId id, bool maximum_compaction) { - const size_t chunk_size = ParallelCompactData::ChunkSize; + const size_t region_size = ParallelCompactData::RegionSize; const ParallelCompactData& sd = summary_data(); const MutableSpace* const space = _space_info[id].space(); HeapWord* const top = space->top(); - HeapWord* const top_aligned_up = sd.chunk_align_up(top); + HeapWord* const top_aligned_up = sd.region_align_up(top); HeapWord* const new_top = _space_info[id].new_top(); - HeapWord* const new_top_aligned_up = sd.chunk_align_up(new_top); + HeapWord* const new_top_aligned_up = sd.region_align_up(new_top); HeapWord* const bottom = space->bottom(); - const ChunkData* const beg_cp = sd.addr_to_chunk_ptr(bottom); - const ChunkData* const top_cp = sd.addr_to_chunk_ptr(top_aligned_up); - const ChunkData* const new_top_cp = sd.addr_to_chunk_ptr(new_top_aligned_up); + const RegionData* const beg_cp = sd.addr_to_region_ptr(bottom); + const RegionData* const top_cp = sd.addr_to_region_ptr(top_aligned_up); + const RegionData* const new_top_cp = + sd.addr_to_region_ptr(new_top_aligned_up); - // Skip full chunks at the beginning of the space--they are necessarily part + // Skip full regions at the beginning of the space--they are necessarily part // of the dense prefix. - const ChunkData* const full_cp = first_dead_space_chunk(beg_cp, new_top_cp); - assert(full_cp->destination() == sd.chunk_to_addr(full_cp) || + const RegionData* const full_cp = first_dead_space_region(beg_cp, new_top_cp); + assert(full_cp->destination() == sd.region_to_addr(full_cp) || space->is_empty(), "no dead space allowed to the left"); - assert(full_cp->data_size() < chunk_size || full_cp == new_top_cp - 1, - "chunk must have dead space"); + assert(full_cp->data_size() < region_size || full_cp == new_top_cp - 1, + "region must have dead space"); // The gc number is saved whenever a maximum compaction is done, and used to // determine when the maximum compaction interval has expired. This avoids @@ -1300,7 +1306,7 @@ PSParallelCompact::compute_dense_prefix(const SpaceId id, total_invocations() == HeapFirstMaximumCompactionCount; if (maximum_compaction || full_cp == top_cp || interval_ended) { _maximum_compaction_gc_num = total_invocations(); - return sd.chunk_to_addr(full_cp); + return sd.region_to_addr(full_cp); } const size_t space_live = pointer_delta(new_top, bottom); @@ -1326,15 +1332,15 @@ PSParallelCompact::compute_dense_prefix(const SpaceId id, dead_wood_max, dead_wood_limit); } - // Locate the chunk with the desired amount of dead space to the left. - const ChunkData* const limit_cp = - dead_wood_limit_chunk(full_cp, top_cp, dead_wood_limit); + // Locate the region with the desired amount of dead space to the left. + const RegionData* const limit_cp = + dead_wood_limit_region(full_cp, top_cp, dead_wood_limit); - // Scan from the first chunk with dead space to the limit chunk and find the + // Scan from the first region with dead space to the limit region and find the // one with the best (largest) reclaimed ratio. double best_ratio = 0.0; - const ChunkData* best_cp = full_cp; - for (const ChunkData* cp = full_cp; cp < limit_cp; ++cp) { + const RegionData* best_cp = full_cp; + for (const RegionData* cp = full_cp; cp < limit_cp; ++cp) { double tmp_ratio = reclaimed_ratio(cp, bottom, top, new_top); if (tmp_ratio > best_ratio) { best_cp = cp; @@ -1343,18 +1349,18 @@ PSParallelCompact::compute_dense_prefix(const SpaceId id, } #if 0 - // Something to consider: if the chunk with the best ratio is 'close to' the - // first chunk w/free space, choose the first chunk with free space - // ("first-free"). The first-free chunk is usually near the start of the + // Something to consider: if the region with the best ratio is 'close to' the + // first region w/free space, choose the first region with free space + // ("first-free"). The first-free region is usually near the start of the // heap, which means we are copying most of the heap already, so copy a bit // more to get complete compaction. - if (pointer_delta(best_cp, full_cp, sizeof(ChunkData)) < 4) { + if (pointer_delta(best_cp, full_cp, sizeof(RegionData)) < 4) { _maximum_compaction_gc_num = total_invocations(); best_cp = full_cp; } #endif // #if 0 - return sd.chunk_to_addr(best_cp); + return sd.region_to_addr(best_cp); } void PSParallelCompact::summarize_spaces_quick() @@ -1372,9 +1378,9 @@ void PSParallelCompact::summarize_spaces_quick() void PSParallelCompact::fill_dense_prefix_end(SpaceId id) { HeapWord* const dense_prefix_end = dense_prefix(id); - const ChunkData* chunk = _summary_data.addr_to_chunk_ptr(dense_prefix_end); + const RegionData* region = _summary_data.addr_to_region_ptr(dense_prefix_end); const idx_t dense_prefix_bit = _mark_bitmap.addr_to_bit(dense_prefix_end); - if (dead_space_crosses_boundary(chunk, dense_prefix_bit)) { + if (dead_space_crosses_boundary(region, dense_prefix_bit)) { // Only enough dead space is filled so that any remaining dead space to the // left is larger than the minimum filler object. (The remainder is filled // during the copy/update phase.) @@ -1465,7 +1471,7 @@ PSParallelCompact::summarize_space(SpaceId id, bool maximum_compaction) fill_dense_prefix_end(id); } - // Compute the destination of each Chunk, and thus each object. + // Compute the destination of each Region, and thus each object. _summary_data.summarize_dense_prefix(space->bottom(), dense_prefix_end); _summary_data.summarize(dense_prefix_end, space->end(), dense_prefix_end, space->top(), @@ -1473,19 +1479,19 @@ PSParallelCompact::summarize_space(SpaceId id, bool maximum_compaction) } if (TraceParallelOldGCSummaryPhase) { - const size_t chunk_size = ParallelCompactData::ChunkSize; + const size_t region_size = ParallelCompactData::RegionSize; HeapWord* const dense_prefix_end = _space_info[id].dense_prefix(); - const size_t dp_chunk = _summary_data.addr_to_chunk_idx(dense_prefix_end); + const size_t dp_region = _summary_data.addr_to_region_idx(dense_prefix_end); const size_t dp_words = pointer_delta(dense_prefix_end, space->bottom()); HeapWord* const new_top = _space_info[id].new_top(); - const HeapWord* nt_aligned_up = _summary_data.chunk_align_up(new_top); + const HeapWord* nt_aligned_up = _summary_data.region_align_up(new_top); const size_t cr_words = pointer_delta(nt_aligned_up, dense_prefix_end); tty->print_cr("id=%d cap=" SIZE_FORMAT " dp=" PTR_FORMAT " " - "dp_chunk=" SIZE_FORMAT " " "dp_count=" SIZE_FORMAT " " + "dp_region=" SIZE_FORMAT " " "dp_count=" SIZE_FORMAT " " "cr_count=" SIZE_FORMAT " " "nt=" PTR_FORMAT, id, space->capacity_in_words(), dense_prefix_end, - dp_chunk, dp_words / chunk_size, - cr_words / chunk_size, new_top); + dp_region, dp_words / region_size, + cr_words / region_size, new_top); } } @@ -1513,7 +1519,7 @@ void PSParallelCompact::summary_phase(ParCompactionManager* cm, if (TraceParallelOldGCSummaryPhase) { tty->print_cr("summary_phase: after summarizing each space to self"); Universe::print(); - NOT_PRODUCT(print_chunk_ranges()); + NOT_PRODUCT(print_region_ranges()); if (Verbose) { NOT_PRODUCT(print_initial_summary_data(_summary_data, _space_info)); } @@ -1559,14 +1565,15 @@ void PSParallelCompact::summary_phase(ParCompactionManager* cm, space->bottom(), space->top(), new_top_addr); - // Clear the source_chunk field for each chunk in the space. + // Clear the source_region field for each region in the space. HeapWord* const new_top = _space_info[id].new_top(); - HeapWord* const clear_end = _summary_data.chunk_align_up(new_top); - ChunkData* beg_chunk = _summary_data.addr_to_chunk_ptr(space->bottom()); - ChunkData* end_chunk = _summary_data.addr_to_chunk_ptr(clear_end); - while (beg_chunk < end_chunk) { - beg_chunk->set_source_chunk(0); - ++beg_chunk; + HeapWord* const clear_end = _summary_data.region_align_up(new_top); + RegionData* beg_region = + _summary_data.addr_to_region_ptr(space->bottom()); + RegionData* end_region = _summary_data.addr_to_region_ptr(clear_end); + while (beg_region < end_region) { + beg_region->set_source_region(0); + ++beg_region; } // Reset the new_top value for the space. @@ -1574,13 +1581,13 @@ void PSParallelCompact::summary_phase(ParCompactionManager* cm, } } - // Fill in the block data after any changes to the chunks have + // Fill in the block data after any changes to the regions have // been made. #ifdef ASSERT summarize_blocks(cm, perm_space_id); summarize_blocks(cm, old_space_id); #else - if (!UseParallelOldGCChunkPointerCalc) { + if (!UseParallelOldGCRegionPointerCalc) { summarize_blocks(cm, perm_space_id); summarize_blocks(cm, old_space_id); } @@ -1589,7 +1596,7 @@ void PSParallelCompact::summary_phase(ParCompactionManager* cm, if (TraceParallelOldGCSummaryPhase) { tty->print_cr("summary_phase: after final summarization"); Universe::print(); - NOT_PRODUCT(print_chunk_ranges()); + NOT_PRODUCT(print_region_ranges()); if (Verbose) { NOT_PRODUCT(print_generic_summary_data(_summary_data, _space_info)); } @@ -1598,7 +1605,7 @@ void PSParallelCompact::summary_phase(ParCompactionManager* cm, // Fill in the BlockData. // Iterate over the spaces and within each space iterate over -// the chunks and fill in the BlockData for each chunk. +// the regions and fill in the BlockData for each region. void PSParallelCompact::summarize_blocks(ParCompactionManager* cm, SpaceId first_compaction_space_id) { @@ -1607,40 +1614,41 @@ void PSParallelCompact::summarize_blocks(ParCompactionManager* cm, for (SpaceId cur_space_id = first_compaction_space_id; cur_space_id != last_space_id; cur_space_id = next_compaction_space_id(cur_space_id)) { - // Iterate over the chunks in the space - size_t start_chunk_index = - _summary_data.addr_to_chunk_idx(space(cur_space_id)->bottom()); + // Iterate over the regions in the space + size_t start_region_index = + _summary_data.addr_to_region_idx(space(cur_space_id)->bottom()); BitBlockUpdateClosure bbu(mark_bitmap(), cm, - start_chunk_index); + start_region_index); // Iterate over blocks. - for (size_t chunk_index = start_chunk_index; - chunk_index < _summary_data.chunk_count() && - _summary_data.chunk_to_addr(chunk_index) < space(cur_space_id)->top(); - chunk_index++) { + for (size_t region_index = start_region_index; + region_index < _summary_data.region_count() && + _summary_data.region_to_addr(region_index) < + space(cur_space_id)->top(); + region_index++) { - // Reset the closure for the new chunk. Note that the closure - // maintains some data that does not get reset for each chunk + // Reset the closure for the new region. Note that the closure + // maintains some data that does not get reset for each region // so a new instance of the closure is no appropriate. - bbu.reset_chunk(chunk_index); + bbu.reset_region(region_index); // Start the iteration with the first live object. This - // may return the end of the chunk. That is acceptable since + // may return the end of the region. That is acceptable since // it will properly limit the iterations. ParMarkBitMap::idx_t left_offset = mark_bitmap()->addr_to_bit( - _summary_data.first_live_or_end_in_chunk(chunk_index)); + _summary_data.first_live_or_end_in_region(region_index)); - // End the iteration at the end of the chunk. - HeapWord* chunk_addr = _summary_data.chunk_to_addr(chunk_index); - HeapWord* chunk_end = chunk_addr + ParallelCompactData::ChunkSize; + // End the iteration at the end of the region. + HeapWord* region_addr = _summary_data.region_to_addr(region_index); + HeapWord* region_end = region_addr + ParallelCompactData::RegionSize; ParMarkBitMap::idx_t right_offset = - mark_bitmap()->addr_to_bit(chunk_end); + mark_bitmap()->addr_to_bit(region_end); // Blocks that have not objects starting in them can be // skipped because their data will never be used. if (left_offset < right_offset) { - // Iterate through the objects in the chunk. + // Iterate through the objects in the region. ParMarkBitMap::idx_t last_offset = mark_bitmap()->pair_iterate(&bbu, left_offset, right_offset); @@ -1649,7 +1657,7 @@ void PSParallelCompact::summarize_blocks(ParCompactionManager* cm, // is then the offset for the last start bit. In this situation // the "offset" field for the next block to the right (_cur_block + 1) // will not have been update although there may be live data - // to the left of the chunk. + // to the left of the region. size_t cur_block_plus_1 = bbu.cur_block() + 1; HeapWord* cur_block_plus_1_addr = @@ -1669,23 +1677,23 @@ void PSParallelCompact::summarize_blocks(ParCompactionManager* cm, #else // The current block has already been updated. The only block // that remains to be updated is the block where the last - // object in the chunk starts. + // object in the region starts. size_t last_block = _summary_data.addr_to_block_idx(last_offset_addr); #endif assert_bit_is_start(last_offset); assert((last_block == _summary_data.block_count()) || (_summary_data.block(last_block)->raw_offset() == 0), "Should not have been set"); - // Is the last block still in the current chunk? If still - // in this chunk, update the last block (the counting that + // Is the last block still in the current region? If still + // in this region, update the last block (the counting that // included the current block is meant for the offset of the last - // block). If not in this chunk, do nothing. Should not - // update a block in the next chunk. - if (ParallelCompactData::chunk_contains_block(bbu.chunk_index(), - last_block)) { + // block). If not in this region, do nothing. Should not + // update a block in the next region. + if (ParallelCompactData::region_contains_block(bbu.region_index(), + last_block)) { if (last_offset < right_offset) { - // The last object started in this chunk but ends beyond - // this chunk. Update the block for this last object. + // The last object started in this region but ends beyond + // this region. Update the block for this last object. assert(mark_bitmap()->is_marked(last_offset), "Should be marked"); // No end bit was found. The closure takes care of // the cases where @@ -1693,7 +1701,7 @@ void PSParallelCompact::summarize_blocks(ParCompactionManager* cm, // an objects starts and ends in the next block // It does not handle the case where an object is // the first object in a later block and extends - // past the end of the chunk (i.e., the closure + // past the end of the region (i.e., the closure // only handles complete objects that are in the range // it is given). That object is handed back here // for any special consideration necessary. @@ -1709,7 +1717,7 @@ void PSParallelCompact::summarize_blocks(ParCompactionManager* cm, // the AA+1 is the trigger that updates AA. Objects are being // counted in the current block for updaing a following // block. An object may start in later block - // block but may extend beyond the last block in the chunk. + // block but may extend beyond the last block in the region. // Updates are only done when the end of an object has been // found. If the last object (covered by block L) starts // beyond the current block, then no object ends in L (otherwise @@ -1717,7 +1725,7 @@ void PSParallelCompact::summarize_blocks(ParCompactionManager* cm, // a start bit. // // Else the last objects start in the current block and ends - // beyond the chunk. The current block has already been + // beyond the region. The current block has already been // updated and there is no later block (with an object // starting in it) that needs to be updated. // @@ -1728,14 +1736,14 @@ void PSParallelCompact::summarize_blocks(ParCompactionManager* cm, // The start of the object is on a later block // (to the right of the current block and there are no // complete live objects to the left of this last object - // within the chunk. + // within the region. // The first bit in the block is for the start of the // last object. _summary_data.block(last_block)->set_start_bit_offset( bbu.live_data_left()); } else { // The start of the last object was found in - // the current chunk (which has already + // the current region (which has already // been updated). assert(bbu.cur_block() == _summary_data.addr_to_block_idx(last_offset_addr), @@ -1743,15 +1751,15 @@ void PSParallelCompact::summarize_blocks(ParCompactionManager* cm, } #ifdef ASSERT // Is there enough block information to find this object? - // The destination of the chunk has not been set so the + // The destination of the region has not been set so the // values returned by calc_new_pointer() and // block_calc_new_pointer() will only be // offsets. But they should agree. - HeapWord* moved_obj_with_chunks = - _summary_data.chunk_calc_new_pointer(last_offset_addr); + HeapWord* moved_obj_with_regions = + _summary_data.region_calc_new_pointer(last_offset_addr); HeapWord* moved_obj_with_blocks = _summary_data.calc_new_pointer(last_offset_addr); - assert(moved_obj_with_chunks == moved_obj_with_blocks, + assert(moved_obj_with_regions == moved_obj_with_blocks, "Block calculation is wrong"); #endif } else if (last_block < _summary_data.block_count()) { @@ -1764,38 +1772,38 @@ void PSParallelCompact::summarize_blocks(ParCompactionManager* cm, #ifdef ASSERT // Is there enough block information to find this object? HeapWord* left_offset_addr = mark_bitmap()->bit_to_addr(left_offset); - HeapWord* moved_obj_with_chunks = + HeapWord* moved_obj_with_regions = _summary_data.calc_new_pointer(left_offset_addr); HeapWord* moved_obj_with_blocks = _summary_data.calc_new_pointer(left_offset_addr); - assert(moved_obj_with_chunks == moved_obj_with_blocks, + assert(moved_obj_with_regions == moved_obj_with_blocks, "Block calculation is wrong"); #endif - // Is there another block after the end of this chunk? + // Is there another block after the end of this region? #ifdef ASSERT if (last_block < _summary_data.block_count()) { // No object may have been found in a block. If that - // block is at the end of the chunk, the iteration will + // block is at the end of the region, the iteration will // terminate without incrementing the current block so // that the current block is not the last block in the - // chunk. That situation precludes asserting that the - // current block is the last block in the chunk. Assert + // region. That situation precludes asserting that the + // current block is the last block in the region. Assert // the lesser condition that the current block does not - // exceed the chunk. + // exceed the region. assert(_summary_data.block_to_addr(last_block) <= - (_summary_data.chunk_to_addr(chunk_index) + - ParallelCompactData::ChunkSize), - "Chunk and block inconsistency"); + (_summary_data.region_to_addr(region_index) + + ParallelCompactData::RegionSize), + "Region and block inconsistency"); assert(last_offset <= right_offset, "Iteration over ran end"); } #endif } #ifdef ASSERT if (PrintGCDetails && Verbose) { - if (_summary_data.chunk(chunk_index)->partial_obj_size() == 1) { + if (_summary_data.region(region_index)->partial_obj_size() == 1) { size_t first_block = - chunk_index / ParallelCompactData::BlocksPerChunk; + region_index / ParallelCompactData::BlocksPerRegion; gclog_or_tty->print_cr("first_block " PTR_FORMAT " _offset " PTR_FORMAT "_first_is_start_bit %d", @@ -1845,18 +1853,18 @@ void PSParallelCompact::invoke(bool maximum_heap_compaction) { } } -bool ParallelCompactData::chunk_contains(size_t chunk_index, HeapWord* addr) { - size_t addr_chunk_index = addr_to_chunk_idx(addr); - return chunk_index == addr_chunk_index; +bool ParallelCompactData::region_contains(size_t region_index, HeapWord* addr) { + size_t addr_region_index = addr_to_region_idx(addr); + return region_index == addr_region_index; } -bool ParallelCompactData::chunk_contains_block(size_t chunk_index, - size_t block_index) { - size_t first_block_in_chunk = chunk_index * BlocksPerChunk; - size_t last_block_in_chunk = (chunk_index + 1) * BlocksPerChunk - 1; +bool ParallelCompactData::region_contains_block(size_t region_index, + size_t block_index) { + size_t first_block_in_region = region_index * BlocksPerRegion; + size_t last_block_in_region = (region_index + 1) * BlocksPerRegion - 1; - return (first_block_in_chunk <= block_index) && - (block_index <= last_block_in_chunk); + return (first_block_in_region <= block_index) && + (block_index <= last_block_in_region); } // This method contains no policy. You should probably @@ -2205,7 +2213,7 @@ void PSParallelCompact::marking_phase(ParCompactionManager* cm, ParallelScavengeHeap* heap = gc_heap(); uint parallel_gc_threads = heap->gc_task_manager()->workers(); - TaskQueueSetSuper* qset = ParCompactionManager::chunk_array(); + TaskQueueSetSuper* qset = ParCompactionManager::region_array(); ParallelTaskTerminator terminator(parallel_gc_threads, qset); PSParallelCompact::MarkAndPushClosure mark_and_push_closure(cm); @@ -2343,8 +2351,9 @@ void PSParallelCompact::compact_perm(ParCompactionManager* cm) { move_and_update(cm, perm_space_id); } -void PSParallelCompact::enqueue_chunk_draining_tasks(GCTaskQueue* q, - uint parallel_gc_threads) { +void PSParallelCompact::enqueue_region_draining_tasks(GCTaskQueue* q, + uint parallel_gc_threads) +{ TraceTime tm("drain task setup", print_phases(), true, gclog_or_tty); const unsigned int task_count = MAX2(parallel_gc_threads, 1U); @@ -2352,13 +2361,13 @@ void PSParallelCompact::enqueue_chunk_draining_tasks(GCTaskQueue* q, q->enqueue(new DrainStacksCompactionTask()); } - // Find all chunks that are available (can be filled immediately) and + // Find all regions that are available (can be filled immediately) and // distribute them to the thread stacks. The iteration is done in reverse - // order (high to low) so the chunks will be removed in ascending order. + // order (high to low) so the regions will be removed in ascending order. const ParallelCompactData& sd = PSParallelCompact::summary_data(); - size_t fillable_chunks = 0; // A count for diagnostic purposes. + size_t fillable_regions = 0; // A count for diagnostic purposes. unsigned int which = 0; // The worker thread number. for (unsigned int id = to_space_id; id > perm_space_id; --id) { @@ -2366,25 +2375,26 @@ void PSParallelCompact::enqueue_chunk_draining_tasks(GCTaskQueue* q, MutableSpace* const space = space_info->space(); HeapWord* const new_top = space_info->new_top(); - const size_t beg_chunk = sd.addr_to_chunk_idx(space_info->dense_prefix()); - const size_t end_chunk = sd.addr_to_chunk_idx(sd.chunk_align_up(new_top)); - assert(end_chunk > 0, "perm gen cannot be empty"); + const size_t beg_region = sd.addr_to_region_idx(space_info->dense_prefix()); + const size_t end_region = + sd.addr_to_region_idx(sd.region_align_up(new_top)); + assert(end_region > 0, "perm gen cannot be empty"); - for (size_t cur = end_chunk - 1; cur >= beg_chunk; --cur) { - if (sd.chunk(cur)->claim_unsafe()) { + for (size_t cur = end_region - 1; cur >= beg_region; --cur) { + if (sd.region(cur)->claim_unsafe()) { ParCompactionManager* cm = ParCompactionManager::manager_array(which); cm->save_for_processing(cur); if (TraceParallelOldGCCompactionPhase && Verbose) { - const size_t count_mod_8 = fillable_chunks & 7; + const size_t count_mod_8 = fillable_regions & 7; if (count_mod_8 == 0) gclog_or_tty->print("fillable: "); gclog_or_tty->print(" " SIZE_FORMAT_W(7), cur); if (count_mod_8 == 7) gclog_or_tty->cr(); } - NOT_PRODUCT(++fillable_chunks;) + NOT_PRODUCT(++fillable_regions;) - // Assign chunks to threads in round-robin fashion. + // Assign regions to threads in round-robin fashion. if (++which == task_count) { which = 0; } @@ -2393,8 +2403,8 @@ void PSParallelCompact::enqueue_chunk_draining_tasks(GCTaskQueue* q, } if (TraceParallelOldGCCompactionPhase) { - if (Verbose && (fillable_chunks & 7) != 0) gclog_or_tty->cr(); - gclog_or_tty->print_cr("%u initially fillable chunks", fillable_chunks); + if (Verbose && (fillable_regions & 7) != 0) gclog_or_tty->cr(); + gclog_or_tty->print_cr("%u initially fillable regions", fillable_regions); } } @@ -2407,7 +2417,7 @@ void PSParallelCompact::enqueue_dense_prefix_tasks(GCTaskQueue* q, ParallelCompactData& sd = PSParallelCompact::summary_data(); // Iterate over all the spaces adding tasks for updating - // chunks in the dense prefix. Assume that 1 gc thread + // regions in the dense prefix. Assume that 1 gc thread // will work on opening the gaps and the remaining gc threads // will work on the dense prefix. SpaceId space_id = old_space_id; @@ -2421,30 +2431,31 @@ void PSParallelCompact::enqueue_dense_prefix_tasks(GCTaskQueue* q, continue; } - // The dense prefix is before this chunk. - size_t chunk_index_end_dense_prefix = - sd.addr_to_chunk_idx(dense_prefix_end); - ChunkData* const dense_prefix_cp = sd.chunk(chunk_index_end_dense_prefix); + // The dense prefix is before this region. + size_t region_index_end_dense_prefix = + sd.addr_to_region_idx(dense_prefix_end); + RegionData* const dense_prefix_cp = + sd.region(region_index_end_dense_prefix); assert(dense_prefix_end == space->end() || dense_prefix_cp->available() || dense_prefix_cp->claimed(), - "The chunk after the dense prefix should always be ready to fill"); + "The region after the dense prefix should always be ready to fill"); - size_t chunk_index_start = sd.addr_to_chunk_idx(space->bottom()); + size_t region_index_start = sd.addr_to_region_idx(space->bottom()); // Is there dense prefix work? - size_t total_dense_prefix_chunks = - chunk_index_end_dense_prefix - chunk_index_start; - // How many chunks of the dense prefix should be given to + size_t total_dense_prefix_regions = + region_index_end_dense_prefix - region_index_start; + // How many regions of the dense prefix should be given to // each thread? - if (total_dense_prefix_chunks > 0) { + if (total_dense_prefix_regions > 0) { uint tasks_for_dense_prefix = 1; if (UseParallelDensePrefixUpdate) { - if (total_dense_prefix_chunks <= + if (total_dense_prefix_regions <= (parallel_gc_threads * PAR_OLD_DENSE_PREFIX_OVER_PARTITIONING)) { // Don't over partition. This assumes that // PAR_OLD_DENSE_PREFIX_OVER_PARTITIONING is a small integer value - // so there are not many chunks to process. + // so there are not many regions to process. tasks_for_dense_prefix = parallel_gc_threads; } else { // Over partition @@ -2452,50 +2463,50 @@ void PSParallelCompact::enqueue_dense_prefix_tasks(GCTaskQueue* q, PAR_OLD_DENSE_PREFIX_OVER_PARTITIONING; } } - size_t chunks_per_thread = total_dense_prefix_chunks / + size_t regions_per_thread = total_dense_prefix_regions / tasks_for_dense_prefix; - // Give each thread at least 1 chunk. - if (chunks_per_thread == 0) { - chunks_per_thread = 1; + // Give each thread at least 1 region. + if (regions_per_thread == 0) { + regions_per_thread = 1; } for (uint k = 0; k < tasks_for_dense_prefix; k++) { - if (chunk_index_start >= chunk_index_end_dense_prefix) { + if (region_index_start >= region_index_end_dense_prefix) { break; } - // chunk_index_end is not processed - size_t chunk_index_end = MIN2(chunk_index_start + chunks_per_thread, - chunk_index_end_dense_prefix); + // region_index_end is not processed + size_t region_index_end = MIN2(region_index_start + regions_per_thread, + region_index_end_dense_prefix); q->enqueue(new UpdateDensePrefixTask( space_id, - chunk_index_start, - chunk_index_end)); - chunk_index_start = chunk_index_end; + region_index_start, + region_index_end)); + region_index_start = region_index_end; } } // This gets any part of the dense prefix that did not // fit evenly. - if (chunk_index_start < chunk_index_end_dense_prefix) { + if (region_index_start < region_index_end_dense_prefix) { q->enqueue(new UpdateDensePrefixTask( space_id, - chunk_index_start, - chunk_index_end_dense_prefix)); + region_index_start, + region_index_end_dense_prefix)); } space_id = next_compaction_space_id(space_id); } // End tasks for dense prefix } -void PSParallelCompact::enqueue_chunk_stealing_tasks( +void PSParallelCompact::enqueue_region_stealing_tasks( GCTaskQueue* q, ParallelTaskTerminator* terminator_ptr, uint parallel_gc_threads) { TraceTime tm("steal task setup", print_phases(), true, gclog_or_tty); - // Once a thread has drained it's stack, it should try to steal chunks from + // Once a thread has drained it's stack, it should try to steal regions from // other threads. if (parallel_gc_threads > 1) { for (uint j = 0; j < parallel_gc_threads; j++) { - q->enqueue(new StealChunkCompactionTask(terminator_ptr)); + q->enqueue(new StealRegionCompactionTask(terminator_ptr)); } } } @@ -2510,13 +2521,13 @@ void PSParallelCompact::compact() { PSOldGen* old_gen = heap->old_gen(); old_gen->start_array()->reset(); uint parallel_gc_threads = heap->gc_task_manager()->workers(); - TaskQueueSetSuper* qset = ParCompactionManager::chunk_array(); + TaskQueueSetSuper* qset = ParCompactionManager::region_array(); ParallelTaskTerminator terminator(parallel_gc_threads, qset); GCTaskQueue* q = GCTaskQueue::create(); - enqueue_chunk_draining_tasks(q, parallel_gc_threads); + enqueue_region_draining_tasks(q, parallel_gc_threads); enqueue_dense_prefix_tasks(q, parallel_gc_threads); - enqueue_chunk_stealing_tasks(q, &terminator, parallel_gc_threads); + enqueue_region_stealing_tasks(q, &terminator, parallel_gc_threads); { TraceTime tm_pc("par compact", print_phases(), true, gclog_or_tty); @@ -2532,9 +2543,9 @@ void PSParallelCompact::compact() { WaitForBarrierGCTask::destroy(fin); #ifdef ASSERT - // Verify that all chunks have been processed before the deferred updates. + // Verify that all regions have been processed before the deferred updates. // Note that perm_space_id is skipped; this type of verification is not - // valid until the perm gen is compacted by chunks. + // valid until the perm gen is compacted by regions. for (unsigned int id = old_space_id; id < last_space_id; ++id) { verify_complete(SpaceId(id)); } @@ -2553,42 +2564,42 @@ void PSParallelCompact::compact() { #ifdef ASSERT void PSParallelCompact::verify_complete(SpaceId space_id) { - // All Chunks between space bottom() to new_top() should be marked as filled - // and all Chunks between new_top() and top() should be available (i.e., + // All Regions between space bottom() to new_top() should be marked as filled + // and all Regions between new_top() and top() should be available (i.e., // should have been emptied). ParallelCompactData& sd = summary_data(); SpaceInfo si = _space_info[space_id]; - HeapWord* new_top_addr = sd.chunk_align_up(si.new_top()); - HeapWord* old_top_addr = sd.chunk_align_up(si.space()->top()); - const size_t beg_chunk = sd.addr_to_chunk_idx(si.space()->bottom()); - const size_t new_top_chunk = sd.addr_to_chunk_idx(new_top_addr); - const size_t old_top_chunk = sd.addr_to_chunk_idx(old_top_addr); + HeapWord* new_top_addr = sd.region_align_up(si.new_top()); + HeapWord* old_top_addr = sd.region_align_up(si.space()->top()); + const size_t beg_region = sd.addr_to_region_idx(si.space()->bottom()); + const size_t new_top_region = sd.addr_to_region_idx(new_top_addr); + const size_t old_top_region = sd.addr_to_region_idx(old_top_addr); bool issued_a_warning = false; - size_t cur_chunk; - for (cur_chunk = beg_chunk; cur_chunk < new_top_chunk; ++cur_chunk) { - const ChunkData* const c = sd.chunk(cur_chunk); + size_t cur_region; + for (cur_region = beg_region; cur_region < new_top_region; ++cur_region) { + const RegionData* const c = sd.region(cur_region); if (!c->completed()) { - warning("chunk " SIZE_FORMAT " not filled: " + warning("region " SIZE_FORMAT " not filled: " "destination_count=" SIZE_FORMAT, - cur_chunk, c->destination_count()); + cur_region, c->destination_count()); issued_a_warning = true; } } - for (cur_chunk = new_top_chunk; cur_chunk < old_top_chunk; ++cur_chunk) { - const ChunkData* const c = sd.chunk(cur_chunk); + for (cur_region = new_top_region; cur_region < old_top_region; ++cur_region) { + const RegionData* const c = sd.region(cur_region); if (!c->available()) { - warning("chunk " SIZE_FORMAT " not empty: " + warning("region " SIZE_FORMAT " not empty: " "destination_count=" SIZE_FORMAT, - cur_chunk, c->destination_count()); + cur_region, c->destination_count()); issued_a_warning = true; } } if (issued_a_warning) { - print_chunk_ranges(); + print_region_ranges(); } } #endif // #ifdef ASSERT @@ -2789,46 +2800,47 @@ void PSParallelCompact::print_new_location_of_heap_address(HeapWord* q) { } #endif //VALIDATE_MARK_SWEEP -// Update interior oops in the ranges of chunks [beg_chunk, end_chunk). +// Update interior oops in the ranges of regions [beg_region, end_region). void PSParallelCompact::update_and_deadwood_in_dense_prefix(ParCompactionManager* cm, SpaceId space_id, - size_t beg_chunk, - size_t end_chunk) { + size_t beg_region, + size_t end_region) { ParallelCompactData& sd = summary_data(); ParMarkBitMap* const mbm = mark_bitmap(); - HeapWord* beg_addr = sd.chunk_to_addr(beg_chunk); - HeapWord* const end_addr = sd.chunk_to_addr(end_chunk); - assert(beg_chunk <= end_chunk, "bad chunk range"); + HeapWord* beg_addr = sd.region_to_addr(beg_region); + HeapWord* const end_addr = sd.region_to_addr(end_region); + assert(beg_region <= end_region, "bad region range"); assert(end_addr <= dense_prefix(space_id), "not in the dense prefix"); #ifdef ASSERT - // Claim the chunks to avoid triggering an assert when they are marked as + // Claim the regions to avoid triggering an assert when they are marked as // filled. - for (size_t claim_chunk = beg_chunk; claim_chunk < end_chunk; ++claim_chunk) { - assert(sd.chunk(claim_chunk)->claim_unsafe(), "claim() failed"); + for (size_t claim_region = beg_region; claim_region < end_region; ++claim_region) { + assert(sd.region(claim_region)->claim_unsafe(), "claim() failed"); } #endif // #ifdef ASSERT if (beg_addr != space(space_id)->bottom()) { // Find the first live object or block of dead space that *starts* in this - // range of chunks. If a partial object crosses onto the chunk, skip it; it - // will be marked for 'deferred update' when the object head is processed. - // If dead space crosses onto the chunk, it is also skipped; it will be - // filled when the prior chunk is processed. If neither of those apply, the - // first word in the chunk is the start of a live object or dead space. + // range of regions. If a partial object crosses onto the region, skip it; + // it will be marked for 'deferred update' when the object head is + // processed. If dead space crosses onto the region, it is also skipped; it + // will be filled when the prior region is processed. If neither of those + // apply, the first word in the region is the start of a live object or dead + // space. assert(beg_addr > space(space_id)->bottom(), "sanity"); - const ChunkData* const cp = sd.chunk(beg_chunk); + const RegionData* const cp = sd.region(beg_region); if (cp->partial_obj_size() != 0) { - beg_addr = sd.partial_obj_end(beg_chunk); + beg_addr = sd.partial_obj_end(beg_region); } else if (dead_space_crosses_boundary(cp, mbm->addr_to_bit(beg_addr))) { beg_addr = mbm->find_obj_beg(beg_addr, end_addr); } } if (beg_addr < end_addr) { - // A live object or block of dead space starts in this range of Chunks. + // A live object or block of dead space starts in this range of Regions. HeapWord* const dense_prefix_end = dense_prefix(space_id); // Create closures and iterate. @@ -2842,10 +2854,10 @@ PSParallelCompact::update_and_deadwood_in_dense_prefix(ParCompactionManager* cm, } } - // Mark the chunks as filled. - ChunkData* const beg_cp = sd.chunk(beg_chunk); - ChunkData* const end_cp = sd.chunk(end_chunk); - for (ChunkData* cp = beg_cp; cp < end_cp; ++cp) { + // Mark the regions as filled. + RegionData* const beg_cp = sd.region(beg_region); + RegionData* const end_cp = sd.region(end_region); + for (RegionData* cp = beg_cp; cp < end_cp; ++cp) { cp->set_completed(); } } @@ -2877,13 +2889,13 @@ void PSParallelCompact::update_deferred_objects(ParCompactionManager* cm, const MutableSpace* const space = space_info->space(); assert(space_info->dense_prefix() >= space->bottom(), "dense_prefix not set"); HeapWord* const beg_addr = space_info->dense_prefix(); - HeapWord* const end_addr = sd.chunk_align_up(space_info->new_top()); + HeapWord* const end_addr = sd.region_align_up(space_info->new_top()); - const ChunkData* const beg_chunk = sd.addr_to_chunk_ptr(beg_addr); - const ChunkData* const end_chunk = sd.addr_to_chunk_ptr(end_addr); - const ChunkData* cur_chunk; - for (cur_chunk = beg_chunk; cur_chunk < end_chunk; ++cur_chunk) { - HeapWord* const addr = cur_chunk->deferred_obj_addr(); + const RegionData* const beg_region = sd.addr_to_region_ptr(beg_addr); + const RegionData* const end_region = sd.addr_to_region_ptr(end_addr); + const RegionData* cur_region; + for (cur_region = beg_region; cur_region < end_region; ++cur_region) { + HeapWord* const addr = cur_region->deferred_obj_addr(); if (addr != NULL) { if (start_array != NULL) { start_array->allocate_block(addr); @@ -2929,45 +2941,45 @@ PSParallelCompact::skip_live_words(HeapWord* beg, HeapWord* end, size_t count) HeapWord* PSParallelCompact::first_src_addr(HeapWord* const dest_addr, - size_t src_chunk_idx) + size_t src_region_idx) { ParMarkBitMap* const bitmap = mark_bitmap(); const ParallelCompactData& sd = summary_data(); - const size_t ChunkSize = ParallelCompactData::ChunkSize; + const size_t RegionSize = ParallelCompactData::RegionSize; - assert(sd.is_chunk_aligned(dest_addr), "not aligned"); + assert(sd.is_region_aligned(dest_addr), "not aligned"); - const ChunkData* const src_chunk_ptr = sd.chunk(src_chunk_idx); - const size_t partial_obj_size = src_chunk_ptr->partial_obj_size(); - HeapWord* const src_chunk_destination = src_chunk_ptr->destination(); + const RegionData* const src_region_ptr = sd.region(src_region_idx); + const size_t partial_obj_size = src_region_ptr->partial_obj_size(); + HeapWord* const src_region_destination = src_region_ptr->destination(); - assert(dest_addr >= src_chunk_destination, "wrong src chunk"); - assert(src_chunk_ptr->data_size() > 0, "src chunk cannot be empty"); + assert(dest_addr >= src_region_destination, "wrong src region"); + assert(src_region_ptr->data_size() > 0, "src region cannot be empty"); - HeapWord* const src_chunk_beg = sd.chunk_to_addr(src_chunk_idx); - HeapWord* const src_chunk_end = src_chunk_beg + ChunkSize; + HeapWord* const src_region_beg = sd.region_to_addr(src_region_idx); + HeapWord* const src_region_end = src_region_beg + RegionSize; - HeapWord* addr = src_chunk_beg; - if (dest_addr == src_chunk_destination) { - // Return the first live word in the source chunk. + HeapWord* addr = src_region_beg; + if (dest_addr == src_region_destination) { + // Return the first live word in the source region. if (partial_obj_size == 0) { - addr = bitmap->find_obj_beg(addr, src_chunk_end); - assert(addr < src_chunk_end, "no objects start in src chunk"); + addr = bitmap->find_obj_beg(addr, src_region_end); + assert(addr < src_region_end, "no objects start in src region"); } return addr; } // Must skip some live data. - size_t words_to_skip = dest_addr - src_chunk_destination; - assert(src_chunk_ptr->data_size() > words_to_skip, "wrong src chunk"); + size_t words_to_skip = dest_addr - src_region_destination; + assert(src_region_ptr->data_size() > words_to_skip, "wrong src region"); if (partial_obj_size >= words_to_skip) { // All the live words to skip are part of the partial object. addr += words_to_skip; if (partial_obj_size == words_to_skip) { // Find the first live word past the partial object. - addr = bitmap->find_obj_beg(addr, src_chunk_end); - assert(addr < src_chunk_end, "wrong src chunk"); + addr = bitmap->find_obj_beg(addr, src_region_end); + assert(addr < src_region_end, "wrong src region"); } return addr; } @@ -2978,63 +2990,64 @@ PSParallelCompact::first_src_addr(HeapWord* const dest_addr, addr += partial_obj_size; } - // Skip over live words due to objects that start in the chunk. - addr = skip_live_words(addr, src_chunk_end, words_to_skip); - assert(addr < src_chunk_end, "wrong src chunk"); + // Skip over live words due to objects that start in the region. + addr = skip_live_words(addr, src_region_end, words_to_skip); + assert(addr < src_region_end, "wrong src region"); return addr; } void PSParallelCompact::decrement_destination_counts(ParCompactionManager* cm, - size_t beg_chunk, + size_t beg_region, HeapWord* end_addr) { ParallelCompactData& sd = summary_data(); - ChunkData* const beg = sd.chunk(beg_chunk); - HeapWord* const end_addr_aligned_up = sd.chunk_align_up(end_addr); - ChunkData* const end = sd.addr_to_chunk_ptr(end_addr_aligned_up); - size_t cur_idx = beg_chunk; - for (ChunkData* cur = beg; cur < end; ++cur, ++cur_idx) { - assert(cur->data_size() > 0, "chunk must have live data"); + RegionData* const beg = sd.region(beg_region); + HeapWord* const end_addr_aligned_up = sd.region_align_up(end_addr); + RegionData* const end = sd.addr_to_region_ptr(end_addr_aligned_up); + size_t cur_idx = beg_region; + for (RegionData* cur = beg; cur < end; ++cur, ++cur_idx) { + assert(cur->data_size() > 0, "region must have live data"); cur->decrement_destination_count(); - if (cur_idx <= cur->source_chunk() && cur->available() && cur->claim()) { + if (cur_idx <= cur->source_region() && cur->available() && cur->claim()) { cm->save_for_processing(cur_idx); } } } -size_t PSParallelCompact::next_src_chunk(MoveAndUpdateClosure& closure, - SpaceId& src_space_id, - HeapWord*& src_space_top, - HeapWord* end_addr) +size_t PSParallelCompact::next_src_region(MoveAndUpdateClosure& closure, + SpaceId& src_space_id, + HeapWord*& src_space_top, + HeapWord* end_addr) { - typedef ParallelCompactData::ChunkData ChunkData; + typedef ParallelCompactData::RegionData RegionData; ParallelCompactData& sd = PSParallelCompact::summary_data(); - const size_t chunk_size = ParallelCompactData::ChunkSize; + const size_t region_size = ParallelCompactData::RegionSize; - size_t src_chunk_idx = 0; + size_t src_region_idx = 0; - // Skip empty chunks (if any) up to the top of the space. - HeapWord* const src_aligned_up = sd.chunk_align_up(end_addr); - ChunkData* src_chunk_ptr = sd.addr_to_chunk_ptr(src_aligned_up); - HeapWord* const top_aligned_up = sd.chunk_align_up(src_space_top); - const ChunkData* const top_chunk_ptr = sd.addr_to_chunk_ptr(top_aligned_up); - while (src_chunk_ptr < top_chunk_ptr && src_chunk_ptr->data_size() == 0) { - ++src_chunk_ptr; + // Skip empty regions (if any) up to the top of the space. + HeapWord* const src_aligned_up = sd.region_align_up(end_addr); + RegionData* src_region_ptr = sd.addr_to_region_ptr(src_aligned_up); + HeapWord* const top_aligned_up = sd.region_align_up(src_space_top); + const RegionData* const top_region_ptr = + sd.addr_to_region_ptr(top_aligned_up); + while (src_region_ptr < top_region_ptr && src_region_ptr->data_size() == 0) { + ++src_region_ptr; } - if (src_chunk_ptr < top_chunk_ptr) { - // The next source chunk is in the current space. Update src_chunk_idx and - // the source address to match src_chunk_ptr. - src_chunk_idx = sd.chunk(src_chunk_ptr); - HeapWord* const src_chunk_addr = sd.chunk_to_addr(src_chunk_idx); - if (src_chunk_addr > closure.source()) { - closure.set_source(src_chunk_addr); + if (src_region_ptr < top_region_ptr) { + // The next source region is in the current space. Update src_region_idx + // and the source address to match src_region_ptr. + src_region_idx = sd.region(src_region_ptr); + HeapWord* const src_region_addr = sd.region_to_addr(src_region_idx); + if (src_region_addr > closure.source()) { + closure.set_source(src_region_addr); } - return src_chunk_idx; + return src_region_idx; } - // Switch to a new source space and find the first non-empty chunk. + // Switch to a new source space and find the first non-empty region. unsigned int space_id = src_space_id + 1; assert(space_id < last_space_id, "not enough spaces"); @@ -3043,14 +3056,14 @@ size_t PSParallelCompact::next_src_chunk(MoveAndUpdateClosure& closure, do { MutableSpace* space = _space_info[space_id].space(); HeapWord* const bottom = space->bottom(); - const ChunkData* const bottom_cp = sd.addr_to_chunk_ptr(bottom); + const RegionData* const bottom_cp = sd.addr_to_region_ptr(bottom); // Iterate over the spaces that do not compact into themselves. if (bottom_cp->destination() != bottom) { - HeapWord* const top_aligned_up = sd.chunk_align_up(space->top()); - const ChunkData* const top_cp = sd.addr_to_chunk_ptr(top_aligned_up); + HeapWord* const top_aligned_up = sd.region_align_up(space->top()); + const RegionData* const top_cp = sd.addr_to_region_ptr(top_aligned_up); - for (const ChunkData* src_cp = bottom_cp; src_cp < top_cp; ++src_cp) { + for (const RegionData* src_cp = bottom_cp; src_cp < top_cp; ++src_cp) { if (src_cp->live_obj_size() > 0) { // Found it. assert(src_cp->destination() == destination, @@ -3060,9 +3073,9 @@ size_t PSParallelCompact::next_src_chunk(MoveAndUpdateClosure& closure, src_space_id = SpaceId(space_id); src_space_top = space->top(); - const size_t src_chunk_idx = sd.chunk(src_cp); - closure.set_source(sd.chunk_to_addr(src_chunk_idx)); - return src_chunk_idx; + const size_t src_region_idx = sd.region(src_cp); + closure.set_source(sd.region_to_addr(src_region_idx)); + return src_region_idx; } else { assert(src_cp->data_size() == 0, "sanity"); } @@ -3070,38 +3083,38 @@ size_t PSParallelCompact::next_src_chunk(MoveAndUpdateClosure& closure, } } while (++space_id < last_space_id); - assert(false, "no source chunk was found"); + assert(false, "no source region was found"); return 0; } -void PSParallelCompact::fill_chunk(ParCompactionManager* cm, size_t chunk_idx) +void PSParallelCompact::fill_region(ParCompactionManager* cm, size_t region_idx) { typedef ParMarkBitMap::IterationStatus IterationStatus; - const size_t ChunkSize = ParallelCompactData::ChunkSize; + const size_t RegionSize = ParallelCompactData::RegionSize; ParMarkBitMap* const bitmap = mark_bitmap(); ParallelCompactData& sd = summary_data(); - ChunkData* const chunk_ptr = sd.chunk(chunk_idx); + RegionData* const region_ptr = sd.region(region_idx); // Get the items needed to construct the closure. - HeapWord* dest_addr = sd.chunk_to_addr(chunk_idx); + HeapWord* dest_addr = sd.region_to_addr(region_idx); SpaceId dest_space_id = space_id(dest_addr); ObjectStartArray* start_array = _space_info[dest_space_id].start_array(); HeapWord* new_top = _space_info[dest_space_id].new_top(); assert(dest_addr < new_top, "sanity"); - const size_t words = MIN2(pointer_delta(new_top, dest_addr), ChunkSize); + const size_t words = MIN2(pointer_delta(new_top, dest_addr), RegionSize); - // Get the source chunk and related info. - size_t src_chunk_idx = chunk_ptr->source_chunk(); - SpaceId src_space_id = space_id(sd.chunk_to_addr(src_chunk_idx)); + // Get the source region and related info. + size_t src_region_idx = region_ptr->source_region(); + SpaceId src_space_id = space_id(sd.region_to_addr(src_region_idx)); HeapWord* src_space_top = _space_info[src_space_id].space()->top(); MoveAndUpdateClosure closure(bitmap, cm, start_array, dest_addr, words); - closure.set_source(first_src_addr(dest_addr, src_chunk_idx)); + closure.set_source(first_src_addr(dest_addr, src_region_idx)); - // Adjust src_chunk_idx to prepare for decrementing destination counts (the - // destination count is not decremented when a chunk is copied to itself). - if (src_chunk_idx == chunk_idx) { - src_chunk_idx += 1; + // Adjust src_region_idx to prepare for decrementing destination counts (the + // destination count is not decremented when a region is copied to itself). + if (src_region_idx == region_idx) { + src_region_idx += 1; } if (bitmap->is_unmarked(closure.source())) { @@ -3111,32 +3124,33 @@ void PSParallelCompact::fill_chunk(ParCompactionManager* cm, size_t chunk_idx) HeapWord* const old_src_addr = closure.source(); closure.copy_partial_obj(); if (closure.is_full()) { - decrement_destination_counts(cm, src_chunk_idx, closure.source()); - chunk_ptr->set_deferred_obj_addr(NULL); - chunk_ptr->set_completed(); + decrement_destination_counts(cm, src_region_idx, closure.source()); + region_ptr->set_deferred_obj_addr(NULL); + region_ptr->set_completed(); return; } - HeapWord* const end_addr = sd.chunk_align_down(closure.source()); - if (sd.chunk_align_down(old_src_addr) != end_addr) { - // The partial object was copied from more than one source chunk. - decrement_destination_counts(cm, src_chunk_idx, end_addr); + HeapWord* const end_addr = sd.region_align_down(closure.source()); + if (sd.region_align_down(old_src_addr) != end_addr) { + // The partial object was copied from more than one source region. + decrement_destination_counts(cm, src_region_idx, end_addr); - // Move to the next source chunk, possibly switching spaces as well. All + // Move to the next source region, possibly switching spaces as well. All // args except end_addr may be modified. - src_chunk_idx = next_src_chunk(closure, src_space_id, src_space_top, - end_addr); + src_region_idx = next_src_region(closure, src_space_id, src_space_top, + end_addr); } } do { HeapWord* const cur_addr = closure.source(); - HeapWord* const end_addr = MIN2(sd.chunk_align_up(cur_addr + 1), + HeapWord* const end_addr = MIN2(sd.region_align_up(cur_addr + 1), src_space_top); IterationStatus status = bitmap->iterate(&closure, cur_addr, end_addr); if (status == ParMarkBitMap::incomplete) { - // The last obj that starts in the source chunk does not end in the chunk. + // The last obj that starts in the source region does not end in the + // region. assert(closure.source() < end_addr, "sanity") HeapWord* const obj_beg = closure.source(); HeapWord* const range_end = MIN2(obj_beg + closure.words_remaining(), @@ -3155,28 +3169,28 @@ void PSParallelCompact::fill_chunk(ParCompactionManager* cm, size_t chunk_idx) if (status == ParMarkBitMap::would_overflow) { // The last object did not fit. Note that interior oop updates were - // deferred, then copy enough of the object to fill the chunk. - chunk_ptr->set_deferred_obj_addr(closure.destination()); + // deferred, then copy enough of the object to fill the region. + region_ptr->set_deferred_obj_addr(closure.destination()); status = closure.copy_until_full(); // copies from closure.source() - decrement_destination_counts(cm, src_chunk_idx, closure.source()); - chunk_ptr->set_completed(); + decrement_destination_counts(cm, src_region_idx, closure.source()); + region_ptr->set_completed(); return; } if (status == ParMarkBitMap::full) { - decrement_destination_counts(cm, src_chunk_idx, closure.source()); - chunk_ptr->set_deferred_obj_addr(NULL); - chunk_ptr->set_completed(); + decrement_destination_counts(cm, src_region_idx, closure.source()); + region_ptr->set_deferred_obj_addr(NULL); + region_ptr->set_completed(); return; } - decrement_destination_counts(cm, src_chunk_idx, end_addr); + decrement_destination_counts(cm, src_region_idx, end_addr); - // Move to the next source chunk, possibly switching spaces as well. All + // Move to the next source region, possibly switching spaces as well. All // args except end_addr may be modified. - src_chunk_idx = next_src_chunk(closure, src_space_id, src_space_top, - end_addr); + src_region_idx = next_src_region(closure, src_space_id, src_space_top, + end_addr); } while (true); } @@ -3208,15 +3222,15 @@ PSParallelCompact::move_and_update(ParCompactionManager* cm, SpaceId space_id) { } #endif - const size_t beg_chunk = sd.addr_to_chunk_idx(beg_addr); - const size_t dp_chunk = sd.addr_to_chunk_idx(dp_addr); - if (beg_chunk < dp_chunk) { - update_and_deadwood_in_dense_prefix(cm, space_id, beg_chunk, dp_chunk); + const size_t beg_region = sd.addr_to_region_idx(beg_addr); + const size_t dp_region = sd.addr_to_region_idx(dp_addr); + if (beg_region < dp_region) { + update_and_deadwood_in_dense_prefix(cm, space_id, beg_region, dp_region); } - // The destination of the first live object that starts in the chunk is one - // past the end of the partial object entering the chunk (if any). - HeapWord* const dest_addr = sd.partial_obj_end(dp_chunk); + // The destination of the first live object that starts in the region is one + // past the end of the partial object entering the region (if any). + HeapWord* const dest_addr = sd.partial_obj_end(dp_region); HeapWord* const new_top = _space_info[space_id].new_top(); assert(new_top >= dest_addr, "bad new_top value"); const size_t words = pointer_delta(new_top, dest_addr); @@ -3327,41 +3341,41 @@ UpdateOnlyClosure::do_addr(HeapWord* addr, size_t words) { BitBlockUpdateClosure::BitBlockUpdateClosure(ParMarkBitMap* mbm, ParCompactionManager* cm, - size_t chunk_index) : + size_t region_index) : ParMarkBitMapClosure(mbm, cm), _live_data_left(0), _cur_block(0) { - _chunk_start = - PSParallelCompact::summary_data().chunk_to_addr(chunk_index); - _chunk_end = - PSParallelCompact::summary_data().chunk_to_addr(chunk_index) + - ParallelCompactData::ChunkSize; - _chunk_index = chunk_index; + _region_start = + PSParallelCompact::summary_data().region_to_addr(region_index); + _region_end = + PSParallelCompact::summary_data().region_to_addr(region_index) + + ParallelCompactData::RegionSize; + _region_index = region_index; _cur_block = - PSParallelCompact::summary_data().addr_to_block_idx(_chunk_start); + PSParallelCompact::summary_data().addr_to_block_idx(_region_start); } -bool BitBlockUpdateClosure::chunk_contains_cur_block() { - return ParallelCompactData::chunk_contains_block(_chunk_index, _cur_block); +bool BitBlockUpdateClosure::region_contains_cur_block() { + return ParallelCompactData::region_contains_block(_region_index, _cur_block); } -void BitBlockUpdateClosure::reset_chunk(size_t chunk_index) { +void BitBlockUpdateClosure::reset_region(size_t region_index) { DEBUG_ONLY(ParallelCompactData::BlockData::set_cur_phase(7);) ParallelCompactData& sd = PSParallelCompact::summary_data(); - _chunk_index = chunk_index; + _region_index = region_index; _live_data_left = 0; - _chunk_start = sd.chunk_to_addr(chunk_index); - _chunk_end = sd.chunk_to_addr(chunk_index) + ParallelCompactData::ChunkSize; + _region_start = sd.region_to_addr(region_index); + _region_end = sd.region_to_addr(region_index) + ParallelCompactData::RegionSize; - // The first block in this chunk - size_t first_block = sd.addr_to_block_idx(_chunk_start); - size_t partial_live_size = sd.chunk(chunk_index)->partial_obj_size(); + // The first block in this region + size_t first_block = sd.addr_to_block_idx(_region_start); + size_t partial_live_size = sd.region(region_index)->partial_obj_size(); // Set the offset to 0. By definition it should have that value - // but it may have been written while processing an earlier chunk. + // but it may have been written while processing an earlier region. if (partial_live_size == 0) { - // No live object extends onto the chunk. The first bit - // in the bit map for the first chunk must be a start bit. + // No live object extends onto the region. The first bit + // in the bit map for the first region must be a start bit. // Although there may not be any marked bits, it is safe // to set it as a start bit. sd.block(first_block)->set_start_bit_offset(0); @@ -3413,8 +3427,8 @@ BitBlockUpdateClosure::do_addr(HeapWord* addr, size_t words) { ParallelCompactData& sd = PSParallelCompact::summary_data(); assert(bitmap()->obj_size(obj) == words, "bad size"); - assert(_chunk_start <= obj, "object is not in chunk"); - assert(obj + words <= _chunk_end, "object is not in chunk"); + assert(_region_start <= obj, "object is not in region"); + assert(obj + words <= _region_end, "object is not in region"); // Update the live data to the left size_t prev_live_data_left = _live_data_left; @@ -3432,7 +3446,7 @@ BitBlockUpdateClosure::do_addr(HeapWord* addr, size_t words) { // the new block with the data size that does not include this object. // // The first bit in block_of_obj is a start bit except in the - // case where the partial object for the chunk extends into + // case where the partial object for the region extends into // this block. if (sd.partial_obj_ends_in_block(block_of_obj)) { sd.block(block_of_obj)->set_end_bit_offset(prev_live_data_left); @@ -3449,9 +3463,9 @@ BitBlockUpdateClosure::do_addr(HeapWord* addr, size_t words) { // The offset for blocks with no objects starting in them // (e.g., blocks between _cur_block and block_of_obj_last) // should not be needed. - // Note that block_of_obj_last may be in another chunk. If so, + // Note that block_of_obj_last may be in another region. If so, // it should be overwritten later. This is a problem (writting - // into a block in a later chunk) for parallel execution. + // into a block in a later region) for parallel execution. assert(obj < block_of_obj_last_addr, "Object should start in previous block"); @@ -3485,7 +3499,7 @@ BitBlockUpdateClosure::do_addr(HeapWord* addr, size_t words) { } // Return incomplete if there are more blocks to be done. - if (chunk_contains_cur_block()) { + if (region_contains_cur_block()) { return ParMarkBitMap::incomplete; } return ParMarkBitMap::complete; diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp index c3f1619db75..251d4ea4106 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp @@ -76,87 +76,87 @@ class ParallelCompactData { public: // Sizes are in HeapWords, unless indicated otherwise. - static const size_t Log2ChunkSize; - static const size_t ChunkSize; - static const size_t ChunkSizeBytes; + static const size_t Log2RegionSize; + static const size_t RegionSize; + static const size_t RegionSizeBytes; - // Mask for the bits in a size_t to get an offset within a chunk. - static const size_t ChunkSizeOffsetMask; - // Mask for the bits in a pointer to get an offset within a chunk. - static const size_t ChunkAddrOffsetMask; - // Mask for the bits in a pointer to get the address of the start of a chunk. - static const size_t ChunkAddrMask; + // Mask for the bits in a size_t to get an offset within a region. + static const size_t RegionSizeOffsetMask; + // Mask for the bits in a pointer to get an offset within a region. + static const size_t RegionAddrOffsetMask; + // Mask for the bits in a pointer to get the address of the start of a region. + static const size_t RegionAddrMask; static const size_t Log2BlockSize; static const size_t BlockSize; static const size_t BlockOffsetMask; static const size_t BlockMask; - static const size_t BlocksPerChunk; + static const size_t BlocksPerRegion; - class ChunkData + class RegionData { public: - // Destination address of the chunk. + // Destination address of the region. HeapWord* destination() const { return _destination; } - // The first chunk containing data destined for this chunk. - size_t source_chunk() const { return _source_chunk; } + // The first region containing data destined for this region. + size_t source_region() const { return _source_region; } - // The object (if any) starting in this chunk and ending in a different - // chunk that could not be updated during the main (parallel) compaction + // The object (if any) starting in this region and ending in a different + // region that could not be updated during the main (parallel) compaction // phase. This is different from _partial_obj_addr, which is an object that - // extends onto a source chunk. However, the two uses do not overlap in + // extends onto a source region. However, the two uses do not overlap in // time, so the same field is used to save space. HeapWord* deferred_obj_addr() const { return _partial_obj_addr; } - // The starting address of the partial object extending onto the chunk. + // The starting address of the partial object extending onto the region. HeapWord* partial_obj_addr() const { return _partial_obj_addr; } - // Size of the partial object extending onto the chunk (words). + // Size of the partial object extending onto the region (words). size_t partial_obj_size() const { return _partial_obj_size; } - // Size of live data that lies within this chunk due to objects that start - // in this chunk (words). This does not include the partial object - // extending onto the chunk (if any), or the part of an object that extends - // onto the next chunk (if any). + // Size of live data that lies within this region due to objects that start + // in this region (words). This does not include the partial object + // extending onto the region (if any), or the part of an object that extends + // onto the next region (if any). size_t live_obj_size() const { return _dc_and_los & los_mask; } - // Total live data that lies within the chunk (words). + // Total live data that lies within the region (words). size_t data_size() const { return partial_obj_size() + live_obj_size(); } - // The destination_count is the number of other chunks to which data from - // this chunk will be copied. At the end of the summary phase, the valid + // The destination_count is the number of other regions to which data from + // this region will be copied. At the end of the summary phase, the valid // values of destination_count are // - // 0 - data from the chunk will be compacted completely into itself, or the - // chunk is empty. The chunk can be claimed and then filled. - // 1 - data from the chunk will be compacted into 1 other chunk; some - // data from the chunk may also be compacted into the chunk itself. - // 2 - data from the chunk will be copied to 2 other chunks. + // 0 - data from the region will be compacted completely into itself, or the + // region is empty. The region can be claimed and then filled. + // 1 - data from the region will be compacted into 1 other region; some + // data from the region may also be compacted into the region itself. + // 2 - data from the region will be copied to 2 other regions. // - // During compaction as chunks are emptied, the destination_count is + // During compaction as regions are emptied, the destination_count is // decremented (atomically) and when it reaches 0, it can be claimed and // then filled. // - // A chunk is claimed for processing by atomically changing the - // destination_count to the claimed value (dc_claimed). After a chunk has + // A region is claimed for processing by atomically changing the + // destination_count to the claimed value (dc_claimed). After a region has // been filled, the destination_count should be set to the completed value // (dc_completed). inline uint destination_count() const; inline uint destination_count_raw() const; - // The location of the java heap data that corresponds to this chunk. + // The location of the java heap data that corresponds to this region. inline HeapWord* data_location() const; - // The highest address referenced by objects in this chunk. + // The highest address referenced by objects in this region. inline HeapWord* highest_ref() const; - // Whether this chunk is available to be claimed, has been claimed, or has + // Whether this region is available to be claimed, has been claimed, or has // been completed. // - // Minor subtlety: claimed() returns true if the chunk is marked - // completed(), which is desirable since a chunk must be claimed before it + // Minor subtlety: claimed() returns true if the region is marked + // completed(), which is desirable since a region must be claimed before it // can be completed. bool available() const { return _dc_and_los < dc_one; } bool claimed() const { return _dc_and_los >= dc_claimed; } @@ -164,11 +164,11 @@ public: // These are not atomic. void set_destination(HeapWord* addr) { _destination = addr; } - void set_source_chunk(size_t chunk) { _source_chunk = chunk; } + void set_source_region(size_t region) { _source_region = region; } void set_deferred_obj_addr(HeapWord* addr) { _partial_obj_addr = addr; } void set_partial_obj_addr(HeapWord* addr) { _partial_obj_addr = addr; } void set_partial_obj_size(size_t words) { - _partial_obj_size = (chunk_sz_t) words; + _partial_obj_size = (region_sz_t) words; } inline void set_destination_count(uint count); @@ -184,44 +184,44 @@ public: inline bool claim(); private: - // The type used to represent object sizes within a chunk. - typedef uint chunk_sz_t; + // The type used to represent object sizes within a region. + typedef uint region_sz_t; // Constants for manipulating the _dc_and_los field, which holds both the // destination count and live obj size. The live obj size lives at the // least significant end so no masking is necessary when adding. - static const chunk_sz_t dc_shift; // Shift amount. - static const chunk_sz_t dc_mask; // Mask for destination count. - static const chunk_sz_t dc_one; // 1, shifted appropriately. - static const chunk_sz_t dc_claimed; // Chunk has been claimed. - static const chunk_sz_t dc_completed; // Chunk has been completed. - static const chunk_sz_t los_mask; // Mask for live obj size. + static const region_sz_t dc_shift; // Shift amount. + static const region_sz_t dc_mask; // Mask for destination count. + static const region_sz_t dc_one; // 1, shifted appropriately. + static const region_sz_t dc_claimed; // Region has been claimed. + static const region_sz_t dc_completed; // Region has been completed. + static const region_sz_t los_mask; // Mask for live obj size. - HeapWord* _destination; - size_t _source_chunk; - HeapWord* _partial_obj_addr; - chunk_sz_t _partial_obj_size; - chunk_sz_t volatile _dc_and_los; + HeapWord* _destination; + size_t _source_region; + HeapWord* _partial_obj_addr; + region_sz_t _partial_obj_size; + region_sz_t volatile _dc_and_los; #ifdef ASSERT // These enable optimizations that are only partially implemented. Use // debug builds to prevent the code fragments from breaking. - HeapWord* _data_location; - HeapWord* _highest_ref; + HeapWord* _data_location; + HeapWord* _highest_ref; #endif // #ifdef ASSERT #ifdef ASSERT public: - uint _pushed; // 0 until chunk is pushed onto a worker's stack + uint _pushed; // 0 until region is pushed onto a worker's stack private: #endif }; // 'Blocks' allow shorter sections of the bitmap to be searched. Each Block - // holds an offset, which is the amount of live data in the Chunk to the left + // holds an offset, which is the amount of live data in the Region to the left // of the first live object in the Block. This amount of live data will // include any object extending into the block. The first block in - // a chunk does not include any partial object extending into the - // the chunk. + // a region does not include any partial object extending into the + // the region. // // The offset also encodes the // 'parity' of the first 1 bit in the Block: a positive offset means the @@ -286,27 +286,27 @@ public: ParallelCompactData(); bool initialize(MemRegion covered_region); - size_t chunk_count() const { return _chunk_count; } + size_t region_count() const { return _region_count; } - // Convert chunk indices to/from ChunkData pointers. - inline ChunkData* chunk(size_t chunk_idx) const; - inline size_t chunk(const ChunkData* const chunk_ptr) const; + // Convert region indices to/from RegionData pointers. + inline RegionData* region(size_t region_idx) const; + inline size_t region(const RegionData* const region_ptr) const; - // Returns true if the given address is contained within the chunk - bool chunk_contains(size_t chunk_index, HeapWord* addr); + // Returns true if the given address is contained within the region + bool region_contains(size_t region_index, HeapWord* addr); size_t block_count() const { return _block_count; } inline BlockData* block(size_t n) const; - // Returns true if the given block is in the given chunk. - static bool chunk_contains_block(size_t chunk_index, size_t block_index); + // Returns true if the given block is in the given region. + static bool region_contains_block(size_t region_index, size_t block_index); void add_obj(HeapWord* addr, size_t len); void add_obj(oop p, size_t len) { add_obj((HeapWord*)p, len); } - // Fill in the chunks covering [beg, end) so that no data moves; i.e., the - // destination of chunk n is simply the start of chunk n. The argument beg - // must be chunk-aligned; end need not be. + // Fill in the regions covering [beg, end) so that no data moves; i.e., the + // destination of region n is simply the start of region n. The argument beg + // must be region-aligned; end need not be. void summarize_dense_prefix(HeapWord* beg, HeapWord* end); bool summarize(HeapWord* target_beg, HeapWord* target_end, @@ -314,27 +314,27 @@ public: HeapWord** target_next, HeapWord** source_next = 0); void clear(); - void clear_range(size_t beg_chunk, size_t end_chunk); + void clear_range(size_t beg_region, size_t end_region); void clear_range(HeapWord* beg, HeapWord* end) { - clear_range(addr_to_chunk_idx(beg), addr_to_chunk_idx(end)); + clear_range(addr_to_region_idx(beg), addr_to_region_idx(end)); } - // Return the number of words between addr and the start of the chunk + // Return the number of words between addr and the start of the region // containing addr. - inline size_t chunk_offset(const HeapWord* addr) const; + inline size_t region_offset(const HeapWord* addr) const; - // Convert addresses to/from a chunk index or chunk pointer. - inline size_t addr_to_chunk_idx(const HeapWord* addr) const; - inline ChunkData* addr_to_chunk_ptr(const HeapWord* addr) const; - inline HeapWord* chunk_to_addr(size_t chunk) const; - inline HeapWord* chunk_to_addr(size_t chunk, size_t offset) const; - inline HeapWord* chunk_to_addr(const ChunkData* chunk) const; + // Convert addresses to/from a region index or region pointer. + inline size_t addr_to_region_idx(const HeapWord* addr) const; + inline RegionData* addr_to_region_ptr(const HeapWord* addr) const; + inline HeapWord* region_to_addr(size_t region) const; + inline HeapWord* region_to_addr(size_t region, size_t offset) const; + inline HeapWord* region_to_addr(const RegionData* region) const; - inline HeapWord* chunk_align_down(HeapWord* addr) const; - inline HeapWord* chunk_align_up(HeapWord* addr) const; - inline bool is_chunk_aligned(HeapWord* addr) const; + inline HeapWord* region_align_down(HeapWord* addr) const; + inline HeapWord* region_align_up(HeapWord* addr) const; + inline bool is_region_aligned(HeapWord* addr) const; - // Analogous to chunk_offset() for blocks. + // Analogous to region_offset() for blocks. size_t block_offset(const HeapWord* addr) const; size_t addr_to_block_idx(const HeapWord* addr) const; size_t addr_to_block_idx(const oop obj) const { @@ -344,7 +344,7 @@ public: inline HeapWord* block_to_addr(size_t block) const; // Return the address one past the end of the partial object. - HeapWord* partial_obj_end(size_t chunk_idx) const; + HeapWord* partial_obj_end(size_t region_idx) const; // Return the new location of the object p after the // the compaction. @@ -353,8 +353,8 @@ public: // Same as calc_new_pointer() using blocks. HeapWord* block_calc_new_pointer(HeapWord* addr); - // Same as calc_new_pointer() using chunks. - HeapWord* chunk_calc_new_pointer(HeapWord* addr); + // Same as calc_new_pointer() using regions. + HeapWord* region_calc_new_pointer(HeapWord* addr); HeapWord* calc_new_pointer(oop p) { return calc_new_pointer((HeapWord*) p); @@ -364,7 +364,7 @@ public: klassOop calc_new_klass(klassOop); // Given a block returns true if the partial object for the - // corresponding chunk ends in the block. Returns false, otherwise + // corresponding region ends in the block. Returns false, otherwise // If there is no partial object, returns false. bool partial_obj_ends_in_block(size_t block_index); @@ -378,7 +378,7 @@ public: private: bool initialize_block_data(size_t region_size); - bool initialize_chunk_data(size_t region_size); + bool initialize_region_data(size_t region_size); PSVirtualSpace* create_vspace(size_t count, size_t element_size); private: @@ -387,9 +387,9 @@ private: HeapWord* _region_end; #endif // #ifdef ASSERT - PSVirtualSpace* _chunk_vspace; - ChunkData* _chunk_data; - size_t _chunk_count; + PSVirtualSpace* _region_vspace; + RegionData* _region_data; + size_t _region_count; PSVirtualSpace* _block_vspace; BlockData* _block_data; @@ -397,64 +397,64 @@ private: }; inline uint -ParallelCompactData::ChunkData::destination_count_raw() const +ParallelCompactData::RegionData::destination_count_raw() const { return _dc_and_los & dc_mask; } inline uint -ParallelCompactData::ChunkData::destination_count() const +ParallelCompactData::RegionData::destination_count() const { return destination_count_raw() >> dc_shift; } inline void -ParallelCompactData::ChunkData::set_destination_count(uint count) +ParallelCompactData::RegionData::set_destination_count(uint count) { assert(count <= (dc_completed >> dc_shift), "count too large"); - const chunk_sz_t live_sz = (chunk_sz_t) live_obj_size(); + const region_sz_t live_sz = (region_sz_t) live_obj_size(); _dc_and_los = (count << dc_shift) | live_sz; } -inline void ParallelCompactData::ChunkData::set_live_obj_size(size_t words) +inline void ParallelCompactData::RegionData::set_live_obj_size(size_t words) { assert(words <= los_mask, "would overflow"); - _dc_and_los = destination_count_raw() | (chunk_sz_t)words; + _dc_and_los = destination_count_raw() | (region_sz_t)words; } -inline void ParallelCompactData::ChunkData::decrement_destination_count() +inline void ParallelCompactData::RegionData::decrement_destination_count() { assert(_dc_and_los < dc_claimed, "already claimed"); assert(_dc_and_los >= dc_one, "count would go negative"); Atomic::add((int)dc_mask, (volatile int*)&_dc_and_los); } -inline HeapWord* ParallelCompactData::ChunkData::data_location() const +inline HeapWord* ParallelCompactData::RegionData::data_location() const { DEBUG_ONLY(return _data_location;) NOT_DEBUG(return NULL;) } -inline HeapWord* ParallelCompactData::ChunkData::highest_ref() const +inline HeapWord* ParallelCompactData::RegionData::highest_ref() const { DEBUG_ONLY(return _highest_ref;) NOT_DEBUG(return NULL;) } -inline void ParallelCompactData::ChunkData::set_data_location(HeapWord* addr) +inline void ParallelCompactData::RegionData::set_data_location(HeapWord* addr) { DEBUG_ONLY(_data_location = addr;) } -inline void ParallelCompactData::ChunkData::set_completed() +inline void ParallelCompactData::RegionData::set_completed() { assert(claimed(), "must be claimed first"); - _dc_and_los = dc_completed | (chunk_sz_t) live_obj_size(); + _dc_and_los = dc_completed | (region_sz_t) live_obj_size(); } -// MT-unsafe claiming of a chunk. Should only be used during single threaded +// MT-unsafe claiming of a region. Should only be used during single threaded // execution. -inline bool ParallelCompactData::ChunkData::claim_unsafe() +inline bool ParallelCompactData::RegionData::claim_unsafe() { if (available()) { _dc_and_los |= dc_claimed; @@ -463,13 +463,13 @@ inline bool ParallelCompactData::ChunkData::claim_unsafe() return false; } -inline void ParallelCompactData::ChunkData::add_live_obj(size_t words) +inline void ParallelCompactData::RegionData::add_live_obj(size_t words) { assert(words <= (size_t)los_mask - live_obj_size(), "overflow"); Atomic::add((int) words, (volatile int*) &_dc_and_los); } -inline void ParallelCompactData::ChunkData::set_highest_ref(HeapWord* addr) +inline void ParallelCompactData::RegionData::set_highest_ref(HeapWord* addr) { #ifdef ASSERT HeapWord* tmp = _highest_ref; @@ -479,7 +479,7 @@ inline void ParallelCompactData::ChunkData::set_highest_ref(HeapWord* addr) #endif // #ifdef ASSERT } -inline bool ParallelCompactData::ChunkData::claim() +inline bool ParallelCompactData::RegionData::claim() { const int los = (int) live_obj_size(); const int old = Atomic::cmpxchg(dc_claimed | los, @@ -487,19 +487,19 @@ inline bool ParallelCompactData::ChunkData::claim() return old == los; } -inline ParallelCompactData::ChunkData* -ParallelCompactData::chunk(size_t chunk_idx) const +inline ParallelCompactData::RegionData* +ParallelCompactData::region(size_t region_idx) const { - assert(chunk_idx <= chunk_count(), "bad arg"); - return _chunk_data + chunk_idx; + assert(region_idx <= region_count(), "bad arg"); + return _region_data + region_idx; } inline size_t -ParallelCompactData::chunk(const ChunkData* const chunk_ptr) const +ParallelCompactData::region(const RegionData* const region_ptr) const { - assert(chunk_ptr >= _chunk_data, "bad arg"); - assert(chunk_ptr <= _chunk_data + chunk_count(), "bad arg"); - return pointer_delta(chunk_ptr, _chunk_data, sizeof(ChunkData)); + assert(region_ptr >= _region_data, "bad arg"); + assert(region_ptr <= _region_data + region_count(), "bad arg"); + return pointer_delta(region_ptr, _region_data, sizeof(RegionData)); } inline ParallelCompactData::BlockData* @@ -509,68 +509,69 @@ ParallelCompactData::block(size_t n) const { } inline size_t -ParallelCompactData::chunk_offset(const HeapWord* addr) const +ParallelCompactData::region_offset(const HeapWord* addr) const { assert(addr >= _region_start, "bad addr"); assert(addr <= _region_end, "bad addr"); - return (size_t(addr) & ChunkAddrOffsetMask) >> LogHeapWordSize; + return (size_t(addr) & RegionAddrOffsetMask) >> LogHeapWordSize; } inline size_t -ParallelCompactData::addr_to_chunk_idx(const HeapWord* addr) const +ParallelCompactData::addr_to_region_idx(const HeapWord* addr) const { assert(addr >= _region_start, "bad addr"); assert(addr <= _region_end, "bad addr"); - return pointer_delta(addr, _region_start) >> Log2ChunkSize; + return pointer_delta(addr, _region_start) >> Log2RegionSize; } -inline ParallelCompactData::ChunkData* -ParallelCompactData::addr_to_chunk_ptr(const HeapWord* addr) const +inline ParallelCompactData::RegionData* +ParallelCompactData::addr_to_region_ptr(const HeapWord* addr) const { - return chunk(addr_to_chunk_idx(addr)); + return region(addr_to_region_idx(addr)); } inline HeapWord* -ParallelCompactData::chunk_to_addr(size_t chunk) const +ParallelCompactData::region_to_addr(size_t region) const { - assert(chunk <= _chunk_count, "chunk out of range"); - return _region_start + (chunk << Log2ChunkSize); + assert(region <= _region_count, "region out of range"); + return _region_start + (region << Log2RegionSize); } inline HeapWord* -ParallelCompactData::chunk_to_addr(const ChunkData* chunk) const +ParallelCompactData::region_to_addr(const RegionData* region) const { - return chunk_to_addr(pointer_delta(chunk, _chunk_data, sizeof(ChunkData))); + return region_to_addr(pointer_delta(region, _region_data, + sizeof(RegionData))); } inline HeapWord* -ParallelCompactData::chunk_to_addr(size_t chunk, size_t offset) const +ParallelCompactData::region_to_addr(size_t region, size_t offset) const { - assert(chunk <= _chunk_count, "chunk out of range"); - assert(offset < ChunkSize, "offset too big"); // This may be too strict. - return chunk_to_addr(chunk) + offset; + assert(region <= _region_count, "region out of range"); + assert(offset < RegionSize, "offset too big"); // This may be too strict. + return region_to_addr(region) + offset; } inline HeapWord* -ParallelCompactData::chunk_align_down(HeapWord* addr) const +ParallelCompactData::region_align_down(HeapWord* addr) const { assert(addr >= _region_start, "bad addr"); - assert(addr < _region_end + ChunkSize, "bad addr"); - return (HeapWord*)(size_t(addr) & ChunkAddrMask); + assert(addr < _region_end + RegionSize, "bad addr"); + return (HeapWord*)(size_t(addr) & RegionAddrMask); } inline HeapWord* -ParallelCompactData::chunk_align_up(HeapWord* addr) const +ParallelCompactData::region_align_up(HeapWord* addr) const { assert(addr >= _region_start, "bad addr"); assert(addr <= _region_end, "bad addr"); - return chunk_align_down(addr + ChunkSizeOffsetMask); + return region_align_down(addr + RegionSizeOffsetMask); } inline bool -ParallelCompactData::is_chunk_aligned(HeapWord* addr) const +ParallelCompactData::is_region_aligned(HeapWord* addr) const { - return chunk_offset(addr) == 0; + return region_offset(addr) == 0; } inline size_t @@ -692,40 +693,39 @@ class BitBlockUpdateClosure: public ParMarkBitMapClosure { // ParallelCompactData::BlockData::blk_ofs_t _live_data_left; size_t _live_data_left; size_t _cur_block; - HeapWord* _chunk_start; - HeapWord* _chunk_end; - size_t _chunk_index; + HeapWord* _region_start; + HeapWord* _region_end; + size_t _region_index; public: BitBlockUpdateClosure(ParMarkBitMap* mbm, ParCompactionManager* cm, - size_t chunk_index); + size_t region_index); size_t cur_block() { return _cur_block; } - size_t chunk_index() { return _chunk_index; } + size_t region_index() { return _region_index; } size_t live_data_left() { return _live_data_left; } // Returns true the first bit in the current block (cur_block) is // a start bit. - // Returns true if the current block is within the chunk for the closure; - bool chunk_contains_cur_block(); + // Returns true if the current block is within the region for the closure; + bool region_contains_cur_block(); - // Set the chunk index and related chunk values for - // a new chunk. - void reset_chunk(size_t chunk_index); + // Set the region index and related region values for + // a new region. + void reset_region(size_t region_index); virtual IterationStatus do_addr(HeapWord* addr, size_t words); }; -// The UseParallelOldGC collector is a stop-the-world garbage -// collector that does parts of the collection using parallel threads. -// The collection includes the tenured generation and the young -// generation. The permanent generation is collected at the same -// time as the other two generations but the permanent generation -// is collect by a single GC thread. The permanent generation is -// collected serially because of the requirement that during the -// processing of a klass AAA, any objects reference by AAA must -// already have been processed. This requirement is enforced by -// a left (lower address) to right (higher address) sliding compaction. +// The UseParallelOldGC collector is a stop-the-world garbage collector that +// does parts of the collection using parallel threads. The collection includes +// the tenured generation and the young generation. The permanent generation is +// collected at the same time as the other two generations but the permanent +// generation is collect by a single GC thread. The permanent generation is +// collected serially because of the requirement that during the processing of a +// klass AAA, any objects reference by AAA must already have been processed. +// This requirement is enforced by a left (lower address) to right (higher +// address) sliding compaction. // // There are four phases of the collection. // @@ -740,80 +740,75 @@ class BitBlockUpdateClosure: public ParMarkBitMapClosure { // - move the objects to their destination // - update some references and reinitialize some variables // -// These three phases are invoked in PSParallelCompact::invoke_no_policy(). -// The marking phase is implemented in PSParallelCompact::marking_phase() -// and does a complete marking of the heap. -// The summary phase is implemented in PSParallelCompact::summary_phase(). -// The move and update phase is implemented in PSParallelCompact::compact(). +// These three phases are invoked in PSParallelCompact::invoke_no_policy(). The +// marking phase is implemented in PSParallelCompact::marking_phase() and does a +// complete marking of the heap. The summary phase is implemented in +// PSParallelCompact::summary_phase(). The move and update phase is implemented +// in PSParallelCompact::compact(). // -// A space that is being collected is divided into chunks and with -// each chunk is associated an object of type ParallelCompactData. -// Each chunk is of a fixed size and typically will contain more than -// 1 object and may have parts of objects at the front and back of the -// chunk. +// A space that is being collected is divided into regions and with each region +// is associated an object of type ParallelCompactData. Each region is of a +// fixed size and typically will contain more than 1 object and may have parts +// of objects at the front and back of the region. // -// chunk -----+---------------------+---------- +// region -----+---------------------+---------- // objects covered [ AAA )[ BBB )[ CCC )[ DDD ) // -// The marking phase does a complete marking of all live objects in the -// heap. The marking also compiles the size of the data for -// all live objects covered by the chunk. This size includes the -// part of any live object spanning onto the chunk (part of AAA -// if it is live) from the front, all live objects contained in the chunk -// (BBB and/or CCC if they are live), and the part of any live objects -// covered by the chunk that extends off the chunk (part of DDD if it is -// live). The marking phase uses multiple GC threads and marking is -// done in a bit array of type ParMarkBitMap. The marking of the -// bit map is done atomically as is the accumulation of the size of the -// live objects covered by a chunk. +// The marking phase does a complete marking of all live objects in the heap. +// The marking also compiles the size of the data for all live objects covered +// by the region. This size includes the part of any live object spanning onto +// the region (part of AAA if it is live) from the front, all live objects +// contained in the region (BBB and/or CCC if they are live), and the part of +// any live objects covered by the region that extends off the region (part of +// DDD if it is live). The marking phase uses multiple GC threads and marking +// is done in a bit array of type ParMarkBitMap. The marking of the bit map is +// done atomically as is the accumulation of the size of the live objects +// covered by a region. // -// The summary phase calculates the total live data to the left of -// each chunk XXX. Based on that total and the bottom of the space, -// it can calculate the starting location of the live data in XXX. -// The summary phase calculates for each chunk XXX quantites such as +// The summary phase calculates the total live data to the left of each region +// XXX. Based on that total and the bottom of the space, it can calculate the +// starting location of the live data in XXX. The summary phase calculates for +// each region XXX quantites such as // -// - the amount of live data at the beginning of a chunk from an object -// entering the chunk. -// - the location of the first live data on the chunk -// - a count of the number of chunks receiving live data from XXX. +// - the amount of live data at the beginning of a region from an object +// entering the region. +// - the location of the first live data on the region +// - a count of the number of regions receiving live data from XXX. // // See ParallelCompactData for precise details. The summary phase also -// calculates the dense prefix for the compaction. The dense prefix -// is a portion at the beginning of the space that is not moved. The -// objects in the dense prefix do need to have their object references -// updated. See method summarize_dense_prefix(). +// calculates the dense prefix for the compaction. The dense prefix is a +// portion at the beginning of the space that is not moved. The objects in the +// dense prefix do need to have their object references updated. See method +// summarize_dense_prefix(). // // The summary phase is done using 1 GC thread. // -// The compaction phase moves objects to their new location and updates -// all references in the object. +// The compaction phase moves objects to their new location and updates all +// references in the object. // -// A current exception is that objects that cross a chunk boundary -// are moved but do not have their references updated. References are -// not updated because it cannot easily be determined if the klass -// pointer KKK for the object AAA has been updated. KKK likely resides -// in a chunk to the left of the chunk containing AAA. These AAA's -// have there references updated at the end in a clean up phase. -// See the method PSParallelCompact::update_deferred_objects(). An -// alternate strategy is being investigated for this deferral of updating. -// -// Compaction is done on a chunk basis. A chunk that is ready to be -// filled is put on a ready list and GC threads take chunk off the list -// and fill them. A chunk is ready to be filled if it -// empty of live objects. Such a chunk may have been initially -// empty (only contained -// dead objects) or may have had all its live objects copied out already. -// A chunk that compacts into itself is also ready for filling. The -// ready list is initially filled with empty chunks and chunks compacting -// into themselves. There is always at least 1 chunk that can be put on -// the ready list. The chunks are atomically added and removed from -// the ready list. +// A current exception is that objects that cross a region boundary are moved +// but do not have their references updated. References are not updated because +// it cannot easily be determined if the klass pointer KKK for the object AAA +// has been updated. KKK likely resides in a region to the left of the region +// containing AAA. These AAA's have there references updated at the end in a +// clean up phase. See the method PSParallelCompact::update_deferred_objects(). +// An alternate strategy is being investigated for this deferral of updating. // +// Compaction is done on a region basis. A region that is ready to be filled is +// put on a ready list and GC threads take region off the list and fill them. A +// region is ready to be filled if it empty of live objects. Such a region may +// have been initially empty (only contained dead objects) or may have had all +// its live objects copied out already. A region that compacts into itself is +// also ready for filling. The ready list is initially filled with empty +// regions and regions compacting into themselves. There is always at least 1 +// region that can be put on the ready list. The regions are atomically added +// and removed from the ready list. + class PSParallelCompact : AllStatic { public: // Convenient access to type names. typedef ParMarkBitMap::idx_t idx_t; - typedef ParallelCompactData::ChunkData ChunkData; + typedef ParallelCompactData::RegionData RegionData; typedef ParallelCompactData::BlockData BlockData; typedef enum { @@ -977,26 +972,26 @@ class PSParallelCompact : AllStatic { // not reclaimed). static double dead_wood_limiter(double density, size_t min_percent); - // Find the first (left-most) chunk in the range [beg, end) that has at least + // Find the first (left-most) region in the range [beg, end) that has at least // dead_words of dead space to the left. The argument beg must be the first - // chunk in the space that is not completely live. - static ChunkData* dead_wood_limit_chunk(const ChunkData* beg, - const ChunkData* end, - size_t dead_words); + // region in the space that is not completely live. + static RegionData* dead_wood_limit_region(const RegionData* beg, + const RegionData* end, + size_t dead_words); - // Return a pointer to the first chunk in the range [beg, end) that is not + // Return a pointer to the first region in the range [beg, end) that is not // completely full. - static ChunkData* first_dead_space_chunk(const ChunkData* beg, - const ChunkData* end); + static RegionData* first_dead_space_region(const RegionData* beg, + const RegionData* end); // Return a value indicating the benefit or 'yield' if the compacted region // were to start (or equivalently if the dense prefix were to end) at the - // candidate chunk. Higher values are better. + // candidate region. Higher values are better. // // The value is based on the amount of space reclaimed vs. the costs of (a) // updating references in the dense prefix plus (b) copying objects and // updating references in the compacted region. - static inline double reclaimed_ratio(const ChunkData* const candidate, + static inline double reclaimed_ratio(const RegionData* const candidate, HeapWord* const bottom, HeapWord* const top, HeapWord* const new_top); @@ -1005,9 +1000,9 @@ class PSParallelCompact : AllStatic { static HeapWord* compute_dense_prefix(const SpaceId id, bool maximum_compaction); - // Return true if dead space crosses onto the specified Chunk; bit must be the - // bit index corresponding to the first word of the Chunk. - static inline bool dead_space_crosses_boundary(const ChunkData* chunk, + // Return true if dead space crosses onto the specified Region; bit must be + // the bit index corresponding to the first word of the Region. + static inline bool dead_space_crosses_boundary(const RegionData* region, idx_t bit); // Summary phase utility routine to fill dead space (if any) at the dense @@ -1038,16 +1033,16 @@ class PSParallelCompact : AllStatic { static void compact_perm(ParCompactionManager* cm); static void compact(); - // Add available chunks to the stack and draining tasks to the task queue. - static void enqueue_chunk_draining_tasks(GCTaskQueue* q, - uint parallel_gc_threads); + // Add available regions to the stack and draining tasks to the task queue. + static void enqueue_region_draining_tasks(GCTaskQueue* q, + uint parallel_gc_threads); // Add dense prefix update tasks to the task queue. static void enqueue_dense_prefix_tasks(GCTaskQueue* q, uint parallel_gc_threads); - // Add chunk stealing tasks to the task queue. - static void enqueue_chunk_stealing_tasks( + // Add region stealing tasks to the task queue. + static void enqueue_region_stealing_tasks( GCTaskQueue* q, ParallelTaskTerminator* terminator_ptr, uint parallel_gc_threads); @@ -1154,56 +1149,56 @@ class PSParallelCompact : AllStatic { // Move and update the live objects in the specified space. static void move_and_update(ParCompactionManager* cm, SpaceId space_id); - // Process the end of the given chunk range in the dense prefix. + // Process the end of the given region range in the dense prefix. // This includes saving any object not updated. - static void dense_prefix_chunks_epilogue(ParCompactionManager* cm, - size_t chunk_start_index, - size_t chunk_end_index, - idx_t exiting_object_offset, - idx_t chunk_offset_start, - idx_t chunk_offset_end); + static void dense_prefix_regions_epilogue(ParCompactionManager* cm, + size_t region_start_index, + size_t region_end_index, + idx_t exiting_object_offset, + idx_t region_offset_start, + idx_t region_offset_end); - // Update a chunk in the dense prefix. For each live object - // in the chunk, update it's interior references. For each + // Update a region in the dense prefix. For each live object + // in the region, update it's interior references. For each // dead object, fill it with deadwood. Dead space at the end - // of a chunk range will be filled to the start of the next - // live object regardless of the chunk_index_end. None of the + // of a region range will be filled to the start of the next + // live object regardless of the region_index_end. None of the // objects in the dense prefix move and dead space is dead // (holds only dead objects that don't need any processing), so // dead space can be filled in any order. static void update_and_deadwood_in_dense_prefix(ParCompactionManager* cm, SpaceId space_id, - size_t chunk_index_start, - size_t chunk_index_end); + size_t region_index_start, + size_t region_index_end); // Return the address of the count + 1st live word in the range [beg, end). static HeapWord* skip_live_words(HeapWord* beg, HeapWord* end, size_t count); // Return the address of the word to be copied to dest_addr, which must be - // aligned to a chunk boundary. + // aligned to a region boundary. static HeapWord* first_src_addr(HeapWord* const dest_addr, - size_t src_chunk_idx); + size_t src_region_idx); - // Determine the next source chunk, set closure.source() to the start of the - // new chunk return the chunk index. Parameter end_addr is the address one + // Determine the next source region, set closure.source() to the start of the + // new region return the region index. Parameter end_addr is the address one // beyond the end of source range just processed. If necessary, switch to a // new source space and set src_space_id (in-out parameter) and src_space_top // (out parameter) accordingly. - static size_t next_src_chunk(MoveAndUpdateClosure& closure, - SpaceId& src_space_id, - HeapWord*& src_space_top, - HeapWord* end_addr); + static size_t next_src_region(MoveAndUpdateClosure& closure, + SpaceId& src_space_id, + HeapWord*& src_space_top, + HeapWord* end_addr); - // Decrement the destination count for each non-empty source chunk in the - // range [beg_chunk, chunk(chunk_align_up(end_addr))). + // Decrement the destination count for each non-empty source region in the + // range [beg_region, region(region_align_up(end_addr))). static void decrement_destination_counts(ParCompactionManager* cm, - size_t beg_chunk, + size_t beg_region, HeapWord* end_addr); - // Fill a chunk, copying objects from one or more source chunks. - static void fill_chunk(ParCompactionManager* cm, size_t chunk_idx); - static void fill_and_update_chunk(ParCompactionManager* cm, size_t chunk) { - fill_chunk(cm, chunk); + // Fill a region, copying objects from one or more source regions. + static void fill_region(ParCompactionManager* cm, size_t region_idx); + static void fill_and_update_region(ParCompactionManager* cm, size_t region) { + fill_region(cm, region); } // Update the deferred objects in the space. @@ -1259,7 +1254,7 @@ class PSParallelCompact : AllStatic { #ifndef PRODUCT // Debugging support. static const char* space_names[last_space_id]; - static void print_chunk_ranges(); + static void print_region_ranges(); static void print_dense_prefix_stats(const char* const algorithm, const SpaceId id, const bool maximum_compaction, @@ -1267,7 +1262,7 @@ class PSParallelCompact : AllStatic { #endif // #ifndef PRODUCT #ifdef ASSERT - // Verify that all the chunks have been emptied. + // Verify that all the regions have been emptied. static void verify_complete(SpaceId space_id); #endif // #ifdef ASSERT }; @@ -1376,17 +1371,17 @@ inline double PSParallelCompact::normal_distribution(double density) { } inline bool -PSParallelCompact::dead_space_crosses_boundary(const ChunkData* chunk, +PSParallelCompact::dead_space_crosses_boundary(const RegionData* region, idx_t bit) { - assert(bit > 0, "cannot call this for the first bit/chunk"); - assert(_summary_data.chunk_to_addr(chunk) == _mark_bitmap.bit_to_addr(bit), + assert(bit > 0, "cannot call this for the first bit/region"); + assert(_summary_data.region_to_addr(region) == _mark_bitmap.bit_to_addr(bit), "sanity check"); // Dead space crosses the boundary if (1) a partial object does not extend - // onto the chunk, (2) an object does not start at the beginning of the chunk, - // and (3) an object does not end at the end of the prior chunk. - return chunk->partial_obj_size() == 0 && + // onto the region, (2) an object does not start at the beginning of the + // region, and (3) an object does not end at the end of the prior region. + return region->partial_obj_size() == 0 && !_mark_bitmap.is_obj_beg(bit) && !_mark_bitmap.is_obj_end(bit - 1); } diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index f07dbd15332..febed1dd1d9 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -1157,9 +1157,9 @@ class CommandLineFlags { "In the Parallel Old garbage collector use parallel dense" \ " prefix update") \ \ - develop(bool, UseParallelOldGCChunkPointerCalc, true, \ - "In the Parallel Old garbage collector use chucks to calculate" \ - " new object locations") \ + develop(bool, UseParallelOldGCRegionPointerCalc, true, \ + "In the Parallel Old garbage collector use regions to calculate" \ + "new object locations") \ \ product(uintx, HeapMaximumCompactionInterval, 20, \ "How often should we maximally compact the heap (not allowing " \ @@ -1195,8 +1195,8 @@ class CommandLineFlags { develop(bool, ParallelOldMTUnsafeUpdateLiveData, false, \ "Use the Parallel Old MT unsafe in update of live size") \ \ - develop(bool, TraceChunkTasksQueuing, false, \ - "Trace the queuing of the chunk tasks") \ + develop(bool, TraceRegionTasksQueuing, false, \ + "Trace the queuing of the region tasks") \ \ product(uintx, ParallelMarkingThreads, 0, \ "Number of marking threads concurrent gc will use") \ diff --git a/hotspot/src/share/vm/utilities/taskqueue.cpp b/hotspot/src/share/vm/utilities/taskqueue.cpp index 4a9789b53df..d5220089c5a 100644 --- a/hotspot/src/share/vm/utilities/taskqueue.cpp +++ b/hotspot/src/share/vm/utilities/taskqueue.cpp @@ -109,72 +109,72 @@ void ParallelTaskTerminator::reset_for_reuse() { } } -bool ChunkTaskQueueWithOverflow::is_empty() { - return (_chunk_queue.size() == 0) && +bool RegionTaskQueueWithOverflow::is_empty() { + return (_region_queue.size() == 0) && (_overflow_stack->length() == 0); } -bool ChunkTaskQueueWithOverflow::stealable_is_empty() { - return _chunk_queue.size() == 0; +bool RegionTaskQueueWithOverflow::stealable_is_empty() { + return _region_queue.size() == 0; } -bool ChunkTaskQueueWithOverflow::overflow_is_empty() { +bool RegionTaskQueueWithOverflow::overflow_is_empty() { return _overflow_stack->length() == 0; } -void ChunkTaskQueueWithOverflow::initialize() { - _chunk_queue.initialize(); +void RegionTaskQueueWithOverflow::initialize() { + _region_queue.initialize(); assert(_overflow_stack == 0, "Creating memory leak"); _overflow_stack = - new (ResourceObj::C_HEAP) GrowableArray(10, true); + new (ResourceObj::C_HEAP) GrowableArray(10, true); } -void ChunkTaskQueueWithOverflow::save(ChunkTask t) { - if (TraceChunkTasksQueuing && Verbose) { +void RegionTaskQueueWithOverflow::save(RegionTask t) { + if (TraceRegionTasksQueuing && Verbose) { gclog_or_tty->print_cr("CTQ: save " PTR_FORMAT, t); } - if(!_chunk_queue.push(t)) { + if(!_region_queue.push(t)) { _overflow_stack->push(t); } } -// Note that using this method will retrieve all chunks +// Note that using this method will retrieve all regions // that have been saved but that it will always check // the overflow stack. It may be more efficient to // check the stealable queue and the overflow stack // separately. -bool ChunkTaskQueueWithOverflow::retrieve(ChunkTask& chunk_task) { - bool result = retrieve_from_overflow(chunk_task); +bool RegionTaskQueueWithOverflow::retrieve(RegionTask& region_task) { + bool result = retrieve_from_overflow(region_task); if (!result) { - result = retrieve_from_stealable_queue(chunk_task); + result = retrieve_from_stealable_queue(region_task); } - if (TraceChunkTasksQueuing && Verbose && result) { + if (TraceRegionTasksQueuing && Verbose && result) { gclog_or_tty->print_cr(" CTQ: retrieve " PTR_FORMAT, result); } return result; } -bool ChunkTaskQueueWithOverflow::retrieve_from_stealable_queue( - ChunkTask& chunk_task) { - bool result = _chunk_queue.pop_local(chunk_task); - if (TraceChunkTasksQueuing && Verbose) { - gclog_or_tty->print_cr("CTQ: retrieve_stealable " PTR_FORMAT, chunk_task); +bool RegionTaskQueueWithOverflow::retrieve_from_stealable_queue( + RegionTask& region_task) { + bool result = _region_queue.pop_local(region_task); + if (TraceRegionTasksQueuing && Verbose) { + gclog_or_tty->print_cr("CTQ: retrieve_stealable " PTR_FORMAT, region_task); } return result; } -bool ChunkTaskQueueWithOverflow::retrieve_from_overflow( - ChunkTask& chunk_task) { +bool +RegionTaskQueueWithOverflow::retrieve_from_overflow(RegionTask& region_task) { bool result; if (!_overflow_stack->is_empty()) { - chunk_task = _overflow_stack->pop(); + region_task = _overflow_stack->pop(); result = true; } else { - chunk_task = (ChunkTask) NULL; + region_task = (RegionTask) NULL; result = false; } - if (TraceChunkTasksQueuing && Verbose) { - gclog_or_tty->print_cr("CTQ: retrieve_stealable " PTR_FORMAT, chunk_task); + if (TraceRegionTasksQueuing && Verbose) { + gclog_or_tty->print_cr("CTQ: retrieve_stealable " PTR_FORMAT, region_task); } return result; } diff --git a/hotspot/src/share/vm/utilities/taskqueue.hpp b/hotspot/src/share/vm/utilities/taskqueue.hpp index f949d6f6061..2323fb61c76 100644 --- a/hotspot/src/share/vm/utilities/taskqueue.hpp +++ b/hotspot/src/share/vm/utilities/taskqueue.hpp @@ -557,32 +557,32 @@ class StarTask { typedef GenericTaskQueue OopStarTaskQueue; typedef GenericTaskQueueSet OopStarTaskQueueSet; -typedef size_t ChunkTask; // index for chunk -typedef GenericTaskQueue ChunkTaskQueue; -typedef GenericTaskQueueSet ChunkTaskQueueSet; +typedef size_t RegionTask; // index for region +typedef GenericTaskQueue RegionTaskQueue; +typedef GenericTaskQueueSet RegionTaskQueueSet; -class ChunkTaskQueueWithOverflow: public CHeapObj { +class RegionTaskQueueWithOverflow: public CHeapObj { protected: - ChunkTaskQueue _chunk_queue; - GrowableArray* _overflow_stack; + RegionTaskQueue _region_queue; + GrowableArray* _overflow_stack; public: - ChunkTaskQueueWithOverflow() : _overflow_stack(NULL) {} + RegionTaskQueueWithOverflow() : _overflow_stack(NULL) {} // Initialize both stealable queue and overflow void initialize(); // Save first to stealable queue and then to overflow - void save(ChunkTask t); + void save(RegionTask t); // Retrieve first from overflow and then from stealable queue - bool retrieve(ChunkTask& chunk_index); + bool retrieve(RegionTask& region_index); // Retrieve from stealable queue - bool retrieve_from_stealable_queue(ChunkTask& chunk_index); + bool retrieve_from_stealable_queue(RegionTask& region_index); // Retrieve from overflow - bool retrieve_from_overflow(ChunkTask& chunk_index); + bool retrieve_from_overflow(RegionTask& region_index); bool is_empty(); bool stealable_is_empty(); bool overflow_is_empty(); - juint stealable_size() { return _chunk_queue.size(); } - ChunkTaskQueue* task_queue() { return &_chunk_queue; } + juint stealable_size() { return _region_queue.size(); } + RegionTaskQueue* task_queue() { return &_region_queue; } }; -#define USE_ChunkTaskQueueWithOverflow +#define USE_RegionTaskQueueWithOverflow From e98b7ce059e5b7e19a70fdf8c7e634ef736ec7ac Mon Sep 17 00:00:00 2001 From: John Coomes Date: Tue, 30 Sep 2008 13:15:27 -0700 Subject: [PATCH 025/267] 6729594: par compact - remove unused block table implementation Reviewed-by: tonyp, jmasa, apetrusenko --- .../parallelScavenge/psParallelCompact.cpp | 536 ------------------ .../parallelScavenge/psParallelCompact.hpp | 178 ------ hotspot/src/share/vm/runtime/globals.hpp | 4 - 3 files changed, 718 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp index c7150478749..a84a955f0d3 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp @@ -36,15 +36,6 @@ const size_t ParallelCompactData::RegionSizeOffsetMask = RegionSize - 1; const size_t ParallelCompactData::RegionAddrOffsetMask = RegionSizeBytes - 1; const size_t ParallelCompactData::RegionAddrMask = ~RegionAddrOffsetMask; -// 32-bit: 128 words covers 4 bitmap words -// 64-bit: 128 words covers 2 bitmap words -const size_t ParallelCompactData::Log2BlockSize = 7; // 128 words -const size_t ParallelCompactData::BlockSize = (size_t)1 << Log2BlockSize; -const size_t ParallelCompactData::BlockOffsetMask = BlockSize - 1; -const size_t ParallelCompactData::BlockMask = ~BlockOffsetMask; - -const size_t ParallelCompactData::BlocksPerRegion = RegionSize / BlockSize; - const ParallelCompactData::RegionData::region_sz_t ParallelCompactData::RegionData::dc_shift = 27; @@ -63,10 +54,6 @@ ParallelCompactData::RegionData::dc_claimed = 0x8U << dc_shift; const ParallelCompactData::RegionData::region_sz_t ParallelCompactData::RegionData::dc_completed = 0xcU << dc_shift; -#ifdef ASSERT -short ParallelCompactData::BlockData::_cur_phase = 0; -#endif - SpaceInfo PSParallelCompact::_space_info[PSParallelCompact::last_space_id]; bool PSParallelCompact::_print_phases = false; @@ -290,10 +277,6 @@ ParallelCompactData::ParallelCompactData() _region_vspace = 0; _region_data = 0; _region_count = 0; - - _block_vspace = 0; - _block_data = 0; - _block_count = 0; } bool ParallelCompactData::initialize(MemRegion covered_region) @@ -309,12 +292,6 @@ bool ParallelCompactData::initialize(MemRegion covered_region) bool result = initialize_region_data(region_size); - // Initialize the block data if it will be used for updating pointers, or if - // this is a debug build. - if (!UseParallelOldGCRegionPointerCalc || trueInDebug) { - result = result && initialize_block_data(region_size); - } - return result; } @@ -356,39 +333,16 @@ bool ParallelCompactData::initialize_region_data(size_t region_size) return false; } -bool ParallelCompactData::initialize_block_data(size_t region_size) -{ - const size_t count = (region_size + BlockOffsetMask) >> Log2BlockSize; - _block_vspace = create_vspace(count, sizeof(BlockData)); - if (_block_vspace != 0) { - _block_data = (BlockData*)_block_vspace->reserved_low_addr(); - _block_count = count; - return true; - } - return false; -} - void ParallelCompactData::clear() { - if (_block_data) { - memset(_block_data, 0, _block_vspace->committed_size()); - } memset(_region_data, 0, _region_vspace->committed_size()); } void ParallelCompactData::clear_range(size_t beg_region, size_t end_region) { assert(beg_region <= _region_count, "beg_region out of range"); assert(end_region <= _region_count, "end_region out of range"); - assert(RegionSize % BlockSize == 0, "RegionSize not a multiple of BlockSize"); const size_t region_cnt = end_region - beg_region; - - if (_block_data) { - const size_t blocks_per_region = RegionSize / BlockSize; - const size_t beg_block = beg_region * blocks_per_region; - const size_t block_cnt = region_cnt * blocks_per_region; - memset(_block_data + beg_block, 0, block_cnt * sizeof(BlockData)); - } memset(_region_data + beg_region, 0, region_cnt * sizeof(RegionData)); } @@ -565,40 +519,7 @@ bool ParallelCompactData::summarize(HeapWord* target_beg, HeapWord* target_end, return true; } -bool ParallelCompactData::partial_obj_ends_in_block(size_t block_index) { - HeapWord* block_addr = block_to_addr(block_index); - HeapWord* block_end_addr = block_addr + BlockSize; - size_t region_index = addr_to_region_idx(block_addr); - HeapWord* partial_obj_end_addr = partial_obj_end(region_index); - - // An object that ends at the end of the block, ends - // in the block (the last word of the object is to - // the left of the end). - if ((block_addr < partial_obj_end_addr) && - (partial_obj_end_addr <= block_end_addr)) { - return true; - } - - return false; -} - HeapWord* ParallelCompactData::calc_new_pointer(HeapWord* addr) { - HeapWord* result = NULL; - if (UseParallelOldGCRegionPointerCalc) { - result = region_calc_new_pointer(addr); - } else { - result = block_calc_new_pointer(addr); - } - return result; -} - -// This method is overly complicated (expensive) to be called -// for every reference. -// Try to restructure this so that a NULL is returned if -// the object is dead. But don't wast the cycles to explicitly check -// that it is dead since only live objects should be passed in. - -HeapWord* ParallelCompactData::region_calc_new_pointer(HeapWord* addr) { assert(addr != NULL, "Should detect NULL oop earlier"); assert(PSParallelCompact::gc_heap()->is_in(addr), "addr not in heap"); #ifdef ASSERT @@ -641,50 +562,6 @@ HeapWord* ParallelCompactData::region_calc_new_pointer(HeapWord* addr) { return result; } -HeapWord* ParallelCompactData::block_calc_new_pointer(HeapWord* addr) { - assert(addr != NULL, "Should detect NULL oop earlier"); - assert(PSParallelCompact::gc_heap()->is_in(addr), "addr not in heap"); -#ifdef ASSERT - if (PSParallelCompact::mark_bitmap()->is_unmarked(addr)) { - gclog_or_tty->print_cr("calc_new_pointer:: addr " PTR_FORMAT, addr); - } -#endif - assert(PSParallelCompact::mark_bitmap()->is_marked(addr), "obj not marked"); - - // Region covering the object. - size_t region_index = addr_to_region_idx(addr); - const RegionData* const region_ptr = region(region_index); - HeapWord* const region_addr = region_align_down(addr); - - assert(addr < region_addr + RegionSize, "Region does not cover object"); - assert(addr_to_region_ptr(region_addr) == region_ptr, "sanity check"); - - HeapWord* result = region_ptr->destination(); - - // If all the data in the region is live, then the new location of the object - // can be calculated from the destination of the region plus the offset of the - // object in the region. - if (region_ptr->data_size() == RegionSize) { - result += pointer_delta(addr, region_addr); - return result; - } - - // The new location of the object is - // region destination + - // block offset + - // sizes of the live objects in the Block that are to the left of addr - const size_t block_offset = addr_to_block_ptr(addr)->offset(); - HeapWord* const search_start = region_addr + block_offset; - - const ParMarkBitMap* bitmap = PSParallelCompact::mark_bitmap(); - size_t live_to_left = bitmap->live_words_in_range(search_start, oop(addr)); - - result += block_offset + live_to_left; - assert(result <= addr, "object cannot move to the right"); - assert(result == region_calc_new_pointer(addr), "Should match"); - return result; -} - klassOop ParallelCompactData::calc_new_klass(klassOop old_klass) { klassOop updated_klass; if (PSParallelCompact::should_update_klass(old_klass)) { @@ -709,7 +586,6 @@ void ParallelCompactData::verify_clear(const PSVirtualSpace* vspace) void ParallelCompactData::verify_clear() { verify_clear(_region_vspace); - verify_clear(_block_vspace); } #endif // #ifdef ASSERT @@ -1581,18 +1457,6 @@ void PSParallelCompact::summary_phase(ParCompactionManager* cm, } } - // Fill in the block data after any changes to the regions have - // been made. -#ifdef ASSERT - summarize_blocks(cm, perm_space_id); - summarize_blocks(cm, old_space_id); -#else - if (!UseParallelOldGCRegionPointerCalc) { - summarize_blocks(cm, perm_space_id); - summarize_blocks(cm, old_space_id); - } -#endif - if (TraceParallelOldGCSummaryPhase) { tty->print_cr("summary_phase: after final summarization"); Universe::print(); @@ -1603,222 +1467,6 @@ void PSParallelCompact::summary_phase(ParCompactionManager* cm, } } -// Fill in the BlockData. -// Iterate over the spaces and within each space iterate over -// the regions and fill in the BlockData for each region. - -void PSParallelCompact::summarize_blocks(ParCompactionManager* cm, - SpaceId first_compaction_space_id) { -#if 0 - DEBUG_ONLY(ParallelCompactData::BlockData::set_cur_phase(1);) - for (SpaceId cur_space_id = first_compaction_space_id; - cur_space_id != last_space_id; - cur_space_id = next_compaction_space_id(cur_space_id)) { - // Iterate over the regions in the space - size_t start_region_index = - _summary_data.addr_to_region_idx(space(cur_space_id)->bottom()); - BitBlockUpdateClosure bbu(mark_bitmap(), - cm, - start_region_index); - // Iterate over blocks. - for (size_t region_index = start_region_index; - region_index < _summary_data.region_count() && - _summary_data.region_to_addr(region_index) < - space(cur_space_id)->top(); - region_index++) { - - // Reset the closure for the new region. Note that the closure - // maintains some data that does not get reset for each region - // so a new instance of the closure is no appropriate. - bbu.reset_region(region_index); - - // Start the iteration with the first live object. This - // may return the end of the region. That is acceptable since - // it will properly limit the iterations. - ParMarkBitMap::idx_t left_offset = mark_bitmap()->addr_to_bit( - _summary_data.first_live_or_end_in_region(region_index)); - - // End the iteration at the end of the region. - HeapWord* region_addr = _summary_data.region_to_addr(region_index); - HeapWord* region_end = region_addr + ParallelCompactData::RegionSize; - ParMarkBitMap::idx_t right_offset = - mark_bitmap()->addr_to_bit(region_end); - - // Blocks that have not objects starting in them can be - // skipped because their data will never be used. - if (left_offset < right_offset) { - - // Iterate through the objects in the region. - ParMarkBitMap::idx_t last_offset = - mark_bitmap()->pair_iterate(&bbu, left_offset, right_offset); - - // If last_offset is less than right_offset, then the iterations - // terminated while it was looking for an end bit. "last_offset" - // is then the offset for the last start bit. In this situation - // the "offset" field for the next block to the right (_cur_block + 1) - // will not have been update although there may be live data - // to the left of the region. - - size_t cur_block_plus_1 = bbu.cur_block() + 1; - HeapWord* cur_block_plus_1_addr = - _summary_data.block_to_addr(bbu.cur_block()) + - ParallelCompactData::BlockSize; - HeapWord* last_offset_addr = mark_bitmap()->bit_to_addr(last_offset); - #if 1 // This code works. The else doesn't but should. Why does it? - // The current block (cur_block()) has already been updated. - // The last block that may need to be updated is either the - // next block (current block + 1) or the block where the - // last object starts (which can be greater than the - // next block if there were no objects found in intervening - // blocks). - size_t last_block = - MAX2(bbu.cur_block() + 1, - _summary_data.addr_to_block_idx(last_offset_addr)); - #else - // The current block has already been updated. The only block - // that remains to be updated is the block where the last - // object in the region starts. - size_t last_block = _summary_data.addr_to_block_idx(last_offset_addr); - #endif - assert_bit_is_start(last_offset); - assert((last_block == _summary_data.block_count()) || - (_summary_data.block(last_block)->raw_offset() == 0), - "Should not have been set"); - // Is the last block still in the current region? If still - // in this region, update the last block (the counting that - // included the current block is meant for the offset of the last - // block). If not in this region, do nothing. Should not - // update a block in the next region. - if (ParallelCompactData::region_contains_block(bbu.region_index(), - last_block)) { - if (last_offset < right_offset) { - // The last object started in this region but ends beyond - // this region. Update the block for this last object. - assert(mark_bitmap()->is_marked(last_offset), "Should be marked"); - // No end bit was found. The closure takes care of - // the cases where - // an objects crosses over into the next block - // an objects starts and ends in the next block - // It does not handle the case where an object is - // the first object in a later block and extends - // past the end of the region (i.e., the closure - // only handles complete objects that are in the range - // it is given). That object is handed back here - // for any special consideration necessary. - // - // Is the first bit in the last block a start or end bit? - // - // If the partial object ends in the last block L, - // then the 1st bit in L may be an end bit. - // - // Else does the last object start in a block after the current - // block? A block AA will already have been updated if an - // object ends in the next block AA+1. An object found to end in - // the AA+1 is the trigger that updates AA. Objects are being - // counted in the current block for updaing a following - // block. An object may start in later block - // block but may extend beyond the last block in the region. - // Updates are only done when the end of an object has been - // found. If the last object (covered by block L) starts - // beyond the current block, then no object ends in L (otherwise - // L would be the current block). So the first bit in L is - // a start bit. - // - // Else the last objects start in the current block and ends - // beyond the region. The current block has already been - // updated and there is no later block (with an object - // starting in it) that needs to be updated. - // - if (_summary_data.partial_obj_ends_in_block(last_block)) { - _summary_data.block(last_block)->set_end_bit_offset( - bbu.live_data_left()); - } else if (last_offset_addr >= cur_block_plus_1_addr) { - // The start of the object is on a later block - // (to the right of the current block and there are no - // complete live objects to the left of this last object - // within the region. - // The first bit in the block is for the start of the - // last object. - _summary_data.block(last_block)->set_start_bit_offset( - bbu.live_data_left()); - } else { - // The start of the last object was found in - // the current region (which has already - // been updated). - assert(bbu.cur_block() == - _summary_data.addr_to_block_idx(last_offset_addr), - "Should be a block already processed"); - } -#ifdef ASSERT - // Is there enough block information to find this object? - // The destination of the region has not been set so the - // values returned by calc_new_pointer() and - // block_calc_new_pointer() will only be - // offsets. But they should agree. - HeapWord* moved_obj_with_regions = - _summary_data.region_calc_new_pointer(last_offset_addr); - HeapWord* moved_obj_with_blocks = - _summary_data.calc_new_pointer(last_offset_addr); - assert(moved_obj_with_regions == moved_obj_with_blocks, - "Block calculation is wrong"); -#endif - } else if (last_block < _summary_data.block_count()) { - // Iterations ended looking for a start bit (but - // did not run off the end of the block table). - _summary_data.block(last_block)->set_start_bit_offset( - bbu.live_data_left()); - } - } -#ifdef ASSERT - // Is there enough block information to find this object? - HeapWord* left_offset_addr = mark_bitmap()->bit_to_addr(left_offset); - HeapWord* moved_obj_with_regions = - _summary_data.calc_new_pointer(left_offset_addr); - HeapWord* moved_obj_with_blocks = - _summary_data.calc_new_pointer(left_offset_addr); - assert(moved_obj_with_regions == moved_obj_with_blocks, - "Block calculation is wrong"); -#endif - - // Is there another block after the end of this region? -#ifdef ASSERT - if (last_block < _summary_data.block_count()) { - // No object may have been found in a block. If that - // block is at the end of the region, the iteration will - // terminate without incrementing the current block so - // that the current block is not the last block in the - // region. That situation precludes asserting that the - // current block is the last block in the region. Assert - // the lesser condition that the current block does not - // exceed the region. - assert(_summary_data.block_to_addr(last_block) <= - (_summary_data.region_to_addr(region_index) + - ParallelCompactData::RegionSize), - "Region and block inconsistency"); - assert(last_offset <= right_offset, "Iteration over ran end"); - } -#endif - } -#ifdef ASSERT - if (PrintGCDetails && Verbose) { - if (_summary_data.region(region_index)->partial_obj_size() == 1) { - size_t first_block = - region_index / ParallelCompactData::BlocksPerRegion; - gclog_or_tty->print_cr("first_block " PTR_FORMAT - " _offset " PTR_FORMAT - "_first_is_start_bit %d", - first_block, - _summary_data.block(first_block)->raw_offset(), - _summary_data.block(first_block)->first_is_start_bit()); - } - } -#endif - } - } - DEBUG_ONLY(ParallelCompactData::BlockData::set_cur_phase(16);) -#endif // #if 0 -} - // This method should contain all heap-specific policy for invoking a full // collection. invoke_no_policy() will only attempt to compact the heap; it // will do nothing further. If we need to bail out for policy reasons, scavenge @@ -1858,15 +1506,6 @@ bool ParallelCompactData::region_contains(size_t region_index, HeapWord* addr) { return region_index == addr_region_index; } -bool ParallelCompactData::region_contains_block(size_t region_index, - size_t block_index) { - size_t first_block_in_region = region_index * BlocksPerRegion; - size_t last_block_in_region = (region_index + 1) * BlocksPerRegion - 1; - - return (first_block_in_region <= block_index) && - (block_index <= last_block_in_region); -} - // This method contains no policy. You should probably // be calling invoke() instead. void PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) { @@ -3339,172 +2978,6 @@ UpdateOnlyClosure::do_addr(HeapWord* addr, size_t words) { return ParMarkBitMap::incomplete; } -BitBlockUpdateClosure::BitBlockUpdateClosure(ParMarkBitMap* mbm, - ParCompactionManager* cm, - size_t region_index) : - ParMarkBitMapClosure(mbm, cm), - _live_data_left(0), - _cur_block(0) { - _region_start = - PSParallelCompact::summary_data().region_to_addr(region_index); - _region_end = - PSParallelCompact::summary_data().region_to_addr(region_index) + - ParallelCompactData::RegionSize; - _region_index = region_index; - _cur_block = - PSParallelCompact::summary_data().addr_to_block_idx(_region_start); -} - -bool BitBlockUpdateClosure::region_contains_cur_block() { - return ParallelCompactData::region_contains_block(_region_index, _cur_block); -} - -void BitBlockUpdateClosure::reset_region(size_t region_index) { - DEBUG_ONLY(ParallelCompactData::BlockData::set_cur_phase(7);) - ParallelCompactData& sd = PSParallelCompact::summary_data(); - _region_index = region_index; - _live_data_left = 0; - _region_start = sd.region_to_addr(region_index); - _region_end = sd.region_to_addr(region_index) + ParallelCompactData::RegionSize; - - // The first block in this region - size_t first_block = sd.addr_to_block_idx(_region_start); - size_t partial_live_size = sd.region(region_index)->partial_obj_size(); - - // Set the offset to 0. By definition it should have that value - // but it may have been written while processing an earlier region. - if (partial_live_size == 0) { - // No live object extends onto the region. The first bit - // in the bit map for the first region must be a start bit. - // Although there may not be any marked bits, it is safe - // to set it as a start bit. - sd.block(first_block)->set_start_bit_offset(0); - sd.block(first_block)->set_first_is_start_bit(true); - } else if (sd.partial_obj_ends_in_block(first_block)) { - sd.block(first_block)->set_end_bit_offset(0); - sd.block(first_block)->set_first_is_start_bit(false); - } else { - // The partial object extends beyond the first block. - // There is no object starting in the first block - // so the offset and bit parity are not needed. - // Set the the bit parity to start bit so assertions - // work when not bit is found. - sd.block(first_block)->set_end_bit_offset(0); - sd.block(first_block)->set_first_is_start_bit(false); - } - _cur_block = first_block; -#ifdef ASSERT - if (sd.block(first_block)->first_is_start_bit()) { - assert(!sd.partial_obj_ends_in_block(first_block), - "Partial object cannot end in first block"); - } - - if (PrintGCDetails && Verbose) { - if (partial_live_size == 1) { - gclog_or_tty->print_cr("first_block " PTR_FORMAT - " _offset " PTR_FORMAT - " _first_is_start_bit %d", - first_block, - sd.block(first_block)->raw_offset(), - sd.block(first_block)->first_is_start_bit()); - } - } -#endif - DEBUG_ONLY(ParallelCompactData::BlockData::set_cur_phase(17);) -} - -// This method is called when a object has been found (both beginning -// and end of the object) in the range of iteration. This method is -// calculating the words of live data to the left of a block. That live -// data includes any object starting to the left of the block (i.e., -// the live-data-to-the-left of block AAA will include the full size -// of any object entering AAA). - -ParMarkBitMapClosure::IterationStatus -BitBlockUpdateClosure::do_addr(HeapWord* addr, size_t words) { - // add the size to the block data. - HeapWord* obj = addr; - ParallelCompactData& sd = PSParallelCompact::summary_data(); - - assert(bitmap()->obj_size(obj) == words, "bad size"); - assert(_region_start <= obj, "object is not in region"); - assert(obj + words <= _region_end, "object is not in region"); - - // Update the live data to the left - size_t prev_live_data_left = _live_data_left; - _live_data_left = _live_data_left + words; - - // Is this object in the current block. - size_t block_of_obj = sd.addr_to_block_idx(obj); - size_t block_of_obj_last = sd.addr_to_block_idx(obj + words - 1); - HeapWord* block_of_obj_last_addr = sd.block_to_addr(block_of_obj_last); - if (_cur_block < block_of_obj) { - - // - // No object crossed the block boundary and this object was found - // on the other side of the block boundary. Update the offset for - // the new block with the data size that does not include this object. - // - // The first bit in block_of_obj is a start bit except in the - // case where the partial object for the region extends into - // this block. - if (sd.partial_obj_ends_in_block(block_of_obj)) { - sd.block(block_of_obj)->set_end_bit_offset(prev_live_data_left); - } else { - sd.block(block_of_obj)->set_start_bit_offset(prev_live_data_left); - } - - // Does this object pass beyond the its block? - if (block_of_obj < block_of_obj_last) { - // Object crosses block boundary. Two blocks need to be udpated: - // the current block where the object started - // the block where the object ends - // - // The offset for blocks with no objects starting in them - // (e.g., blocks between _cur_block and block_of_obj_last) - // should not be needed. - // Note that block_of_obj_last may be in another region. If so, - // it should be overwritten later. This is a problem (writting - // into a block in a later region) for parallel execution. - assert(obj < block_of_obj_last_addr, - "Object should start in previous block"); - - // obj is crossing into block_of_obj_last so the first bit - // is and end bit. - sd.block(block_of_obj_last)->set_end_bit_offset(_live_data_left); - - _cur_block = block_of_obj_last; - } else { - // _first_is_start_bit has already been set correctly - // in the if-then-else above so don't reset it here. - _cur_block = block_of_obj; - } - } else { - // The current block only changes if the object extends beyound - // the block it starts in. - // - // The object starts in the current block. - // Does this object pass beyond the end of it? - if (block_of_obj < block_of_obj_last) { - // Object crosses block boundary. - // See note above on possible blocks between block_of_obj and - // block_of_obj_last - assert(obj < block_of_obj_last_addr, - "Object should start in previous block"); - - sd.block(block_of_obj_last)->set_end_bit_offset(_live_data_left); - - _cur_block = block_of_obj_last; - } - } - - // Return incomplete if there are more blocks to be done. - if (region_contains_cur_block()) { - return ParMarkBitMap::incomplete; - } - return ParMarkBitMap::complete; -} - // Verify the new location using the forwarding pointer // from MarkSweep::mark_sweep_phase2(). Set the mark_word // to the initial value. @@ -3577,12 +3050,3 @@ PSParallelCompact::next_compaction_space_id(SpaceId id) { return last_space_id; } } - -// Here temporarily for debugging -#ifdef ASSERT - size_t ParallelCompactData::block_idx(BlockData* block) { - size_t index = pointer_delta(block, - PSParallelCompact::summary_data()._block_data, sizeof(BlockData)); - return index; - } -#endif diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp index 251d4ea4106..7ca899956f4 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp @@ -87,13 +87,6 @@ public: // Mask for the bits in a pointer to get the address of the start of a region. static const size_t RegionAddrMask; - static const size_t Log2BlockSize; - static const size_t BlockSize; - static const size_t BlockOffsetMask; - static const size_t BlockMask; - - static const size_t BlocksPerRegion; - class RegionData { public: @@ -216,72 +209,6 @@ public: #endif }; - // 'Blocks' allow shorter sections of the bitmap to be searched. Each Block - // holds an offset, which is the amount of live data in the Region to the left - // of the first live object in the Block. This amount of live data will - // include any object extending into the block. The first block in - // a region does not include any partial object extending into the - // the region. - // - // The offset also encodes the - // 'parity' of the first 1 bit in the Block: a positive offset means the - // first 1 bit marks the start of an object, a negative offset means the first - // 1 bit marks the end of an object. - class BlockData - { - public: - typedef short int blk_ofs_t; - - blk_ofs_t offset() const { return _offset >= 0 ? _offset : -_offset; } - blk_ofs_t raw_offset() const { return _offset; } - void set_first_is_start_bit(bool v) { _first_is_start_bit = v; } - -#if 0 - // The need for this method was anticipated but it is - // never actually used. Do not include it for now. If - // it is needed, consider the problem of what is passed - // as "v". To avoid warning errors the method set_start_bit_offset() - // was changed to take a size_t as the parameter and to do the - // check for the possible overflow. Doing the cast in these - // methods better limits the potential problems because of - // the size of the field to this class. - void set_raw_offset(blk_ofs_t v) { _offset = v; } -#endif - void set_start_bit_offset(size_t val) { - assert(val >= 0, "sanity"); - _offset = (blk_ofs_t) val; - assert(val == (size_t) _offset, "Value is too large"); - _first_is_start_bit = true; - } - void set_end_bit_offset(size_t val) { - assert(val >= 0, "sanity"); - _offset = (blk_ofs_t) val; - assert(val == (size_t) _offset, "Value is too large"); - _offset = - _offset; - _first_is_start_bit = false; - } - bool first_is_start_bit() { - assert(_set_phase > 0, "Not initialized"); - return _first_is_start_bit; - } - bool first_is_end_bit() { - assert(_set_phase > 0, "Not initialized"); - return !_first_is_start_bit; - } - - private: - blk_ofs_t _offset; - // This is temporary until the mark_bitmap is separated into - // a start bit array and an end bit array. - bool _first_is_start_bit; -#ifdef ASSERT - short _set_phase; - static short _cur_phase; - public: - static void set_cur_phase(short v) { _cur_phase = v; } -#endif - }; - public: ParallelCompactData(); bool initialize(MemRegion covered_region); @@ -295,12 +222,6 @@ public: // Returns true if the given address is contained within the region bool region_contains(size_t region_index, HeapWord* addr); - size_t block_count() const { return _block_count; } - inline BlockData* block(size_t n) const; - - // Returns true if the given block is in the given region. - static bool region_contains_block(size_t region_index, size_t block_index); - void add_obj(HeapWord* addr, size_t len); void add_obj(oop p, size_t len) { add_obj((HeapWord*)p, len); } @@ -334,15 +255,6 @@ public: inline HeapWord* region_align_up(HeapWord* addr) const; inline bool is_region_aligned(HeapWord* addr) const; - // Analogous to region_offset() for blocks. - size_t block_offset(const HeapWord* addr) const; - size_t addr_to_block_idx(const HeapWord* addr) const; - size_t addr_to_block_idx(const oop obj) const { - return addr_to_block_idx((HeapWord*) obj); - } - inline BlockData* addr_to_block_ptr(const HeapWord* addr) const; - inline HeapWord* block_to_addr(size_t block) const; - // Return the address one past the end of the partial object. HeapWord* partial_obj_end(size_t region_idx) const; @@ -350,12 +262,6 @@ public: // the compaction. HeapWord* calc_new_pointer(HeapWord* addr); - // Same as calc_new_pointer() using blocks. - HeapWord* block_calc_new_pointer(HeapWord* addr); - - // Same as calc_new_pointer() using regions. - HeapWord* region_calc_new_pointer(HeapWord* addr); - HeapWord* calc_new_pointer(oop p) { return calc_new_pointer((HeapWord*) p); } @@ -363,21 +269,12 @@ public: // Return the updated address for the given klass klassOop calc_new_klass(klassOop); - // Given a block returns true if the partial object for the - // corresponding region ends in the block. Returns false, otherwise - // If there is no partial object, returns false. - bool partial_obj_ends_in_block(size_t block_index); - - // Returns the block index for the block - static size_t block_idx(BlockData* block); - #ifdef ASSERT void verify_clear(const PSVirtualSpace* vspace); void verify_clear(); #endif // #ifdef ASSERT private: - bool initialize_block_data(size_t region_size); bool initialize_region_data(size_t region_size); PSVirtualSpace* create_vspace(size_t count, size_t element_size); @@ -390,10 +287,6 @@ private: PSVirtualSpace* _region_vspace; RegionData* _region_data; size_t _region_count; - - PSVirtualSpace* _block_vspace; - BlockData* _block_data; - size_t _block_count; }; inline uint @@ -502,12 +395,6 @@ ParallelCompactData::region(const RegionData* const region_ptr) const return pointer_delta(region_ptr, _region_data, sizeof(RegionData)); } -inline ParallelCompactData::BlockData* -ParallelCompactData::block(size_t n) const { - assert(n < block_count(), "bad arg"); - return _block_data + n; -} - inline size_t ParallelCompactData::region_offset(const HeapWord* addr) const { @@ -574,35 +461,6 @@ ParallelCompactData::is_region_aligned(HeapWord* addr) const return region_offset(addr) == 0; } -inline size_t -ParallelCompactData::block_offset(const HeapWord* addr) const -{ - assert(addr >= _region_start, "bad addr"); - assert(addr <= _region_end, "bad addr"); - return pointer_delta(addr, _region_start) & BlockOffsetMask; -} - -inline size_t -ParallelCompactData::addr_to_block_idx(const HeapWord* addr) const -{ - assert(addr >= _region_start, "bad addr"); - assert(addr <= _region_end, "bad addr"); - return pointer_delta(addr, _region_start) >> Log2BlockSize; -} - -inline ParallelCompactData::BlockData* -ParallelCompactData::addr_to_block_ptr(const HeapWord* addr) const -{ - return block(addr_to_block_idx(addr)); -} - -inline HeapWord* -ParallelCompactData::block_to_addr(size_t block) const -{ - assert(block < _block_count, "block out of range"); - return _region_start + (block << Log2BlockSize); -} - // Abstract closure for use with ParMarkBitMap::iterate(), which will invoke the // do_addr() method. // @@ -688,35 +546,6 @@ inline void ParMarkBitMapClosure::decrement_words_remaining(size_t words) { _words_remaining -= words; } -// Closure for updating the block data during the summary phase. -class BitBlockUpdateClosure: public ParMarkBitMapClosure { - // ParallelCompactData::BlockData::blk_ofs_t _live_data_left; - size_t _live_data_left; - size_t _cur_block; - HeapWord* _region_start; - HeapWord* _region_end; - size_t _region_index; - - public: - BitBlockUpdateClosure(ParMarkBitMap* mbm, - ParCompactionManager* cm, - size_t region_index); - - size_t cur_block() { return _cur_block; } - size_t region_index() { return _region_index; } - size_t live_data_left() { return _live_data_left; } - // Returns true the first bit in the current block (cur_block) is - // a start bit. - // Returns true if the current block is within the region for the closure; - bool region_contains_cur_block(); - - // Set the region index and related region values for - // a new region. - void reset_region(size_t region_index); - - virtual IterationStatus do_addr(HeapWord* addr, size_t words); -}; - // The UseParallelOldGC collector is a stop-the-world garbage collector that // does parts of the collection using parallel threads. The collection includes // the tenured generation and the young generation. The permanent generation is @@ -809,7 +638,6 @@ class PSParallelCompact : AllStatic { // Convenient access to type names. typedef ParMarkBitMap::idx_t idx_t; typedef ParallelCompactData::RegionData RegionData; - typedef ParallelCompactData::BlockData BlockData; typedef enum { perm_space_id, old_space_id, eden_space_id, @@ -1014,12 +842,6 @@ class PSParallelCompact : AllStatic { static void summarize_space(SpaceId id, bool maximum_compaction); static void summary_phase(ParCompactionManager* cm, bool maximum_compaction); - static bool block_first_offset(size_t block_index, idx_t* block_offset_ptr); - - // Fill in the BlockData - static void summarize_blocks(ParCompactionManager* cm, - SpaceId first_compaction_space_id); - // The space that is compacted after space_id. static SpaceId next_compaction_space_id(SpaceId space_id); diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index febed1dd1d9..c861367c2a5 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -1157,10 +1157,6 @@ class CommandLineFlags { "In the Parallel Old garbage collector use parallel dense" \ " prefix update") \ \ - develop(bool, UseParallelOldGCRegionPointerCalc, true, \ - "In the Parallel Old garbage collector use regions to calculate" \ - "new object locations") \ - \ product(uintx, HeapMaximumCompactionInterval, 20, \ "How often should we maximally compact the heap (not allowing " \ "any dead space)") \ From 59f2891c07a46c2de60a4e7d3d02c43b450c0230 Mon Sep 17 00:00:00 2001 From: Erik Trimble Date: Wed, 1 Oct 2008 16:57:19 -0700 Subject: [PATCH 026/267] 6754998: Update Hotspot version for hs14 b06 Bump Hotspot build number to 06 Reviewed-by: jcoomes --- hotspot/make/hotspot_version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hotspot/make/hotspot_version b/hotspot/make/hotspot_version index 061bd9ebc32..efc6eb5223d 100644 --- a/hotspot/make/hotspot_version +++ b/hotspot/make/hotspot_version @@ -35,7 +35,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2008 HS_MAJOR_VER=14 HS_MINOR_VER=0 -HS_BUILD_NUMBER=05 +HS_BUILD_NUMBER=06 JDK_MAJOR_VER=1 JDK_MINOR_VER=7 From adce6fc49acc2ca3027de38999bc4fdf1cbd4690 Mon Sep 17 00:00:00 2001 From: Vladimir Kozlov Date: Thu, 2 Oct 2008 08:37:44 -0700 Subject: [PATCH 027/267] 6667595: Set probability FAIR for pre-, post- loops and ALWAYS for main loop Fix loop's probability. Add optimizations to avoid spilling. Change InlineSmallCode to product flag. Reviewed-by: never --- hotspot/src/share/vm/opto/addnode.cpp | 131 +++++++++++++++----- hotspot/src/share/vm/opto/cfgnode.cpp | 10 +- hotspot/src/share/vm/opto/cfgnode.hpp | 2 + hotspot/src/share/vm/opto/divnode.cpp | 22 ++-- hotspot/src/share/vm/opto/loopTransform.cpp | 11 +- hotspot/src/share/vm/opto/node.hpp | 3 +- hotspot/src/share/vm/opto/postaloc.cpp | 16 ++- hotspot/src/share/vm/opto/subnode.cpp | 8 ++ hotspot/src/share/vm/runtime/globals.hpp | 2 +- 9 files changed, 156 insertions(+), 49 deletions(-) diff --git a/hotspot/src/share/vm/opto/addnode.cpp b/hotspot/src/share/vm/opto/addnode.cpp index e207e65eaab..2ff10cd083d 100644 --- a/hotspot/src/share/vm/opto/addnode.cpp +++ b/hotspot/src/share/vm/opto/addnode.cpp @@ -156,7 +156,8 @@ Node *AddNode::Ideal(PhaseGVN *phase, bool can_reshape) { if( add1_op == this_op && !con_right ) { Node *a12 = add1->in(2); const Type *t12 = phase->type( a12 ); - if( t12->singleton() && t12 != Type::TOP && (add1 != add1->in(1)) ) { + if( t12->singleton() && t12 != Type::TOP && (add1 != add1->in(1)) && + !(add1->in(1)->is_Phi() && add1->in(1)->as_Phi()->is_tripcount()) ) { assert(add1->in(1) != this, "dead loop in AddNode::Ideal"); add2 = add1->clone(); add2->set_req(2, in(2)); @@ -173,7 +174,8 @@ Node *AddNode::Ideal(PhaseGVN *phase, bool can_reshape) { if( add2_op == this_op && !con_left ) { Node *a22 = add2->in(2); const Type *t22 = phase->type( a22 ); - if( t22->singleton() && t22 != Type::TOP && (add2 != add2->in(1)) ) { + if( t22->singleton() && t22 != Type::TOP && (add2 != add2->in(1)) && + !(add2->in(1)->is_Phi() && add2->in(1)->as_Phi()->is_tripcount()) ) { assert(add2->in(1) != this, "dead loop in AddNode::Ideal"); Node *addx = add2->clone(); addx->set_req(1, in(1)); @@ -225,34 +227,63 @@ const Type *AddNode::add_of_identity( const Type *t1, const Type *t2 ) const { //============================================================================= //------------------------------Idealize--------------------------------------- Node *AddINode::Ideal(PhaseGVN *phase, bool can_reshape) { - int op1 = in(1)->Opcode(); - int op2 = in(2)->Opcode(); + Node* in1 = in(1); + Node* in2 = in(2); + int op1 = in1->Opcode(); + int op2 = in2->Opcode(); // Fold (con1-x)+con2 into (con1+con2)-x + if ( op1 == Op_AddI && op2 == Op_SubI ) { + // Swap edges to try optimizations below + in1 = in2; + in2 = in(1); + op1 = op2; + op2 = in2->Opcode(); + } if( op1 == Op_SubI ) { - const Type *t_sub1 = phase->type( in(1)->in(1) ); - const Type *t_2 = phase->type( in(2) ); + const Type *t_sub1 = phase->type( in1->in(1) ); + const Type *t_2 = phase->type( in2 ); if( t_sub1->singleton() && t_2->singleton() && t_sub1 != Type::TOP && t_2 != Type::TOP ) return new (phase->C, 3) SubINode(phase->makecon( add_ring( t_sub1, t_2 ) ), - in(1)->in(2) ); + in1->in(2) ); // Convert "(a-b)+(c-d)" into "(a+c)-(b+d)" if( op2 == Op_SubI ) { // Check for dead cycle: d = (a-b)+(c-d) - assert( in(1)->in(2) != this && in(2)->in(2) != this, + assert( in1->in(2) != this && in2->in(2) != this, "dead loop in AddINode::Ideal" ); Node *sub = new (phase->C, 3) SubINode(NULL, NULL); - sub->init_req(1, phase->transform(new (phase->C, 3) AddINode(in(1)->in(1), in(2)->in(1) ) )); - sub->init_req(2, phase->transform(new (phase->C, 3) AddINode(in(1)->in(2), in(2)->in(2) ) )); + sub->init_req(1, phase->transform(new (phase->C, 3) AddINode(in1->in(1), in2->in(1) ) )); + sub->init_req(2, phase->transform(new (phase->C, 3) AddINode(in1->in(2), in2->in(2) ) )); return sub; } + // Convert "(a-b)+(b+c)" into "(a+c)" + if( op2 == Op_AddI && in1->in(2) == in2->in(1) ) { + assert(in1->in(1) != this && in2->in(2) != this,"dead loop in AddINode::Ideal"); + return new (phase->C, 3) AddINode(in1->in(1), in2->in(2)); + } + // Convert "(a-b)+(c+b)" into "(a+c)" + if( op2 == Op_AddI && in1->in(2) == in2->in(2) ) { + assert(in1->in(1) != this && in2->in(1) != this,"dead loop in AddINode::Ideal"); + return new (phase->C, 3) AddINode(in1->in(1), in2->in(1)); + } + // Convert "(a-b)+(b-c)" into "(a-c)" + if( op2 == Op_SubI && in1->in(2) == in2->in(1) ) { + assert(in1->in(1) != this && in2->in(2) != this,"dead loop in AddINode::Ideal"); + return new (phase->C, 3) SubINode(in1->in(1), in2->in(2)); + } + // Convert "(a-b)+(c-a)" into "(c-b)" + if( op2 == Op_SubI && in1->in(1) == in2->in(2) ) { + assert(in1->in(2) != this && in2->in(1) != this,"dead loop in AddINode::Ideal"); + return new (phase->C, 3) SubINode(in2->in(1), in1->in(2)); + } } // Convert "x+(0-y)" into "(x-y)" - if( op2 == Op_SubI && phase->type(in(2)->in(1)) == TypeInt::ZERO ) - return new (phase->C, 3) SubINode(in(1), in(2)->in(2) ); + if( op2 == Op_SubI && phase->type(in2->in(1)) == TypeInt::ZERO ) + return new (phase->C, 3) SubINode(in1, in2->in(2) ); // Convert "(0-y)+x" into "(x-y)" - if( op1 == Op_SubI && phase->type(in(1)->in(1)) == TypeInt::ZERO ) - return new (phase->C, 3) SubINode( in(2), in(1)->in(2) ); + if( op1 == Op_SubI && phase->type(in1->in(1)) == TypeInt::ZERO ) + return new (phase->C, 3) SubINode( in2, in1->in(2) ); // Convert (x>>>z)+y into (x+(y<>>z for small constant z and y. // Helps with array allocation math constant folding @@ -266,15 +297,15 @@ Node *AddINode::Ideal(PhaseGVN *phase, bool can_reshape) { // Have not observed cases where type information exists to support // positive y and (x <= -(y << z)) if( op1 == Op_URShiftI && op2 == Op_ConI && - in(1)->in(2)->Opcode() == Op_ConI ) { - jint z = phase->type( in(1)->in(2) )->is_int()->get_con() & 0x1f; // only least significant 5 bits matter - jint y = phase->type( in(2) )->is_int()->get_con(); + in1->in(2)->Opcode() == Op_ConI ) { + jint z = phase->type( in1->in(2) )->is_int()->get_con() & 0x1f; // only least significant 5 bits matter + jint y = phase->type( in2 )->is_int()->get_con(); if( z < 5 && -5 < y && y < 0 ) { - const Type *t_in11 = phase->type(in(1)->in(1)); + const Type *t_in11 = phase->type(in1->in(1)); if( t_in11 != Type::TOP && (t_in11->is_int()->_lo >= -(y << z)) ) { - Node *a = phase->transform( new (phase->C, 3) AddINode( in(1)->in(1), phase->intcon(y<C, 3) URShiftINode( a, in(1)->in(2) ); + Node *a = phase->transform( new (phase->C, 3) AddINode( in1->in(1), phase->intcon(y<C, 3) URShiftINode( a, in1->in(2) ); } } } @@ -328,39 +359,73 @@ const Type *AddINode::add_ring( const Type *t0, const Type *t1 ) const { //============================================================================= //------------------------------Idealize--------------------------------------- Node *AddLNode::Ideal(PhaseGVN *phase, bool can_reshape) { - int op1 = in(1)->Opcode(); - int op2 = in(2)->Opcode(); + Node* in1 = in(1); + Node* in2 = in(2); + int op1 = in1->Opcode(); + int op2 = in2->Opcode(); + // Fold (con1-x)+con2 into (con1+con2)-x + if ( op1 == Op_AddL && op2 == Op_SubL ) { + // Swap edges to try optimizations below + in1 = in2; + in2 = in(1); + op1 = op2; + op2 = in2->Opcode(); + } // Fold (con1-x)+con2 into (con1+con2)-x if( op1 == Op_SubL ) { - const Type *t_sub1 = phase->type( in(1)->in(1) ); - const Type *t_2 = phase->type( in(2) ); + const Type *t_sub1 = phase->type( in1->in(1) ); + const Type *t_2 = phase->type( in2 ); if( t_sub1->singleton() && t_2->singleton() && t_sub1 != Type::TOP && t_2 != Type::TOP ) return new (phase->C, 3) SubLNode(phase->makecon( add_ring( t_sub1, t_2 ) ), - in(1)->in(2) ); + in1->in(2) ); // Convert "(a-b)+(c-d)" into "(a+c)-(b+d)" if( op2 == Op_SubL ) { // Check for dead cycle: d = (a-b)+(c-d) - assert( in(1)->in(2) != this && in(2)->in(2) != this, + assert( in1->in(2) != this && in2->in(2) != this, "dead loop in AddLNode::Ideal" ); Node *sub = new (phase->C, 3) SubLNode(NULL, NULL); - sub->init_req(1, phase->transform(new (phase->C, 3) AddLNode(in(1)->in(1), in(2)->in(1) ) )); - sub->init_req(2, phase->transform(new (phase->C, 3) AddLNode(in(1)->in(2), in(2)->in(2) ) )); + sub->init_req(1, phase->transform(new (phase->C, 3) AddLNode(in1->in(1), in2->in(1) ) )); + sub->init_req(2, phase->transform(new (phase->C, 3) AddLNode(in1->in(2), in2->in(2) ) )); return sub; } + // Convert "(a-b)+(b+c)" into "(a+c)" + if( op2 == Op_AddL && in1->in(2) == in2->in(1) ) { + assert(in1->in(1) != this && in2->in(2) != this,"dead loop in AddLNode::Ideal"); + return new (phase->C, 3) AddLNode(in1->in(1), in2->in(2)); + } + // Convert "(a-b)+(c+b)" into "(a+c)" + if( op2 == Op_AddL && in1->in(2) == in2->in(2) ) { + assert(in1->in(1) != this && in2->in(1) != this,"dead loop in AddLNode::Ideal"); + return new (phase->C, 3) AddLNode(in1->in(1), in2->in(1)); + } + // Convert "(a-b)+(b-c)" into "(a-c)" + if( op2 == Op_SubL && in1->in(2) == in2->in(1) ) { + assert(in1->in(1) != this && in2->in(2) != this,"dead loop in AddLNode::Ideal"); + return new (phase->C, 3) SubLNode(in1->in(1), in2->in(2)); + } + // Convert "(a-b)+(c-a)" into "(c-b)" + if( op2 == Op_SubL && in1->in(1) == in1->in(2) ) { + assert(in1->in(2) != this && in2->in(1) != this,"dead loop in AddLNode::Ideal"); + return new (phase->C, 3) SubLNode(in2->in(1), in1->in(2)); + } } // Convert "x+(0-y)" into "(x-y)" - if( op2 == Op_SubL && phase->type(in(2)->in(1)) == TypeLong::ZERO ) - return new (phase->C, 3) SubLNode(in(1), in(2)->in(2) ); + if( op2 == Op_SubL && phase->type(in2->in(1)) == TypeLong::ZERO ) + return new (phase->C, 3) SubLNode( in1, in2->in(2) ); + + // Convert "(0-y)+x" into "(x-y)" + if( op1 == Op_SubL && phase->type(in1->in(1)) == TypeInt::ZERO ) + return new (phase->C, 3) SubLNode( in2, in1->in(2) ); // Convert "X+X+X+X+X...+X+Y" into "k*X+Y" or really convert "X+(X+Y)" // into "(X<<1)+Y" and let shift-folding happen. if( op2 == Op_AddL && - in(2)->in(1) == in(1) && + in2->in(1) == in1 && op1 != Op_ConL && 0 ) { - Node *shift = phase->transform(new (phase->C, 3) LShiftLNode(in(1),phase->intcon(1))); - return new (phase->C, 3) AddLNode(shift,in(2)->in(2)); + Node *shift = phase->transform(new (phase->C, 3) LShiftLNode(in1,phase->intcon(1))); + return new (phase->C, 3) AddLNode(shift,in2->in(2)); } return AddNode::Ideal(phase, can_reshape); diff --git a/hotspot/src/share/vm/opto/cfgnode.cpp b/hotspot/src/share/vm/opto/cfgnode.cpp index 60508de55b3..fdee151f1e9 100644 --- a/hotspot/src/share/vm/opto/cfgnode.cpp +++ b/hotspot/src/share/vm/opto/cfgnode.cpp @@ -1817,6 +1817,12 @@ Node *PhiNode::Ideal(PhaseGVN *phase, bool can_reshape) { return progress; // Return any progress } +//------------------------------is_tripcount----------------------------------- +bool PhiNode::is_tripcount() const { + return (in(0) != NULL && in(0)->is_CountedLoop() && + in(0)->as_CountedLoop()->phi() == this); +} + //------------------------------out_RegMask------------------------------------ const RegMask &PhiNode::in_RegMask(uint i) const { return i ? out_RegMask() : RegMask::Empty; @@ -1832,9 +1838,7 @@ const RegMask &PhiNode::out_RegMask() const { #ifndef PRODUCT void PhiNode::dump_spec(outputStream *st) const { TypeNode::dump_spec(st); - if (in(0) != NULL && - in(0)->is_CountedLoop() && - in(0)->as_CountedLoop()->phi() == this) { + if (is_tripcount()) { st->print(" #tripcount"); } } diff --git a/hotspot/src/share/vm/opto/cfgnode.hpp b/hotspot/src/share/vm/opto/cfgnode.hpp index 8fd493a308e..c902d12510a 100644 --- a/hotspot/src/share/vm/opto/cfgnode.hpp +++ b/hotspot/src/share/vm/opto/cfgnode.hpp @@ -162,6 +162,8 @@ public: return NULL; // not a copy! } + bool is_tripcount() const; + // Determine a unique non-trivial input, if any. // Ignore casts if it helps. Return NULL on failure. Node* unique_input(PhaseTransform *phase); diff --git a/hotspot/src/share/vm/opto/divnode.cpp b/hotspot/src/share/vm/opto/divnode.cpp index c1c2b5df442..a37597e05c8 100644 --- a/hotspot/src/share/vm/opto/divnode.cpp +++ b/hotspot/src/share/vm/opto/divnode.cpp @@ -110,10 +110,13 @@ static Node *transform_int_divide( PhaseGVN *phase, Node *dividend, jint divisor } else if( dividend->Opcode() == Op_AndI ) { // An AND mask of sufficient size clears the low bits and // I can avoid rounding. - const TypeInt *andconi = phase->type( dividend->in(2) )->isa_int(); - if( andconi && andconi->is_con(-d) ) { - dividend = dividend->in(1); - needs_rounding = false; + const TypeInt *andconi_t = phase->type( dividend->in(2) )->isa_int(); + if( andconi_t && andconi_t->is_con() ) { + jint andconi = andconi_t->get_con(); + if( andconi < 0 && is_power_of_2(-andconi) && (-andconi) >= d ) { + dividend = dividend->in(1); + needs_rounding = false; + } } } @@ -316,10 +319,13 @@ static Node *transform_long_divide( PhaseGVN *phase, Node *dividend, jlong divis } else if( dividend->Opcode() == Op_AndL ) { // An AND mask of sufficient size clears the low bits and // I can avoid rounding. - const TypeLong *andconl = phase->type( dividend->in(2) )->isa_long(); - if( andconl && andconl->is_con(-d)) { - dividend = dividend->in(1); - needs_rounding = false; + const TypeLong *andconl_t = phase->type( dividend->in(2) )->isa_long(); + if( andconl_t && andconl_t->is_con() ) { + jlong andconl = andconl_t->get_con(); + if( andconl < 0 && is_power_of_2_long(-andconl) && (-andconl) >= d ) { + dividend = dividend->in(1); + needs_rounding = false; + } } } diff --git a/hotspot/src/share/vm/opto/loopTransform.cpp b/hotspot/src/share/vm/opto/loopTransform.cpp index 3955f79d14e..60e21500048 100644 --- a/hotspot/src/share/vm/opto/loopTransform.cpp +++ b/hotspot/src/share/vm/opto/loopTransform.cpp @@ -679,6 +679,10 @@ void PhaseIdealLoop::insert_pre_post_loops( IdealLoopTree *loop, Node_List &old_ CountedLoopNode *post_head = old_new[main_head->_idx]->as_CountedLoop(); post_head->set_post_loop(main_head); + // Reduce the post-loop trip count. + CountedLoopEndNode* post_end = old_new[main_end ->_idx]->as_CountedLoopEnd(); + post_end->_prob = PROB_FAIR; + // Build the main-loop normal exit. IfFalseNode *new_main_exit = new (C, 1) IfFalseNode(main_end); _igvn.register_new_node_with_optimizer( new_main_exit ); @@ -748,6 +752,9 @@ void PhaseIdealLoop::insert_pre_post_loops( IdealLoopTree *loop, Node_List &old_ pre_head->set_pre_loop(main_head); Node *pre_incr = old_new[incr->_idx]; + // Reduce the pre-loop trip count. + pre_end->_prob = PROB_FAIR; + // Find the pre-loop normal exit. Node* pre_exit = pre_end->proj_out(false); assert( pre_exit->Opcode() == Op_IfFalse, "" ); @@ -767,8 +774,8 @@ void PhaseIdealLoop::insert_pre_post_loops( IdealLoopTree *loop, Node_List &old_ register_new_node( min_cmp , new_pre_exit ); register_new_node( min_bol , new_pre_exit ); - // Build the IfNode - IfNode *min_iff = new (C, 2) IfNode( new_pre_exit, min_bol, PROB_FAIR, COUNT_UNKNOWN ); + // Build the IfNode (assume the main-loop is executed always). + IfNode *min_iff = new (C, 2) IfNode( new_pre_exit, min_bol, PROB_ALWAYS, COUNT_UNKNOWN ); _igvn.register_new_node_with_optimizer( min_iff ); set_idom(min_iff, new_pre_exit, dd_main_head); set_loop(min_iff, loop->_parent); diff --git a/hotspot/src/share/vm/opto/node.hpp b/hotspot/src/share/vm/opto/node.hpp index e027265bf67..f55a403099a 100644 --- a/hotspot/src/share/vm/opto/node.hpp +++ b/hotspot/src/share/vm/opto/node.hpp @@ -1320,7 +1320,8 @@ public: Node *pop() { if( _clock_index >= size() ) _clock_index = 0; Node *b = at(_clock_index); - map( _clock_index++, Node_List::pop()); + map( _clock_index, Node_List::pop()); + if (size() != 0) _clock_index++; // Always start from 0 _in_worklist >>= b->_idx; return b; } diff --git a/hotspot/src/share/vm/opto/postaloc.cpp b/hotspot/src/share/vm/opto/postaloc.cpp index 59e6b14125d..cd881065f32 100644 --- a/hotspot/src/share/vm/opto/postaloc.cpp +++ b/hotspot/src/share/vm/opto/postaloc.cpp @@ -34,7 +34,7 @@ static bool is_single_register(uint x) { #endif } -//------------------------------may_be_copy_of_callee----------------------------- +//---------------------------may_be_copy_of_callee----------------------------- // Check to see if we can possibly be a copy of a callee-save value. bool PhaseChaitin::may_be_copy_of_callee( Node *def ) const { // Short circuit if there are no callee save registers @@ -225,6 +225,20 @@ int PhaseChaitin::elide_copy( Node *n, int k, Block *current_block, Node_List &v // Scan all registers to see if this value is around already for( uint reg = 0; reg < (uint)_max_reg; reg++ ) { + if (reg == (uint)nk_reg) { + // Found ourselves so check if there is only one user of this + // copy and keep on searching for a better copy if so. + bool ignore_self = true; + x = n->in(k); + DUIterator_Fast imax, i = x->fast_outs(imax); + Node* first = x->fast_out(i); i++; + while (i < imax && ignore_self) { + Node* use = x->fast_out(i); i++; + if (use != first) ignore_self = false; + } + if (ignore_self) continue; + } + Node *vv = value[reg]; if( !single ) { // Doubles check for aligned-adjacent pair if( (reg&1)==0 ) continue; // Wrong half of a pair diff --git a/hotspot/src/share/vm/opto/subnode.cpp b/hotspot/src/share/vm/opto/subnode.cpp index 774aff9f430..260b5dc8af8 100644 --- a/hotspot/src/share/vm/opto/subnode.cpp +++ b/hotspot/src/share/vm/opto/subnode.cpp @@ -206,6 +206,14 @@ Node *SubINode::Ideal(PhaseGVN *phase, bool can_reshape){ if( op1 == Op_AddI && op2 == Op_AddI && in1->in(2) == in2->in(2) ) return new (phase->C, 3) SubINode( in1->in(1), in2->in(1) ); + // Convert "(A+X) - (X+B)" into "A - B" + if( op1 == Op_AddI && op2 == Op_AddI && in1->in(2) == in2->in(1) ) + return new (phase->C, 3) SubINode( in1->in(1), in2->in(2) ); + + // Convert "(X+A) - (B+X)" into "A - B" + if( op1 == Op_AddI && op2 == Op_AddI && in1->in(1) == in2->in(2) ) + return new (phase->C, 3) SubINode( in1->in(2), in2->in(1) ); + // Convert "A-(B-C)" into (A+C)-B", since add is commutative and generally // nicer to optimize than subtract. if( op2 == Op_SubI && in2->outcnt() == 1) { diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index 8363919e7e1..86641c583b5 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -2557,7 +2557,7 @@ class CommandLineFlags { develop(intx, MaxRecursiveInlineLevel, 1, \ "maximum number of nested recursive calls that are inlined") \ \ - develop(intx, InlineSmallCode, 1000, \ + product(intx, InlineSmallCode, 1000, \ "Only inline already compiled methods if their code size is " \ "less than this") \ \ From 6c19542a3695f7038229ed3555fb88cc334aefaf Mon Sep 17 00:00:00 2001 From: Jon Masamitsu Date: Thu, 2 Oct 2008 12:01:08 -0700 Subject: [PATCH 028/267] 6660681: Incrementally reserve pages on win server 2003 for better large page affinity For windows server 2003 added option to reserve large pages individually. Reviewed-by: alanb, jcoomes, tonyp, apetrusenko --- hotspot/src/os/linux/vm/globals_linux.hpp | 1 + hotspot/src/os/solaris/vm/globals_solaris.hpp | 1 + hotspot/src/os/windows/vm/globals_windows.hpp | 1 + hotspot/src/os/windows/vm/os_windows.cpp | 118 +++++++++++++++++- hotspot/src/os/windows/vm/os_windows.hpp | 4 + hotspot/src/share/vm/runtime/globals.hpp | 6 + 6 files changed, 126 insertions(+), 5 deletions(-) diff --git a/hotspot/src/os/linux/vm/globals_linux.hpp b/hotspot/src/os/linux/vm/globals_linux.hpp index e22b84b0f92..9c4482ab927 100644 --- a/hotspot/src/os/linux/vm/globals_linux.hpp +++ b/hotspot/src/os/linux/vm/globals_linux.hpp @@ -38,5 +38,6 @@ // platforms, but they may have different default values on other platforms. // define_pd_global(bool, UseLargePages, false); +define_pd_global(bool, UseLargePagesIndividualAllocation, false); define_pd_global(bool, UseOSErrorReporting, false); define_pd_global(bool, UseThreadPriorities, true) ; diff --git a/hotspot/src/os/solaris/vm/globals_solaris.hpp b/hotspot/src/os/solaris/vm/globals_solaris.hpp index 8f00adbe2a3..85fcc8c8752 100644 --- a/hotspot/src/os/solaris/vm/globals_solaris.hpp +++ b/hotspot/src/os/solaris/vm/globals_solaris.hpp @@ -44,5 +44,6 @@ // platforms, but they may have different default values on other platforms. // define_pd_global(bool, UseLargePages, true); +define_pd_global(bool, UseLargePagesIndividualAllocation, false); define_pd_global(bool, UseOSErrorReporting, false); define_pd_global(bool, UseThreadPriorities, false); diff --git a/hotspot/src/os/windows/vm/globals_windows.hpp b/hotspot/src/os/windows/vm/globals_windows.hpp index 228c69c84c0..b5b6ef870d3 100644 --- a/hotspot/src/os/windows/vm/globals_windows.hpp +++ b/hotspot/src/os/windows/vm/globals_windows.hpp @@ -37,5 +37,6 @@ // platforms, but they may have different default values on other platforms. // define_pd_global(bool, UseLargePages, false); +define_pd_global(bool, UseLargePagesIndividualAllocation, true); define_pd_global(bool, UseOSErrorReporting, false); // for now. define_pd_global(bool, UseThreadPriorities, true) ; diff --git a/hotspot/src/os/windows/vm/os_windows.cpp b/hotspot/src/os/windows/vm/os_windows.cpp index d74a4aff571..bc86280bd87 100644 --- a/hotspot/src/os/windows/vm/os_windows.cpp +++ b/hotspot/src/os/windows/vm/os_windows.cpp @@ -2593,9 +2593,104 @@ bool os::can_execute_large_page_memory() { } char* os::reserve_memory_special(size_t bytes) { - DWORD flag = MEM_RESERVE | MEM_COMMIT | MEM_LARGE_PAGES; - char * res = (char *)VirtualAlloc(NULL, bytes, flag, PAGE_EXECUTE_READWRITE); - return res; + + if (UseLargePagesIndividualAllocation) { + if (TracePageSizes && Verbose) { + tty->print_cr("Reserving large pages individually."); + } + char * p_buf; + // first reserve enough address space in advance since we want to be + // able to break a single contiguous virtual address range into multiple + // large page commits but WS2003 does not allow reserving large page space + // so we just use 4K pages for reserve, this gives us a legal contiguous + // address space. then we will deallocate that reservation, and re alloc + // using large pages + const size_t size_of_reserve = bytes + _large_page_size; + if (bytes > size_of_reserve) { + // Overflowed. + warning("Individually allocated large pages failed, " + "use -XX:-UseLargePagesIndividualAllocation to turn off"); + return NULL; + } + p_buf = (char *) VirtualAlloc(NULL, + size_of_reserve, // size of Reserve + MEM_RESERVE, + PAGE_EXECUTE_READWRITE); + // If reservation failed, return NULL + if (p_buf == NULL) return NULL; + + release_memory(p_buf, bytes + _large_page_size); + // round up to page boundary. If the size_of_reserve did not + // overflow and the reservation did not fail, this align up + // should not overflow. + p_buf = (char *) align_size_up((size_t)p_buf, _large_page_size); + + // now go through and allocate one page at a time until all bytes are + // allocated + size_t bytes_remaining = align_size_up(bytes, _large_page_size); + // An overflow of align_size_up() would have been caught above + // in the calculation of size_of_reserve. + char * next_alloc_addr = p_buf; + +#ifdef ASSERT + // Variable for the failure injection + long ran_num = os::random(); + size_t fail_after = ran_num % bytes; +#endif + + while (bytes_remaining) { + size_t bytes_to_rq = MIN2(bytes_remaining, _large_page_size); + // Note allocate and commit + char * p_new; + +#ifdef ASSERT + bool inject_error = LargePagesIndividualAllocationInjectError && + (bytes_remaining <= fail_after); +#else + const bool inject_error = false; +#endif + + if (inject_error) { + p_new = NULL; + } else { + p_new = (char *) VirtualAlloc(next_alloc_addr, + bytes_to_rq, + MEM_RESERVE | MEM_COMMIT | MEM_LARGE_PAGES, + PAGE_EXECUTE_READWRITE); + } + + if (p_new == NULL) { + // Free any allocated pages + if (next_alloc_addr > p_buf) { + // Some memory was committed so release it. + size_t bytes_to_release = bytes - bytes_remaining; + release_memory(p_buf, bytes_to_release); + } +#ifdef ASSERT + if (UseLargePagesIndividualAllocation && + LargePagesIndividualAllocationInjectError) { + if (TracePageSizes && Verbose) { + tty->print_cr("Reserving large pages individually failed."); + } + } +#endif + return NULL; + } + bytes_remaining -= bytes_to_rq; + next_alloc_addr += bytes_to_rq; + } + + return p_buf; + + } else { + // normal policy just allocate it all at once + DWORD flag = MEM_RESERVE | MEM_COMMIT | MEM_LARGE_PAGES; + char * res = (char *)VirtualAlloc(NULL, + bytes, + flag, + PAGE_EXECUTE_READWRITE); + return res; + } } bool os::release_memory_special(char* base, size_t bytes) { @@ -2983,6 +3078,7 @@ size_t os::win32::_default_stack_size = 0; volatile intx os::win32::_os_thread_count = 0; bool os::win32::_is_nt = false; +bool os::win32::_is_windows_2003 = false; void os::win32::initialize_system_info() { @@ -3005,7 +3101,15 @@ void os::win32::initialize_system_info() { GetVersionEx(&oi); switch(oi.dwPlatformId) { case VER_PLATFORM_WIN32_WINDOWS: _is_nt = false; break; - case VER_PLATFORM_WIN32_NT: _is_nt = true; break; + case VER_PLATFORM_WIN32_NT: + _is_nt = true; + { + int os_vers = oi.dwMajorVersion * 1000 + oi.dwMinorVersion; + if (os_vers == 5002) { + _is_windows_2003 = true; + } + } + break; default: fatal("Unknown platform"); } @@ -3103,9 +3207,13 @@ void os::init(void) { NoYieldsInMicrolock = true; } #endif + // This may be overridden later when argument processing is done. + FLAG_SET_ERGO(bool, UseLargePagesIndividualAllocation, + os::win32::is_windows_2003()); + // Initialize main_process and main_thread main_process = GetCurrentProcess(); // Remember main_process is a pseudo handle - if (!DuplicateHandle(main_process, GetCurrentThread(), main_process, + if (!DuplicateHandle(main_process, GetCurrentThread(), main_process, &main_thread, THREAD_ALL_ACCESS, false, 0)) { fatal("DuplicateHandle failed\n"); } diff --git a/hotspot/src/os/windows/vm/os_windows.hpp b/hotspot/src/os/windows/vm/os_windows.hpp index 8a66e3c6374..9b5a0301a08 100644 --- a/hotspot/src/os/windows/vm/os_windows.hpp +++ b/hotspot/src/os/windows/vm/os_windows.hpp @@ -34,6 +34,7 @@ class win32 { static julong _physical_memory; static size_t _default_stack_size; static bool _is_nt; + static bool _is_windows_2003; public: // Windows-specific interface: @@ -60,6 +61,9 @@ class win32 { // Tells whether the platform is NT or Windown95 static bool is_nt() { return _is_nt; } + // Tells whether the platform is Windows 2003 + static bool is_windows_2003() { return _is_windows_2003; } + // Returns the byte size of a virtual memory page static int vm_page_size() { return _vm_page_size; } diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index 73a337c2070..a0ef55da23a 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -330,6 +330,12 @@ class CommandLineFlags { product_pd(bool, UseLargePages, \ "Use large page memory") \ \ + product_pd(bool, UseLargePagesIndividualAllocation, \ + "Allocate large pages individually for better affinity") \ + \ + develop(bool, LargePagesIndividualAllocationInjectError, false, \ + "Fail large pages individual allocation") \ + \ develop(bool, TracePageSizes, false, \ "Trace page size selection and usage.") \ \ From b089627fe8f39f3a44f547e4f1dbfca328427709 Mon Sep 17 00:00:00 2001 From: Erik Trimble Date: Thu, 2 Oct 2008 14:11:33 -0700 Subject: [PATCH 029/267] 6755406: minor mistakes in copyright notices Mismatch in some header copyrights from standard templates Reviewed-by: jcoomes --- hotspot/make/hotspot_distro | 4 ++-- hotspot/test/compiler/6646019/Test.java | 1 - hotspot/test/compiler/6689060/Test.java | 1 - hotspot/test/compiler/6695810/Test.java | 1 - 4 files changed, 2 insertions(+), 5 deletions(-) diff --git a/hotspot/make/hotspot_distro b/hotspot/make/hotspot_distro index ab698d37c4e..51bad9748eb 100644 --- a/hotspot/make/hotspot_distro +++ b/hotspot/make/hotspot_distro @@ -1,4 +1,4 @@ -# +# # Copyright 2006-2008 Sun Microsystems, Inc. All Rights Reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # @@ -19,7 +19,7 @@ # 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. -# +# # # This file format must remain compatible with both diff --git a/hotspot/test/compiler/6646019/Test.java b/hotspot/test/compiler/6646019/Test.java index 99c07617e04..f28d0a05036 100644 --- a/hotspot/test/compiler/6646019/Test.java +++ b/hotspot/test/compiler/6646019/Test.java @@ -19,7 +19,6 @@ * 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. - * */ /* diff --git a/hotspot/test/compiler/6689060/Test.java b/hotspot/test/compiler/6689060/Test.java index 4d3f2003baa..ba42667a815 100644 --- a/hotspot/test/compiler/6689060/Test.java +++ b/hotspot/test/compiler/6689060/Test.java @@ -19,7 +19,6 @@ * 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. - * */ /* diff --git a/hotspot/test/compiler/6695810/Test.java b/hotspot/test/compiler/6695810/Test.java index f59db440083..a8f2ea0c80e 100644 --- a/hotspot/test/compiler/6695810/Test.java +++ b/hotspot/test/compiler/6695810/Test.java @@ -19,7 +19,6 @@ * 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. - * */ /* From 043fde10e58cc03e343e4be171a47c6e94146245 Mon Sep 17 00:00:00 2001 From: Tom Rodriguez Date: Fri, 3 Oct 2008 13:58:20 -0700 Subject: [PATCH 030/267] 6743188: incomplete fix for 6700047 C2 failed in idom_no_update Reviewed-by: rasbold, kvn --- hotspot/src/share/vm/opto/loopTransform.cpp | 31 ++++++++++++------- hotspot/src/share/vm/opto/loopnode.hpp | 12 ++++--- hotspot/src/share/vm/opto/loopopts.cpp | 3 -- .../test/compiler/6700047/Test6700047.java | 3 ++ 4 files changed, 29 insertions(+), 20 deletions(-) diff --git a/hotspot/src/share/vm/opto/loopTransform.cpp b/hotspot/src/share/vm/opto/loopTransform.cpp index 60e21500048..f1c15b08344 100644 --- a/hotspot/src/share/vm/opto/loopTransform.cpp +++ b/hotspot/src/share/vm/opto/loopTransform.cpp @@ -1590,10 +1590,10 @@ bool IdealLoopTree::policy_do_remove_empty_loop( PhaseIdealLoop *phase ) { //============================================================================= //------------------------------iteration_split_impl--------------------------- -void IdealLoopTree::iteration_split_impl( PhaseIdealLoop *phase, Node_List &old_new ) { +bool IdealLoopTree::iteration_split_impl( PhaseIdealLoop *phase, Node_List &old_new ) { // Check and remove empty loops (spam micro-benchmarks) if( policy_do_remove_empty_loop(phase) ) - return; // Here we removed an empty loop + return true; // Here we removed an empty loop bool should_peel = policy_peeling(phase); // Should we peel? @@ -1603,7 +1603,8 @@ void IdealLoopTree::iteration_split_impl( PhaseIdealLoop *phase, Node_List &old_ // This removes loop-invariant tests (usually null checks). if( !_head->is_CountedLoop() ) { // Non-counted loop if (PartialPeelLoop && phase->partial_peel(this, old_new)) { - return; + // Partial peel succeeded so terminate this round of loop opts + return false; } if( should_peel ) { // Should we peel? #ifndef PRODUCT @@ -1613,14 +1614,14 @@ void IdealLoopTree::iteration_split_impl( PhaseIdealLoop *phase, Node_List &old_ } else if( should_unswitch ) { phase->do_unswitching(this, old_new); } - return; + return true; } CountedLoopNode *cl = _head->as_CountedLoop(); - if( !cl->loopexit() ) return; // Ignore various kinds of broken loops + if( !cl->loopexit() ) return true; // Ignore various kinds of broken loops // Do nothing special to pre- and post- loops - if( cl->is_pre_loop() || cl->is_post_loop() ) return; + if( cl->is_pre_loop() || cl->is_post_loop() ) return true; // Compute loop trip count from profile data compute_profile_trip_cnt(phase); @@ -1633,11 +1634,11 @@ void IdealLoopTree::iteration_split_impl( PhaseIdealLoop *phase, Node_List &old_ // Here we did some unrolling and peeling. Eventually we will // completely unroll this loop and it will no longer be a loop. phase->do_maximally_unroll(this,old_new); - return; + return true; } if (should_unswitch) { phase->do_unswitching(this, old_new); - return; + return true; } } @@ -1698,14 +1699,16 @@ void IdealLoopTree::iteration_split_impl( PhaseIdealLoop *phase, Node_List &old_ if( should_peel ) // Might want to peel but do nothing else phase->do_peeling(this,old_new); } + return true; } //============================================================================= //------------------------------iteration_split-------------------------------- -void IdealLoopTree::iteration_split( PhaseIdealLoop *phase, Node_List &old_new ) { +bool IdealLoopTree::iteration_split( PhaseIdealLoop *phase, Node_List &old_new ) { // Recursively iteration split nested loops - if( _child ) _child->iteration_split( phase, old_new ); + if( _child && !_child->iteration_split( phase, old_new )) + return false; // Clean out prior deadwood DCE_loop_body(); @@ -1727,7 +1730,9 @@ void IdealLoopTree::iteration_split( PhaseIdealLoop *phase, Node_List &old_new ) _allow_optimizations && !tail()->is_top() ) { // Also ignore the occasional dead backedge if (!_has_call) { - iteration_split_impl( phase, old_new ); + if (!iteration_split_impl( phase, old_new )) { + return false; + } } else if (policy_unswitching(phase)) { phase->do_unswitching(this, old_new); } @@ -1736,5 +1741,7 @@ void IdealLoopTree::iteration_split( PhaseIdealLoop *phase, Node_List &old_new ) // Minor offset re-organization to remove loop-fallout uses of // trip counter. if( _head->is_CountedLoop() ) phase->reorg_offsets( this ); - if( _next ) _next->iteration_split( phase, old_new ); + if( _next && !_next->iteration_split( phase, old_new )) + return false; + return true; } diff --git a/hotspot/src/share/vm/opto/loopnode.hpp b/hotspot/src/share/vm/opto/loopnode.hpp index 968cf865365..53775646696 100644 --- a/hotspot/src/share/vm/opto/loopnode.hpp +++ b/hotspot/src/share/vm/opto/loopnode.hpp @@ -325,12 +325,14 @@ public: // Returns TRUE if loop tree is structurally changed. bool beautify_loops( PhaseIdealLoop *phase ); - // Perform iteration-splitting on inner loops. Split iterations to avoid - // range checks or one-shot null checks. - void iteration_split( PhaseIdealLoop *phase, Node_List &old_new ); + // Perform iteration-splitting on inner loops. Split iterations to + // avoid range checks or one-shot null checks. Returns false if the + // current round of loop opts should stop. + bool iteration_split( PhaseIdealLoop *phase, Node_List &old_new ); - // Driver for various flavors of iteration splitting - void iteration_split_impl( PhaseIdealLoop *phase, Node_List &old_new ); + // Driver for various flavors of iteration splitting. Returns false + // if the current round of loop opts should stop. + bool iteration_split_impl( PhaseIdealLoop *phase, Node_List &old_new ); // Given dominators, try to find loops with calls that must always be // executed (call dominates loop tail). These loops do not need non-call diff --git a/hotspot/src/share/vm/opto/loopopts.cpp b/hotspot/src/share/vm/opto/loopopts.cpp index e0f55603b7a..41048cbcbe9 100644 --- a/hotspot/src/share/vm/opto/loopopts.cpp +++ b/hotspot/src/share/vm/opto/loopopts.cpp @@ -1903,9 +1903,6 @@ void PhaseIdealLoop::clone_for_use_outside_loop( IdealLoopTree *loop, Node* n, N // Use in a phi is considered a use in the associated predecessor block use_c = use->in(0)->in(j); } - if (use_c->is_CountedLoop()) { - use_c = use_c->in(LoopNode::EntryControl); - } set_ctrl(n_clone, use_c); assert(!loop->is_member(get_loop(use_c)), "should be outside loop"); get_loop(use_c)->_body.push(n_clone); diff --git a/hotspot/test/compiler/6700047/Test6700047.java b/hotspot/test/compiler/6700047/Test6700047.java index 55921d59465..64e6ddb1933 100644 --- a/hotspot/test/compiler/6700047/Test6700047.java +++ b/hotspot/test/compiler/6700047/Test6700047.java @@ -29,6 +29,8 @@ */ public class Test6700047 { + static byte[] dummy = new byte[256]; + public static void main(String[] args) { for (int i = 0; i < 100000; i++) { intToLeftPaddedAsciiBytes(); @@ -53,6 +55,7 @@ public class Test6700047 { if (offset > 0) { for(int j = 0; j < offset; j++) { result++; + dummy[i] = 0; } } return result; From 6f5e28aca130089c0f776357772339832a556548 Mon Sep 17 00:00:00 2001 From: Antonios Printezis Date: Mon, 6 Oct 2008 13:16:35 -0400 Subject: [PATCH 031/267] 6752248: G1: introduce parallel heap verification Introduce parallel heap verification in G1. Reviewed-by: jcoomes, apetrusenko --- .../gc_implementation/g1/g1CollectedHeap.cpp | 64 +++++++++++++++++-- .../gc_implementation/g1/g1CollectedHeap.hpp | 3 + .../vm/gc_implementation/g1/heapRegion.hpp | 3 +- hotspot/src/share/vm/runtime/globals.hpp | 3 + 4 files changed, 67 insertions(+), 6 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index 43565be9b35..0c605e2c2ac 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -1789,6 +1789,20 @@ G1CollectedHeap::heap_region_par_iterate_chunked(HeapRegionClosure* cl, } } +class ResetClaimValuesClosure: public HeapRegionClosure { +public: + bool doHeapRegion(HeapRegion* r) { + r->set_claim_value(HeapRegion::InitialClaimValue); + return false; + } +}; + +void +G1CollectedHeap::reset_heap_region_claim_values() { + ResetClaimValuesClosure blk; + heap_region_iterate(&blk); +} + #ifdef ASSERT // This checks whether all regions in the heap have the correct claim // value. I also piggy-backed on this a check to ensure that the @@ -2031,10 +2045,12 @@ public: class VerifyRegionClosure: public HeapRegionClosure { public: bool _allow_dirty; - VerifyRegionClosure(bool allow_dirty) - : _allow_dirty(allow_dirty) {} + bool _par; + VerifyRegionClosure(bool allow_dirty, bool par = false) + : _allow_dirty(allow_dirty), _par(par) {} bool doHeapRegion(HeapRegion* r) { - guarantee(r->claim_value() == 0, "Should be unclaimed at verify points."); + guarantee(_par || r->claim_value() == HeapRegion::InitialClaimValue, + "Should be unclaimed at verify points."); if (r->isHumongous()) { if (r->startsHumongous()) { // Verify the single H object. @@ -2082,6 +2098,25 @@ public: } }; +// This is the task used for parallel heap verification. + +class G1ParVerifyTask: public AbstractGangTask { +private: + G1CollectedHeap* _g1h; + bool _allow_dirty; + +public: + G1ParVerifyTask(G1CollectedHeap* g1h, bool allow_dirty) : + AbstractGangTask("Parallel verify task"), + _g1h(g1h), _allow_dirty(allow_dirty) { } + + void work(int worker_i) { + VerifyRegionClosure blk(_allow_dirty, true); + _g1h->heap_region_par_iterate_chunked(&blk, worker_i, + HeapRegion::ParVerifyClaimValue); + } +}; + void G1CollectedHeap::verify(bool allow_dirty, bool silent) { if (SafepointSynchronize::is_at_safepoint() || ! UseTLAB) { if (!silent) { gclog_or_tty->print("roots "); } @@ -2092,8 +2127,27 @@ void G1CollectedHeap::verify(bool allow_dirty, bool silent) { &rootsCl); rem_set()->invalidate(perm_gen()->used_region(), false); if (!silent) { gclog_or_tty->print("heapRegions "); } - VerifyRegionClosure blk(allow_dirty); - _hrs->iterate(&blk); + if (GCParallelVerificationEnabled && ParallelGCThreads > 1) { + assert(check_heap_region_claim_values(HeapRegion::InitialClaimValue), + "sanity check"); + + G1ParVerifyTask task(this, allow_dirty); + int n_workers = workers()->total_workers(); + set_par_threads(n_workers); + workers()->run_task(&task); + set_par_threads(0); + + assert(check_heap_region_claim_values(HeapRegion::ParVerifyClaimValue), + "sanity check"); + + reset_heap_region_claim_values(); + + assert(check_heap_region_claim_values(HeapRegion::InitialClaimValue), + "sanity check"); + } else { + VerifyRegionClosure blk(allow_dirty); + _hrs->iterate(&blk); + } if (!silent) gclog_or_tty->print("remset "); rem_set()->verify(); guarantee(!rootsCl.failures(), "should not have had failures"); diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp index 3cb980e205c..557456e4024 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp @@ -890,6 +890,9 @@ public: int worker, jint claim_value); + // It resets all the region claim values to the default. + void reset_heap_region_claim_values(); + #ifdef ASSERT bool check_heap_region_claim_values(jint claim_value); #endif // ASSERT diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp index eb51e865ca7..eee90ecb9bb 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp @@ -317,7 +317,8 @@ class HeapRegion: public G1OffsetTableContigSpace { InitialClaimValue = 0, FinalCountClaimValue = 1, NoteEndClaimValue = 2, - ScrubRemSetClaimValue = 3 + ScrubRemSetClaimValue = 3, + ParVerifyClaimValue = 4 }; // Concurrent refinement requires contiguous heap regions (in which TLABs diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index a0ef55da23a..06d43a60d61 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -1825,6 +1825,9 @@ class CommandLineFlags { diagnostic(bool, VerifyDuringGC, false, \ "Verify memory system during GC (between phases)") \ \ + diagnostic(bool, GCParallelVerificationEnabled, true, \ + "Enable parallel memory system verification") \ + \ diagnostic(bool, VerifyRememberedSets, false, \ "Verify GC remembered sets") \ \ From fe28b4f768857def40c7cc38cc2def1dd4e445f4 Mon Sep 17 00:00:00 2001 From: Xiaobin Lu Date: Mon, 6 Oct 2008 11:39:34 -0700 Subject: [PATCH 032/267] 6673124: Runtime.availableProcessors / os::active_processor_count wrong if unused processor sets exist Reviewed-by: acorn, dholmes --- hotspot/src/os/solaris/vm/os_solaris.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/hotspot/src/os/solaris/vm/os_solaris.cpp b/hotspot/src/os/solaris/vm/os_solaris.cpp index 7bd9a6370ca..c4386d85988 100644 --- a/hotspot/src/os/solaris/vm/os_solaris.cpp +++ b/hotspot/src/os/solaris/vm/os_solaris.cpp @@ -462,16 +462,14 @@ int os::active_processor_count() { int online_cpus = sysconf(_SC_NPROCESSORS_ONLN); pid_t pid = getpid(); psetid_t pset = PS_NONE; - // Are we running in a processor set? + // Are we running in a processor set or is there any processor set around? if (pset_bind(PS_QUERY, P_PID, pid, &pset) == 0) { - if (pset != PS_NONE) { - uint_t pset_cpus; - // Query number of cpus in processor set - if (pset_info(pset, NULL, &pset_cpus, NULL) == 0) { - assert(pset_cpus > 0 && pset_cpus <= online_cpus, "sanity check"); - _processors_online = pset_cpus; - return pset_cpus; - } + uint_t pset_cpus; + // Query the number of cpus available to us. + if (pset_info(pset, NULL, &pset_cpus, NULL) == 0) { + assert(pset_cpus > 0 && pset_cpus <= online_cpus, "sanity check"); + _processors_online = pset_cpus; + return pset_cpus; } } // Otherwise return number of online cpus From d80199b4036f1949c7e1628a6e5b8c2b6f9c4305 Mon Sep 17 00:00:00 2001 From: Igor Veresov Date: Mon, 6 Oct 2008 20:59:16 -0700 Subject: [PATCH 033/267] 6753547: NUMA allocator: Invalid chunk size computation during adaptive resizing The per-lgrp chuck size can be incorrectly computed (causing an assertion failure) because of the non-associativity of the floating point operations. The fix is to rearrange the operations. Reviewed-by: ysr --- .../share/vm/gc_implementation/shared/mutableNUMASpace.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp b/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp index 4779daf69df..697e00de0ab 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp +++ b/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp @@ -391,6 +391,8 @@ size_t MutableNUMASpace::default_chunk_size() { } // Produce a new chunk size. page_size() aligned. +// This function is expected to be called on sequence of i's from 0 to +// lgrp_spaces()->length(). size_t MutableNUMASpace::adaptive_chunk_size(int i, size_t limit) { size_t pages_available = base_space_size(); for (int j = 0; j < i; j++) { @@ -405,7 +407,7 @@ size_t MutableNUMASpace::adaptive_chunk_size(int i, size_t limit) { size_t chunk_size = 0; if (alloc_rate > 0) { LGRPSpace *ls = lgrp_spaces()->at(i); - chunk_size = (size_t)(ls->alloc_rate()->average() * pages_available / alloc_rate) * page_size(); + chunk_size = (size_t)(ls->alloc_rate()->average() / alloc_rate * pages_available) * page_size(); } chunk_size = MAX2(chunk_size, page_size()); From 2229fb0a55c98b726cc1536c2142f67e0c40f7c9 Mon Sep 17 00:00:00 2001 From: Sean Mullan Date: Tue, 7 Oct 2008 13:41:39 -0400 Subject: [PATCH 034/267] 6752764: PIT B37: CertPath/CertPathValidatorTest/KeyParamsInheritanceTest failed Fix regression introduced by 6465942 Reviewed-by: vinnie --- .../classes/sun/security/provider/certpath/BasicChecker.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/src/share/classes/sun/security/provider/certpath/BasicChecker.java b/jdk/src/share/classes/sun/security/provider/certpath/BasicChecker.java index 491dd4711da..d19d5d193e4 100644 --- a/jdk/src/share/classes/sun/security/provider/certpath/BasicChecker.java +++ b/jdk/src/share/classes/sun/security/provider/certpath/BasicChecker.java @@ -162,7 +162,7 @@ class BasicChecker extends PKIXCertPathChecker { throw new CertPathValidatorException (msg + " check failed", e, null, -1, BasicReason.INVALID_SIGNATURE); - } catch (GeneralSecurityException e) { + } catch (Exception e) { throw new CertPathValidatorException(msg + " check failed", e); } From 98ab03e7e5f93fa4bb45dcd3e0d9648918d19586 Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Tue, 7 Oct 2008 15:39:19 -0700 Subject: [PATCH 035/267] 6749967: regression tests for apt should be same-vm friendly Reviewed-by: darcy --- langtools/test/tools/apt/mirror/declaration/AnnoMirror.java | 2 +- langtools/test/tools/apt/mirror/declaration/AnnoTypeDecl.java | 2 +- .../test/tools/apt/mirror/declaration/AnnoTypeElemDecl.java | 2 +- langtools/test/tools/apt/mirror/declaration/AnnoVal.java | 2 +- langtools/test/tools/apt/mirror/declaration/ClassDecl.java | 2 +- langtools/test/tools/apt/mirror/declaration/ConstExpr.java | 2 +- .../test/tools/apt/mirror/declaration/ConstructorDecl.java | 2 +- langtools/test/tools/apt/mirror/declaration/EnumDecl.java | 2 +- langtools/test/tools/apt/mirror/declaration/FieldDecl.java | 2 +- langtools/test/tools/apt/mirror/declaration/GetAnno.java | 2 +- langtools/test/tools/apt/mirror/declaration/InterfaceDecl.java | 2 +- langtools/test/tools/apt/mirror/declaration/MethodDecl.java | 2 +- langtools/test/tools/apt/mirror/declaration/PackageDecl.java | 2 +- langtools/test/tools/apt/mirror/declaration/ParameterDecl.java | 1 + langtools/test/tools/apt/mirror/type/AnnoTyp.java | 2 +- langtools/test/tools/apt/mirror/type/ArrayTyp.java | 2 +- langtools/test/tools/apt/mirror/type/ClassTyp.java | 1 + langtools/test/tools/apt/mirror/type/EnumTyp.java | 2 +- langtools/test/tools/apt/mirror/type/InterfaceTyp.java | 1 + langtools/test/tools/apt/mirror/type/PrimitiveTyp.java | 2 +- langtools/test/tools/apt/mirror/type/TypeVar.java | 2 +- langtools/test/tools/apt/mirror/type/WildcardTyp.java | 2 +- langtools/test/tools/apt/mirror/util/Overrides.java | 1 + langtools/test/tools/apt/mirror/util/TypeCreation.java | 1 + 24 files changed, 24 insertions(+), 19 deletions(-) diff --git a/langtools/test/tools/apt/mirror/declaration/AnnoMirror.java b/langtools/test/tools/apt/mirror/declaration/AnnoMirror.java index 4c30a15e576..1d651aa4c72 100644 --- a/langtools/test/tools/apt/mirror/declaration/AnnoMirror.java +++ b/langtools/test/tools/apt/mirror/declaration/AnnoMirror.java @@ -28,7 +28,7 @@ * @summary Tests AnnotationMirror and AnnotationValue methods. * @library ../../lib * @compile -source 1.5 AnnoMirror.java - * @run main AnnoMirror + * @run main/othervm AnnoMirror */ diff --git a/langtools/test/tools/apt/mirror/declaration/AnnoTypeDecl.java b/langtools/test/tools/apt/mirror/declaration/AnnoTypeDecl.java index eea9fd78655..e619f1ed5e4 100644 --- a/langtools/test/tools/apt/mirror/declaration/AnnoTypeDecl.java +++ b/langtools/test/tools/apt/mirror/declaration/AnnoTypeDecl.java @@ -28,7 +28,7 @@ * @summary AnnotationTypeDeclaration tests * @library ../../lib * @compile -source 1.5 AnnoTypeDecl.java - * @run main AnnoTypeDecl + * @run main/othervm AnnoTypeDecl */ diff --git a/langtools/test/tools/apt/mirror/declaration/AnnoTypeElemDecl.java b/langtools/test/tools/apt/mirror/declaration/AnnoTypeElemDecl.java index 9b4e0298f92..864d6b94659 100644 --- a/langtools/test/tools/apt/mirror/declaration/AnnoTypeElemDecl.java +++ b/langtools/test/tools/apt/mirror/declaration/AnnoTypeElemDecl.java @@ -28,7 +28,7 @@ * @summary AnnotationTypeElementDeclaration tests * @library ../../lib * @compile -source 1.5 AnnoTypeElemDecl.java - * @run main AnnoTypeElemDecl + * @run main/othervm AnnoTypeElemDecl */ diff --git a/langtools/test/tools/apt/mirror/declaration/AnnoVal.java b/langtools/test/tools/apt/mirror/declaration/AnnoVal.java index f97da399476..f2e4112b3e3 100644 --- a/langtools/test/tools/apt/mirror/declaration/AnnoVal.java +++ b/langtools/test/tools/apt/mirror/declaration/AnnoVal.java @@ -28,7 +28,7 @@ * @summary Tests AnnotationValue methods. * @library ../../lib * @compile -source 1.5 AnnoVal.java - * @run main AnnoVal + * @run main/othervm AnnoVal */ diff --git a/langtools/test/tools/apt/mirror/declaration/ClassDecl.java b/langtools/test/tools/apt/mirror/declaration/ClassDecl.java index e3771f8f95e..c2b3d062efd 100644 --- a/langtools/test/tools/apt/mirror/declaration/ClassDecl.java +++ b/langtools/test/tools/apt/mirror/declaration/ClassDecl.java @@ -28,7 +28,7 @@ * @summary ClassDeclaration tests * @library ../../lib * @compile -source 1.5 ClassDecl.java - * @run main ClassDecl + * @run main/othervm ClassDecl */ diff --git a/langtools/test/tools/apt/mirror/declaration/ConstExpr.java b/langtools/test/tools/apt/mirror/declaration/ConstExpr.java index a1050279707..160c5ef2421 100644 --- a/langtools/test/tools/apt/mirror/declaration/ConstExpr.java +++ b/langtools/test/tools/apt/mirror/declaration/ConstExpr.java @@ -28,7 +28,7 @@ * @summary Tests FieldDeclaration.getConstantExpression method * @library ../../lib * @compile -source 1.5 ConstExpr.java - * @run main ConstExpr + * @run main/othervm ConstExpr */ diff --git a/langtools/test/tools/apt/mirror/declaration/ConstructorDecl.java b/langtools/test/tools/apt/mirror/declaration/ConstructorDecl.java index a078909ec9c..b275645417e 100644 --- a/langtools/test/tools/apt/mirror/declaration/ConstructorDecl.java +++ b/langtools/test/tools/apt/mirror/declaration/ConstructorDecl.java @@ -28,7 +28,7 @@ * @summary ConstructorDeclaration tests * @library ../../lib * @compile -source 1.5 ConstructorDecl.java - * @run main ConstructorDecl + * @run main/othervm ConstructorDecl */ diff --git a/langtools/test/tools/apt/mirror/declaration/EnumDecl.java b/langtools/test/tools/apt/mirror/declaration/EnumDecl.java index 66d0614cd72..543af15d26a 100644 --- a/langtools/test/tools/apt/mirror/declaration/EnumDecl.java +++ b/langtools/test/tools/apt/mirror/declaration/EnumDecl.java @@ -28,7 +28,7 @@ * @summary EnumDeclaration tests * @library ../../lib * @compile -source 1.5 EnumDecl.java - * @run main EnumDecl + * @run main/othervm EnumDecl */ diff --git a/langtools/test/tools/apt/mirror/declaration/FieldDecl.java b/langtools/test/tools/apt/mirror/declaration/FieldDecl.java index 0426f46f4cc..dc78d5bbde4 100644 --- a/langtools/test/tools/apt/mirror/declaration/FieldDecl.java +++ b/langtools/test/tools/apt/mirror/declaration/FieldDecl.java @@ -28,7 +28,7 @@ * @summary FieldDeclaration tests * @library ../../lib * @compile -source 1.5 FieldDecl.java - * @run main FieldDecl + * @run main/othervm FieldDecl */ diff --git a/langtools/test/tools/apt/mirror/declaration/GetAnno.java b/langtools/test/tools/apt/mirror/declaration/GetAnno.java index f4b57f558ba..e70409d9bbb 100644 --- a/langtools/test/tools/apt/mirror/declaration/GetAnno.java +++ b/langtools/test/tools/apt/mirror/declaration/GetAnno.java @@ -28,7 +28,7 @@ * @summary Tests Declaration.getAnnotation method * @library ../../lib * @compile -source 1.5 GetAnno.java - * @run main GetAnno + * @run main/othervm GetAnno */ diff --git a/langtools/test/tools/apt/mirror/declaration/InterfaceDecl.java b/langtools/test/tools/apt/mirror/declaration/InterfaceDecl.java index 797d331b8fc..eccc36719d2 100644 --- a/langtools/test/tools/apt/mirror/declaration/InterfaceDecl.java +++ b/langtools/test/tools/apt/mirror/declaration/InterfaceDecl.java @@ -28,7 +28,7 @@ * @summary InterfaceDeclaration tests * @library ../../lib * @compile -source 1.5 InterfaceDecl.java - * @run main InterfaceDecl + * @run main/othervm InterfaceDecl */ diff --git a/langtools/test/tools/apt/mirror/declaration/MethodDecl.java b/langtools/test/tools/apt/mirror/declaration/MethodDecl.java index 0c5162101b4..f323bdc69bb 100644 --- a/langtools/test/tools/apt/mirror/declaration/MethodDecl.java +++ b/langtools/test/tools/apt/mirror/declaration/MethodDecl.java @@ -28,7 +28,7 @@ * @summary MethodDeclaration tests * @library ../../lib * @compile -source 1.5 MethodDecl.java - * @run main MethodDecl + * @run main/othervm MethodDecl */ diff --git a/langtools/test/tools/apt/mirror/declaration/PackageDecl.java b/langtools/test/tools/apt/mirror/declaration/PackageDecl.java index d070a0527d9..d2cef893cc5 100644 --- a/langtools/test/tools/apt/mirror/declaration/PackageDecl.java +++ b/langtools/test/tools/apt/mirror/declaration/PackageDecl.java @@ -28,7 +28,7 @@ * @summary PackageDeclaration tests * @library ../../lib * @compile -source 1.5 PackageDecl.java - * @run main PackageDecl + * @run main/othervm PackageDecl */ diff --git a/langtools/test/tools/apt/mirror/declaration/ParameterDecl.java b/langtools/test/tools/apt/mirror/declaration/ParameterDecl.java index 20faabbb52a..b1347c48e3e 100644 --- a/langtools/test/tools/apt/mirror/declaration/ParameterDecl.java +++ b/langtools/test/tools/apt/mirror/declaration/ParameterDecl.java @@ -27,6 +27,7 @@ * @bug 4853450 5031171 * @summary ParameterDeclaration tests * @library ../../lib + * @run main/othervm ParameterDecl */ diff --git a/langtools/test/tools/apt/mirror/type/AnnoTyp.java b/langtools/test/tools/apt/mirror/type/AnnoTyp.java index 307e8e66812..05b82548485 100644 --- a/langtools/test/tools/apt/mirror/type/AnnoTyp.java +++ b/langtools/test/tools/apt/mirror/type/AnnoTyp.java @@ -28,7 +28,7 @@ * @summary AnnotationType tests * @library ../../lib * @compile -source 1.5 AnnoTyp.java - * @run main AnnoTyp + * @run main/othervm AnnoTyp */ diff --git a/langtools/test/tools/apt/mirror/type/ArrayTyp.java b/langtools/test/tools/apt/mirror/type/ArrayTyp.java index d71f8b013c1..f7d5fe22595 100644 --- a/langtools/test/tools/apt/mirror/type/ArrayTyp.java +++ b/langtools/test/tools/apt/mirror/type/ArrayTyp.java @@ -28,7 +28,7 @@ * @summary ArrayType tests * @library ../../lib * @compile -source 1.5 ArrayTyp.java - * @run main ArrayTyp + * @run main/othervm ArrayTyp */ diff --git a/langtools/test/tools/apt/mirror/type/ClassTyp.java b/langtools/test/tools/apt/mirror/type/ClassTyp.java index d9a5d6658ec..12ffff5ac4d 100644 --- a/langtools/test/tools/apt/mirror/type/ClassTyp.java +++ b/langtools/test/tools/apt/mirror/type/ClassTyp.java @@ -27,6 +27,7 @@ * @bug 4853450 5009360 5055963 * @summary ClassType tests * @library ../../lib + * @run main/othervm ClassTyp */ diff --git a/langtools/test/tools/apt/mirror/type/EnumTyp.java b/langtools/test/tools/apt/mirror/type/EnumTyp.java index 65ea8e309b7..894859c3814 100644 --- a/langtools/test/tools/apt/mirror/type/EnumTyp.java +++ b/langtools/test/tools/apt/mirror/type/EnumTyp.java @@ -28,7 +28,7 @@ * @summary EnumType tests * @library ../../lib * @compile -source 1.5 EnumTyp.java - * @run main EnumTyp + * @run main/othervm EnumTyp */ diff --git a/langtools/test/tools/apt/mirror/type/InterfaceTyp.java b/langtools/test/tools/apt/mirror/type/InterfaceTyp.java index 7f65e5a7953..91bac6d04a1 100644 --- a/langtools/test/tools/apt/mirror/type/InterfaceTyp.java +++ b/langtools/test/tools/apt/mirror/type/InterfaceTyp.java @@ -27,6 +27,7 @@ * @bug 4853450 5055963 * @summary InterfaceType tests * @library ../../lib + * @run main/othervm InterfaceTyp */ diff --git a/langtools/test/tools/apt/mirror/type/PrimitiveTyp.java b/langtools/test/tools/apt/mirror/type/PrimitiveTyp.java index 27f0aa3c534..88d4e5755b5 100644 --- a/langtools/test/tools/apt/mirror/type/PrimitiveTyp.java +++ b/langtools/test/tools/apt/mirror/type/PrimitiveTyp.java @@ -28,7 +28,7 @@ * @summary PrimitiveType tests * @library ../../lib * @compile -source 1.5 PrimitiveTyp.java - * @run main PrimitiveTyp + * @run main/othervm PrimitiveTyp */ diff --git a/langtools/test/tools/apt/mirror/type/TypeVar.java b/langtools/test/tools/apt/mirror/type/TypeVar.java index 8a18914d8a9..cf4478045ea 100644 --- a/langtools/test/tools/apt/mirror/type/TypeVar.java +++ b/langtools/test/tools/apt/mirror/type/TypeVar.java @@ -28,7 +28,7 @@ * @summary TypeVariable tests * @library ../../lib * @compile -source 1.5 TypeVar.java - * @run main TypeVar + * @run main/othervm TypeVar */ diff --git a/langtools/test/tools/apt/mirror/type/WildcardTyp.java b/langtools/test/tools/apt/mirror/type/WildcardTyp.java index 09f1cdd59c8..788b707f2ec 100644 --- a/langtools/test/tools/apt/mirror/type/WildcardTyp.java +++ b/langtools/test/tools/apt/mirror/type/WildcardTyp.java @@ -28,7 +28,7 @@ * @summary WildcardType tests * @library ../../lib * @compile -source 1.5 WildcardTyp.java - * @run main WildcardTyp + * @run main/othervm WildcardTyp */ diff --git a/langtools/test/tools/apt/mirror/util/Overrides.java b/langtools/test/tools/apt/mirror/util/Overrides.java index e2e7f4260f0..9cd1c242d23 100644 --- a/langtools/test/tools/apt/mirror/util/Overrides.java +++ b/langtools/test/tools/apt/mirror/util/Overrides.java @@ -27,6 +27,7 @@ * @bug 5037165 * @summary Test the Declarations.overrides method * @library ../../lib + * @run main/othervm Overrides */ diff --git a/langtools/test/tools/apt/mirror/util/TypeCreation.java b/langtools/test/tools/apt/mirror/util/TypeCreation.java index 3aa57174366..dc5d446169b 100644 --- a/langtools/test/tools/apt/mirror/util/TypeCreation.java +++ b/langtools/test/tools/apt/mirror/util/TypeCreation.java @@ -27,6 +27,7 @@ * @bug 5033381 * @summary Test the type creation methods in Types. * @library ../../lib + * @run main/othervm TypeCreation */ From 3a72f5c241a2cb3439562c47a06bd44e9479abb0 Mon Sep 17 00:00:00 2001 From: Kumar Srinivasan Date: Wed, 8 Oct 2008 08:10:51 -0700 Subject: [PATCH 036/267] 6755845: JVM_FindClassFromBoot triggers assertions Fixes assertions caused by one jvm_entry calling another, solved by refactoring code and modified gamma test. Reviewed-by: dholmes, xlu --- hotspot/src/os/linux/launcher/java.c | 15 ++++--- hotspot/src/os/linux/launcher/java.h | 10 +++++ hotspot/src/os/linux/launcher/java_md.c | 20 +++++++++ hotspot/src/os/solaris/launcher/java.c | 15 ++++--- hotspot/src/os/solaris/launcher/java.h | 11 +++++ hotspot/src/os/solaris/launcher/java_md.c | 21 +++++++++ hotspot/src/share/vm/prims/jvm.cpp | 52 +++++++++++++---------- 7 files changed, 108 insertions(+), 36 deletions(-) diff --git a/hotspot/src/os/linux/launcher/java.c b/hotspot/src/os/linux/launcher/java.c index d538db1d03d..c68bb41449b 100644 --- a/hotspot/src/os/linux/launcher/java.c +++ b/hotspot/src/os/linux/launcher/java.c @@ -1110,7 +1110,7 @@ static jstring getPlatformEncoding(JNIEnv *env) { if (propname) { jclass cls; jmethodID mid; - NULL_CHECK0 (cls = (*env)->FindClass(env, "java/lang/System")); + NULL_CHECK0 (cls = FindBootStrapClass(env, "java/lang/System")); NULL_CHECK0 (mid = (*env)->GetStaticMethodID( env, cls, "getProperty", @@ -1125,7 +1125,7 @@ static jstring getPlatformEncoding(JNIEnv *env) { static jboolean isEncodingSupported(JNIEnv *env, jstring enc) { jclass cls; jmethodID mid; - NULL_CHECK0 (cls = (*env)->FindClass(env, "java/nio/charset/Charset")); + NULL_CHECK0 (cls = FindBootStrapClass(env, "java/nio/charset/Charset")); NULL_CHECK0 (mid = (*env)->GetStaticMethodID( env, cls, "isSupported", @@ -1161,7 +1161,7 @@ NewPlatformString(JNIEnv *env, char *s) #else if (isEncodingSupported(env, enc) == JNI_TRUE) { #endif - NULL_CHECK0(cls = (*env)->FindClass(env, "java/lang/String")); + NULL_CHECK0(cls = FindBootStrapClass(env, "java/lang/String")); NULL_CHECK0(mid = (*env)->GetMethodID(env, cls, "", "([BLjava/lang/String;)V")); str = (*env)->NewObject(env, cls, mid, ary, enc); @@ -1172,7 +1172,7 @@ NewPlatformString(JNIEnv *env, char *s) the encoding name, in which the StringCoding class will pickup the iso-8859-1 as the fallback converter for us. */ - NULL_CHECK0(cls = (*env)->FindClass(env, "java/lang/String")); + NULL_CHECK0(cls = FindBootStrapClass(env, "java/lang/String")); NULL_CHECK0(mid = (*env)->GetMethodID(env, cls, "", "([B)V")); str = (*env)->NewObject(env, cls, mid, ary); @@ -1195,7 +1195,7 @@ NewPlatformStringArray(JNIEnv *env, char **strv, int strc) jarray ary; int i; - NULL_CHECK0(cls = (*env)->FindClass(env, "java/lang/String")); + NULL_CHECK0(cls = FindBootStrapClass(env, "java/lang/String")); NULL_CHECK0(ary = (*env)->NewObjectArray(env, strc, cls, 0)); for (i = 0; i < strc; i++) { jstring str = NewPlatformString(env, *strv++); @@ -1224,6 +1224,7 @@ LoadClass(JNIEnv *env, char *name) c = *t++; *s++ = (c == '.') ? '/' : c; } while (c != '\0'); + // use the application class loader for main-class cls = (*env)->FindClass(env, buf); free(buf); @@ -1250,7 +1251,7 @@ GetMainClassName(JNIEnv *env, char *jarname) jobject jar, man, attr; jstring str, result = 0; - NULL_CHECK0(cls = (*env)->FindClass(env, "java/util/jar/JarFile")); + NULL_CHECK0(cls = FindBootStrapClass(env, "java/util/jar/JarFile")); NULL_CHECK0(mid = (*env)->GetMethodID(env, cls, "", "(Ljava/lang/String;)V")); NULL_CHECK0(str = NewPlatformString(env, jarname)); @@ -1471,7 +1472,7 @@ PrintJavaVersion(JNIEnv *env) jclass ver; jmethodID print; - NULL_CHECK(ver = (*env)->FindClass(env, "sun/misc/Version")); + NULL_CHECK(ver = FindBootStrapClass(env, "sun/misc/Version")); NULL_CHECK(print = (*env)->GetStaticMethodID(env, ver, "print", "()V")); (*env)->CallStaticVoidMethod(env, ver, print); diff --git a/hotspot/src/os/linux/launcher/java.h b/hotspot/src/os/linux/launcher/java.h index c6f43df9c00..9e4a1a6f623 100644 --- a/hotspot/src/os/linux/launcher/java.h +++ b/hotspot/src/os/linux/launcher/java.h @@ -100,5 +100,15 @@ void* MemAlloc(size_t size); * Make launcher spit debug output. */ extern jboolean _launcher_debug; +/* + * This allows for finding classes from the VM's bootstrap class loader + * directly, FindClass uses the application class loader internally, this will + * cause unnecessary searching of the classpath for the required classes. + */ +typedef jclass (JNICALL FindClassFromBootLoader_t(JNIEnv *env, + const char *name, + jboolean throwError)); + +jclass FindBootStrapClass(JNIEnv *env, const char *classname); #endif /* _JAVA_H_ */ diff --git a/hotspot/src/os/linux/launcher/java_md.c b/hotspot/src/os/linux/launcher/java_md.c index 90c6e62c31b..248df18fc4b 100644 --- a/hotspot/src/os/linux/launcher/java_md.c +++ b/hotspot/src/os/linux/launcher/java_md.c @@ -1826,3 +1826,23 @@ UnsetEnv(char *name) { return(borrowed_unsetenv(name)); } +/* + * The implementation for finding classes from the bootstrap + * class loader, refer to java.h + */ +static FindClassFromBootLoader_t *findBootClass = NULL; + +jclass +FindBootStrapClass(JNIEnv *env, const char* classname) +{ + if (findBootClass == NULL) { + findBootClass = (FindClassFromBootLoader_t *)dlsym(RTLD_DEFAULT, + "JVM_FindClassFromBootLoader"); + if (findBootClass == NULL) { + fprintf(stderr, "Error: could load method JVM_FindClassFromBootLoader"); + return NULL; + } + } + return findBootClass(env, classname, JNI_FALSE); +} + diff --git a/hotspot/src/os/solaris/launcher/java.c b/hotspot/src/os/solaris/launcher/java.c index cb67cc0f088..17a939bb3a4 100644 --- a/hotspot/src/os/solaris/launcher/java.c +++ b/hotspot/src/os/solaris/launcher/java.c @@ -1110,7 +1110,7 @@ static jstring getPlatformEncoding(JNIEnv *env) { if (propname) { jclass cls; jmethodID mid; - NULL_CHECK0 (cls = (*env)->FindClass(env, "java/lang/System")); + NULL_CHECK0 (cls = FindBootStrapClass(env, "java/lang/System")); NULL_CHECK0 (mid = (*env)->GetStaticMethodID( env, cls, "getProperty", @@ -1125,7 +1125,7 @@ static jstring getPlatformEncoding(JNIEnv *env) { static jboolean isEncodingSupported(JNIEnv *env, jstring enc) { jclass cls; jmethodID mid; - NULL_CHECK0 (cls = (*env)->FindClass(env, "java/nio/charset/Charset")); + NULL_CHECK0 (cls = FindBootStrapClass(env, "java/nio/charset/Charset")); NULL_CHECK0 (mid = (*env)->GetStaticMethodID( env, cls, "isSupported", @@ -1161,7 +1161,7 @@ NewPlatformString(JNIEnv *env, char *s) #else if (isEncodingSupported(env, enc) == JNI_TRUE) { #endif - NULL_CHECK0(cls = (*env)->FindClass(env, "java/lang/String")); + NULL_CHECK0(cls = FindBootStrapClass(env, "java/lang/String")); NULL_CHECK0(mid = (*env)->GetMethodID(env, cls, "", "([BLjava/lang/String;)V")); str = (*env)->NewObject(env, cls, mid, ary, enc); @@ -1172,7 +1172,7 @@ NewPlatformString(JNIEnv *env, char *s) the encoding name, in which the StringCoding class will pickup the iso-8859-1 as the fallback converter for us. */ - NULL_CHECK0(cls = (*env)->FindClass(env, "java/lang/String")); + NULL_CHECK0(cls = FindBootStrapClass(env, "java/lang/String")); NULL_CHECK0(mid = (*env)->GetMethodID(env, cls, "", "([B)V")); str = (*env)->NewObject(env, cls, mid, ary); @@ -1195,7 +1195,7 @@ NewPlatformStringArray(JNIEnv *env, char **strv, int strc) jarray ary; int i; - NULL_CHECK0(cls = (*env)->FindClass(env, "java/lang/String")); + NULL_CHECK0(cls = FindBootStrapClass(env, "java/lang/String")); NULL_CHECK0(ary = (*env)->NewObjectArray(env, strc, cls, 0)); for (i = 0; i < strc; i++) { jstring str = NewPlatformString(env, *strv++); @@ -1224,6 +1224,7 @@ LoadClass(JNIEnv *env, char *name) c = *t++; *s++ = (c == '.') ? '/' : c; } while (c != '\0'); + // use the application class loader for the main-class cls = (*env)->FindClass(env, buf); free(buf); @@ -1250,7 +1251,7 @@ GetMainClassName(JNIEnv *env, char *jarname) jobject jar, man, attr; jstring str, result = 0; - NULL_CHECK0(cls = (*env)->FindClass(env, "java/util/jar/JarFile")); + NULL_CHECK0(cls = FindBootStrapClass(env, "java/util/jar/JarFile")); NULL_CHECK0(mid = (*env)->GetMethodID(env, cls, "", "(Ljava/lang/String;)V")); NULL_CHECK0(str = NewPlatformString(env, jarname)); @@ -1471,7 +1472,7 @@ PrintJavaVersion(JNIEnv *env) jclass ver; jmethodID print; - NULL_CHECK(ver = (*env)->FindClass(env, "sun/misc/Version")); + NULL_CHECK(ver = FindBootStrapClass(env, "sun/misc/Version")); NULL_CHECK(print = (*env)->GetStaticMethodID(env, ver, "print", "()V")); (*env)->CallStaticVoidMethod(env, ver, print); diff --git a/hotspot/src/os/solaris/launcher/java.h b/hotspot/src/os/solaris/launcher/java.h index 1e3321b7d4c..3bea15527d2 100644 --- a/hotspot/src/os/solaris/launcher/java.h +++ b/hotspot/src/os/solaris/launcher/java.h @@ -101,4 +101,15 @@ void* MemAlloc(size_t size); */ extern jboolean _launcher_debug; +/* + * This allows for finding classes from the VM's bootstrap class loader + * directly, FindClass uses the application class loader internally, this will + * cause unnecessary searching of the classpath for the required classes. + */ +typedef jclass (JNICALL FindClassFromBootLoader_t(JNIEnv *env, + const char *name, + jboolean throwError)); + +jclass FindBootStrapClass(JNIEnv *env, const char *classname); + #endif /* _JAVA_H_ */ diff --git a/hotspot/src/os/solaris/launcher/java_md.c b/hotspot/src/os/solaris/launcher/java_md.c index 09f8b89ea17..b006d24b676 100644 --- a/hotspot/src/os/solaris/launcher/java_md.c +++ b/hotspot/src/os/solaris/launcher/java_md.c @@ -1826,3 +1826,24 @@ UnsetEnv(char *name) { return(borrowed_unsetenv(name)); } + +/* + * The implementation for finding classes from the bootstrap + * class loader, refer to java.h + */ +static FindClassFromBootLoader_t *findBootClass = NULL; + +jclass +FindBootStrapClass(JNIEnv *env, const char* classname) +{ + if (findBootClass == NULL) { + findBootClass = (FindClassFromBootLoader_t *)dlsym(RTLD_DEFAULT, + "JVM_FindClassFromBootLoader"); + if (findBootClass == NULL) { + fprintf(stderr, "Error: could not load method JVM_FindClassFromBootLoader"); + return NULL; + } + } + return findBootClass(env, classname, JNI_FALSE); +} + diff --git a/hotspot/src/share/vm/prims/jvm.cpp b/hotspot/src/share/vm/prims/jvm.cpp index eb99862b1b7..81302b71225 100644 --- a/hotspot/src/share/vm/prims/jvm.cpp +++ b/hotspot/src/share/vm/prims/jvm.cpp @@ -628,6 +628,32 @@ JVM_ENTRY(void, JVM_ResolveClass(JNIEnv* env, jclass cls)) if (PrintJVMWarnings) warning("JVM_ResolveClass not implemented"); JVM_END +// Common implementation for JVM_FindClassFromBootLoader and +// JVM_FindClassFromLoader +static jclass jvm_find_class_from_class_loader(JNIEnv* env, const char* name, + jboolean init, jobject loader, + jboolean throwError, TRAPS) { + // Java libraries should ensure that name is never null... + if (name == NULL || (int)strlen(name) > symbolOopDesc::max_length()) { + // It's impossible to create this class; the name cannot fit + // into the constant pool. + if (throwError) { + THROW_MSG_0(vmSymbols::java_lang_NoClassDefFoundError(), name); + } else { + THROW_MSG_0(vmSymbols::java_lang_ClassNotFoundException(), name); + } + } + symbolHandle h_name = oopFactory::new_symbol_handle(name, CHECK_NULL); + Handle h_loader(THREAD, JNIHandles::resolve(loader)); + jclass result = find_class_from_class_loader(env, h_name, init, h_loader, + Handle(), throwError, THREAD); + + if (TraceClassResolution && result != NULL) { + trace_class_resolution(java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(result))); + } + return result; +} + // Rationale behind JVM_FindClassFromBootLoader // a> JVM_FindClassFromClassLoader was never exported in the export tables. // b> because of (a) java.dll has a direct dependecy on the unexported @@ -649,8 +675,8 @@ JVM_ENTRY(jclass, JVM_FindClassFromBootLoader(JNIEnv* env, jboolean throwError)) JVMWrapper3("JVM_FindClassFromBootLoader %s throw %s", name, throwError ? "error" : "exception"); - return JVM_FindClassFromClassLoader(env, name, JNI_FALSE, - (jobject)NULL, throwError); + return jvm_find_class_from_class_loader(env, name, JNI_FALSE, + (jobject)NULL, throwError, THREAD); JVM_END JVM_ENTRY(jclass, JVM_FindClassFromClassLoader(JNIEnv* env, const char* name, @@ -658,26 +684,8 @@ JVM_ENTRY(jclass, JVM_FindClassFromClassLoader(JNIEnv* env, const char* name, jboolean throwError)) JVMWrapper3("JVM_FindClassFromClassLoader %s throw %s", name, throwError ? "error" : "exception"); - // Java libraries should ensure that name is never null... - if (name == NULL || (int)strlen(name) > symbolOopDesc::max_length()) { - // It's impossible to create this class; the name cannot fit - // into the constant pool. - if (throwError) { - THROW_MSG_0(vmSymbols::java_lang_NoClassDefFoundError(), name); - } else { - THROW_MSG_0(vmSymbols::java_lang_ClassNotFoundException(), name); - } - } - symbolHandle h_name = oopFactory::new_symbol_handle(name, CHECK_NULL); - Handle h_loader(THREAD, JNIHandles::resolve(loader)); - jclass result = find_class_from_class_loader(env, h_name, init, h_loader, - Handle(), throwError, thread); - - if (TraceClassResolution && result != NULL) { - trace_class_resolution(java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(result))); - } - - return result; + return jvm_find_class_from_class_loader(env, name, init, loader, + throwError, THREAD); JVM_END From 8fe5a021a368b7a06b774473f83f50e22ce7250d Mon Sep 17 00:00:00 2001 From: Eamonn McManus Date: Wed, 8 Oct 2008 18:38:25 +0200 Subject: [PATCH 037/267] 6757225: MXBean: Incorrect type names for parametrized types, dealing with arrays Reviewed-by: sjiang --- .../jmx/mbeanserver/MXBeanIntrospector.java | 27 +++++- .../javax/management/event/EventClient.java | 24 +++-- .../management/event/FetchingEventRelay.java | 40 ++++---- .../javax/management/monitor/Monitor.java | 4 +- .../management/remote/rmi/RMIConnector.java | 13 ++- .../javax/management/mxbean/TypeNameTest.java | 97 +++++++++++++++++++ 6 files changed, 167 insertions(+), 38 deletions(-) create mode 100644 jdk/test/javax/management/mxbean/TypeNameTest.java diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/MXBeanIntrospector.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/MXBeanIntrospector.java index 8ff0a902dff..6479f9751e0 100644 --- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/MXBeanIntrospector.java +++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/MXBeanIntrospector.java @@ -32,6 +32,7 @@ import java.lang.ref.WeakReference; import java.lang.reflect.GenericArrayType; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.util.Map; import java.util.WeakHashMap; @@ -390,7 +391,31 @@ class MXBeanIntrospector extends MBeanIntrospector { if (type instanceof Class) return ((Class) type).getName(); else - return type.toString(); + return genericTypeString(type); + } + + private static String genericTypeString(Type type) { + if (type instanceof Class) { + Class c = (Class) type; + if (c.isArray()) + return genericTypeString(c.getComponentType()) + "[]"; + else + return c.getName(); + } else if (type instanceof GenericArrayType) { + GenericArrayType gat = (GenericArrayType) type; + return genericTypeString(gat.getGenericComponentType()) + "[]"; + } else if (type instanceof ParameterizedType) { + ParameterizedType pt = (ParameterizedType) type; + StringBuilder sb = new StringBuilder(); + sb.append(genericTypeString(pt.getRawType())).append("<"); + String sep = ""; + for (Type t : pt.getActualTypeArguments()) { + sb.append(sep).append(genericTypeString(t)); + sep = ", "; + } + return sb.append(">").toString(); + } else + return "???"; } private final PerInterfaceMap diff --git a/jdk/src/share/classes/javax/management/event/EventClient.java b/jdk/src/share/classes/javax/management/event/EventClient.java index 6f5c84eb2cd..cfce77b0879 100644 --- a/jdk/src/share/classes/javax/management/event/EventClient.java +++ b/jdk/src/share/classes/javax/management/event/EventClient.java @@ -265,12 +265,20 @@ public class EventClient implements EventConsumer, NotificationManager { public ScheduledThreadPoolExecutor createThreadPool(ThreadGroup group) { ThreadFactory daemonThreadFactory = new DaemonThreadFactory( "JMX EventClient lease renewer %d"); - ScheduledThreadPoolExecutor exec = new ScheduledThreadPoolExecutor( - 20, daemonThreadFactory); - exec.setKeepAliveTime(1, TimeUnit.SECONDS); - exec.allowCoreThreadTimeOut(true); - exec.setRemoveOnCancelPolicy(true); - return exec; + ScheduledThreadPoolExecutor executor = + new ScheduledThreadPoolExecutor(20, daemonThreadFactory); + executor.setKeepAliveTime(1, TimeUnit.SECONDS); + executor.allowCoreThreadTimeOut(true); + executor.setRemoveOnCancelPolicy(true); + // By default, a ScheduledThreadPoolExecutor will keep jobs + // in its queue even after they have been cancelled. They + // will only be removed when their scheduled time arrives. + // Since the job references the LeaseRenewer which references + // this EventClient, this can lead to a moderately large number + // of objects remaining referenced until the renewal time + // arrives. Hence the above call, which removes the job from + // the queue as soon as it is cancelled. + return executor; } }; return leaseRenewerThreadPool.getThreadPoolExecutor(create); @@ -381,7 +389,7 @@ public class EventClient implements EventConsumer, NotificationManager { listenerId = eventClientDelegate.addListener(clientId, name, filter); } catch (EventClientNotFoundException ecnfe) { - final IOException ioe = new IOException(); + final IOException ioe = new IOException(ecnfe.getMessage()); ioe.initCause(ecnfe); throw ioe; } @@ -488,7 +496,7 @@ public class EventClient implements EventConsumer, NotificationManager { listenerId = eventClientDelegate.addSubscriber(clientId, name, filter); } catch (EventClientNotFoundException ecnfe) { - final IOException ioe = new IOException(); + final IOException ioe = new IOException(ecnfe.getMessage()); ioe.initCause(ecnfe); throw ioe; } diff --git a/jdk/src/share/classes/javax/management/event/FetchingEventRelay.java b/jdk/src/share/classes/javax/management/event/FetchingEventRelay.java index 2a456ec44c7..e4c8d81d87b 100644 --- a/jdk/src/share/classes/javax/management/event/FetchingEventRelay.java +++ b/jdk/src/share/classes/javax/management/event/FetchingEventRelay.java @@ -91,7 +91,7 @@ public class FetchingEventRelay implements EventRelay { * the fetching. * * @param delegate The {@code EventClientDelegateMBean} to work with. - * @param executor Used to do the fetching. A new thread is created if + * @param fetchExecutor Used to do the fetching. A new thread is created if * {@code null}. * @throws IOException If failed to work with the {@code delegate}. * @throws MBeanException if unable to add a client to the remote @@ -101,12 +101,12 @@ public class FetchingEventRelay implements EventRelay { * @throws IllegalArgumentException If {@code delegate} is {@code null}. */ public FetchingEventRelay(EventClientDelegateMBean delegate, - Executor executor) throws IOException, MBeanException { + Executor fetchExecutor) throws IOException, MBeanException { this(delegate, DEFAULT_BUFFER_SIZE, DEFAULT_WAITING_TIMEOUT, DEFAULT_MAX_NOTIFICATIONS, - executor); + fetchExecutor); } /** @@ -120,7 +120,7 @@ public class FetchingEventRelay implements EventRelay { * @param timeout The waiting time in millseconds when fetching * notifications from an {@code EventClientDelegateMBean}. * @param maxNotifs The maximum notifications to fetch every time. - * @param executor Used to do the fetching. A new thread is created if + * @param fetchExecutor Used to do the fetching. A new thread is created if * {@code null}. * @throws IOException if failed to communicate with the {@code delegate}. * @throws MBeanException if unable to add a client to the remote @@ -133,12 +133,12 @@ public class FetchingEventRelay implements EventRelay { int bufferSize, long timeout, int maxNotifs, - Executor executor) throws IOException, MBeanException { + Executor fetchExecutor) throws IOException, MBeanException { this(delegate, bufferSize, timeout, maxNotifs, - executor, + fetchExecutor, FetchingEventForwarder.class.getName(), new Object[] {bufferSize}, new String[] {int.class.getName()}); @@ -155,7 +155,7 @@ public class FetchingEventRelay implements EventRelay { * @param timeout The waiting time in millseconds when fetching * notifications from an {@code EventClientDelegateMBean}. * @param maxNotifs The maximum notifications to fetch every time. - * @param executor Used to do the fetching. + * @param fetchExecutor Used to do the fetching. * @param forwarderName the class name of a user specific EventForwarder * to create in server to forward notifications to this object. The class * should be a subclass of the class {@link FetchingEventForwarder}. @@ -174,7 +174,7 @@ public class FetchingEventRelay implements EventRelay { int bufferSize, long timeout, int maxNotifs, - Executor executor, + Executor fetchExecutor, String forwarderName, Object[] params, String[] sig) throws IOException, MBeanException { @@ -184,11 +184,11 @@ public class FetchingEventRelay implements EventRelay { bufferSize+" "+ timeout+" "+ maxNotifs+" "+ - executor+" "+ + fetchExecutor+" "+ forwarderName+" "); } - if(delegate == null) { + if (delegate == null) { throw new NullPointerException("Null EventClientDelegateMBean!"); } @@ -212,16 +212,16 @@ public class FetchingEventRelay implements EventRelay { this.timeout = timeout; this.maxNotifs = maxNotifs; - if (executor == null) { - ScheduledThreadPoolExecutor stpe = new ScheduledThreadPoolExecutor(1, - daemonThreadFactory); - stpe.setKeepAliveTime(1, TimeUnit.SECONDS); - stpe.allowCoreThreadTimeOut(true); - executor = stpe; - this.defaultExecutor = stpe; + if (fetchExecutor == null) { + ScheduledThreadPoolExecutor executor = + new ScheduledThreadPoolExecutor(1, daemonThreadFactory); + executor.setKeepAliveTime(1, TimeUnit.SECONDS); + executor.allowCoreThreadTimeOut(true); + fetchExecutor = executor; + this.defaultExecutor = executor; } else this.defaultExecutor = null; - this.executor = executor; + this.fetchExecutor = fetchExecutor; startSequenceNumber = 0; fetchingJob = new MyJob(); @@ -258,7 +258,7 @@ public class FetchingEventRelay implements EventRelay { private class MyJob extends RepeatedSingletonJob { public MyJob() { - super(executor); + super(fetchExecutor); } public boolean isSuspended() { @@ -368,7 +368,7 @@ public class FetchingEventRelay implements EventRelay { private String clientId; private boolean stopped = false; - private final Executor executor; + private final Executor fetchExecutor; private final ExecutorService defaultExecutor; private final MyJob fetchingJob; diff --git a/jdk/src/share/classes/javax/management/monitor/Monitor.java b/jdk/src/share/classes/javax/management/monitor/Monitor.java index 081c5ede429..0329a33b077 100644 --- a/jdk/src/share/classes/javax/management/monitor/Monitor.java +++ b/jdk/src/share/classes/javax/management/monitor/Monitor.java @@ -181,7 +181,7 @@ public abstract class Monitor /** * Executor Service. */ - private static final ExecutorService executor; + private static final ThreadPoolExecutor executor; static { final String maximumPoolSizeSysProp = "jmx.x.monitor.maximum.pool.size"; final String maximumPoolSizeStr = AccessController.doPrivileged( @@ -218,7 +218,7 @@ public abstract class Monitor TimeUnit.SECONDS, new LinkedBlockingQueue(), new DaemonThreadFactory("Executor")); - ((ThreadPoolExecutor)executor).allowCoreThreadTimeOut(true); + executor.allowCoreThreadTimeOut(true); } /** diff --git a/jdk/src/share/classes/javax/management/remote/rmi/RMIConnector.java b/jdk/src/share/classes/javax/management/remote/rmi/RMIConnector.java index a620235ac13..934dac790db 100644 --- a/jdk/src/share/classes/javax/management/remote/rmi/RMIConnector.java +++ b/jdk/src/share/classes/javax/management/remote/rmi/RMIConnector.java @@ -71,9 +71,8 @@ import java.util.Map; import java.util.Properties; import java.util.Set; import java.util.WeakHashMap; -import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.Executor; -import java.util.concurrent.LinkedBlockingDeque; +import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; @@ -421,12 +420,12 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable public ThreadPoolExecutor createThreadPool(ThreadGroup group) { ThreadFactory daemonThreadFactory = new DaemonThreadFactory( "JMX RMIConnector listener dispatch %d"); - ThreadPoolExecutor exec = new ThreadPoolExecutor( + ThreadPoolExecutor executor = new ThreadPoolExecutor( 1, 10, 1, TimeUnit.SECONDS, - new LinkedBlockingDeque(), + new LinkedBlockingQueue(), daemonThreadFactory); - exec.allowCoreThreadTimeOut(true); - return exec; + executor.allowCoreThreadTimeOut(true); + return executor; } }; return listenerDispatchThreadPool.getThreadPoolExecutor(create); @@ -1503,7 +1502,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable super(period); } - public void gotIOException (IOException ioe) throws IOException { + public void gotIOException(IOException ioe) throws IOException { if (ioe instanceof NoSuchObjectException) { // need to restart super.gotIOException(ioe); diff --git a/jdk/test/javax/management/mxbean/TypeNameTest.java b/jdk/test/javax/management/mxbean/TypeNameTest.java new file mode 100644 index 00000000000..f5f48bccacb --- /dev/null +++ b/jdk/test/javax/management/mxbean/TypeNameTest.java @@ -0,0 +1,97 @@ +/* + * 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. + * + * 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 6757225 + * @summary Test that type names in MXBeans match their spec. + * @author Eamonn McManus + */ + +import java.lang.reflect.Field; +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; +import java.util.List; +import java.util.Map; +import javax.management.MBeanAttributeInfo; +import javax.management.MBeanInfo; +import javax.management.MBeanServer; +import javax.management.MBeanServerFactory; +import javax.management.ObjectName; +import javax.management.StandardMBean; + +public class TypeNameTest { + public static interface TestMXBean { + public int getInt(); + public String IntName = "int"; + + public Map getMapSI(); + public String MapSIName = "java.util.Map"; + + public Map getMapSInts(); + public String MapSIntsName = "java.util.Map"; + + public List> getListListInts(); + public String ListListIntsName = "java.util.List>"; + } + + private static InvocationHandler nullIH = new InvocationHandler() { + public Object invoke(Object proxy, Method method, Object[] args) + throws Throwable { + return null; + } + }; + + static String failure; + + public static void main(String[] args) throws Exception { + TestMXBean testImpl = (TestMXBean) Proxy.newProxyInstance( + TestMXBean.class.getClassLoader(), new Class[] {TestMXBean.class}, nullIH); + Object mxbean = new StandardMBean(testImpl, TestMXBean.class, true); + MBeanServer mbs = MBeanServerFactory.newMBeanServer(); + ObjectName name = new ObjectName("a:b=c"); + mbs.registerMBean(mxbean, name); + MBeanInfo mbi = mbs.getMBeanInfo(name); + MBeanAttributeInfo[] mbais = mbi.getAttributes(); + for (MBeanAttributeInfo mbai : mbais) { + String attrName = mbai.getName(); + String attrTypeName = (String) mbai.getDescriptor().getFieldValue("originalType"); + String fieldName = attrName + "Name"; + Field nameField = TestMXBean.class.getField(fieldName); + String expectedTypeName = (String) nameField.get(null); + if (expectedTypeName.equals(attrTypeName)) { + System.out.println("OK: " + attrName + ": " + attrTypeName); + } else { + failure = "For attribute " + attrName + " expected type name \"" + + expectedTypeName + "\", found type name \"" + attrTypeName + + "\""; + System.out.println("FAIL: " + failure); + } + } + if (failure == null) + System.out.println("TEST PASSED"); + else + throw new Exception("TEST FAILED: " + failure); + } +} From 4f96480e1764e0ad3e2e5faef5c2b32a4c790507 Mon Sep 17 00:00:00 2001 From: Daniel Fuchs Date: Thu, 9 Oct 2008 14:10:58 +0200 Subject: [PATCH 038/267] 6332953: JMX agent should bind to loopback address when starting the local connector server Reviewed-by: emcmanus --- .../jmxremote/ConnectorBootstrap.java | 24 +++- .../LocalRMIServerSocketFactory.java | 114 ++++++++++++++++++ .../lib/management/management.properties | 22 +++- 3 files changed, 154 insertions(+), 6 deletions(-) create mode 100644 jdk/src/share/classes/sun/management/jmxremote/LocalRMIServerSocketFactory.java diff --git a/jdk/src/share/classes/sun/management/jmxremote/ConnectorBootstrap.java b/jdk/src/share/classes/sun/management/jmxremote/ConnectorBootstrap.java index 43cae9144e9..74a1d41352c 100644 --- a/jdk/src/share/classes/sun/management/jmxremote/ConnectorBootstrap.java +++ b/jdk/src/share/classes/sun/management/jmxremote/ConnectorBootstrap.java @@ -80,7 +80,7 @@ import sun.management.AgentConfigurationError; import static sun.management.AgentConfigurationError.*; import sun.management.ConnectorAddressLink; import sun.management.FileSystem; -import sun.management.snmp.util.MibLogger; +import com.sun.jmx.remote.util.ClassLogger; import com.sun.jmx.remote.internal.RMIExporter; import com.sun.jmx.remote.security.JMXPluggableAuthenticator; @@ -115,6 +115,8 @@ public final class ConnectorBootstrap { "com.sun.management.jmxremote.port"; public static final String CONFIG_FILE_NAME = "com.sun.management.config.file"; + public static final String USE_LOCAL_ONLY = + "com.sun.management.jmxremote.local.only"; public static final String USE_SSL = "com.sun.management.jmxremote.ssl"; public static final String USE_REGISTRY_SSL = @@ -384,7 +386,7 @@ public final class ConnectorBootstrap { checkAccessFile(accessFileName); } - if (log.isDebugOn()) { + if (log.debugOn()) { log.debug("initialize", Agent.getText("jmxremote.ConnectorBootstrap.initialize") + "\n\t" + PropertyNames.PORT + "=" + port + @@ -477,6 +479,18 @@ public final class ConnectorBootstrap { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); try { JMXServiceURL url = new JMXServiceURL("rmi", localhost, 0); + // Do we accept connections from local interfaces only? + Properties props = Agent.getManagementProperties(); + if (props == null) { + props = new Properties(); + } + String useLocalOnlyStr = props.getProperty( + PropertyNames.USE_LOCAL_ONLY, DefaultValues.USE_LOCAL_ONLY); + boolean useLocalOnly = Boolean.valueOf(useLocalOnlyStr).booleanValue(); + if (useLocalOnly) { + env.put(RMIConnectorServer.RMI_SERVER_SOCKET_FACTORY_ATTRIBUTE, + new LocalRMIServerSocketFactory()); + } JMXConnectorServer server = JMXConnectorServerFactory.newJMXConnectorServer(url, env, mbs); server.start(); @@ -764,7 +778,7 @@ public final class ConnectorBootstrap { private ConnectorBootstrap() { } - // XXX Revisit: should probably clone this MibLogger.... - private static final MibLogger log = - new MibLogger(ConnectorBootstrap.class); + private static final ClassLogger log = + new ClassLogger(ConnectorBootstrap.class.getPackage().getName(), + "ConnectorBootstrap"); } diff --git a/jdk/src/share/classes/sun/management/jmxremote/LocalRMIServerSocketFactory.java b/jdk/src/share/classes/sun/management/jmxremote/LocalRMIServerSocketFactory.java new file mode 100644 index 00000000000..edb15539b23 --- /dev/null +++ b/jdk/src/share/classes/sun/management/jmxremote/LocalRMIServerSocketFactory.java @@ -0,0 +1,114 @@ +/* + * Copyright 2007 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 sun.management.jmxremote; + +import java.io.IOException; +import java.net.InetAddress; +import java.net.NetworkInterface; +import java.net.ServerSocket; +import java.net.Socket; +import java.net.SocketException; +import java.rmi.server.RMIServerSocketFactory; +import java.util.Enumeration; + +/** + * This RMI server socket factory creates server sockets that + * will only accept connection requests from clients running + * on the host where the RMI remote objects have been exported. + */ +public final class LocalRMIServerSocketFactory implements RMIServerSocketFactory { + /** + * Creates a server socket that only accepts connection requests from + * clients running on the host where the RMI remote objects have been + * exported. + */ + public ServerSocket createServerSocket(int port) throws IOException { + return new ServerSocket(port) { + @Override + public Socket accept() throws IOException { + Socket socket = super.accept(); + InetAddress remoteAddr = socket.getInetAddress(); + final String msg = "The server sockets created using the " + + "LocalRMIServerSocketFactory only accept connections " + + "from clients running on the host where the RMI " + + "remote objects have been exported."; + if (remoteAddr.isAnyLocalAddress()) { + // local address: accept the connection. + return socket; + } + // Retrieve all the network interfaces on this host. + Enumeration nis; + try { + nis = NetworkInterface.getNetworkInterfaces(); + } catch (SocketException e) { + try { + socket.close(); + } catch (IOException ioe) { + // Ignore... + } + throw new IOException(msg, e); + } + // Walk through the network interfaces to see + // if any of them matches the client's address. + // If true, then the client's address is local. + while (nis.hasMoreElements()) { + NetworkInterface ni = nis.nextElement(); + Enumeration addrs = ni.getInetAddresses(); + while (addrs.hasMoreElements()) { + InetAddress localAddr = addrs.nextElement(); + if (localAddr.equals(remoteAddr)) { + return socket; + } + } + } + // The client's address is remote so refuse the connection. + try { + socket.close(); + } catch (IOException ioe) { + // Ignore... + } + throw new IOException(msg); + } + }; + } + + /** + * Two LocalRMIServerSocketFactory objects + * are equal if they are of the same type. + */ + @Override + public boolean equals(Object obj) { + return (obj instanceof LocalRMIServerSocketFactory); + } + + /** + * Returns a hash code value for this LocalRMIServerSocketFactory. + */ + @Override + public int hashCode() { + return getClass().hashCode(); + } +} diff --git a/jdk/src/share/lib/management/management.properties b/jdk/src/share/lib/management/management.properties index ab7cff92cde..db08b780ebd 100644 --- a/jdk/src/share/lib/management/management.properties +++ b/jdk/src/share/lib/management/management.properties @@ -82,7 +82,7 @@ # # com.sun.management.snmp.interface= # Specifies the local interface on which the SNMP agent will bind. -# This is usefull when running on machines which have several +# This is useful when running on machines which have several # interfaces defined. It makes it possible to listen to a specific # subnet accessible through that interface. # Default for this property is "localhost". @@ -143,6 +143,26 @@ # running MBean server, the connector, or the registry. # +# +# ########## RMI connector settings for local management ########## +# +# com.sun.management.jmxremote.local.only=true|false +# Default for this property is true. (Case for true/false ignored) +# If this property is specified as true then the local JMX RMI connector +# server will only accept connection requests from clients running on +# the host where the out-of-the-box JMX management agent is running. +# In order to ensure backwards compatibility this property could be +# set to false. However, deploying the local management agent in this +# way is discouraged because the local JMX RMI connector server will +# accept connection requests from any client either local or remote. +# For remote management the remote JMX RMI connector server should +# be used instead with authentication and SSL/TLS encryption enabled. +# + +# For allowing the local management agent accept local +# and remote connection requests use the following line +# com.sun.management.jmxremote.local.only=false + # # ###################### RMI SSL ############################# # From 9315b88d670bf72cfeeec735460ec350d1458921 Mon Sep 17 00:00:00 2001 From: Maurizio Cimadamore Date: Thu, 9 Oct 2008 15:56:20 +0100 Subject: [PATCH 039/267] 6751514: Unary post-increment with type variables crash javac during lowering Lower.abstractRval should take into account parenthesized expressions Reviewed-by: jjg --- .../com/sun/tools/javac/comp/Lower.java | 13 ++- .../com/sun/tools/javac/comp/TransTypes.java | 4 +- .../test/tools/javac/generics/T6751514.java | 82 +++++++++++++++++++ 3 files changed, 90 insertions(+), 9 deletions(-) create mode 100644 langtools/test/tools/javac/generics/T6751514.java diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java index 423d855fad6..b2f4981be6a 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java @@ -1884,6 +1884,9 @@ public class Lower extends TreeTranslator { } }); } + case JCTree.TYPECAST: { + return abstractLval(((JCTypeCast)lval).expr, builder); + } } throw new AssertionError(lval); } @@ -2713,10 +2716,7 @@ public class Lower extends TreeTranslator { // boxing required; need to rewrite as x = (unbox typeof x)(x op y); // or if x == (typeof x)z then z = (unbox typeof x)((typeof x)z op y) // (but without recomputing x) - JCTree arg = (tree.lhs.getTag() == JCTree.TYPECAST) - ? ((JCTypeCast)tree.lhs).expr - : tree.lhs; - JCTree newTree = abstractLval(arg, new TreeBuilder() { + JCTree newTree = abstractLval(tree.lhs, new TreeBuilder() { public JCTree build(final JCTree lhs) { int newTag = tree.getTag() - JCTree.ASGOffset; // Erasure (TransTypes) can change the type of @@ -2768,9 +2768,8 @@ public class Lower extends TreeTranslator { // or // translate to tmp1=lval(e); tmp2=tmp1; (typeof tree)tmp1 OP 1; tmp2 // where OP is += or -= - final boolean cast = tree.arg.getTag() == JCTree.TYPECAST; - final JCExpression arg = cast ? ((JCTypeCast)tree.arg).expr : tree.arg; - return abstractLval(arg, new TreeBuilder() { + final boolean cast = TreeInfo.skipParens(tree.arg).getTag() == JCTree.TYPECAST; + return abstractLval(tree.arg, new TreeBuilder() { public JCTree build(final JCTree tmp1) { return abstractRval(tmp1, tree.arg.type, new TreeBuilder() { public JCTree build(final JCTree tmp2) { diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java b/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java index 3db04591956..14c8543c03b 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java @@ -623,8 +623,8 @@ public class TransTypes extends TreeTranslator { } public void visitAssignop(JCAssignOp tree) { - tree.lhs = translate(tree.lhs, null); - tree.rhs = translate(tree.rhs, erasure(tree.rhs.type)); + tree.lhs = translate(tree.lhs, tree.operator.type.getParameterTypes().head); + tree.rhs = translate(tree.rhs, tree.operator.type.getParameterTypes().tail.head); tree.type = erasure(tree.type); result = tree; } diff --git a/langtools/test/tools/javac/generics/T6751514.java b/langtools/test/tools/javac/generics/T6751514.java new file mode 100644 index 00000000000..79d88efb5cf --- /dev/null +++ b/langtools/test/tools/javac/generics/T6751514.java @@ -0,0 +1,82 @@ +/* + * 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. + * + * 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 6751514 + * @summary Unary post-increment with type variables crash javac during lowering + * @author Maurizio Cimadamore + */ + +public class T6751514 { + + static class Foo { + X x; + Foo (X x) { + this.x = x; + } + } + + static void test1(Foo foo) { + int start = foo.x; + equals(foo.x += 1, start + 1); + equals(foo.x++, start + 1); + equals(++foo.x, start + 3); + equals(foo.x--, start + 3); + equals(foo.x -= 1, start + 1); + equals(--foo.x, start); + } + + static void test2(Foo foo) { + int start = foo.x; + equals((foo.x) += 1, start + 1); + equals((foo.x)++, start + 1); + equals(++(foo.x), start + 3); + equals((foo.x)--, start + 3); + equals((foo.x) -= 1, start + 1); + equals(--(foo.x), start); + } + + static void test3(Foo foo) { + int start = foo.x; + equals(((foo.x)) += 1, start + 1); + equals(((foo.x))++, start + 1); + equals(++((foo.x)), start + 3); + equals(((foo.x))--, start + 3); + equals(((foo.x)) -= 1, start + 1); + equals(--((foo.x)), start); + } + + public static void main(String[] args) { + test1(new Foo(1)); + test2(new Foo(1)); + test3(new Foo(1)); + } + + static void equals(int found, int req) { + if (found != req) { + throw new AssertionError("Error (expected: "+ req + + " - found: " + found + ")"); + } + } +} \ No newline at end of file From 67339c0aabe459064a929ee3f9d6b86166056d73 Mon Sep 17 00:00:00 2001 From: Maurizio Cimadamore Date: Thu, 9 Oct 2008 16:02:29 +0100 Subject: [PATCH 040/267] 6738538: javac crashes when using a type parameter as a covariant method return type Capture conversion should be applied when acccessing a member of an intersection type Reviewed-by: jjg --- .../com/sun/tools/javac/code/Types.java | 4 ++ .../OverrideChecks/6738538/T6738538a.java | 44 +++++++++++++++++ .../OverrideChecks/6738538/T6738538b.java | 47 +++++++++++++++++++ 3 files changed, 95 insertions(+) create mode 100644 langtools/test/tools/javac/OverrideChecks/6738538/T6738538a.java create mode 100644 langtools/test/tools/javac/OverrideChecks/6738538/T6738538b.java diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java index 88556d618e9..92a8f8a72a3 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java @@ -1430,6 +1430,10 @@ public class Types { long flags = sym.flags(); if (((flags & STATIC) == 0) && owner.type.isParameterized()) { Type base = asOuterSuper(t, owner); + //if t is an intersection type T = CT & I1 & I2 ... & In + //its supertypes CT, I1, ... In might contain wildcards + //so we need to go through capture conversion + base = t.isCompound() ? capture(base) : base; if (base != null) { List ownerParams = owner.type.allparams(); List baseParams = base.allparams(); diff --git a/langtools/test/tools/javac/OverrideChecks/6738538/T6738538a.java b/langtools/test/tools/javac/OverrideChecks/6738538/T6738538a.java new file mode 100644 index 00000000000..183983cdd3e --- /dev/null +++ b/langtools/test/tools/javac/OverrideChecks/6738538/T6738538a.java @@ -0,0 +1,44 @@ +/* + * 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. + * + * 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 6738538 6687444 + * @summary javac crashes when using a type parameter as a covariant method return type + * @author Maurizio Cimadamore + * + * @compile T6738538a.java + */ + +class T6738538a { + + class C { + public T m(){ + return null; + } + } + interface I{ + public T m(); + } + class Crash & I> {} +} \ No newline at end of file diff --git a/langtools/test/tools/javac/OverrideChecks/6738538/T6738538b.java b/langtools/test/tools/javac/OverrideChecks/6738538/T6738538b.java new file mode 100644 index 00000000000..0370abf872b --- /dev/null +++ b/langtools/test/tools/javac/OverrideChecks/6738538/T6738538b.java @@ -0,0 +1,47 @@ +/* + * 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. + * + * 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 6738538 6687444 + * @summary javac crashes when using a type parameter as a covariant method return type + * @author Maurizio Cimadamore + * + * @compile T6738538b.java + */ + +class T6738538b { + interface I1 { + Object m(); + } + + interface I2 {} + + class C1 implements I1 { + public T m() { + return null; + } + } + + class C2 & I2> {} +} \ No newline at end of file From ab5f1cb24b0bce3db599ac8b71d41da1b0b33553 Mon Sep 17 00:00:00 2001 From: Maurizio Cimadamore Date: Thu, 9 Oct 2008 16:04:29 +0100 Subject: [PATCH 041/267] 6724345: incorrect method resolution for enum classes entered as source files Enum's abstract methods shouldn't be skipped during method resolution Reviewed-by: jjg --- .../com/sun/tools/javac/comp/Resolve.java | 2 +- langtools/test/tools/javac/enum/T6724345.java | 51 +++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 langtools/test/tools/javac/enum/T6724345.java diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java index 45dc1d619b7..fa9d3613189 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java @@ -741,7 +741,7 @@ public class Resolve { while (ct.tag == TYPEVAR) ct = ct.getUpperBound(); ClassSymbol c = (ClassSymbol)ct.tsym; - if ((c.flags() & (ABSTRACT | INTERFACE)) == 0) + if ((c.flags() & (ABSTRACT | INTERFACE | ENUM)) == 0) abstractok = false; for (Scope.Entry e = c.members().lookup(name); e.scope != null; diff --git a/langtools/test/tools/javac/enum/T6724345.java b/langtools/test/tools/javac/enum/T6724345.java new file mode 100644 index 00000000000..d71ce5611f6 --- /dev/null +++ b/langtools/test/tools/javac/enum/T6724345.java @@ -0,0 +1,51 @@ +/* + * 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. + * + * 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 6724345 + * + * @summary incorrect method resolution for enum classes entered as source files + * @author Maurizio Cimadamore + * + * @compile T6509042.java + */ + +class T6724345 { + + interface I { + void i(); + } + + class U { + { + I i = E.V; + i.i(); + E.V.i(); + } + } + + enum E implements I { + V {public void i() {}}; + } +} \ No newline at end of file From 7a442ce178248e200ddc64db879bf75c64bc37e7 Mon Sep 17 00:00:00 2001 From: Maurizio Cimadamore Date: Thu, 9 Oct 2008 16:07:38 +0100 Subject: [PATCH 042/267] 6406133: JCDiagnostic.getMessage ignores locale argument Compiler API should take into account locale settings Reviewed-by: jjg --- .../classes/com/sun/tools/apt/util/Bark.java | 4 +- .../com/sun/tools/javac/api/Formattable.java | 7 +- .../sun/tools/javac/api/JavacTaskImpl.java | 6 +- .../com/sun/tools/javac/api/JavacTool.java | 2 + .../com/sun/tools/javac/api/Messages.java | 54 +++++ .../com/sun/tools/javac/code/Kinds.java | 7 +- .../com/sun/tools/javac/code/Symtab.java | 2 +- .../com/sun/tools/javac/code/Types.java | 4 +- .../com/sun/tools/javac/main/Main.java | 8 +- .../com/sun/tools/javac/parser/Token.java | 8 +- .../JavacProcessingEnvironment.java | 11 +- .../util/AbstractDiagnosticFormatter.java | 13 +- .../javac/util/BasicDiagnosticFormatter.java | 10 +- .../sun/tools/javac/util/JCDiagnostic.java | 6 +- .../sun/tools/javac/util/JavacMessages.java | 194 ++++++++++++++++++ .../classes/com/sun/tools/javac/util/Log.java | 16 +- .../javac/util/RawDiagnosticFormatter.java | 2 +- .../test/tools/javac/6457284/T6457284.java | 4 +- .../tools/javac/api/6406133/Erroneous.java | 4 + .../tools/javac/api/6406133/T6406133.java | 109 ++++++++++ 20 files changed, 427 insertions(+), 44 deletions(-) create mode 100644 langtools/src/share/classes/com/sun/tools/javac/api/Messages.java create mode 100644 langtools/src/share/classes/com/sun/tools/javac/util/JavacMessages.java create mode 100644 langtools/test/tools/javac/api/6406133/Erroneous.java create mode 100644 langtools/test/tools/javac/api/6406133/T6406133.java diff --git a/langtools/src/share/classes/com/sun/tools/apt/util/Bark.java b/langtools/src/share/classes/com/sun/tools/apt/util/Bark.java index fe370a0a586..eab7849e0db 100644 --- a/langtools/src/share/classes/com/sun/tools/apt/util/Bark.java +++ b/langtools/src/share/classes/com/sun/tools/apt/util/Bark.java @@ -29,7 +29,7 @@ import com.sun.tools.javac.util.Context; import com.sun.tools.javac.util.JCDiagnostic; import com.sun.tools.javac.util.JCDiagnostic.SimpleDiagnosticPosition; import com.sun.tools.javac.util.Log; -import com.sun.tools.javac.util.Messages; +import com.sun.tools.javac.util.JavacMessages; import com.sun.tools.javac.util.Position; /** A subtype of Log for use in APT. @@ -87,7 +87,7 @@ public class Bark extends Log { context.put(barkKey, this); // register additional resource bundle for APT messages. - Messages aptMessages = Messages.instance(context); + JavacMessages aptMessages = JavacMessages.instance(context); aptMessages.add("com.sun.tools.apt.resources.apt"); aptDiags = new JCDiagnostic.Factory(aptMessages, "apt"); diff --git a/langtools/src/share/classes/com/sun/tools/javac/api/Formattable.java b/langtools/src/share/classes/com/sun/tools/javac/api/Formattable.java index 32821f42095..22e6f77fb0a 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/api/Formattable.java +++ b/langtools/src/share/classes/com/sun/tools/javac/api/Formattable.java @@ -25,7 +25,7 @@ package com.sun.tools.javac.api; -import java.util.ResourceBundle; +import java.util.Locale; /** * This interface must be implemented by any javac class that has non-trivial @@ -39,10 +39,11 @@ public interface Formattable { * Used to obtain a localized String representing the object accordingly * to a given locale * - * @param bundle resource bundle class used for localization + * @param locale locale in which the object's representation is to be rendered + * @param messages messages object used for localization * @return a locale-dependent string representing the object */ - public String toString(ResourceBundle bundle); + public String toString(Locale locale, Messages messages); /** * Retrieve a pretty name of this object's kind * @return a string representing the object's kind diff --git a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java index c7bc83e51d8..0f2ca15b5d3 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java +++ b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java @@ -68,6 +68,7 @@ public class JavacTaskImpl extends JavacTask { private JavacTool tool; private Main compilerMain; private JavaCompiler compiler; + private Locale locale; private String[] args; private Context context; private List fileObjects; @@ -89,6 +90,7 @@ public class JavacTaskImpl extends JavacTask { this.args = args; this.context = context; this.fileObjects = fileObjects; + setLocale(Locale.getDefault()); // null checks compilerMain.getClass(); args.getClass(); @@ -156,9 +158,9 @@ public class JavacTaskImpl extends JavacTask { } public void setLocale(Locale locale) { - // locale argument is ignored, see RFE 6443132 if (used.get()) throw new IllegalStateException(); + this.locale = locale; } private void prepareCompiler() throws IOException { @@ -191,6 +193,8 @@ public class JavacTaskImpl extends JavacTask { if (taskListener != null) context.put(TaskListener.class, wrap(taskListener)); tool.beginContext(context); + //initialize compiler's default locale + JavacMessages.instance(context).setCurrentLocale(locale); } // where private TaskListener wrap(final TaskListener tl) { diff --git a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTool.java b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTool.java index 8d5ec5fb727..e8134d2ef94 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTool.java +++ b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTool.java @@ -49,6 +49,7 @@ import com.sun.tools.javac.main.RecognizedOptions.GrumpyHelper; import com.sun.tools.javac.main.RecognizedOptions; import com.sun.tools.javac.util.Context; import com.sun.tools.javac.util.Log; +import com.sun.tools.javac.util.JavacMessages; import com.sun.tools.javac.util.Options; import com.sun.tools.javac.util.Pair; import java.nio.charset.Charset; @@ -144,6 +145,7 @@ public final class JavacTool implements JavaCompiler { Locale locale, Charset charset) { Context context = new Context(); + JavacMessages.instance(context).setCurrentLocale(locale); if (diagnosticListener != null) context.put(DiagnosticListener.class, diagnosticListener); context.put(Log.outKey, new PrintWriter(System.err, true)); // FIXME diff --git a/langtools/src/share/classes/com/sun/tools/javac/api/Messages.java b/langtools/src/share/classes/com/sun/tools/javac/api/Messages.java new file mode 100644 index 00000000000..7b67fe617cd --- /dev/null +++ b/langtools/src/share/classes/com/sun/tools/javac/api/Messages.java @@ -0,0 +1,54 @@ +/* + * 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 com.sun.tools.javac.api; + +import java.util.Locale; +import java.util.MissingResourceException; + +/** + * This interface defines the minimum requirements in order to provide support + * for localized formatted strings. + * + * @author Maurizio Cimadamore + */ +public interface Messages { + + /** + * Add a new resource bundle to the list that is searched for localized messages. + * @param bundleName the name to identify the resource bundle of localized messages. + * @throws MissingResourceException if the given resource is not found + */ + void add(String bundleName) throws MissingResourceException; + + /** + * Get a localized formatted string + * @param l locale in which the text is to be localized + * @param key locale-independent message key + * @param args misc message arguments + * @return a localized formatted string + */ + String getLocalizedString(Locale l, String key, Object... args); +} diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Kinds.java b/langtools/src/share/classes/com/sun/tools/javac/code/Kinds.java index b86095598e6..2fd6fb736aa 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/code/Kinds.java +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Kinds.java @@ -26,9 +26,10 @@ package com.sun.tools.javac.code; import java.util.EnumSet; -import java.util.ResourceBundle; +import java.util.Locale; import com.sun.tools.javac.api.Formattable; +import com.sun.tools.javac.api.Messages; import static com.sun.tools.javac.code.TypeTags.*; import static com.sun.tools.javac.code.Flags.*; @@ -117,9 +118,9 @@ public class Kinds { return "Kindname"; } - public String toString(ResourceBundle bundle) { + public String toString(Locale locale, Messages messages) { String s = toString(); - return bundle.getString("compiler.misc." + s); + return messages.getLocalizedString(locale, "compiler.misc." + s); } } diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java b/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java index f699a2efbef..a16101f0417 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java @@ -336,7 +336,7 @@ public class Symtab { // create the basic builtin symbols rootPackage = new PackageSymbol(names.empty, null); - final Messages messages = Messages.instance(context); + final JavacMessages messages = JavacMessages.instance(context); unnamedPackage = new PackageSymbol(names.empty, rootPackage) { public String toString() { return messages.getLocalizedString("compiler.misc.unnamed.package"); diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java index 92a8f8a72a3..80a8d002a15 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java @@ -67,7 +67,7 @@ public class Types { new Context.Key(); final Symtab syms; - final Messages messages; + final JavacMessages messages; final Names names; final boolean allowBoxing; final ClassReader reader; @@ -93,7 +93,7 @@ public class Types { source = Source.instance(context); chk = Check.instance(context); capturedName = names.fromString(""); - messages = Messages.instance(context); + messages = JavacMessages.instance(context); } // diff --git a/langtools/src/share/classes/com/sun/tools/javac/main/Main.java b/langtools/src/share/classes/com/sun/tools/javac/main/Main.java index 648b2dcf491..e8165090b4e 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/main/Main.java +++ b/langtools/src/share/classes/com/sun/tools/javac/main/Main.java @@ -484,7 +484,7 @@ public class Main { public static String getLocalizedString(String key, Object... args) { // FIXME sb private try { if (messages == null) - messages = new Messages(javacBundleName); + messages = new JavacMessages(javacBundleName); return messages.getLocalizedString("javac." + key, args); } catch (MissingResourceException e) { @@ -494,18 +494,18 @@ public class Main { public static void useRawMessages(boolean enable) { if (enable) { - messages = new Messages(javacBundleName) { + messages = new JavacMessages(javacBundleName) { public String getLocalizedString(String key, Object... args) { return key; } }; } else { - messages = new Messages(javacBundleName); + messages = new JavacMessages(javacBundleName); } } private static final String javacBundleName = "com.sun.tools.javac.resources.javac"; - private static Messages messages; + private static JavacMessages messages; } diff --git a/langtools/src/share/classes/com/sun/tools/javac/parser/Token.java b/langtools/src/share/classes/com/sun/tools/javac/parser/Token.java index 3479d213374..a49c8b32307 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/parser/Token.java +++ b/langtools/src/share/classes/com/sun/tools/javac/parser/Token.java @@ -25,9 +25,10 @@ package com.sun.tools.javac.parser; -import java.util.ResourceBundle; +import java.util.Locale; import com.sun.tools.javac.api.Formattable; +import com.sun.tools.javac.api.Messages; /** An interface that defines codes for Java source tokens * returned from lexical analysis. @@ -191,8 +192,7 @@ public enum Token implements Formattable { return "Token"; } - public String toString(ResourceBundle bundle) { - String s = toString(); - return s.startsWith("token.") ? bundle.getString("compiler.misc." + s) : s; + public String toString(Locale locale, Messages messages) { + return name != null ? toString() : messages.getLocalizedString(locale, "compiler.misc." + toString()); } } diff --git a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java index ba9888206e3..94944766e83 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java +++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java @@ -69,6 +69,7 @@ import com.sun.tools.javac.util.Context; import com.sun.tools.javac.util.List; import com.sun.tools.javac.util.ListBuffer; import com.sun.tools.javac.util.Log; +import com.sun.tools.javac.util.JavacMessages; import com.sun.tools.javac.util.Name; import com.sun.tools.javac.util.Names; import com.sun.tools.javac.util.Options; @@ -133,9 +134,14 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea */ Source source; + /** + * JavacMessages object used for localization + */ + private JavacMessages messages; + private Context context; - public JavacProcessingEnvironment(Context context, Iterable processors) { + public JavacProcessingEnvironment(Context context, Iterable processors) { options = Options.instance(context); this.context = context; log = Log.instance(context); @@ -157,6 +163,7 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea typeUtils = new JavacTypes(context); processorOptions = initProcessorOptions(context); unmatchedProcessorOptions = initUnmatchedProcessorOptions(); + messages = JavacMessages.instance(context); initProcessorIterator(context, processors); } @@ -1246,7 +1253,7 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea } public Locale getLocale() { - return Locale.getDefault(); + return messages.getCurrentLocale(); } public Set getSpecifiedPackages() { diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java b/langtools/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java index c4daa885e7e..48dbb26982b 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java +++ b/langtools/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java @@ -27,6 +27,7 @@ package com.sun.tools.javac.util; import java.util.Collection; import java.util.Locale; import javax.tools.JavaFileObject; +import java.util.ResourceBundle; import com.sun.tools.javac.api.DiagnosticFormatter; import com.sun.tools.javac.api.Formattable; @@ -48,15 +49,15 @@ import com.sun.tools.javac.file.JavacFileManager; public abstract class AbstractDiagnosticFormatter implements DiagnosticFormatter { /** - * Messages object used by this formatter for i18n + * JavacMessages object used by this formatter for i18n */ - protected Messages messages; + protected JavacMessages messages; /** - * Initialize an AbstractDiagnosticFormatter by setting its Messages object + * Initialize an AbstractDiagnosticFormatter by setting its JavacMessages object * @param messages */ - protected AbstractDiagnosticFormatter(Messages messages) { + protected AbstractDiagnosticFormatter(JavacMessages messages) { this.messages = messages; } @@ -131,7 +132,7 @@ public abstract class AbstractDiagnosticFormatter implements DiagnosticFormatter else if (arg instanceof JavaFileObject) return JavacFileManager.getJavacBaseFileName((JavaFileObject)arg); else if (arg instanceof Formattable) - return ((Formattable)arg).toString(Messages.getDefaultBundle()); + return ((Formattable)arg).toString(l, messages); else return String.valueOf(arg); } @@ -164,6 +165,6 @@ public abstract class AbstractDiagnosticFormatter implements DiagnosticFormatter * @return a locale-dependent string */ protected String localize(Locale l, String key, Object... args) { - return messages.getLocalizedString(key, args); + return messages.getLocalizedString(l, key, args); } } diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java b/langtools/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java index c2499f1cd5a..6dbcb319781 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java +++ b/langtools/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java @@ -59,9 +59,9 @@ public class BasicDiagnosticFormatter extends AbstractDiagnosticFormatter { * Create a basic formatter based on the supplied options. * * @param opts list of command-line options - * @param msgs Messages object used for i18n + * @param msgs JavacMessages object used for i18n */ - BasicDiagnosticFormatter(Options opts, Messages msgs) { + BasicDiagnosticFormatter(Options opts, JavacMessages msgs) { this(msgs); //common init String fmt = opts.get("diags"); if (fmt != null) { @@ -80,9 +80,9 @@ public class BasicDiagnosticFormatter extends AbstractDiagnosticFormatter { /** * Create a standard basic formatter * - * @param msgs Messages object used for i18n + * @param msgs JavacMessages object used for i18n */ - public BasicDiagnosticFormatter(Messages msgs) { + public BasicDiagnosticFormatter(JavacMessages msgs) { super(msgs); availableFormats = new HashMap(); availableFormats.put(DEFAULT_POS_FORMAT, "%f:%l:%_%t%m"); @@ -91,6 +91,8 @@ public class BasicDiagnosticFormatter extends AbstractDiagnosticFormatter { } public String format(JCDiagnostic d, Locale l) { + if (l == null) + l = messages.getCurrentLocale(); String format = selectFormat(d); StringBuilder buf = new StringBuilder(); for (int i = 0; i < format.length(); i++) { diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/JCDiagnostic.java b/langtools/src/share/classes/com/sun/tools/javac/util/JCDiagnostic.java index 2ecac0850e8..2e8227fbba7 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/util/JCDiagnostic.java +++ b/langtools/src/share/classes/com/sun/tools/javac/util/JCDiagnostic.java @@ -64,12 +64,12 @@ public class JCDiagnostic implements Diagnostic { /** Create a new diagnostic factory. */ protected Factory(Context context) { - this(Messages.instance(context), "compiler"); + this(JavacMessages.instance(context), "compiler"); context.put(diagnosticFactoryKey, this); } /** Create a new diagnostic factory. */ - public Factory(Messages messages, String prefix) { + public Factory(JavacMessages messages, String prefix) { this.prefix = prefix; this.formatter = new BasicDiagnosticFormatter(messages); } @@ -178,7 +178,7 @@ public class JCDiagnostic implements Diagnostic { @Deprecated public static DiagnosticFormatter getFragmentFormatter() { if (fragmentFormatter == null) { - fragmentFormatter = new BasicDiagnosticFormatter(Messages.getDefaultMessages()); + fragmentFormatter = new BasicDiagnosticFormatter(JavacMessages.getDefaultMessages()); } return fragmentFormatter; } diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/JavacMessages.java b/langtools/src/share/classes/com/sun/tools/javac/util/JavacMessages.java new file mode 100644 index 00000000000..e67fde5e747 --- /dev/null +++ b/langtools/src/share/classes/com/sun/tools/javac/util/JavacMessages.java @@ -0,0 +1,194 @@ +/* + * Copyright 2005 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 com.sun.tools.javac.util; + +import com.sun.tools.javac.api.Messages; +import java.lang.ref.SoftReference; +import java.util.ResourceBundle; +import java.util.MissingResourceException; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; + +/** + * Support for formatted localized messages. + * + *

This is NOT part of any API supported by Sun Microsystems. If + * you write code that depends on this, you do so at your own risk. + * This code and its internal interfaces are subject to change or + * deletion without notice. + */ +public class JavacMessages implements Messages { + /** The context key for the JavacMessages object. */ + protected static final Context.Key messagesKey = + new Context.Key(); + + /** Get the JavacMessages instance for this context. */ + public static JavacMessages instance(Context context) { + JavacMessages instance = context.get(messagesKey); + if (instance == null) + instance = new JavacMessages(context); + return instance; + } + + private Map>> bundleCache; + + private List bundleNames; + + private Locale currentLocale; + private List currentBundles; + + public Locale getCurrentLocale() { + return currentLocale; + } + + public void setCurrentLocale(Locale locale) { + if (locale == null) { + locale = Locale.getDefault(); + } + this.currentBundles = getBundles(locale); + this.currentLocale = locale; + } + + /** Creates a JavacMessages object. + */ + public JavacMessages(Context context) { + this(defaultBundleName); + context.put(messagesKey, this); + } + + /** Creates a JavacMessages object. + * @param bundleName the name to identify the resource buundle of localized messages. + */ + public JavacMessages(String bundleName) throws MissingResourceException { + bundleNames = List.nil(); + bundleCache = new HashMap>>(); + add(bundleName); + setCurrentLocale(Locale.getDefault()); + } + + public JavacMessages() throws MissingResourceException { + this(defaultBundleName); + } + + public void add(String bundleName) throws MissingResourceException { + bundleNames = bundleNames.prepend(bundleName); + if (!bundleCache.isEmpty()) + bundleCache.clear(); + } + + public List getBundles(Locale locale) { + if (locale == currentLocale) + return currentBundles; + SoftReference> bundles = bundleCache.get(locale); + List bundleList = bundles == null ? null : bundles.get(); + if (bundleList == null) { + bundleList = List.nil(); + for (String bundleName : bundleNames) { + try { + ResourceBundle rb = ResourceBundle.getBundle(bundleName, locale); + bundleList = bundleList.prepend(rb); + } catch (MissingResourceException e) { + throw new InternalError("Cannot find javac resource bundle for locale " + locale); + } + } + bundleCache.put(locale, new SoftReference>(bundleList)); + } + return bundleList; + } + + /** Gets the localized string corresponding to a key, formatted with a set of args. + */ + public String getLocalizedString(String key, Object... args) { + return getLocalizedString(currentLocale, key, args); + } + + public String getLocalizedString(Locale l, String key, Object... args) { + if (l == null) + l = getCurrentLocale(); + return getLocalizedString(getBundles(l), key, args); + } + + /* Static access: + * javac has a firmly entrenched notion of a default message bundle + * which it can access from any static context. This is used to get + * easy access to simple localized strings. + */ + + private static final String defaultBundleName = + "com.sun.tools.javac.resources.compiler"; + private static ResourceBundle defaultBundle; + private static JavacMessages defaultMessages; + + + /** + * Gets a localized string from the compiler's default bundle. + */ + // used to support legacy Log.getLocalizedString + static String getDefaultLocalizedString(String key, Object... args) { + return getLocalizedString(List.of(getDefaultBundle()), key, args); + } + + // used to support legacy static Diagnostic.fragment + @Deprecated + static JavacMessages getDefaultMessages() { + if (defaultMessages == null) + defaultMessages = new JavacMessages(defaultBundleName); + return defaultMessages; + } + + public static ResourceBundle getDefaultBundle() { + try { + if (defaultBundle == null) + defaultBundle = ResourceBundle.getBundle(defaultBundleName); + return defaultBundle; + } + catch (MissingResourceException e) { + throw new Error("Fatal: Resource for compiler is missing", e); + } + } + + private static String getLocalizedString(List bundles, + String key, + Object... args) { + String msg = null; + for (List l = bundles; l.nonEmpty() && msg == null; l = l.tail) { + ResourceBundle rb = l.head; + try { + msg = rb.getString(key); + } + catch (MissingResourceException e) { + // ignore, try other bundles in list + } + } + if (msg == null) { + msg = "compiler message file broken: key=" + key + + " arguments={0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}"; + } + return MessageFormat.format(msg, args); + } +} diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/Log.java b/langtools/src/share/classes/com/sun/tools/javac/util/Log.java index d4d7c123cc6..e0aeb12bf6a 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/util/Log.java +++ b/langtools/src/share/classes/com/sun/tools/javac/util/Log.java @@ -29,7 +29,6 @@ import java.io.*; import java.util.HashSet; import java.util.Map; import java.util.Set; -import java.util.Locale; import javax.tools.DiagnosticListener; import javax.tools.JavaFileObject; @@ -97,6 +96,11 @@ public class Log extends AbstractLog { */ private DiagnosticFormatter diagFormatter; + /** + * JavacMessages object used for localization + */ + private JavacMessages messages; + /** Construct a log with given I/O redirections. */ @Deprecated @@ -115,9 +119,9 @@ public class Log extends AbstractLog { this.MaxWarnings = getIntOption(options, "-Xmaxwarns", 100); boolean rawDiagnostics = options.get("rawDiagnostics") != null; - Messages msgs = Messages.instance(context); - this.diagFormatter = rawDiagnostics ? new RawDiagnosticFormatter(msgs) : - new BasicDiagnosticFormatter(options, msgs); + messages = JavacMessages.instance(context); + this.diagFormatter = rawDiagnostics ? new RawDiagnosticFormatter(messages) : + new BasicDiagnosticFormatter(options, messages); @SuppressWarnings("unchecked") // FIXME DiagnosticListener diagListener = context.get(DiagnosticListener.class); @@ -335,7 +339,7 @@ public class Log extends AbstractLog { PrintWriter writer = getWriterForDiagnosticType(diag.getType()); - printLines(writer, diagFormatter.format(diag, Locale.getDefault())); + printLines(writer, diagFormatter.format(diag, messages.getCurrentLocale())); if (diagFormatter.displaySource(diag)) { int pos = diag.getIntPosition(); if (pos != Position.NOPOS) { @@ -384,7 +388,7 @@ public class Log extends AbstractLog { * @param args Fields to substitute into the string. */ public static String getLocalizedString(String key, Object ... args) { - return Messages.getDefaultLocalizedString("compiler.misc." + key, args); + return JavacMessages.getDefaultLocalizedString("compiler.misc." + key, args); } /*************************************************************************** diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/RawDiagnosticFormatter.java b/langtools/src/share/classes/com/sun/tools/javac/util/RawDiagnosticFormatter.java index 3d51e248dfe..d5f37bb085a 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/util/RawDiagnosticFormatter.java +++ b/langtools/src/share/classes/com/sun/tools/javac/util/RawDiagnosticFormatter.java @@ -41,7 +41,7 @@ public class RawDiagnosticFormatter extends AbstractDiagnosticFormatter { * Create a formatter based on the supplied options. * @param msgs */ - public RawDiagnosticFormatter(Messages msgs) { + public RawDiagnosticFormatter(JavacMessages msgs) { super(null); } diff --git a/langtools/test/tools/javac/6457284/T6457284.java b/langtools/test/tools/javac/6457284/T6457284.java index 3cf58ab9cef..64b10867e16 100644 --- a/langtools/test/tools/javac/6457284/T6457284.java +++ b/langtools/test/tools/javac/6457284/T6457284.java @@ -35,7 +35,7 @@ import javax.lang.model.element.Element; import com.sun.tools.javac.api.JavacTaskImpl; import com.sun.tools.javac.util.Context; import com.sun.tools.javac.util.List; -import com.sun.tools.javac.util.Messages; +import com.sun.tools.javac.util.JavacMessages; import javax.tools.*; @@ -63,7 +63,7 @@ public class T6457284 { throw new AssertionError("No top-level classes!"); } - static class MyMessages extends Messages { + static class MyMessages extends JavacMessages { static void preRegister(Context context) { context.put(messagesKey, new MyMessages()); } diff --git a/langtools/test/tools/javac/api/6406133/Erroneous.java b/langtools/test/tools/javac/api/6406133/Erroneous.java new file mode 100644 index 00000000000..ecd230006ff --- /dev/null +++ b/langtools/test/tools/javac/api/6406133/Erroneous.java @@ -0,0 +1,4 @@ +@Deprecated +class A { + class A {} +} diff --git a/langtools/test/tools/javac/api/6406133/T6406133.java b/langtools/test/tools/javac/api/6406133/T6406133.java new file mode 100644 index 00000000000..165207595c8 --- /dev/null +++ b/langtools/test/tools/javac/api/6406133/T6406133.java @@ -0,0 +1,109 @@ +/* + * 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. + * + * 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 6443132 6406133 6597678 + * @summary Compiler API ignores locale settings + * @author Maurizio Cimadamore + * @library ../lib + */ + +import javax.tools.*; +import javax.annotation.processing.*; +import javax.lang.model.element.*; +import java.util.*; +import java.io.*; + +public class T6406133 extends ToolTester { + + List locales = Arrays.asList(Locale.US, Locale.JAPAN, Locale.CHINA); + + class DiagnosticTester implements DiagnosticListener { + Locale locale; + String result; + + DiagnosticTester(Locale locale) { + this.locale = locale; + } + public void report(Diagnostic diagnostic) { + result = diagnostic.getMessage(locale); //6406133 + } + } + + class ProcessorTester extends AbstractProcessor { + + Locale locale; + + public Set getSupportedAnnotationTypes() { + return new HashSet(Arrays.asList("*")); + } + + public void init(ProcessingEnvironment env) { + locale = env.getLocale(); + } + + public boolean process(Set annotations, RoundEnvironment roundEnv) { + return true; + } + } + + void compare(Locale loc1, Locale loc2, boolean useListener) { + String res1 = exec(useListener, loc1); + String res2 = exec(useListener, loc2); + boolean success = (loc1.equals(loc2) && res1.equals(res2)) || + (!loc1.equals(loc2) && !res1.equals(res2)); + if (!success) + throw new AssertionError("Error in diagnostic localization"); + } + + String exec(boolean useListener, Locale locale) { + final Iterable compilationUnits = + fm.getJavaFileObjects(new File(test_src, "Erroneous.java")); + StringWriter pw = new StringWriter(); + DiagnosticTester listener = useListener ? new DiagnosticTester(locale) : null; + ProcessorTester processor = new ProcessorTester(); + task = tool.getTask(pw, fm, listener, null, null, compilationUnits); + task.setProcessors(Arrays.asList(processor)); + task.setLocale(locale); //6443132 + task.call(); + if (!processor.locale.equals(locale)) + throw new AssertionError("Error in diagnostic localization during annotation processing"); + String res = useListener ? listener.result : pw.toString(); + System.err.println("[locale:"+ locale + ", listener:" + useListener + "] " +res); + return res; + } + + void test() { + for (Locale l1 : locales) { + for (Locale l2 : locales) { + compare(l1, l2, true); + compare(l1, l2, false); + } + } + } + + public static void main(String... args) throws Exception { + new T6406133().test(); + } +} From 68c9df411087a16a6313c63ed0ddd74b44c2a0d6 Mon Sep 17 00:00:00 2001 From: Maurizio Cimadamore Date: Thu, 9 Oct 2008 16:19:13 +0100 Subject: [PATCH 043/267] 6731573: diagnostic output should optionally include source line Added an -XD option to optionally prints out source lines in error messages Reviewed-by: jjg --- .../util/AbstractDiagnosticFormatter.java | 36 +++++- .../javac/util/BasicDiagnosticFormatter.java | 16 ++- .../classes/com/sun/tools/javac/util/Log.java | 10 +- .../javac/util/RawDiagnosticFormatter.java | 10 +- .../tools/javac/api/6731573/Erroneous.java | 4 + .../tools/javac/api/6731573/T6731573.java | 109 ++++++++++++++++++ 6 files changed, 163 insertions(+), 22 deletions(-) create mode 100644 langtools/test/tools/javac/api/6731573/Erroneous.java create mode 100644 langtools/test/tools/javac/api/6731573/T6731573.java diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java b/langtools/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java index 48dbb26982b..9ac5788516a 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java +++ b/langtools/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java @@ -33,6 +33,7 @@ import com.sun.tools.javac.api.DiagnosticFormatter; import com.sun.tools.javac.api.Formattable; import com.sun.tools.javac.api.DiagnosticFormatter.PositionKind; import com.sun.tools.javac.file.JavacFileManager; +import static com.sun.tools.javac.util.JCDiagnostic.DiagnosticType.*; /** * This abstract class provides a basic implementation of the functionalities that should be provided @@ -52,13 +53,21 @@ public abstract class AbstractDiagnosticFormatter implements DiagnosticFormatter * JavacMessages object used by this formatter for i18n */ protected JavacMessages messages; + protected boolean showSource; /** * Initialize an AbstractDiagnosticFormatter by setting its JavacMessages object * @param messages */ - protected AbstractDiagnosticFormatter(JavacMessages messages) { + protected AbstractDiagnosticFormatter(JavacMessages messages, Options options, boolean showSource) { this.messages = messages; + this.showSource = options.get("showSource") == null ? showSource : + options.get("showSource").equals("true"); + } + + protected AbstractDiagnosticFormatter(JavacMessages messages, boolean showSource) { + this.messages = messages; + this.showSource = showSource; } public String formatMessage(JCDiagnostic d, Locale l) { @@ -156,6 +165,27 @@ public abstract class AbstractDiagnosticFormatter implements DiagnosticFormatter return sbuf.toString(); } + /** Format the faulty source code line and point to the error. + * @param d The diagnostic for which the error line should be printed + */ + protected String formatSourceLine(JCDiagnostic d) { + StringBuilder buf = new StringBuilder(); + DiagnosticSource source = d.getDiagnosticSource(); + int pos = d.getIntPosition(); + if (d.getIntPosition() != Position.NOPOS) { + String line = (source == null ? null : source.getLine(pos)); + if (line == null) + return ""; + buf.append(line+"\n"); + int col = source.getColumnNumber(pos, false); + for (int i = 0; i < col - 1; i++) { + buf.append((line.charAt(i) == '\t') ? "\t" : " "); + } + buf.append("^"); + } + return buf.toString(); + } + /** * Converts a String into a locale-dependent representation accordingly to a given locale * @@ -167,4 +197,8 @@ public abstract class AbstractDiagnosticFormatter implements DiagnosticFormatter protected String localize(Locale l, String key, Object... args) { return messages.getLocalizedString(l, key, args); } + + public boolean displaySource(JCDiagnostic d) { + return showSource && d.getType() != FRAGMENT; + } } diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java b/langtools/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java index 6dbcb319781..345e2628c96 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java +++ b/langtools/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java @@ -62,7 +62,8 @@ public class BasicDiagnosticFormatter extends AbstractDiagnosticFormatter { * @param msgs JavacMessages object used for i18n */ BasicDiagnosticFormatter(Options opts, JavacMessages msgs) { - this(msgs); //common init + super(msgs, opts, true); + initAvailableFormats(); String fmt = opts.get("diags"); if (fmt != null) { String[] formats = fmt.split("\\|"); @@ -83,7 +84,11 @@ public class BasicDiagnosticFormatter extends AbstractDiagnosticFormatter { * @param msgs JavacMessages object used for i18n */ public BasicDiagnosticFormatter(JavacMessages msgs) { - super(msgs); + super(msgs, true); + initAvailableFormats(); + } + + public void initAvailableFormats() { availableFormats = new HashMap(); availableFormats.put(DEFAULT_POS_FORMAT, "%f:%l:%_%t%m"); availableFormats.put(DEFAULT_NO_POS_FORMAT, "%p%m"); @@ -104,6 +109,9 @@ public class BasicDiagnosticFormatter extends AbstractDiagnosticFormatter { } buf.append(meta ? formatMeta(c, d, l) : String.valueOf(c)); } + if (displaySource(d)) { + buf.append("\n" + formatSourceLine(d)); + } return buf.toString(); } @@ -167,10 +175,6 @@ public class BasicDiagnosticFormatter extends AbstractDiagnosticFormatter { return format; } - public boolean displaySource(JCDiagnostic d) { - return true; - } - /** * This enum contains all the kinds of formatting patterns supported * by a basic diagnostic formatter. diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/Log.java b/langtools/src/share/classes/com/sun/tools/javac/util/Log.java index e0aeb12bf6a..222ab4de301 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/util/Log.java +++ b/langtools/src/share/classes/com/sun/tools/javac/util/Log.java @@ -120,7 +120,7 @@ public class Log extends AbstractLog { boolean rawDiagnostics = options.get("rawDiagnostics") != null; messages = JavacMessages.instance(context); - this.diagFormatter = rawDiagnostics ? new RawDiagnosticFormatter(messages) : + this.diagFormatter = rawDiagnostics ? new RawDiagnosticFormatter(options) : new BasicDiagnosticFormatter(options, messages); @SuppressWarnings("unchecked") // FIXME DiagnosticListener diagListener = @@ -340,14 +340,6 @@ public class Log extends AbstractLog { PrintWriter writer = getWriterForDiagnosticType(diag.getType()); printLines(writer, diagFormatter.format(diag, messages.getCurrentLocale())); - if (diagFormatter.displaySource(diag)) { - int pos = diag.getIntPosition(); - if (pos != Position.NOPOS) { - JavaFileObject prev = useSource(diag.getSource()); - printErrLine(pos, writer); - useSource(prev); - } - } if (promptOnError) { switch (diag.getType()) { diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/RawDiagnosticFormatter.java b/langtools/src/share/classes/com/sun/tools/javac/util/RawDiagnosticFormatter.java index d5f37bb085a..5aa6ae35af2 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/util/RawDiagnosticFormatter.java +++ b/langtools/src/share/classes/com/sun/tools/javac/util/RawDiagnosticFormatter.java @@ -41,8 +41,8 @@ public class RawDiagnosticFormatter extends AbstractDiagnosticFormatter { * Create a formatter based on the supplied options. * @param msgs */ - public RawDiagnosticFormatter(JavacMessages msgs) { - super(null); + public RawDiagnosticFormatter(Options opts) { + super(null, opts, false); } //provide common default formats @@ -61,6 +61,8 @@ public class RawDiagnosticFormatter extends AbstractDiagnosticFormatter { buf.append('-'); buf.append(' '); buf.append(formatMessage(d, null)); + if (displaySource(d)) + buf.append("\n" + formatSourceLine(d)); return buf.toString(); } catch (Exception e) { @@ -94,8 +96,4 @@ public class RawDiagnosticFormatter extends AbstractDiagnosticFormatter { } return buf.toString(); } - - public boolean displaySource(JCDiagnostic d) { - return false; - } } diff --git a/langtools/test/tools/javac/api/6731573/Erroneous.java b/langtools/test/tools/javac/api/6731573/Erroneous.java new file mode 100644 index 00000000000..10ce9051a27 --- /dev/null +++ b/langtools/test/tools/javac/api/6731573/Erroneous.java @@ -0,0 +1,4 @@ +class A { + boolean b; + boolean b; +} \ No newline at end of file diff --git a/langtools/test/tools/javac/api/6731573/T6731573.java b/langtools/test/tools/javac/api/6731573/T6731573.java new file mode 100644 index 00000000000..01fac8b6f44 --- /dev/null +++ b/langtools/test/tools/javac/api/6731573/T6731573.java @@ -0,0 +1,109 @@ +/* + * 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. + * + * 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 6731573 + * @summary diagnostic output should optionally include source line + * @author Maurizio Cimadamore + * @library ../lib + */ + +import java.io.*; +import java.util.*; +import javax.tools.*; + +public class T6731573 extends ToolTester { + + enum DiagnosticType { + BASIC(null) { + boolean shouldDisplaySource(SourceLine sourceLine) { + return sourceLine != SourceLine.DISABLED; + } + }, + RAW("-XDrawDiagnostics") { + boolean shouldDisplaySource(SourceLine sourceLine) { + return sourceLine == SourceLine.ENABLED; + } + }; + + String optValue; + + DiagnosticType(String optValue) { + this.optValue = optValue; + } + + abstract boolean shouldDisplaySource(SourceLine sourceLine); + } + + enum SourceLine { + STANDARD(null), + ENABLED("-XDshowSource=true"), + DISABLED("-XDshowSource=false"); + + String optValue; + + SourceLine(String optValue) { + this.optValue = optValue; + } + } + + void checkErrorLine(String output, boolean expected, List options) { + System.err.println("\noptions = "+options); + System.err.println(output); + boolean errLinePresent = output.contains("^"); + if (errLinePresent != expected) { + throw new AssertionError("Error in diagnostic: error line" + + (expected ? "" : " not") + " expected but" + + (errLinePresent ? "" : " not") + " found"); + } + } + + void exec(DiagnosticType diagType, SourceLine sourceLine) { + final Iterable compilationUnits = + fm.getJavaFileObjects(new File(test_src, "Erroneous.java")); + StringWriter pw = new StringWriter(); + ArrayList options = new ArrayList(); + if (diagType.optValue != null) + options.add(diagType.optValue); + if (sourceLine.optValue != null) + options.add(sourceLine.optValue); + task = tool.getTask(pw, fm, null, options, null, compilationUnits); + task.call(); + checkErrorLine(pw.toString(), + diagType.shouldDisplaySource(sourceLine), + options); + } + + void test() { + for (DiagnosticType dt : DiagnosticType.values()) { + for (SourceLine sl : SourceLine.values()) { + exec(dt, sl); + } + } + } + + public static void main(String... args) throws Exception { + new T6731573().test(); + } +} \ No newline at end of file From c09e705e045ce724bef0c2cd0a2cc4bca7181259 Mon Sep 17 00:00:00 2001 From: Maurizio Cimadamore Date: Thu, 9 Oct 2008 16:21:04 +0100 Subject: [PATCH 044/267] 6586091: javac crashes with StackOverflowError Types.adapt should avoid infinite loops by exploiting a local cache Reviewed-by: jjg --- .../com/sun/tools/javac/code/Types.java | 185 ++++++++++-------- .../tools/javac/cast/6586091/T6586091.java | 38 ++++ 2 files changed, 142 insertions(+), 81 deletions(-) create mode 100644 langtools/test/tools/javac/cast/6586091/T6586091.java diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java index 80a8d002a15..f7d0352bc28 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java @@ -3213,6 +3213,7 @@ public class Types { containsType(t, s) && containsType(s, t); } + // /** * Adapt a type by computing a substitution which maps a source * type to a target type. @@ -3226,92 +3227,113 @@ public class Types { Type target, ListBuffer from, ListBuffer to) throws AdaptFailure { - Map mapping = new HashMap(); - adaptRecursive(source, target, from, to, mapping); - List fromList = from.toList(); - List toList = to.toList(); - while (!fromList.isEmpty()) { - Type val = mapping.get(fromList.head.tsym); - if (toList.head != val) - toList.head = val; - fromList = fromList.tail; - toList = toList.tail; - } + new Adapter(from, to).adapt(source, target); } - // where - private void adaptRecursive(Type source, - Type target, - ListBuffer from, - ListBuffer to, - Map mapping) throws AdaptFailure { - if (source.tag == TYPEVAR) { - // Check to see if there is - // already a mapping for $source$, in which case - // the old mapping will be merged with the new - Type val = mapping.get(source.tsym); - if (val != null) { - if (val.isSuperBound() && target.isSuperBound()) { - val = isSubtype(lowerBound(val), lowerBound(target)) - ? target : val; - } else if (val.isExtendsBound() && target.isExtendsBound()) { - val = isSubtype(upperBound(val), upperBound(target)) - ? val : target; - } else if (!isSameType(val, target)) { - throw new AdaptFailure(); - } - } else { - val = target; - from.append(source); - to.append(target); - } - mapping.put(source.tsym, val); - } else if (source.tag == target.tag) { - switch (source.tag) { - case CLASS: - adapt(source.allparams(), target.allparams(), - from, to, mapping); - break; - case ARRAY: - adaptRecursive(elemtype(source), elemtype(target), - from, to, mapping); - break; - case WILDCARD: - if (source.isExtendsBound()) { - adaptRecursive(upperBound(source), upperBound(target), - from, to, mapping); - } else if (source.isSuperBound()) { - adaptRecursive(lowerBound(source), lowerBound(target), - from, to, mapping); - } - break; - } - } - } - public static class AdaptFailure extends Exception { - static final long serialVersionUID = -7490231548272701566L; + + class Adapter extends SimpleVisitor { + + ListBuffer from; + ListBuffer to; + Map mapping; + + Adapter(ListBuffer from, ListBuffer to) { + this.from = from; + this.to = to; + mapping = new HashMap(); } - /** - * Adapt a type by computing a substitution which maps a list of - * source types to a list of target types. - * - * @param source the source type - * @param target the target type - * @param from the type variables of the computed substitution - * @param to the types of the computed substitution. - */ - private void adapt(List source, - List target, - ListBuffer from, - ListBuffer to, - Map mapping) throws AdaptFailure { - if (source.length() == target.length()) { - while (source.nonEmpty()) { - adaptRecursive(source.head, target.head, from, to, mapping); - source = source.tail; - target = target.tail; + public void adapt(Type source, Type target) throws AdaptFailure { + visit(source, target); + List fromList = from.toList(); + List toList = to.toList(); + while (!fromList.isEmpty()) { + Type val = mapping.get(fromList.head.tsym); + if (toList.head != val) + toList.head = val; + fromList = fromList.tail; + toList = toList.tail; } } + + @Override + public Void visitClassType(ClassType source, Type target) throws AdaptFailure { + if (target.tag == CLASS) + adaptRecursive(source.allparams(), target.allparams()); + return null; + } + + @Override + public Void visitArrayType(ArrayType source, Type target) throws AdaptFailure { + if (target.tag == ARRAY) + adaptRecursive(elemtype(source), elemtype(target)); + return null; + } + + @Override + public Void visitWildcardType(WildcardType source, Type target) throws AdaptFailure { + if (source.isExtendsBound()) + adaptRecursive(upperBound(source), upperBound(target)); + else if (source.isSuperBound()) + adaptRecursive(lowerBound(source), lowerBound(target)); + return null; + } + + @Override + public Void visitTypeVar(TypeVar source, Type target) throws AdaptFailure { + // Check to see if there is + // already a mapping for $source$, in which case + // the old mapping will be merged with the new + Type val = mapping.get(source.tsym); + if (val != null) { + if (val.isSuperBound() && target.isSuperBound()) { + val = isSubtype(lowerBound(val), lowerBound(target)) + ? target : val; + } else if (val.isExtendsBound() && target.isExtendsBound()) { + val = isSubtype(upperBound(val), upperBound(target)) + ? val : target; + } else if (!isSameType(val, target)) { + throw new AdaptFailure(); + } + } else { + val = target; + from.append(source); + to.append(target); + } + mapping.put(source.tsym, val); + return null; + } + + @Override + public Void visitType(Type source, Type target) { + return null; + } + + private Set cache = new HashSet(); + + private void adaptRecursive(Type source, Type target) { + TypePair pair = new TypePair(source, target); + if (cache.add(pair)) { + try { + visit(source, target); + } finally { + cache.remove(pair); + } + } + } + + private void adaptRecursive(List source, List target) { + if (source.length() == target.length()) { + while (source.nonEmpty()) { + adaptRecursive(source.head, target.head); + source = source.tail; + target = target.tail; + } + } + } + } + + public static class AdaptFailure extends RuntimeException { + static final long serialVersionUID = -7490231548272701566L; } private void adaptSelf(Type t, @@ -3326,6 +3348,7 @@ public class Types { throw new AssertionError(ex); } } + // /** * Rewrite all type variables (universal quantifiers) in the given diff --git a/langtools/test/tools/javac/cast/6586091/T6586091.java b/langtools/test/tools/javac/cast/6586091/T6586091.java new file mode 100644 index 00000000000..5cc9ae8aa75 --- /dev/null +++ b/langtools/test/tools/javac/cast/6586091/T6586091.java @@ -0,0 +1,38 @@ +/* + * 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. + * + * 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 + * @author Maurizio Cimadamore + * @bug 6586091 + * @summary javac crashes with StackOverflowError + * @compile T6586091.java + */ + +class T6586091 { + static class A> {} + static class B extends A> {} + + A> t = null; + B c = (B)t; +} \ No newline at end of file From 246d79484df576e0313d25059409a617ffb34168 Mon Sep 17 00:00:00 2001 From: Daniel Fuchs Date: Fri, 10 Oct 2008 10:58:08 +0200 Subject: [PATCH 045/267] 6758165: ConnectorBootstrap.DefaultValues should have a default value for USE_LOCAL_ONLY Reviewed-by: alanb, emcmanus --- .../classes/sun/management/jmxremote/ConnectorBootstrap.java | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/src/share/classes/sun/management/jmxremote/ConnectorBootstrap.java b/jdk/src/share/classes/sun/management/jmxremote/ConnectorBootstrap.java index 74a1d41352c..1ff66405e5e 100644 --- a/jdk/src/share/classes/sun/management/jmxremote/ConnectorBootstrap.java +++ b/jdk/src/share/classes/sun/management/jmxremote/ConnectorBootstrap.java @@ -99,6 +99,7 @@ public final class ConnectorBootstrap { public static final String PORT = "0"; public static final String CONFIG_FILE_NAME = "management.properties"; public static final String USE_SSL = "true"; + public static final String USE_LOCAL_ONLY = "true"; public static final String USE_REGISTRY_SSL = "false"; public static final String USE_AUTHENTICATION = "true"; public static final String PASSWORD_FILE_NAME = "jmxremote.password"; From e585263735cbe19a35fad41ef57e40d992771fff Mon Sep 17 00:00:00 2001 From: Chuck Rasbold Date: Fri, 10 Oct 2008 09:47:56 -0700 Subject: [PATCH 046/267] 6752257: Use NOT instead of XOR -1 on x86 Add match rule for xor -1 Reviewed-by: never, kvn --- hotspot/src/cpu/x86/vm/x86_32.ad | 34 ++++++++++++++++++++++++++++++++ hotspot/src/cpu/x86/vm/x86_64.ad | 22 +++++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/hotspot/src/cpu/x86/vm/x86_32.ad b/hotspot/src/cpu/x86/vm/x86_32.ad index a4a4199312d..589051e06bf 100644 --- a/hotspot/src/cpu/x86/vm/x86_32.ad +++ b/hotspot/src/cpu/x86/vm/x86_32.ad @@ -4810,6 +4810,16 @@ operand immL0() %{ interface(CONST_INTER); %} +// Long Immediate zero +operand immL_M1() %{ + predicate( n->get_long() == -1L ); + match(ConL); + op_cost(0); + + format %{ %} + interface(CONST_INTER); +%} + // Long immediate from 0 to 127. // Used for a shorter form of long mul by 10. operand immL_127() %{ @@ -8621,6 +8631,18 @@ instruct xorI_eReg(eRegI dst, eRegI src, eFlagsReg cr) %{ ins_pipe( ialu_reg_reg ); %} +// Xor Register with Immediate -1 +instruct xorI_eReg_im1(eRegI dst, immI_M1 imm) %{ + match(Set dst (XorI dst imm)); + + size(2); + format %{ "NOT $dst" %} + ins_encode %{ + __ notl($dst$$Register); + %} + ins_pipe( ialu_reg ); +%} + // Xor Register with Immediate instruct xorI_eReg_imm(eRegI dst, immI src, eFlagsReg cr) %{ match(Set dst (XorI dst src)); @@ -8938,6 +8960,18 @@ instruct xorl_eReg(eRegL dst, eRegL src, eFlagsReg cr) %{ ins_pipe( ialu_reg_reg_long ); %} +// Xor Long Register with Immediate -1 +instruct xorl_eReg_im1(eRegL dst, immL_M1 imm) %{ + match(Set dst (XorL dst imm)); + format %{ "NOT $dst.lo\n\t" + "NOT $dst.hi" %} + ins_encode %{ + __ notl($dst$$Register); + __ notl(HIGH_FROM_LOW($dst$$Register)); + %} + ins_pipe( ialu_reg_long ); +%} + // Xor Long Register with Immediate instruct xorl_eReg_imm(eRegL dst, immL src, eFlagsReg cr) %{ match(Set dst (XorL dst src)); diff --git a/hotspot/src/cpu/x86/vm/x86_64.ad b/hotspot/src/cpu/x86/vm/x86_64.ad index 62b46da14b0..4245284593d 100644 --- a/hotspot/src/cpu/x86/vm/x86_64.ad +++ b/hotspot/src/cpu/x86/vm/x86_64.ad @@ -9309,6 +9309,17 @@ instruct xorI_rReg(rRegI dst, rRegI src, rFlagsReg cr) ins_pipe(ialu_reg_reg); %} +// Xor Register with Immediate -1 +instruct xorI_rReg_im1(rRegI dst, immI_M1 imm) %{ + match(Set dst (XorI dst imm)); + + format %{ "not $dst" %} + ins_encode %{ + __ notl($dst$$Register); + %} + ins_pipe(ialu_reg); +%} + // Xor Register with Immediate instruct xorI_rReg_imm(rRegI dst, immI src, rFlagsReg cr) %{ @@ -9529,6 +9540,17 @@ instruct xorL_rReg(rRegL dst, rRegL src, rFlagsReg cr) ins_pipe(ialu_reg_reg); %} +// Xor Register with Immediate -1 +instruct xorL_rReg_im1(rRegL dst, immL_M1 imm) %{ + match(Set dst (XorL dst imm)); + + format %{ "notq $dst" %} + ins_encode %{ + __ notq($dst$$Register); + %} + ins_pipe(ialu_reg); +%} + // Xor Register with Immediate instruct xorL_rReg_imm(rRegL dst, immL32 src, rFlagsReg cr) %{ From 7add953cfed8e32165b7b721971ebe225874e77c Mon Sep 17 00:00:00 2001 From: Xueming Shen Date: Mon, 13 Oct 2008 14:45:27 -0700 Subject: [PATCH 047/267] 5025260: Register methods should throw ClosedChannelException instead of NPE Update the spec and implementation to throw ClosedSelectorException Reviewed-by: alanb --- .../java/nio/channels/SelectableChannel.java | 6 ++ .../spi/AbstractSelectableChannel.java | 10 +++ .../sun/nio/ch/AbstractPollSelectorImpl.java | 50 +++++++----- .../sun/nio/ch/DevPollSelectorImpl.java | 68 ++++++++-------- .../classes/sun/nio/ch/EPollSelectorImpl.java | 66 ++++++++-------- .../sun/nio/ch/WindowsSelectorImpl.java | 77 +++++++++++-------- .../channels/Selector/CloseThenRegister.java | 48 ++++++++++++ 7 files changed, 206 insertions(+), 119 deletions(-) create mode 100644 jdk/test/java/nio/channels/Selector/CloseThenRegister.java diff --git a/jdk/src/share/classes/java/nio/channels/SelectableChannel.java b/jdk/src/share/classes/java/nio/channels/SelectableChannel.java index 10f523d0430..f11439f54a1 100644 --- a/jdk/src/share/classes/java/nio/channels/SelectableChannel.java +++ b/jdk/src/share/classes/java/nio/channels/SelectableChannel.java @@ -191,6 +191,9 @@ public abstract class SelectableChannel * @throws ClosedChannelException * If this channel is closed * + * @throws ClosedSelectorException + * If the selector is closed + * * @throws IllegalBlockingModeException * If this channel is in blocking mode * @@ -246,6 +249,9 @@ public abstract class SelectableChannel * @throws ClosedChannelException * If this channel is closed * + * @throws ClosedSelectorException + * If the selector is closed + * * @throws IllegalBlockingModeException * If this channel is in blocking mode * diff --git a/jdk/src/share/classes/java/nio/channels/spi/AbstractSelectableChannel.java b/jdk/src/share/classes/java/nio/channels/spi/AbstractSelectableChannel.java index 73fcf3d130e..3b1d31c5ebb 100644 --- a/jdk/src/share/classes/java/nio/channels/spi/AbstractSelectableChannel.java +++ b/jdk/src/share/classes/java/nio/channels/spi/AbstractSelectableChannel.java @@ -175,6 +175,16 @@ public abstract class AbstractSelectableChannel * the selector is invoked while holding the appropriate locks. The * resulting key is added to this channel's key set before being returned. *

+ * + * @throws ClosedSelectorException {@inheritDoc} + * + * @throws IllegalBlockingModeException {@inheritDoc} + * + * @throws IllegalSelectorException {@inheritDoc} + * + * @throws CancelledKeyException {@inheritDoc} + * + * @throws IllegalArgumentException {@inheritDoc} */ public final SelectionKey register(Selector sel, int ops, Object att) diff --git a/jdk/src/share/classes/sun/nio/ch/AbstractPollSelectorImpl.java b/jdk/src/share/classes/sun/nio/ch/AbstractPollSelectorImpl.java index 5016a03851b..4b95d869321 100644 --- a/jdk/src/share/classes/sun/nio/ch/AbstractPollSelectorImpl.java +++ b/jdk/src/share/classes/sun/nio/ch/AbstractPollSelectorImpl.java @@ -58,6 +58,9 @@ abstract class AbstractPollSelectorImpl // True if this Selector has been closed private boolean closed = false; + // Lock for close and cleanup + private Object closeLock = new Object(); + AbstractPollSelectorImpl(SelectorProvider sp, int channels, int offset) { super(sp); this.totalChannels = channels; @@ -65,7 +68,11 @@ abstract class AbstractPollSelectorImpl } void putEventOps(SelectionKeyImpl sk, int ops) { - pollWrapper.putEventOps(sk.getIndex(), ops); + synchronized (closeLock) { + if (closed) + throw new ClosedSelectorException(); + pollWrapper.putEventOps(sk.getIndex(), ops); + } } public Selector wakeup() { @@ -76,7 +83,9 @@ abstract class AbstractPollSelectorImpl protected abstract int doSelect(long timeout) throws IOException; protected void implClose() throws IOException { - if (!closed) { + synchronized (closeLock) { + if (closed) + return; closed = true; // Deregister channels for(int i=channelOffset; i fdToKey; // True if this Selector has been closed private boolean closed = false; + // Lock for close/cleanup + private Object closeLock = new Object(); + // Lock for interrupt triggering and clearing private Object interruptLock = new Object(); private boolean interruptTriggered = false; @@ -72,7 +72,6 @@ class DevPollSelectorImpl pollWrapper = new DevPollArrayWrapper(); pollWrapper.initInterrupt(fd0, fd1); fdToKey = new HashMap(); - totalChannels = 1; } protected int doSelect(long timeout) @@ -131,45 +130,39 @@ class DevPollSelectorImpl } protected void implClose() throws IOException { - if (!closed) { - closed = true; + if (closed) + return; + closed = true; - // prevent further wakeup - synchronized (interruptLock) { - interruptTriggered = true; - } - - FileDispatcher.closeIntFD(fd0); - FileDispatcher.closeIntFD(fd1); - if (pollWrapper != null) { - - pollWrapper.release(fd0); - pollWrapper.closeDevPollFD(); - pollWrapper = null; - selectedKeys = null; - - // Deregister channels - Iterator i = keys.iterator(); - while (i.hasNext()) { - SelectionKeyImpl ski = (SelectionKeyImpl)i.next(); - deregister(ski); - SelectableChannel selch = ski.channel(); - if (!selch.isOpen() && !selch.isRegistered()) - ((SelChImpl)selch).kill(); - i.remove(); - } - totalChannels = 0; - - } - fd0 = -1; - fd1 = -1; + // prevent further wakeup + synchronized (interruptLock) { + interruptTriggered = true; } + + FileDispatcher.closeIntFD(fd0); + FileDispatcher.closeIntFD(fd1); + + pollWrapper.release(fd0); + pollWrapper.closeDevPollFD(); + selectedKeys = null; + + // Deregister channels + Iterator i = keys.iterator(); + while (i.hasNext()) { + SelectionKeyImpl ski = (SelectionKeyImpl)i.next(); + deregister(ski); + SelectableChannel selch = ski.channel(); + if (!selch.isOpen() && !selch.isRegistered()) + ((SelChImpl)selch).kill(); + i.remove(); + } + fd0 = -1; + fd1 = -1; } protected void implRegister(SelectionKeyImpl ski) { int fd = IOUtil.fdVal(ski.channel.getFD()); fdToKey.put(Integer.valueOf(fd), ski); - totalChannels++; keys.add(ski); } @@ -179,7 +172,6 @@ class DevPollSelectorImpl int fd = ski.channel.getFDVal(); fdToKey.remove(Integer.valueOf(fd)); pollWrapper.release(fd); - totalChannels--; ski.setIndex(-1); keys.remove(ski); selectedKeys.remove(ski); @@ -190,6 +182,8 @@ class DevPollSelectorImpl } void putEventOps(SelectionKeyImpl sk, int ops) { + if (closed) + throw new ClosedSelectorException(); int fd = IOUtil.fdVal(sk.channel.getFD()); pollWrapper.setInterest(fd, ops); } diff --git a/jdk/src/solaris/classes/sun/nio/ch/EPollSelectorImpl.java b/jdk/src/solaris/classes/sun/nio/ch/EPollSelectorImpl.java index b9193435c79..e23cfa75dc0 100644 --- a/jdk/src/solaris/classes/sun/nio/ch/EPollSelectorImpl.java +++ b/jdk/src/solaris/classes/sun/nio/ch/EPollSelectorImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2008 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2005-2007 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,7 +31,6 @@ import java.nio.channels.spi.*; import java.util.*; import sun.misc.*; - /** * An implementation of Selector for Linux 2.6+ kernels that uses * the epoll event notification facility. @@ -51,7 +50,7 @@ class EPollSelectorImpl private Map fdToKey; // True if this Selector has been closed - private boolean closed = false; + private volatile boolean closed = false; // Lock for interrupt triggering and clearing private Object interruptLock = new Object(); @@ -128,40 +127,41 @@ class EPollSelectorImpl } protected void implClose() throws IOException { - if (!closed) { - closed = true; + if (closed) + return; + closed = true; - // prevent further wakeup - synchronized (interruptLock) { - interruptTriggered = true; - } - - FileDispatcher.closeIntFD(fd0); - FileDispatcher.closeIntFD(fd1); - if (pollWrapper != null) { - - pollWrapper.release(fd0); - pollWrapper.closeEPollFD(); - pollWrapper = null; - selectedKeys = null; - - // Deregister channels - Iterator i = keys.iterator(); - while (i.hasNext()) { - SelectionKeyImpl ski = (SelectionKeyImpl)i.next(); - deregister(ski); - SelectableChannel selch = ski.channel(); - if (!selch.isOpen() && !selch.isRegistered()) - ((SelChImpl)selch).kill(); - i.remove(); - } - } - fd0 = -1; - fd1 = -1; + // prevent further wakeup + synchronized (interruptLock) { + interruptTriggered = true; } + + FileDispatcher.closeIntFD(fd0); + FileDispatcher.closeIntFD(fd1); + + pollWrapper.release(fd0); + pollWrapper.closeEPollFD(); + // it is possible + selectedKeys = null; + + // Deregister channels + Iterator i = keys.iterator(); + while (i.hasNext()) { + SelectionKeyImpl ski = (SelectionKeyImpl)i.next(); + deregister(ski); + SelectableChannel selch = ski.channel(); + if (!selch.isOpen() && !selch.isRegistered()) + ((SelChImpl)selch).kill(); + i.remove(); + } + + fd0 = -1; + fd1 = -1; } protected void implRegister(SelectionKeyImpl ski) { + if (closed) + throw new ClosedSelectorException(); int fd = IOUtil.fdVal(ski.channel.getFD()); fdToKey.put(Integer.valueOf(fd), ski); pollWrapper.add(fd); @@ -183,6 +183,8 @@ class EPollSelectorImpl } void putEventOps(SelectionKeyImpl sk, int ops) { + if (closed) + throw new ClosedSelectorException(); int fd = IOUtil.fdVal(sk.channel.getFD()); pollWrapper.setInterest(fd, ops); } diff --git a/jdk/src/windows/classes/sun/nio/ch/WindowsSelectorImpl.java b/jdk/src/windows/classes/sun/nio/ch/WindowsSelectorImpl.java index ac25ac0803a..a73351615fc 100644 --- a/jdk/src/windows/classes/sun/nio/ch/WindowsSelectorImpl.java +++ b/jdk/src/windows/classes/sun/nio/ch/WindowsSelectorImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2002-2007 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 @@ -80,6 +80,9 @@ final class WindowsSelectorImpl extends SelectorImpl { // File descriptors corresponding to source and sink private final int wakeupSourceFd, wakeupSinkFd; + // Lock for close cleanup + private Object closeLock = new Object(); + // Maps file descriptors to their indices in pollArray private final static class FdMap extends HashMap { static final long serialVersionUID = 0L; @@ -473,42 +476,48 @@ final class WindowsSelectorImpl extends SelectorImpl { } protected void implClose() throws IOException { - if (channelArray != null) { - if (pollWrapper != null) { - // prevent further wakeup - synchronized (interruptLock) { - interruptTriggered = true; - } - wakeupPipe.sink().close(); - wakeupPipe.source().close(); - for(int i = 1; i < totalChannels; i++) { // Deregister channels - if (i % MAX_SELECTABLE_FDS != 0) { // skip wakeupEvent - deregister(channelArray[i]); - SelectableChannel selch = channelArray[i].channel(); - if (!selch.isOpen() && !selch.isRegistered()) - ((SelChImpl)selch).kill(); + synchronized (closeLock) { + if (channelArray != null) { + if (pollWrapper != null) { + // prevent further wakeup + synchronized (interruptLock) { + interruptTriggered = true; } - } - pollWrapper.free(); - pollWrapper = null; - selectedKeys = null; - channelArray = null; - threads.clear(); - // Call startThreads. All remaining helper threads now exit, - // since threads.size() = 0; - startLock.startThreads(); + wakeupPipe.sink().close(); + wakeupPipe.source().close(); + for(int i = 1; i < totalChannels; i++) { // Deregister channels + if (i % MAX_SELECTABLE_FDS != 0) { // skip wakeupEvent + deregister(channelArray[i]); + SelectableChannel selch = channelArray[i].channel(); + if (!selch.isOpen() && !selch.isRegistered()) + ((SelChImpl)selch).kill(); + } + } + pollWrapper.free(); + pollWrapper = null; + selectedKeys = null; + channelArray = null; + threads.clear(); + // Call startThreads. All remaining helper threads now exit, + // since threads.size() = 0; + startLock.startThreads(); + } } } } protected void implRegister(SelectionKeyImpl ski) { - growIfNeeded(); - channelArray[totalChannels] = ski; - ski.setIndex(totalChannels); - fdMap.put(ski); - keys.add(ski); - pollWrapper.addEntry(totalChannels, ski); - totalChannels++; + synchronized (closeLock) { + if (pollWrapper == null) + throw new ClosedSelectorException(); + growIfNeeded(); + channelArray[totalChannels] = ski; + ski.setIndex(totalChannels); + fdMap.put(ski); + keys.add(ski); + pollWrapper.addEntry(totalChannels, ski); + totalChannels++; + } } private void growIfNeeded() { @@ -554,7 +563,11 @@ final class WindowsSelectorImpl extends SelectorImpl { } void putEventOps(SelectionKeyImpl sk, int ops) { - pollWrapper.putEventOps(sk.getIndex(), ops); + synchronized (closeLock) { + if (pollWrapper == null) + throw new ClosedSelectorException(); + pollWrapper.putEventOps(sk.getIndex(), ops); + } } public Selector wakeup() { diff --git a/jdk/test/java/nio/channels/Selector/CloseThenRegister.java b/jdk/test/java/nio/channels/Selector/CloseThenRegister.java new file mode 100644 index 00000000000..0fbb7b9d3a1 --- /dev/null +++ b/jdk/test/java/nio/channels/Selector/CloseThenRegister.java @@ -0,0 +1,48 @@ +/* + * 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. + * + * 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 5025260 + * @summary ClosedSelectorException is expected when register after close + */ + +import java.net.*; +import java.nio.channels.*; + +public class CloseThenRegister { + + public static void main (String [] args) throws Exception { + try { + Selector s = Selector.open(); + s.close(); + ServerSocketChannel c = ServerSocketChannel.open(); + c.socket().bind(new InetSocketAddress(40000)); + c.configureBlocking(false); + c.register(s, SelectionKey.OP_ACCEPT); + } catch (ClosedSelectorException cse) { + return; + } + throw new RuntimeException("register after close does not cause CSE!"); + } + +} From bc9f3649179146506fee6702bdd0eb585dfdeeda Mon Sep 17 00:00:00 2001 From: Igor Veresov Date: Mon, 13 Oct 2008 21:41:42 -0700 Subject: [PATCH 048/267] 6758633: G1: SEGV with GCOld on Linux Avoid growth of a GrowableArray backend of HeapRegionSeq. Reviewed-by: tonyp, jcoomes --- .../src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp | 2 +- hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp | 5 +++-- hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.hpp | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index 0c605e2c2ac..370745f36e1 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -1398,7 +1398,7 @@ jint G1CollectedHeap::initialize() { _g1_storage.initialize(g1_rs, 0); _g1_committed = MemRegion((HeapWord*)_g1_storage.low(), (size_t) 0); _g1_max_committed = _g1_committed; - _hrs = new HeapRegionSeq(); + _hrs = new HeapRegionSeq(_expansion_regions); guarantee(_hrs != NULL, "Couldn't allocate HeapRegionSeq"); guarantee(_cur_alloc_region == NULL, "from constructor"); diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp index 5be6ab2b3bb..315e4a351b3 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp @@ -37,7 +37,7 @@ static int orderRegions(HeapRegion** hr1p, HeapRegion** hr2p) { return 0; } -HeapRegionSeq::HeapRegionSeq() : +HeapRegionSeq::HeapRegionSeq(const size_t max_size) : _alloc_search_start(0), // The line below is the worst bit of C++ hackery I've ever written // (Detlefs, 11/23). You should think of it as equivalent to @@ -50,7 +50,7 @@ HeapRegionSeq::HeapRegionSeq() : _regions((ResourceObj::operator new (sizeof(GrowableArray), (void*)&_regions, ResourceObj::C_HEAP), - 100), + (int)max_size), true), _next_rr_candidate(0), _seq_bottom(NULL) @@ -167,6 +167,7 @@ int HeapRegionSeq::find(HeapRegion* hr) { // Public methods. void HeapRegionSeq::insert(HeapRegion* hr) { + assert(!_regions.is_full(), "Too many elements in HeapRegionSeq"); if (_regions.length() == 0 || _regions.top()->end() <= hr->bottom()) { hr->set_hrs_index(_regions.length()); diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.hpp index ec930f9b28d..a79ff99f4a2 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.hpp @@ -49,7 +49,7 @@ class HeapRegionSeq: public CHeapObj { public: // Initializes "this" to the empty sequence of regions. - HeapRegionSeq(); + HeapRegionSeq(const size_t max_size); // Adds "hr" to "this" sequence. Requires "hr" not to overlap with // any region already in "this". (Will perform better if regions are From 0dac6431d2275b54e0b8f86a29ce372d1618247f Mon Sep 17 00:00:00 2001 From: Chuck Rasbold Date: Tue, 14 Oct 2008 06:58:58 -0700 Subject: [PATCH 049/267] 6717150: improper constant folding of subnormal strictfp multiplications and divides Suppress constant folding of double divides and multiplications on ia32 Reviewed-by: never --- hotspot/src/share/vm/opto/divnode.cpp | 17 ++++++++++++----- hotspot/src/share/vm/opto/mulnode.cpp | 10 +++++++++- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/hotspot/src/share/vm/opto/divnode.cpp b/hotspot/src/share/vm/opto/divnode.cpp index a37597e05c8..94240873ef5 100644 --- a/hotspot/src/share/vm/opto/divnode.cpp +++ b/hotspot/src/share/vm/opto/divnode.cpp @@ -710,11 +710,18 @@ const Type *DivDNode::Value( PhaseTransform *phase ) const { if( t2 == TypeD::ONE ) return t1; - // If divisor is a constant and not zero, divide them numbers - if( t1->base() == Type::DoubleCon && - t2->base() == Type::DoubleCon && - t2->getd() != 0.0 ) // could be negative zero - return TypeD::make( t1->getd()/t2->getd() ); +#if defined(IA32) + if (!phase->C->method()->is_strict()) + // Can't trust native compilers to properly fold strict double + // division with round-to-zero on this platform. +#endif + { + // If divisor is a constant and not zero, divide them numbers + if( t1->base() == Type::DoubleCon && + t2->base() == Type::DoubleCon && + t2->getd() != 0.0 ) // could be negative zero + return TypeD::make( t1->getd()/t2->getd() ); + } // If the dividend is a constant zero // Note: if t1 and t2 are zero then result is NaN (JVMS page 213) diff --git a/hotspot/src/share/vm/opto/mulnode.cpp b/hotspot/src/share/vm/opto/mulnode.cpp index 22ea890c95a..5cdcbafbc4b 100644 --- a/hotspot/src/share/vm/opto/mulnode.cpp +++ b/hotspot/src/share/vm/opto/mulnode.cpp @@ -152,6 +152,14 @@ const Type *MulNode::Value( PhaseTransform *phase ) const { if( t1 == Type::BOTTOM || t2 == Type::BOTTOM ) return bottom_type(); +#if defined(IA32) + // Can't trust native compilers to properly fold strict double + // multiplication with round-to-zero on this platform. + if (op == Op_MulD && phase->C->method()->is_strict()) { + return TypeD::DOUBLE; + } +#endif + return mul_ring(t1,t2); // Local flavor of type multiplication } @@ -360,7 +368,7 @@ const Type *MulFNode::mul_ring(const Type *t0, const Type *t1) const { // Compute the product type of two double ranges into this node. const Type *MulDNode::mul_ring(const Type *t0, const Type *t1) const { if( t0 == Type::DOUBLE || t1 == Type::DOUBLE ) return Type::DOUBLE; - // We must be adding 2 double constants. + // We must be multiplying 2 double constants. return TypeD::make( t0->getd() * t1->getd() ); } From d1aacc7cdff5ed6699b12c93a4e87e63f0beabac Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Tue, 14 Oct 2008 10:15:33 -0400 Subject: [PATCH 050/267] 6700107: java/lang/Class/forName/TooManyDimensions.java crashes with SIGSEGV in c2 compiler with fastdebug ObjArrayKlass::compute_modifier_flags was unnecessarily recursive Reviewed-by: kamg --- hotspot/src/share/vm/oops/objArrayKlass.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hotspot/src/share/vm/oops/objArrayKlass.cpp b/hotspot/src/share/vm/oops/objArrayKlass.cpp index 8811fa22b58..1f2574b9c43 100644 --- a/hotspot/src/share/vm/oops/objArrayKlass.cpp +++ b/hotspot/src/share/vm/oops/objArrayKlass.cpp @@ -475,8 +475,8 @@ jint objArrayKlass::compute_modifier_flags(TRAPS) const { assert(Universe::is_bootstrapping(), "partial objArray only at startup"); return JVM_ACC_ABSTRACT | JVM_ACC_FINAL | JVM_ACC_PUBLIC; } - // Recurse down the element list - jint element_flags = Klass::cast(element_klass())->compute_modifier_flags(CHECK_0); + // Return the flags of the bottom element type. + jint element_flags = Klass::cast(bottom_klass())->compute_modifier_flags(CHECK_0); return (element_flags & (JVM_ACC_PUBLIC | JVM_ACC_PRIVATE | JVM_ACC_PROTECTED)) | (JVM_ACC_ABSTRACT | JVM_ACC_FINAL); From 1dc1dcab49f1635276025d5646f4ce76673d0a2d Mon Sep 17 00:00:00 2001 From: Maurizio Cimadamore Date: Tue, 14 Oct 2008 17:05:48 +0100 Subject: [PATCH 051/267] 6759143: com.sun.tools.javac.util.Messages is obsolete and should be removed Push for 6406133 should have removed com.sun.tools.javac.util.Messages Reviewed-by: jjg --- .../com/sun/tools/javac/util/Messages.java | 157 ------------------ 1 file changed, 157 deletions(-) delete mode 100644 langtools/src/share/classes/com/sun/tools/javac/util/Messages.java diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/Messages.java b/langtools/src/share/classes/com/sun/tools/javac/util/Messages.java deleted file mode 100644 index 48eff2e0c69..00000000000 --- a/langtools/src/share/classes/com/sun/tools/javac/util/Messages.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright 2005 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 com.sun.tools.javac.util; - -import java.util.ResourceBundle; -import java.util.MissingResourceException; -import java.text.MessageFormat; - -/** - * Support for localized messages. - * - *

This is NOT part of any API supported by Sun Microsystems. If - * you write code that depends on this, you do so at your own risk. - * This code and its internal interfaces are subject to change or - * deletion without notice. - */ -public class Messages { - /** The context key for the Messages object. */ - protected static final Context.Key messagesKey = - new Context.Key(); - - /** Get the Messages instance for this context. */ - public static Messages instance(Context context) { - Messages instance = context.get(messagesKey); - if (instance == null) - instance = new Messages(context); - return instance; - } - - private List bundles = List.nil(); - - /** Creates a Messages object. - */ - public Messages(Context context) { - context.put(messagesKey, this); - add(getDefaultBundle()); - } - - /** Creates a Messages object. - * @param bundle the name to identify the resource buundle of localized messages. - */ - public Messages(String bundleName) throws MissingResourceException { - add(bundleName); - } - - /** Creates a Messages object. - * @param bundle the name to identif the resource buundle of localized messages. - */ - public Messages(ResourceBundle bundle) throws MissingResourceException { - add(bundle); - } - - /** Add a new resource bundle to the list that is searched for localized messages. - * @param bundle the name to identify the resource bundle of localized messages. - */ - public void add(String bundleName) throws MissingResourceException { - add(ResourceBundle.getBundle(bundleName)); - } - - /** Add a new resource bundle to the list that is searched for localized messages. - * Resource bundles will be searched in reverse order in which they are added. - * @param bundle the bundle of localized messages. - */ - public void add(ResourceBundle bundle) { - bundles = bundles.prepend(bundle); - } - - /** Gets the localized string corresponding to a key, formatted with a set of args. - */ - public String getLocalizedString(String key, Object... args) { - return getLocalizedString(bundles, key, args); - } - - - /* Static access: - * javac has a firmly entrenched notion of a default message bundle - * which it can access from any static context. This is used to get - * easy access to simple localized strings. - */ - - private static final String defaultBundleName = - "com.sun.tools.javac.resources.compiler"; - private static ResourceBundle defaultBundle; - private static Messages defaultMessages; - - - /** - * Gets a localized string from the compiler's default bundle. - */ - // used to support legacy Log.getLocalizedString - static String getDefaultLocalizedString(String key, Object... args) { - return getLocalizedString(List.of(getDefaultBundle()), key, args); - } - - // used to support legacy static Diagnostic.fragment - static Messages getDefaultMessages() { - if (defaultMessages == null) - defaultMessages = new Messages(getDefaultBundle()); - return defaultMessages; - } - - public static ResourceBundle getDefaultBundle() { - try { - if (defaultBundle == null) - defaultBundle = ResourceBundle.getBundle(defaultBundleName); - return defaultBundle; - } - catch (MissingResourceException e) { - throw new Error("Fatal: Resource for compiler is missing", e); - } - } - - private static String getLocalizedString(List bundles, - String key, - Object... args) { - String msg = null; - for (List l = bundles; l.nonEmpty() && msg == null; l = l.tail) { - ResourceBundle rb = l.head; - try { - msg = rb.getString(key); - } - catch (MissingResourceException e) { - // ignore, try other bundles in list - } - } - if (msg == null) { - msg = "compiler message file broken: key=" + key + - " arguments={0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}"; - } - return MessageFormat.format(msg, args); - } - - -} From 55925534ec50b30885d976548b49ba1307bbd11e Mon Sep 17 00:00:00 2001 From: Vladimir Kozlov Date: Tue, 14 Oct 2008 15:10:26 -0700 Subject: [PATCH 052/267] 6532536: Optimize arraycopy stubs for Intel cpus Use SSE2 movdqu in arraycopy stubs on newest Intel's cpus Reviewed-by: rasbold --- hotspot/src/cpu/x86/vm/assembler_x86.cpp | 29 +++++ hotspot/src/cpu/x86/vm/assembler_x86.hpp | 5 + .../src/cpu/x86/vm/stubGenerator_x86_32.cpp | 118 +++++++++++++++--- .../src/cpu/x86/vm/stubGenerator_x86_64.cpp | 49 +++++--- hotspot/src/cpu/x86/vm/vm_version_x86_32.cpp | 25 ++-- hotspot/src/cpu/x86/vm/vm_version_x86_32.hpp | 30 +++-- hotspot/src/cpu/x86/vm/vm_version_x86_64.cpp | 23 +++- hotspot/src/cpu/x86/vm/vm_version_x86_64.hpp | 30 +++-- hotspot/src/os/solaris/vm/os_solaris.cpp | 2 +- hotspot/src/share/vm/runtime/globals.hpp | 6 + 10 files changed, 239 insertions(+), 78 deletions(-) diff --git a/hotspot/src/cpu/x86/vm/assembler_x86.cpp b/hotspot/src/cpu/x86/vm/assembler_x86.cpp index 6a8fff0cc9d..ec208540ad0 100644 --- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp +++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp @@ -1575,6 +1575,35 @@ void Assembler::movdqa(Address dst, XMMRegister src) { emit_operand(src, dst); } +void Assembler::movdqu(XMMRegister dst, Address src) { + NOT_LP64(assert(VM_Version::supports_sse2(), "")); + InstructionMark im(this); + emit_byte(0xF3); + prefix(src, dst); + emit_byte(0x0F); + emit_byte(0x6F); + emit_operand(dst, src); +} + +void Assembler::movdqu(XMMRegister dst, XMMRegister src) { + NOT_LP64(assert(VM_Version::supports_sse2(), "")); + emit_byte(0xF3); + int encode = prefixq_and_encode(dst->encoding(), src->encoding()); + emit_byte(0x0F); + emit_byte(0x6F); + emit_byte(0xC0 | encode); +} + +void Assembler::movdqu(Address dst, XMMRegister src) { + NOT_LP64(assert(VM_Version::supports_sse2(), "")); + InstructionMark im(this); + emit_byte(0xF3); + prefix(dst, src); + emit_byte(0x0F); + emit_byte(0x7F); + emit_operand(src, dst); +} + // Uses zero extension on 64bit void Assembler::movl(Register dst, int32_t imm32) { diff --git a/hotspot/src/cpu/x86/vm/assembler_x86.hpp b/hotspot/src/cpu/x86/vm/assembler_x86.hpp index aea3f108f32..c2b64771803 100644 --- a/hotspot/src/cpu/x86/vm/assembler_x86.hpp +++ b/hotspot/src/cpu/x86/vm/assembler_x86.hpp @@ -1055,6 +1055,11 @@ private: void movdqa(XMMRegister dst, Address src); void movdqa(XMMRegister dst, XMMRegister src); + // Move Unaligned Double Quadword + void movdqu(Address dst, XMMRegister src); + void movdqu(XMMRegister dst, Address src); + void movdqu(XMMRegister dst, XMMRegister src); + void movl(Register dst, int32_t imm32); void movl(Address dst, int32_t imm32); void movl(Register dst, Register src); diff --git a/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp b/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp index 21092074a11..6da932d4c90 100644 --- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp +++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp @@ -791,6 +791,69 @@ class StubGenerator: public StubCodeGenerator { } } + + // Copy 64 bytes chunks + // + // Inputs: + // from - source array address + // to_from - destination array address - from + // qword_count - 8-bytes element count, negative + // + void xmm_copy_forward(Register from, Register to_from, Register qword_count) { + assert( UseSSE >= 2, "supported cpu only" ); + 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); + __ BIND(L_copy_64_bytes_loop); + + if(UseUnalignedLoadStores) { + __ movdqu(xmm0, Address(from, 0)); + __ movdqu(Address(from, to_from, Address::times_1, 0), xmm0); + __ movdqu(xmm1, Address(from, 16)); + __ movdqu(Address(from, to_from, Address::times_1, 16), xmm1); + __ movdqu(xmm2, Address(from, 32)); + __ movdqu(Address(from, to_from, Address::times_1, 32), xmm2); + __ movdqu(xmm3, Address(from, 48)); + __ movdqu(Address(from, to_from, Address::times_1, 48), xmm3); + + } else { + __ movq(xmm0, Address(from, 0)); + __ movq(Address(from, to_from, Address::times_1, 0), xmm0); + __ movq(xmm1, Address(from, 8)); + __ movq(Address(from, to_from, Address::times_1, 8), xmm1); + __ movq(xmm2, Address(from, 16)); + __ movq(Address(from, to_from, Address::times_1, 16), xmm2); + __ movq(xmm3, Address(from, 24)); + __ movq(Address(from, to_from, Address::times_1, 24), xmm3); + __ movq(xmm4, Address(from, 32)); + __ movq(Address(from, to_from, Address::times_1, 32), xmm4); + __ movq(xmm5, Address(from, 40)); + __ movq(Address(from, to_from, Address::times_1, 40), xmm5); + __ movq(xmm6, Address(from, 48)); + __ movq(Address(from, to_from, Address::times_1, 48), xmm6); + __ movq(xmm7, Address(from, 56)); + __ movq(Address(from, to_from, Address::times_1, 56), xmm7); + } + + __ addl(from, 64); + __ BIND(L_copy_64_bytes); + __ subl(qword_count, 8); + __ jcc(Assembler::greaterEqual, L_copy_64_bytes_loop); + __ addl(qword_count, 8); + __ jccb(Assembler::zero, L_exit); + // + // length is too short, just copy qwords + // + __ BIND(L_copy_8_bytes); + __ movq(xmm0, Address(from, 0)); + __ movq(Address(from, to_from, Address::times_1), xmm0); + __ addl(from, 8); + __ decrement(qword_count); + __ jcc(Assembler::greater, L_copy_8_bytes); + __ BIND(L_exit); + } + // Copy 64 bytes chunks // // Inputs: @@ -799,6 +862,7 @@ class StubGenerator: public StubCodeGenerator { // qword_count - 8-bytes element count, negative // void mmx_copy_forward(Register from, Register to_from, Register qword_count) { + assert( VM_Version::supports_mmx(), "supported cpu only" ); 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); @@ -876,7 +940,7 @@ class StubGenerator: public StubCodeGenerator { __ subptr(to, from); // to --> to_from __ cmpl(count, 2< to_from if (VM_Version::supports_mmx()) { - mmx_copy_forward(from, to_from, count); + if (UseXMMForArrayCopy) { + xmm_copy_forward(from, to_from, count); + } else { + mmx_copy_forward(from, to_from, count); + } } else { __ jmpb(L_copy_8_bytes); __ align(16); @@ -1196,8 +1277,13 @@ class StubGenerator: public StubCodeGenerator { __ align(16); __ BIND(L_copy_8_bytes_loop); if (VM_Version::supports_mmx()) { - __ movq(mmx0, Address(from, count, Address::times_8)); - __ movq(Address(to, count, Address::times_8), mmx0); + if (UseXMMForArrayCopy) { + __ movq(xmm0, Address(from, count, Address::times_8)); + __ movq(Address(to, count, Address::times_8), xmm0); + } else { + __ movq(mmx0, Address(from, count, Address::times_8)); + __ movq(Address(to, count, Address::times_8), mmx0); + } } else { __ fild_d(Address(from, count, Address::times_8)); __ fistp_d(Address(to, count, Address::times_8)); @@ -1206,7 +1292,7 @@ class StubGenerator: public StubCodeGenerator { __ decrement(count); __ jcc(Assembler::greaterEqual, L_copy_8_bytes_loop); - if (VM_Version::supports_mmx()) { + if (VM_Version::supports_mmx() && !UseXMMForArrayCopy) { __ emms(); } inc_copy_counter_np(T_LONG); diff --git a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp index 680167158cc..33f6e88ee6d 100644 --- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp @@ -1251,6 +1251,7 @@ class StubGenerator: public StubCodeGenerator { } } + // Copy big chunks forward // // Inputs: @@ -1268,14 +1269,22 @@ class StubGenerator: public StubCodeGenerator { Label L_loop; __ align(16); __ BIND(L_loop); - __ movq(to, Address(end_from, qword_count, Address::times_8, -24)); - __ movq(Address(end_to, qword_count, Address::times_8, -24), to); - __ movq(to, Address(end_from, qword_count, Address::times_8, -16)); - __ movq(Address(end_to, qword_count, Address::times_8, -16), to); - __ movq(to, Address(end_from, qword_count, Address::times_8, - 8)); - __ movq(Address(end_to, qword_count, Address::times_8, - 8), to); - __ movq(to, Address(end_from, qword_count, Address::times_8, - 0)); - __ movq(Address(end_to, qword_count, Address::times_8, - 0), to); + if(UseUnalignedLoadStores) { + __ movdqu(xmm0, Address(end_from, qword_count, Address::times_8, -24)); + __ movdqu(Address(end_to, qword_count, Address::times_8, -24), xmm0); + __ movdqu(xmm1, Address(end_from, qword_count, Address::times_8, - 8)); + __ movdqu(Address(end_to, qword_count, Address::times_8, - 8), xmm1); + + } else { + __ movq(to, Address(end_from, qword_count, Address::times_8, -24)); + __ movq(Address(end_to, qword_count, Address::times_8, -24), to); + __ movq(to, Address(end_from, qword_count, Address::times_8, -16)); + __ movq(Address(end_to, qword_count, Address::times_8, -16), to); + __ movq(to, Address(end_from, qword_count, Address::times_8, - 8)); + __ movq(Address(end_to, qword_count, Address::times_8, - 8), to); + __ movq(to, Address(end_from, qword_count, Address::times_8, - 0)); + __ movq(Address(end_to, qword_count, Address::times_8, - 0), to); + } __ BIND(L_copy_32_bytes); __ addptr(qword_count, 4); __ jcc(Assembler::lessEqual, L_loop); @@ -1301,14 +1310,22 @@ class StubGenerator: public StubCodeGenerator { Label L_loop; __ align(16); __ BIND(L_loop); - __ movq(to, Address(from, qword_count, Address::times_8, 24)); - __ movq(Address(dest, qword_count, Address::times_8, 24), to); - __ movq(to, Address(from, qword_count, Address::times_8, 16)); - __ movq(Address(dest, qword_count, Address::times_8, 16), to); - __ movq(to, Address(from, qword_count, Address::times_8, 8)); - __ movq(Address(dest, qword_count, Address::times_8, 8), to); - __ movq(to, Address(from, qword_count, Address::times_8, 0)); - __ movq(Address(dest, qword_count, Address::times_8, 0), to); + if(UseUnalignedLoadStores) { + __ movdqu(xmm0, Address(from, qword_count, Address::times_8, 16)); + __ movdqu(Address(dest, qword_count, Address::times_8, 16), xmm0); + __ movdqu(xmm1, Address(from, qword_count, Address::times_8, 0)); + __ movdqu(Address(dest, qword_count, Address::times_8, 0), xmm1); + + } else { + __ movq(to, Address(from, qword_count, Address::times_8, 24)); + __ movq(Address(dest, qword_count, Address::times_8, 24), to); + __ movq(to, Address(from, qword_count, Address::times_8, 16)); + __ movq(Address(dest, qword_count, Address::times_8, 16), to); + __ movq(to, Address(from, qword_count, Address::times_8, 8)); + __ movq(Address(dest, qword_count, Address::times_8, 8), to); + __ movq(to, Address(from, qword_count, Address::times_8, 0)); + __ movq(Address(dest, qword_count, Address::times_8, 0), to); + } __ BIND(L_copy_32_bytes); __ subptr(qword_count, 4); __ jcc(Assembler::greaterEqual, L_loop); diff --git a/hotspot/src/cpu/x86/vm/vm_version_x86_32.cpp b/hotspot/src/cpu/x86/vm/vm_version_x86_32.cpp index 839a4cdaeda..edd1da4e31f 100644 --- a/hotspot/src/cpu/x86/vm/vm_version_x86_32.cpp +++ b/hotspot/src/cpu/x86/vm/vm_version_x86_32.cpp @@ -242,9 +242,11 @@ void VM_Version::get_processor_features() { _supports_cx8 = supports_cmpxchg8(); // if the OS doesn't support SSE, we can't use this feature even if the HW does if( !os::supports_sse()) - _cpuFeatures &= ~(CPU_SSE|CPU_SSE2|CPU_SSE3|CPU_SSSE3|CPU_SSE4|CPU_SSE4A); - if (UseSSE < 4) - _cpuFeatures &= ~CPU_SSE4; + _cpuFeatures &= ~(CPU_SSE|CPU_SSE2|CPU_SSE3|CPU_SSSE3|CPU_SSE4A|CPU_SSE4_1|CPU_SSE4_2); + if (UseSSE < 4) { + _cpuFeatures &= ~CPU_SSE4_1; + _cpuFeatures &= ~CPU_SSE4_2; + } if (UseSSE < 3) { _cpuFeatures &= ~CPU_SSE3; _cpuFeatures &= ~CPU_SSSE3; @@ -261,7 +263,7 @@ void VM_Version::get_processor_features() { } char buf[256]; - jio_snprintf(buf, sizeof(buf), "(%u cores per cpu, %u threads per core) family %d model %d stepping %d%s%s%s%s%s%s%s%s%s%s%s%s%s%s", + jio_snprintf(buf, sizeof(buf), "(%u cores per cpu, %u threads per core) family %d model %d stepping %d%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", cores_per_cpu(), threads_per_core(), cpu_family(), _model, _stepping, (supports_cmov() ? ", cmov" : ""), @@ -272,7 +274,8 @@ void VM_Version::get_processor_features() { (supports_sse2() ? ", sse2" : ""), (supports_sse3() ? ", sse3" : ""), (supports_ssse3()? ", ssse3": ""), - (supports_sse4() ? ", sse4" : ""), + (supports_sse4_1() ? ", sse4.1" : ""), + (supports_sse4_2() ? ", sse4.2" : ""), (supports_mmx_ext() ? ", mmxext" : ""), (supports_3dnow() ? ", 3dnow" : ""), (supports_3dnow2() ? ", 3dnowext" : ""), @@ -285,7 +288,7 @@ void VM_Version::get_processor_features() { // older Pentiums which do not support it. if( UseSSE > 4 ) UseSSE=4; if( UseSSE < 0 ) UseSSE=0; - if( !supports_sse4() ) // Drop to 3 if no SSE4 support + if( !supports_sse4_1() ) // Drop to 3 if no SSE4 support UseSSE = MIN2((intx)3,UseSSE); if( !supports_sse3() ) // Drop to 2 if no SSE3 support UseSSE = MIN2((intx)2,UseSSE); @@ -375,6 +378,14 @@ void VM_Version::get_processor_features() { MaxLoopPad = 11; } #endif // COMPILER2 + if( FLAG_IS_DEFAULT(UseXMMForArrayCopy) ) { + UseXMMForArrayCopy = true; // use SSE2 movq on new Intel cpus + } + if( supports_sse4_2() && supports_ht() ) { // Newest Intel cpus + if( FLAG_IS_DEFAULT(UseUnalignedLoadStores) && UseXMMForArrayCopy ) { + UseUnalignedLoadStores = true; // use movdqu on newest Intel cpus + } + } } } @@ -413,7 +424,7 @@ void VM_Version::get_processor_features() { #ifndef PRODUCT if (PrintMiscellaneous && Verbose) { - tty->print_cr("Logical CPUs per package: %u", + tty->print_cr("Logical CPUs per core: %u", logical_processors_per_package()); tty->print_cr("UseSSE=%d",UseSSE); tty->print("Allocation: "); diff --git a/hotspot/src/cpu/x86/vm/vm_version_x86_32.hpp b/hotspot/src/cpu/x86/vm/vm_version_x86_32.hpp index 361bfb2eb11..b37b4f4e516 100644 --- a/hotspot/src/cpu/x86/vm/vm_version_x86_32.hpp +++ b/hotspot/src/cpu/x86/vm/vm_version_x86_32.hpp @@ -68,9 +68,9 @@ public: cmpxchg16: 1, : 4, dca : 1, - : 4, - popcnt : 1, - : 8; + sse4_1 : 1, + sse4_2 : 1, + : 11; } bits; }; @@ -177,8 +177,9 @@ protected: CPU_SSE2 = (1 << 7), CPU_SSE3 = (1 << 8), // sse3 comes from cpuid 1 (ECX) CPU_SSSE3= (1 << 9), - CPU_SSE4 = (1 <<10), - CPU_SSE4A= (1 <<11) + CPU_SSE4A= (1 <<10), + CPU_SSE4_1 = (1 << 11), + CPU_SSE4_2 = (1 << 12) } cpuFeatureFlags; // cpuid information block. All info derived from executing cpuid with @@ -240,22 +241,14 @@ protected: static CpuidInfo _cpuid_info; // Extractors and predicates - static bool is_extended_cpu_family() { - const uint32_t Extended_Cpu_Family = 0xf; - return _cpuid_info.std_cpuid1_rax.bits.family == Extended_Cpu_Family; - } static uint32_t extended_cpu_family() { uint32_t result = _cpuid_info.std_cpuid1_rax.bits.family; - if (is_extended_cpu_family()) { - result += _cpuid_info.std_cpuid1_rax.bits.ext_family; - } + result += _cpuid_info.std_cpuid1_rax.bits.ext_family; return result; } static uint32_t extended_cpu_model() { uint32_t result = _cpuid_info.std_cpuid1_rax.bits.model; - if (is_extended_cpu_family()) { - result |= _cpuid_info.std_cpuid1_rax.bits.ext_model << 4; - } + result |= _cpuid_info.std_cpuid1_rax.bits.ext_model << 4; return result; } static uint32_t cpu_stepping() { @@ -293,6 +286,10 @@ protected: result |= CPU_SSSE3; if (is_amd() && _cpuid_info.ext_cpuid1_rcx.bits.sse4a != 0) result |= CPU_SSE4A; + if (_cpuid_info.std_cpuid1_rcx.bits.sse4_1 != 0) + result |= CPU_SSE4_1; + if (_cpuid_info.std_cpuid1_rcx.bits.sse4_2 != 0) + result |= CPU_SSE4_2; return result; } @@ -380,7 +377,8 @@ public: static bool supports_sse2() { return (_cpuFeatures & CPU_SSE2) != 0; } static bool supports_sse3() { return (_cpuFeatures & CPU_SSE3) != 0; } static bool supports_ssse3() { return (_cpuFeatures & CPU_SSSE3)!= 0; } - static bool supports_sse4() { return (_cpuFeatures & CPU_SSE4) != 0; } + static bool supports_sse4_1() { return (_cpuFeatures & CPU_SSE4_1) != 0; } + static bool supports_sse4_2() { return (_cpuFeatures & CPU_SSE4_2) != 0; } // // AMD features // diff --git a/hotspot/src/cpu/x86/vm/vm_version_x86_64.cpp b/hotspot/src/cpu/x86/vm/vm_version_x86_64.cpp index 709d82e6e68..7994aab7a78 100644 --- a/hotspot/src/cpu/x86/vm/vm_version_x86_64.cpp +++ b/hotspot/src/cpu/x86/vm/vm_version_x86_64.cpp @@ -186,8 +186,10 @@ void VM_Version::get_processor_features() { if (!VM_Version::supports_sse2()) { vm_exit_during_initialization("Unknown x64 processor: SSE2 not supported"); } - if (UseSSE < 4) - _cpuFeatures &= ~CPU_SSE4; + if (UseSSE < 4) { + _cpuFeatures &= ~CPU_SSE4_1; + _cpuFeatures &= ~CPU_SSE4_2; + } if (UseSSE < 3) { _cpuFeatures &= ~CPU_SSE3; _cpuFeatures &= ~CPU_SSSE3; @@ -204,7 +206,7 @@ void VM_Version::get_processor_features() { } char buf[256]; - jio_snprintf(buf, sizeof(buf), "(%u cores per cpu, %u threads per core) family %d model %d stepping %d%s%s%s%s%s%s%s%s%s%s%s%s%s%s", + jio_snprintf(buf, sizeof(buf), "(%u cores per cpu, %u threads per core) family %d model %d stepping %d%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", cores_per_cpu(), threads_per_core(), cpu_family(), _model, _stepping, (supports_cmov() ? ", cmov" : ""), @@ -215,7 +217,8 @@ void VM_Version::get_processor_features() { (supports_sse2() ? ", sse2" : ""), (supports_sse3() ? ", sse3" : ""), (supports_ssse3()? ", ssse3": ""), - (supports_sse4() ? ", sse4" : ""), + (supports_sse4_1() ? ", sse4.1" : ""), + (supports_sse4_2() ? ", sse4.2" : ""), (supports_mmx_ext() ? ", mmxext" : ""), (supports_3dnow() ? ", 3dnow" : ""), (supports_3dnow2() ? ", 3dnowext" : ""), @@ -228,7 +231,7 @@ void VM_Version::get_processor_features() { // older Pentiums which do not support it. if( UseSSE > 4 ) UseSSE=4; if( UseSSE < 0 ) UseSSE=0; - if( !supports_sse4() ) // Drop to 3 if no SSE4 support + if( !supports_sse4_1() ) // Drop to 3 if no SSE4 support UseSSE = MIN2((intx)3,UseSSE); if( !supports_sse3() ) // Drop to 2 if no SSE3 support UseSSE = MIN2((intx)2,UseSSE); @@ -314,6 +317,14 @@ void VM_Version::get_processor_features() { MaxLoopPad = 11; } #endif // COMPILER2 + if( FLAG_IS_DEFAULT(UseXMMForArrayCopy) ) { + UseXMMForArrayCopy = true; // use SSE2 movq on new Intel cpus + } + if( supports_sse4_2() && supports_ht() ) { // Newest Intel cpus + if( FLAG_IS_DEFAULT(UseUnalignedLoadStores) && UseXMMForArrayCopy ) { + UseUnalignedLoadStores = true; // use movdqu on newest Intel cpus + } + } } } @@ -355,7 +366,7 @@ void VM_Version::get_processor_features() { #ifndef PRODUCT if (PrintMiscellaneous && Verbose) { - tty->print_cr("Logical CPUs per package: %u", + tty->print_cr("Logical CPUs per core: %u", logical_processors_per_package()); tty->print_cr("UseSSE=%d",UseSSE); tty->print("Allocation: "); diff --git a/hotspot/src/cpu/x86/vm/vm_version_x86_64.hpp b/hotspot/src/cpu/x86/vm/vm_version_x86_64.hpp index dc60b370073..37ba2d07558 100644 --- a/hotspot/src/cpu/x86/vm/vm_version_x86_64.hpp +++ b/hotspot/src/cpu/x86/vm/vm_version_x86_64.hpp @@ -68,9 +68,9 @@ public: cmpxchg16: 1, : 4, dca : 1, - : 4, - popcnt : 1, - : 8; + sse4_1 : 1, + sse4_2 : 1, + : 11; } bits; }; @@ -177,8 +177,9 @@ protected: CPU_SSE2 = (1 << 7), CPU_SSE3 = (1 << 8), CPU_SSSE3= (1 << 9), - CPU_SSE4 = (1 <<10), - CPU_SSE4A= (1 <<11) + CPU_SSE4A= (1 <<10), + CPU_SSE4_1 = (1 << 11), + CPU_SSE4_2 = (1 << 12) } cpuFeatureFlags; // cpuid information block. All info derived from executing cpuid with @@ -240,22 +241,14 @@ protected: static CpuidInfo _cpuid_info; // Extractors and predicates - static bool is_extended_cpu_family() { - const uint32_t Extended_Cpu_Family = 0xf; - return _cpuid_info.std_cpuid1_eax.bits.family == Extended_Cpu_Family; - } static uint32_t extended_cpu_family() { uint32_t result = _cpuid_info.std_cpuid1_eax.bits.family; - if (is_extended_cpu_family()) { - result += _cpuid_info.std_cpuid1_eax.bits.ext_family; - } + result += _cpuid_info.std_cpuid1_eax.bits.ext_family; return result; } static uint32_t extended_cpu_model() { uint32_t result = _cpuid_info.std_cpuid1_eax.bits.model; - if (is_extended_cpu_family()) { - result |= _cpuid_info.std_cpuid1_eax.bits.ext_model << 4; - } + result |= _cpuid_info.std_cpuid1_eax.bits.ext_model << 4; return result; } static uint32_t cpu_stepping() { @@ -293,6 +286,10 @@ protected: result |= CPU_SSSE3; if (is_amd() && _cpuid_info.ext_cpuid1_ecx.bits.sse4a != 0) result |= CPU_SSE4A; + if (_cpuid_info.std_cpuid1_ecx.bits.sse4_1 != 0) + result |= CPU_SSE4_1; + if (_cpuid_info.std_cpuid1_ecx.bits.sse4_2 != 0) + result |= CPU_SSE4_2; return result; } @@ -380,7 +377,8 @@ public: static bool supports_sse2() { return (_cpuFeatures & CPU_SSE2) != 0; } static bool supports_sse3() { return (_cpuFeatures & CPU_SSE3) != 0; } static bool supports_ssse3() { return (_cpuFeatures & CPU_SSSE3)!= 0; } - static bool supports_sse4() { return (_cpuFeatures & CPU_SSE4) != 0; } + static bool supports_sse4_1() { return (_cpuFeatures & CPU_SSE4_1) != 0; } + static bool supports_sse4_2() { return (_cpuFeatures & CPU_SSE4_2) != 0; } // // AMD features // diff --git a/hotspot/src/os/solaris/vm/os_solaris.cpp b/hotspot/src/os/solaris/vm/os_solaris.cpp index 7bd9a6370ca..ef720c1eefb 100644 --- a/hotspot/src/os/solaris/vm/os_solaris.cpp +++ b/hotspot/src/os/solaris/vm/os_solaris.cpp @@ -3758,7 +3758,7 @@ int set_lwp_priority (int ThreadID, int lwpid, int newPrio ) int maxClamped = MIN2(iaLimits.maxPrio, (int)iaInfo->ia_uprilim); iaInfo->ia_upri = scale_to_lwp_priority(iaLimits.minPrio, maxClamped, newPrio); iaInfo->ia_uprilim = IA_NOCHANGE; - iaInfo->ia_nice = IA_NOCHANGE; +// iaInfo->ia_nice = IA_NOCHANGE; iaInfo->ia_mode = IA_NOCHANGE; if (ThreadPriorityVerbose) { tty->print_cr ("IA: [%d...%d] %d->%d\n", diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index 6ca90f522d5..8453e5c6977 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -991,6 +991,12 @@ class CommandLineFlags { product(bool, UseXmmI2F, false, \ "Use SSE2 CVTDQ2PS instruction to convert Integer to Float") \ \ + product(bool, UseXMMForArrayCopy, false, \ + "Use SSE2 MOVQ instruction for Arraycopy") \ + \ + product(bool, UseUnalignedLoadStores, false, \ + "Use SSE2 MOVDQU instruction for Arraycopy") \ + \ product(intx, FieldsAllocationStyle, 1, \ "0 - type based with oops first, 1 - with oops last") \ \ From e5e6ca9d624646c6ef081e55fa8cf1045e8a19f0 Mon Sep 17 00:00:00 2001 From: Mandy Chung Date: Tue, 14 Oct 2008 15:16:38 -0700 Subject: [PATCH 053/267] 6306922: Dump dump created by +HeapDumpOnOutOfMemoryError should include stack traces for stack roots Include stack traces of all threads in the heap dump Reviewed-by: alanb --- hotspot/src/share/vm/includeDB_features | 1 + hotspot/src/share/vm/services/heapDumper.cpp | 192 ++++++++++++++---- .../src/share/vm/services/threadService.hpp | 1 + 3 files changed, 158 insertions(+), 36 deletions(-) diff --git a/hotspot/src/share/vm/includeDB_features b/hotspot/src/share/vm/includeDB_features index 6effcca57ae..6faf50bde8b 100644 --- a/hotspot/src/share/vm/includeDB_features +++ b/hotspot/src/share/vm/includeDB_features @@ -99,6 +99,7 @@ heapDumper.cpp ostream.hpp heapDumper.cpp reflectionUtils.hpp heapDumper.cpp symbolTable.hpp heapDumper.cpp systemDictionary.hpp +heapDumper.cpp threadService.hpp heapDumper.cpp universe.hpp heapDumper.cpp vframe.hpp heapDumper.cpp vmGCOperations.hpp diff --git a/hotspot/src/share/vm/services/heapDumper.cpp b/hotspot/src/share/vm/services/heapDumper.cpp index 7d08462a66f..bf7aaf1a914 100644 --- a/hotspot/src/share/vm/services/heapDumper.cpp +++ b/hotspot/src/share/vm/services/heapDumper.cpp @@ -343,7 +343,8 @@ typedef enum { // Default stack trace ID (used for dummy HPROF_TRACE record) enum { - STACK_TRACE_ID = 1 + STACK_TRACE_ID = 1, + INITIAL_CLASS_COUNT = 200 }; @@ -408,6 +409,7 @@ class DumpWriter : public StackObj { void write_u8(u8 x); void write_objectID(oop o); void write_classID(Klass* k); + void write_id(u4 x); }; DumpWriter::DumpWriter(const char* path) { @@ -548,6 +550,14 @@ void DumpWriter::write_objectID(oop o) { #endif } +void DumpWriter::write_id(u4 x) { +#ifdef _LP64 + write_u8((u8) x); +#else + write_u4(x); +#endif +} + // We use java mirror as the class ID void DumpWriter::write_classID(Klass* k) { write_objectID(k->java_mirror()); @@ -596,6 +606,8 @@ class DumperSupport : AllStatic { static void dump_object_array(DumpWriter* writer, objArrayOop array); // creates HPROF_GC_PRIM_ARRAY_DUMP record for the given type array static void dump_prim_array(DumpWriter* writer, typeArrayOop array); + // create HPROF_FRAME record for the given method and bci + static void dump_stack_frame(DumpWriter* writer, int frame_serial_num, int class_serial_num, methodOop m, int bci); }; // write a header of the given type @@ -1070,6 +1082,29 @@ void DumperSupport::dump_prim_array(DumpWriter* writer, typeArrayOop array) { } } +// create a HPROF_FRAME record of the given methodOop and bci +void DumperSupport::dump_stack_frame(DumpWriter* writer, + int frame_serial_num, + int class_serial_num, + methodOop m, + int bci) { + int line_number; + if (m->is_native()) { + line_number = -3; // native frame + } else { + line_number = m->line_number_from_bci(bci); + } + + write_header(writer, HPROF_FRAME, 4*oopSize + 2*sizeof(u4)); + writer->write_id(frame_serial_num); // frame serial number + writer->write_objectID(m->name()); // method's name + writer->write_objectID(m->signature()); // method's signature + + assert(Klass::cast(m->method_holder())->oop_is_instance(), "not instanceKlass"); + writer->write_objectID(instanceKlass::cast(m->method_holder())->source_file_name()); // source file name + writer->write_u4(class_serial_num); // class serial number + writer->write_u4((u4) line_number); // line number +} // Support class used to generate HPROF_UTF8 records from the entries in the // SymbolTable. @@ -1104,12 +1139,15 @@ class JNILocalsDumper : public OopClosure { private: DumpWriter* _writer; u4 _thread_serial_num; + int _frame_num; DumpWriter* writer() const { return _writer; } public: JNILocalsDumper(DumpWriter* writer, u4 thread_serial_num) { _writer = writer; _thread_serial_num = thread_serial_num; + _frame_num = -1; // default - empty stack } + void set_frame_number(int n) { _frame_num = n; } void do_oop(oop* obj_p); void do_oop(narrowOop* obj_p) { ShouldNotReachHere(); } }; @@ -1122,7 +1160,7 @@ void JNILocalsDumper::do_oop(oop* obj_p) { writer()->write_u1(HPROF_GC_ROOT_JNI_LOCAL); writer()->write_objectID(o); writer()->write_u4(_thread_serial_num); - writer()->write_u4((u4)-1); // empty + writer()->write_u4((u4)_frame_num); } } @@ -1269,6 +1307,9 @@ class VM_HeapDumper : public VM_GC_Operation { bool _gc_before_heap_dump; bool _is_segmented_dump; jlong _dump_start; + GrowableArray* _klass_map; + ThreadStackTrace** _stack_traces; + int _num_threads; // accessors DumpWriter* writer() const { return _writer; } @@ -1291,9 +1332,16 @@ class VM_HeapDumper : public VM_GC_Operation { static void do_basic_type_array_class_dump(klassOop k); // HPROF_GC_ROOT_THREAD_OBJ records - void do_thread(JavaThread* thread, u4 thread_serial_num); + int do_thread(JavaThread* thread, u4 thread_serial_num); void do_threads(); + void add_class_serial_number(Klass* k, int serial_num) { + _klass_map->at_put_grow(serial_num, k); + } + + // HPROF_TRACE and HPROF_FRAME records + void dump_stack_traces(); + // writes a HPROF_HEAP_DUMP or HPROF_HEAP_DUMP_SEGMENT record void write_dump_header(); @@ -1313,6 +1361,18 @@ class VM_HeapDumper : public VM_GC_Operation { _gc_before_heap_dump = gc_before_heap_dump; _is_segmented_dump = false; _dump_start = (jlong)-1; + _klass_map = new (ResourceObj::C_HEAP) GrowableArray(INITIAL_CLASS_COUNT, true); + _stack_traces = NULL; + _num_threads = 0; + } + ~VM_HeapDumper() { + if (_stack_traces != NULL) { + for (int i=0; i < _num_threads; i++) { + delete _stack_traces[i]; + } + FREE_C_HEAP_ARRAY(ThreadStackTrace*, _stack_traces); + } + delete _klass_map; } VMOp_Type type() const { return VMOp_HeapDumper; } @@ -1436,6 +1496,9 @@ void VM_HeapDumper::do_load_class(klassOop k) { Klass* klass = Klass::cast(k); writer->write_classID(klass); + // add the klassOop and class serial number pair + dumper->add_class_serial_number(klass, class_serial_num); + writer->write_u4(STACK_TRACE_ID); // class name ID @@ -1465,15 +1528,15 @@ void VM_HeapDumper::do_basic_type_array_class_dump(klassOop k) { // Walk the stack of the given thread. // Dumps a HPROF_GC_ROOT_JAVA_FRAME record for each local // Dumps a HPROF_GC_ROOT_JNI_LOCAL record for each JNI local -void VM_HeapDumper::do_thread(JavaThread* java_thread, u4 thread_serial_num) { +// +// It returns the number of Java frames in this thread stack +int VM_HeapDumper::do_thread(JavaThread* java_thread, u4 thread_serial_num) { JNILocalsDumper blk(writer(), thread_serial_num); oop threadObj = java_thread->threadObj(); assert(threadObj != NULL, "sanity check"); - // JNI locals for the top frame - java_thread->active_handles()->oops_do(&blk); - + int stack_depth = 0; if (java_thread->has_last_Java_frame()) { // vframes are resource allocated @@ -1484,13 +1547,14 @@ void VM_HeapDumper::do_thread(JavaThread* java_thread, u4 thread_serial_num) { RegisterMap reg_map(java_thread); frame f = java_thread->last_frame(); vframe* vf = vframe::new_vframe(&f, ®_map, java_thread); + frame* last_entry_frame = NULL; while (vf != NULL) { + blk.set_frame_number(stack_depth); if (vf->is_java_frame()) { // java frame (interpreted, compiled, ...) javaVFrame *jvf = javaVFrame::cast(vf); - if (!(jvf->method()->is_native())) { StackValueCollection* locals = jvf->locals(); for (int slot=0; slotsize(); slot++) { @@ -1501,44 +1565,61 @@ void VM_HeapDumper::do_thread(JavaThread* java_thread, u4 thread_serial_num) { writer()->write_u1(HPROF_GC_ROOT_JAVA_FRAME); writer()->write_objectID(o); writer()->write_u4(thread_serial_num); - writer()->write_u4((u4)-1); // empty + writer()->write_u4((u4) stack_depth); } } } + } else { + // native frame + if (stack_depth == 0) { + // JNI locals for the top frame. + java_thread->active_handles()->oops_do(&blk); + } else { + if (last_entry_frame != NULL) { + // JNI locals for the entry frame + assert(last_entry_frame->is_entry_frame(), "checking"); + last_entry_frame->entry_frame_call_wrapper()->handles()->oops_do(&blk); + } + } } - } else { + // increment only for Java frames + stack_depth++; + last_entry_frame = NULL; + } else { // externalVFrame - if it's an entry frame then report any JNI locals - // as roots + // as roots when we find the corresponding native javaVFrame frame* fr = vf->frame_pointer(); assert(fr != NULL, "sanity check"); if (fr->is_entry_frame()) { - fr->entry_frame_call_wrapper()->handles()->oops_do(&blk); + last_entry_frame = fr; } } - vf = vf->sender(); } + } else { + // no last java frame but there may be JNI locals + java_thread->active_handles()->oops_do(&blk); } + return stack_depth; } // write a HPROF_GC_ROOT_THREAD_OBJ record for each java thread. Then walk // the stack so that locals and JNI locals are dumped. void VM_HeapDumper::do_threads() { - u4 thread_serial_num = 0; - for (JavaThread* thread = Threads::first(); thread != NULL ; thread = thread->next()) { + for (int i=0; i < _num_threads; i++) { + JavaThread* thread = _stack_traces[i]->thread(); oop threadObj = thread->threadObj(); - if (threadObj != NULL && !thread->is_exiting() && !thread->is_hidden_from_external_view()) { - ++thread_serial_num; - - writer()->write_u1(HPROF_GC_ROOT_THREAD_OBJ); - writer()->write_objectID(threadObj); - writer()->write_u4(thread_serial_num); - writer()->write_u4(STACK_TRACE_ID); - - do_thread(thread, thread_serial_num); - } + u4 thread_serial_num = i+1; + u4 stack_serial_num = thread_serial_num + STACK_TRACE_ID; + writer()->write_u1(HPROF_GC_ROOT_THREAD_OBJ); + writer()->write_objectID(threadObj); + writer()->write_u4(thread_serial_num); // thread number + writer()->write_u4(stack_serial_num); // stack trace serial number + int num_frames = do_thread(thread, thread_serial_num); + assert(num_frames == _stack_traces[i]->get_stack_depth(), + "total number of Java frames not matched"); } } @@ -1547,16 +1628,16 @@ void VM_HeapDumper::do_threads() { // records: // // HPROF_HEADER -// HPROF_TRACE // [HPROF_UTF8]* // [HPROF_LOAD_CLASS]* +// [[HPROF_FRAME]*|HPROF_TRACE]* // [HPROF_GC_CLASS_DUMP]* // HPROF_HEAP_DUMP // -// The HPROF_TRACE record after the header is "dummy trace" record which does -// not include any frames. Other records which require a stack trace ID will -// specify the trace ID of this record (1). It also means we can run HAT without -// needing the -stack false option. +// The HPROF_TRACE records represent the stack traces where the heap dump +// is generated and a "dummy trace" record which does not include +// any frames. The dummy trace record is used to be referenced as the +// unknown object alloc site. // // The HPROF_HEAP_DUMP record has a length following by sub-records. To allow // the heap dump be generated in a single pass we remember the position of @@ -1592,12 +1673,6 @@ void VM_HeapDumper::doit() { writer()->write_u4(oopSize); writer()->write_u8(os::javaTimeMillis()); - // HPROF_TRACE record without any frames - DumperSupport::write_header(writer(), HPROF_TRACE, 3*sizeof(u4)); - writer()->write_u4(STACK_TRACE_ID); - writer()->write_u4(0); // thread number - writer()->write_u4(0); // frame count - // HPROF_UTF8 records SymbolTableDumper sym_dumper(writer()); SymbolTable::oops_do(&sym_dumper); @@ -1606,6 +1681,10 @@ void VM_HeapDumper::doit() { SystemDictionary::classes_do(&do_load_class); Universe::basic_type_classes_do(&do_load_class); + // write HPROF_FRAME and HPROF_TRACE records + // this must be called after _klass_map is built when iterating the classes above. + dump_stack_traces(); + // write HPROF_HEAP_DUMP or HPROF_HEAP_DUMP_SEGMENT write_dump_header(); @@ -1646,6 +1725,47 @@ void VM_HeapDumper::doit() { end_of_dump(); } +void VM_HeapDumper::dump_stack_traces() { + // write a HPROF_TRACE record without any frames to be referenced as object alloc sites + DumperSupport::write_header(writer(), HPROF_TRACE, 3*sizeof(u4)); + writer()->write_u4((u4) STACK_TRACE_ID); + writer()->write_u4(0); // thread number + writer()->write_u4(0); // frame count + + _stack_traces = NEW_C_HEAP_ARRAY(ThreadStackTrace*, Threads::number_of_threads()); + int frame_serial_num = 0; + for (JavaThread* thread = Threads::first(); thread != NULL ; thread = thread->next()) { + oop threadObj = thread->threadObj(); + if (threadObj != NULL && !thread->is_exiting() && !thread->is_hidden_from_external_view()) { + // dump thread stack trace + ThreadStackTrace* stack_trace = new ThreadStackTrace(thread, false); + stack_trace->dump_stack_at_safepoint(-1); + _stack_traces[_num_threads++] = stack_trace; + + // write HPROF_FRAME records for this thread's stack trace + int depth = stack_trace->get_stack_depth(); + int thread_frame_start = frame_serial_num; + for (int j=0; j < depth; j++) { + StackFrameInfo* frame = stack_trace->stack_frame_at(j); + methodOop m = frame->method(); + int class_serial_num = _klass_map->find(Klass::cast(m->method_holder())); + // the class serial number starts from 1 + assert(class_serial_num > 0, "class not found"); + DumperSupport::dump_stack_frame(writer(), ++frame_serial_num, class_serial_num, m, frame->bci()); + } + + // write HPROF_TRACE record for one thread + DumperSupport::write_header(writer(), HPROF_TRACE, 3*sizeof(u4) + depth*oopSize); + int stack_serial_num = _num_threads + STACK_TRACE_ID; + writer()->write_u4(stack_serial_num); // stack trace serial number + writer()->write_u4((u4) _num_threads); // thread serial number + writer()->write_u4(depth); // frame count + for (int j=1; j <= depth; j++) { + writer()->write_id(thread_frame_start + j); + } + } + } +} // dump the heap to given path. int HeapDumper::dump(const char* path) { diff --git a/hotspot/src/share/vm/services/threadService.hpp b/hotspot/src/share/vm/services/threadService.hpp index 291a8eebb0e..97a83bb5e35 100644 --- a/hotspot/src/share/vm/services/threadService.hpp +++ b/hotspot/src/share/vm/services/threadService.hpp @@ -242,6 +242,7 @@ class ThreadStackTrace : public CHeapObj { ThreadStackTrace(JavaThread* thread, bool with_locked_monitors); ~ThreadStackTrace(); + JavaThread* thread() { return _thread; } StackFrameInfo* stack_frame_at(int i) { return _frames->at(i); } int get_stack_depth() { return _depth; } From 55ef4bc22e0a565df77cce32ddb1dae1d715c3be Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Wed, 15 Oct 2008 08:07:59 -0700 Subject: [PATCH 054/267] 6748541: javadoc should be reusable Reviewed-by: bpatel --- .../doclets/formats/html/ConfigurationImpl.java | 13 +++++++++++-- .../tools/doclets/formats/html/HtmlDoclet.java | 14 ++++++++++---- .../doclets/formats/html/WriterFactoryImpl.java | 16 +--------------- .../doclets/internal/toolkit/AbstractDoclet.java | 3 ++- .../doclets/internal/toolkit/Configuration.java | 10 +++++----- .../doclets/internal/toolkit/util/Group.java | 11 +---------- .../internal/toolkit/util/MetaKeywords.java | 16 +--------------- .../test/com/sun/javadoc/AuthorDD/AuthorDD.java | 3 ++- .../test/com/sun/javadoc/lib/JavadocTester.java | 1 + langtools/test/tools/javadoc/BooleanConst.java | 2 +- .../test/tools/javadoc/BreakIteratorWarning.java | 1 + langtools/test/tools/javadoc/FlagsTooEarly.java | 1 + .../test/tools/javadoc/InlineTagsWithBraces.java | 1 + langtools/test/tools/javadoc/LangVers.java | 1 + langtools/test/tools/javadoc/MethodLinks.java | 2 +- langtools/test/tools/javadoc/NoStar.java | 2 +- .../test/tools/javadoc/T4994049/T4994049.java | 3 ++- langtools/test/tools/javadoc/XWerror.java | 2 +- .../completionFailure/CompletionFailure.java | 1 + langtools/test/tools/javadoc/dupOk/DupOk.java | 2 +- .../tools/javadoc/imports/MissingImport.java | 1 + langtools/test/tools/javadoc/lib/Tester.java | 4 +++- .../tools/javadoc/nestedClass/NestedClass.java | 2 +- .../tools/javadoc/sourceOnly/p/SourceOnly.java | 2 +- .../tools/javadoc/sourceOption/SourceOption.java | 1 + .../subpackageIgnore/SubpackageIgnore.java | 1 + 26 files changed, 54 insertions(+), 62 deletions(-) diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java index 4db128b2bfe..524bd2472a3 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java @@ -51,7 +51,7 @@ import java.io.*; */ public class ConfigurationImpl extends Configuration { - private static final ConfigurationImpl instance = new ConfigurationImpl(); + private static ConfigurationImpl instance = new ConfigurationImpl(); /** * The build date. Note: For now, we will use @@ -189,6 +189,15 @@ public class ConfigurationImpl extends Configuration { "com.sun.tools.doclets.formats.html.resources.standard"); } + /** + * Reset to a fresh new ConfigurationImpl, to allow multiple invocations + * of javadoc within a single VM. It would be better not to be using + * static fields at all, but .... (sigh). + */ + public static void reset() { + instance = new ConfigurationImpl(); + } + public static ConfigurationImpl getInstance() { return instance; } @@ -475,7 +484,7 @@ public class ConfigurationImpl extends Configuration { * {@inheritDoc} */ public WriterFactory getWriterFactory() { - return WriterFactoryImpl.getInstance(); + return new WriterFactoryImpl(this); } /** diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java index eb131b63121..b806f11dc8f 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java @@ -41,12 +41,14 @@ import java.io.*; * */ public class HtmlDoclet extends AbstractDoclet { + public HtmlDoclet() { + configuration = (ConfigurationImpl) configuration(); + } /** * The global configuration information for this run. */ - public ConfigurationImpl configuration = - (ConfigurationImpl) configuration(); + public ConfigurationImpl configuration; /** * The "start" method as required by Javadoc. @@ -56,8 +58,12 @@ public class HtmlDoclet extends AbstractDoclet { * @return true if the doclet ran without encountering any errors. */ public static boolean start(RootDoc root) { - HtmlDoclet doclet = new HtmlDoclet(); - return doclet.start(doclet, root); + try { + HtmlDoclet doclet = new HtmlDoclet(); + return doclet.start(doclet, root); + } finally { + ConfigurationImpl.reset(); + } } /** diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/WriterFactoryImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/WriterFactoryImpl.java index e4a9d45e833..b970354279b 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/WriterFactoryImpl.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/WriterFactoryImpl.java @@ -37,26 +37,12 @@ import com.sun.javadoc.*; */ public class WriterFactoryImpl implements WriterFactory { - private static WriterFactoryImpl instance; - private ConfigurationImpl configuration; - private WriterFactoryImpl(ConfigurationImpl configuration) { + public WriterFactoryImpl(ConfigurationImpl configuration) { this.configuration = configuration; } - /** - * Return an instance of this factory. - * - * @return an instance of this factory. - */ - public static WriterFactoryImpl getInstance() { - if (instance == null) { - instance = new WriterFactoryImpl(ConfigurationImpl.getInstance()); - } - return instance; - } - /** * {@inheritDoc} */ diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AbstractDoclet.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AbstractDoclet.java index 740f63998bc..a1744c9b1ca 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AbstractDoclet.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AbstractDoclet.java @@ -45,7 +45,7 @@ public abstract class AbstractDoclet { /** * The global configuration information for this run. */ - public Configuration configuration = configuration(); + public Configuration configuration; /** * The only doclet that may use this toolkit is {@value} @@ -74,6 +74,7 @@ public abstract class AbstractDoclet { * @return true if the doclet executed without error. False otherwise. */ public boolean start(AbstractDoclet doclet, RootDoc root) { + configuration = configuration(); configuration.root = root; if (! isValidDoclet(doclet)) { return false; diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java index a988b9ecd1c..b7941dba07d 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java @@ -113,9 +113,9 @@ public abstract class Configuration { public boolean keywords = false; /** - * The meta tag keywords sole-instance. + * The meta tag keywords instance. */ - public final MetaKeywords metakeywords = MetaKeywords.getInstance(this); + public final MetaKeywords metakeywords = new MetaKeywords(this); /** * The list of doc-file subdirectories to exclude @@ -211,12 +211,12 @@ public abstract class Configuration { public boolean notimestamp= false; /** - * The package grouping sole-instance. + * The package grouping instance. */ - public final Group group = Group.getInstance(this); + public final Group group = new Group(this); /** - * The tracker of external package links (sole-instance). + * The tracker of external package links. */ public final Extern extern = new Extern(this); diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Group.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Group.java index bf35dd0122f..d5c91f36861 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Group.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Group.java @@ -56,8 +56,6 @@ import java.util.*; */ public class Group { - private static Group instance; - /** * Map of regular expressions with the corresponding group name. */ @@ -96,17 +94,10 @@ public class Group { } } - private Group(Configuration configuration) { + public Group(Configuration configuration) { this.configuration = configuration; } - public static Group getInstance(Configuration configuration) { - if (instance == null) { - instance = new Group(configuration); - } - return instance; - } - /** * Depending upon the format of the package name provided in the "-group" * option, generate two separate maps. There will be a map for mapping diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MetaKeywords.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MetaKeywords.java index ab5060d31e3..83720c9bc57 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MetaKeywords.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MetaKeywords.java @@ -43,8 +43,6 @@ import java.util.*; */ public class MetaKeywords { - private static MetaKeywords instance = null; - /** * The global configuration information for this run. */ @@ -53,22 +51,10 @@ public class MetaKeywords { /** * Constructor */ - private MetaKeywords(Configuration configuration) { + public MetaKeywords(Configuration configuration) { this.configuration = configuration; } - /** - * Return an instance of MetaKeywords. This class is a singleton. - * - * @param configuration the current configuration of the doclet. - */ - public static MetaKeywords getInstance(Configuration configuration) { - if (instance == null) { - instance = new MetaKeywords(configuration); - } - return instance; - } - /** * Returns an array of strings where each element * is a class, method or field name. This array is diff --git a/langtools/test/com/sun/javadoc/AuthorDD/AuthorDD.java b/langtools/test/com/sun/javadoc/AuthorDD/AuthorDD.java index a83eda78a46..1a114ee6eb9 100644 --- a/langtools/test/com/sun/javadoc/AuthorDD/AuthorDD.java +++ b/langtools/test/com/sun/javadoc/AuthorDD/AuthorDD.java @@ -72,7 +72,8 @@ public class AuthorDD /** Run javadoc */ public static void runJavadoc(String[] javadocArgs) { - if (com.sun.tools.javadoc.Main.execute(javadocArgs) != 0) { + if (com.sun.tools.javadoc.Main.execute(AuthorDD.class.getClassLoader(), + javadocArgs) != 0) { throw new Error("Javadoc failed to execute"); } } diff --git a/langtools/test/com/sun/javadoc/lib/JavadocTester.java b/langtools/test/com/sun/javadoc/lib/JavadocTester.java index 9db295276e5..4925859d314 100644 --- a/langtools/test/com/sun/javadoc/lib/JavadocTester.java +++ b/langtools/test/com/sun/javadoc/lib/JavadocTester.java @@ -197,6 +197,7 @@ public abstract class JavadocTester { new PrintWriter(warnings, true), new PrintWriter(notices, true), docletClass, + getClass().getClassLoader(), args); System.setOut(prev); standardOut = new StringBuffer(stdout.toString()); diff --git a/langtools/test/tools/javadoc/BooleanConst.java b/langtools/test/tools/javadoc/BooleanConst.java index ede45083a07..9809cc2b120 100644 --- a/langtools/test/tools/javadoc/BooleanConst.java +++ b/langtools/test/tools/javadoc/BooleanConst.java @@ -37,7 +37,7 @@ public class BooleanConst extends Doclet public static void main(String[] args) { // run javadoc on package p if (com.sun.tools.javadoc.Main. - execute("javadoc", "BooleanConst", + execute("javadoc", "BooleanConst", BooleanConst.class.getClassLoader(), new String[] {System.getProperty("test.src", ".") + java.io.File.separatorChar + "BooleanConst.java"}) != 0) throw new Error(); } diff --git a/langtools/test/tools/javadoc/BreakIteratorWarning.java b/langtools/test/tools/javadoc/BreakIteratorWarning.java index 8baa6393243..b90643cdc0e 100644 --- a/langtools/test/tools/javadoc/BreakIteratorWarning.java +++ b/langtools/test/tools/javadoc/BreakIteratorWarning.java @@ -41,6 +41,7 @@ public class BreakIteratorWarning extends Doclet { if (com.sun.tools.javadoc.Main.execute( "javadoc", "BreakIteratorWarning", + BreakIteratorWarning.class.getClassLoader(), new String[] {"-Xwerror", thisFile}) != 0) throw new Error("Javadoc encountered warnings or errors."); } diff --git a/langtools/test/tools/javadoc/FlagsTooEarly.java b/langtools/test/tools/javadoc/FlagsTooEarly.java index 170c791d902..b924af82334 100644 --- a/langtools/test/tools/javadoc/FlagsTooEarly.java +++ b/langtools/test/tools/javadoc/FlagsTooEarly.java @@ -40,6 +40,7 @@ public class FlagsTooEarly extends Doclet { if (com.sun.tools.javadoc.Main.execute( "javadoc", "FlagsTooEarly", + FlagsTooEarly.class.getClassLoader(), new String[] {"-Xwerror", thisFile}) != 0) throw new Error("Javadoc encountered warnings or errors."); } diff --git a/langtools/test/tools/javadoc/InlineTagsWithBraces.java b/langtools/test/tools/javadoc/InlineTagsWithBraces.java index 232dd069c5d..17d6995a6c3 100644 --- a/langtools/test/tools/javadoc/InlineTagsWithBraces.java +++ b/langtools/test/tools/javadoc/InlineTagsWithBraces.java @@ -60,6 +60,7 @@ public class InlineTagsWithBraces extends Doclet { if (com.sun.tools.javadoc.Main.execute( "javadoc", "InlineTagsWithBraces", + InlineTagsWithBraces.class.getClassLoader(), new String[] {"-Xwerror", thisFile}) != 0) throw new Error("Javadoc encountered warnings or errors."); } diff --git a/langtools/test/tools/javadoc/LangVers.java b/langtools/test/tools/javadoc/LangVers.java index e14f2738508..59be44f2b5e 100644 --- a/langtools/test/tools/javadoc/LangVers.java +++ b/langtools/test/tools/javadoc/LangVers.java @@ -43,6 +43,7 @@ public class LangVers extends Doclet { if (com.sun.tools.javadoc.Main.execute( "javadoc", "LangVers", + LangVers.class.getClassLoader(), new String[] {"-source", "1.5", thisFile}) != 0) throw new Error("Javadoc encountered warnings or errors."); } diff --git a/langtools/test/tools/javadoc/MethodLinks.java b/langtools/test/tools/javadoc/MethodLinks.java index 143f8c7c7e2..99207f089af 100644 --- a/langtools/test/tools/javadoc/MethodLinks.java +++ b/langtools/test/tools/javadoc/MethodLinks.java @@ -36,7 +36,7 @@ public class MethodLinks extends Doclet { public static void main(String[] args) { if (com.sun.tools.javadoc.Main. - execute("javadoc", "MethodLinks", + execute("javadoc", "MethodLinks", MethodLinks.class.getClassLoader(), new String[] {System.getProperty("test.src", ".") + java.io.File.separatorChar + "MethodLinks.java"} ) != 0) diff --git a/langtools/test/tools/javadoc/NoStar.java b/langtools/test/tools/javadoc/NoStar.java index 5770b1bfaa1..1284ae44091 100644 --- a/langtools/test/tools/javadoc/NoStar.java +++ b/langtools/test/tools/javadoc/NoStar.java @@ -44,7 +44,7 @@ public class NoStar extends Doclet { public static void main(String[] args) { if (com.sun.tools.javadoc.Main. - execute("javadoc", "NoStar", + execute("javadoc", "NoStar", NoStar.class.getClassLoader(), new String[] {System.getProperty("test.src", ".") + java.io.File.separatorChar + "NoStar.java"}) != 0) throw new Error(); } diff --git a/langtools/test/tools/javadoc/T4994049/T4994049.java b/langtools/test/tools/javadoc/T4994049/T4994049.java index 98ea54828e5..ec39878dd42 100644 --- a/langtools/test/tools/javadoc/T4994049/T4994049.java +++ b/langtools/test/tools/javadoc/T4994049/T4994049.java @@ -55,7 +55,8 @@ public class T4994049 extends Doclet { public static void main(String... args) { for (String file : args) { File source = new File(System.getProperty("test.src", "."), file); - if (execute("javadoc", "T4994049", new String[]{source.getPath()} ) != 0) + if (execute("javadoc", "T4994049", T4994049.class.getClassLoader(), + new String[]{source.getPath()} ) != 0) throw new Error(); } } diff --git a/langtools/test/tools/javadoc/XWerror.java b/langtools/test/tools/javadoc/XWerror.java index 413fa223831..9d78422b638 100644 --- a/langtools/test/tools/javadoc/XWerror.java +++ b/langtools/test/tools/javadoc/XWerror.java @@ -36,7 +36,7 @@ public class XWerror extends Doclet { public static void main(String[] args) { if (com.sun.tools.javadoc.Main. - execute("javadoc", "XWerror", + execute("javadoc", "XWerror", XWerror.class.getClassLoader(), new String[] {"-Xwerror", System.getProperty("test.src", ".") + java.io.File.separatorChar + diff --git a/langtools/test/tools/javadoc/completionFailure/CompletionFailure.java b/langtools/test/tools/javadoc/completionFailure/CompletionFailure.java index 6deb20f6af8..991811a5567 100644 --- a/langtools/test/tools/javadoc/completionFailure/CompletionFailure.java +++ b/langtools/test/tools/javadoc/completionFailure/CompletionFailure.java @@ -37,6 +37,7 @@ public class CompletionFailure extends Doclet // run javadoc on package pkg if (com.sun.tools.javadoc.Main.execute("javadoc", "CompletionFailure", + CompletionFailure.class.getClassLoader(), new String[]{"pkg"}) != 0) throw new Error(); } diff --git a/langtools/test/tools/javadoc/dupOk/DupOk.java b/langtools/test/tools/javadoc/dupOk/DupOk.java index 7d48afc2afd..80d0f19ab22 100644 --- a/langtools/test/tools/javadoc/dupOk/DupOk.java +++ b/langtools/test/tools/javadoc/dupOk/DupOk.java @@ -36,7 +36,7 @@ public class DupOk extends Doclet public static void main(String[] args) { // run javadoc on package p if (com.sun.tools.javadoc.Main. - execute("javadoc", "DupOk", + execute("javadoc", "DupOk", DupOk.class.getClassLoader(), new String[] {"-sourcepath", System.getProperty("test.src", ".") + java.io.File.separatorChar + "sp1" + diff --git a/langtools/test/tools/javadoc/imports/MissingImport.java b/langtools/test/tools/javadoc/imports/MissingImport.java index a1591c4c5b0..3dec6884b7f 100644 --- a/langtools/test/tools/javadoc/imports/MissingImport.java +++ b/langtools/test/tools/javadoc/imports/MissingImport.java @@ -41,6 +41,7 @@ public class MissingImport extends Doclet { if (com.sun.tools.javadoc.Main.execute( "javadoc", "MissingImport", + MissingImport.class.getClassLoader(), new String[] {thisFile}) != 0) throw new Error("Javadoc encountered warnings or errors."); } diff --git a/langtools/test/tools/javadoc/lib/Tester.java b/langtools/test/tools/javadoc/lib/Tester.java index 11c3b13407d..626efe22094 100644 --- a/langtools/test/tools/javadoc/lib/Tester.java +++ b/langtools/test/tools/javadoc/lib/Tester.java @@ -89,7 +89,9 @@ public class Tester { public void run() throws IOException { try { if (com.sun.tools.javadoc.Main.execute("javadoc", - docletName, args) != 0) { + docletName, + getClass().getClassLoader(), + args) != 0) { throw new Error("Javadoc errors encountered."); } System.out.println("--> Output written to " + outputFile); diff --git a/langtools/test/tools/javadoc/nestedClass/NestedClass.java b/langtools/test/tools/javadoc/nestedClass/NestedClass.java index b2bfcee909d..76b8b488ee3 100644 --- a/langtools/test/tools/javadoc/nestedClass/NestedClass.java +++ b/langtools/test/tools/javadoc/nestedClass/NestedClass.java @@ -39,7 +39,7 @@ public class NestedClass extends Doclet public static void main(String[] args) { if (com.sun.tools.javadoc.Main. - execute("javadoc", "NestedClass", + execute("javadoc", "NestedClass", NestedClass.class.getClassLoader(), new String[] {System.getProperty("test.src", ".") + java.io.File.separatorChar + "NestedClass.java"}) diff --git a/langtools/test/tools/javadoc/sourceOnly/p/SourceOnly.java b/langtools/test/tools/javadoc/sourceOnly/p/SourceOnly.java index 6927b09a6d6..e8a27de3718 100644 --- a/langtools/test/tools/javadoc/sourceOnly/p/SourceOnly.java +++ b/langtools/test/tools/javadoc/sourceOnly/p/SourceOnly.java @@ -31,7 +31,7 @@ public class SourceOnly extends com.sun.javadoc.Doclet public static void main(String[] args) { // run javadoc on package p int result = com.sun.tools.javadoc.Main. - execute("javadoc", "p.SourceOnly", new String[] {"p"}); + execute("javadoc", "p.SourceOnly", SourceOnly.class.getClassLoader(), new String[] {"p"}); if (result != 0) throw new Error(); } diff --git a/langtools/test/tools/javadoc/sourceOption/SourceOption.java b/langtools/test/tools/javadoc/sourceOption/SourceOption.java index 273dca30a10..b1bac2f5dbe 100644 --- a/langtools/test/tools/javadoc/sourceOption/SourceOption.java +++ b/langtools/test/tools/javadoc/sourceOption/SourceOption.java @@ -36,6 +36,7 @@ public class SourceOption extends Doclet { if (com.sun.tools.javadoc.Main.execute( "javadoc", "SourceOption", + SourceOption.class.getClassLoader(), new String[] {"-source", "1.3", "p"}) != 0) throw new Error("Javadoc encountered warnings or errors."); } diff --git a/langtools/test/tools/javadoc/subpackageIgnore/SubpackageIgnore.java b/langtools/test/tools/javadoc/subpackageIgnore/SubpackageIgnore.java index e5d277cbb22..5da02b2ae69 100644 --- a/langtools/test/tools/javadoc/subpackageIgnore/SubpackageIgnore.java +++ b/langtools/test/tools/javadoc/subpackageIgnore/SubpackageIgnore.java @@ -36,6 +36,7 @@ public class SubpackageIgnore extends Doclet { if (com.sun.tools.javadoc.Main.execute( "javadoc", "SubpackageIgnore", + SubpackageIgnore.class.getClassLoader(), new String[] {"-Xwerror", "-sourcepath", System.getProperty("test.src", "."), From 0f7dc308163478ff1abd04ba0e21b9ba54e82693 Mon Sep 17 00:00:00 2001 From: Maurizio Cimadamore Date: Wed, 15 Oct 2008 17:23:55 +0100 Subject: [PATCH 055/267] 6759682: APT: compiler message file broken after refactoring of com.sun.tools.javac.util.Message JavacMessages should refresh its own bundle cache when a new resource bundle is added by APT Reviewed-by: jjg --- .../share/classes/com/sun/tools/javac/util/JavacMessages.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/JavacMessages.java b/langtools/src/share/classes/com/sun/tools/javac/util/JavacMessages.java index e67fde5e747..e10adfcc679 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/util/JavacMessages.java +++ b/langtools/src/share/classes/com/sun/tools/javac/util/JavacMessages.java @@ -99,10 +99,11 @@ public class JavacMessages implements Messages { bundleNames = bundleNames.prepend(bundleName); if (!bundleCache.isEmpty()) bundleCache.clear(); + currentBundles = null; } public List getBundles(Locale locale) { - if (locale == currentLocale) + if (locale == currentLocale && currentBundles != null) return currentBundles; SoftReference> bundles = bundleCache.get(locale); List bundleList = bundles == null ? null : bundles.get(); From a2201c5ae7a67ce67654d5f96a6f58cb2c820634 Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Wed, 15 Oct 2008 11:13:23 -0700 Subject: [PATCH 056/267] 6759795: test/tools/apt/Basic/print.sh may fail depending on jtreg options Reviewed-by: darcy --- langtools/test/tools/apt/Basics/print.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/langtools/test/tools/apt/Basics/print.sh b/langtools/test/tools/apt/Basics/print.sh index 42aad383bdd..5622868927a 100644 --- a/langtools/test/tools/apt/Basics/print.sh +++ b/langtools/test/tools/apt/Basics/print.sh @@ -26,7 +26,6 @@ # @test # @bug 5008759 4998341 5018369 5032476 5060121 5096932 5096931 # @run shell ../verifyVariables.sh -# @build Aggregate # @run shell print.sh # @summary test availabilty of print option # @author Joseph D. Darcy @@ -42,6 +41,12 @@ case "${OS}" in ;; esac +# Compile file directly, without TESTJAVACOPTS +# Don't use @build or @compile as these implicitly use jtreg -javacoption values +# and it is important that this file be compiled as expected, for later comparison +# against a golden file. +"${TESTJAVA}/bin/javac" ${TESTTOOLVMOPTS} -d ${TESTCLASSES} ${TESTSRC}/Aggregate.java + # Construct path to apt executable APT="${TESTJAVA}/bin/apt ${TESTTOOLVMOPTS} \ -print " From a75a5f00d6662788d20b93b816dd543414d1dd43 Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Wed, 15 Oct 2008 13:20:03 -0700 Subject: [PATCH 057/267] 6759796: test/tools/javac/6348193/T6348193.java fails if there are empty entries on the bootclasspath Reviewed-by: darcy --- langtools/test/tools/javac/processing/6348193/T6348193.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/langtools/test/tools/javac/processing/6348193/T6348193.java b/langtools/test/tools/javac/processing/6348193/T6348193.java index a84370923c3..71f1f3e3c6c 100644 --- a/langtools/test/tools/javac/processing/6348193/T6348193.java +++ b/langtools/test/tools/javac/processing/6348193/T6348193.java @@ -118,10 +118,7 @@ public class T6348193 extends AbstractProcessor // set up or remove a service configuration file static void installConfigFile(NoGoodBad type) throws IOException { - URL self = T6348193.class.getClassLoader().getResource(myName+".class"); - if (!self.getProtocol().equals("file")) - throw new AssertionError(); - File f = new File(self.getFile()).getParentFile(); + File f = new File(System.getProperty("test.classes", ".")); for (String s: new String[] { "META-INF", "services", Processor.class.getName() }) f = new File(f, s); BufferedWriter out; From ad3ca8d8f2d2c74245ec4aeda5fc8dbd94c204a1 Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Thu, 16 Oct 2008 07:30:13 -0700 Subject: [PATCH 058/267] 6759775: RegularFileObject.inferBinaryName gives bad result on empty path Reviewed-by: mcimadamore --- .../classes/com/sun/tools/javac/file/RegularFileObject.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/langtools/src/share/classes/com/sun/tools/javac/file/RegularFileObject.java b/langtools/src/share/classes/com/sun/tools/javac/file/RegularFileObject.java index a2a4b2bdc73..c604134cab1 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/file/RegularFileObject.java +++ b/langtools/src/share/classes/com/sun/tools/javac/file/RegularFileObject.java @@ -89,6 +89,8 @@ class RegularFileObject extends BaseFileObject { for (File dir: path) { //System.err.println("dir: " + dir); String dPath = dir.getPath(); + if (dPath.length() == 0) + dPath = System.getProperty("user.dir"); if (!dPath.endsWith(File.separator)) dPath += File.separator; if (fPath.regionMatches(true, 0, dPath, 0, dPath.length()) From 72ffb28a4d8221c9250eac2ab3e4080b6f6ed6a8 Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Thu, 16 Oct 2008 07:39:53 -0700 Subject: [PATCH 059/267] 6759810: bad regression test causes source file to be deleted Reviewed-by: mcimadamore --- langtools/test/tools/javac/links/T.java | 8 -------- langtools/test/tools/javac/links/links.sh | 13 +++++++++++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/langtools/test/tools/javac/links/T.java b/langtools/test/tools/javac/links/T.java index 7874f2ed226..506fb40ccdf 100644 --- a/langtools/test/tools/javac/links/T.java +++ b/langtools/test/tools/javac/links/T.java @@ -21,12 +21,4 @@ * have any questions. */ -/* - * @test - * @bug 4266026 - * @summary javac no longer follows symlinks - * - * @run shell links.sh - */ - class T extends a.B {} diff --git a/langtools/test/tools/javac/links/links.sh b/langtools/test/tools/javac/links/links.sh index 942aa81235c..89d1c02cee7 100644 --- a/langtools/test/tools/javac/links/links.sh +++ b/langtools/test/tools/javac/links/links.sh @@ -23,6 +23,12 @@ # have any questions. # +# @test +# @bug 4266026 +# @summary javac no longer follows symlinks +# +# @run shell links.sh + if [ "${TESTSRC}" = "" ] then @@ -58,8 +64,11 @@ case "$OS" in ;; esac +mkdir tmp +cp ${TESTSRC}/b/B.java tmp + rm -rf T.class B.class b/B.class "${TESTCLASSES}/a" "${TESTCLASSES}/classes" -ln -s "${TESTSRC}/b" "${TESTCLASSES}/a" +ln -s `pwd`/tmp "${TESTCLASSES}/a" mkdir "${TESTCLASSES}/classes" -exec "${TESTJAVA}/bin/javac" ${TESTTOOLVMOPTS} -sourcepath "${TESTCLASSES}" -d "${TESTCLASSES}/classes" "${TESTSRC}/T.java" 2>&1 +"${TESTJAVA}/bin/javac" ${TESTTOOLVMOPTS} -sourcepath "${TESTCLASSES}" -d "${TESTCLASSES}/classes" "${TESTSRC}/T.java" 2>&1 From 1cfe36b8a13067f75f6f76147d3e420f5a28b193 Mon Sep 17 00:00:00 2001 From: Maurizio Cimadamore Date: Thu, 16 Oct 2008 18:07:37 +0100 Subject: [PATCH 060/267] 6760226: test/tools/javap/T6622260.java fails with specific locale settings Changed the regression test in order to make it more robust w.r.t. to locale settings Reviewed-by: jjg --- langtools/test/tools/javap/T6622260.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/langtools/test/tools/javap/T6622260.java b/langtools/test/tools/javap/T6622260.java index d0b5694d030..c914f7bbd7e 100644 --- a/langtools/test/tools/javap/T6622260.java +++ b/langtools/test/tools/javap/T6622260.java @@ -189,10 +189,7 @@ public class T6622260 { void verify(String output) { System.out.println(output); - if (output.startsWith("Classfile")) { - // make sure to ignore filename - output = output.substring(output.indexOf('\n')); - } + output = output.substring(output.indexOf("Test.java")); if (output.indexOf("-") >= 0) throw new Error("- found in output"); if (output.indexOf("FFFFFF") >= 0) From c6c8882d70bea7c26ec609930af71c3f29616308 Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Thu, 16 Oct 2008 16:53:56 -0700 Subject: [PATCH 061/267] 6760500: test com/sun/javadoc/testSupplementary/TestSupplementary.java is not same-VM safe Reviewed-by: darcy --- .../testSupplementary/TestSupplementary.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/langtools/test/com/sun/javadoc/testSupplementary/TestSupplementary.java b/langtools/test/com/sun/javadoc/testSupplementary/TestSupplementary.java index 65b9c2db86e..e2a4939ec0c 100644 --- a/langtools/test/com/sun/javadoc/testSupplementary/TestSupplementary.java +++ b/langtools/test/com/sun/javadoc/testSupplementary/TestSupplementary.java @@ -33,6 +33,8 @@ * @run main TestSupplementary */ +import java.util.Locale; + public class TestSupplementary extends JavadocTester { private static final String BUG_ID = "4914724"; @@ -56,9 +58,14 @@ public class TestSupplementary extends JavadocTester { * @param args the array of command line arguments. */ public static void main(String[] args) { - TestSupplementary tester = new TestSupplementary(); - run(tester, ARGS, TEST, NEGATED_TEST); - tester.printSummary(); + Locale saveLocale = Locale.getDefault(); + try { + TestSupplementary tester = new TestSupplementary(); + run(tester, ARGS, TEST, NEGATED_TEST); + tester.printSummary(); + } finally { + Locale.setDefault(saveLocale); + } } /** From f134b5139af446fb9aaeb9dc9843a9f7c45f6430 Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Fri, 17 Oct 2008 13:02:00 +0800 Subject: [PATCH 062/267] 6706974: Add krb5 test infrastructure Reviewed-by: valeriep --- jdk/test/sun/security/krb5/auto/Action.java | 33 + .../sun/security/krb5/auto/BasicKrb5Test.java | 111 ++ .../sun/security/krb5/auto/CleanState.java | 75 ++ jdk/test/sun/security/krb5/auto/Context.java | 386 +++++++ .../sun/security/krb5/auto/CrossRealm.java | 101 ++ jdk/test/sun/security/krb5/auto/KDC.java | 962 ++++++++++++++++++ .../krb5/auto/KerberosHashEqualsTest.java | 173 ++++ jdk/test/sun/security/krb5/auto/OneKDC.java | 140 +++ jdk/test/sun/security/krb5/auto/basic.sh | 65 ++ 9 files changed, 2046 insertions(+) create mode 100644 jdk/test/sun/security/krb5/auto/Action.java create mode 100644 jdk/test/sun/security/krb5/auto/BasicKrb5Test.java create mode 100644 jdk/test/sun/security/krb5/auto/CleanState.java create mode 100644 jdk/test/sun/security/krb5/auto/Context.java create mode 100644 jdk/test/sun/security/krb5/auto/CrossRealm.java create mode 100644 jdk/test/sun/security/krb5/auto/KDC.java create mode 100644 jdk/test/sun/security/krb5/auto/KerberosHashEqualsTest.java create mode 100644 jdk/test/sun/security/krb5/auto/OneKDC.java create mode 100644 jdk/test/sun/security/krb5/auto/basic.sh diff --git a/jdk/test/sun/security/krb5/auto/Action.java b/jdk/test/sun/security/krb5/auto/Action.java new file mode 100644 index 00000000000..1e7073dc1ff --- /dev/null +++ b/jdk/test/sun/security/krb5/auto/Action.java @@ -0,0 +1,33 @@ +/* + * 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. + * + * 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. + */ + +/** + * Action used in Context.doAs + */ +public interface Action { + /** + * This method always reads a byte block and emits another one + */ + byte[] run(Context s, byte[] input) throws Exception; +} + diff --git a/jdk/test/sun/security/krb5/auto/BasicKrb5Test.java b/jdk/test/sun/security/krb5/auto/BasicKrb5Test.java new file mode 100644 index 00000000000..2099e27ffd1 --- /dev/null +++ b/jdk/test/sun/security/krb5/auto/BasicKrb5Test.java @@ -0,0 +1,111 @@ +/* + * 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. + * + * 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 6706974 + * @summary Add krb5 test infrastructure + */ + +import org.ietf.jgss.GSSName; +import sun.security.jgss.GSSUtil; +import sun.security.krb5.Config; +import sun.security.krb5.internal.crypto.EType; + +/** + * Basic JGSS/krb5 test with 3 parties: client, server, backend server. Each + * party uses JAAS login to get subjects and executes JGSS calls using + * Subject.doAs. + */ +public class BasicKrb5Test { + + /** + * @param args empty or etype + */ + public static void main(String[] args) + throws Exception { + + String etype = null; + if (args.length > 0) { + etype = args[0]; + } + System.out.println("Testing etype " + etype); + if (etype != null && !EType.isSupported(Config.getInstance().getType(etype))) { + System.out.println("Not supported."); + System.exit(0); + } + + // Creates and starts the KDC + new OneKDC(etype).writeJAASConf(); + new BasicKrb5Test().go(OneKDC.SERVER, OneKDC.BACKEND); + } + + void go(final String server, final String backend) throws Exception { + Context c, s, s2, b; + c = Context.fromJAAS("client"); + s = Context.fromJAAS("server"); + b = Context.fromJAAS("backend"); + + c.startAsClient(server, GSSUtil.GSS_KRB5_MECH_OID); + c.x().requestCredDeleg(true); + s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID); + + c.status(); + s.status(); + + Context.handshake(c, s); + GSSName client = c.x().getSrcName(); + + c.status(); + s.status(); + + Context.transmit("i say high --", c, s); + Context.transmit(" you say low", s, c); + + s2 = s.delegated(); + s.dispose(); + s = null; + + s2.startAsClient(backend, GSSUtil.GSS_KRB5_MECH_OID); + b.startAsServer(GSSUtil.GSS_KRB5_MECH_OID); + + s2.status(); + b.status(); + + Context.handshake(s2, b); + GSSName client2 = b.x().getSrcName(); + + if (!client.equals(client2)) { + throw new Exception("Delegation failed"); + } + + s2.status(); + b.status(); + + Context.transmit("you say hello --", s2, b); + Context.transmit(" i say goodbye", b, s2); + + s2.dispose(); + b.dispose(); + } +} diff --git a/jdk/test/sun/security/krb5/auto/CleanState.java b/jdk/test/sun/security/krb5/auto/CleanState.java new file mode 100644 index 00000000000..8f79fd8e70e --- /dev/null +++ b/jdk/test/sun/security/krb5/auto/CleanState.java @@ -0,0 +1,75 @@ +/* + * 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. + * + * 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 6716534 + * @summary Krb5LoginModule has not cleaned temp info between authentication attempts + */ +import com.sun.security.auth.module.Krb5LoginModule; +import java.util.HashMap; +import java.util.Map; +import javax.security.auth.Subject; +import javax.security.auth.callback.Callback; +import javax.security.auth.callback.CallbackHandler; +import javax.security.auth.callback.NameCallback; +import javax.security.auth.callback.PasswordCallback; + +public class CleanState { + public static void main(String[] args) throws Exception { + CleanState x = new CleanState(); + new OneKDC(null); + x.go(); + } + + void go() throws Exception { + Krb5LoginModule krb5 = new Krb5LoginModule(); + + final String name = OneKDC.USER; + final char[] password = OneKDC.PASS; + char[] badpassword = "hellokitty".toCharArray(); + + Map map = new HashMap(); + map.put("useTicketCache", "false"); + map.put("doNotPrompt", "false"); + map.put("tryFirstPass", "true"); + Map shared = new HashMap(); + shared.put("javax.security.auth.login.name", name); + shared.put("javax.security.auth.login.password", badpassword); + + krb5.initialize(new Subject(), new CallbackHandler() { + @Override + public void handle(Callback[] callbacks) { + for(Callback callback: callbacks) { + if (callback instanceof NameCallback) { + ((NameCallback)callback).setName(name); + } + if (callback instanceof PasswordCallback) { + ((PasswordCallback)callback).setPassword(password); + } + } + } + }, shared, map); + krb5.login(); + } +} diff --git a/jdk/test/sun/security/krb5/auto/Context.java b/jdk/test/sun/security/krb5/auto/Context.java new file mode 100644 index 00000000000..9f52dad1f1a --- /dev/null +++ b/jdk/test/sun/security/krb5/auto/Context.java @@ -0,0 +1,386 @@ +/* + * 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. + * + * 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. + */ + +import com.sun.security.auth.module.Krb5LoginModule; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import javax.security.auth.Subject; +import javax.security.auth.kerberos.KerberosKey; +import javax.security.auth.kerberos.KerberosTicket; +import javax.security.auth.login.LoginContext; +import org.ietf.jgss.GSSContext; +import org.ietf.jgss.GSSCredential; +import org.ietf.jgss.GSSException; +import org.ietf.jgss.GSSManager; +import org.ietf.jgss.GSSName; +import org.ietf.jgss.MessageProp; +import org.ietf.jgss.Oid; + +/** + * Context of a JGSS subject, encapsulating Subject and GSSContext. + * + * Three "constructors", which acquire the (private) credentials and fill + * it into the Subject: + * + * 1. static fromJAAS(): Creates a Context using a JAAS login config entry + * 2. static fromUserPass(): Creates a Context using a username and a password + * 3. delegated(): A new context which uses the delegated credentials from a + * previously established acceptor Context + * + * Two context initiators, which create the GSSContext object inside: + * + * 1. startAsClient() + * 2. startAsServer() + * + * Privileged action: + * doAs(): Performs an action in the name of the Subject + * + * Handshake process: + * static handShake(initiator, acceptor) + * + * A four-phase typical data communication which includes all four GSS + * actions (wrap, unwrap, getMic and veryfyMiC): + * static transmit(message, from, to) + */ +public class Context { + + private Subject s; + private GSSContext x; + private boolean f; // context established? + private String name; + private GSSCredential cred; // see static method delegated(). + + private Context() {} + + /** + * Using the delegated credentials from a previous acceptor + * @param c + */ + public Context delegated() throws Exception { + Context out = new Context(); + out.s = s; + out.cred = x.getDelegCred(); + out.name = name + " as " + out.cred.getName().toString(); + return out; + } + + /** + * Logins with a JAAS login config entry name + */ + public static Context fromJAAS(final String name) throws Exception { + Context out = new Context(); + out.name = name; + LoginContext lc = new LoginContext(name); + lc.login(); + out.s = lc.getSubject(); + return out; + } + + /** + * Logins with a username and a password, using Krb5LoginModule directly + * @param storeKey true if key should be saved, used on acceptor side + */ + public static Context fromUserPass(String user, char[] pass, boolean storeKey) throws Exception { + Context out = new Context(); + out.name = user; + out.s = new Subject(); + Krb5LoginModule krb5 = new Krb5LoginModule(); + Map map = new HashMap(); + map.put("tryFirstPass", "true"); + if (storeKey) { + map.put("storeKey", "true"); + } + Map shared = new HashMap(); + shared.put("javax.security.auth.login.name", user); + shared.put("javax.security.auth.login.password", pass); + + krb5.initialize(out.s, null, shared, map); + krb5.login(); + krb5.commit(); + return out; + } + + /** + * Starts as a client + * @param target communication peer + * @param mech GSS mech + * @throws java.lang.Exception + */ + public void startAsClient(final String target, final Oid mech) throws Exception { + doAs(new Action() { + @Override + public byte[] run(Context me, byte[] dummy) throws Exception { + GSSManager m = GSSManager.getInstance(); + me.x = m.createContext( + target.indexOf('@') < 0 ? + m.createName(target, null) : + m.createName(target, GSSName.NT_HOSTBASED_SERVICE), + mech, + cred, + GSSContext.DEFAULT_LIFETIME); + return null; + } + }, null); + f = false; + } + + /** + * Starts as a server + * @param mech GSS mech + * @throws java.lang.Exception + */ + public void startAsServer(final Oid mech) throws Exception { + doAs(new Action() { + @Override + public byte[] run(Context me, byte[] dummy) throws Exception { + GSSManager m = GSSManager.getInstance(); + me.x = m.createContext(m.createCredential( + null, + GSSCredential.INDEFINITE_LIFETIME, + mech, + GSSCredential.ACCEPT_ONLY)); + return null; + } + }, null); + f = false; + } + + /** + * Accesses the internal GSSContext object. Currently it's used for -- + * + * 1. calling requestXXX() before handshake + * 2. accessing source name + * + * Note: If the application needs to do any privileged call on this + * object, please use doAs(). Otherwise, it can be done directly. The + * methods listed above are all non-privileged calls. + * + * @return the GSSContext object + */ + public GSSContext x() { + return x; + } + + /** + * Disposes the GSSContext within + * @throws org.ietf.jgss.GSSException + */ + public void dispose() throws GSSException { + x.dispose(); + } + + /** + * Does something using the Subject inside + * @param action the action + * @param in the input byte + * @return the output byte + * @throws java.lang.Exception + */ + public byte[] doAs(final Action action, final byte[] in) throws Exception { + try { + return Subject.doAs(s, new PrivilegedExceptionAction() { + + @Override + public byte[] run() throws Exception { + return action.run(Context.this, in); + } + }); + } catch (PrivilegedActionException pae) { + throw pae.getException(); + } + } + + /** + * Prints status of GSSContext and Subject + * @throws java.lang.Exception + */ + public void status() throws Exception { + System.out.println("STATUS OF " + name.toUpperCase()); + try { + StringBuffer sb = new StringBuffer(); + if (x.getAnonymityState()) { + sb.append("anon, "); + } + if (x.getConfState()) { + sb.append("conf, "); + } + if (x.getCredDelegState()) { + sb.append("deleg, "); + } + if (x.getIntegState()) { + sb.append("integ, "); + } + if (x.getMutualAuthState()) { + sb.append("mutual, "); + } + if (x.getReplayDetState()) { + sb.append("rep det, "); + } + if (x.getSequenceDetState()) { + sb.append("seq det, "); + } + System.out.println("Context status of " + name + ": " + sb.toString()); + System.out.println(x.getSrcName() + " -> " + x.getTargName()); + } catch (Exception e) { + ;// Don't care + } + System.out.println("====================================="); + for (Object o : s.getPrivateCredentials()) { + System.out.println(" " + o.getClass()); + if (o instanceof KerberosTicket) { + KerberosTicket kt = (KerberosTicket) o; + System.out.println(" " + kt.getServer() + " for " + kt.getClient()); + } else if (o instanceof KerberosKey) { + KerberosKey kk = (KerberosKey) o; + System.out.print(" " + kk.getKeyType() + " " + kk.getVersionNumber() + " " + kk.getAlgorithm() + " "); + for (byte b : kk.getEncoded()) { + System.out.printf("%02X", b & 0xff); + } + System.out.println(); + } else if (o instanceof Map) { + Map map = (Map) o; + for (Object k : map.keySet()) { + System.out.println(" " + k + ": " + map.get(k)); + } + } + } + } + + /** + * Transmits a message from one Context to another. The sender wraps the + * message and sends it to the receiver. The receiver unwraps it, creates + * a MIC of the clear text and sends it back to the sender. The sender + * verifies the MIC against the message sent earlier. + * @param message the message + * @param s1 the sender + * @param s2 the receiver + * @throws java.lang.Exception If anything goes wrong + */ + static public void transmit(final String message, final Context s1, + final Context s2) throws Exception { + final byte[] messageBytes = message.getBytes(); + System.out.printf("-------------------- TRANSMIT from %s to %s------------------------\n", + s1.name, s2.name); + + byte[] t = s1.doAs(new Action() { + @Override + public byte[] run(Context me, byte[] dummy) throws Exception { + System.out.println("wrap"); + MessageProp p1 = new MessageProp(0, true); + byte[] out = me.x.wrap(messageBytes, 0, messageBytes.length, p1); + System.out.println(printProp(p1)); + return out; + } + }, null); + + t = s2.doAs(new Action() { + @Override + public byte[] run(Context me, byte[] input) throws Exception { + MessageProp p1 = new MessageProp(0, true); + byte[] bytes = me.x.unwrap(input, 0, input.length, p1); + if (!Arrays.equals(messageBytes, bytes)) + throw new Exception("wrap/unwrap mismatch"); + System.out.println("unwrap"); + System.out.println(printProp(p1)); + p1 = new MessageProp(0, true); + System.out.println("getMIC"); + bytes = me.x.getMIC(bytes, 0, bytes.length, p1); + System.out.println(printProp(p1)); + return bytes; + } + }, t); + // Re-unwrap should make p2.isDuplicateToken() returns true + s1.doAs(new Action() { + @Override + public byte[] run(Context me, byte[] input) throws Exception { + MessageProp p1 = new MessageProp(0, true); + System.out.println("verifyMIC"); + me.x.verifyMIC(input, 0, input.length, + messageBytes, 0, messageBytes.length, + p1); + System.out.println(printProp(p1)); + return null; + } + }, t); + } + + /** + * Returns a string description of a MessageProp object + * @param prop the object + * @return the description + */ + static public String printProp(MessageProp prop) { + StringBuffer sb = new StringBuffer(); + sb.append("MessagePop: "); + sb.append("QOP="+ prop.getQOP() + ", "); + sb.append(prop.getPrivacy()?"privacy, ":""); + sb.append(prop.isDuplicateToken()?"dup, ":""); + sb.append(prop.isGapToken()?"gap, ":""); + sb.append(prop.isOldToken()?"old, ":""); + sb.append(prop.isUnseqToken()?"unseq, ":""); + sb.append(prop.getMinorString()+ "(" + prop.getMinorStatus()+")"); + return sb.toString(); + } + + /** + * Handshake (security context establishment process) between two Contexts + * @param c the initiator + * @param s the acceptor + * @throws java.lang.Exception + */ + static public void handshake(final Context c, final Context s) throws Exception { + byte[] t = new byte[0]; + while (!c.f || !s.f) { + t = c.doAs(new Action() { + @Override + public byte[] run(Context me, byte[] input) throws Exception { + if (me.x.isEstablished()) { + me.f = true; + System.out.println(c.name + " side established"); + return null; + } else { + System.out.println(c.name + " call initSecContext"); + return me.x.initSecContext(input, 0, input.length); + } + } + }, t); + + t = s.doAs(new Action() { + @Override + public byte[] run(Context me, byte[] input) throws Exception { + if (me.x.isEstablished()) { + me.f = true; + System.out.println(s.name + " side established"); + return null; + } else { + System.out.println(s.name + " called acceptSecContext"); + return me.x.acceptSecContext(input, 0, input.length); + } + } + }, t); + } + } +} diff --git a/jdk/test/sun/security/krb5/auto/CrossRealm.java b/jdk/test/sun/security/krb5/auto/CrossRealm.java new file mode 100644 index 00000000000..9b610279ebc --- /dev/null +++ b/jdk/test/sun/security/krb5/auto/CrossRealm.java @@ -0,0 +1,101 @@ +/* + * 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. + * + * 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 6706974 + * @summary Add krb5 test infrastructure + */ +import java.io.FileOutputStream; +import java.io.IOException; +import java.security.Security; +import javax.security.auth.callback.Callback; +import javax.security.auth.callback.CallbackHandler; +import javax.security.auth.callback.NameCallback; +import javax.security.auth.callback.PasswordCallback; +import javax.security.auth.callback.UnsupportedCallbackException; +import org.ietf.jgss.GSSContext; +import org.ietf.jgss.GSSManager; +import org.ietf.jgss.GSSName; +import sun.security.jgss.GSSUtil; + +public class CrossRealm implements CallbackHandler { + public static void main(String[] args) throws Exception { + startKDCs(); + xRealmAuth(); + } + + static void startKDCs() throws Exception { + // Create and start the KDC + KDC kdc1 = KDC.create("RABBIT.HOLE"); + kdc1.addPrincipal("dummy", "bogus".toCharArray()); + kdc1.addPrincipalRandKey("krbtgt/RABBIT.HOLE"); + kdc1.addPrincipal("krbtgt/SNAKE.HOLE", "sharedsec".toCharArray()); + + KDC kdc2 = KDC.create("SNAKE.HOLE"); + kdc2.addPrincipalRandKey("krbtgt/SNAKE.HOLE"); + kdc2.addPrincipal("krbtgt/RABBIT.HOLE", "sharedsec".toCharArray()); + kdc2.addPrincipalRandKey("host/www.snake.hole"); + + KDC.saveConfig("krb5-localkdc.conf", kdc1, kdc2, + "forwardable=true", + "[domain_realm]", + ".snake.hole=SNAKE.HOLE"); + System.setProperty("java.security.krb5.conf", "krb5-localkdc.conf"); + } + + static void xRealmAuth() throws Exception { + Security.setProperty("auth.login.defaultCallbackHandler", "CrossRealm"); + System.setProperty("java.security.auth.login.config", "jaas-localkdc.conf"); + System.setProperty("javax.security.auth.useSubjectCredsOnly", "false"); + FileOutputStream fos = new FileOutputStream("jaas-localkdc.conf"); + fos.write(("com.sun.security.jgss.krb5.initiate {\n" + + " com.sun.security.auth.module.Krb5LoginModule\n" + + " required\n" + + " principal=dummy\n" + + " doNotPrompt=false\n" + + " useTicketCache=false\n" + + " ;\n" + + "};").getBytes()); + fos.close(); + + GSSManager m = GSSManager.getInstance(); + m.createContext( + m.createName("host@www.snake.hole", GSSName.NT_HOSTBASED_SERVICE), + GSSUtil.GSS_KRB5_MECH_OID, + null, + GSSContext.DEFAULT_LIFETIME).initSecContext(new byte[0], 0, 0); + } + + @Override + public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { + for (Callback callback : callbacks) { + if (callback instanceof NameCallback) { + ((NameCallback) callback).setName("dummy"); + } + if (callback instanceof PasswordCallback) { + ((PasswordCallback) callback).setPassword("bogus".toCharArray()); + } + } + } +} diff --git a/jdk/test/sun/security/krb5/auto/KDC.java b/jdk/test/sun/security/krb5/auto/KDC.java new file mode 100644 index 00000000000..03375950ba4 --- /dev/null +++ b/jdk/test/sun/security/krb5/auto/KDC.java @@ -0,0 +1,962 @@ +/* + * 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. + * + * 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. + */ + +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.net.*; +import java.io.*; +import java.lang.reflect.Method; +import java.security.SecureRandom; +import java.util.*; +import java.util.concurrent.*; +import sun.security.krb5.*; +import sun.security.krb5.internal.*; +import sun.security.krb5.internal.crypto.KeyUsage; +import sun.security.krb5.internal.ktab.KeyTab; +import sun.security.util.DerInputStream; +import sun.security.util.DerOutputStream; +import sun.security.util.DerValue; + +/** + * A KDC server. + *

+ * Features: + *

    + *
  1. Supports TCP and UDP + *
  2. Supports AS-REQ and TGS-REQ + *
  3. Principal db and other settings hard coded in application + *
  4. Options, say, request preauth or not + *
+ * Side effects: + *
    + *
  1. The Sun-internal class sun.security.krb5.Config is a + * singleton and initialized according to Kerberos settings (krb5.conf and + * java.security.krb5.* system properties). This means once it's initialized + * it will not automatically notice any changes to these settings (or file + * changes of krb5.conf). The KDC class normally does not touch these + * settings (except for the writeKtab() method). However, to make + * sure nothing ever goes wrong, if you want to make any changes to these + * settings after calling a KDC method, call Config.refresh() to + * make sure your changes are reflected in the Config object. + *
+ * Issues and TODOs: + *
    + *
  1. Generates krb5.conf to be used on another machine, currently the kdc is + * always localhost + *
  2. More options to KDC, say, error output, say, response nonce != + * request nonce + *
+ * Note: This program uses internal krb5 classes (including reflection to + * access private fields and methods). + *

+ * Usages: + *

+ * 1. Init and start the KDC: + *

+ * KDC kdc = KDC.create("REALM.NAME", port, isDaemon);
+ * KDC kdc = KDC.create("REALM.NAME");
+ * 
+ * Here, port is the UDP and TCP port number the KDC server + * listens on. If zero, a random port is chosen, which you can use getPort() + * later to retrieve the value. + *

+ * If isDaemon is true, the KDC worker threads will be daemons. + *

+ * The shortcut KDC.create("REALM.NAME") has port=0 and + * isDaemon=false, and is commonly used in an embedded KDC. + *

+ * 2. Adding users: + *

+ * kdc.addPrincipal(String principal_name, char[] password);
+ * kdc.addPrincipalRandKey(String principal_name);
+ * 
+ * A service principal's name should look like "host/f.q.d.n". The second form + * generates a random key. To expose this key, call writeKtab() to + * save the keys into a keytab file. + *

+ * Note that you need to add the principal name krbtgt/REALM.NAME yourself. + *

+ * Note that you can safely add a principal at any time after the KDC is + * started and before a user requests info on this principal. + *

+ * 3. Other public methods: + *

    + *
  • getPort: Returns the port number the KDC uses + *
  • getRealm: Returns the realm name + *
  • writeKtab: Writes all principals' keys into a keytab file + *
  • saveConfig: Saves a krb5.conf file to access this KDC + *
  • setOption: Sets various options + *
+ * Read the javadoc for details. Lazy developer can use OneKDC + * directly. + */ +public class KDC { + + // Under the hood. + + // The random generator to generate random keys (including session keys) + private static SecureRandom secureRandom = new SecureRandom(); + // Principal db + private Map passwords = new HashMap(); + // Realm name + private String realm; + // The request/response job queue + private BlockingQueue q = new ArrayBlockingQueue(100); + // Service port number + private int port; + // Options + private Map options = new HashMap(); + + /** + * Option names, to be expanded forever. + */ + public static enum Option { + /** + * Whether pre-authentication is required. Default Boolean.TRUE + */ + PREAUTH_REQUIRED, + }; + + /** + * A standalone KDC server. + * @param args + * @throws java.lang.Exception + */ + public static void main(String[] args) throws Exception { + if (args.length > 0) { + if (args[0].equals("-help") || args[0].equals("--help")) { + System.out.println("Usage:"); + System.out.println(" java " + KDC.class + " " + + "Start KDC on port 8888"); + return; + } + } + KDC kdc = create("RABBIT.HOLE", 8888, false); + kdc.addPrincipal("dummy", "bogus".toCharArray()); + kdc.addPrincipal("foo", "bar".toCharArray()); + kdc.addPrincipalRandKey("krbtgt/" + kdc.realm); + kdc.addPrincipalRandKey("server/localhost"); + kdc.addPrincipalRandKey("backend/localhost"); + } + + /** + * Creates and starts a KDC running as a daemon on a random port. + * @param realm the realm name + * @return the running KDC instance + * @throws java.io.IOException for any socket creation error + */ + public static KDC create(String realm) throws IOException { + return create(realm, 0, true); + } + + /** + * Creates and starts a KDC server. + * @param realm the realm name + * @param port the TCP and UDP port to listen to. A random port will to + * chosen if zero. + * @param asDaemon if true, KDC threads will be daemons. Otherwise, not. + * @return the running KDC instance + * @throws java.io.IOException for any socket creation error + */ + public static KDC create(String realm, int port, boolean asDaemon) throws IOException { + return new KDC(realm, port, asDaemon); + } + + /** + * Sets an option + * @param key the option name + * @param obj the value + */ + public void setOption(Option key, Object value) { + options.put(key, value); + } + + /** + * Write all principals' keys into a keytab file. Note that the keys for + * the krbtgt principal for this realm will not be written. + *

+ * Attention: This method references krb5.conf settings. If you need to + * setup krb5.conf later, please call Config.refresh() after + * the new setting. For example: + *

+     * kdc.writeKtab("/etc/kdc/ktab");  // Config is initialized,
+     * System.setProperty("java.security.krb5.conf", "/home/mykrb5.conf");
+     * Config.refresh();
+     * 
+ * + * Inside this method there are 2 places krb5.conf is used: + *
    + *
  1. (Fatal) Generating keys: EncryptionKey.acquireSecretKeys + *
  2. (Has workaround) Creating PrincipalName + *
+ * @param tab The keytab filename to write to. + * @throws java.io.IOException for any file output error + * @throws sun.security.krb5.KrbException for any realm and/or principal + * name error. + */ + public void writeKtab(String tab) throws IOException, KrbException { + KeyTab ktab = KeyTab.create(tab); + for (String name : passwords.keySet()) { + if (name.equals("krbtgt/" + realm)) { + continue; + } + ktab.addEntry(new PrincipalName(name + "@" + realm, + name.indexOf('/') < 0 ? + PrincipalName.KRB_NT_UNKNOWN : + PrincipalName.KRB_NT_SRV_HST), passwords.get(name)); + } + ktab.save(); + } + + /** + * Adds a new principal to this realm with a given password. + * @param user the principal's name. For a service principal, use the + * form of host/f.q.d.n + * @param pass the password for the principal + */ + public void addPrincipal(String user, char[] pass) { + passwords.put(user, pass); + } + + /** + * Adds a new principal to this realm with a random password + * @param user the principal's name. For a service principal, use the + * form of host/f.q.d.n + */ + public void addPrincipalRandKey(String user) { + passwords.put(user, randomPassword()); + } + + /** + * Returns the name of this realm + * @return the name of this realm + */ + public String getRealm() { + return realm; + } + + /** + * Writes a krb5.conf for one or more KDC that includes KDC locations for + * each realm and the default realm name. You can also add extra strings + * into the file. The method should be called like: + *
+     *   KDC.saveConfig("krb5.conf", kdc1, kdc2, ..., line1, line2, ...);
+     * 
+ * Here you can provide one or more kdc# and zero or more line# arguments. + * The line# will be put after [libdefaults] and before [realms]. Therefore + * you can append new lines into [libdefaults] and/or create your new + * stanzas as well. Note that a newline character will be appended to + * each line# argument. + *

+ * For example: + *

+     * KDC.saveConfig("krb5.conf", this);
+     * 
+ * generates: + *
+     * [libdefaults]
+     * default_realm = REALM.NAME
+     *
+     * [realms]
+     *   REALM.NAME = {
+     *     kdc = localhost:port_number
+     *   }
+     * 
+ * + * Another example: + *
+     * KDC.saveConfig("krb5.conf", kdc1, kdc2, "forwardable = true", "",
+     *         "[domain_realm]",
+     *         ".kdc1.com = KDC1.NAME");
+     * 
+ * generates: + *
+     * [libdefaults]
+     * default_realm = KDC1.NAME
+     * forwardable = true
+     *
+     * [domain_realm]
+     * .kdc1.com = KDC1.NAME
+     *
+     * [realms]
+     *   KDC1.NAME = {
+     *     kdc = localhost:port1
+     *   }
+     *   KDC2.NAME = {
+     *     kdc = localhost:port2
+     *   }
+     * 
+ * @param file the name of the file to write into + * @param kdc the first (and default) KDC + * @param more more KDCs or extra lines (in their appearing order) to + * insert into the krb5.conf file. This method reads each argument's type + * to determine what it's for. This argument can be empty. + * @throws java.io.IOException for any file output error + */ + public static void saveConfig(String file, KDC kdc, Object... more) + throws IOException { + File f = new File(file); + StringBuffer sb = new StringBuffer(); + sb.append("[libdefaults]\ndefault_realm = "); + sb.append(kdc.realm); + sb.append("\n"); + for (Object o: more) { + if (o instanceof String) { + sb.append(o); + sb.append("\n"); + } + } + sb.append("\n[realms]\n"); + sb.append(realmLineForKDC(kdc)); + for (Object o: more) { + if (o instanceof KDC) { + sb.append(realmLineForKDC((KDC)o)); + } + } + FileOutputStream fos = new FileOutputStream(f); + fos.write(sb.toString().getBytes()); + fos.close(); + } + + /** + * Returns the service port of the KDC server. + * @return the KDC service port + */ + public int getPort() { + return port; + } + + // Private helper methods + + /** + * Private constructor, cannot be called outside. + * @param realm + */ + private KDC(String realm) { + this.realm = realm; + } + + /** + * A constructor that starts the KDC service also. + */ + protected KDC(String realm, int port, boolean asDaemon) + throws IOException { + this(realm); + startServer(port, asDaemon); + } + /** + * Generates a 32-char random password + * @return the password + */ + private static char[] randomPassword() { + char[] pass = new char[32]; + for (int i=0; i<32; i++) + pass[i] = (char)secureRandom.nextInt(); + return pass; + } + + /** + * Generates a random key for the given encryption type. + * @param eType the encryption type + * @return the generated key + * @throws sun.security.krb5.KrbException for unknown/unsupported etype + */ + private static EncryptionKey generateRandomKey(int eType) + throws KrbException { + // Is 32 enough for AES256? I should have generated the keys directly + // but different cryptos have different rules on what keys are valid. + char[] pass = randomPassword(); + String algo; + switch (eType) { + case EncryptedData.ETYPE_DES_CBC_MD5: algo = "DES"; break; + case EncryptedData.ETYPE_DES3_CBC_HMAC_SHA1_KD: algo = "DESede"; break; + case EncryptedData.ETYPE_AES128_CTS_HMAC_SHA1_96: algo = "AES128"; break; + case EncryptedData.ETYPE_ARCFOUR_HMAC: algo = "ArcFourHMAC"; break; + case EncryptedData.ETYPE_AES256_CTS_HMAC_SHA1_96: algo = "AES256"; break; + default: algo = "DES"; break; + } + return new EncryptionKey(pass, "NOTHING", algo); // Silly + } + + /** + * Returns the password for a given principal + * @param p principal + * @return the password + * @throws sun.security.krb5.KrbException when the principal is not inside + * the database. + */ + private char[] getPassword(PrincipalName p) throws KrbException { + char[] pass = passwords.get(p.getNameString()); + if (pass == null) { + throw new KrbException(Krb5.KDC_ERR_C_PRINCIPAL_UNKNOWN); + } + return pass; + } + + /** + * Returns the salt string for the principal. For normal users, the + * concatenation for the realm name and the sections of the principal; + * for krgtgt/A@B and krbtgt/B@A, always return AB (so that inter-realm + * principals have the same key). + * @param p principal + * @return the salt + */ + private String getSalt(PrincipalName p) { + String[] ns = p.getNameStrings(); + if (ns[0].equals("krbtgt") && ns.length > 1) { + // Shared cross-realm keys must be the same + if (ns[1].compareTo(realm) < 0) { + return ns[1] + realm; + } else { + return realm + ns[1]; + } + } else { + String s = getRealm(); + for (String n: p.getNameStrings()) { + s += n; + } + return s; + } + } + + /** + * Returns the key for a given principal of the given encryption type + * @param p the principal + * @param etype the encryption type + * @return the key + * @throws sun.security.krb5.KrbException for unknown/unsupported etype + */ + private EncryptionKey keyForUser(PrincipalName p, int etype) throws KrbException { + try { + // Do not call EncryptionKey.acquireSecretKeys(), otherwise + // the krb5.conf config file would be loaded. + Method stringToKey = EncryptionKey.class.getDeclaredMethod("stringToKey", char[].class, String.class, byte[].class, Integer.TYPE); + stringToKey.setAccessible(true); + return new EncryptionKey((byte[]) stringToKey.invoke(null, getPassword(p), getSalt(p), null, etype), etype, null); + } catch (InvocationTargetException ex) { + KrbException ke = (KrbException)ex.getCause(); + throw ke; + } catch (Exception e) { + throw new RuntimeException(e); // should not happen + } + } + + /** + * Processes an incoming request and generates a response. + * @param in the request + * @return the response + * @throws java.lang.Exception for various errors + */ + private byte[] processMessage(byte[] in) throws Exception { + if ((in[0] & 0x1f) == Krb5.KRB_AS_REQ) + return processAsReq(in); + else + return processTgsReq(in); + } + + /** + * Processes a TGS_REQ and generates a TGS_REP (or KRB_ERROR) + * @param in the request + * @return the response + * @throws java.lang.Exception for various errors + */ + private byte[] processTgsReq(byte[] in) throws Exception { + TGSReq tgsReq = new TGSReq(in); + try { + System.out.println(realm + "> " + tgsReq.reqBody.cname + + " sends TGS-REQ for " + + tgsReq.reqBody.sname); + KDCReqBody body = tgsReq.reqBody; + int etype = 0; + + // Reflection: PAData[] pas = tgsReq.pAData; + Field f = KDCReq.class.getDeclaredField("pAData"); + f.setAccessible(true); + PAData[] pas = (PAData[])f.get(tgsReq); + + Ticket tkt = null; + EncTicketPart etp = null; + if (pas == null || pas.length == 0) { + throw new KrbException(Krb5.KDC_ERR_PADATA_TYPE_NOSUPP); + } else { + for (PAData pa: pas) { + if (pa.getType() == Krb5.PA_TGS_REQ) { + APReq apReq = new APReq(pa.getValue()); + EncryptedData ed = apReq.authenticator; + tkt = apReq.ticket; + etype = tkt.encPart.getEType(); + EncryptionKey kkey = null; + if (!tkt.realm.toString().equals(realm)) { + if (tkt.sname.getNameString().equals("krbtgt/" + realm)) { + kkey = keyForUser(new PrincipalName("krbtgt/" + tkt.realm.toString(), realm), etype); + } + } else { + kkey = keyForUser(tkt.sname, etype); + } + byte[] bb = tkt.encPart.decrypt(kkey, KeyUsage.KU_TICKET); + DerInputStream derIn = new DerInputStream(bb); + DerValue der = derIn.getDerValue(); + etp = new EncTicketPart(der.toByteArray()); + } + } + if (tkt == null) { + throw new KrbException(Krb5.KDC_ERR_PADATA_TYPE_NOSUPP); + } + } + EncryptionKey skey = keyForUser(body.sname, etype); + if (skey == null) { + throw new KrbException(Krb5.KDC_ERR_SUMTYPE_NOSUPP); // TODO + } + + // Session key for original ticket, TGT + EncryptionKey ckey = etp.key; + + // Session key for session with the service + EncryptionKey key = generateRandomKey(etype); + + // Check time, TODO + KerberosTime till = body.till; + if (till == null) { + throw new KrbException(Krb5.KDC_ERR_NEVER_VALID); // TODO + } else if (till.isZero()) { + till = new KerberosTime(new Date().getTime() + 1000 * 3600 * 11); + } + + boolean[] bFlags = new boolean[Krb5.TKT_OPTS_MAX+1]; + if (body.kdcOptions.get(KDCOptions.FORWARDABLE)) { + bFlags[Krb5.TKT_OPTS_FORWARDABLE] = true; + } + if (body.kdcOptions.get(KDCOptions.FORWARDED) || + etp.flags.get(Krb5.TKT_OPTS_FORWARDED)) { + bFlags[Krb5.TKT_OPTS_FORWARDED] = true; + } + if (body.kdcOptions.get(KDCOptions.RENEWABLE)) { + bFlags[Krb5.TKT_OPTS_RENEWABLE] = true; + //renew = new KerberosTime(new Date().getTime() + 1000 * 3600 * 24 * 7); + } + if (body.kdcOptions.get(KDCOptions.PROXIABLE)) { + bFlags[Krb5.TKT_OPTS_PROXIABLE] = true; + } + if (body.kdcOptions.get(KDCOptions.POSTDATED)) { + bFlags[Krb5.TKT_OPTS_POSTDATED] = true; + } + if (body.kdcOptions.get(KDCOptions.ALLOW_POSTDATE)) { + bFlags[Krb5.TKT_OPTS_MAY_POSTDATE] = true; + } + bFlags[Krb5.TKT_OPTS_INITIAL] = true; + + TicketFlags tFlags = new TicketFlags(bFlags); + EncTicketPart enc = new EncTicketPart( + tFlags, + key, + etp.crealm, + etp.cname, + new TransitedEncoding(1, new byte[0]), // TODO + new KerberosTime(new Date()), + body.from, + till, body.rtime, + body.addresses, + null); + Ticket t = new Ticket( + body.crealm, + body.sname, + new EncryptedData(skey, enc.asn1Encode(), KeyUsage.KU_TICKET) + ); + EncTGSRepPart enc_part = new EncTGSRepPart( + key, + new LastReq(new LastReqEntry[]{ + new LastReqEntry(0, new KerberosTime(new Date().getTime() - 10000)) + }), + body.getNonce(), // TODO: detect replay + new KerberosTime(new Date().getTime() + 1000 * 3600 * 24), + // Next 5 and last MUST be same with ticket + tFlags, + new KerberosTime(new Date()), + body.from, + till, body.rtime, + body.crealm, + body.sname, + body.addresses + ); + EncryptedData edata = new EncryptedData(ckey, enc_part.asn1Encode(), KeyUsage.KU_ENC_TGS_REP_PART_SESSKEY); + TGSRep tgsRep = new TGSRep(null, + etp.crealm, + etp.cname, + t, + edata); + System.out.println(" Return " + tgsRep.cname + + " ticket for " + tgsRep.ticket.sname); + + DerOutputStream out = new DerOutputStream(); + out.write(DerValue.createTag(DerValue.TAG_APPLICATION, + true, (byte)Krb5.KRB_TGS_REP), tgsRep.asn1Encode()); + return out.toByteArray(); + } catch (KrbException ke) { + ke.printStackTrace(System.out); + KRBError kerr = ke.getError(); + KDCReqBody body = tgsReq.reqBody; + System.out.println(" Error " + ke.returnCode() + + " " +ke.returnCodeMessage()); + if (kerr == null) { + kerr = new KRBError(null, null, null, + new KerberosTime(new Date()), + 0, + ke.returnCode(), + body.crealm, body.cname, + new Realm(getRealm()), body.sname, + KrbException.errorMessage(ke.returnCode()), + null); + } + return kerr.asn1Encode(); + } + } + + /** + * Processes a AS_REQ and generates a AS_REP (or KRB_ERROR) + * @param in the request + * @return the response + * @throws java.lang.Exception for various errors + */ + private byte[] processAsReq(byte[] in) throws Exception { + ASReq asReq = new ASReq(in); + int[] eTypes = null; + try { + System.out.println(realm + "> " + asReq.reqBody.cname + + " sends AS-REQ for " + + asReq.reqBody.sname); + + KDCReqBody body = asReq.reqBody; + + // Reflection: int[] eType = body.eType; + Field f = KDCReqBody.class.getDeclaredField("eType"); + f.setAccessible(true); + eTypes = (int[])f.get(body); + int eType = eTypes[0]; + + EncryptionKey ckey = keyForUser(body.cname, eType); + EncryptionKey skey = keyForUser(body.sname, eType); + if (ckey == null) { + throw new KrbException(Krb5.KDC_ERR_ETYPE_NOSUPP); + } + if (skey == null) { + throw new KrbException(Krb5.KDC_ERR_SUMTYPE_NOSUPP); // TODO + } + + // Session key + EncryptionKey key = generateRandomKey(eType); + // Check time, TODO + KerberosTime till = body.till; + if (till == null) { + throw new KrbException(Krb5.KDC_ERR_NEVER_VALID); // TODO + } else if (till.isZero()) { + till = new KerberosTime(new Date().getTime() + 1000 * 3600 * 11); + } + //body.from + boolean[] bFlags = new boolean[Krb5.TKT_OPTS_MAX+1]; + if (body.kdcOptions.get(KDCOptions.FORWARDABLE)) { + bFlags[Krb5.TKT_OPTS_FORWARDABLE] = true; + } + if (body.kdcOptions.get(KDCOptions.RENEWABLE)) { + bFlags[Krb5.TKT_OPTS_RENEWABLE] = true; + //renew = new KerberosTime(new Date().getTime() + 1000 * 3600 * 24 * 7); + } + if (body.kdcOptions.get(KDCOptions.PROXIABLE)) { + bFlags[Krb5.TKT_OPTS_PROXIABLE] = true; + } + if (body.kdcOptions.get(KDCOptions.POSTDATED)) { + bFlags[Krb5.TKT_OPTS_POSTDATED] = true; + } + if (body.kdcOptions.get(KDCOptions.ALLOW_POSTDATE)) { + bFlags[Krb5.TKT_OPTS_MAY_POSTDATE] = true; + } + bFlags[Krb5.TKT_OPTS_INITIAL] = true; + + f = KDCReq.class.getDeclaredField("pAData"); + f.setAccessible(true); + PAData[] pas = (PAData[])f.get(asReq); + if (pas == null || pas.length == 0) { + Object preauth = options.get(Option.PREAUTH_REQUIRED); + if (preauth == null || preauth.equals(Boolean.TRUE)) { + throw new KrbException(Krb5.KDC_ERR_PREAUTH_REQUIRED); + } + } else { + try { + Constructor ctor = EncryptedData.class.getDeclaredConstructor(DerValue.class); + ctor.setAccessible(true); + EncryptedData data = ctor.newInstance(new DerValue(pas[0].getValue())); + data.decrypt(ckey, KeyUsage.KU_PA_ENC_TS); + } catch (Exception e) { + throw new KrbException(Krb5.KDC_ERR_PREAUTH_FAILED); + } + bFlags[Krb5.TKT_OPTS_PRE_AUTHENT] = true; + } + + TicketFlags tFlags = new TicketFlags(bFlags); + EncTicketPart enc = new EncTicketPart( + tFlags, + key, + body.crealm, + body.cname, + new TransitedEncoding(1, new byte[0]), + new KerberosTime(new Date()), + body.from, + till, body.rtime, + body.addresses, + null); + Ticket t = new Ticket( + body.crealm, + body.sname, + new EncryptedData(skey, enc.asn1Encode(), KeyUsage.KU_TICKET) + ); + EncASRepPart enc_part = new EncASRepPart( + key, + new LastReq(new LastReqEntry[]{ + new LastReqEntry(0, new KerberosTime(new Date().getTime() - 10000)) + }), + body.getNonce(), // TODO: detect replay? + new KerberosTime(new Date().getTime() + 1000 * 3600 * 24), + // Next 5 and last MUST be same with ticket + tFlags, + new KerberosTime(new Date()), + body.from, + till, body.rtime, + body.crealm, + body.sname, + body.addresses + ); + EncryptedData edata = new EncryptedData(ckey, enc_part.asn1Encode(), KeyUsage.KU_ENC_AS_REP_PART); + ASRep asRep = new ASRep(null, + body.crealm, + body.cname, + t, + edata); + + System.out.println(" Return " + asRep.cname + + " ticket for " + asRep.ticket.sname); + + DerOutputStream out = new DerOutputStream(); + out.write(DerValue.createTag(DerValue.TAG_APPLICATION, + true, (byte)Krb5.KRB_AS_REP), asRep.asn1Encode()); + return out.toByteArray(); + } catch (KrbException ke) { + ke.printStackTrace(System.out); + KRBError kerr = ke.getError(); + KDCReqBody body = asReq.reqBody; + System.out.println(" Error " + ke.returnCode() + + " " +ke.returnCodeMessage()); + byte[] eData = null; + if (kerr == null) { + if (ke.returnCode() == Krb5.KDC_ERR_PREAUTH_REQUIRED || + ke.returnCode() == Krb5.KDC_ERR_PREAUTH_FAILED) { + PAData pa; + + ETypeInfo2 ei2 = new ETypeInfo2(eTypes[0], null, null); + DerOutputStream eid = new DerOutputStream(); + eid.write(DerValue.tag_Sequence, ei2.asn1Encode()); + + pa = new PAData(Krb5.PA_ETYPE_INFO2, eid.toByteArray()); + + DerOutputStream bytes = new DerOutputStream(); + bytes.write(new PAData(Krb5.PA_ENC_TIMESTAMP, new byte[0]).asn1Encode()); + bytes.write(pa.asn1Encode()); + + boolean allOld = true; + for (int i: eTypes) { + if (i == EncryptedData.ETYPE_AES128_CTS_HMAC_SHA1_96 || + i == EncryptedData.ETYPE_AES256_CTS_HMAC_SHA1_96) { + allOld = false; + break; + } + } + if (allOld) { + ETypeInfo ei = new ETypeInfo(eTypes[0], null); + eid = new DerOutputStream(); + eid.write(DerValue.tag_Sequence, ei.asn1Encode()); + pa = new PAData(Krb5.PA_ETYPE_INFO, eid.toByteArray()); + bytes.write(pa.asn1Encode()); + } + DerOutputStream temp = new DerOutputStream(); + temp.write(DerValue.tag_Sequence, bytes); + eData = temp.toByteArray(); + } + kerr = new KRBError(null, null, null, + new KerberosTime(new Date()), + 0, + ke.returnCode(), + body.crealm, body.cname, + new Realm(getRealm()), body.sname, + KrbException.errorMessage(ke.returnCode()), + eData); + } + return kerr.asn1Encode(); + } + } + + /** + * Generates a line for a KDC to put inside [realms] of krb5.conf + * @param kdc the KDC + * @return REALM.NAME = { kdc = localhost:port } + */ + private static String realmLineForKDC(KDC kdc) { + return String.format(" %s = {\n kdc = localhost:%d\n }\n", kdc.realm, kdc.port); + } + + /** + * Start the KDC service. This server listens on both UDP and TCP using + * the same port number. It uses three threads to deal with requests. + * They can be set to daemon threads if requested. + * @param port the port number to listen to. If zero, a random available + * port no less than 8000 will be chosen and used. + * @param asDaemon true if the KDC threads should be daemons + * @throws java.io.IOException for any communication error + */ + protected void startServer(int port, boolean asDaemon) throws IOException { + DatagramSocket u1 = null; + ServerSocket t1 = null; + if (port > 0) { + u1 = new DatagramSocket(port, InetAddress.getByName("127.0.0.1")); + t1 = new ServerSocket(port); + } else { + while (true) { + // Try to find a port number that's both TCP and UDP free + try { + port = 8000 + new java.util.Random().nextInt(10000); + u1 = null; + u1 = new DatagramSocket(port, InetAddress.getByName("127.0.0.1")); + t1 = new ServerSocket(port); + break; + } catch (Exception e) { + if (u1 != null) u1.close(); + } + } + } + final DatagramSocket udp = u1; + final ServerSocket tcp = t1; + System.out.println("Start KDC on " + port); + + this.port = port; + + // The UDP consumer + Thread thread = new Thread() { + public void run() { + while (true) { + try { + byte[] inbuf = new byte[8192]; + DatagramPacket p = new DatagramPacket(inbuf, inbuf.length); + udp.receive(p); + System.out.println("-----------------------------------------------"); + System.out.println(">>>>> UDP packet received"); + q.put(new Job(processMessage(Arrays.copyOf(inbuf, p.getLength())), udp, p)); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + }; + thread.setDaemon(asDaemon); + thread.start(); + + // The TCP consumer + thread = new Thread() { + public void run() { + while (true) { + try { + Socket socket = tcp.accept(); + System.out.println("-----------------------------------------------"); + System.out.println(">>>>> TCP connection established"); + DataInputStream in = new DataInputStream(socket.getInputStream()); + DataOutputStream out = new DataOutputStream(socket.getOutputStream()); + byte[] token = new byte[in.readInt()]; + in.readFully(token); + q.put(new Job(processMessage(token), socket, out)); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + }; + thread.setDaemon(asDaemon); + thread.start(); + + // The dispatcher + thread = new Thread() { + public void run() { + while (true) { + try { + q.take().send(); + } catch (Exception e) { + } + } + } + }; + thread.setDaemon(true); + thread.start(); + } + + /** + * Helper class to encapsulate a job in a KDC. + */ + private static class Job { + byte[] token; // The received request at creation time and + // the response at send time + Socket s; // The TCP socket from where the request comes + DataOutputStream out; // The OutputStream of the TCP socket + DatagramSocket s2; // The UDP socket from where the request comes + DatagramPacket dp; // The incoming UDP datagram packet + boolean useTCP; // Whether TCP or UDP is used + + // Creates a job object for TCP + Job(byte[] token, Socket s, DataOutputStream out) { + useTCP = true; + this.token = token; + this.s = s; + this.out = out; + } + + // Creates a job object for UDP + Job(byte[] token, DatagramSocket s2, DatagramPacket dp) { + useTCP = false; + this.token = token; + this.s2 = s2; + this.dp = dp; + } + + // Sends the output back to the client + void send() { + try { + if (useTCP) { + System.out.println(">>>>> TCP request honored"); + out.writeInt(token.length); + out.write(token); + s.close(); + } else { + System.out.println(">>>>> UDP request honored"); + s2.send(new DatagramPacket(token, token.length, dp.getAddress(), dp.getPort())); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + } +} diff --git a/jdk/test/sun/security/krb5/auto/KerberosHashEqualsTest.java b/jdk/test/sun/security/krb5/auto/KerberosHashEqualsTest.java new file mode 100644 index 00000000000..9e5b5839309 --- /dev/null +++ b/jdk/test/sun/security/krb5/auto/KerberosHashEqualsTest.java @@ -0,0 +1,173 @@ +/* + * Copyright 2005-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. + * + * 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 4641821 + * @summary hashCode() and equals() for KerberosKey and KerberosTicket + */ + +import java.net.InetAddress; +import java.util.Date; +import javax.security.auth.kerberos.KerberosKey; +import javax.security.auth.kerberos.KerberosPrincipal; +import javax.security.auth.kerberos.KerberosTicket; + +public class KerberosHashEqualsTest { + public static void main(String[] args) throws Exception { + new OneKDC(null); + new KerberosHashEqualsTest().check(); + } + + void checkSame(Object o1, Object o2) { + if(!o1.equals(o2)) { + throw new RuntimeException("equals() fails"); + } + if(o1.hashCode() != o2.hashCode()) { + throw new RuntimeException("hashCode() not same"); + } + } + + void checkNotSame(Object o1, Object o2) { + if(o1.equals(o2)) { + throw new RuntimeException("equals() succeeds"); + } + } + + void check() throws Exception { + + // The key part: + // new KerberosKey(principal, bytes, keyType, version) + + KerberosKey k1, k2; + KerberosPrincipal CLIENT = new KerberosPrincipal("client"); + KerberosPrincipal SERVER = new KerberosPrincipal("server"); + byte[] PASS = "pass".getBytes(); + + k1 = new KerberosKey(CLIENT, PASS, 1, 1); + k2 = new KerberosKey(CLIENT, PASS, 1, 1); + checkSame(k1, k1); // me is me + checkSame(k1, k2); // same + + // A destroyed key doesn't equal to any key + k2.destroy(); + checkNotSame(k1, k2); + checkNotSame(k2, k1); + k1.destroy(); + checkNotSame(k1, k2); // even if they are both destroyed + checkNotSame(k2, k1); + checkSame(k2, k2); + + // a little difference means not equal + k1 = new KerberosKey(CLIENT, PASS, 1, 1); + k2 = new KerberosKey(SERVER, PASS, 1, 1); + checkNotSame(k1, k2); // Different principal name + + k2 = new KerberosKey(CLIENT, "ssap".getBytes(), 1, 1); + checkNotSame(k1, k2); // Different password + + k2 = new KerberosKey(CLIENT, PASS, 2, 1); + checkNotSame(k1, k2); // Different keytype + + k2 = new KerberosKey(CLIENT, PASS, 1, 2); + checkNotSame(k1, k2); // Different version + + k2 = new KerberosKey(null, PASS, 1, 2); + checkNotSame(k1, k2); // null is not non-null + + k1 = new KerberosKey(null, PASS, 1, 2); + checkSame(k1, k2); // null is null + + checkNotSame(k1, "Another Object"); + + // The ticket part: + // new KerberosTicket(asn1 bytes, client, server, session key, type, flags, + // auth, start, end, renewUntil times, address) + + KerberosTicket t1, t2; + + byte[] ASN1 = "asn1".getBytes(); + boolean[] FORWARDABLE = new boolean[] {true, true}; + boolean[] ALLTRUE = new boolean[] {true, true, true, true, true, true, true, true, true, true}; + Date D0 = new Date(0); + + t1 = new KerberosTicket(ASN1, CLIENT, SERVER, PASS, 1, FORWARDABLE, D0, D0, D0, D0, null); + t2 = new KerberosTicket(ASN1, CLIENT, SERVER, PASS, 1, FORWARDABLE, D0, D0, D0, D0, null); + checkSame(t1, t1); + checkSame(t1, t2); + + // destroyed tickets doesn't equal to each other + t1.destroy(); + checkNotSame(t1, t2); + checkNotSame(t2, t1); + + t2.destroy(); + checkNotSame(t1, t2); // even if they are both destroyed + checkNotSame(t2, t1); + + checkSame(t2, t2); // unless they are the same object + + // a little difference means not equal + t1 = new KerberosTicket(ASN1, CLIENT, SERVER, PASS, 1, FORWARDABLE, D0, D0, D0, D0, null); + t2 = new KerberosTicket("asn11".getBytes(), CLIENT, SERVER, PASS, 1, FORWARDABLE, D0, D0, D0, D0, null); + checkNotSame(t1, t2); // Different ASN1 encoding + + t2 = new KerberosTicket(ASN1, new KerberosPrincipal("client1"), SERVER, PASS, 1, FORWARDABLE, D0, D0, D0, D0, null); + checkNotSame(t1, t2); // Different client + + t2 = new KerberosTicket(ASN1, CLIENT, new KerberosPrincipal("server1"), PASS, 1, FORWARDABLE, D0, D0, D0, D0, null); + checkNotSame(t1, t2); // Different server + + t2 = new KerberosTicket(ASN1, CLIENT, SERVER, "pass1".getBytes(), 1, FORWARDABLE, D0, D0, D0, D0, null); + checkNotSame(t1, t2); // Different session key + + t2 = new KerberosTicket(ASN1, CLIENT, SERVER, PASS, 2, FORWARDABLE, D0, D0, D0, D0, null); + checkNotSame(t1, t2); // Different key type + + t2 = new KerberosTicket(ASN1, CLIENT, SERVER, PASS, 1, new boolean[] {true, false}, D0, D0, D0, D0, null); + checkNotSame(t1, t2); // Different flags, not FORWARDABLE + + t2 = new KerberosTicket(ASN1, CLIENT, SERVER, PASS, 1, FORWARDABLE, new Date(1), D0, D0, D0, null); + checkNotSame(t1, t2); // Different authtime + + t2 = new KerberosTicket(ASN1, CLIENT, SERVER, PASS, 1, FORWARDABLE, D0, new Date(1), D0, D0, null); + checkNotSame(t1, t2); // Different starttime + + t2 = new KerberosTicket(ASN1, CLIENT, SERVER, PASS, 1, FORWARDABLE, D0, D0, new Date(1), D0, null); + checkNotSame(t1, t2); // Different endtime + + t2 = new KerberosTicket(ASN1, CLIENT, SERVER, PASS, 1, FORWARDABLE, D0, D0, D0, D0, new InetAddress[2]); + checkNotSame(t1, t2); // Different client addresses + + t2 = new KerberosTicket(ASN1, CLIENT, SERVER, PASS, 1, FORWARDABLE, D0, D0, D0, new Date(1), null); + t1 = new KerberosTicket(ASN1, CLIENT, SERVER, PASS, 1, FORWARDABLE, D0, D0, D0, new Date(2), null); + checkSame(t1, t2); // renewtill is ignored when RENEWABLE ticket flag is not set. + + t2 = new KerberosTicket(ASN1, CLIENT, SERVER, PASS, 1, ALLTRUE, D0, D0, D0, new Date(1), null); + t1 = new KerberosTicket(ASN1, CLIENT, SERVER, PASS, 1, ALLTRUE, D0, D0, D0, new Date(2), null); + checkNotSame(t1, t2); // renewtill is used when RENEWABLE is set. + + checkNotSame(t1, "Another Object"); + System.out.println("Good!"); + } +} diff --git a/jdk/test/sun/security/krb5/auto/OneKDC.java b/jdk/test/sun/security/krb5/auto/OneKDC.java new file mode 100644 index 00000000000..22e8a4ec10b --- /dev/null +++ b/jdk/test/sun/security/krb5/auto/OneKDC.java @@ -0,0 +1,140 @@ +/* + * 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. + * + * 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. + */ + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.security.Security; +import javax.security.auth.callback.Callback; +import javax.security.auth.callback.CallbackHandler; +import javax.security.auth.callback.NameCallback; +import javax.security.auth.callback.PasswordCallback; +import sun.security.krb5.Config; + +/** + * This class starts a simple KDC with one realm, several typical principal + * names, generates delete-on-exit krb5.conf and keytab files, and setup + * system properties for them. There's also a helper method to generate a + * JAAS login config file that can be used for JAAS or JGSS apps. + *

+ * Just call this line to start everything: + *

+ * new OneKDC(null).writeJaasConf();
+ * 
+ */ +public class OneKDC extends KDC { + + public static final String USER = "dummy"; + public static final char[] PASS = "bogus".toCharArray(); + public static final String SERVER = "server/localhost"; + public static final String BACKEND = "backend/localhost"; + public static final String KRB5_CONF = "localkdc-krb5.conf"; + public static final String KTAB = "localkdc.ktab"; + public static final String JAAS_CONF = "localkdc-jaas.conf"; + public static final String REALM = "RABBIT.HOLE"; + + /** + * Creates the KDC and starts it. + * @param etype Encryption type, null if not specified + * @throws java.lang.Exception if there's anything wrong + */ + public OneKDC(String etype) throws Exception { + super(REALM, 0, true); + addPrincipal(USER, PASS); + addPrincipalRandKey("krbtgt/" + REALM); + addPrincipalRandKey(SERVER); + addPrincipalRandKey(BACKEND); + KDC.saveConfig(KRB5_CONF, this, + "forwardable = true", + "default_keytab_name = " + KTAB, + etype == null ? "" : "default_tkt_enctypes=" + etype + "\ndefault_tgs_enctypes=" + etype); + System.setProperty("java.security.krb5.conf", KRB5_CONF); + // Whatever krb5.conf had been loaded before, we reload ours now. + Config.refresh(); + + writeKtab(KTAB); + new File(KRB5_CONF).deleteOnExit(); + new File(KTAB).deleteOnExit(); + } + + /** + * Writes a JAAS login config file, which contains as many as useful + * entries, including JGSS style initiator/acceptor and normal JAAS + * entries with names using existing OneKDC principals. + * @throws java.lang.Exception if anything goes wrong + */ + public void writeJAASConf() throws IOException { + System.setProperty("java.security.auth.login.config", JAAS_CONF); + File f = new File(JAAS_CONF); + FileOutputStream fos = new FileOutputStream(f); + fos.write(( + "com.sun.security.jgss.krb5.initiate {\n" + + " com.sun.security.auth.module.Krb5LoginModule required;\n};\n" + + "com.sun.security.jgss.krb5.accept {\n" + + " com.sun.security.auth.module.Krb5LoginModule required\n" + + " principal=\"" + SERVER + "\"\n" + + " useKeyTab=true\n" + + " isInitiator=false\n" + + " storeKey=true;\n};\n" + + "client {\n" + + " com.sun.security.auth.module.Krb5LoginModule required;\n};\n" + + "server {\n" + + " com.sun.security.auth.module.Krb5LoginModule required\n" + + " principal=\"" + SERVER + "\"\n" + + " useKeyTab=true\n" + + " storeKey=true;\n};\n" + + "backend {\n" + + " com.sun.security.auth.module.Krb5LoginModule required\n" + + " principal=\"" + BACKEND + "\"\n" + + " useKeyTab=true\n" + + " storeKey=true\n" + + " isInitiator=false;\n};\n" + ).getBytes()); + fos.close(); + f.deleteOnExit(); + Security.setProperty("auth.login.defaultCallbackHandler", "OneKDC$CallbackForClient"); + } + + /** + * The default callback handler for JAAS login. Note that this handler is + * hard coded to provide only info for USER1. If you need to provide info + * for another principal, please use Context.fromUserPass() instead. + */ + public static class CallbackForClient implements CallbackHandler { + public void handle(Callback[] callbacks) { + String user = OneKDC.USER; + char[] pass = OneKDC.PASS; + for (Callback callback : callbacks) { + if (callback instanceof NameCallback) { + System.out.println("Callback for name: " + user); + ((NameCallback) callback).setName(user); + } + if (callback instanceof PasswordCallback) { + System.out.println("Callback for pass: " + + new String(pass)); + ((PasswordCallback) callback).setPassword(pass); + } + } + } + } +} diff --git a/jdk/test/sun/security/krb5/auto/basic.sh b/jdk/test/sun/security/krb5/auto/basic.sh new file mode 100644 index 00000000000..388e4a1ea55 --- /dev/null +++ b/jdk/test/sun/security/krb5/auto/basic.sh @@ -0,0 +1,65 @@ +# +# 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. +# +# 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 6706974 +# @summary Add krb5 test infrastructure +# @run shell/timeout=300 basic.sh +# + +if [ "${TESTSRC}" = "" ] ; then + TESTSRC="." +fi +if [ "${TESTJAVA}" = "" ] ; then + echo "TESTJAVA not set. Test cannot execute." + echo "FAILED!!!" + exit 1 +fi + +# set platform-dependent variables +OS=`uname -s` +case "$OS" in + Windows_* ) + FS="\\" + ;; + * ) + FS="/" + ;; +esac + +${TESTJAVA}${FS}bin${FS}javac -d . \ + ${TESTSRC}${FS}BasicKrb5Test.java \ + ${TESTSRC}${FS}KDC.java \ + ${TESTSRC}${FS}OneKDC.java \ + ${TESTSRC}${FS}Action.java \ + ${TESTSRC}${FS}Context.java \ + || exit 10 +${TESTJAVA}${FS}bin${FS}java -Dtest.src=$TESTSRC BasicKrb5Test || exit 100 +${TESTJAVA}${FS}bin${FS}java -Dtest.src=$TESTSRC BasicKrb5Test des-cbc-crc || exit 1 +${TESTJAVA}${FS}bin${FS}java -Dtest.src=$TESTSRC BasicKrb5Test des-cbc-md5 || exit 3 +${TESTJAVA}${FS}bin${FS}java -Dtest.src=$TESTSRC BasicKrb5Test des3-cbc-sha1 || exit 16 +${TESTJAVA}${FS}bin${FS}java -Dtest.src=$TESTSRC BasicKrb5Test aes128-cts || exit 17 +${TESTJAVA}${FS}bin${FS}java -Dtest.src=$TESTSRC BasicKrb5Test aes256-cts || exit 18 +${TESTJAVA}${FS}bin${FS}java -Dtest.src=$TESTSRC BasicKrb5Test rc4-hmac || exit 23 + +exit 0 From 8175eb6c0e680dc51ae7a1693c2c9bfffca989d5 Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Fri, 17 Oct 2008 10:34:06 -0700 Subject: [PATCH 063/267] 6760805: empty element on bootclasspath breaks test/tools/apt/Compile/compile.sh Reviewed-by: darcy --- langtools/test/tools/apt/Compile/compile.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/langtools/test/tools/apt/Compile/compile.sh b/langtools/test/tools/apt/Compile/compile.sh index 97273a9713d..aa378df1bcd 100644 --- a/langtools/test/tools/apt/Compile/compile.sh +++ b/langtools/test/tools/apt/Compile/compile.sh @@ -473,6 +473,9 @@ ${JAR} cf0 round4Apf.jar Round4Apf*.class META-INF cp ${TESTCLASSES}/Round?.class . ${JAR} cf0 rounds.jar Round?.class +# cleanup file to prevent accidental discovery in current directory +rm -Rf META-INF/services/* + printf "%s\n" "-factorypath round1Apf.jar${SEP}round2Apf.jar${SEP}round3Apf.jar${SEP}round4Apf.jar" > options8 printf "%s\n" "-classpath rounds.jar" >> options8 printf "%s\n" "-s ./src" >> options8 From fac7f6fd8a22b154dcc327bfc844b4a9d69e4cbb Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Fri, 17 Oct 2008 16:06:32 -0700 Subject: [PATCH 064/267] 6760930: empty element on bootclasspath breaks test/tools/apt/Discovery/discovery.sh Reviewed-by: darcy --- langtools/test/tools/apt/Discovery/discovery.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/langtools/test/tools/apt/Discovery/discovery.sh b/langtools/test/tools/apt/Discovery/discovery.sh index fbec6d62f30..73d4087b74a 100644 --- a/langtools/test/tools/apt/Discovery/discovery.sh +++ b/langtools/test/tools/apt/Discovery/discovery.sh @@ -109,7 +109,8 @@ cp ${TESTSRC}/servicesPhantomTouch ./META-INF/services/com.sun.mirror.apt.Annota ${JAR} cf0 phantom/phantom.jar PhantomTouch*.class META-INF - +# cleanup file to prevent accidental discovery in current directory +rm -f META-INF/services/com.sun.mirror.apt.AnnotationProcessorFactory # Jar files created; verify right output file is touched From d9d3a811682579dd8fb2e87a6865b9cd9d53c0e6 Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Mon, 20 Oct 2008 10:32:33 +0800 Subject: [PATCH 065/267] 6761072: new krb5 tests fail on multiple platforms Reviewed-by: xuelei --- .../sun/security/krb5/auto/BasicKrb5Test.java | 7 +++++-- jdk/test/sun/security/krb5/auto/KDC.java | 11 +++++++++-- jdk/test/sun/security/krb5/auto/OneKDC.java | 19 +++++++++++++++++-- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/jdk/test/sun/security/krb5/auto/BasicKrb5Test.java b/jdk/test/sun/security/krb5/auto/BasicKrb5Test.java index 2099e27ffd1..26d52e0787c 100644 --- a/jdk/test/sun/security/krb5/auto/BasicKrb5Test.java +++ b/jdk/test/sun/security/krb5/auto/BasicKrb5Test.java @@ -49,14 +49,17 @@ public class BasicKrb5Test { if (args.length > 0) { etype = args[0]; } + + // Creates and starts the KDC. This line must be put ahead of etype check + // since the check needs a krb5.conf. + new OneKDC(etype).writeJAASConf(); + System.out.println("Testing etype " + etype); if (etype != null && !EType.isSupported(Config.getInstance().getType(etype))) { System.out.println("Not supported."); System.exit(0); } - // Creates and starts the KDC - new OneKDC(etype).writeJAASConf(); new BasicKrb5Test().go(OneKDC.SERVER, OneKDC.BACKEND); } diff --git a/jdk/test/sun/security/krb5/auto/KDC.java b/jdk/test/sun/security/krb5/auto/KDC.java index 03375950ba4..a875e090bb5 100644 --- a/jdk/test/sun/security/krb5/auto/KDC.java +++ b/jdk/test/sun/security/krb5/auto/KDC.java @@ -152,12 +152,19 @@ public class KDC { return; } } + String localhost = "localhost"; + try { + localhost = InetAddress.getByName(localhost) + .getCanonicalHostName(); + } catch (UnknownHostException uhe) { + ; // Ignore, localhost is still "localhost" + } KDC kdc = create("RABBIT.HOLE", 8888, false); kdc.addPrincipal("dummy", "bogus".toCharArray()); kdc.addPrincipal("foo", "bar".toCharArray()); kdc.addPrincipalRandKey("krbtgt/" + kdc.realm); - kdc.addPrincipalRandKey("server/localhost"); - kdc.addPrincipalRandKey("backend/localhost"); + kdc.addPrincipalRandKey("server/" + localhost); + kdc.addPrincipalRandKey("backend/" + localhost); } /** diff --git a/jdk/test/sun/security/krb5/auto/OneKDC.java b/jdk/test/sun/security/krb5/auto/OneKDC.java index 22e8a4ec10b..9505c6a3c8f 100644 --- a/jdk/test/sun/security/krb5/auto/OneKDC.java +++ b/jdk/test/sun/security/krb5/auto/OneKDC.java @@ -24,6 +24,8 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; +import java.net.InetAddress; +import java.net.UnknownHostException; import java.security.Security; import javax.security.auth.callback.Callback; import javax.security.auth.callback.CallbackHandler; @@ -44,10 +46,23 @@ import sun.security.krb5.Config; */ public class OneKDC extends KDC { + // The krb5 codes would try to canonicalize hostnames before creating + // a service principal name, so let's find out the canonicalized form + // of localhost first. The following codes mimic the process inside + // PrincipalName.java. + static String localhost = "localhost"; + static { + try { + localhost = InetAddress.getByName(localhost) + .getCanonicalHostName(); + } catch (UnknownHostException uhe) { + ; // Ignore, localhost is still "localhost" + } + } public static final String USER = "dummy"; public static final char[] PASS = "bogus".toCharArray(); - public static final String SERVER = "server/localhost"; - public static final String BACKEND = "backend/localhost"; + public static String SERVER = "server/" + localhost; + public static String BACKEND = "backend/" + localhost; public static final String KRB5_CONF = "localkdc-krb5.conf"; public static final String KTAB = "localkdc.ktab"; public static final String JAAS_CONF = "localkdc-jaas.conf"; From 7d2872604dd438e88bd9760119ac7c7bcb3d559c Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Mon, 20 Oct 2008 13:42:45 -0700 Subject: [PATCH 066/267] 6759996: ignore empty entries on paths Reviewed-by: darcy --- .../com/sun/tools/javac/file/Paths.java | 92 +++++++++---------- langtools/test/tools/javac/T6759996.java | 79 ++++++++++++++++ 2 files changed, 122 insertions(+), 49 deletions(-) create mode 100644 langtools/test/tools/javac/T6759996.java diff --git a/langtools/src/share/classes/com/sun/tools/javac/file/Paths.java b/langtools/src/share/classes/com/sun/tools/javac/file/Paths.java index f0f7e8628e8..c4dc9bb2301 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/file/Paths.java +++ b/langtools/src/share/classes/com/sun/tools/javac/file/Paths.java @@ -34,12 +34,12 @@ import java.util.Set; import java.util.Collection; import java.util.Collections; import java.util.LinkedHashSet; -import java.util.Iterator; import java.util.zip.ZipFile; import javax.tools.JavaFileManager.Location; import com.sun.tools.javac.code.Lint; import com.sun.tools.javac.util.Context; +import com.sun.tools.javac.util.ListBuffer; import com.sun.tools.javac.util.Log; import com.sun.tools.javac.util.Options; @@ -174,38 +174,38 @@ public class Paths { return file.equals(bootClassPathRtJar); } - private static class PathIterator implements Iterable { - private int pos = 0; - private final String path; - private final String emptyPathDefault; + /** + * Split a path into its elements. Empty path elements will be ignored. + * @param path The path to be split + * @return The elements of the path + */ + private static Iterable getPathEntries(String path) { + return getPathEntries(path, null); + } - public PathIterator(String path, String emptyPathDefault) { - this.path = path; - this.emptyPathDefault = emptyPathDefault; - } - public PathIterator(String path) { this(path, null); } - public Iterator iterator() { - return new Iterator() { - public boolean hasNext() { - return pos <= path.length(); - } - public String next() { - int beg = pos; - int end = path.indexOf(File.pathSeparator, beg); - if (end == -1) - end = path.length(); - pos = end + 1; - - if (beg == end && emptyPathDefault != null) - return emptyPathDefault; - else - return path.substring(beg, end); - } - public void remove() { - throw new UnsupportedOperationException(); - } - }; + /** + * Split a path into its elements. If emptyPathDefault is not null, all + * empty elements in the path, including empty elements at either end of + * the path, will be replaced with the value of emptyPathDefault. + * @param path The path to be split + * @param emptyPathDefault The value to substitute for empty path elements, + * or null, to ignore empty path elements + * @return The elements of the path + */ + private static Iterable getPathEntries(String path, File emptyPathDefault) { + ListBuffer entries = new ListBuffer(); + int start = 0; + while (start <= path.length()) { + int sep = path.indexOf(File.pathSeparatorChar, start); + if (sep == -1) + sep = path.length(); + if (start < sep) + entries.add(new File(path.substring(start, sep))); + else if (emptyPathDefault != null) + entries.add(emptyPathDefault); + start = sep + 1; } + return entries; } private class Path extends LinkedHashSet { @@ -220,9 +220,9 @@ public class Paths { } /** What to use when path element is the empty string */ - private String emptyPathDefault = null; + private File emptyPathDefault = null; - public Path emptyPathDefault(String x) { + public Path emptyPathDefault(File x) { emptyPathDefault = x; return this; } @@ -231,7 +231,7 @@ public class Paths { public Path addDirectories(String dirs, boolean warn) { if (dirs != null) - for (String dir : new PathIterator(dirs)) + for (File dir : getPathEntries(dirs)) addDirectory(dir, warn); return this; } @@ -240,14 +240,14 @@ public class Paths { return addDirectories(dirs, warn); } - private void addDirectory(String dir, boolean warn) { - if (! new File(dir).isDirectory()) { + private void addDirectory(File dir, boolean warn) { + if (!dir.isDirectory()) { if (warn) log.warning("dir.path.element.not.found", dir); return; } - File[] files = new File(dir).listFiles(); + File[] files = dir.listFiles(); if (files == null) return; @@ -259,7 +259,7 @@ public class Paths { public Path addFiles(String files, boolean warn) { if (files != null) - for (String file : new PathIterator(files, emptyPathDefault)) + for (File file : getPathEntries(files, emptyPathDefault)) addFile(file, warn); return this; } @@ -268,11 +268,6 @@ public class Paths { return addFiles(files, warn); } - public Path addFile(String file, boolean warn) { - addFile(new File(file), warn); - return this; - } - public void addFile(File file, boolean warn) { File canonFile = fsInfo.getCanonicalFile(file); if (contains(file) || canonicalValues.contains(canonFile)) { @@ -346,10 +341,9 @@ public class Paths { String files = System.getProperty("sun.boot.class.path"); path.addFiles(files, false); File rt_jar = new File("rt.jar"); - for (String file : new PathIterator(files, null)) { - File f = new File(file); - if (new File(f.getName()).equals(rt_jar)) - bootClassPathRtJar = f; + for (File file : getPathEntries(files)) { + if (new File(file.getName()).equals(rt_jar)) + bootClassPathRtJar = file; } } @@ -381,8 +375,8 @@ public class Paths { if (cp == null) cp = "."; return new Path() - .expandJarClassPaths(true) // Only search user jars for Class-Paths - .emptyPathDefault(".") // Empty path elt ==> current directory + .expandJarClassPaths(true) // Only search user jars for Class-Paths + .emptyPathDefault(new File(".")) // Empty path elt ==> current directory .addFiles(cp); } diff --git a/langtools/test/tools/javac/T6759996.java b/langtools/test/tools/javac/T6759996.java new file mode 100644 index 00000000000..7a9b00288bb --- /dev/null +++ b/langtools/test/tools/javac/T6759996.java @@ -0,0 +1,79 @@ +/* + * 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. + * + * 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 6759996 + * @summary javac should ignore empty entries on paths + */ + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.io.Writer; + +public class T6759996 { + public static void main(String[] args) throws Exception { + new T6759996().run(); + } + + void run() throws IOException, InterruptedException { + String PS = File.pathSeparator; + write(new File("A.java"), "class A { }"); + write(new File("B.java"), "class B extends A { }"); + // In the following line, the presence of the empty element + // should not mask the presence of the "." element on the path + javac("-verbose", "-sourcepath", "" + PS + ".", "B.java"); + } + + void javac(String... args) throws IOException, InterruptedException { + StringWriter sw = new StringWriter(); + PrintWriter out = new PrintWriter(sw); + int rc = com.sun.tools.javac.Main.compile(args, out); + System.out.println(sw.toString()); + if (rc != 0) + throw new Error("javac failed: rc=" + rc); + + } + + void write(File to, String body) throws IOException { + System.err.println("write " + to); + File toDir = to.getParentFile(); + if (toDir != null) { + boolean ok = toDir.mkdirs(); + if (!ok) { + throw new Error("could not create directory " + toDir); + } + } + Writer out = new FileWriter(to); + try { + out.write(body); + if (!body.endsWith("\n")) + out.write("\n"); + } finally { + out.close(); + } + } +} From f3a403d0d4ff609c9f294d41ee13eb871fed9e91 Mon Sep 17 00:00:00 2001 From: Tom Rodriguez Date: Tue, 21 Oct 2008 11:23:52 -0700 Subject: [PATCH 067/267] 6762004: 6532536 fix contains changes in os_solaris.cpp which were pushed by mistake Reviewed-by: kvn --- hotspot/src/os/solaris/vm/os_solaris.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hotspot/src/os/solaris/vm/os_solaris.cpp b/hotspot/src/os/solaris/vm/os_solaris.cpp index 74b270d3d98..c4386d85988 100644 --- a/hotspot/src/os/solaris/vm/os_solaris.cpp +++ b/hotspot/src/os/solaris/vm/os_solaris.cpp @@ -3756,7 +3756,7 @@ int set_lwp_priority (int ThreadID, int lwpid, int newPrio ) int maxClamped = MIN2(iaLimits.maxPrio, (int)iaInfo->ia_uprilim); iaInfo->ia_upri = scale_to_lwp_priority(iaLimits.minPrio, maxClamped, newPrio); iaInfo->ia_uprilim = IA_NOCHANGE; -// iaInfo->ia_nice = IA_NOCHANGE; + iaInfo->ia_nice = IA_NOCHANGE; iaInfo->ia_mode = IA_NOCHANGE; if (ThreadPriorityVerbose) { tty->print_cr ("IA: [%d...%d] %d->%d\n", From 347534f43bdd2ef5492378cbb0c72009182faa50 Mon Sep 17 00:00:00 2001 From: Karen Kinnear Date: Wed, 22 Oct 2008 14:48:08 -0400 Subject: [PATCH 068/267] 6761092: jvm crashes when CDS is enabled CDS hardcoded max c++ virtual method table increased Reviewed-by: coleenp, xlu, jmasa --- .../share/vm/memory/compactingPermGenGen.hpp | 2 +- hotspot/src/share/vm/memory/dump.cpp | 34 +++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/hotspot/src/share/vm/memory/compactingPermGenGen.hpp b/hotspot/src/share/vm/memory/compactingPermGenGen.hpp index 3a12a8848de..fd5265110e1 100644 --- a/hotspot/src/share/vm/memory/compactingPermGenGen.hpp +++ b/hotspot/src/share/vm/memory/compactingPermGenGen.hpp @@ -100,7 +100,7 @@ public: enum { vtbl_list_size = 16, // number of entries in the shared space vtable list. - num_virtuals = 100 // number of virtual methods in Klass (or + num_virtuals = 200 // number of virtual methods in Klass (or // subclass) objects, or greater. }; diff --git a/hotspot/src/share/vm/memory/dump.cpp b/hotspot/src/share/vm/memory/dump.cpp index cfe22633d15..cce5036d0b9 100644 --- a/hotspot/src/share/vm/memory/dump.cpp +++ b/hotspot/src/share/vm/memory/dump.cpp @@ -818,6 +818,40 @@ static void print_contents() { // across the space while doing this, as that causes the vtables to be // patched, undoing our useful work. Instead, iterate to make a list, // then use the list to do the fixing. +// +// Our constructed vtables: +// Dump time: +// 1. init_self_patching_vtbl_list: table of pointers to current virtual method addrs +// 2. generate_vtable_methods: create jump table, appended to above vtbl_list +// 3. PatchKlassVtables: for Klass list, patch the vtable entry to point to jump table +// rather than to current vtbl +// Table layout: NOTE FIXED SIZE +// 1. vtbl pointers +// 2. #Klass X #virtual methods per Klass +// 1 entry for each, in the order: +// Klass1:method1 entry, Klass1:method2 entry, ... Klass1:method entry +// Klass2:method1 entry, Klass2:method2 entry, ... Klass2:method entry +// ... +// Klass:method1 entry, Klass:method2 entry, +// ... Klass:method entry +// Sample entry: (Sparc): +// save(sp, -256, sp) +// ba,pt common_code +// mov XXX, %L0 %L0 gets: Klass index <<8 + method index (note: max method index 255) +// +// Restore time: +// 1. initialize_oops: reserve space for table +// 2. init_self_patching_vtbl_list: update pointers to NEW virtual method addrs in text +// +// Execution time: +// First virtual method call for any object of these Klass types: +// 1. object->klass->klass_part +// 2. vtable entry for that klass_part points to the jump table entries +// 3. branches to common_code with %O0/klass_part, %L0: Klass index <<8 + method index +// 4. common_code: +// Get address of new vtbl pointer for this Klass from updated table +// Update new vtbl pointer in the Klass: future virtual calls go direct +// Jump to method, using new vtbl pointer and method index class PatchKlassVtables: public ObjectClosure { private: From be7b82ffe4883dfddf9843815b7c196f86031083 Mon Sep 17 00:00:00 2001 From: Maurizio Cimadamore Date: Thu, 23 Oct 2008 17:59:16 +0100 Subject: [PATCH 069/267] 6732484: Bound error on wildcard code Check.checkExtends should cope with captured type-variables Reviewed-by: jjg --- .../com/sun/tools/javac/code/Type.java | 15 --- .../com/sun/tools/javac/comp/Check.java | 102 +++++++++--------- .../javac/generics/wildcards/T6732484.java | 37 +++++++ 3 files changed, 90 insertions(+), 64 deletions(-) create mode 100644 langtools/test/tools/javac/generics/wildcards/T6732484.java diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Type.java b/langtools/src/share/classes/com/sun/tools/javac/code/Type.java index b2a3dae9dee..891a346f645 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/code/Type.java +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Type.java @@ -360,17 +360,6 @@ public class Type implements PrimitiveType { public boolean isUnbound() { return false; } public Type withTypeVar(Type t) { return this; } - public static List removeBounds(List ts) { - ListBuffer result = new ListBuffer(); - for(;ts.nonEmpty(); ts = ts.tail) { - result.append(ts.head.removeBounds()); - } - return result.toList(); - } - public Type removeBounds() { - return this; - } - /** The underlying method type of this type. */ public MethodType asMethodType() { throw new AssertionError(); } @@ -489,10 +478,6 @@ public class Type implements PrimitiveType { return new WildcardType(t, kind, tsym, bound); } - public Type removeBounds() { - return isUnbound() ? this : type; - } - public Type getExtendsBound() { if (kind == EXTENDS) return type; diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java index d901d867fc5..a0d5cf320ca 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java @@ -424,43 +424,43 @@ public class Check { * @param bs The bound. */ private void checkExtends(DiagnosticPosition pos, Type a, TypeVar bs) { - if (a.tag == TYPEVAR && ((TypeVar)a).isCaptured()) { - CapturedType ct = (CapturedType)a; - boolean ok; - if (ct.bound.isErroneous()) {//capture doesn't exist - ok = false; + if (a.isUnbound()) { + return; + } else if (a.tag != WILDCARD) { + a = types.upperBound(a); + for (List l = types.getBounds(bs); l.nonEmpty(); l = l.tail) { + if (!types.isSubtype(a, l.head)) { + log.error(pos, "not.within.bounds", a); + return; + } + } + } else if (a.isExtendsBound()) { + if (!types.isCastable(bs.getUpperBound(), types.upperBound(a), Warner.noWarnings)) + log.error(pos, "not.within.bounds", a); + } else if (a.isSuperBound()) { + if (types.notSoftSubtype(types.lowerBound(a), bs.getUpperBound())) + log.error(pos, "not.within.bounds", a); + } + } + + /** Check that a type is within some bounds. + * + * Used in TypeApply to verify that, e.g., X in V is a valid + * type argument. + * @param pos Position to be used for error reporting. + * @param a The type that should be bounded by bs. + * @param bs The bound. + */ + private void checkCapture(JCTypeApply tree) { + List args = tree.getTypeArguments(); + for (Type arg : types.capture(tree.type).getTypeArguments()) { + if (arg.tag == TYPEVAR && arg.getUpperBound().isErroneous()) { + log.error(args.head.pos, "not.within.bounds", args.head.type); + break; } - else { - switch (ct.wildcard.kind) { - case EXTENDS: - ok = types.isCastable(bs.getUpperBound(), - types.upperBound(a), - Warner.noWarnings); - break; - case SUPER: - ok = !types.notSoftSubtype(types.lowerBound(a), - bs.getUpperBound()); - break; - case UNBOUND: - ok = true; - break; - default: - throw new AssertionError("Invalid bound kind"); - } - } - if (!ok) - log.error(pos, "not.within.bounds", a); + args = args.tail; } - else { - a = types.upperBound(a); - for (List l = types.getBounds(bs); l.nonEmpty(); l = l.tail) { - if (!types.isSubtype(a, l.head)) { - log.error(pos, "not.within.bounds", a); - return; - } - } - } - } + } /** Check that type is different from 'void'. * @param pos Position to be used for error reporting. @@ -803,7 +803,7 @@ public class Check { public void visitTypeApply(JCTypeApply tree) { if (tree.type.tag == CLASS) { List formals = tree.type.tsym.type.getTypeArguments(); - List actuals = types.capture(tree.type).getTypeArguments(); + List actuals = tree.type.getTypeArguments(); List args = tree.arguments; List forms = formals; ListBuffer tvars_buf = new ListBuffer(); @@ -826,24 +826,28 @@ public class Check { } args = tree.arguments; - List tvars = tvars_buf.toList(); - while (args.nonEmpty() && tvars.nonEmpty()) { + List tvars_cap = types.substBounds(formals, + formals, + types.capture(tree.type).getTypeArguments()); + while (args.nonEmpty() && tvars_cap.nonEmpty()) { // Let the actual arguments know their bound - args.head.type.withTypeVar(tvars.head); + args.head.type.withTypeVar((TypeVar)tvars_cap.head); + args = args.tail; + tvars_cap = tvars_cap.tail; + } + + args = tree.arguments; + List tvars = tvars_buf.toList(); + + while (args.nonEmpty() && tvars.nonEmpty()) { + checkExtends(args.head.pos(), + args.head.type, + tvars.head); args = args.tail; tvars = tvars.tail; } - args = tree.arguments; - tvars = tvars_buf.toList(); - while (args.nonEmpty() && tvars.nonEmpty()) { - checkExtends(args.head.pos(), - actuals.head, - tvars.head); - args = args.tail; - tvars = tvars.tail; - actuals = actuals.tail; - } + checkCapture(tree); // Check that this type is either fully parameterized, or // not parameterized at all. diff --git a/langtools/test/tools/javac/generics/wildcards/T6732484.java b/langtools/test/tools/javac/generics/wildcards/T6732484.java new file mode 100644 index 00000000000..42906e92944 --- /dev/null +++ b/langtools/test/tools/javac/generics/wildcards/T6732484.java @@ -0,0 +1,37 @@ +/* + * 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. + * + * 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 6732484 + * @summary Bound error on wildcard code + * @author Maurizio Cimadamore + * @compile T6732484.java + */ + +class T6732484 { + class A> {} + class B extends A {} + + A f; +} \ No newline at end of file From 90e6379916924685fdb17d0a68f4c66d8a695eaa Mon Sep 17 00:00:00 2001 From: Maurizio Cimadamore Date: Thu, 23 Oct 2008 17:59:43 +0100 Subject: [PATCH 070/267] 6711619: javac doesn't allow access to protected members in intersection types Accordingly to new accessibility rules all members of intersection types (but private ones) should be accessible Reviewed-by: jjg --- .../com/sun/tools/javac/code/Symbol.java | 6 +- .../com/sun/tools/javac/comp/Attr.java | 4 + .../com/sun/tools/javac/comp/Resolve.java | 1 - .../javac/generics/6531090/T6531090b.java | 51 +++++++++---- .../javac/generics/6711619/T6711619a.java | 74 +++++++++++++++++++ .../javac/generics/6711619/T6711619a.out | 7 ++ .../javac/generics/6711619/T6711619b.java | 64 ++++++++++++++++ .../javac/generics/6711619/T6711619b.out | 5 ++ 8 files changed, 197 insertions(+), 15 deletions(-) create mode 100644 langtools/test/tools/javac/generics/6711619/T6711619a.java create mode 100644 langtools/test/tools/javac/generics/6711619/T6711619a.out create mode 100644 langtools/test/tools/javac/generics/6711619/T6711619b.java create mode 100644 langtools/test/tools/javac/generics/6711619/T6711619b.out diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java b/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java index d8566136636..cd1a1962123 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java @@ -361,6 +361,8 @@ public abstract class Symbol implements Element { for (Symbol sup = clazz; sup != null && sup != this.owner; sup = types.supertype(sup.type).tsym) { + while (sup.type.tag == TYPEVAR) + sup = sup.type.getUpperBound().tsym; if (sup.type.isErroneous()) return true; // error recovery if ((sup.flags() & COMPOUND) != 0) @@ -1183,7 +1185,9 @@ public abstract class Symbol implements Element { * as possible implementations. */ public MethodSymbol implementation(TypeSymbol origin, Types types, boolean checkResult) { - for (Type t = origin.type; t.tag == CLASS; t = types.supertype(t)) { + for (Type t = origin.type; t.tag == CLASS || t.tag == TYPEVAR; t = types.supertype(t)) { + while (t.tag == TYPEVAR) + t = t.getUpperBound(); TypeSymbol c = t.tsym; for (Scope.Entry e = c.members().lookup(name); e.scope != null; diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java index c41c7e9850d..769653d6989 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java @@ -2007,6 +2007,10 @@ public class Attr extends JCTree.Visitor { log.error(pos, "type.var.cant.be.deref"); return syms.errSymbol; } else { + Symbol sym2 = (sym.flags() & Flags.PRIVATE) != 0 ? + rs.new AccessError(env, site, sym) : + sym; + rs.access(sym2, pos, site, name, true); return sym; } case ERROR: diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java index fa9d3613189..f95af3501a3 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java @@ -554,7 +554,6 @@ public class Resolve { boolean useVarargs, boolean operator) { if (sym.kind == ERR) return bestSoFar; - if (!sym.isInheritedIn(site.tsym, types)) return bestSoFar; assert sym.kind < AMBIGUOUS; try { if (rawInstantiate(env, site, sym, argtypes, typeargtypes, diff --git a/langtools/test/tools/javac/generics/6531090/T6531090b.java b/langtools/test/tools/javac/generics/6531090/T6531090b.java index ede819f32d6..07b18df2383 100644 --- a/langtools/test/tools/javac/generics/6531090/T6531090b.java +++ b/langtools/test/tools/javac/generics/6531090/T6531090b.java @@ -23,7 +23,7 @@ /* * @test - * @bug 6531090 + * @bug 6531090 6711619 * * @summary Cannot access methods/fields of a captured type belonging to an intersection type * @author Maurizio Cimadamore @@ -32,12 +32,20 @@ public class T6531090b { static class A { - public void a() {} - public A a; + public void a1() {} + protected void a2() {} + void a3() {} + public A a1; + protected A a2; + A a3; } static class B extends A { - public void b(){} - public B b; + public void b1() {} + protected void b2() {} + void b3() {} + public B b1; + protected B b2; + B b3; } static interface I{ void i(); @@ -65,18 +73,35 @@ public class T6531090b { } static void testMemberMethods(C arg) { - arg.t.a(); - arg.t.b(); + arg.t.a1(); + arg.t.a2(); + arg.t.a3(); + arg.t.b1(); + arg.t.b2(); + arg.t.b3(); arg.t.i1(); - arg.w.a(); - arg.w.b(); + arg.w.a1(); + arg.w.a2(); + arg.w.a3(); + arg.w.b1(); + arg.w.b2(); + arg.w.b3(); arg.w.i1(); } static void testMemberFields(C arg) { - A ta = arg.t.a; - B tb = arg.t.b; - A wa = arg.w.a; - B wb = arg.w.b; + A ta; B tb; + ta = arg.t.a1; + ta = arg.t.a2; + ta = arg.t.a3; + tb = arg.t.b1; + tb = arg.t.b2; + tb = arg.t.b3; + ta = arg.w.a1; + ta = arg.w.a2; + ta = arg.w.a3; + tb = arg.w.b1; + tb = arg.w.b2; + tb = arg.w.b3; } } diff --git a/langtools/test/tools/javac/generics/6711619/T6711619a.java b/langtools/test/tools/javac/generics/6711619/T6711619a.java new file mode 100644 index 00000000000..98749d10ceb --- /dev/null +++ b/langtools/test/tools/javac/generics/6711619/T6711619a.java @@ -0,0 +1,74 @@ +/* + * 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. + * + * 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 6711619 + * + * @summary javac doesn't allow access to protected members in intersection types + * @author Maurizio Cimadamore + * + * @compile/fail/ref=T6711619a.out -XDrawDiagnostics T6711619a.java + */ +class T6711619a { + + static class A { + private void a() {} + private A a; + } + static class B extends A { + private B b() {} + private B b; + } + static interface I{ + void i(); + } + static interface I1{ + void i1(); + } + static class E extends B implements I, I1{ + public void i() {} + public void i1() {} + } + static class C{ + T t; + W w; + C(W w, T t) { + this.w = w; + this.t = t; + } + } + + static void testMemberMethods(C arg) { + arg.t.a(); + arg.t.b(); + } + + static void testMemberFields(C arg) { + A ta; B tb; + ta = arg.t.a; + tb = arg.t.b; + ta = arg.w.a; + tb = arg.w.b; + } +} \ No newline at end of file diff --git a/langtools/test/tools/javac/generics/6711619/T6711619a.out b/langtools/test/tools/javac/generics/6711619/T6711619a.out new file mode 100644 index 00000000000..e35eed19137 --- /dev/null +++ b/langtools/test/tools/javac/generics/6711619/T6711619a.out @@ -0,0 +1,7 @@ +T6711619a.java:63:14: compiler.err.report.access: a(), private, T6711619a.A +T6711619a.java:64:14: compiler.err.report.access: b(), private, T6711619a.B +T6711619a.java:69:19: compiler.err.report.access: a, private, T6711619a.A +T6711619a.java:70:19: compiler.err.report.access: b, private, T6711619a.B +T6711619a.java:71:19: compiler.err.report.access: a, private, T6711619a.A +T6711619a.java:72:19: compiler.err.report.access: b, private, T6711619a.B +6 errors diff --git a/langtools/test/tools/javac/generics/6711619/T6711619b.java b/langtools/test/tools/javac/generics/6711619/T6711619b.java new file mode 100644 index 00000000000..16dd2ad1669 --- /dev/null +++ b/langtools/test/tools/javac/generics/6711619/T6711619b.java @@ -0,0 +1,64 @@ +/* + * 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. + * + * 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 6711619 + * + * @summary javac doesn't allow access to protected members in intersection types + * @author Maurizio Cimadamore + * + * @compile/fail/ref=T6711619b.out -XDrawDiagnostics T6711619b.java + */ + +class T6711619b { + static class X1> { + private int i; + E e; + int f() { + return e.i; + } + } + + static class X2> { + static private int i; + int f() { + return E.i; + } + } + + static class X3 & java.io.Serializable> { + private int i; + E e; + int f() { + return e.i; + } + } + + static class X4 & java.io.Serializable> { + static private int i; + int f() { + return E.i; + } + } +} \ No newline at end of file diff --git a/langtools/test/tools/javac/generics/6711619/T6711619b.out b/langtools/test/tools/javac/generics/6711619/T6711619b.out new file mode 100644 index 00000000000..f1b87f3b631 --- /dev/null +++ b/langtools/test/tools/javac/generics/6711619/T6711619b.out @@ -0,0 +1,5 @@ +T6711619b.java:39:22: compiler.err.report.access: i, private, T6711619b.X1 +T6711619b.java:46:22: compiler.err.report.access: i, private, T6711619b.X2 +T6711619b.java:54:22: compiler.err.report.access: i, private, T6711619b.X3 +T6711619b.java:61:22: compiler.err.report.access: i, private, T6711619b.X4 +4 errors From b2ffad71804f0641e5b56d46fdb86485d7861150 Mon Sep 17 00:00:00 2001 From: Maurizio Cimadamore Date: Thu, 23 Oct 2008 18:00:05 +0100 Subject: [PATCH 071/267] 6487370: javac incorrectly gives ambiguity warning with override-equivalent abstract inherited methods Javac should not compare erased return types when checking for ambiguity errors during overload resolution Reviewed-by: jjg --- .../com/sun/tools/javac/comp/Resolve.java | 5 +- .../javac/generics/6487370/T6487370.java | 56 +++++++++++++++++++ 2 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 langtools/test/tools/javac/generics/6487370/T6487370.java diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java index f95af3501a3..3fd493a398f 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java @@ -650,8 +650,9 @@ public class Resolve { // both abstract or both concrete if (!m1Abstract && !m2Abstract) return new AmbiguityError(m1, m2); - // check for same erasure - if (!types.isSameType(m1.erasure(types), m2.erasure(types))) + // check that both signatures have the same erasure + if (!types.isSameTypes(m1.erasure(types).getParameterTypes(), + m2.erasure(types).getParameterTypes())) return new AmbiguityError(m1, m2); // both abstract, neither overridden; merge throws clause and result type Symbol result; diff --git a/langtools/test/tools/javac/generics/6487370/T6487370.java b/langtools/test/tools/javac/generics/6487370/T6487370.java new file mode 100644 index 00000000000..566efe993f1 --- /dev/null +++ b/langtools/test/tools/javac/generics/6487370/T6487370.java @@ -0,0 +1,56 @@ +/* + * 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. + * + * 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 6487370 + * @author Maurizio Cimadamore + * @summary javac incorrectly gives ambiguity warning with override-equivalent abstract inherited methods + */ + +public class T6487370 { + + interface I1 { + String m(Number n); + } + + interface I2 { + Object m(Number n); + } + + static abstract class X implements I1, I2 { + String test() { + return m(0.0f); + } + } + + static class W extends X { + public String m(Number n) { + return "Hello!"; + } + } + + public static void main(String args[]) { + System.out.println(new W().test()); + } +} From 0408a1adae3cd5c75f7e5caa8ebb51cdc0b97201 Mon Sep 17 00:00:00 2001 From: Maurizio Cimadamore Date: Thu, 23 Oct 2008 18:10:23 +0100 Subject: [PATCH 072/267] 6548436: Incorrect inconvertible types error Types.rewrite quantifiers should cope with captured type-variables properly Reviewed-by: jjg --- .../com/sun/tools/javac/code/Types.java | 86 +++++++++++++------ .../tools/javac/cast/6548436/T6548436a.java | 40 +++++++++ .../tools/javac/cast/6548436/T6548436b.java | 40 +++++++++ .../tools/javac/cast/6548436/T6548436c.java | 42 +++++++++ .../tools/javac/cast/6548436/T6548436d.java | 40 +++++++++ 5 files changed, 222 insertions(+), 26 deletions(-) create mode 100644 langtools/test/tools/javac/cast/6548436/T6548436a.java create mode 100644 langtools/test/tools/javac/cast/6548436/T6548436b.java create mode 100644 langtools/test/tools/javac/cast/6548436/T6548436c.java create mode 100644 langtools/test/tools/javac/cast/6548436/T6548436d.java diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java index f7d0352bc28..776596b40b0 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java @@ -3367,33 +3367,67 @@ public class Types { * quantifiers) only */ private Type rewriteQuantifiers(Type t, boolean high, boolean rewriteTypeVars) { - ListBuffer from = new ListBuffer(); - ListBuffer to = new ListBuffer(); - adaptSelf(t, from, to); - ListBuffer rewritten = new ListBuffer(); - List formals = from.toList(); - boolean changed = false; - for (Type arg : to.toList()) { - Type bound; - if (rewriteTypeVars && arg.tag == TYPEVAR) { - TypeVar tv = (TypeVar)arg; - bound = high ? tv.bound : syms.botType; - } else { - bound = high ? upperBound(arg) : lowerBound(arg); - } - Type newarg = bound; - if (arg != bound) { - changed = true; - newarg = high ? makeExtendsWildcard(bound, (TypeVar)formals.head) - : makeSuperWildcard(bound, (TypeVar)formals.head); - } - rewritten.append(newarg); - formals = formals.tail; + return new Rewriter(high, rewriteTypeVars).rewrite(t); + } + + class Rewriter extends UnaryVisitor { + + boolean high; + boolean rewriteTypeVars; + + Rewriter(boolean high, boolean rewriteTypeVars) { + this.high = high; + this.rewriteTypeVars = rewriteTypeVars; + } + + Type rewrite(Type t) { + ListBuffer from = new ListBuffer(); + ListBuffer to = new ListBuffer(); + adaptSelf(t, from, to); + ListBuffer rewritten = new ListBuffer(); + List formals = from.toList(); + boolean changed = false; + for (Type arg : to.toList()) { + Type bound = visit(arg); + if (arg != bound) { + changed = true; + bound = high ? makeExtendsWildcard(bound, (TypeVar)formals.head) + : makeSuperWildcard(bound, (TypeVar)formals.head); + } + rewritten.append(bound); + formals = formals.tail; + } + if (changed) + return subst(t.tsym.type, from.toList(), rewritten.toList()); + else + return t; + } + + public Type visitType(Type t, Void s) { + return high ? upperBound(t) : lowerBound(t); + } + + @Override + public Type visitCapturedType(CapturedType t, Void s) { + return visitWildcardType(t.wildcard, null); + } + + @Override + public Type visitTypeVar(TypeVar t, Void s) { + if (rewriteTypeVars) + return high ? t.bound : syms.botType; + else + return t; + } + + @Override + public Type visitWildcardType(WildcardType t, Void s) { + Type bound = high ? t.getExtendsBound() : + t.getSuperBound(); + if (bound == null) + bound = high ? syms.objectType : syms.botType; + return bound; } - if (changed) - return subst(t.tsym.type, from.toList(), rewritten.toList()); - else - return t; } /** diff --git a/langtools/test/tools/javac/cast/6548436/T6548436a.java b/langtools/test/tools/javac/cast/6548436/T6548436a.java new file mode 100644 index 00000000000..aebc61c1421 --- /dev/null +++ b/langtools/test/tools/javac/cast/6548436/T6548436a.java @@ -0,0 +1,40 @@ +/* + * 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. + * + * 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 6548436 + * @summary Incorrect inconvertible types error + * @author Maurizio Cimadamore + * + * @compile T6548436a.java + */ + +public class T6548436a { + + static class Base> {} + + static void test(Base je) { + Object o = (Base)je; + } +} diff --git a/langtools/test/tools/javac/cast/6548436/T6548436b.java b/langtools/test/tools/javac/cast/6548436/T6548436b.java new file mode 100644 index 00000000000..d0fb4523597 --- /dev/null +++ b/langtools/test/tools/javac/cast/6548436/T6548436b.java @@ -0,0 +1,40 @@ +/* + * 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. + * + * 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 6548436 + * @summary Incorrect inconvertible types error + * @author Maurizio Cimadamore + * + * @compile T6548436b.java + */ + +public class T6548436b { + + enum E { } + + static void test(Enum o) { + Object e = (E)o; + } +} diff --git a/langtools/test/tools/javac/cast/6548436/T6548436c.java b/langtools/test/tools/javac/cast/6548436/T6548436c.java new file mode 100644 index 00000000000..5ae454a5f0d --- /dev/null +++ b/langtools/test/tools/javac/cast/6548436/T6548436c.java @@ -0,0 +1,42 @@ +/* + * 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. + * + * 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 6548436 + * @summary Incorrect inconvertible types error + * @author Maurizio Cimadamore + * + * @compile T6548436c.java + */ + +public class T6548436c { + + interface A> { } + + interface B extends A { } + + static void test(A a) { + Object o = (B)a; + } +} diff --git a/langtools/test/tools/javac/cast/6548436/T6548436d.java b/langtools/test/tools/javac/cast/6548436/T6548436d.java new file mode 100644 index 00000000000..626afbc16c7 --- /dev/null +++ b/langtools/test/tools/javac/cast/6548436/T6548436d.java @@ -0,0 +1,40 @@ +/* + * 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. + * + * 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 6548436 + * @summary Incorrect inconvertible types error + * @author Maurizio Cimadamore + * + * @compile/fail T6548436d.java + */ + +public class T6548436d { + + static class Base> {} + + static void test(Base je) { + Object o = (Base)je; + } +} \ No newline at end of file From ffbe5e4f5074984db90f8bcecd56932ed91a6e10 Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena Date: Thu, 23 Oct 2008 10:12:57 -0700 Subject: [PATCH 073/267] Added tag jdk7-b38 for changeset 654f8f2e8e45 --- .hgtags-top-repo | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags-top-repo b/.hgtags-top-repo index 97e4ff1601b..65dc4a6d39c 100644 --- a/.hgtags-top-repo +++ b/.hgtags-top-repo @@ -12,3 +12,4 @@ bb1ef4ee3d2c8cbf43a37d372325a7952be590b9 jdk7-b33 143c1abedb7d3095eff0f9ee5fec9bf48e3490fc jdk7-b35 4b4f5fea8d7d0743f0c30d91fcd9bf9d96e5d2ad jdk7-b36 744554f5a3290e11c71cd2ddb1aff49e431f9ed0 jdk7-b37 +cc47a76899ed33a2c513cb688348244c9b5a1288 jdk7-b38 From df2736e9cc00474febece154fda405288fa2831f Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena Date: Thu, 23 Oct 2008 10:12:58 -0700 Subject: [PATCH 074/267] Added tag jdk7-b38 for changeset 6e4503bc10a3 --- corba/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/corba/.hgtags b/corba/.hgtags index 296a27ee08e..baa91282f79 100644 --- a/corba/.hgtags +++ b/corba/.hgtags @@ -12,3 +12,4 @@ ef6af34d75a7b44e77083f1d4ee47631fa09d3b4 jdk7-b31 3867c4d14a5bfdbb37c97b4874ccb0ee5343111c jdk7-b35 0723891eb8d1c27e67c54163af0b4cea05a4e036 jdk7-b36 59d5848bdedebe91cc2753acce78911bcb4a66db jdk7-b37 +08be802754b0296c91a7713b6d85a015dbcd5349 jdk7-b38 From 3ae2c2ca54ed8807cde1d284a574b653df49275e Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena Date: Thu, 23 Oct 2008 10:13:01 -0700 Subject: [PATCH 075/267] Added tag jdk7-b38 for changeset 2db019fa6029 --- hotspot/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/hotspot/.hgtags b/hotspot/.hgtags index 7cf7d998708..15a4678d894 100644 --- a/hotspot/.hgtags +++ b/hotspot/.hgtags @@ -12,3 +12,4 @@ b727c32788a906c04839516ae7443a085185a300 jdk7-b32 5fa96a5a7e76da7c8dad12486293a0456c2c116c jdk7-b35 e91159f921a58af3698e6479ea1fc5818da66d09 jdk7-b36 9ee9cf798b59e7d51f8c0a686959f313867a55d6 jdk7-b37 +d9bc824aa078573829bb66572af847e26e1bd12e jdk7-b38 From 92ac5f1b9fba8670ad4982a4b235ad52a9a9df4b Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena Date: Thu, 23 Oct 2008 10:13:05 -0700 Subject: [PATCH 076/267] Added tag jdk7-b38 for changeset aee0dbbcda19 --- jaxp/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxp/.hgtags b/jaxp/.hgtags index 26debcbf9b8..617465552f9 100644 --- a/jaxp/.hgtags +++ b/jaxp/.hgtags @@ -12,3 +12,4 @@ b996318955c0ad8e9fa0ffb56c74f626786e863f jdk7-b28 eac46d1eb7f0935ba04f1c7929ec15423fd0309e jdk7-b35 c84ca638db42a8b6b227b4e3b63bca192c5ca634 jdk7-b36 af49591bc486d82aa04b832257de0d18adc9af52 jdk7-b37 +e9f750f0a3a00413a7b77028b2ecdabb7129ae32 jdk7-b38 From 66c2adbaa4303e753e63ada8b4c9825908171a72 Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena Date: Thu, 23 Oct 2008 10:13:07 -0700 Subject: [PATCH 077/267] Added tag jdk7-b38 for changeset d4268c9919d4 --- jaxws/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxws/.hgtags b/jaxws/.hgtags index a8f294fe904..bd52eb7b738 100644 --- a/jaxws/.hgtags +++ b/jaxws/.hgtags @@ -12,3 +12,4 @@ e6daca2eced9d84b01255cabcfcc49164c26405e jdk7-b32 b0f01c2508b690dd225298edfec70b5e8b8dc367 jdk7-b35 f60187f44a0d62906a5e2f6bd0989b5b24c1ca1e jdk7-b36 a2a6f9edf761934faf59ea60d7fe7178371302cd jdk7-b37 +9ce439969184c753a9ba3caf8ed277b05230f2e5 jdk7-b38 From f623a9cb53618745fd0f600fc794e3898b73b46e Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena Date: Thu, 23 Oct 2008 10:13:13 -0700 Subject: [PATCH 078/267] Added tag jdk7-b38 for changeset 1b948c48b8e9 --- jdk/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/.hgtags b/jdk/.hgtags index 8a91ce7fabc..d9b8755cd4d 100644 --- a/jdk/.hgtags +++ b/jdk/.hgtags @@ -12,3 +12,4 @@ fa4c0a6cdd25d97d4e6f5d7aa180bcbb0e0d56af jdk7-b33 cf4894b78ceb966326e93bf221db0c2d14d59218 jdk7-b35 134fd1a656ea85acd1f97f6700f75029b9b472a0 jdk7-b36 14f50aee4989b75934d385c56a83da0c23d2f68b jdk7-b37 +cc5f810b5af8a3a83b0df5a29d9e24d7a0ff8086 jdk7-b38 From 2531ec2c0390a0dc36b90c8ea2412b1024c7bb59 Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena Date: Thu, 23 Oct 2008 10:13:23 -0700 Subject: [PATCH 079/267] Added tag jdk7-b38 for changeset 62c548002ecb --- langtools/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/langtools/.hgtags b/langtools/.hgtags index fcc090969a3..efee9345fcf 100644 --- a/langtools/.hgtags +++ b/langtools/.hgtags @@ -12,3 +12,4 @@ eaf608c64fecf70f955dc9f29f94c055b183aeec jdk7-b30 81f66dd906eb28e43bcaa66c092e794f59a4e52d jdk7-b35 258af9b67b7cb4262ab1b5424160c9ad22d52e8f jdk7-b36 24a47c3062fe8869fcfb533ce0ff770c8ceb550d jdk7-b37 +3fd42dfa6f27f2767a241fb82bc01a613f0c2096 jdk7-b38 From 5a17e286024599468d8e18d4230325ccb806b3e3 Mon Sep 17 00:00:00 2001 From: Maurizio Cimadamore Date: Thu, 23 Oct 2008 18:29:11 +0100 Subject: [PATCH 080/267] 6557954: Inner class type parameters doesn't get substituted when checking type well-formedness Validator.visitTypeApply should substitute all formal typevars with actual parameters Reviewed-by: jjg --- .../com/sun/tools/javac/comp/Check.java | 8 ++--- .../test/tools/javac/generics/T6557954.java | 36 +++++++++++++++++++ 2 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 langtools/test/tools/javac/generics/T6557954.java diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java index a0d5cf320ca..911b9d7d46e 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java @@ -802,10 +802,10 @@ public class Check { public void visitTypeApply(JCTypeApply tree) { if (tree.type.tag == CLASS) { - List formals = tree.type.tsym.type.getTypeArguments(); - List actuals = tree.type.getTypeArguments(); + List formals = tree.type.tsym.type.allparams(); + List actuals = tree.type.allparams(); List args = tree.arguments; - List forms = formals; + List forms = tree.type.tsym.type.getTypeArguments(); ListBuffer tvars_buf = new ListBuffer(); // For matching pairs of actual argument types `a' and @@ -828,7 +828,7 @@ public class Check { args = tree.arguments; List tvars_cap = types.substBounds(formals, formals, - types.capture(tree.type).getTypeArguments()); + types.capture(tree.type).allparams()); while (args.nonEmpty() && tvars_cap.nonEmpty()) { // Let the actual arguments know their bound args.head.type.withTypeVar((TypeVar)tvars_cap.head); diff --git a/langtools/test/tools/javac/generics/T6557954.java b/langtools/test/tools/javac/generics/T6557954.java new file mode 100644 index 00000000000..f77a04db163 --- /dev/null +++ b/langtools/test/tools/javac/generics/T6557954.java @@ -0,0 +1,36 @@ +/* + * 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. + * + * 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 6557954 + * @summary Inner class type parameters doesn't get substituted when checking type well-formedness + * @author Maurizio Cimadamore + * + * @compile T6557954.java + */ + +class T6557954 { + class Foo {} + T6557954.Foo f; +} \ No newline at end of file From 3a7c0b423cc80148d4427e1e06baa845726dea2c Mon Sep 17 00:00:00 2001 From: Maurizio Cimadamore Date: Fri, 24 Oct 2008 12:45:47 +0100 Subject: [PATCH 081/267] 6680106: StackOverFlowError for Cyclic inheritance in TypeParameters with ArrayType Bounds Javac ends up in an infinite loop while attributing mutually referring array type-parameter bounds Reviewed-by: jjg --- .../com/sun/tools/javac/comp/Attr.java | 9 ++++- .../generics/typevars/6680106/T6680106.java | 40 +++++++++++++++++++ .../generics/typevars/6680106/T6680106.out | 13 ++++++ 3 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 langtools/test/tools/javac/generics/typevars/6680106/T6680106.java create mode 100644 langtools/test/tools/javac/generics/typevars/6680106/T6680106.out diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java index 769653d6989..58e6198a6af 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java @@ -2520,7 +2520,10 @@ public class Attr extends JCTree.Visitor { // accept class or interface or typevar as first bound. Type b = checkBase(bs.head, tree.bounds.head, env, false, false, false); boundSet.add(types.erasure(b)); - if (b.tag == TYPEVAR) { + if (b.isErroneous()) { + a.bound = b; + } + else if (b.tag == TYPEVAR) { // if first bound was a typevar, do not accept further bounds. if (tree.bounds.tail.nonEmpty()) { log.error(tree.bounds.tail.head.pos(), @@ -2534,7 +2537,9 @@ public class Attr extends JCTree.Visitor { for (JCExpression bound : tree.bounds.tail) { bs = bs.tail; Type i = checkBase(bs.head, bound, env, false, true, false); - if (i.tag == CLASS) + if (i.isErroneous()) + a.bound = i; + else if (i.tag == CLASS) chk.checkNotRepeated(bound.pos(), types.erasure(i), boundSet); } } diff --git a/langtools/test/tools/javac/generics/typevars/6680106/T6680106.java b/langtools/test/tools/javac/generics/typevars/6680106/T6680106.java new file mode 100644 index 00000000000..37bd7cad44f --- /dev/null +++ b/langtools/test/tools/javac/generics/typevars/6680106/T6680106.java @@ -0,0 +1,40 @@ +/* + * 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. + * + * 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 6680106 + * @summary StackOverFlowError for Cyclic inheritance in TypeParameters with ArrayType Bounds + * @author Maurizio Cimadamore + * @compile/fail/ref=T6680106.out -XDrawDiagnostics T6680106.java + */ + +class T6680106 { + class A0 {} + class A1 {} + class A2 {} + class A3 {} + class A5 {} + class A6 {} + class A7 {} +} diff --git a/langtools/test/tools/javac/generics/typevars/6680106/T6680106.out b/langtools/test/tools/javac/generics/typevars/6680106/T6680106.out new file mode 100644 index 00000000000..06f1eaf100f --- /dev/null +++ b/langtools/test/tools/javac/generics/typevars/6680106/T6680106.out @@ -0,0 +1,13 @@ +T6680106.java:34:25: compiler.err.type.found.req: T[], (- compiler.misc.type.req.class) +T6680106.java:35:25: compiler.err.type.found.req: S[], (- compiler.misc.type.req.class) +T6680106.java:35:40: compiler.err.type.found.req: T[], (- compiler.misc.type.req.class) +T6680106.java:36:25: compiler.err.type.found.req: S[], (- compiler.misc.type.req.class) +T6680106.java:36:40: compiler.err.type.found.req: U[], (- compiler.misc.type.req.class) +T6680106.java:36:55: compiler.err.type.found.req: T[], (- compiler.misc.type.req.class) +T6680106.java:37:30: compiler.err.type.found.req: T[], (- compiler.misc.type.req.class) +T6680106.java:38:30: compiler.err.type.found.req: S[], (- compiler.misc.type.req.class) +T6680106.java:38:50: compiler.err.type.found.req: T[], (- compiler.misc.type.req.class) +T6680106.java:39:30: compiler.err.type.found.req: S[], (- compiler.misc.type.req.class) +T6680106.java:39:50: compiler.err.type.found.req: U[], (- compiler.misc.type.req.class) +T6680106.java:39:70: compiler.err.type.found.req: T[], (- compiler.misc.type.req.class) +12 errors \ No newline at end of file From dd2a864f5138ff2e220d85a6e70d4622e62f776c Mon Sep 17 00:00:00 2001 From: Maurizio Cimadamore Date: Fri, 24 Oct 2008 12:46:07 +0100 Subject: [PATCH 082/267] 6746184: javac fails to compile call to public varargs method Javac's resolution process should go through all steps described in JLS 15.12.2.2 Reviewed-by: jjg --- .../com/sun/tools/javac/comp/Resolve.java | 122 ++++++++++++++---- .../test/tools/javac/varargs/T6746184.java | 39 ++++++ 2 files changed, 136 insertions(+), 25 deletions(-) create mode 100644 langtools/test/tools/javac/varargs/T6746184.java diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java index 3fd493a398f..98fef5f1e63 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java @@ -30,6 +30,7 @@ import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; import com.sun.tools.javac.code.*; import com.sun.tools.javac.jvm.*; import com.sun.tools.javac.tree.*; +import static com.sun.tools.javac.comp.Resolve.MethodResolutionPhase.*; import com.sun.tools.javac.code.Type.*; import com.sun.tools.javac.code.Symbol.*; @@ -40,6 +41,9 @@ import static com.sun.tools.javac.code.Kinds.*; import static com.sun.tools.javac.code.TypeTags.*; import javax.lang.model.element.ElementVisitor; +import java.util.Map; +import java.util.HashMap; + /** Helper class for name resolution, used mostly by the attribution phase. * *

This is NOT part of any API supported by Sun Microsystems. If @@ -1192,15 +1196,23 @@ public class Resolve { Name name, List argtypes, List typeargtypes) { - Symbol sym = findFun(env, name, argtypes, typeargtypes, false, env.info.varArgs=false); - if (varargsEnabled && sym.kind >= WRONG_MTHS) { - sym = findFun(env, name, argtypes, typeargtypes, true, false); - if (sym.kind >= WRONG_MTHS) - sym = findFun(env, name, argtypes, typeargtypes, true, env.info.varArgs=true); + Symbol sym = methodNotFound; + List steps = methodResolutionSteps; + while (steps.nonEmpty() && + steps.head.isApplicable(boxingEnabled, varargsEnabled) && + sym.kind >= ERRONEOUS) { + sym = findFun(env, name, argtypes, typeargtypes, + steps.head.isBoxingRequired, + env.info.varArgs = steps.head.isVarargsRequired); + methodResolutionCache.put(steps.head, sym); + steps = steps.tail; } - if (sym.kind >= AMBIGUOUS) { - sym = access( - sym, pos, env.enclClass.sym.type, name, false, argtypes, typeargtypes); + if (sym.kind >= AMBIGUOUS) {//if nothing is found return the 'first' error + MethodResolutionPhase errPhase = + firstErroneousResolutionPhase(); + sym = access(methodResolutionCache.get(errPhase), + pos, env.enclClass.sym.type, name, false, argtypes, typeargtypes); + env.info.varArgs = errPhase.isVarargsRequired; } return sym; } @@ -1217,17 +1229,23 @@ public class Resolve { Symbol resolveQualifiedMethod(DiagnosticPosition pos, Env env, Type site, Name name, List argtypes, List typeargtypes) { - Symbol sym = findMethod(env, site, name, argtypes, typeargtypes, false, - env.info.varArgs=false, false); - if (varargsEnabled && sym.kind >= WRONG_MTHS) { - sym = findMethod(env, site, name, argtypes, typeargtypes, true, - false, false); - if (sym.kind >= WRONG_MTHS) - sym = findMethod(env, site, name, argtypes, typeargtypes, true, - env.info.varArgs=true, false); + Symbol sym = methodNotFound; + List steps = methodResolutionSteps; + while (steps.nonEmpty() && + steps.head.isApplicable(boxingEnabled, varargsEnabled) && + sym.kind >= ERRONEOUS) { + sym = findMethod(env, site, name, argtypes, typeargtypes, + steps.head.isBoxingRequired(), + env.info.varArgs = steps.head.isVarargsRequired(), false); + methodResolutionCache.put(steps.head, sym); + steps = steps.tail; } - if (sym.kind >= AMBIGUOUS) { - sym = access(sym, pos, site, name, true, argtypes, typeargtypes); + if (sym.kind >= AMBIGUOUS) {//if nothing is found return the 'first' error + MethodResolutionPhase errPhase = + firstErroneousResolutionPhase(); + sym = access(methodResolutionCache.get(errPhase), + pos, site, name, true, argtypes, typeargtypes); + env.info.varArgs = errPhase.isVarargsRequired; } return sym; } @@ -1268,14 +1286,22 @@ public class Resolve { Type site, List argtypes, List typeargtypes) { - Symbol sym = resolveConstructor(pos, env, site, argtypes, typeargtypes, false, env.info.varArgs=false); - if (varargsEnabled && sym.kind >= WRONG_MTHS) { - sym = resolveConstructor(pos, env, site, argtypes, typeargtypes, true, false); - if (sym.kind >= WRONG_MTHS) - sym = resolveConstructor(pos, env, site, argtypes, typeargtypes, true, env.info.varArgs=true); + Symbol sym = methodNotFound; + List steps = methodResolutionSteps; + while (steps.nonEmpty() && + steps.head.isApplicable(boxingEnabled, varargsEnabled) && + sym.kind >= ERRONEOUS) { + sym = resolveConstructor(pos, env, site, argtypes, typeargtypes, + steps.head.isBoxingRequired(), + env.info.varArgs = steps.head.isVarargsRequired()); + methodResolutionCache.put(steps.head, sym); + steps = steps.tail; } - if (sym.kind >= AMBIGUOUS) { - sym = access(sym, pos, site, names.init, true, argtypes, typeargtypes); + if (sym.kind >= AMBIGUOUS) {//if nothing is found return the 'first' error + MethodResolutionPhase errPhase = firstErroneousResolutionPhase(); + sym = access(methodResolutionCache.get(errPhase), + pos, site, names.init, true, argtypes, typeargtypes); + env.info.varArgs = errPhase.isVarargsRequired(); } return sym; } @@ -1733,4 +1759,50 @@ public class Resolve { pair.sym2.location(site, types)); } } + + enum MethodResolutionPhase { + BASIC(false, false), + BOX(true, false), + VARARITY(true, true); + + boolean isBoxingRequired; + boolean isVarargsRequired; + + MethodResolutionPhase(boolean isBoxingRequired, boolean isVarargsRequired) { + this.isBoxingRequired = isBoxingRequired; + this.isVarargsRequired = isVarargsRequired; + } + + public boolean isBoxingRequired() { + return isBoxingRequired; + } + + public boolean isVarargsRequired() { + return isVarargsRequired; + } + + public boolean isApplicable(boolean boxingEnabled, boolean varargsEnabled) { + return (varargsEnabled || !isVarargsRequired) && + (boxingEnabled || !isBoxingRequired); + } + } + + private Map methodResolutionCache = + new HashMap(MethodResolutionPhase.values().length); + + final List methodResolutionSteps = List.of(BASIC, BOX, VARARITY); + + private MethodResolutionPhase firstErroneousResolutionPhase() { + MethodResolutionPhase bestSoFar = BASIC; + Symbol sym = methodNotFound; + List steps = methodResolutionSteps; + while (steps.nonEmpty() && + steps.head.isApplicable(boxingEnabled, varargsEnabled) && + sym.kind >= WRONG_MTHS) { + sym = methodResolutionCache.get(steps.head); + bestSoFar = steps.head; + steps = steps.tail; + } + return bestSoFar; + } } diff --git a/langtools/test/tools/javac/varargs/T6746184.java b/langtools/test/tools/javac/varargs/T6746184.java new file mode 100644 index 00000000000..f1b5ca46028 --- /dev/null +++ b/langtools/test/tools/javac/varargs/T6746184.java @@ -0,0 +1,39 @@ +/* + * 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. + * + * 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 6746184 + * @summary javac fails to compile call to public varargs method + */ + +public class T6746184 { + public static void main(String[] args) { + A.m(new Object()); + } +} + +class A { + public static void m(final Object... varargs) {} + private static void m(final Object singleArg) {} +} \ No newline at end of file From 418461fae23154dae6e2ea77872e2f3287a80220 Mon Sep 17 00:00:00 2001 From: Maurizio Cimadamore Date: Fri, 24 Oct 2008 12:46:34 +0100 Subject: [PATCH 083/267] 6758789: Some method resolution diagnostic should be improved Recent work on diagnostics left out some resolution corner cases Reviewed-by: jjg --- .../com/sun/tools/javac/api/Formattable.java | 19 +++++++++ .../com/sun/tools/javac/comp/Attr.java | 14 +++---- .../com/sun/tools/javac/comp/Resolve.java | 11 ++++- .../tools/javac/resources/compiler.properties | 8 +++- .../test/tools/javac/6758789/T6758789a.java | 40 ++++++++++++++++++ .../test/tools/javac/6758789/T6758789a.out | 3 ++ .../test/tools/javac/6758789/T6758789b.java | 41 +++++++++++++++++++ .../test/tools/javac/6758789/T6758789b.out | 3 ++ .../generics/inference/6718364/T6718364.out | 2 +- 9 files changed, 129 insertions(+), 12 deletions(-) create mode 100644 langtools/test/tools/javac/6758789/T6758789a.java create mode 100644 langtools/test/tools/javac/6758789/T6758789a.out create mode 100644 langtools/test/tools/javac/6758789/T6758789b.java create mode 100644 langtools/test/tools/javac/6758789/T6758789b.out diff --git a/langtools/src/share/classes/com/sun/tools/javac/api/Formattable.java b/langtools/src/share/classes/com/sun/tools/javac/api/Formattable.java index 22e6f77fb0a..e2a381f9f29 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/api/Formattable.java +++ b/langtools/src/share/classes/com/sun/tools/javac/api/Formattable.java @@ -49,4 +49,23 @@ public interface Formattable { * @return a string representing the object's kind */ String getKind(); + + static class LocalizedString implements Formattable { + String key; + + public LocalizedString(String key) { + this.key = key; + } + + public String toString(java.util.Locale l, Messages messages) { + return messages.getLocalizedString(l, key); + } + public String getKind() { + return "LocalizedString"; + } + + public String toString() { + return key; + } + } } diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java index 58e6198a6af..e6615d50a00 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java @@ -2378,16 +2378,14 @@ public class Attr extends JCTree.Visitor { } if (warned && sym.type.tag == FORALL) { - String typeargs = ""; - if (typeargtypes != null && typeargtypes.nonEmpty()) { - typeargs = "<" + Type.toString(typeargtypes) + ">"; - } chk.warnUnchecked(env.tree.pos(), "unchecked.meth.invocation.applied", - sym, - sym.location(), - typeargs, - Type.toString(argtypes)); + kindName(sym), + sym.name, + rs.methodArguments(sym.type.getParameterTypes()), + rs.methodArguments(argtypes), + kindName(sym.location()), + sym.location()); owntype = new MethodType(owntype.getParameterTypes(), types.erasure(owntype.getReturnType()), owntype.getThrownTypes(), diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java index 98fef5f1e63..59c2292b12f 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java @@ -30,6 +30,7 @@ import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; import com.sun.tools.javac.code.*; import com.sun.tools.javac.jvm.*; import com.sun.tools.javac.tree.*; +import com.sun.tools.javac.api.Formattable.LocalizedString; import static com.sun.tools.javac.comp.Resolve.MethodResolutionPhase.*; import com.sun.tools.javac.code.Type.*; @@ -1478,6 +1479,12 @@ public class Resolve { error.report(log, tree.pos(), type.getEnclosingType(), null, null, null); } + private final LocalizedString noArgs = new LocalizedString("compiler.misc.no.args"); + + public Object methodArguments(List argtypes) { + return argtypes.isEmpty() ? noArgs : argtypes; + } + /** Root class for resolve errors. * Instances of this class indicate "Symbol not found". * Instances of subclass indicate other errors. @@ -1584,8 +1591,8 @@ public class Resolve { "cant.apply.symbol" + (explanation != null ? ".1" : ""), kindname, ws.name == names.init ? ws.owner.name : ws.name, - ws.type.getParameterTypes(), - argtypes, + methodArguments(ws.type.getParameterTypes()), + methodArguments(argtypes), kindName(ws.owner), ws.owner.type, explanation); diff --git a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties index 3389b1ebfea..60d151b47ab 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties +++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties @@ -745,7 +745,10 @@ compiler.warn.unchecked.call.mbr.of.raw.type=\ compiler.warn.unchecked.cast.to.type=\ [unchecked] unchecked cast to type {0} compiler.warn.unchecked.meth.invocation.applied=\ - [unchecked] unchecked method invocation: {0} in {1} is applied to {2}({3}) + [unchecked] unchecked method invocation: {0} {1} in {4} {5} is applied to given types\n\ + required: {2}\n\ + found: {3} + compiler.warn.unchecked.generic.array.creation=\ [unchecked] unchecked generic array creation of type {0} for varargs parameter @@ -1062,6 +1065,9 @@ compiler.misc.kindname.package=\ package ##### +compiler.misc.no.args=\ + no arguments + compiler.err.override.static=\ {0}; overriding method is static compiler.err.override.meth=\ diff --git a/langtools/test/tools/javac/6758789/T6758789a.java b/langtools/test/tools/javac/6758789/T6758789a.java new file mode 100644 index 00000000000..f4607973afd --- /dev/null +++ b/langtools/test/tools/javac/6758789/T6758789a.java @@ -0,0 +1,40 @@ +/* + * 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. + * + * 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 6758789 + * @summary 6758789: Some method resolution diagnostic should be improved + * @author Maurizio Cimadamore + * + * @compile/fail/ref=T6758789a.out -XDrawDiagnostics T6758789a.java + */ + +class T6758789a { + void m1() {} + void m2(int i) {} + void test() { + m1(1); + m2(); + } +} diff --git a/langtools/test/tools/javac/6758789/T6758789a.out b/langtools/test/tools/javac/6758789/T6758789a.out new file mode 100644 index 00000000000..e85453992a9 --- /dev/null +++ b/langtools/test/tools/javac/6758789/T6758789a.out @@ -0,0 +1,3 @@ +T6758789a.java:37:9: compiler.err.cant.apply.symbol: kindname.method, m1, compiler.misc.no.args, int, kindname.class, T6758789a, null +T6758789a.java:38:9: compiler.err.cant.apply.symbol: kindname.method, m2, int, compiler.misc.no.args, kindname.class, T6758789a, null +2 errors \ No newline at end of file diff --git a/langtools/test/tools/javac/6758789/T6758789b.java b/langtools/test/tools/javac/6758789/T6758789b.java new file mode 100644 index 00000000000..731a1bad33a --- /dev/null +++ b/langtools/test/tools/javac/6758789/T6758789b.java @@ -0,0 +1,41 @@ +/* + * 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. + * + * 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 6758789 + * @summary 6758789: Some method resolution diagnostic should be improved + * @author Maurizio Cimadamore + * + * @compile/fail/ref=T6758789b.out -Werror -XDrawDiagnostics -Xlint:unchecked T6758789b.java + */ + +class T6758789a { + class Foo {} + + void m(Foo foo) {} + + void test() { + m(new Foo()); + } +} diff --git a/langtools/test/tools/javac/6758789/T6758789b.out b/langtools/test/tools/javac/6758789/T6758789b.out new file mode 100644 index 00000000000..2ff12ec5e28 --- /dev/null +++ b/langtools/test/tools/javac/6758789/T6758789b.out @@ -0,0 +1,3 @@ +T6758789b.java:39:11: compiler.warn.prob.found.req: (- compiler.misc.unchecked.assign), T6758789a.Foo, T6758789a.Foo +T6758789b.java:39:10: compiler.warn.unchecked.meth.invocation.applied: kindname.method, m, T6758789a.Foo, T6758789a.Foo, kindname.class, T6758789a +2 warnings diff --git a/langtools/test/tools/javac/generics/inference/6718364/T6718364.out b/langtools/test/tools/javac/generics/inference/6718364/T6718364.out index 4453ec98ec7..e049269d284 100644 --- a/langtools/test/tools/javac/generics/inference/6718364/T6718364.out +++ b/langtools/test/tools/javac/generics/inference/6718364/T6718364.out @@ -1,3 +1,3 @@ T6718364.java:36:32: compiler.warn.prob.found.req: (- compiler.misc.unchecked.assign), T6718364.X, T6718364.X -T6718364.java:36:10: compiler.warn.unchecked.meth.invocation.applied: m(T6718364.X,T), T6718364, , T6718364.X>,T6718364.X +T6718364.java:36:10: compiler.warn.unchecked.meth.invocation.applied: kindname.method, m, T6718364.X,T, T6718364.X>,T6718364.X, kindname.class, T6718364 2 warnings \ No newline at end of file From a21aaaa7dceb162da7620c5a3c8d0a2b009e99ff Mon Sep 17 00:00:00 2001 From: Maurizio Cimadamore Date: Fri, 24 Oct 2008 12:46:51 +0100 Subject: [PATCH 084/267] 6762569: Javac crashes with AssertionError in Types.containedBy Types.containedBy should be more liberal with UndetVars Reviewed-by: jjg --- .../com/sun/tools/javac/code/Types.java | 15 +++----- .../T6651719b.java => 6762569/T6762569a.java} | 9 +++-- .../generics/wildcards/6762569/T6762569b.java | 38 +++++++++++++++++++ 3 files changed, 49 insertions(+), 13 deletions(-) rename langtools/test/tools/javac/generics/wildcards/{6651719/T6651719b.java => 6762569/T6762569a.java} (88%) create mode 100644 langtools/test/tools/javac/generics/wildcards/6762569/T6762569b.java diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java index 776596b40b0..ac168ee344d 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java @@ -709,16 +709,13 @@ public class Types { case UNDETVAR: if (s.tag == WILDCARD) { UndetVar undetvar = (UndetVar)t; - - // Because of wildcard capture, s must be on the left - // hand side of an assignment. Furthermore, t is an - // underconstrained type variable, for example, one - // that is only used in the return type of a method. - // If the type variable is truly underconstrained, it - // cannot have any low bounds: - assert undetvar.lobounds.isEmpty() : undetvar; - undetvar.inst = glb(upperBound(s), undetvar.inst); + // We should check instantiated type against any of the + // undetvar's lower bounds. + for (Type t2 : undetvar.lobounds) { + if (!isSubtype(t2, undetvar.inst)) + return false; + } return true; } else { return isSameType(t, s); diff --git a/langtools/test/tools/javac/generics/wildcards/6651719/T6651719b.java b/langtools/test/tools/javac/generics/wildcards/6762569/T6762569a.java similarity index 88% rename from langtools/test/tools/javac/generics/wildcards/6651719/T6651719b.java rename to langtools/test/tools/javac/generics/wildcards/6762569/T6762569a.java index f14e4799638..398cdc44b00 100644 --- a/langtools/test/tools/javac/generics/wildcards/6651719/T6651719b.java +++ b/langtools/test/tools/javac/generics/wildcards/6762569/T6762569a.java @@ -23,14 +23,15 @@ /* * @test - * @bug 6651719 - * @summary Compiler crashes possibly during forward reference of TypeParameter - * @compile T6651719b.java + * @bug 6762569 + * @summary Javac crashes with AssertionError in Types.containedBy + * @compile T6762569a.java */ import java.util.*; -public class T6651719b { +class T6762569a { void m(T t, List> list) {} + void test(List> list) { m("", list); } diff --git a/langtools/test/tools/javac/generics/wildcards/6762569/T6762569b.java b/langtools/test/tools/javac/generics/wildcards/6762569/T6762569b.java new file mode 100644 index 00000000000..4065b84b4e1 --- /dev/null +++ b/langtools/test/tools/javac/generics/wildcards/6762569/T6762569b.java @@ -0,0 +1,38 @@ +/* + * 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. + * + * 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 6762569 + * @summary Javac crashes with AssertionError in Types.containedBy + * @compile/fail T6762569b.java + */ +import java.util.*; + +class T6762569b { + void m(T t, List> list) {} + + void test(List> list) { + m("", list); + } +} From adcd85f803f66db4cdcd95402461e856687158d6 Mon Sep 17 00:00:00 2001 From: Joshua Bloch Date: Fri, 24 Oct 2008 20:34:40 -0700 Subject: [PATCH 085/267] 6761678: (ann) SecurityException in AnnotationInvocationHandler.getMemberMethods Move call to getDeclaredMethods inside doPrivileged Reviewed-by: darcy, mullan --- .../AnnotationInvocationHandler.java | 16 +-- .../lang/annotation/ParameterAnnotations.java | 118 ++++++++++++++++++ 2 files changed, 126 insertions(+), 8 deletions(-) create mode 100644 jdk/test/java/lang/annotation/ParameterAnnotations.java diff --git a/jdk/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java b/jdk/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java index 05361fca444..3b5d8f74d27 100644 --- a/jdk/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java +++ b/jdk/src/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java @@ -272,14 +272,14 @@ class AnnotationInvocationHandler implements InvocationHandler, Serializable { */ private Method[] getMemberMethods() { if (memberMethods == null) { - final Method[] mm = type.getDeclaredMethods(); - AccessController.doPrivileged(new PrivilegedAction() { - public Void run() { - AccessibleObject.setAccessible(mm, true); - return null; - } - }); - memberMethods = mm; + memberMethods = AccessController.doPrivileged( + new PrivilegedAction() { + public Method[] run() { + final Method[] mm = type.getDeclaredMethods(); + AccessibleObject.setAccessible(mm, true); + return mm; + } + }); } return memberMethods; } diff --git a/jdk/test/java/lang/annotation/ParameterAnnotations.java b/jdk/test/java/lang/annotation/ParameterAnnotations.java new file mode 100644 index 00000000000..fa02e53dfa6 --- /dev/null +++ b/jdk/test/java/lang/annotation/ParameterAnnotations.java @@ -0,0 +1,118 @@ +/* + * 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. + * + * 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 6761678 + * @summary Check properties of Annotations returned from + * getParameterAnnotations, including freedom from security + * exceptions. + * @author Martin Buchholz + */ + +import java.lang.annotation.Annotation; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import java.lang.reflect.Method; +import java.security.Permission; +import java.security.Policy; +import java.security.ProtectionDomain; + +@Retention(RetentionPolicy.RUNTIME) +@Target({ ElementType.FIELD, ElementType.PARAMETER }) +@interface Named { + String value(); +} + +public class ParameterAnnotations { + + // A security policy that differs from the default only in that it + // allows a security manager to be uninstalled. + static class MyPolicy extends Policy { + final Policy defaultPolicy; + MyPolicy(Policy defaultPolicy) { + this.defaultPolicy = defaultPolicy; + } + public boolean implies(ProtectionDomain pd, Permission p) { + return p.getName().equals("setSecurityManager") || + defaultPolicy.implies(pd, p); + } + } + + public void nop(@Named("foo") Object foo, + @Named("bar") Object bar) { + } + + void test(String[] args) throws Throwable { + // Test without a security manager + test1(); + + // Test with a security manager + Policy defaultPolicy = Policy.getPolicy(); + Policy.setPolicy(new MyPolicy(defaultPolicy)); + System.setSecurityManager(new SecurityManager()); + try { + test1(); + } finally { + System.setSecurityManager(null); + Policy.setPolicy(defaultPolicy); + } + } + + void test1() throws Throwable { + for (Method m : thisClass.getMethods()) { + if (m.getName().equals("nop")) { + Annotation[][] ann = m.getParameterAnnotations(); + equal(ann.length, 2); + Annotation foo = ann[0][0]; + Annotation bar = ann[1][0]; + equal(foo.toString(), "@Named(value=foo)"); + equal(bar.toString(), "@Named(value=bar)"); + check(foo.equals(foo)); + check(! foo.equals(bar)); + } + } + } + + //--------------------- Infrastructure --------------------------- + volatile int passed = 0, failed = 0; + void pass() {passed++;} + void fail() {failed++; Thread.dumpStack();} + void fail(String msg) {System.err.println(msg); fail();} + void unexpected(Throwable t) {failed++; t.printStackTrace();} + void check(boolean cond) {if (cond) pass(); else fail();} + void equal(Object x, Object y) { + if (x == null ? y == null : x.equals(y)) pass(); + else fail(x + " not equal to " + y);} + static Class thisClass = new Object(){}.getClass().getEnclosingClass(); + public static void main(String[] args) throws Throwable { + try {thisClass.getMethod("instanceMain",String[].class) + .invoke(thisClass.newInstance(), (Object) args);} + catch (Throwable e) {throw e.getCause();}} + public void instanceMain(String[] args) throws Throwable { + try {test(args);} catch (Throwable t) {unexpected(t);} + System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); + if (failed > 0) throw new AssertionError("Some tests failed");} +} From d3972610f43321086093a2df58d443c13de5adfc Mon Sep 17 00:00:00 2001 From: Eamonn McManus Date: Mon, 27 Oct 2008 14:02:40 +0100 Subject: [PATCH 086/267] 6763639: Remove "rawtypes" warnings from JMX code Reviewed-by: dfuchs --- jdk/make/netbeans/jmx/build.xml | 20 ++-- .../com/sun/jmx/event/LeaseManager.java | 2 +- .../com/sun/jmx/event/LeaseRenewer.java | 2 +- .../DefaultMBeanServerInterceptor.java | 9 +- .../ClassLoaderRepositorySupport.java | 14 +-- .../sun/jmx/mbeanserver/ConvertingMethod.java | 6 +- .../DefaultMXBeanMappingFactory.java | 103 +++++++++--------- .../com/sun/jmx/mbeanserver/Introspector.java | 16 +-- .../sun/jmx/mbeanserver/JmxMBeanServer.java | 14 +-- .../jmx/mbeanserver/MBeanInstantiator.java | 54 ++++----- .../jmx/mbeanserver/MXBeanIntrospector.java | 12 +- .../ObjectInputStreamWithLoader.java | 3 +- .../SecureClassLoaderRepository.java | 6 +- .../classes/com/sun/jmx/mbeanserver/Util.java | 4 +- .../jmx/mbeanserver/WeakIdentityHashMap.java | 4 +- .../internal/ArrayNotificationBuffer.java | 2 +- .../remote/internal/ClientNotifForwarder.java | 4 +- .../jmx/remote/internal/ProxyInputStream.java | 2 +- .../remote/internal/ServerNotifForwarder.java | 2 +- .../sun/jmx/remote/internal/Unmarshal.java | 2 +- .../jmx/remote/security/FileLoginModule.java | 11 +- .../security/JMXPluggableAuthenticator.java | 2 +- .../MBeanServerFileAccessController.java | 9 +- .../util/ClassLoaderWithRepository.java | 2 +- .../com/sun/jmx/remote/util/ClassLogger.java | 2 +- .../com/sun/jmx/remote/util/EnvHelp.java | 54 ++++----- .../remote/util/EventClientConnection.java | 10 +- .../jmx/remote/util/OrderClassLoaders.java | 2 +- .../javax/management/AttributeList.java | 2 +- .../management/DefaultLoaderRepository.java | 4 +- .../javax/management/JMRuntimeException.java | 2 +- .../share/classes/javax/management/JMX.java | 4 +- .../javax/management/MBeanAttributeInfo.java | 4 +- .../management/MBeanConstructorInfo.java | 6 +- .../classes/javax/management/MBeanInfo.java | 6 +- .../javax/management/MBeanOperationInfo.java | 5 +- .../javax/management/MBeanServerFactory.java | 8 +- .../MBeanServerInvocationHandler.java | 14 +-- .../javax/management/StandardMBean.java | 16 +-- .../management/event/EventClientDelegate.java | 6 +- .../management/event/EventSubscriber.java | 3 +- .../loading/DefaultLoaderRepository.java | 11 +- .../javax/management/loading/MLet.java | 2 +- .../loading/MLetObjectInputStream.java | 23 ++-- .../modelmbean/DescriptorSupport.java | 34 +++--- .../modelmbean/ModelMBeanConstructorInfo.java | 4 +- .../modelmbean/RequiredModelMBean.java | 21 ++-- .../javax/management/openmbean/ArrayType.java | 33 +++--- .../CompositeDataInvocationHandler.java | 4 +- .../management/openmbean/CompositeType.java | 10 +- .../OpenMBeanAttributeInfoSupport.java | 16 +-- .../OpenMBeanParameterInfoSupport.java | 4 +- .../javax/management/openmbean/OpenType.java | 2 +- .../management/openmbean/SimpleType.java | 14 +-- .../openmbean/TabularDataSupport.java | 13 +-- .../management/openmbean/TabularType.java | 17 ++- .../MBeanServerNotificationFilter.java | 6 +- .../management/relation/RelationService.java | 66 ++++------- .../management/relation/RelationSupport.java | 16 +-- .../javax/management/relation/Role.java | 6 +- .../javax/management/relation/RoleList.java | 3 +- .../javax/management/relation/RoleResult.java | 4 +- .../management/relation/RoleUnresolved.java | 6 +- .../relation/RoleUnresolvedList.java | 3 +- .../remote/JMXConnectorFactory.java | 5 +- .../remote/rmi/NoCallStackClassLoader.java | 3 +- .../management/remote/rmi/RMIConnection.java | 8 +- .../remote/rmi/RMIConnectionImpl.java | 14 ++- .../management/remote/rmi/RMIConnector.java | 45 ++++---- .../remote/rmi/RMIConnectorServer.java | 21 ++-- .../management/remote/rmi/RMIServerImpl.java | 27 +++-- .../classes/javax/management/timer/Timer.java | 3 +- 72 files changed, 441 insertions(+), 456 deletions(-) diff --git a/jdk/make/netbeans/jmx/build.xml b/jdk/make/netbeans/jmx/build.xml index 6e2696ebb8f..e306b8ea40a 100644 --- a/jdk/make/netbeans/jmx/build.xml +++ b/jdk/make/netbeans/jmx/build.xml @@ -44,13 +44,13 @@ - - + @@ -58,13 +58,13 @@ - + @@ -96,7 +96,7 @@ - + - - @@ -131,7 +131,7 @@ - @@ -144,7 +144,7 @@ - + diff --git a/jdk/src/share/classes/com/sun/jmx/event/LeaseManager.java b/jdk/src/share/classes/com/sun/jmx/event/LeaseManager.java index e1761011f0e..09a7a03a42d 100644 --- a/jdk/src/share/classes/com/sun/jmx/event/LeaseManager.java +++ b/jdk/src/share/classes/com/sun/jmx/event/LeaseManager.java @@ -141,7 +141,7 @@ public class LeaseManager { } private final Runnable callback; - private ScheduledFuture scheduled; // If null, the lease has expired. + private ScheduledFuture scheduled; // If null, the lease has expired. private final ScheduledExecutorService executor = Executors.newScheduledThreadPool(1, diff --git a/jdk/src/share/classes/com/sun/jmx/event/LeaseRenewer.java b/jdk/src/share/classes/com/sun/jmx/event/LeaseRenewer.java index b3f7c7fee07..8ba6877221e 100644 --- a/jdk/src/share/classes/com/sun/jmx/event/LeaseRenewer.java +++ b/jdk/src/share/classes/com/sun/jmx/event/LeaseRenewer.java @@ -128,7 +128,7 @@ public class LeaseRenewer { }; private final Callable doRenew; - private ScheduledFuture future; + private ScheduledFuture future; private boolean closed = false; private long nextRenewTime; diff --git a/jdk/src/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java b/jdk/src/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java index 7da3406b911..3d80a09eccb 100644 --- a/jdk/src/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java +++ b/jdk/src/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java @@ -247,7 +247,7 @@ public class DefaultMBeanServerInterceptor MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException { - Class theClass; + Class theClass; if (className == null) { final RuntimeException wrapped = @@ -327,7 +327,7 @@ public class DefaultMBeanServerInterceptor // ------------------------------ // ------------------------------ - Class theClass = object.getClass(); + Class theClass = object.getClass(); Introspector.checkCompliance(theClass); @@ -808,9 +808,8 @@ public class DefaultMBeanServerInterceptor // on each specific attribute // allowedAttributes = new AttributeList(attributes.size()); - for (Iterator i = attributes.iterator(); i.hasNext();) { + for (Attribute attribute : attributes.asList()) { try { - Attribute attribute = (Attribute) i.next(); checkMBeanPermission(mbeanServerName, classname, attribute.getName(), name, "setAttribute"); allowedAttributes.add(attribute); @@ -1857,7 +1856,7 @@ public class DefaultMBeanServerInterceptor } } - private static void checkMBeanTrustPermission(final Class theClass) + private static void checkMBeanTrustPermission(final Class theClass) throws SecurityException { SecurityManager sm = System.getSecurityManager(); if (sm != null) { diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/ClassLoaderRepositorySupport.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/ClassLoaderRepositorySupport.java index 35311699d8d..011bb2d26ac 100644 --- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/ClassLoaderRepositorySupport.java +++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/ClassLoaderRepositorySupport.java @@ -136,14 +136,14 @@ final class ClassLoaderRepositorySupport new Hashtable(10); // from javax.management.loading.DefaultLoaderRepository - public final Class loadClass(String className) + public final Class loadClass(String className) throws ClassNotFoundException { return loadClass(loaders, className, null, null); } // from javax.management.loading.DefaultLoaderRepository - public final Class loadClassWithout(ClassLoader without, String className) + public final Class loadClassWithout(ClassLoader without, String className) throws ClassNotFoundException { if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) { MBEANSERVER_LOGGER.logp(Level.FINER, @@ -167,7 +167,7 @@ final class ClassLoaderRepositorySupport } - public final Class loadClassBefore(ClassLoader stop, String className) + public final Class loadClassBefore(ClassLoader stop, String className) throws ClassNotFoundException { if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) { MBEANSERVER_LOGGER.logp(Level.FINER, @@ -187,10 +187,10 @@ final class ClassLoaderRepositorySupport } - private Class loadClass(final LoaderEntry list[], - final String className, - final ClassLoader without, - final ClassLoader stop) + private Class loadClass(final LoaderEntry list[], + final String className, + final ClassLoader without, + final ClassLoader stop) throws ClassNotFoundException { final int size = list.length; for(int i=0; i getOpenReturnType() { return returnMapping.getOpenType(); } - OpenType[] getOpenParameterTypes() { - final OpenType[] types = new OpenType[paramMappings.length]; + OpenType[] getOpenParameterTypes() { + final OpenType[] types = new OpenType[paramMappings.length]; for (int i = 0; i < paramMappings.length; i++) types[i] = paramMappings[i].getOpenType(); return types; diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java index b86b2e00128..d7ca5b0f629 100644 --- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java +++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java @@ -120,7 +120,7 @@ import javax.management.openmbean.TabularType; */ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { static abstract class NonNullMXBeanMapping extends MXBeanMapping { - NonNullMXBeanMapping(Type javaType, OpenType openType) { + NonNullMXBeanMapping(Type javaType, OpenType openType) { super(javaType, openType); } @@ -195,15 +195,15 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { static { /* Set up the mappings for Java types that map to SimpleType. */ - final OpenType[] simpleTypes = { + final OpenType[] simpleTypes = { BIGDECIMAL, BIGINTEGER, BOOLEAN, BYTE, CHARACTER, DATE, DOUBLE, FLOAT, INTEGER, LONG, OBJECTNAME, SHORT, STRING, VOID, }; for (int i = 0; i < simpleTypes.length; i++) { - final OpenType t = simpleTypes[i]; - Class c; + final OpenType t = simpleTypes[i]; + Class c; try { c = Class.forName(t.getClassName(), false, ObjectName.class.getClassLoader()); @@ -224,7 +224,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { if (primitiveType != void.class) { final Class primitiveArrayType = Array.newInstance(primitiveType, 0).getClass(); - final OpenType primitiveArrayOpenType = + final OpenType primitiveArrayOpenType = ArrayType.getPrimitiveArrayType(primitiveArrayType); final MXBeanMapping primitiveArrayMapping = new IdentityMapping(primitiveArrayType, @@ -285,13 +285,13 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { Type componentType = ((GenericArrayType) objType).getGenericComponentType(); return makeArrayOrCollectionMapping(objType, componentType, factory); - } else if (objType instanceof Class) { + } else if (objType instanceof Class) { Class objClass = (Class) objType; if (objClass.isEnum()) { // Huge hack to avoid compiler warnings here. The ElementType // parameter is ignored but allows us to obtain a type variable // T that matches >. - return makeEnumMapping((Class) objClass, ElementType.class); + return makeEnumMapping((Class) objClass, ElementType.class); } else if (objClass.isArray()) { Type componentType = objClass.getComponentType(); return makeArrayOrCollectionMapping(objClass, componentType, @@ -354,7 +354,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { } private static > MXBeanMapping - makeEnumMapping(Class enumClass, Class fake) { + makeEnumMapping(Class enumClass, Class fake) { return new EnumMapping(Util.>cast(enumClass)); } @@ -414,14 +414,14 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { final String objTypeName = objType.toString(); final MXBeanMapping keyMapping = factory.mappingForType(keyType, factory); final MXBeanMapping valueMapping = factory.mappingForType(valueType, factory); - final OpenType keyOpenType = keyMapping.getOpenType(); - final OpenType valueOpenType = valueMapping.getOpenType(); + final OpenType keyOpenType = keyMapping.getOpenType(); + final OpenType valueOpenType = valueMapping.getOpenType(); final CompositeType rowType = new CompositeType(objTypeName, objTypeName, keyValueArray, keyValueArray, - new OpenType[] {keyOpenType, valueOpenType}); + new OpenType[] {keyOpenType, valueOpenType}); final TabularType tabularType = new TabularType(objTypeName, objTypeName, rowType, keyArray); return new TabularMapping(objType, sortedMap, tabularType, @@ -440,8 +440,8 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { final Type rawType = objType.getRawType(); - if (rawType instanceof Class) { - Class c = (Class) rawType; + if (rawType instanceof Class) { + Class c = (Class) rawType; if (c == List.class || c == Set.class || c == SortedSet.class) { Type[] actuals = objType.getActualTypeArguments(); assert(actuals.length == 1); @@ -468,7 +468,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { return new MXBeanRefMapping(t); } - private MXBeanMapping makeCompositeMapping(Class c, + private MXBeanMapping makeCompositeMapping(Class c, MXBeanMappingFactory factory) throws OpenDataException { @@ -514,7 +514,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { final Method[] getters = new Method[nitems]; final String[] itemNames = new String[nitems]; - final OpenType[] openTypes = new OpenType[nitems]; + final OpenType[] openTypes = new OpenType[nitems]; int i = 0; for (Map.Entry entry : getterMap.entrySet()) { itemNames[i] = entry.getKey(); @@ -546,7 +546,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { can be directly represented by an ArrayType, and an int needs no mapping because reflection takes care of it. */ private static final class IdentityMapping extends NonNullMXBeanMapping { - IdentityMapping(Type targetType, OpenType openType) { + IdentityMapping(Type targetType, OpenType openType) { super(targetType, openType); } @@ -576,7 +576,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { @Override final Object toNonNullOpenValue(Object value) { - return ((Enum) value).name(); + return ((Enum) value).name(); } @Override @@ -595,7 +595,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { private static final class ArrayMapping extends NonNullMXBeanMapping { ArrayMapping(Type targetType, - ArrayType openArrayType, Class openArrayClass, + ArrayType openArrayType, Class openArrayClass, MXBeanMapping elementMapping) { super(targetType, openArrayType); this.elementMapping = elementMapping; @@ -623,7 +623,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { if (javaType instanceof GenericArrayType) { componentType = ((GenericArrayType) javaType).getGenericComponentType(); - } else if (javaType instanceof Class && + } else if (javaType instanceof Class && ((Class) javaType).isArray()) { componentType = ((Class) javaType).getComponentType(); } else { @@ -651,8 +651,8 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { private static final class CollectionMapping extends NonNullMXBeanMapping { CollectionMapping(Type targetType, - ArrayType openArrayType, - Class openArrayClass, + ArrayType openArrayType, + Class openArrayClass, MXBeanMapping elementMapping) { super(targetType, openArrayType); this.elementMapping = elementMapping; @@ -662,26 +662,28 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { and all Sets to TreeSet. (TreeSet because it is a SortedSet, so works for both Set and SortedSet.) */ Type raw = ((ParameterizedType) targetType).getRawType(); - Class c = (Class) raw; + Class c = (Class) raw; + final Class collC; if (c == List.class) - collectionClass = ArrayList.class; + collC = ArrayList.class; else if (c == Set.class) - collectionClass = HashSet.class; + collC = HashSet.class; else if (c == SortedSet.class) - collectionClass = TreeSet.class; + collC = TreeSet.class; else { // can't happen assert(false); - collectionClass = null; + collC = null; } + collectionClass = Util.cast(collC); } @Override final Object toNonNullOpenValue(Object value) throws OpenDataException { - final Collection valueCollection = (Collection) value; - if (valueCollection instanceof SortedSet) { - Comparator comparator = - ((SortedSet) valueCollection).comparator(); + final Collection valueCollection = (Collection) value; + if (valueCollection instanceof SortedSet) { + Comparator comparator = + ((SortedSet) valueCollection).comparator(); if (comparator != null) { final String msg = "Cannot convert SortedSet with non-null comparator: " + @@ -725,7 +727,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { elementMapping.checkReconstructible(); } - private final Class collectionClass; + private final Class> collectionClass; private final MXBeanMapping elementMapping; } @@ -794,8 +796,8 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { @Override final Object toNonNullOpenValue(Object value) throws OpenDataException { final Map valueMap = cast(value); - if (valueMap instanceof SortedMap) { - Comparator comparator = ((SortedMap) valueMap).comparator(); + if (valueMap instanceof SortedMap) { + Comparator comparator = ((SortedMap) valueMap).comparator(); if (comparator != null) { final String msg = "Cannot convert SortedMap with non-null comparator: " + @@ -806,7 +808,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { final TabularType tabularType = (TabularType) getOpenType(); final TabularData table = new TabularDataSupport(tabularType); final CompositeType rowType = tabularType.getRowType(); - for (Map.Entry entry : valueMap.entrySet()) { + for (Map.Entry entry : valueMap.entrySet()) { final Object openKey = keyMapping.toOpenValue(entry.getKey()); final Object openValue = valueMapping.toOpenValue(entry.getValue()); final CompositeData row; @@ -852,7 +854,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { } private final class CompositeMapping extends NonNullMXBeanMapping { - CompositeMapping(Class targetClass, + CompositeMapping(Class targetClass, CompositeType compositeType, String[] itemNames, Method[] getters, @@ -901,7 +903,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { if (compositeBuilder != null) return; - Class targetClass = (Class) getJavaType(); + Class targetClass = (Class) getJavaType(); /* In this 2D array, each subarray is a set of builders where there is no point in consulting the ones after the first if the first refuses. */ @@ -973,7 +975,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { /** Converts from a CompositeData to an instance of the targetClass. */ private static abstract class CompositeBuilder { - CompositeBuilder(Class targetClass, String[] itemNames) { + CompositeBuilder(Class targetClass, String[] itemNames) { this.targetClass = targetClass; this.itemNames = itemNames; } @@ -1008,7 +1010,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { private static final class CompositeBuilderViaFrom extends CompositeBuilder { - CompositeBuilderViaFrom(Class targetClass, String[] itemNames) { + CompositeBuilderViaFrom(Class targetClass, String[] itemNames) { super(targetClass, itemNames); } @@ -1018,8 +1020,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { Class targetClass = getTargetClass(); try { Method fromMethod = - targetClass.getMethod("from", - new Class[] {CompositeData.class}); + targetClass.getMethod("from", CompositeData.class); if (!Modifier.isStatic(fromMethod.getModifiers())) { final String msg = @@ -1071,7 +1072,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { If all the getters are OK, then the "applicable" method will return an empty string and the other builders will be tried. */ private static class CompositeBuilderCheckGetters extends CompositeBuilder { - CompositeBuilderCheckGetters(Class targetClass, String[] itemNames, + CompositeBuilderCheckGetters(Class targetClass, String[] itemNames, MXBeanMapping[] getterConverters) { super(targetClass, itemNames); this.getterConverters = getterConverters; @@ -1115,7 +1116,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { Method[] setters = new Method[getters.length]; for (int i = 0; i < getters.length; i++) { Method getter = getters[i]; - Class returnType = getter.getReturnType(); + Class returnType = getter.getReturnType(); String name = propertyName(getter); String setterName = "set" + name; Method setter; @@ -1163,7 +1164,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { private static final class CompositeBuilderViaConstructor extends CompositeBuilder { - CompositeBuilderViaConstructor(Class targetClass, String[] itemNames) { + CompositeBuilderViaConstructor(Class targetClass, String[] itemNames) { super(targetClass, itemNames); } @@ -1171,7 +1172,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { final Class propertyNamesClass = ConstructorProperties.class; - Class targetClass = getTargetClass(); + Class targetClass = getTargetClass(); Constructor[] constrs = targetClass.getConstructors(); // Applicable if and only if there are any annotated constructors @@ -1384,12 +1385,12 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { private static final class CompositeBuilderViaProxy extends CompositeBuilder { - CompositeBuilderViaProxy(Class targetClass, String[] itemNames) { + CompositeBuilderViaProxy(Class targetClass, String[] itemNames) { super(targetClass, itemNames); } String applicable(Method[] getters) { - Class targetClass = getTargetClass(); + Class targetClass = getTargetClass(); if (!targetClass.isInterface()) return "not an interface"; Set methods = @@ -1401,7 +1402,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { String bad = null; for (Method m : methods) { String mname = m.getName(); - Class[] mparams = m.getParameterTypes(); + Class[] mparams = m.getParameterTypes(); try { Method om = Object.class.getMethod(mname, mparams); if (!Modifier.isPublic(om.getModifiers())) @@ -1422,10 +1423,10 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { final Object fromCompositeData(CompositeData cd, String[] itemNames, MXBeanMapping[] converters) { - final Class targetClass = getTargetClass(); + final Class targetClass = getTargetClass(); return Proxy.newProxyInstance(targetClass.getClassLoader(), - new Class[] {targetClass}, + new Class[] {targetClass}, new CompositeDataInvocationHandler(cd)); } } @@ -1447,9 +1448,9 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { return openDataException(cause.getMessage(), cause); } - static void mustBeComparable(Class collection, Type element) + static void mustBeComparable(Class collection, Type element) throws OpenDataException { - if (!(element instanceof Class) + if (!(element instanceof Class) || !Comparable.class.isAssignableFrom((Class) element)) { final String msg = "Parameter class " + element + " of " + diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java index 52783fd5a60..da4209cd2b3 100644 --- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java +++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java @@ -115,7 +115,7 @@ public class Introspector { * Dynamic MBeans, false otherwise. * **/ - public static final boolean isDynamic(final Class c) { + public static final boolean isDynamic(final Class c) { // Check if the MBean implements the DynamicMBean interface return javax.management.DynamicMBean.class.isAssignableFrom(c); } @@ -134,7 +134,7 @@ public class Introspector { * MBeanServer. * **/ - public static void testCreation(Class c) + public static void testCreation(Class c) throws NotCompliantMBeanException { // Check if the class is a concrete class final int mods = c.getModifiers(); @@ -143,7 +143,7 @@ public class Introspector { } // Check if the MBean has a public constructor - final Constructor[] consList = c.getConstructors(); + final Constructor[] consList = c.getConstructors(); if (consList.length == 0) { throw new NotCompliantMBeanException("MBean class must have public constructor"); } @@ -253,7 +253,7 @@ public class Introspector { * @exception NotCompliantMBeanException The specified class is not a * JMX compliant MBean */ - public static MBeanInfo testCompliance(Class baseClass) + public static MBeanInfo testCompliance(Class baseClass) throws NotCompliantMBeanException { // ------------------------------ @@ -267,7 +267,7 @@ public class Introspector { return testCompliance(baseClass, null); } - public static void testComplianceMXBeanInterface(Class interfaceClass, + public static void testComplianceMXBeanInterface(Class interfaceClass, MXBeanMappingFactory factory) throws NotCompliantMBeanException { MXBeanIntrospector.getInstance(factory).getAnalyzer(interfaceClass); @@ -596,10 +596,10 @@ public class Introspector { ss[i] = (String) annotationToField(xx[i]); return ss; } - if (x instanceof Class) + if (x instanceof Class) return ((Class) x).getName(); - if (x instanceof Enum) - return ((Enum) x).name(); + if (x instanceof Enum) + return ((Enum) x).name(); // The only other possibility is that the value is another // annotation, or that the language has evolved since this code // was written. We don't allow for either of those currently. diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/JmxMBeanServer.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/JmxMBeanServer.java index 777cd1cce65..14ee0ac5279 100644 --- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/JmxMBeanServer.java +++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/JmxMBeanServer.java @@ -33,6 +33,7 @@ import java.security.AccessController; import java.security.Permission; import java.security.PrivilegedExceptionAction; import java.util.Iterator; +import java.util.List; import java.util.Set; import java.util.logging.Level; @@ -1144,7 +1145,7 @@ public final class JmxMBeanServer // This call requires MBeanPermission 'getClassLoaderRepository' final ClassLoaderRepository clr = getClassLoaderRepository(); - Class theClass; + Class theClass; try { if (clr == null) throw new ClassNotFoundException(className); theClass = clr.loadClass(className); @@ -1457,23 +1458,22 @@ public final class JmxMBeanServer */ private AttributeList cloneAttributeList(AttributeList list) { if (list != null) { + List alist = list.asList(); if (!list.getClass().equals(AttributeList.class)) { // Create new attribute list // - AttributeList newList = new AttributeList(list.size()); + AttributeList newList = new AttributeList(alist.size()); // Iterate through list and replace non JMX attributes // - for (Iterator i = list.iterator(); i.hasNext(); ) { - Attribute attribute = (Attribute) i.next(); + for (Attribute attribute : alist) newList.add(cloneAttribute(attribute)); - } return newList; } else { // Iterate through list and replace non JMX attributes // - for (int i = 0; i < list.size(); i++) { - Attribute attribute = (Attribute) list.get(i); + for (int i = 0; i < alist.size(); i++) { + Attribute attribute = alist.get(i); if (!attribute.getClass().equals(Attribute.class)) { list.set(i, cloneAttribute(attribute)); } diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java index 019793b8d85..789fd661aa9 100644 --- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java +++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java @@ -70,7 +70,7 @@ public class MBeanInstantiator { * instantiate an MBean of this class in the MBeanServer. * e.g. it must have a public constructor, be a concrete class... */ - public void testCreation(Class c) throws NotCompliantMBeanException { + public void testCreation(Class c) throws NotCompliantMBeanException { Introspector.testCreation(c); } @@ -78,10 +78,10 @@ public class MBeanInstantiator { * Loads the class with the specified name using this object's * Default Loader Repository. **/ - public Class findClassWithDefaultLoaderRepository(String className) + public Class findClassWithDefaultLoaderRepository(String className) throws ReflectionException { - Class theClass; + Class theClass; if (className == null) { throw new RuntimeOperationsException(new IllegalArgumentException("The class name cannot be null"), @@ -105,7 +105,7 @@ public class MBeanInstantiator { * Gets the class for the specified class name using the MBean * Interceptor's classloader */ - public Class findClass(String className, ClassLoader loader) + public Class findClass(String className, ClassLoader loader) throws ReflectionException { return loadClass(className,loader); @@ -115,7 +115,7 @@ public class MBeanInstantiator { * Gets the class for the specified class name using the specified * class loader */ - public Class findClass(String className, ObjectName aLoader) + public Class findClass(String className, ObjectName aLoader) throws ReflectionException, InstanceNotFoundException { if (aLoader == null) @@ -140,14 +140,14 @@ public class MBeanInstantiator { * Return an array of Class corresponding to the given signature, using * the specified class loader. */ - public Class[] findSignatureClasses(String signature[], - ClassLoader loader) - throws ReflectionException { + public Class[] findSignatureClasses(String signature[], + ClassLoader loader) + throws ReflectionException { if (signature == null) return null; final ClassLoader aLoader = loader; final int length= signature.length; - final Class tab[]=new Class[length]; + final Class tab[]=new Class[length]; if (length == 0) return tab; try { @@ -156,7 +156,7 @@ public class MBeanInstantiator { // forth) // - final Class primCla = primitiveClasses.get(signature[i]); + final Class primCla = primitiveClasses.get(signature[i]); if (primCla != null) { tab[i] = primCla; continue; @@ -203,14 +203,14 @@ public class MBeanInstantiator { * Instantiates an object given its class, using its empty constructor. * The call returns a reference to the newly created object. */ - public Object instantiate(Class theClass) + public Object instantiate(Class theClass) throws ReflectionException, MBeanException { Object moi; // ------------------------------ // ------------------------------ - Constructor cons = findConstructor(theClass, null); + Constructor cons = findConstructor(theClass, null); if (cons == null) { throw new ReflectionException(new NoSuchMethodException("No such constructor")); @@ -257,14 +257,14 @@ public class MBeanInstantiator { * signature of its constructor The call returns a reference to * the newly created object. */ - public Object instantiate(Class theClass, Object params[], + public Object instantiate(Class theClass, Object params[], String signature[], ClassLoader loader) throws ReflectionException, MBeanException { // Instantiate the new object // ------------------------------ // ------------------------------ - final Class[] tab; + final Class[] tab; Object moi; try { // Build the signature of the method @@ -283,7 +283,7 @@ public class MBeanInstantiator { } // Query the metadata service to get the right constructor - Constructor cons = findConstructor(theClass, tab); + Constructor cons = findConstructor(theClass, tab); if (cons == null) { throw new ReflectionException(new @@ -407,7 +407,7 @@ public class MBeanInstantiator { throw new RuntimeOperationsException(new IllegalArgumentException(), "Null className passed in parameter"); } - Class theClass; + Class theClass; if (loaderName == null) { // Load the class using the agent class loader theClass = findClass(className, loader); @@ -547,7 +547,7 @@ public class MBeanInstantiator { throws ReflectionException, MBeanException { - Class theClass = findClassWithDefaultLoaderRepository(className); + Class theClass = findClassWithDefaultLoaderRepository(className); return instantiate(theClass, params, signature, loader); } @@ -595,7 +595,7 @@ public class MBeanInstantiator { // ------------------------------ // ------------------------------ - Class theClass; + Class theClass; if (loaderName == null) { theClass = findClass(className, loader); @@ -617,10 +617,10 @@ public class MBeanInstantiator { * Load a class with the specified loader, or with this object * class loader if the specified loader is null. **/ - static Class loadClass(String className, ClassLoader loader) + static Class loadClass(String className, ClassLoader loader) throws ReflectionException { - Class theClass; + Class theClass; if (className == null) { throw new RuntimeOperationsException(new IllegalArgumentException("The class name cannot be null"), @@ -647,15 +647,15 @@ public class MBeanInstantiator { * Load the classes specified in the signature with the given loader, * or with this object class loader. **/ - static Class[] loadSignatureClasses(String signature[], - ClassLoader loader) + static Class[] loadSignatureClasses(String signature[], + ClassLoader loader) throws ReflectionException { if (signature == null) return null; final ClassLoader aLoader = (loader==null?MBeanInstantiator.class.getClassLoader():loader); final int length= signature.length; - final Class tab[]=new Class[length]; + final Class tab[]=new Class[length]; if (length == 0) return tab; try { @@ -664,7 +664,7 @@ public class MBeanInstantiator { // forth) // - final Class primCla = primitiveClasses.get(signature[i]); + final Class primCla = primitiveClasses.get(signature[i]); if (primCla != null) { tab[i] = primCla; continue; @@ -710,9 +710,9 @@ public class MBeanInstantiator { private static final Map> primitiveClasses = Util.newMap(); static { - for (Class c : new Class[] {byte.class, short.class, int.class, - long.class, float.class, double.class, - char.class, boolean.class}) + for (Class c : new Class[] {byte.class, short.class, int.class, + long.class, float.class, double.class, + char.class, boolean.class}) primitiveClasses.put(c.getName(), c); } } diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/MXBeanIntrospector.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/MXBeanIntrospector.java index 6479f9751e0..bcb6f869c20 100644 --- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/MXBeanIntrospector.java +++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/MXBeanIntrospector.java @@ -160,7 +160,7 @@ class MXBeanIntrospector extends MBeanIntrospector { // matched to the corresponding Java type, except when that // type is primitive. Type t = m.getGenericParameterTypes()[paramNo]; - return (!(t instanceof Class) || !((Class) t).isPrimitive()); + return (!(t instanceof Class) || !((Class) t).isPrimitive()); } else { Object v; try { @@ -354,7 +354,7 @@ class MXBeanIntrospector extends MBeanIntrospector { } } - private static Descriptor typeDescriptor(OpenType openType, + private static Descriptor typeDescriptor(OpenType openType, Type originalType) { return new ImmutableDescriptor( new String[] {"openType", @@ -380,16 +380,16 @@ class MXBeanIntrospector extends MBeanIntrospector { if (type instanceof GenericArrayType) { return canUseOpenInfo( ((GenericArrayType) type).getGenericComponentType()); - } else if (type instanceof Class && ((Class) type).isArray()) { + } else if (type instanceof Class && ((Class) type).isArray()) { return canUseOpenInfo( ((Class) type).getComponentType()); } - return (!(type instanceof Class && ((Class) type).isPrimitive())); + return (!(type instanceof Class && ((Class) type).isPrimitive())); } private static String originalTypeString(Type type) { - if (type instanceof Class) - return ((Class) type).getName(); + if (type instanceof Class) + return ((Class) type).getName(); else return genericTypeString(type); } diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/ObjectInputStreamWithLoader.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/ObjectInputStreamWithLoader.java index 2c74e5890c0..cbdce77a71e 100644 --- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/ObjectInputStreamWithLoader.java +++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/ObjectInputStreamWithLoader.java @@ -54,7 +54,8 @@ class ObjectInputStreamWithLoader extends ObjectInputStream { this.loader = theLoader; } - protected Class resolveClass(ObjectStreamClass aClass) + @Override + protected Class resolveClass(ObjectStreamClass aClass) throws IOException, ClassNotFoundException { if (loader == null) { return super.resolveClass(aClass); diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/SecureClassLoaderRepository.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/SecureClassLoaderRepository.java index 0576f80ebed..b078bac8f57 100644 --- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/SecureClassLoaderRepository.java +++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/SecureClassLoaderRepository.java @@ -47,16 +47,16 @@ final class SecureClassLoaderRepository public SecureClassLoaderRepository(ClassLoaderRepository clr) { this.clr=clr; } - public final Class loadClass(String className) + public final Class loadClass(String className) throws ClassNotFoundException { return clr.loadClass(className); } - public final Class loadClassWithout(ClassLoader loader, + public final Class loadClassWithout(ClassLoader loader, String className) throws ClassNotFoundException { return clr.loadClassWithout(loader,className); } - public final Class loadClassBefore(ClassLoader loader, + public final Class loadClassBefore(ClassLoader loader, String className) throws ClassNotFoundException { return clr.loadClassBefore(loader,className); diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/Util.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/Util.java index 6307adbf8d9..5fe4d1542cc 100644 --- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/Util.java +++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/Util.java @@ -669,7 +669,7 @@ public class Util { } public static Set cloneSet(Set set) { - if (set instanceof SortedSet) { + if (set instanceof SortedSet) { @SuppressWarnings("unchecked") SortedSet sset = (SortedSet) set; set = new TreeSet(sset.comparator()); @@ -680,7 +680,7 @@ public class Util { } public static Set equivalentEmptySet(Set set) { - if (set instanceof SortedSet) { + if (set instanceof SortedSet) { @SuppressWarnings("unchecked") SortedSet sset = (SortedSet) set; set = new TreeSet(sset.comparator()); diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/WeakIdentityHashMap.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/WeakIdentityHashMap.java index b6662937f93..6f8ed6e9474 100644 --- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/WeakIdentityHashMap.java +++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/WeakIdentityHashMap.java @@ -118,9 +118,9 @@ class WeakIdentityHashMap { public boolean equals(Object o) { if (this == o) return true; - if (!(o instanceof IdentityWeakReference)) + if (!(o instanceof IdentityWeakReference)) return false; - IdentityWeakReference wr = (IdentityWeakReference) o; + IdentityWeakReference wr = (IdentityWeakReference) o; Object got = get(); return (got != null && got == wr.get()); } diff --git a/jdk/src/share/classes/com/sun/jmx/remote/internal/ArrayNotificationBuffer.java b/jdk/src/share/classes/com/sun/jmx/remote/internal/ArrayNotificationBuffer.java index 234f50f22da..cd4de2aae10 100644 --- a/jdk/src/share/classes/com/sun/jmx/remote/internal/ArrayNotificationBuffer.java +++ b/jdk/src/share/classes/com/sun/jmx/remote/internal/ArrayNotificationBuffer.java @@ -120,7 +120,7 @@ public class ArrayNotificationBuffer implements NotificationBuffer { private final Collection sharers = new HashSet(1); public static NotificationBuffer getNotificationBuffer( - MBeanServer mbs, Map env) { + MBeanServer mbs, Map env) { if (env == null) env = Collections.emptyMap(); diff --git a/jdk/src/share/classes/com/sun/jmx/remote/internal/ClientNotifForwarder.java b/jdk/src/share/classes/com/sun/jmx/remote/internal/ClientNotifForwarder.java index ab6bd60caf8..cb94371fdc9 100644 --- a/jdk/src/share/classes/com/sun/jmx/remote/internal/ClientNotifForwarder.java +++ b/jdk/src/share/classes/com/sun/jmx/remote/internal/ClientNotifForwarder.java @@ -54,7 +54,7 @@ import com.sun.jmx.remote.util.EnvHelp; public abstract class ClientNotifForwarder { - public ClientNotifForwarder(Map env) { + public ClientNotifForwarder(Map env) { this(null, env); } @@ -113,7 +113,7 @@ public abstract class ClientNotifForwarder { private Thread thread; } - public ClientNotifForwarder(ClassLoader defaultClassLoader, Map env) { + public ClientNotifForwarder(ClassLoader defaultClassLoader, Map env) { maxNotifications = EnvHelp.getMaxFetchNotifNumber(env); timeout = EnvHelp.getFetchTimeout(env); diff --git a/jdk/src/share/classes/com/sun/jmx/remote/internal/ProxyInputStream.java b/jdk/src/share/classes/com/sun/jmx/remote/internal/ProxyInputStream.java index 8d57b8f92a6..b610828065a 100644 --- a/jdk/src/share/classes/com/sun/jmx/remote/internal/ProxyInputStream.java +++ b/jdk/src/share/classes/com/sun/jmx/remote/internal/ProxyInputStream.java @@ -36,7 +36,7 @@ import org.omg.CORBA.ORB; import org.omg.CORBA.TypeCode; import org.omg.CORBA.portable.BoxedValueHelper; -@SuppressWarnings("deprecation") +@SuppressWarnings({"deprecation", "rawtypes"}) public class ProxyInputStream extends org.omg.CORBA_2_3.portable.InputStream { public ProxyInputStream(org.omg.CORBA.portable.InputStream in) { this.in = in; diff --git a/jdk/src/share/classes/com/sun/jmx/remote/internal/ServerNotifForwarder.java b/jdk/src/share/classes/com/sun/jmx/remote/internal/ServerNotifForwarder.java index c3542cc1d8a..dab9b872d64 100644 --- a/jdk/src/share/classes/com/sun/jmx/remote/internal/ServerNotifForwarder.java +++ b/jdk/src/share/classes/com/sun/jmx/remote/internal/ServerNotifForwarder.java @@ -59,7 +59,7 @@ public class ServerNotifForwarder { public ServerNotifForwarder(MBeanServer mbeanServer, - Map env, + Map env, NotificationBuffer notifBuffer, String connectionId) { this.mbeanServer = mbeanServer; diff --git a/jdk/src/share/classes/com/sun/jmx/remote/internal/Unmarshal.java b/jdk/src/share/classes/com/sun/jmx/remote/internal/Unmarshal.java index 64c00b0174b..614edd464fb 100644 --- a/jdk/src/share/classes/com/sun/jmx/remote/internal/Unmarshal.java +++ b/jdk/src/share/classes/com/sun/jmx/remote/internal/Unmarshal.java @@ -29,6 +29,6 @@ import java.io.IOException; import java.rmi.MarshalledObject; public interface Unmarshal { - public Object get(MarshalledObject mo) + public Object get(MarshalledObject mo) throws IOException, ClassNotFoundException; } diff --git a/jdk/src/share/classes/com/sun/jmx/remote/security/FileLoginModule.java b/jdk/src/share/classes/com/sun/jmx/remote/security/FileLoginModule.java index a901a19c8f8..33cd6b4ce7c 100644 --- a/jdk/src/share/classes/com/sun/jmx/remote/security/FileLoginModule.java +++ b/jdk/src/share/classes/com/sun/jmx/remote/security/FileLoginModule.java @@ -26,6 +26,7 @@ package com.sun.jmx.remote.security; import com.sun.jmx.mbeanserver.GetPropertyAction; +import com.sun.jmx.mbeanserver.Util; import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; @@ -146,8 +147,8 @@ public class FileLoginModule implements LoginModule { // Initial state private Subject subject; private CallbackHandler callbackHandler; - private Map sharedState; - private Map options; + private Map sharedState; + private Map options; private String passwordFile; private String passwordFileDisplayName; private boolean userSuppliedPasswordFile; @@ -172,7 +173,7 @@ public class FileLoginModule implements LoginModule { this.subject = subject; this.callbackHandler = callbackHandler; - this.sharedState = sharedState; + this.sharedState = Util.cast(sharedState); this.options = options; // initialize any configured options @@ -454,8 +455,8 @@ public class FileLoginModule implements LoginModule { if (storePass && !sharedState.containsKey(USERNAME_KEY) && !sharedState.containsKey(PASSWORD_KEY)) { - ((Map) sharedState).put(USERNAME_KEY, username); - ((Map) sharedState).put(PASSWORD_KEY, password); + sharedState.put(USERNAME_KEY, username); + sharedState.put(PASSWORD_KEY, password); } // Create a new user principal diff --git a/jdk/src/share/classes/com/sun/jmx/remote/security/JMXPluggableAuthenticator.java b/jdk/src/share/classes/com/sun/jmx/remote/security/JMXPluggableAuthenticator.java index 631ee3e3b7b..70c72eaf9ef 100644 --- a/jdk/src/share/classes/com/sun/jmx/remote/security/JMXPluggableAuthenticator.java +++ b/jdk/src/share/classes/com/sun/jmx/remote/security/JMXPluggableAuthenticator.java @@ -87,7 +87,7 @@ public final class JMXPluggableAuthenticator implements JMXAuthenticator { * @exception SecurityException if the authentication mechanism cannot be * initialized. */ - public JMXPluggableAuthenticator(Map env) { + public JMXPluggableAuthenticator(Map env) { String loginConfigName = null; String passwordFile = null; diff --git a/jdk/src/share/classes/com/sun/jmx/remote/security/MBeanServerFileAccessController.java b/jdk/src/share/classes/com/sun/jmx/remote/security/MBeanServerFileAccessController.java index 2e90b11bf4b..66c78f2775e 100644 --- a/jdk/src/share/classes/com/sun/jmx/remote/security/MBeanServerFileAccessController.java +++ b/jdk/src/share/classes/com/sun/jmx/remote/security/MBeanServerFileAccessController.java @@ -249,9 +249,8 @@ public class MBeanServerFileAccessController } }); if (s == null) return; /* security has not been enabled */ - final Set principals = s.getPrincipals(); - for (Iterator i = principals.iterator(); i.hasNext(); ) { - final Principal p = (Principal) i.next(); + final Set principals = s.getPrincipals(); + for (Principal p : principals) { String grantedAccessLevel; synchronized (props) { grantedAccessLevel = props.getProperty(p.getName()); @@ -271,8 +270,8 @@ public class MBeanServerFileAccessController } private void checkValues(Properties props) { - Collection c = props.values(); - for (Iterator i = c.iterator(); i.hasNext(); ) { + Collection c = props.values(); + for (Iterator i = c.iterator(); i.hasNext(); ) { final String accessLevel = (String) i.next(); if (!accessLevel.equals(READONLY) && !accessLevel.equals(READWRITE)) { diff --git a/jdk/src/share/classes/com/sun/jmx/remote/util/ClassLoaderWithRepository.java b/jdk/src/share/classes/com/sun/jmx/remote/util/ClassLoaderWithRepository.java index dfbabeb4184..f59f3265f4e 100644 --- a/jdk/src/share/classes/com/sun/jmx/remote/util/ClassLoaderWithRepository.java +++ b/jdk/src/share/classes/com/sun/jmx/remote/util/ClassLoaderWithRepository.java @@ -38,7 +38,7 @@ public class ClassLoaderWithRepository extends ClassLoader { this.cl2 = cl2; } - protected Class findClass(String name) throws ClassNotFoundException { + protected Class findClass(String name) throws ClassNotFoundException { try { return repository.loadClass(name); } catch (ClassNotFoundException cne) { diff --git a/jdk/src/share/classes/com/sun/jmx/remote/util/ClassLogger.java b/jdk/src/share/classes/com/sun/jmx/remote/util/ClassLogger.java index c3a1c451af6..2cd6a02e1ba 100644 --- a/jdk/src/share/classes/com/sun/jmx/remote/util/ClassLogger.java +++ b/jdk/src/share/classes/com/sun/jmx/remote/util/ClassLogger.java @@ -41,7 +41,7 @@ public class ClassLogger { people to use at least J2SE 1.4. */ boolean loaded = false; try { - Class c = java.util.logging.Logger.class; + Class c = java.util.logging.Logger.class; loaded = true; } catch (Error e) { // OK. diff --git a/jdk/src/share/classes/com/sun/jmx/remote/util/EnvHelp.java b/jdk/src/share/classes/com/sun/jmx/remote/util/EnvHelp.java index 67b9ea59561..c86df1c88ee 100644 --- a/jdk/src/share/classes/com/sun/jmx/remote/util/EnvHelp.java +++ b/jdk/src/share/classes/com/sun/jmx/remote/util/EnvHelp.java @@ -117,7 +117,7 @@ public class EnvHelp { * jmx.remote.default.class.loader.name is specified * and the ClassLoader MBean is not found in mbs. */ - public static ClassLoader resolveServerClassLoader(Map env, + public static ClassLoader resolveServerClassLoader(Map env, MBeanServer mbs) throws InstanceNotFoundException { @@ -194,7 +194,7 @@ public class EnvHelp { * jmx.remote.default.class.loader is specified * and is not an instance of {@link ClassLoader}. */ - public static ClassLoader resolveClientClassLoader(Map env) { + public static ClassLoader resolveClientClassLoader(Map env) { if (env == null) return Thread.currentThread().getContextClassLoader(); @@ -241,7 +241,7 @@ public class EnvHelp { try { java.lang.reflect.Method getCause = - t.getClass().getMethod("getCause", (Class[]) null); + t.getClass().getMethod("getCause", (Class[]) null); ret = (Throwable)getCause.invoke(t, (Object[]) null); } catch (Exception e) { @@ -264,7 +264,7 @@ public class EnvHelp { * Returns the size of a notification buffer for a connector server. * The default value is 1000. */ - public static int getNotifBufferSize(Map env) { + public static int getNotifBufferSize(Map env) { int defaultQueueSize = 1000; // default value // keep it for the compability for the fix: @@ -327,7 +327,7 @@ public class EnvHelp { * Returns the maximum notification number which a client will * fetch every time. */ - public static int getMaxFetchNotifNumber(Map env) { + public static int getMaxFetchNotifNumber(Map env) { return (int) getIntegerAttribute(env, MAX_FETCH_NOTIFS, 1000, 1, Integer.MAX_VALUE); } @@ -344,7 +344,7 @@ public class EnvHelp { /** * Returns the timeout for a client to fetch notifications. */ - public static long getFetchTimeout(Map env) { + public static long getFetchTimeout(Map env) { return getIntegerAttribute(env, FETCH_TIMEOUT, 60000L, 0, Long.MAX_VALUE); } @@ -361,7 +361,7 @@ public class EnvHelp { "com.sun.jmx.remote.notification.access.controller"; public static NotificationAccessController getNotificationAccessController( - Map env) { + Map env) { return (env == null) ? null : (NotificationAccessController) env.get(NOTIF_ACCESS_CONTROLLER); } @@ -378,7 +378,7 @@ public class EnvHelp { * an entry for name but it does not meet the * constraints above. */ - public static long getIntegerAttribute(Map env, String name, + public static long getIntegerAttribute(Map env, String name, long defaultValue, long minValue, long maxValue) { final Object o; @@ -421,9 +421,8 @@ public class EnvHelp { /* Check that all attributes have a key that is a String. Could make further checks, e.g. appropriate types for attributes. */ - public static void checkAttributes(Map attributes) { - for (Iterator it = attributes.keySet().iterator(); it.hasNext(); ) { - Object key = it.next(); + public static void checkAttributes(Map attributes) { + for (Object key : attributes.keySet()) { if (!(key instanceof String)) { final String msg = "Attributes contain key that is not a string: " + key; @@ -455,7 +454,7 @@ public class EnvHelp { logger.trace("purgeUnserializable", "starts"); ObjectOutputStream oos = null; int i = 0; - for (Iterator it = objects.iterator(); it.hasNext(); i++) { + for (Iterator it = objects.iterator(); it.hasNext(); i++) { Object v = it.next(); if (v == null || v instanceof String) { @@ -564,18 +563,18 @@ public class EnvHelp { guarantees that we will never call next() on the corresponding iterator. */ String sentinelKey = map.lastKey() + "X"; - Iterator keyIterator = map.keySet().iterator(); - Iterator stringIterator = hiddenStrings.iterator(); - Iterator prefixIterator = hiddenPrefixes.iterator(); + Iterator keyIterator = map.keySet().iterator(); + Iterator stringIterator = hiddenStrings.iterator(); + Iterator prefixIterator = hiddenPrefixes.iterator(); String nextString; if (stringIterator.hasNext()) - nextString = (String) stringIterator.next(); + nextString = stringIterator.next(); else nextString = sentinelKey; String nextPrefix; if (prefixIterator.hasNext()) - nextPrefix = (String) prefixIterator.next(); + nextPrefix = prefixIterator.next(); else nextPrefix = sentinelKey; @@ -583,7 +582,7 @@ public class EnvHelp { or prefix, remove it. */ keys: while (keyIterator.hasNext()) { - String key = (String) keyIterator.next(); + String key = keyIterator.next(); /* Continue through string-match values until we find one that is either greater than the current key, or equal @@ -591,7 +590,7 @@ public class EnvHelp { int cmp = +1; while ((cmp = nextString.compareTo(key)) < 0) { if (stringIterator.hasNext()) - nextString = (String) stringIterator.next(); + nextString = stringIterator.next(); else nextString = sentinelKey; } @@ -609,7 +608,7 @@ public class EnvHelp { continue keys; } if (prefixIterator.hasNext()) - nextPrefix = (String) prefixIterator.next(); + nextPrefix = prefixIterator.next(); else nextPrefix = sentinelKey; } @@ -640,7 +639,7 @@ public class EnvHelp { /** * Returns the server side connection timeout. */ - public static long getServerConnectionTimeout(Map env) { + public static long getServerConnectionTimeout(Map env) { return getIntegerAttribute(env, SERVER_CONNECTION_TIMEOUT, 120000L, 0, Long.MAX_VALUE); } @@ -656,7 +655,7 @@ public class EnvHelp { /** * Returns the client connection check period. */ - public static long getConnectionCheckPeriod(Map env) { + public static long getConnectionCheckPeriod(Map env) { return getIntegerAttribute(env, CLIENT_CONNECTION_CHECK_PERIOD, 60000L, 0, Long.MAX_VALUE); } @@ -691,7 +690,7 @@ public class EnvHelp { * to {@code String}. */ public static boolean computeBooleanFromString( - Map env, String prop, boolean systemProperty) { + Map env, String prop, boolean systemProperty) { if (env == null) throw new IllegalArgumentException("env map cannot be null"); @@ -744,7 +743,8 @@ public class EnvHelp { * to {@code String}. */ public static boolean computeBooleanFromString( - Map env, String prop, boolean systemProperty, boolean defaultValue) { + Map env, String prop, + boolean systemProperty, boolean defaultValue) { if (env == null) throw new IllegalArgumentException("env map cannot be null"); @@ -774,7 +774,7 @@ public class EnvHelp { public static Hashtable mapToHashtable(Map map) { HashMap m = new HashMap(map); if (m.containsKey(null)) m.remove(null); - for (Iterator i = m.values().iterator(); i.hasNext(); ) + for (Iterator i = m.values().iterator(); i.hasNext(); ) if (i.next() == null) i.remove(); return new Hashtable(m); } @@ -783,7 +783,7 @@ public class EnvHelp { * Returns true if the parameter JMXConnector.USE_EVENT_SERVICE is set to a * String equals "true" by ignoring case in the map or in the System. */ - public static boolean eventServiceEnabled(Map env) { + public static boolean eventServiceEnabled(Map env) { return computeBooleanFromString(env, JMXConnector.USE_EVENT_SERVICE, true); } @@ -793,7 +793,7 @@ public class EnvHelp { * If the property DELEGATE_TO_EVENT_SERVICE is not set, returns * a default value of "true". */ - public static boolean delegateToEventService(Map env) { + public static boolean delegateToEventService(Map env) { return computeBooleanFromString(env, JMXConnectorServer.DELEGATE_TO_EVENT_SERVICE, true, true); } diff --git a/jdk/src/share/classes/com/sun/jmx/remote/util/EventClientConnection.java b/jdk/src/share/classes/com/sun/jmx/remote/util/EventClientConnection.java index 6281b68a574..b660898731a 100644 --- a/jdk/src/share/classes/com/sun/jmx/remote/util/EventClientConnection.java +++ b/jdk/src/share/classes/com/sun/jmx/remote/util/EventClientConnection.java @@ -138,8 +138,8 @@ public class EventClientConnection implements InvocationHandler, Class interfaceClass, Callable eventClientFactory) { final InvocationHandler handler = new EventClientConnection(connection,eventClientFactory); - final Class[] interfaces = - new Class[] {interfaceClass, EventClientFactory.class}; + final Class[] interfaces = + new Class[] {interfaceClass, EventClientFactory.class}; Object proxy = Proxy.newProxyInstance(interfaceClass.getClassLoader(), @@ -156,7 +156,7 @@ public class EventClientConnection implements InvocationHandler, // add/remove notification listener are routed to the EventClient if (methodName.equals("addNotificationListener") || methodName.equals("removeNotificationListener")) { - final Class[] sig = method.getParameterTypes(); + final Class[] sig = method.getParameterTypes(); if (sig.length>1 && NotificationListener.class.isAssignableFrom(sig[1])) { return invokeBroadcasterMethod(proxy,method,args); @@ -164,7 +164,7 @@ public class EventClientConnection implements InvocationHandler, } // subscribe/unsubscribe are also routed to the EventClient. - final Class clazz = method.getDeclaringClass(); + final Class clazz = method.getDeclaringClass(); if (clazz.equals(EventClientFactory.class)) { return invokeEventClientSubscriberMethod(proxy,method,args); } @@ -319,7 +319,7 @@ public class EventClientConnection implements InvocationHandler, return true; if (methodName.equals("equals") && Arrays.equals(method.getParameterTypes(), - new Class[] {Object.class}) + new Class[] {Object.class}) && isLocal(proxy, method)) return true; return false; diff --git a/jdk/src/share/classes/com/sun/jmx/remote/util/OrderClassLoaders.java b/jdk/src/share/classes/com/sun/jmx/remote/util/OrderClassLoaders.java index b54a23b2bb1..041736310c1 100644 --- a/jdk/src/share/classes/com/sun/jmx/remote/util/OrderClassLoaders.java +++ b/jdk/src/share/classes/com/sun/jmx/remote/util/OrderClassLoaders.java @@ -32,7 +32,7 @@ public class OrderClassLoaders extends ClassLoader { this.cl2 = cl2; } - protected Class findClass(String name) throws ClassNotFoundException { + protected Class findClass(String name) throws ClassNotFoundException { try { return super.findClass(name); } catch (ClassNotFoundException cne) { diff --git a/jdk/src/share/classes/javax/management/AttributeList.java b/jdk/src/share/classes/javax/management/AttributeList.java index b385c3c0f79..1ce3004a337 100644 --- a/jdk/src/share/classes/javax/management/AttributeList.java +++ b/jdk/src/share/classes/javax/management/AttributeList.java @@ -159,7 +159,7 @@ public class AttributeList extends ArrayList { checkTypeSafe(this); typeSafe = true; } - return (List) (List) this; + return (List) (List) this; } /** diff --git a/jdk/src/share/classes/javax/management/DefaultLoaderRepository.java b/jdk/src/share/classes/javax/management/DefaultLoaderRepository.java index 6cf16435ad6..85028b44c50 100644 --- a/jdk/src/share/classes/javax/management/DefaultLoaderRepository.java +++ b/jdk/src/share/classes/javax/management/DefaultLoaderRepository.java @@ -62,7 +62,7 @@ public class DefaultLoaderRepository { * * @exception ClassNotFoundException The specified class could not be found. */ - public static Class loadClass(String className) + public static Class loadClass(String className) throws ClassNotFoundException { return javax.management.loading.DefaultLoaderRepository.loadClass(className); } @@ -82,7 +82,7 @@ public class DefaultLoaderRepository { * * @exception ClassNotFoundException The specified class could not be found. */ - public static Class loadClassWithout(ClassLoader loader,String className) + public static Class loadClassWithout(ClassLoader loader,String className) throws ClassNotFoundException { return javax.management.loading.DefaultLoaderRepository.loadClassWithout(loader, className); } diff --git a/jdk/src/share/classes/javax/management/JMRuntimeException.java b/jdk/src/share/classes/javax/management/JMRuntimeException.java index c27ec1a561b..70998c8a2d8 100644 --- a/jdk/src/share/classes/javax/management/JMRuntimeException.java +++ b/jdk/src/share/classes/javax/management/JMRuntimeException.java @@ -70,7 +70,7 @@ public class JMRuntimeException extends RuntimeException { try { java.lang.reflect.Method initCause = Throwable.class.getMethod("initCause", - new Class[] {Throwable.class}); + new Class[] {Throwable.class}); initCause.invoke(this, new Object[] {cause}); } catch (Exception e) { // OK: just means we won't have debugging info diff --git a/jdk/src/share/classes/javax/management/JMX.java b/jdk/src/share/classes/javax/management/JMX.java index 87c7dd227ce..82704db0a47 100644 --- a/jdk/src/share/classes/javax/management/JMX.java +++ b/jdk/src/share/classes/javax/management/JMX.java @@ -703,12 +703,12 @@ public class JMX { InvocationHandler handler = new MBeanServerInvocationHandler( connection, objectName, opts); - final Class[] interfaces; + final Class[] interfaces; if (notificationEmitter) { interfaces = new Class[] {interfaceClass, NotificationEmitter.class}; } else - interfaces = new Class[] {interfaceClass}; + interfaces = new Class[] {interfaceClass}; Object proxy = Proxy.newProxyInstance( interfaceClass.getClassLoader(), interfaces, diff --git a/jdk/src/share/classes/javax/management/MBeanAttributeInfo.java b/jdk/src/share/classes/javax/management/MBeanAttributeInfo.java index 5b41bb4b63c..2566c3e48a2 100644 --- a/jdk/src/share/classes/javax/management/MBeanAttributeInfo.java +++ b/jdk/src/share/classes/javax/management/MBeanAttributeInfo.java @@ -316,7 +316,7 @@ public class MBeanAttributeInfo extends MBeanFeatureInfo implements Cloneable { */ private static String attributeType(Method getter, Method setter) throws IntrospectionException { - Class type = null; + Class type = null; if (getter != null) { if (getter.getParameterTypes().length != 0) { @@ -330,7 +330,7 @@ public class MBeanAttributeInfo extends MBeanFeatureInfo implements Cloneable { } if (setter != null) { - Class params[] = setter.getParameterTypes(); + Class params[] = setter.getParameterTypes(); if (params.length != 1) { throw new IntrospectionException("bad setter arg count"); } diff --git a/jdk/src/share/classes/javax/management/MBeanConstructorInfo.java b/jdk/src/share/classes/javax/management/MBeanConstructorInfo.java index f66502e2f06..872c723e3af 100644 --- a/jdk/src/share/classes/javax/management/MBeanConstructorInfo.java +++ b/jdk/src/share/classes/javax/management/MBeanConstructorInfo.java @@ -64,7 +64,7 @@ public class MBeanConstructorInfo extends MBeanFeatureInfo implements Cloneable * @param constructor The java.lang.reflect.Constructor * object describing the MBean constructor. */ - public MBeanConstructorInfo(String description, Constructor constructor) { + public MBeanConstructorInfo(String description, Constructor constructor) { this(constructor.getName(), description, constructorSignature(constructor), Introspector.descriptorForElement(constructor)); @@ -210,8 +210,8 @@ public class MBeanConstructorInfo extends MBeanFeatureInfo implements Cloneable return hash; } - private static MBeanParameterInfo[] constructorSignature(Constructor cn) { - final Class[] classes = cn.getParameterTypes(); + private static MBeanParameterInfo[] constructorSignature(Constructor cn) { + final Class[] classes = cn.getParameterTypes(); final Annotation[][] annots = cn.getParameterAnnotations(); return MBeanOperationInfo.parameters(classes, annots); } diff --git a/jdk/src/share/classes/javax/management/MBeanInfo.java b/jdk/src/share/classes/javax/management/MBeanInfo.java index 9e30d44a51d..722e96fedd9 100644 --- a/jdk/src/share/classes/javax/management/MBeanInfo.java +++ b/jdk/src/share/classes/javax/management/MBeanInfo.java @@ -524,8 +524,8 @@ public class MBeanInfo implements Cloneable, Serializable, DescriptorRead { * a WeakHashMap so that we don't prevent a class from being * garbage collected just because we know whether it's immutable. */ - private static final Map arrayGettersSafeMap = - new WeakHashMap(); + private static final Map, Boolean> arrayGettersSafeMap = + new WeakHashMap, Boolean>(); /** * Return true if subclass is known to preserve the @@ -537,7 +537,7 @@ public class MBeanInfo implements Cloneable, Serializable, DescriptorRead { * This is obviously not an infallible test for immutability, * but it works for the public interfaces of the MBean*Info classes. */ - static boolean arrayGettersSafe(Class subclass, Class immutableClass) { + static boolean arrayGettersSafe(Class subclass, Class immutableClass) { if (subclass == immutableClass) return true; synchronized (arrayGettersSafeMap) { diff --git a/jdk/src/share/classes/javax/management/MBeanOperationInfo.java b/jdk/src/share/classes/javax/management/MBeanOperationInfo.java index e3c26df5265..006fc345d93 100644 --- a/jdk/src/share/classes/javax/management/MBeanOperationInfo.java +++ b/jdk/src/share/classes/javax/management/MBeanOperationInfo.java @@ -308,17 +308,18 @@ public class MBeanOperationInfo extends MBeanFeatureInfo implements Cloneable { wrong should be less than the penalty we would pay if it were right and we needlessly hashed in the description and the parameter array. */ + @Override public int hashCode() { return getName().hashCode() ^ getReturnType().hashCode(); } private static MBeanParameterInfo[] methodSignature(Method method) { - final Class[] classes = method.getParameterTypes(); + final Class[] classes = method.getParameterTypes(); final Annotation[][] annots = method.getParameterAnnotations(); return parameters(classes, annots); } - static MBeanParameterInfo[] parameters(Class[] classes, + static MBeanParameterInfo[] parameters(Class[] classes, Annotation[][] annots) { final MBeanParameterInfo[] params = new MBeanParameterInfo[classes.length]; diff --git a/jdk/src/share/classes/javax/management/MBeanServerFactory.java b/jdk/src/share/classes/javax/management/MBeanServerFactory.java index 365f2a7d9b5..e0225200d83 100644 --- a/jdk/src/share/classes/javax/management/MBeanServerFactory.java +++ b/jdk/src/share/classes/javax/management/MBeanServerFactory.java @@ -747,7 +747,7 @@ public class MBeanServerFactory { * Load the builder class through the context class loader. * @param builderClassName The name of the builder class. **/ - private static Class loadBuilderClass(String builderClassName) + private static Class loadBuilderClass(String builderClassName) throws ClassNotFoundException { final ClassLoader loader = Thread.currentThread().getContextClassLoader(); @@ -767,7 +767,7 @@ public class MBeanServerFactory { * If any checked exception needs to be thrown, it is embedded in * a JMRuntimeException. **/ - private static MBeanServerBuilder newBuilder(Class builderClass) { + private static MBeanServerBuilder newBuilder(Class builderClass) { try { final Object abuilder = builderClass.newInstance(); return (MBeanServerBuilder)abuilder; @@ -792,7 +792,7 @@ public class MBeanServerFactory { String builderClassName = AccessController.doPrivileged(act); try { - final Class newBuilderClass; + final Class newBuilderClass; if (builderClassName == null || builderClassName.length() == 0) newBuilderClass = MBeanServerBuilder.class; else @@ -800,7 +800,7 @@ public class MBeanServerFactory { // Check whether a new builder needs to be created if (builder != null) { - final Class builderClass = builder.getClass(); + final Class builderClass = builder.getClass(); if (newBuilderClass == builderClass) return; // no need to create a new builder... } diff --git a/jdk/src/share/classes/javax/management/MBeanServerInvocationHandler.java b/jdk/src/share/classes/javax/management/MBeanServerInvocationHandler.java index f111e577bf1..936b03ce489 100644 --- a/jdk/src/share/classes/javax/management/MBeanServerInvocationHandler.java +++ b/jdk/src/share/classes/javax/management/MBeanServerInvocationHandler.java @@ -253,12 +253,12 @@ public class MBeanServerInvocationHandler implements InvocationHandler { boolean notificationBroadcaster) { final InvocationHandler handler = new MBeanServerInvocationHandler(connection, objectName); - final Class[] interfaces; + final Class[] interfaces; if (notificationBroadcaster) { interfaces = - new Class[] {interfaceClass, NotificationEmitter.class}; + new Class[] {interfaceClass, NotificationEmitter.class}; } else - interfaces = new Class[] {interfaceClass}; + interfaces = new Class[] {interfaceClass}; Object proxy = Proxy.newProxyInstance(interfaceClass.getClassLoader(), @@ -269,7 +269,7 @@ public class MBeanServerInvocationHandler implements InvocationHandler { public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { - final Class methodClass = method.getDeclaringClass(); + final Class methodClass = method.getDeclaringClass(); if (methodClass.equals(NotificationBroadcaster.class) || methodClass.equals(NotificationEmitter.class)) @@ -285,8 +285,8 @@ public class MBeanServerInvocationHandler implements InvocationHandler { return p.invoke(connection, objectName, method, args); } else { final String methodName = method.getName(); - final Class[] paramTypes = method.getParameterTypes(); - final Class returnType = method.getReturnType(); + final Class[] paramTypes = method.getParameterTypes(); + final Class returnType = method.getReturnType(); /* Inexplicably, InvocationHandler specifies that args is null when the method takes no arguments rather than a @@ -452,7 +452,7 @@ public class MBeanServerInvocationHandler implements InvocationHandler { return true; if (methodName.equals("equals") && Arrays.equals(method.getParameterTypes(), - new Class[] {Object.class}) + new Class[] {Object.class}) && isLocal(proxy, method)) return true; return false; diff --git a/jdk/src/share/classes/javax/management/StandardMBean.java b/jdk/src/share/classes/javax/management/StandardMBean.java index a779e8282bb..492b259d189 100644 --- a/jdk/src/share/classes/javax/management/StandardMBean.java +++ b/jdk/src/share/classes/javax/management/StandardMBean.java @@ -689,7 +689,7 @@ public class StandardMBean implements DynamicWrapperMBean, MBeanRegistration { getImplementationClass().getName()); } - MBeanSupport msupport = mbean; + MBeanSupport msupport = mbean; final MBeanInfo bi = msupport.getMBeanInfo(); final Object impl = msupport.getWrappedObject(); @@ -1391,8 +1391,8 @@ public class StandardMBean implements DynamicWrapperMBean, MBeanRegistration { * garbage collected just because we know whether its MBeanInfo * is immutable. */ - private static final Map mbeanInfoSafeMap = - new WeakHashMap(); + private static final Map, Boolean> mbeanInfoSafeMap = + new WeakHashMap, Boolean>(); /** * Return true if {@code subclass} is known to preserve the immutability @@ -1438,9 +1438,9 @@ public class StandardMBean implements DynamicWrapperMBean, MBeanRegistration { private static class MBeanInfoSafeAction implements PrivilegedAction { - private final Class subclass; + private final Class subclass; - MBeanInfoSafeAction(Class subclass) { + MBeanInfoSafeAction(Class subclass) { this.subclass = subclass; } @@ -1454,13 +1454,13 @@ public class StandardMBean implements DynamicWrapperMBean, MBeanRegistration { // Check for "MBeanInfo getCachedMBeanInfo()" method. // if (overrides(subclass, StandardMBean.class, - "getCachedMBeanInfo", (Class[]) null)) + "getCachedMBeanInfo", (Class[]) null)) return false; // Check for "MBeanInfo getMBeanInfo()" method. // if (overrides(subclass, StandardMBean.class, - "getMBeanInfo", (Class[]) null)) + "getMBeanInfo", (Class[]) null)) return false; // Check for "MBeanNotificationInfo[] getNotificationInfo()" @@ -1473,7 +1473,7 @@ public class StandardMBean implements DynamicWrapperMBean, MBeanRegistration { // if (StandardEmitterMBean.class.isAssignableFrom(subclass)) if (overrides(subclass, StandardEmitterMBean.class, - "getNotificationInfo", (Class[]) null)) + "getNotificationInfo", (Class[]) null)) return false; return true; } diff --git a/jdk/src/share/classes/javax/management/event/EventClientDelegate.java b/jdk/src/share/classes/javax/management/event/EventClientDelegate.java index 8d144123a87..13329ea9e6f 100644 --- a/jdk/src/share/classes/javax/management/event/EventClientDelegate.java +++ b/jdk/src/share/classes/javax/management/event/EventClientDelegate.java @@ -104,8 +104,8 @@ public class EventClientDelegate implements EventClientDelegateMBean { public static EventClientDelegate getEventClientDelegate(MBeanServer server) { EventClientDelegate delegate = null; synchronized(delegateMap) { - final WeakReference wrf = delegateMap.get(server); - delegate = (wrf == null) ? null : (EventClientDelegate)wrf.get(); + final WeakReference wrf = delegateMap.get(server); + delegate = (wrf == null) ? null : wrf.get(); if (delegate == null) { delegate = new EventClientDelegate(server); @@ -282,7 +282,7 @@ public class EventClientDelegate implements EventClientDelegateMBean { Constructor foundCons = null; if (sig == null) sig = new String[0]; - for (Constructor cons : c.getConstructors()) { + for (Constructor cons : c.getConstructors()) { Class[] types = cons.getParameterTypes(); String[] consSig = new String[types.length]; for (int i = 0; i < types.length; i++) diff --git a/jdk/src/share/classes/javax/management/event/EventSubscriber.java b/jdk/src/share/classes/javax/management/event/EventSubscriber.java index 9948810bfeb..5a472b5adb5 100644 --- a/jdk/src/share/classes/javax/management/event/EventSubscriber.java +++ b/jdk/src/share/classes/javax/management/event/EventSubscriber.java @@ -350,8 +350,7 @@ public class EventSubscriber implements EventConsumer { static { QueryExp broadcasterExp; try { - final Method m = Query.class.getMethod("isInstanceOf", - new Class[] {String.class}); + final Method m = Query.class.getMethod("isInstanceOf", String.class); broadcasterExp = (QueryExp)m.invoke(Query.class, new Object[] {NotificationBroadcaster.class.getName()}); } catch (Exception e) { diff --git a/jdk/src/share/classes/javax/management/loading/DefaultLoaderRepository.java b/jdk/src/share/classes/javax/management/loading/DefaultLoaderRepository.java index 0d514dd780a..5c2717c256d 100644 --- a/jdk/src/share/classes/javax/management/loading/DefaultLoaderRepository.java +++ b/jdk/src/share/classes/javax/management/loading/DefaultLoaderRepository.java @@ -69,7 +69,7 @@ public class DefaultLoaderRepository { * @exception ClassNotFoundException The specified class could not be * found. */ - public static Class loadClass(String className) + public static Class loadClass(String className) throws ClassNotFoundException { MBEANSERVER_LOGGER.logp(Level.FINEST, DefaultLoaderRepository.class.getName(), @@ -93,7 +93,7 @@ public class DefaultLoaderRepository { * @exception ClassNotFoundException The specified class could not be * found. */ - public static Class loadClassWithout(ClassLoader loader, + public static Class loadClassWithout(ClassLoader loader, String className) throws ClassNotFoundException { MBEANSERVER_LOGGER.logp(Level.FINEST, @@ -102,12 +102,11 @@ public class DefaultLoaderRepository { return load(loader, className); } - private static Class load(ClassLoader without, String className) + private static Class load(ClassLoader without, String className) throws ClassNotFoundException { - final List mbsList = MBeanServerFactory.findMBeanServer(null); + final List mbsList = MBeanServerFactory.findMBeanServer(null); - for (Iterator it = mbsList.iterator(); it.hasNext(); ) { - MBeanServer mbs = (MBeanServer) it.next(); + for (MBeanServer mbs : mbsList) { ClassLoaderRepository clr = mbs.getClassLoaderRepository(); try { return clr.loadClassWithout(without, className); diff --git a/jdk/src/share/classes/javax/management/loading/MLet.java b/jdk/src/share/classes/javax/management/loading/MLet.java index d6540591e98..c006dc09b11 100644 --- a/jdk/src/share/classes/javax/management/loading/MLet.java +++ b/jdk/src/share/classes/javax/management/loading/MLet.java @@ -1291,7 +1291,7 @@ public class MLet extends java.net.URLClassLoader if (c != null) { try { Constructor cons = - c.getConstructor(new Class[] {String.class}); + c.getConstructor(String.class); Object[] oo = new Object[1]; oo[0]=param; return(cons.newInstance(oo)); diff --git a/jdk/src/share/classes/javax/management/loading/MLetObjectInputStream.java b/jdk/src/share/classes/javax/management/loading/MLetObjectInputStream.java index 8f9ea4cc69a..06262dc5aed 100644 --- a/jdk/src/share/classes/javax/management/loading/MLetObjectInputStream.java +++ b/jdk/src/share/classes/javax/management/loading/MLetObjectInputStream.java @@ -55,30 +55,30 @@ class MLetObjectInputStream extends ObjectInputStream { this.loader = loader; } - private Class primitiveType(char c) { + private Class primitiveType(char c) { switch(c) { - case 66: /* 'B' */ + case 'B': return Byte.TYPE; - case 67: /* 'C' */ + case 'C': return Character.TYPE; - case 68: /* 'D' */ + case 'D': return Double.TYPE; - case 70: /* 'F' */ + case 'F': return Float.TYPE; - case 73: /* 'I' */ + case 'I': return Integer.TYPE; - case 74: /* 'J' */ + case 'J': return Long.TYPE; - case 83: /* 'S' */ + case 'S': return Short.TYPE; - case 90: /* 'Z' */ + case 'Z': return Boolean.TYPE; } return null; @@ -87,14 +87,15 @@ class MLetObjectInputStream extends ObjectInputStream { /** * Use the given ClassLoader rather than using the system class */ - protected Class resolveClass(ObjectStreamClass objectstreamclass) + @Override + protected Class resolveClass(ObjectStreamClass objectstreamclass) throws IOException, ClassNotFoundException { String s = objectstreamclass.getName(); if (s.startsWith("[")) { int i; for (i = 1; s.charAt(i) == '['; i++); - Class class1; + Class class1; if (s.charAt(i) == 'L') { class1 = loader.loadClass(s.substring(i + 1, s.length() - 1)); } else { diff --git a/jdk/src/share/classes/javax/management/modelmbean/DescriptorSupport.java b/jdk/src/share/classes/javax/management/modelmbean/DescriptorSupport.java index 66b8fec8b9a..4e9db9dcd54 100644 --- a/jdk/src/share/classes/javax/management/modelmbean/DescriptorSupport.java +++ b/jdk/src/share/classes/javax/management/modelmbean/DescriptorSupport.java @@ -589,7 +589,7 @@ public class DescriptorSupport int numberOfEntries = descriptorMap.size(); String[] responseFields = new String[numberOfEntries]; - Set returnedSet = descriptorMap.entrySet(); + Set> returnedSet = descriptorMap.entrySet(); int i = 0; @@ -598,8 +598,9 @@ public class DescriptorSupport DescriptorSupport.class.getName(), "getFields()", "Returning " + numberOfEntries + " fields"); } - for (Iterator iter = returnedSet.iterator(); iter.hasNext(); i++) { - Map.Entry currElement = (Map.Entry) iter.next(); + for (Iterator> iter = returnedSet.iterator(); + iter.hasNext(); i++) { + Map.Entry currElement = iter.next(); if (currElement == null) { if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { @@ -642,7 +643,7 @@ public class DescriptorSupport int numberOfEntries = descriptorMap.size(); String[] responseFields = new String[numberOfEntries]; - Set returnedSet = descriptorMap.entrySet(); + Set> returnedSet = descriptorMap.entrySet(); int i = 0; @@ -653,8 +654,9 @@ public class DescriptorSupport "Returning " + numberOfEntries + " fields"); } - for (Iterator iter = returnedSet.iterator(); iter.hasNext(); i++) { - Map.Entry currElement = (Map.Entry) iter.next(); + for (Iterator> iter = returnedSet.iterator(); + iter.hasNext(); i++) { + Map.Entry currElement = iter.next(); if (( currElement == null ) || (currElement.getKey() == null)) { if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { @@ -700,9 +702,8 @@ public class DescriptorSupport } if (fieldNames == null) { - for (Iterator iter = descriptorMap.values().iterator(); - iter.hasNext(); i++) - responseFields[i] = iter.next(); + for (Object value : descriptorMap.values()) + responseFields[i++] = value; } else { for (i=0; i < fieldNames.length; i++) { if ((fieldNames[i] == null) || (fieldNames[i].equals(""))) { @@ -904,7 +905,7 @@ public class DescriptorSupport } // verify that the descriptor is valid, by iterating over each field... - Set returnedSet = descriptorMap.entrySet(); + Set> returnedSet = descriptorMap.entrySet(); if (returnedSet == null) { // null descriptor, not valid if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { @@ -925,9 +926,7 @@ public class DescriptorSupport // According to the descriptor type we validate the fields contained - for (Iterator iter = returnedSet.iterator(); iter.hasNext();) { - Map.Entry currElement = (Map.Entry) iter.next(); - + for (Map.Entry currElement : returnedSet) { if (currElement != null) { if (currElement.getValue() != null) { // validate the field valued... @@ -1083,10 +1082,9 @@ public class DescriptorSupport */ public synchronized String toXMLString() { final StringBuilder buf = new StringBuilder(""); - Set returnedSet = descriptorMap.entrySet(); - for (Iterator iter = returnedSet.iterator(); iter.hasNext(); ) { - final Map.Entry currElement = (Map.Entry) iter.next(); - final String name = currElement.getKey().toString(); + Set> returnedSet = descriptorMap.entrySet(); + for (Map.Entry currElement : returnedSet) { + final String name = currElement.getKey(); Object value = currElement.getValue(); String valueString = null; /* Set valueString to non-null if and only if this is a string that @@ -1256,7 +1254,7 @@ public class DescriptorSupport } final Class c = Class.forName(className, false, contextClassLoader); - constr = c.getConstructor(new Class[] {String.class}); + constr = c.getConstructor(new Class[] {String.class}); } catch (Exception e) { throw new XMLParseException(e, "Cannot parse value: <" + s + ">"); diff --git a/jdk/src/share/classes/javax/management/modelmbean/ModelMBeanConstructorInfo.java b/jdk/src/share/classes/javax/management/modelmbean/ModelMBeanConstructorInfo.java index a6e7ceab737..89948d5c92c 100644 --- a/jdk/src/share/classes/javax/management/modelmbean/ModelMBeanConstructorInfo.java +++ b/jdk/src/share/classes/javax/management/modelmbean/ModelMBeanConstructorInfo.java @@ -152,7 +152,7 @@ public class ModelMBeanConstructorInfo * describing the MBean constructor. */ public ModelMBeanConstructorInfo(String description, - Constructor constructorMethod) + Constructor constructorMethod) { super(description, constructorMethod); if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) { @@ -194,7 +194,7 @@ public class ModelMBeanConstructorInfo */ public ModelMBeanConstructorInfo(String description, - Constructor constructorMethod, + Constructor constructorMethod, Descriptor descriptor) { diff --git a/jdk/src/share/classes/javax/management/modelmbean/RequiredModelMBean.java b/jdk/src/share/classes/javax/management/modelmbean/RequiredModelMBean.java index 7d99fba0021..b9bec5ecc86 100644 --- a/jdk/src/share/classes/javax/management/modelmbean/RequiredModelMBean.java +++ b/jdk/src/share/classes/javax/management/modelmbean/RequiredModelMBean.java @@ -1074,7 +1074,7 @@ public class RequiredModelMBean } } - final Class targetClass; + final Class targetClass; if (opClassName != null) { try { @@ -1126,20 +1126,20 @@ public class RequiredModelMBean "resolving " + targetClass.getName() + "." + opMethodName); } - final Class[] argClasses; + final Class[] argClasses; if (sig == null) argClasses = null; else { final ClassLoader targetClassLoader = targetClass.getClassLoader(); - argClasses = new Class[sig.length]; + argClasses = new Class[sig.length]; for (int i = 0; i < sig.length; i++) { if (tracing) { MODELMBEAN_LOGGER.logp(Level.FINER, RequiredModelMBean.class.getName(),"resolveMethod", "resolve type " + sig[i]); } - argClasses[i] = (Class) primitiveClassMap.get(sig[i]); + argClasses[i] = (Class) primitiveClassMap.get(sig[i]); if (argClasses[i] == null) { try { argClasses[i] = @@ -1170,7 +1170,7 @@ public class RequiredModelMBean /* Map e.g. "int" to int.class. Goodness knows how many time this particular wheel has been reinvented. */ - private static final Class[] primitiveClasses = { + private static final Class[] primitiveClasses = { int.class, long.class, boolean.class, double.class, float.class, short.class, byte.class, char.class, }; @@ -1178,7 +1178,7 @@ public class RequiredModelMBean new HashMap>(); static { for (int i = 0; i < primitiveClasses.length; i++) { - final Class c = primitiveClasses[i]; + final Class c = primitiveClasses[i]; primitiveClassMap.put(c.getName(), c); } } @@ -1645,7 +1645,7 @@ public class RequiredModelMBean try { ClassLoader cl = response.getClass().getClassLoader(); - Class c = Class.forName(respType, true, cl); + Class c = Class.forName(respType, true, cl); subtype = c.isInstance(response); } catch (Exception e) { subtype = false; @@ -1904,7 +1904,7 @@ public class RequiredModelMBean if (attrSetMethod == null) { if (attrValue != null) { try { - final Class clazz = loadClass(attrType); + final Class clazz = loadClass(attrType); if (! clazz.isInstance(attrValue)) throw new InvalidAttributeValueException(clazz.getName() + " expected, " + @@ -2044,8 +2044,7 @@ public class RequiredModelMBean final AttributeList responseList = new AttributeList(); // Go through the list of attributes - for (Iterator i = attributes.iterator(); i.hasNext();) { - final Attribute attr = (Attribute) i.next(); + for (Attribute attr : attributes.asList()) { try { setAttribute(attr); responseList.add(attr); @@ -2799,7 +2798,7 @@ public class RequiredModelMBean return MBeanServerFactory.getClassLoaderRepository(server); } - private Class loadClass(String className) + private Class loadClass(String className) throws ClassNotFoundException { try { return Class.forName(className); diff --git a/jdk/src/share/classes/javax/management/openmbean/ArrayType.java b/jdk/src/share/classes/javax/management/openmbean/ArrayType.java index 49c8bbf1f63..0cbb677cf88 100644 --- a/jdk/src/share/classes/javax/management/openmbean/ArrayType.java +++ b/jdk/src/share/classes/javax/management/openmbean/ArrayType.java @@ -296,7 +296,7 @@ public class ArrayType extends OpenType { // Check and construct state specific to ArrayType // if (elementType.isArray()) { - ArrayType at = (ArrayType) elementType; + ArrayType at = (ArrayType) elementType; this.dimension = at.getDimension() + dimension; this.elementType = at.getElementOpenType(); this.primitiveArray = at.isPrimitiveArray(); @@ -384,7 +384,7 @@ public class ArrayType extends OpenType { /* Package-private constructor for callers we trust to get it right. */ ArrayType(String className, String typeName, String description, - int dimension, OpenType elementType, + int dimension, OpenType elementType, boolean primitiveArray) { super(className, typeName, description, true); this.dimension = dimension; @@ -397,7 +397,7 @@ public class ArrayType extends OpenType { throws OpenDataException { boolean isPrimitiveArray = false; if (elementType.isArray()) { - isPrimitiveArray = ((ArrayType) elementType).isPrimitiveArray(); + isPrimitiveArray = ((ArrayType) elementType).isPrimitiveArray(); } return buildArrayClassName(dimension, elementType, isPrimitiveArray); } @@ -443,7 +443,7 @@ public class ArrayType extends OpenType { throws OpenDataException { boolean isPrimitiveArray = false; if (elementType.isArray()) { - isPrimitiveArray = ((ArrayType) elementType).isPrimitiveArray(); + isPrimitiveArray = ((ArrayType) elementType).isPrimitiveArray(); } return buildArrayDescription(dimension, elementType, isPrimitiveArray); } @@ -453,7 +453,7 @@ public class ArrayType extends OpenType { boolean isPrimitiveArray) throws OpenDataException { if (elementType.isArray()) { - ArrayType at = (ArrayType) elementType; + ArrayType at = (ArrayType) elementType; dimension += at.getDimension(); elementType = at.getElementOpenType(); isPrimitiveArray = at.isPrimitiveArray(); @@ -551,7 +551,7 @@ public class ArrayType extends OpenType { return false; } - Class objClass = obj.getClass(); + Class objClass = obj.getClass(); String objClassName = objClass.getName(); // if obj is not an array, return false @@ -636,8 +636,8 @@ public class ArrayType extends OpenType { } @Override - boolean isAssignableFrom(OpenType ot) { - if (!(ot instanceof ArrayType)) + boolean isAssignableFrom(OpenType ot) { + if (!(ot instanceof ArrayType)) return false; ArrayType at = (ArrayType) ot; return (at.getDimension() == getDimension() && @@ -675,9 +675,9 @@ public class ArrayType extends OpenType { // if obj is not an ArrayType, return false // - if (!(obj instanceof ArrayType)) + if (!(obj instanceof ArrayType)) return false; - ArrayType other = (ArrayType) obj; + ArrayType other = (ArrayType) obj; // if other's dimension is different than this instance's, return false // @@ -879,6 +879,7 @@ public class ArrayType extends OpenType { // Build primitive array // try { + @SuppressWarnings("rawtypes") ArrayType at = new ArrayType(simpleType, true); if (n > 1) at = new ArrayType(n - 1, at); @@ -934,7 +935,7 @@ public class ArrayType extends OpenType { } } - private ArrayType convertFromWrapperToPrimitiveTypes() { + private ArrayType convertFromWrapperToPrimitiveTypes() { String cn = getClassName(); String tn = getTypeName(); String d = getDescription(); @@ -952,8 +953,8 @@ public class ArrayType extends OpenType { break; } } - return new ArrayType(cn, tn, d, - dimension, elementType, primitiveArray); + return new ArrayType(cn, tn, d, + dimension, elementType, primitiveArray); } /** @@ -1002,7 +1003,7 @@ public class ArrayType extends OpenType { } } - private ArrayType convertFromPrimitiveToWrapperTypes() { + private ArrayType convertFromPrimitiveToWrapperTypes() { String cn = getClassName(); String tn = getTypeName(); String d = getDescription(); @@ -1020,7 +1021,7 @@ public class ArrayType extends OpenType { break; } } - return new ArrayType(cn, tn, d, - dimension, elementType, primitiveArray); + return new ArrayType(cn, tn, d, + dimension, elementType, primitiveArray); } } diff --git a/jdk/src/share/classes/javax/management/openmbean/CompositeDataInvocationHandler.java b/jdk/src/share/classes/javax/management/openmbean/CompositeDataInvocationHandler.java index e0414e9d031..2262c2a5ef7 100644 --- a/jdk/src/share/classes/javax/management/openmbean/CompositeDataInvocationHandler.java +++ b/jdk/src/share/classes/javax/management/openmbean/CompositeDataInvocationHandler.java @@ -236,8 +236,8 @@ public class CompositeDataInvocationHandler implements InvocationHandler { if (other == null) return false; - final Class proxyClass = proxy.getClass(); - final Class otherClass = other.getClass(); + final Class proxyClass = proxy.getClass(); + final Class otherClass = other.getClass(); if (proxyClass != otherClass) return false; InvocationHandler otherih = Proxy.getInvocationHandler(other); diff --git a/jdk/src/share/classes/javax/management/openmbean/CompositeType.java b/jdk/src/share/classes/javax/management/openmbean/CompositeType.java index b4c662ec9bc..28c3fd72b7f 100644 --- a/jdk/src/share/classes/javax/management/openmbean/CompositeType.java +++ b/jdk/src/share/classes/javax/management/openmbean/CompositeType.java @@ -329,7 +329,7 @@ public class CompositeType extends OpenType { * @return true if {@code ot} is assignable to this open type. */ @Override - boolean isAssignableFrom(OpenType ot) { + boolean isAssignableFrom(OpenType ot) { if (!(ot instanceof CompositeType)) return false; CompositeType ct = (CompositeType) ot; @@ -420,9 +420,7 @@ public class CompositeType extends OpenType { if (myHashCode == null) { int value = 0; value += this.getTypeName().hashCode(); - String key; - for (Iterator k = nameToDescription.keySet().iterator(); k.hasNext(); ) { - key = (String) k.next(); + for (String key : nameToDescription.keySet()) { value += key.hashCode(); value += this.nameToType.get(key).hashCode(); } @@ -457,10 +455,10 @@ public class CompositeType extends OpenType { result.append(getTypeName()); result.append(",items=("); int i=0; - Iterator k=nameToType.keySet().iterator(); + Iterator k=nameToType.keySet().iterator(); String key; while (k.hasNext()) { - key = (String) k.next(); + key = k.next(); if (i > 0) result.append(","); result.append("(itemName="); result.append(key); diff --git a/jdk/src/share/classes/javax/management/openmbean/OpenMBeanAttributeInfoSupport.java b/jdk/src/share/classes/javax/management/openmbean/OpenMBeanAttributeInfoSupport.java index bcfa4c157ad..3ad03ef58ae 100644 --- a/jdk/src/share/classes/javax/management/openmbean/OpenMBeanAttributeInfoSupport.java +++ b/jdk/src/share/classes/javax/management/openmbean/OpenMBeanAttributeInfoSupport.java @@ -78,12 +78,12 @@ public class OpenMBeanAttributeInfoSupport /** * @serial The open mbean attribute's min value */ - private final Comparable minValue; + private final Comparable minValue; /** * @serial The open mbean attribute's max value */ - private final Comparable maxValue; + private final Comparable maxValue; // As this instance is immutable, these two values need only @@ -450,7 +450,7 @@ public class OpenMBeanAttributeInfoSupport } static void check(OpenMBeanParameterInfo info) throws OpenDataException { - OpenType openType = info.getOpenType(); + OpenType openType = info.getOpenType(); if (openType == null) throw new IllegalArgumentException("OpenType cannot be null"); @@ -562,7 +562,7 @@ public class OpenMBeanAttributeInfoSupport } - @SuppressWarnings("unchecked") + @SuppressWarnings({"unchecked", "rawtypes"}) static int compare(Object x, Object y) { return ((Comparable) x).compareTo(y); } @@ -657,11 +657,11 @@ public class OpenMBeanAttributeInfoSupport return result; } - static Comparable comparableValueFrom(Descriptor d, String name, - OpenType openType) { + static Comparable comparableValueFrom(Descriptor d, String name, + OpenType openType) { T t = valueFrom(d, name, openType); if (t == null || t instanceof Comparable) - return (Comparable) t; + return (Comparable) t; final String msg = "Descriptor field " + name + " with value " + t + " is not Comparable"; @@ -925,7 +925,7 @@ public class OpenMBeanAttributeInfoSupport return isValue(this, obj); } - @SuppressWarnings("unchecked") // cast to Comparable + @SuppressWarnings({"unchecked", "rawtypes"}) // cast to Comparable static boolean isValue(OpenMBeanParameterInfo info, Object obj) { if (info.hasDefaultValue() && obj == null) return true; diff --git a/jdk/src/share/classes/javax/management/openmbean/OpenMBeanParameterInfoSupport.java b/jdk/src/share/classes/javax/management/openmbean/OpenMBeanParameterInfoSupport.java index b67ac60d77c..fc50a3b7621 100644 --- a/jdk/src/share/classes/javax/management/openmbean/OpenMBeanParameterInfoSupport.java +++ b/jdk/src/share/classes/javax/management/openmbean/OpenMBeanParameterInfoSupport.java @@ -74,12 +74,12 @@ public class OpenMBeanParameterInfoSupport /** * @serial The open mbean parameter's min value */ - private Comparable minValue = null; + private Comparable minValue = null; /** * @serial The open mbean parameter's max value */ - private Comparable maxValue = null; + private Comparable maxValue = null; // As this instance is immutable, these two values need only diff --git a/jdk/src/share/classes/javax/management/openmbean/OpenType.java b/jdk/src/share/classes/javax/management/openmbean/OpenType.java index 7aac2c0fd8f..3f74c3cda60 100644 --- a/jdk/src/share/classes/javax/management/openmbean/OpenType.java +++ b/jdk/src/share/classes/javax/management/openmbean/OpenType.java @@ -206,7 +206,7 @@ public abstract class OpenType implements Serializable { } } - private static boolean overridesGetClassName(final Class c) { + private static boolean overridesGetClassName(final Class c) { return AccessController.doPrivileged(new PrivilegedAction() { public Boolean run() { try { diff --git a/jdk/src/share/classes/javax/management/openmbean/SimpleType.java b/jdk/src/share/classes/javax/management/openmbean/SimpleType.java index 7837819c4c2..1d4f90e6a9b 100644 --- a/jdk/src/share/classes/javax/management/openmbean/SimpleType.java +++ b/jdk/src/share/classes/javax/management/openmbean/SimpleType.java @@ -163,7 +163,7 @@ public final class SimpleType extends OpenType { public static final SimpleType OBJECTNAME = new SimpleType(ObjectName.class); - private static final SimpleType[] typeArray = { + private static final SimpleType[] typeArray = { VOID, BOOLEAN, CHARACTER, BYTE, SHORT, INTEGER, LONG, FLOAT, DOUBLE, STRING, BIGDECIMAL, BIGINTEGER, DATE, OBJECTNAME, }; @@ -232,10 +232,10 @@ public final class SimpleType extends OpenType { return (this == obj); */ - if (!(obj instanceof SimpleType)) + if (!(obj instanceof SimpleType)) return false; - SimpleType other = (SimpleType) obj; + SimpleType other = (SimpleType) obj; // Test if other's className field is the same as for this instance // @@ -290,11 +290,11 @@ public final class SimpleType extends OpenType { return myToString; } - private static final Map canonicalTypes = - new HashMap(); + private static final Map,SimpleType> canonicalTypes = + new HashMap,SimpleType>(); static { for (int i = 0; i < typeArray.length; i++) { - final SimpleType type = typeArray[i]; + final SimpleType type = typeArray[i]; canonicalTypes.put(type, type); } } @@ -310,7 +310,7 @@ public final class SimpleType extends OpenType { * resolved. */ public Object readResolve() throws ObjectStreamException { - final SimpleType canonical = canonicalTypes.get(this); + final SimpleType canonical = canonicalTypes.get(this); if (canonical == null) { // Should not happen throw new InvalidObjectException("Invalid SimpleType: " + this); diff --git a/jdk/src/share/classes/javax/management/openmbean/TabularDataSupport.java b/jdk/src/share/classes/javax/management/openmbean/TabularDataSupport.java index 4e0c51cc9ba..faeba1a91e9 100644 --- a/jdk/src/share/classes/javax/management/openmbean/TabularDataSupport.java +++ b/jdk/src/share/classes/javax/management/openmbean/TabularDataSupport.java @@ -30,6 +30,7 @@ package javax.management.openmbean; // java import // import com.sun.jmx.mbeanserver.GetPropertyAction; +import com.sun.jmx.mbeanserver.Util; import java.io.IOException; import java.io.ObjectInputStream; import java.io.Serializable; @@ -611,7 +612,7 @@ public class TabularDataSupport @SuppressWarnings("unchecked") // historical confusion about the return type public Collection values() { - return (Collection) dataMap.values() ; + return Util.cast(dataMap.values()); } @@ -647,7 +648,7 @@ public class TabularDataSupport @SuppressWarnings("unchecked") // historical confusion about the return type public Set> entrySet() { - return (Set) dataMap.entrySet(); + return Util.cast(dataMap.entrySet()); } @@ -725,8 +726,7 @@ public class TabularDataSupport if (this.size() != other.size()) { return false; } - for (Iterator iter = this.values().iterator(); iter.hasNext(); ) { - CompositeData value = (CompositeData) iter.next(); + for (CompositeData value : dataMap.values()) { if ( ! other.containsValue(value) ) { return false; } @@ -760,9 +760,8 @@ public class TabularDataSupport int result = 0; result += this.tabularType.hashCode(); - for (Iterator iter = this.values().iterator(); iter.hasNext(); ) { - result += ((CompositeData)iter.next()).hashCode(); - } + for (Object value : values()) + result += value.hashCode(); return result; diff --git a/jdk/src/share/classes/javax/management/openmbean/TabularType.java b/jdk/src/share/classes/javax/management/openmbean/TabularType.java index b45f2f661d5..8f953107539 100644 --- a/jdk/src/share/classes/javax/management/openmbean/TabularType.java +++ b/jdk/src/share/classes/javax/management/openmbean/TabularType.java @@ -237,7 +237,7 @@ public class TabularType extends OpenType { } @Override - boolean isAssignableFrom(OpenType ot) { + boolean isAssignableFrom(OpenType ot) { if (!(ot instanceof TabularType)) return false; TabularType tt = (TabularType) ot; @@ -329,9 +329,8 @@ public class TabularType extends OpenType { int value = 0; value += this.getTypeName().hashCode(); value += this.rowType.hashCode(); - for (Iterator k = indexNames.iterator(); k.hasNext(); ) { - value += k.next().hashCode(); - } + for (String index : indexNames) + value += index.hashCode(); myHashCode = Integer.valueOf(value); } @@ -364,12 +363,10 @@ public class TabularType extends OpenType { .append(",rowType=") .append(rowType.toString()) .append(",indexNames=("); - int i=0; - Iterator k = indexNames.iterator(); - while( k.hasNext() ) { - if (i > 0) result.append(","); - result.append(k.next().toString()); - i++; + String sep = ""; + for (String index : indexNames) { + result.append(sep).append(index); + sep = ","; } result.append("))"); myToString = result.toString(); diff --git a/jdk/src/share/classes/javax/management/relation/MBeanServerNotificationFilter.java b/jdk/src/share/classes/javax/management/relation/MBeanServerNotificationFilter.java index 3b1edc58a4d..fbbbf3d70c3 100644 --- a/jdk/src/share/classes/javax/management/relation/MBeanServerNotificationFilter.java +++ b/jdk/src/share/classes/javax/management/relation/MBeanServerNotificationFilter.java @@ -354,7 +354,7 @@ public class MBeanServerNotificationFilter extends NotificationFilterSupport { // Checks the type first String ntfType = notif.getType(); - Vector enabledTypes = getEnabledTypes(); + Vector enabledTypes = getEnabledTypes(); if (!(enabledTypes.contains(ntfType))) { RELATION_LOGGER.logp(Level.FINER, MBeanServerNotificationFilter.class.getName(), @@ -464,8 +464,8 @@ public class MBeanServerNotificationFilter extends NotificationFilterSupport { // Serializes this instance in the old serial form // ObjectOutputStream.PutField fields = out.putFields(); - fields.put("mySelectObjNameList", (Vector)selectedNames); - fields.put("myDeselectObjNameList", (Vector)deselectedNames); + fields.put("mySelectObjNameList", selectedNames); + fields.put("myDeselectObjNameList", deselectedNames); out.writeFields(); } else diff --git a/jdk/src/share/classes/javax/management/relation/RelationService.java b/jdk/src/share/classes/javax/management/relation/RelationService.java index 98a4809ea41..fcf0cb0127e 100644 --- a/jdk/src/share/classes/javax/management/relation/RelationService.java +++ b/jdk/src/share/classes/javax/management/relation/RelationService.java @@ -1111,7 +1111,7 @@ public class RelationService extends NotificationBroadcasterSupport throw new IllegalArgumentException(excMsg); } - if (!(oldValue instanceof ArrayList)) + if (!(oldValue instanceof ArrayList)) oldValue = new ArrayList(oldValue); RELATION_LOGGER.entering(RelationService.class.getName(), @@ -1881,7 +1881,7 @@ public class RelationService extends NotificationBroadcasterSupport "getRole", params, signature)); - if (invokeResult == null || invokeResult instanceof ArrayList) + if (invokeResult == null || invokeResult instanceof ArrayList) result = invokeResult; else result = new ArrayList(invokeResult); @@ -2786,7 +2786,7 @@ public class RelationService extends NotificationBroadcasterSupport // Note that it is possible that the MBean has already been removed // from the internal map: this is the case when the MBean is // unregistered, the role is updated, then we arrive here. - HashMap mbeanRefMap = (HashMap) + Map> mbeanRefMap = (myRefedMBeanObjName2RelIdsMap.get(objectName)); if (mbeanRefMap == null) { @@ -2796,11 +2796,11 @@ public class RelationService extends NotificationBroadcasterSupport return true; } - ArrayList roleNames = new ArrayList(); + List roleNames = null; if (!allRolesFlag) { // Now retrieves the roles of current relation where the MBean // was referenced - roleNames = (ArrayList)(mbeanRefMap.get(relationId)); + roleNames = mbeanRefMap.get(relationId); // Removes obsolete reference to role int obsRefIdx = roleNames.indexOf(roleName); @@ -2840,8 +2840,8 @@ public class RelationService extends NotificationBroadcasterSupport // // -exception RelationServiceNotRegisteredException if the Relation // Service is not registered in the MBean Server. - private void updateUnregistrationListener(List newRefList, - List obsoleteRefList) + private void updateUnregistrationListener(List newRefList, + List obsoleteRefList) throws RelationServiceNotRegisteredException { if (newRefList != null && obsoleteRefList != null) { @@ -2871,24 +2871,14 @@ public class RelationService extends NotificationBroadcasterSupport // Enables ObjectNames in newRefList if (newRefList != null) { - for (Iterator newRefIter = newRefList.iterator(); - newRefIter.hasNext();) { - - ObjectName newObjName = (ObjectName) - (newRefIter.next()); + for (ObjectName newObjName : newRefList) myUnregNtfFilter.enableObjectName(newObjName); - } } if (obsoleteRefList != null) { // Disables ObjectNames in obsoleteRefList - for (Iterator obsRefIter = obsoleteRefList.iterator(); - obsRefIter.hasNext();) { - - ObjectName obsObjName = (ObjectName) - (obsRefIter.next()); + for (ObjectName obsObjName : obsoleteRefList) myUnregNtfFilter.disableObjectName(obsObjName); - } } // Under test @@ -3047,18 +3037,13 @@ public class RelationService extends NotificationBroadcasterSupport // to see which roles have not been initialized // Note: no need to test if list not null before cloning, not allowed // to have an empty relation type. - ArrayList roleInfoList = (ArrayList) - (((ArrayList)(relType.getRoleInfos())).clone()); + List roleInfoList = new ArrayList(relType.getRoleInfos()); if (roleList != null) { - for (Iterator roleIter = roleList.iterator(); - roleIter.hasNext();) { - - Role currRole = (Role)(roleIter.next()); + for (Role currRole : roleList.asList()) { String currRoleName = currRole.getRoleName(); - ArrayList currRoleValue = (ArrayList) - (currRole.getRoleValue()); + List currRoleValue = currRole.getRoleValue(); // Retrieves corresponding role info // Can throw a RoleInfoNotFoundException to be converted into a // RoleNotFoundException @@ -3137,9 +3122,7 @@ public class RelationService extends NotificationBroadcasterSupport // Only role list parameter used, as default initialization of roles // done automatically in initializeMissingRoles() sets each // uninitialized role to an empty value. - for (Iterator roleIter = roleList.iterator(); - roleIter.hasNext();) { - Role currRole = (Role)(roleIter.next()); + for (Role currRole : roleList.asList()) { // Creates a dummy empty ArrayList of ObjectNames to be the old // role value :) List dummyList = new ArrayList(); @@ -3191,7 +3174,7 @@ public class RelationService extends NotificationBroadcasterSupport // -exception IllegalArgumentException if null parameter private Integer checkRoleInt(int chkType, String roleName, - List roleValue, + List roleValue, RoleInfo roleInfo, boolean writeChkFlag) throws IllegalArgumentException { @@ -3266,9 +3249,7 @@ public class RelationService extends NotificationBroadcasterSupport // registered in the same MBean Server. String expClassName = roleInfo.getRefMBeanClassName(); - for (Iterator refMBeanIter = roleValue.iterator(); - refMBeanIter.hasNext();) { - ObjectName currObjName = (ObjectName)(refMBeanIter.next()); + for (ObjectName currObjName : roleValue) { // Checks it is registered if (currObjName == null) { @@ -3330,7 +3311,7 @@ public class RelationService extends NotificationBroadcasterSupport ObjectName relationObjName, String relationId, String relationTypeName, - List roleInfoList) + List roleInfoList) throws IllegalArgumentException, RelationServiceNotRegisteredException, InvalidRoleValueException { @@ -3361,10 +3342,8 @@ public class RelationService extends NotificationBroadcasterSupport // with an empty list of ObjectNames. // A check is performed to verify that the role can be set to an // empty value, according to its minimum cardinality - for (Iterator roleInfoIter = roleInfoList.iterator(); - roleInfoIter.hasNext();) { + for (RoleInfo currRoleInfo : roleInfoList) { - RoleInfo currRoleInfo = (RoleInfo)(roleInfoIter.next()); String roleName = currRoleInfo.getName(); // Creates an empty value @@ -3663,7 +3642,7 @@ public class RelationService extends NotificationBroadcasterSupport // not exist in the relation private void handleReferenceUnregistration(String relationId, ObjectName objectName, - List roleNameList) + List roleNameList) throws IllegalArgumentException, RelationServiceNotRegisteredException, RelationNotFoundException, @@ -3694,14 +3673,12 @@ public class RelationService extends NotificationBroadcasterSupport // Flag to specify if the relation has to be deleted boolean deleteRelFlag = false; - for (Iterator roleNameIter = roleNameList.iterator(); - roleNameIter.hasNext();) { + for (String currRoleName : roleNameList) { if (deleteRelFlag) { break; } - String currRoleName = (String)(roleNameIter.next()); // Retrieves number of MBeans currently referenced in role // BEWARE! Do not use getRole() as role may be not readable // @@ -3753,10 +3730,7 @@ public class RelationService extends NotificationBroadcasterSupport // using setRole(). So the Relation Service will update the // myRefedMBeanObjName2RelIdsMap to refelect the new role // value! - for (Iterator roleNameIter = roleNameList.iterator(); - roleNameIter.hasNext();) { - - String currRoleName = (String)(roleNameIter.next()); + for (String currRoleName : roleNameList) { if (relObj instanceof RelationSupport) { // Internal relation diff --git a/jdk/src/share/classes/javax/management/relation/RelationSupport.java b/jdk/src/share/classes/javax/management/relation/RelationSupport.java index ed0958e9b4a..c714a3ecbaa 100644 --- a/jdk/src/share/classes/javax/management/relation/RelationSupport.java +++ b/jdk/src/share/classes/javax/management/relation/RelationSupport.java @@ -108,7 +108,7 @@ public class RelationSupport // via Relation Service setRole() and setRoles() methods // - if the relation is internal to the Relation Service, via // setRoleInt() and setRolesInt() methods. - private Map myRoleName2ValueMap = new HashMap(); + private final Map myRoleName2ValueMap = new HashMap(); // Flag to indicate if the object has been added in the Relation Service private final AtomicBoolean myInRelServFlg = new AtomicBoolean(); @@ -424,7 +424,7 @@ public class RelationSupport } } - ArrayList roleValue = (ArrayList)(role.getRoleValue()); + List roleValue = role.getRoleValue(); RELATION_LOGGER.exiting(RelationSupport.class.getName(), "getRoleCardinality"); @@ -855,8 +855,7 @@ public class RelationSupport // Note: no need to test if role value (list) not null before // cloning, null value not allowed, empty list if // nothing. - result = (ArrayList) - (((ArrayList)(role.getRoleValue())).clone()); + result = new ArrayList(role.getRoleValue()); } else { // Role retrieved during multi-role retrieval: returns the @@ -1492,10 +1491,7 @@ public class RelationSupport RoleList roleList = new RoleList(); RoleUnresolvedList roleUnresList = new RoleUnresolvedList(); - for (Iterator roleIter = list.iterator(); - roleIter.hasNext();) { - - Role currRole = (Role)(roleIter.next()); + for (Role currRole : list.asList()) { Object currResult = null; // Can throw: @@ -1617,12 +1613,10 @@ public class RelationSupport synchronized(myRoleName2ValueMap) { - for (Iterator roleIter = list.iterator(); - roleIter.hasNext();) { + for (Role currRole : list.asList()) { // No need to check if role is null, it is not allowed to store // a null role in a RoleList :) - Role currRole = (Role)(roleIter.next()); String currRoleName = currRole.getRoleName(); if (myRoleName2ValueMap.containsKey(currRoleName)) { diff --git a/jdk/src/share/classes/javax/management/relation/Role.java b/jdk/src/share/classes/javax/management/relation/Role.java index dc8f7944304..79fe1490a88 100644 --- a/jdk/src/share/classes/javax/management/relation/Role.java +++ b/jdk/src/share/classes/javax/management/relation/Role.java @@ -228,9 +228,9 @@ public class Role implements Serializable { public String toString() { StringBuilder result = new StringBuilder(); result.append("role name: " + name + "; role value: "); - for (Iterator objNameIter = objectNameList.iterator(); + for (Iterator objNameIter = objectNameList.iterator(); objNameIter.hasNext();) { - ObjectName currObjName = (ObjectName)(objNameIter.next()); + ObjectName currObjName = objNameIter.next(); result.append(currObjName.toString()); if (objNameIter.hasNext()) { result.append(", "); @@ -325,7 +325,7 @@ public class Role implements Serializable { // ObjectOutputStream.PutField fields = out.putFields(); fields.put("myName", name); - fields.put("myObjNameList", (ArrayList)objectNameList); + fields.put("myObjNameList", objectNameList); out.writeFields(); } else diff --git a/jdk/src/share/classes/javax/management/relation/RoleList.java b/jdk/src/share/classes/javax/management/relation/RoleList.java index a03ffe28065..467c3f45967 100644 --- a/jdk/src/share/classes/javax/management/relation/RoleList.java +++ b/jdk/src/share/classes/javax/management/relation/RoleList.java @@ -25,6 +25,7 @@ package javax.management.relation; +import com.sun.jmx.mbeanserver.Util; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -140,7 +141,7 @@ public class RoleList extends ArrayList { checkTypeSafe(this); typeSafe = true; } - return (List) (List) this; + return Util.cast(this); } // diff --git a/jdk/src/share/classes/javax/management/relation/RoleResult.java b/jdk/src/share/classes/javax/management/relation/RoleResult.java index 64df5b97ecb..6ea55250c40 100644 --- a/jdk/src/share/classes/javax/management/relation/RoleResult.java +++ b/jdk/src/share/classes/javax/management/relation/RoleResult.java @@ -172,7 +172,7 @@ public class RoleResult implements Serializable { roleList = new RoleList(); - for (Iterator roleIter = list.iterator(); + for (Iterator roleIter = list.iterator(); roleIter.hasNext();) { Role currRole = (Role)(roleIter.next()); roleList.add((Role)(currRole.clone())); @@ -195,7 +195,7 @@ public class RoleResult implements Serializable { unresolvedRoleList = new RoleUnresolvedList(); - for (Iterator roleUnresIter = unresolvedList.iterator(); + for (Iterator roleUnresIter = unresolvedList.iterator(); roleUnresIter.hasNext();) { RoleUnresolved currRoleUnres = (RoleUnresolved)(roleUnresIter.next()); diff --git a/jdk/src/share/classes/javax/management/relation/RoleUnresolved.java b/jdk/src/share/classes/javax/management/relation/RoleUnresolved.java index 8b25797488b..a20173c6f77 100644 --- a/jdk/src/share/classes/javax/management/relation/RoleUnresolved.java +++ b/jdk/src/share/classes/javax/management/relation/RoleUnresolved.java @@ -285,9 +285,9 @@ public class RoleUnresolved implements Serializable { result.append("role name: " + roleName); if (roleValue != null) { result.append("; value: "); - for (Iterator objNameIter = roleValue.iterator(); + for (Iterator objNameIter = roleValue.iterator(); objNameIter.hasNext();) { - ObjectName currObjName = (ObjectName)(objNameIter.next()); + ObjectName currObjName = objNameIter.next(); result.append(currObjName.toString()); if (objNameIter.hasNext()) { result.append(", "); @@ -344,7 +344,7 @@ public class RoleUnresolved implements Serializable { // ObjectOutputStream.PutField fields = out.putFields(); fields.put("myRoleName", roleName); - fields.put("myRoleValue", (ArrayList)roleValue); + fields.put("myRoleValue", roleValue); fields.put("myPbType", problemType); out.writeFields(); } diff --git a/jdk/src/share/classes/javax/management/relation/RoleUnresolvedList.java b/jdk/src/share/classes/javax/management/relation/RoleUnresolvedList.java index 3b4e42ebfc6..873028b4592 100644 --- a/jdk/src/share/classes/javax/management/relation/RoleUnresolvedList.java +++ b/jdk/src/share/classes/javax/management/relation/RoleUnresolvedList.java @@ -25,6 +25,7 @@ package javax.management.relation; +import com.sun.jmx.mbeanserver.Util; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -140,7 +141,7 @@ public class RoleUnresolvedList extends ArrayList { checkTypeSafe(this); typeSafe = true; } - return (List) (List) this; + return Util.cast(this); } // diff --git a/jdk/src/share/classes/javax/management/remote/JMXConnectorFactory.java b/jdk/src/share/classes/javax/management/remote/JMXConnectorFactory.java index 219865b603c..051d8b34c45 100644 --- a/jdk/src/share/classes/javax/management/remote/JMXConnectorFactory.java +++ b/jdk/src/share/classes/javax/management/remote/JMXConnectorFactory.java @@ -367,7 +367,8 @@ public class JMXConnectorFactory { return provider.newJMXConnector(serviceURL, fixedenv); } - private static String resolvePkgs(Map env) throws JMXProviderException { + private static String resolvePkgs(Map env) + throws JMXProviderException { Object pkgsObject = null; @@ -521,7 +522,7 @@ public class JMXConnectorFactory { return null; } - static ClassLoader resolveClassLoader(Map environment) { + static ClassLoader resolveClassLoader(Map environment) { ClassLoader loader = null; if (environment != null) { diff --git a/jdk/src/share/classes/javax/management/remote/rmi/NoCallStackClassLoader.java b/jdk/src/share/classes/javax/management/remote/rmi/NoCallStackClassLoader.java index a4c5fe0eadf..5c2970f2116 100644 --- a/jdk/src/share/classes/javax/management/remote/rmi/NoCallStackClassLoader.java +++ b/jdk/src/share/classes/javax/management/remote/rmi/NoCallStackClassLoader.java @@ -118,7 +118,8 @@ class NoCallStackClassLoader extends ClassLoader { * if it is one of the classes whose byte code we have, or * delegate the load if it is one of the referenced classes. */ - protected Class findClass(String name) throws ClassNotFoundException { + @Override + protected Class findClass(String name) throws ClassNotFoundException { for (int i = 0; i < classNames.length; i++) { if (name.equals(classNames[i])) { return defineClass(classNames[i], byteCodes[i], 0, diff --git a/jdk/src/share/classes/javax/management/remote/rmi/RMIConnection.java b/jdk/src/share/classes/javax/management/remote/rmi/RMIConnection.java index 863b3dca8cc..6fbafdb531a 100644 --- a/jdk/src/share/classes/javax/management/remote/rmi/RMIConnection.java +++ b/jdk/src/share/classes/javax/management/remote/rmi/RMIConnection.java @@ -31,7 +31,6 @@ import java.rmi.MarshalledObject; import java.rmi.Remote; import java.util.Set; -import javax.management.Attribute; import javax.management.AttributeList; import javax.management.AttributeNotFoundException; import javax.management.InstanceAlreadyExistsException; @@ -45,11 +44,11 @@ import javax.management.MBeanRegistrationException; import javax.management.MBeanServerConnection; import javax.management.NotCompliantMBeanException; -import javax.management.NotificationFilter; import javax.management.ObjectInstance; import javax.management.ObjectName; -import javax.management.QueryExp; import javax.management.ReflectionException; +import javax.management.RuntimeMBeanException; +import javax.management.RuntimeOperationsException; import javax.management.remote.NotificationResult; import javax.security.auth.Subject; @@ -89,8 +88,9 @@ import javax.security.auth.Subject; * even though it would add useful information to the documentation. The * reason is that it was only added in Mustang (Java SE 6), whereas versions * 1.4 and 2.0 of the JMX API must be implementable on Tiger per our - * commitments for JSR 255. + * commitments for JSR 255. This is also why we suppress rawtypes warnings. */ +@SuppressWarnings("rawtypes") public interface RMIConnection extends Closeable, Remote { /** *

Returns the connection ID. This string is different for diff --git a/jdk/src/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java b/jdk/src/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java index a87d146e94e..acac5ec8f22 100644 --- a/jdk/src/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java +++ b/jdk/src/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java @@ -308,6 +308,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { } } + @SuppressWarnings("rawtypes") // MarshalledObject public ObjectInstance createMBean(String className, ObjectName name, MarshalledObject params, @@ -368,6 +369,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { } } + @SuppressWarnings("rawtypes") // MarshalledObject public ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName, @@ -493,6 +495,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { } } + @SuppressWarnings("rawtypes") // MarshalledObject public Set queryMBeans(ObjectName name, MarshalledObject query, @@ -527,6 +530,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { } } + @SuppressWarnings("rawtypes") // MarshalledObject public Set queryNames(ObjectName name, MarshalledObject query, @@ -668,6 +672,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { } } + @SuppressWarnings("rawtypes") // MarshalledObject public void setAttribute(ObjectName name, MarshalledObject attribute, Subject delegationSubject) @@ -720,6 +725,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { } } + @SuppressWarnings("rawtypes") // MarshalledObject public AttributeList setAttributes(ObjectName name, MarshalledObject attributes, Subject delegationSubject) @@ -765,6 +771,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { } } + @SuppressWarnings("rawtypes") // MarshalledObject public Object invoke(ObjectName name, String operationName, MarshalledObject params, @@ -928,6 +935,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { } } + @SuppressWarnings("rawtypes") // MarshalledObject public Integer[] addNotificationListeners(ObjectName[] names, MarshalledObject[] filters, Subject[] delegationSubjects) @@ -1013,6 +1021,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { } } + @SuppressWarnings("rawtypes") // MarshalledObject public void addNotificationListener(ObjectName name, ObjectName listener, MarshalledObject filter, @@ -1148,6 +1157,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { } } + @SuppressWarnings("rawtypes") // MarshalledObject public void removeNotificationListener(ObjectName name, ObjectName listener, MarshalledObject filter, @@ -1809,7 +1819,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { } } - private static T unwrap(final MarshalledObject mo, + private static T unwrap(final MarshalledObject mo, final ClassLoader cl, final Class wrappedClass) throws IOException { @@ -1847,7 +1857,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced { return null; } - private static T unwrap(final MarshalledObject mo, + private static T unwrap(final MarshalledObject mo, final ClassLoader cl1, final ClassLoader cl2, final Class wrappedClass) diff --git a/jdk/src/share/classes/javax/management/remote/rmi/RMIConnector.java b/jdk/src/share/classes/javax/management/remote/rmi/RMIConnector.java index 934dac790db..1f17143b948 100644 --- a/jdk/src/share/classes/javax/management/remote/rmi/RMIConnector.java +++ b/jdk/src/share/classes/javax/management/remote/rmi/RMIConnector.java @@ -28,6 +28,7 @@ package javax.management.remote.rmi; import com.sun.jmx.event.DaemonThreadFactory; import com.sun.jmx.event.EventConnection; import com.sun.jmx.mbeanserver.PerThreadGroupPool; +import com.sun.jmx.mbeanserver.Util; import com.sun.jmx.remote.internal.ClientCommunicatorAdmin; import com.sun.jmx.remote.internal.ClientListenerInfo; import com.sun.jmx.remote.internal.ClientNotifForwarder; @@ -584,7 +585,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable // added for re-connection private Integer addListenerWithSubject(ObjectName name, - MarshalledObject filter, + MarshalledObject filter, Subject delegationSubject, boolean reconnect) throws InstanceNotFoundException, IOException { @@ -595,7 +596,8 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable "(ObjectName,MarshalledObject,Subject)"); final ObjectName[] names = new ObjectName[] {name}; - final MarshalledObject[] filters = new MarshalledObject[] {filter}; + final MarshalledObject[] filters = + Util.cast(new MarshalledObject[] {filter}); final Subject[] delegationSubjects = new Subject[] { delegationSubject }; @@ -611,7 +613,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable // added for re-connection private Integer[] addListenersWithSubjects(ObjectName[] names, - MarshalledObject[] filters, + MarshalledObject[] filters, Subject[] delegationSubjects, boolean reconnect) throws InstanceNotFoundException, IOException { @@ -1362,7 +1364,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable //-------------------------------------------------------------------- private class RMINotifClient extends ClientNotifForwarder { - public RMINotifClient(ClassLoader cl, Map env) { + public RMINotifClient(ClassLoader cl, Map env) { super(cl, env); } @@ -1444,8 +1446,8 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable Integer[] listenerIDs; final ObjectName[] names = new ObjectName[] {MBeanServerDelegate.DELEGATE_NAME}; - final MarshalledObject[] filters = - new MarshalledObject[] {sFilter}; + final MarshalledObject[] filters = + Util.cast(new MarshalledObject[] {sFilter}); final Subject[] subjects = new Subject[] {null}; try { listenerIDs = @@ -1580,7 +1582,8 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable final ObjectName[] names = new ObjectName[len]; final NotificationListener[] listeners = new NotificationListener[len]; final NotificationFilter[] filters = new NotificationFilter[len]; - final MarshalledObject[] mFilters = new MarshalledObject[len]; + final MarshalledObject[] mFilters = + Util.cast(new MarshalledObject[len]); final Object[] handbacks = new Object[len]; for (i=0;i environment) throws IOException { if (rmiServer instanceof javax.rmi.CORBA.Stub) { javax.rmi.CORBA.Stub stub = (javax.rmi.CORBA.Stub) rmiServer; @@ -1776,7 +1779,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable * does not point to an {@link org.omg.CORBA.ORB ORB}. * @exception IOException if the ORB initialization failed. **/ - static ORB resolveOrb(Map environment) + static ORB resolveOrb(Map environment) throws IOException { if (environment != null) { final Object orb = environment.get(EnvHelp.DEFAULT_ORB); @@ -2004,7 +2007,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable } } - private RMIServer findRMIServerIIOP(String ior, Map env, boolean isIiop) { + private RMIServer findRMIServerIIOP(String ior, Map env, boolean isIiop) { // could forbid "rmi:" URL here -- but do we need to? final ORB orb = (ORB) env.get(EnvHelp.DEFAULT_ORB); @@ -2012,7 +2015,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable return (RMIServer) PortableRemoteObject.narrow(stub, RMIServer.class); } - private RMIServer findRMIServerJRMP(String base64, Map env, boolean isIiop) + private RMIServer findRMIServerJRMP(String base64, Map env, boolean isIiop) throws IOException { // could forbid "iiop:" URL here -- but do we need to? final byte[] serialized; @@ -2046,7 +2049,8 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable this.loader = cl; } - protected Class resolveClass(ObjectStreamClass classDesc) + @Override + protected Class resolveClass(ObjectStreamClass classDesc) throws IOException, ClassNotFoundException { return Class.forName(classDesc.getName(), false, loader); } @@ -2121,13 +2125,13 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable private static final String rmiServerImplStubClassName = RMIServer.class.getName() + "Impl_Stub"; - private static final Class rmiServerImplStubClass; + private static final Class rmiServerImplStubClass; private static final String rmiConnectionImplStubClassName = RMIConnection.class.getName() + "Impl_Stub"; private static final Class rmiConnectionImplStubClass; private static final String pRefClassName = "com.sun.jmx.remote.internal.PRef"; - private static final Constructor proxyRefConstructor; + private static final Constructor proxyRefConstructor; static { final String pRefByteCodeString = "\312\376\272\276\0\0\0.\0\27\12\0\5\0\15\11\0\4\0\16\13\0\17\0"+ @@ -2162,7 +2166,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable } }; - Class serverStubClass; + Class serverStubClass; try { serverStubClass = Class.forName(rmiServerImplStubClassName); } catch (Exception e) { @@ -2175,10 +2179,10 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable rmiServerImplStubClass = serverStubClass; Class stubClass; - Constructor constr; + Constructor constr; try { stubClass = Class.forName(rmiConnectionImplStubClassName); - constr = (Constructor) AccessController.doPrivileged(action); + constr = (Constructor) AccessController.doPrivileged(action); } catch (Exception e) { logger.error("", "Failed to initialize proxy reference constructor "+ @@ -2198,9 +2202,8 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable RemoteRef ref = stub.getRef(); RemoteRef proxyRef = (RemoteRef) proxyRefConstructor.newInstance(new Object[] {ref}); - final Class[] constrTypes = {RemoteRef.class}; - final Constructor rmiConnectionImplStubConstructor = - rmiConnectionImplStubClass.getConstructor(constrTypes); + final Constructor rmiConnectionImplStubConstructor = + rmiConnectionImplStubClass.getConstructor(RemoteRef.class); Object[] args = {proxyRef}; RMIConnection proxyStub = (RMIConnection) rmiConnectionImplStubConstructor.newInstance(args); @@ -2328,7 +2331,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable "com.sun.jmx.remote.internal.ProxyStub"; private static final String pInputStreamClassName = "com.sun.jmx.remote.internal.PInputStream"; - private static final Class proxyStubClass; + private static final Class proxyStubClass; static { final String proxyStubByteCodeString = "\312\376\272\276\0\0\0.\0)\12\0\14\0\26\7\0\27\12\0\14\0\30\12"+ diff --git a/jdk/src/share/classes/javax/management/remote/rmi/RMIConnectorServer.java b/jdk/src/share/classes/javax/management/remote/rmi/RMIConnectorServer.java index 2cbe315bfdd..e56020b4722 100644 --- a/jdk/src/share/classes/javax/management/remote/rmi/RMIConnectorServer.java +++ b/jdk/src/share/classes/javax/management/remote/rmi/RMIConnectorServer.java @@ -423,7 +423,7 @@ public class RMIConnectorServer extends JMXConnectorServer { try { if (tracing) logger.trace("start", "binding to " + jndiUrl); - final Hashtable usemap = EnvHelp.mapToHashtable(attributes); + final Hashtable usemap = EnvHelp.mapToHashtable(attributes); bind(jndiUrl, usemap, objref, rebind); @@ -555,7 +555,7 @@ public class RMIConnectorServer extends JMXConnectorServer { logger.trace("stop", "unbind from external directory: " + boundJndiUrl); - final Hashtable usemap = EnvHelp.mapToHashtable(attributes); + final Hashtable usemap = EnvHelp.mapToHashtable(attributes); InitialContext ctx = new InitialContext(usemap); @@ -655,7 +655,7 @@ public class RMIConnectorServer extends JMXConnectorServer { * @param rmiServer The object to bind in the registry * @param rebind true if the object must be rebound. **/ - void bind(String jndiUrl, Hashtable attributes, + void bind(String jndiUrl, Hashtable attributes, RMIServer rmiServer, boolean rebind) throws NamingException, MalformedURLException { // if jndiURL is not null, we nust bind the stub to a @@ -692,7 +692,8 @@ public class RMIConnectorServer extends JMXConnectorServer { * @param attributes A Map containing environment parameters, * built from the Map specified at this object creation. **/ - private void encodeStubInAddress(RMIServer rmiServer, Map attributes) + private void encodeStubInAddress( + RMIServer rmiServer, Map attributes) throws IOException { final String protocol, host; @@ -735,14 +736,16 @@ public class RMIConnectorServer extends JMXConnectorServer { /** * Returns the IOR of the given rmiServer. **/ - static String encodeStub(RMIServer rmiServer, Map env) throws IOException { + static String encodeStub( + RMIServer rmiServer, Map env) throws IOException { if (rmiServer instanceof javax.rmi.CORBA.Stub) return "/ior/" + encodeIIOPStub(rmiServer, env); else return "/stub/" + encodeJRMPStub(rmiServer, env); } - static String encodeJRMPStub(RMIServer rmiServer, Map env) + static String encodeJRMPStub( + RMIServer rmiServer, Map env) throws IOException { ByteArrayOutputStream bout = new ByteArrayOutputStream(); ObjectOutputStream oout = new ObjectOutputStream(bout); @@ -752,7 +755,8 @@ public class RMIConnectorServer extends JMXConnectorServer { return byteArrayToBase64(bytes); } - static String encodeIIOPStub(RMIServer rmiServer, Map env) + static String encodeIIOPStub( + RMIServer rmiServer, Map env) throws IOException { try { javax.rmi.CORBA.Stub stub = @@ -767,7 +771,8 @@ public class RMIConnectorServer extends JMXConnectorServer { * Object that we will bind to the registry. * This object is a stub connected to our RMIServerImpl. **/ - private static RMIServer objectToBind(RMIServerImpl rmiServer, Map env) + private static RMIServer objectToBind( + RMIServerImpl rmiServer, Map env) throws IOException { return RMIConnector. connectStub((RMIServer)rmiServer.toStub(),env); diff --git a/jdk/src/share/classes/javax/management/remote/rmi/RMIServerImpl.java b/jdk/src/share/classes/javax/management/remote/rmi/RMIServerImpl.java index bc15562f5eb..d87b1d0544b 100644 --- a/jdk/src/share/classes/javax/management/remote/rmi/RMIServerImpl.java +++ b/jdk/src/share/classes/javax/management/remote/rmi/RMIServerImpl.java @@ -75,7 +75,7 @@ public abstract class RMIServerImpl implements Closeable, RMIServer { * to an empty Map. */ public RMIServerImpl(Map env) { - this.env = (env == null) ? Collections.EMPTY_MAP : env; + this.env = (env == null) ? Collections.emptyMap() : env; } void setRMIConnectorServer(RMIConnectorServer connServer) @@ -337,8 +337,9 @@ public abstract class RMIServerImpl implements Closeable, RMIServer { synchronized (clientList) { dropDeadReferences(); - for (Iterator it = clientList.iterator(); it.hasNext(); ) { - WeakReference wr = (WeakReference) it.next(); + for (Iterator> it = clientList.iterator(); + it.hasNext(); ) { + WeakReference wr = it.next(); if (wr.get() == client) { it.remove(); break; @@ -417,9 +418,10 @@ public abstract class RMIServerImpl implements Closeable, RMIServer { dropDeadReferences(), this will usually be the first element of the list, but a garbage collection could have happened in between. */ - for (Iterator it = clientList.iterator(); it.hasNext(); ) { - WeakReference wr = (WeakReference) it.next(); - RMIConnection client = (RMIConnection) wr.get(); + for (Iterator> it = clientList.iterator(); + it.hasNext(); ) { + WeakReference wr = it.next(); + RMIConnection client = wr.get(); it.remove(); if (client != null) { try { @@ -475,10 +477,10 @@ public abstract class RMIServerImpl implements Closeable, RMIServer { buf.append("//").append(clientHost); buf.append(" "); if (subject != null) { - Set principals = subject.getPrincipals(); + Set principals = subject.getPrincipals(); String sep = ""; - for (Iterator it = principals.iterator(); it.hasNext(); ) { - Principal p = (Principal) it.next(); + for (Iterator it = principals.iterator(); it.hasNext(); ) { + Principal p = it.next(); String name = p.getName().replace(' ', '_').replace(';', ':'); buf.append(sep).append(name); sep = ";"; @@ -492,8 +494,9 @@ public abstract class RMIServerImpl implements Closeable, RMIServer { private void dropDeadReferences() { synchronized (clientList) { - for (Iterator it = clientList.iterator(); it.hasNext(); ) { - WeakReference wr = (WeakReference) it.next(); + for (Iterator> it = clientList.iterator(); + it.hasNext(); ) { + WeakReference wr = it.next(); if (wr.get() == null) it.remove(); } @@ -522,7 +525,7 @@ public abstract class RMIServerImpl implements Closeable, RMIServer { private MBeanServer mbeanServer; - private final Map env; + private final Map env; private RMIConnectorServer connServer; diff --git a/jdk/src/share/classes/javax/management/timer/Timer.java b/jdk/src/share/classes/javax/management/timer/Timer.java index ea4d0b24a2a..909a1bbb0e5 100644 --- a/jdk/src/share/classes/javax/management/timer/Timer.java +++ b/jdk/src/share/classes/javax/management/timer/Timer.java @@ -248,8 +248,7 @@ public class Timer extends NotificationBroadcasterSupport */ public synchronized MBeanNotificationInfo[] getNotificationInfo() { Set notifTypes = new TreeSet(); - for (Iterator it = timerTable.values().iterator(); it.hasNext(); ) { - Object[] entry = (Object[]) it.next(); + for (Object[] entry : timerTable.values()) { TimerNotification notif = (TimerNotification) entry[TIMER_NOTIF_INDEX]; notifTypes.add(notif.getType()); From 49c8929c4ae667bfb7c29d26d64cf19da0a2800a Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Mon, 27 Oct 2008 14:25:59 -0700 Subject: [PATCH 087/267] 6764226: ListTest fails on javap output with bad characters Reviewed-by: darcy --- langtools/test/tools/javap/ListTest.java | 31 ++++++++++++++---------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/langtools/test/tools/javap/ListTest.java b/langtools/test/tools/javap/ListTest.java index ae4fd9dc64f..a2af27070f8 100644 --- a/langtools/test/tools/javap/ListTest.java +++ b/langtools/test/tools/javap/ListTest.java @@ -82,16 +82,16 @@ public class ListTest { String[] args = new String[options.size() + 1]; options.toArray(args); args[args.length - 1] = testClassName; - String oldOut = runOldJavap(args); - String newOut = runNewJavap(args); - boolean ok = oldOut.equals(newOut); + byte[] oldOut = runOldJavap(args); + byte[] newOut = runNewJavap(args); + boolean ok = equal(oldOut, newOut); System.err.println((ok ? "pass" : "FAIL") + ": " + testClassName); if (!ok && viewResults) view(oldOut, newOut); return ok; } - String runOldJavap(String[] args) { + byte[] runOldJavap(String[] args) { //System.err.println("OLD: " + Arrays.asList(args)); PrintStream oldOut = System.out; ByteArrayOutputStream out = new ByteArrayOutputStream(); @@ -101,29 +101,34 @@ public class ListTest { } finally { System.setOut(oldOut); } - return out.toString(); + return out.toByteArray(); } - String runNewJavap(String[] args) { + byte[] runNewJavap(String[] args) { String[] nArgs = new String[args.length + 2]; nArgs[0] = "-XDcompat"; nArgs[1] = "-XDignore.symbol.file"; System.arraycopy(args, 0, nArgs, 2, args.length); //System.err.println("NEW: " + Arrays.asList(nArgs)); - StringWriter out = new StringWriter(); - com.sun.tools.javap.Main.run(nArgs, new PrintWriter(out, true)); - return out.toString(); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + com.sun.tools.javap.Main.run(nArgs, + new PrintWriter(new OutputStreamWriter(out), true)); + return out.toByteArray(); } - File write(String text, String suffix) throws IOException { - File f = File.createTempFile("ListTest", suffix); - FileWriter out = new FileWriter(f); + File write(byte[] text, String suffix) throws IOException { + File f = new File("ListTest." + suffix); + FileOutputStream out = new FileOutputStream(f); out.write(text); out.close(); return f; } - void view(String oldOut, String newOut) throws Exception { + boolean equal(byte[] a1, byte[] a2) { + return Arrays.equals(a1, a2); + } + + void view(byte[] oldOut, byte[] newOut) throws Exception { File oldFile = write(oldOut, "old"); File newFile = write(newOut, "new"); List cmd = new ArrayList(); From caa22f148335518fc8f958d7c33a2e1ab231899b Mon Sep 17 00:00:00 2001 From: Maurizio Cimadamore Date: Tue, 28 Oct 2008 14:05:59 +0000 Subject: [PATCH 088/267] 6763518: Impossible to suppress raw-type warnings Check.validate(Type) should be invoked after -Xlint is augmented in Attr.visitVarDef Reviewed-by: darcy --- .../com/sun/tools/javac/comp/Attr.java | 6 +-- .../tools/javac/resources/compiler.properties | 2 +- .../test/tools/javac/6304921/T6304921.out | 2 +- .../test/tools/javac/warnings/T6763518.java | 41 +++++++++++++++++++ 4 files changed, 46 insertions(+), 5 deletions(-) create mode 100644 langtools/test/tools/javac/warnings/T6763518.java diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java index e6615d50a00..16661090a66 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java @@ -706,13 +706,13 @@ public class Attr extends JCTree.Visitor { } } - // Check that the variable's declared type is well-formed. - chk.validate(tree.vartype, env); - VarSymbol v = tree.sym; Lint lint = env.info.lint.augment(v.attributes_field, v.flags()); Lint prevLint = chk.setLint(lint); + // Check that the variable's declared type is well-formed. + chk.validate(tree.vartype, env); + try { chk.checkDeprecatedAnnotation(tree.pos(), v); diff --git a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties index 60d151b47ab..0ea7064f462 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties +++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties @@ -774,7 +774,7 @@ compiler.warn.annotation.method.not.found.reason=\ Cannot find annotation method ''{1}()'' in type ''{0}'': {2} compiler.warn.raw.class.use=\ - [raw-type] found raw type: {0}\n\ + [rawtypes] found raw type: {0}\n\ missing type parameters for generic class {1} ##### diff --git a/langtools/test/tools/javac/6304921/T6304921.out b/langtools/test/tools/javac/6304921/T6304921.out index 4a8cb59f79c..27b869deaef 100644 --- a/langtools/test/tools/javac/6304921/T6304921.out +++ b/langtools/test/tools/javac/6304921/T6304921.out @@ -1,4 +1,4 @@ -T6304921.java:671/671/680: warning: [raw-type] found raw type: java.util.ArrayList +T6304921.java:671/671/680: warning: [rawtypes] found raw type: java.util.ArrayList missing type parameters for generic class java.util.ArrayList List list = new ArrayList(); ^ diff --git a/langtools/test/tools/javac/warnings/T6763518.java b/langtools/test/tools/javac/warnings/T6763518.java new file mode 100644 index 00000000000..966c8625f3c --- /dev/null +++ b/langtools/test/tools/javac/warnings/T6763518.java @@ -0,0 +1,41 @@ +/* + * 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. + * + * 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 6763518 + * @summary Impossible to suppress raw-type warnings + * @compile -Werror -Xlint:rawtypes T6763518.java + */ + +import java.util.List; + +class T6763518 { + @SuppressWarnings("rawtypes") + List l1; + + void m(@SuppressWarnings("rawtypes") List l2) { + @SuppressWarnings("rawtypes") + List l3; + }; +} From 333adf3ae1290d4bab11853dd21550d5db150b90 Mon Sep 17 00:00:00 2001 From: Chris Hegarty Date: Tue, 28 Oct 2008 16:14:51 +0000 Subject: [PATCH 089/267] 6756771: com.sun.net.httpserver.HttpServer should handle POSTs larger than 2Gig Update implementation to use long instead of int Reviewed-by: michaelm --- .../sun/net/httpserver/ExchangeImpl.java | 6 +- .../httpserver/FixedLengthInputStream.java | 10 +- .../classes/sun/net/httpserver/Request.java | 2 +- .../sun/net/httpserver/ServerImpl.java | 6 +- .../bugs/FixedLengthInputStream.java | 172 ++++++++++++++++++ 5 files changed, 184 insertions(+), 12 deletions(-) create mode 100644 jdk/test/com/sun/net/httpserver/bugs/FixedLengthInputStream.java diff --git a/jdk/src/share/classes/sun/net/httpserver/ExchangeImpl.java b/jdk/src/share/classes/sun/net/httpserver/ExchangeImpl.java index 2560d7fea75..286e7352f25 100644 --- a/jdk/src/share/classes/sun/net/httpserver/ExchangeImpl.java +++ b/jdk/src/share/classes/sun/net/httpserver/ExchangeImpl.java @@ -43,7 +43,7 @@ class ExchangeImpl { String method; URI uri; HttpConnection connection; - int reqContentLen; + long reqContentLen; long rspContentLen; /* raw streams which access the socket directly */ InputStream ris; @@ -79,7 +79,7 @@ class ExchangeImpl { ServerImpl server; ExchangeImpl ( - String m, URI u, Request req, int len, HttpConnection connection + String m, URI u, Request req, long len, HttpConnection connection ) throws IOException { this.req = req; this.reqHdrs = req.headers(); @@ -148,7 +148,7 @@ class ExchangeImpl { if (uis != null) { return uis; } - if (reqContentLen == -1) { + if (reqContentLen == -1L) { uis_orig = new ChunkedInputStream (this, ris); uis = uis_orig; } else { diff --git a/jdk/src/share/classes/sun/net/httpserver/FixedLengthInputStream.java b/jdk/src/share/classes/sun/net/httpserver/FixedLengthInputStream.java index 6d6c9587fba..1061fb1c039 100644 --- a/jdk/src/share/classes/sun/net/httpserver/FixedLengthInputStream.java +++ b/jdk/src/share/classes/sun/net/httpserver/FixedLengthInputStream.java @@ -37,21 +37,21 @@ import com.sun.net.httpserver.spi.*; */ class FixedLengthInputStream extends LeftOverInputStream { - private int remaining; + private long remaining; - FixedLengthInputStream (ExchangeImpl t, InputStream src, int len) { + FixedLengthInputStream (ExchangeImpl t, InputStream src, long len) { super (t, src); this.remaining = len; } protected int readImpl (byte[]b, int off, int len) throws IOException { - eof = (remaining == 0); + eof = (remaining == 0L); if (eof) { return -1; } if (len > remaining) { - len = remaining; + len = (int)remaining; } int n = in.read(b, off, len); if (n > -1) { @@ -65,7 +65,7 @@ class FixedLengthInputStream extends LeftOverInputStream { return 0; } int n = in.available(); - return n < remaining? n: remaining; + return n < remaining? n: (int)remaining; } public boolean markSupported () {return false;} diff --git a/jdk/src/share/classes/sun/net/httpserver/Request.java b/jdk/src/share/classes/sun/net/httpserver/Request.java index bdafe663c1b..8b50ad83a87 100644 --- a/jdk/src/share/classes/sun/net/httpserver/Request.java +++ b/jdk/src/share/classes/sun/net/httpserver/Request.java @@ -53,7 +53,7 @@ class Request { do { startLine = readLine(); /* skip blank lines */ - } while (startLine.equals ("")); + } while (startLine == null ? false : startLine.equals ("")); } diff --git a/jdk/src/share/classes/sun/net/httpserver/ServerImpl.java b/jdk/src/share/classes/sun/net/httpserver/ServerImpl.java index a6d4b079763..cfff8dd0f6a 100644 --- a/jdk/src/share/classes/sun/net/httpserver/ServerImpl.java +++ b/jdk/src/share/classes/sun/net/httpserver/ServerImpl.java @@ -470,13 +470,13 @@ class ServerImpl implements TimeSource { String version = requestLine.substring (start); Headers headers = req.headers(); String s = headers.getFirst ("Transfer-encoding"); - int clen = 0; + long clen = 0L; if (s !=null && s.equalsIgnoreCase ("chunked")) { - clen = -1; + clen = -1L; } else { s = headers.getFirst ("Content-Length"); if (s != null) { - clen = Integer.parseInt (s); + clen = Long.parseLong(s); } } ctx = contexts.findContext (protocol, uri.getPath()); diff --git a/jdk/test/com/sun/net/httpserver/bugs/FixedLengthInputStream.java b/jdk/test/com/sun/net/httpserver/bugs/FixedLengthInputStream.java new file mode 100644 index 00000000000..76a71fc120b --- /dev/null +++ b/jdk/test/com/sun/net/httpserver/bugs/FixedLengthInputStream.java @@ -0,0 +1,172 @@ +/* + * 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. + * + * 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 6756771 + * @summary com.sun.net.httpserver.HttpServer should handle POSTs larger than 2Gig + */ + +import java.io.InputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.io.PrintStream; +import java.net.InetSocketAddress; +import java.net.HttpURLConnection; +import java.net.URL; +import java.net.Socket; +import java.util.logging.*; +import com.sun.net.httpserver.HttpExchange; +import com.sun.net.httpserver.HttpHandler; +import com.sun.net.httpserver.HttpServer; + +public class FixedLengthInputStream +{ + static final long POST_SIZE = 4L * 1024L * 1024L * 1024L; // 4Gig + + /* Remove when CR 6755625 is fixed */ + static final String requestHeaders = ((new StringBuilder()) + .append("POST /flis/ HTTP/1.1\r\n") + .append("User-Agent: Java/1.7.0\r\n") + .append("Host: localhost\r\n") + .append("Accept: text/html, image/gif, image/jpeg,") + .append( " *; q=.2, */*; q=.2\r\n") + .append("Content-Length: 4294967296\r\n\r\n")).toString(); + + void test(String[] args) throws IOException { + HttpServer httpServer = startHttpServer(); + int port = httpServer.getAddress().getPort(); + try { + /* Uncomment & when CR 6755625 is fixed, remove socket code + URL url = new URL("http://localhost:" + port + "/flis/"); + HttpURLConnection uc = (HttpURLConnection)url.openConnection(); + uc.setDoOutput(true); + uc.setRequestMethod("POST"); + uc.setFixedLengthStreamingMode(POST_SIZE); + OutputStream os = uc.getOutputStream(); + */ + + Socket socket = new Socket("localhost", port); + OutputStream os = socket.getOutputStream(); + PrintStream ps = new PrintStream(os); + debug("Request: " + requestHeaders); + ps.print(requestHeaders); + ps.flush(); + + /* create a 32K byte array with data to POST */ + int thirtyTwoK = 32 * 1024; + byte[] ba = new byte[thirtyTwoK]; + for (int i =0; i k = new Object(){}.getClass().getEnclosingClass(); + try {k.getMethod("instanceMain",String[].class) + .invoke( k.newInstance(), (Object) args);} + catch (Throwable e) {throw e.getCause();}} + public void instanceMain(String[] args) throws Throwable { + try {test(args);} catch (Throwable t) {unexpected(t);} + System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); + if (failed > 0) throw new AssertionError("Some tests failed");} + +} From 429a95440a995e537dd8c93c6f4f60d8f6445574 Mon Sep 17 00:00:00 2001 From: Tom Rodriguez Date: Tue, 28 Oct 2008 09:31:30 -0700 Subject: [PATCH 090/267] 6754519: don't emit flag fixup for NaN when condition being tested doesn't need it Reviewed-by: kvn, rasbold --- hotspot/src/cpu/sparc/vm/sparc.ad | 153 ++++---- hotspot/src/cpu/x86/vm/x86_32.ad | 458 ++++++++++++++++++++---- hotspot/src/cpu/x86/vm/x86_64.ad | 375 +++++++++++++++++-- hotspot/src/share/vm/adlc/adlparse.cpp | 212 +++++++++-- hotspot/src/share/vm/adlc/adlparse.hpp | 6 +- hotspot/src/share/vm/adlc/filebuff.cpp | 2 + hotspot/src/share/vm/adlc/filebuff.hpp | 2 + hotspot/src/share/vm/adlc/forms.cpp | 2 + hotspot/src/share/vm/adlc/forms.hpp | 2 + hotspot/src/share/vm/adlc/formssel.cpp | 30 +- hotspot/src/share/vm/adlc/formssel.hpp | 16 +- hotspot/src/share/vm/adlc/output_c.cpp | 28 +- hotspot/src/share/vm/adlc/output_h.cpp | 77 +++- hotspot/src/share/vm/opto/matcher.hpp | 2 +- hotspot/src/share/vm/opto/output.cpp | 12 +- hotspot/src/share/vm/opto/reg_split.cpp | 1 + 16 files changed, 1125 insertions(+), 253 deletions(-) diff --git a/hotspot/src/cpu/sparc/vm/sparc.ad b/hotspot/src/cpu/sparc/vm/sparc.ad index c02673b3efc..145a1564bb3 100644 --- a/hotspot/src/cpu/sparc/vm/sparc.ad +++ b/hotspot/src/cpu/sparc/vm/sparc.ad @@ -1743,7 +1743,7 @@ const bool Matcher::convL2FSupported(void) { // // NOTE: If the platform does not provide any short branch variants, then // this method should return false for offset 0. -bool Matcher::is_short_branch_offset(int offset) { +bool Matcher::is_short_branch_offset(int rule, int offset) { return false; } @@ -1926,18 +1926,23 @@ encode %{ $mem$$base, $mem$$disp, $mem$$index, $dst$$reg); %} + enc_class simple_form3_mem_reg( memory mem, iRegI dst ) %{ + emit_form3_mem_reg(cbuf, this, $primary, -1, + $mem$$base, $mem$$disp, $mem$$index, $dst$$reg); + %} + enc_class form3_mem_reg_little( memory mem, iRegI dst) %{ - emit_form3_mem_reg_asi(cbuf, this, $primary, $tertiary, + emit_form3_mem_reg_asi(cbuf, this, $primary, -1, $mem$$base, $mem$$disp, $mem$$index, $dst$$reg, Assembler::ASI_PRIMARY_LITTLE); %} enc_class form3_mem_prefetch_read( memory mem ) %{ - emit_form3_mem_reg(cbuf, this, $primary, $tertiary, + emit_form3_mem_reg(cbuf, this, $primary, -1, $mem$$base, $mem$$disp, $mem$$index, 0/*prefetch function many-reads*/); %} enc_class form3_mem_prefetch_write( memory mem ) %{ - emit_form3_mem_reg(cbuf, this, $primary, $tertiary, + emit_form3_mem_reg(cbuf, this, $primary, -1, $mem$$base, $mem$$disp, $mem$$index, 2/*prefetch function many-writes*/); %} @@ -1945,8 +1950,8 @@ encode %{ assert( Assembler::is_simm13($mem$$disp ), "need disp and disp+4" ); assert( Assembler::is_simm13($mem$$disp+4), "need disp and disp+4" ); guarantee($mem$$index == R_G0_enc, "double index?"); - emit_form3_mem_reg(cbuf, this, $primary, $tertiary, $mem$$base, $mem$$disp+4, R_G0_enc, R_O7_enc ); - emit_form3_mem_reg(cbuf, this, $primary, $tertiary, $mem$$base, $mem$$disp, R_G0_enc, $reg$$reg ); + emit_form3_mem_reg(cbuf, this, $primary, -1, $mem$$base, $mem$$disp+4, R_G0_enc, R_O7_enc ); + emit_form3_mem_reg(cbuf, this, $primary, -1, $mem$$base, $mem$$disp, R_G0_enc, $reg$$reg ); emit3_simm13( cbuf, Assembler::arith_op, $reg$$reg, Assembler::sllx_op3, $reg$$reg, 0x1020 ); emit3( cbuf, Assembler::arith_op, $reg$$reg, Assembler::or_op3, $reg$$reg, 0, R_O7_enc ); %} @@ -1956,14 +1961,14 @@ encode %{ assert( Assembler::is_simm13($mem$$disp+4), "need disp and disp+4" ); guarantee($mem$$index == R_G0_enc, "double index?"); // Load long with 2 instructions - emit_form3_mem_reg(cbuf, this, $primary, $tertiary, $mem$$base, $mem$$disp, R_G0_enc, $reg$$reg+0 ); - emit_form3_mem_reg(cbuf, this, $primary, $tertiary, $mem$$base, $mem$$disp+4, R_G0_enc, $reg$$reg+1 ); + emit_form3_mem_reg(cbuf, this, $primary, -1, $mem$$base, $mem$$disp, R_G0_enc, $reg$$reg+0 ); + emit_form3_mem_reg(cbuf, this, $primary, -1, $mem$$base, $mem$$disp+4, R_G0_enc, $reg$$reg+1 ); %} //%%% form3_mem_plus_4_reg is a hack--get rid of it enc_class form3_mem_plus_4_reg( memory mem, iRegI dst ) %{ guarantee($mem$$disp, "cannot offset a reg-reg operand by 4"); - emit_form3_mem_reg(cbuf, this, $primary, $tertiary, $mem$$base, $mem$$disp + 4, $mem$$index, $dst$$reg); + emit_form3_mem_reg(cbuf, this, $primary, -1, $mem$$base, $mem$$disp + 4, $mem$$index, $dst$$reg); %} enc_class form3_g0_rs2_rd_move( iRegI rs2, iRegI rd ) %{ @@ -5062,7 +5067,7 @@ instruct stkI_to_regF(regF dst, stackSlotI src) %{ size(4); format %{ "LDF $src,$dst\t! stkI to regF" %} opcode(Assembler::ldf_op3); - ins_encode(form3_mem_reg(src, dst)); + ins_encode(simple_form3_mem_reg(src, dst)); ins_pipe(floadF_stk); %} @@ -5073,7 +5078,7 @@ instruct stkL_to_regD(regD dst, stackSlotL src) %{ size(4); format %{ "LDDF $src,$dst\t! stkL to regD" %} opcode(Assembler::lddf_op3); - ins_encode(form3_mem_reg(src, dst)); + ins_encode(simple_form3_mem_reg(src, dst)); ins_pipe(floadD_stk); %} @@ -5084,7 +5089,7 @@ instruct regF_to_stkI(stackSlotI dst, regF src) %{ size(4); format %{ "STF $src,$dst\t! regF to stkI" %} opcode(Assembler::stf_op3); - ins_encode(form3_mem_reg(dst, src)); + ins_encode(simple_form3_mem_reg(dst, src)); ins_pipe(fstoreF_stk_reg); %} @@ -5095,7 +5100,7 @@ instruct regD_to_stkL(stackSlotL dst, regD src) %{ size(4); format %{ "STDF $src,$dst\t! regD to stkL" %} opcode(Assembler::stdf_op3); - ins_encode(form3_mem_reg(dst, src)); + ins_encode(simple_form3_mem_reg(dst, src)); ins_pipe(fstoreD_stk_reg); %} @@ -5106,7 +5111,7 @@ instruct regI_to_stkLHi(stackSlotL dst, iRegI src) %{ format %{ "STW $src,$dst.hi\t! long\n\t" "STW R_G0,$dst.lo" %} opcode(Assembler::stw_op3); - ins_encode(form3_mem_reg(dst, src), form3_mem_plus_4_reg(dst, R_G0)); + ins_encode(simple_form3_mem_reg(dst, src), form3_mem_plus_4_reg(dst, R_G0)); ins_pipe(lstoreI_stk_reg); %} @@ -5117,7 +5122,7 @@ instruct regL_to_stkD(stackSlotD dst, iRegL src) %{ size(4); format %{ "STX $src,$dst\t! regL to stkD" %} opcode(Assembler::stx_op3); - ins_encode( form3_mem_reg( dst, src ) ); + ins_encode(simple_form3_mem_reg( dst, src ) ); ins_pipe(istore_stk_reg); %} @@ -5131,7 +5136,7 @@ instruct stkI_to_regI( iRegI dst, stackSlotI src ) %{ size(4); format %{ "LDUW $src,$dst\t!stk" %} opcode(Assembler::lduw_op3); - ins_encode( form3_mem_reg( src, dst ) ); + ins_encode(simple_form3_mem_reg( src, dst ) ); ins_pipe(iload_mem); %} @@ -5143,7 +5148,7 @@ instruct regI_to_stkI( stackSlotI dst, iRegI src ) %{ size(4); format %{ "STW $src,$dst\t!stk" %} opcode(Assembler::stw_op3); - ins_encode( form3_mem_reg( dst, src ) ); + ins_encode(simple_form3_mem_reg( dst, src ) ); ins_pipe(istore_mem_reg); %} @@ -5155,7 +5160,7 @@ instruct stkL_to_regL( iRegL dst, stackSlotL src ) %{ size(4); format %{ "LDX $src,$dst\t! long" %} opcode(Assembler::ldx_op3); - ins_encode( form3_mem_reg( src, dst ) ); + ins_encode(simple_form3_mem_reg( src, dst ) ); ins_pipe(iload_mem); %} @@ -5167,7 +5172,7 @@ instruct regL_to_stkL(stackSlotL dst, iRegL src) %{ size(4); format %{ "STX $src,$dst\t! long" %} opcode(Assembler::stx_op3); - ins_encode( form3_mem_reg( dst, src ) ); + ins_encode(simple_form3_mem_reg( dst, src ) ); ins_pipe(istore_mem_reg); %} @@ -5179,7 +5184,7 @@ instruct stkP_to_regP( iRegP dst, stackSlotP src ) %{ size(4); format %{ "LDX $src,$dst\t!ptr" %} opcode(Assembler::ldx_op3); - ins_encode( form3_mem_reg( src, dst ) ); + ins_encode(simple_form3_mem_reg( src, dst ) ); ins_pipe(iload_mem); %} @@ -5190,7 +5195,7 @@ instruct regP_to_stkP(stackSlotP dst, iRegP src) %{ size(4); format %{ "STX $src,$dst\t!ptr" %} opcode(Assembler::stx_op3); - ins_encode( form3_mem_reg( dst, src ) ); + ins_encode(simple_form3_mem_reg( dst, src ) ); ins_pipe(istore_mem_reg); %} #else // _LP64 @@ -5200,7 +5205,7 @@ instruct stkP_to_regP( iRegP dst, stackSlotP src ) %{ ins_cost(MEMORY_REF_COST); format %{ "LDUW $src,$dst\t!ptr" %} opcode(Assembler::lduw_op3, Assembler::ldst_op); - ins_encode( form3_mem_reg( src, dst ) ); + ins_encode(simple_form3_mem_reg( src, dst ) ); ins_pipe(iload_mem); %} @@ -5210,7 +5215,7 @@ instruct regP_to_stkP(stackSlotP dst, iRegP src) %{ ins_cost(MEMORY_REF_COST); format %{ "STW $src,$dst\t!ptr" %} opcode(Assembler::stw_op3, Assembler::ldst_op); - ins_encode( form3_mem_reg( dst, src ) ); + ins_encode(simple_form3_mem_reg( dst, src ) ); ins_pipe(istore_mem_reg); %} #endif // _LP64 @@ -5273,7 +5278,7 @@ instruct loadB(iRegI dst, memory mem) %{ size(4); format %{ "LDSB $mem,$dst" %} opcode(Assembler::ldsb_op3); - ins_encode( form3_mem_reg( mem, dst ) ); + ins_encode(simple_form3_mem_reg( mem, dst ) ); ins_pipe(iload_mask_mem); %} @@ -5285,7 +5290,7 @@ instruct loadUB(iRegI dst, memory mem, immI_255 bytemask) %{ size(4); format %{ "LDUB $mem,$dst" %} opcode(Assembler::ldub_op3); - ins_encode( form3_mem_reg( mem, dst ) ); + ins_encode(simple_form3_mem_reg( mem, dst ) ); ins_pipe(iload_mask_mem); %} @@ -5297,7 +5302,7 @@ instruct loadUBL(iRegL dst, memory mem, immL_FF bytemask) %{ size(4); format %{ "LDUB $mem,$dst" %} opcode(Assembler::ldub_op3); - ins_encode( form3_mem_reg( mem, dst ) ); + ins_encode(simple_form3_mem_reg( mem, dst ) ); ins_pipe(iload_mask_mem); %} @@ -5309,7 +5314,7 @@ instruct loadUCL(iRegL dst, memory mem, immL_FFFF bytemask) %{ size(4); format %{ "LDUH $mem,$dst" %} opcode(Assembler::lduh_op3); - ins_encode( form3_mem_reg( mem, dst ) ); + ins_encode(simple_form3_mem_reg( mem, dst ) ); ins_pipe(iload_mask_mem); %} @@ -5321,7 +5326,7 @@ instruct loadC(iRegI dst, memory mem) %{ size(4); format %{ "LDUH $mem,$dst" %} opcode(Assembler::lduh_op3); - ins_encode( form3_mem_reg( mem, dst ) ); + ins_encode(simple_form3_mem_reg( mem, dst ) ); ins_pipe(iload_mask_mem); %} @@ -5333,7 +5338,7 @@ instruct loadI(iRegI dst, memory mem) %{ format %{ "LDUW $mem,$dst" %} opcode(Assembler::lduw_op3); - ins_encode( form3_mem_reg( mem, dst ) ); + ins_encode(simple_form3_mem_reg( mem, dst ) ); ins_pipe(iload_mem); %} @@ -5344,7 +5349,7 @@ instruct loadL(iRegL dst, memory mem ) %{ size(4); format %{ "LDX $mem,$dst\t! long" %} opcode(Assembler::ldx_op3); - ins_encode( form3_mem_reg( mem, dst ) ); + ins_encode(simple_form3_mem_reg( mem, dst ) ); ins_pipe(iload_mem); %} @@ -5359,7 +5364,7 @@ instruct loadL_unaligned(iRegL dst, memory mem, o7RegI tmp) %{ "\tSLLX #32, $dst, $dst\n" "\tOR $dst, R_O7, $dst" %} opcode(Assembler::lduw_op3); - ins_encode( form3_mem_reg_long_unaligned_marshal( mem, dst )); + ins_encode(form3_mem_reg_long_unaligned_marshal( mem, dst )); ins_pipe(iload_mem); %} @@ -5370,7 +5375,7 @@ instruct loadA8B(regD dst, memory mem) %{ size(4); format %{ "LDDF $mem,$dst\t! packed8B" %} opcode(Assembler::lddf_op3); - ins_encode( form3_mem_reg( mem, dst ) ); + ins_encode(simple_form3_mem_reg( mem, dst ) ); ins_pipe(floadD_mem); %} @@ -5381,7 +5386,7 @@ instruct loadA4C(regD dst, memory mem) %{ size(4); format %{ "LDDF $mem,$dst\t! packed4C" %} opcode(Assembler::lddf_op3); - ins_encode( form3_mem_reg( mem, dst ) ); + ins_encode(simple_form3_mem_reg( mem, dst ) ); ins_pipe(floadD_mem); %} @@ -5392,7 +5397,7 @@ instruct loadA4S(regD dst, memory mem) %{ size(4); format %{ "LDDF $mem,$dst\t! packed4S" %} opcode(Assembler::lddf_op3); - ins_encode( form3_mem_reg( mem, dst ) ); + ins_encode(simple_form3_mem_reg( mem, dst ) ); ins_pipe(floadD_mem); %} @@ -5403,7 +5408,7 @@ instruct loadA2I(regD dst, memory mem) %{ size(4); format %{ "LDDF $mem,$dst\t! packed2I" %} opcode(Assembler::lddf_op3); - ins_encode( form3_mem_reg( mem, dst ) ); + ins_encode(simple_form3_mem_reg( mem, dst ) ); ins_pipe(floadD_mem); %} @@ -5415,7 +5420,7 @@ instruct loadRange(iRegI dst, memory mem) %{ size(4); format %{ "LDUW $mem,$dst\t! range" %} opcode(Assembler::lduw_op3); - ins_encode( form3_mem_reg( mem, dst ) ); + ins_encode(simple_form3_mem_reg( mem, dst ) ); ins_pipe(iload_mem); %} @@ -5427,7 +5432,7 @@ instruct loadI_freg(regF dst, memory mem) %{ format %{ "LDF $mem,$dst\t! for fitos/fitod" %} opcode(Assembler::ldf_op3); - ins_encode( form3_mem_reg( mem, dst ) ); + ins_encode(simple_form3_mem_reg( mem, dst ) ); ins_pipe(floadF_mem); %} @@ -5514,7 +5519,7 @@ instruct loadS(iRegI dst, memory mem) %{ size(4); format %{ "LDSH $mem,$dst" %} opcode(Assembler::ldsh_op3); - ins_encode( form3_mem_reg( mem, dst ) ); + ins_encode(simple_form3_mem_reg( mem, dst ) ); ins_pipe(iload_mask_mem); %} @@ -5526,7 +5531,7 @@ instruct loadD(regD dst, memory mem) %{ size(4); format %{ "LDDF $mem,$dst" %} opcode(Assembler::lddf_op3); - ins_encode( form3_mem_reg( mem, dst ) ); + ins_encode(simple_form3_mem_reg( mem, dst ) ); ins_pipe(floadD_mem); %} @@ -5550,7 +5555,7 @@ instruct loadF(regF dst, memory mem) %{ size(4); format %{ "LDF $mem,$dst" %} opcode(Assembler::ldf_op3); - ins_encode( form3_mem_reg( mem, dst ) ); + ins_encode(simple_form3_mem_reg( mem, dst ) ); ins_pipe(floadF_mem); %} @@ -5719,7 +5724,7 @@ instruct storeB(memory mem, iRegI src) %{ size(4); format %{ "STB $src,$mem\t! byte" %} opcode(Assembler::stb_op3); - ins_encode( form3_mem_reg( mem, src ) ); + ins_encode(simple_form3_mem_reg( mem, src ) ); ins_pipe(istore_mem_reg); %} @@ -5730,7 +5735,7 @@ instruct storeB0(memory mem, immI0 src) %{ size(4); format %{ "STB $src,$mem\t! byte" %} opcode(Assembler::stb_op3); - ins_encode( form3_mem_reg( mem, R_G0 ) ); + ins_encode(simple_form3_mem_reg( mem, R_G0 ) ); ins_pipe(istore_mem_zero); %} @@ -5741,7 +5746,7 @@ instruct storeCM0(memory mem, immI0 src) %{ size(4); format %{ "STB $src,$mem\t! CMS card-mark byte 0" %} opcode(Assembler::stb_op3); - ins_encode( form3_mem_reg( mem, R_G0 ) ); + ins_encode(simple_form3_mem_reg( mem, R_G0 ) ); ins_pipe(istore_mem_zero); %} @@ -5753,7 +5758,7 @@ instruct storeC(memory mem, iRegI src) %{ size(4); format %{ "STH $src,$mem\t! short" %} opcode(Assembler::sth_op3); - ins_encode( form3_mem_reg( mem, src ) ); + ins_encode(simple_form3_mem_reg( mem, src ) ); ins_pipe(istore_mem_reg); %} @@ -5764,7 +5769,7 @@ instruct storeC0(memory mem, immI0 src) %{ size(4); format %{ "STH $src,$mem\t! short" %} opcode(Assembler::sth_op3); - ins_encode( form3_mem_reg( mem, R_G0 ) ); + ins_encode(simple_form3_mem_reg( mem, R_G0 ) ); ins_pipe(istore_mem_zero); %} @@ -5776,7 +5781,7 @@ instruct storeI(memory mem, iRegI src) %{ size(4); format %{ "STW $src,$mem" %} opcode(Assembler::stw_op3); - ins_encode( form3_mem_reg( mem, src ) ); + ins_encode(simple_form3_mem_reg( mem, src ) ); ins_pipe(istore_mem_reg); %} @@ -5787,7 +5792,7 @@ instruct storeL(memory mem, iRegL src) %{ size(4); format %{ "STX $src,$mem\t! long" %} opcode(Assembler::stx_op3); - ins_encode( form3_mem_reg( mem, src ) ); + ins_encode(simple_form3_mem_reg( mem, src ) ); ins_pipe(istore_mem_reg); %} @@ -5798,7 +5803,7 @@ instruct storeI0(memory mem, immI0 src) %{ size(4); format %{ "STW $src,$mem" %} opcode(Assembler::stw_op3); - ins_encode( form3_mem_reg( mem, R_G0 ) ); + ins_encode(simple_form3_mem_reg( mem, R_G0 ) ); ins_pipe(istore_mem_zero); %} @@ -5809,7 +5814,7 @@ instruct storeL0(memory mem, immL0 src) %{ size(4); format %{ "STX $src,$mem" %} opcode(Assembler::stx_op3); - ins_encode( form3_mem_reg( mem, R_G0 ) ); + ins_encode(simple_form3_mem_reg( mem, R_G0 ) ); ins_pipe(istore_mem_zero); %} @@ -5821,7 +5826,7 @@ instruct storeI_Freg(memory mem, regF src) %{ size(4); format %{ "STF $src,$mem\t! after fstoi/fdtoi" %} opcode(Assembler::stf_op3); - ins_encode( form3_mem_reg( mem, src ) ); + ins_encode(simple_form3_mem_reg( mem, src ) ); ins_pipe(fstoreF_mem_reg); %} @@ -5904,7 +5909,7 @@ instruct storeD( memory mem, regD src) %{ size(4); format %{ "STDF $src,$mem" %} opcode(Assembler::stdf_op3); - ins_encode( form3_mem_reg( mem, src ) ); + ins_encode(simple_form3_mem_reg( mem, src ) ); ins_pipe(fstoreD_mem_reg); %} @@ -5915,7 +5920,7 @@ instruct storeD0( memory mem, immD0 src) %{ size(4); format %{ "STX $src,$mem" %} opcode(Assembler::stx_op3); - ins_encode( form3_mem_reg( mem, R_G0 ) ); + ins_encode(simple_form3_mem_reg( mem, R_G0 ) ); ins_pipe(fstoreD_mem_zero); %} @@ -5927,7 +5932,7 @@ instruct storeF( memory mem, regF src) %{ size(4); format %{ "STF $src,$mem" %} opcode(Assembler::stf_op3); - ins_encode( form3_mem_reg( mem, src ) ); + ins_encode(simple_form3_mem_reg( mem, src ) ); ins_pipe(fstoreF_mem_reg); %} @@ -5938,7 +5943,7 @@ instruct storeF0( memory mem, immF0 src) %{ size(4); format %{ "STW $src,$mem\t! storeF0" %} opcode(Assembler::stw_op3); - ins_encode( form3_mem_reg( mem, R_G0 ) ); + ins_encode(simple_form3_mem_reg( mem, R_G0 ) ); ins_pipe(fstoreF_mem_zero); %} @@ -5949,7 +5954,7 @@ instruct storeA8B(memory mem, regD src) %{ size(4); format %{ "STDF $src,$mem\t! packed8B" %} opcode(Assembler::stdf_op3); - ins_encode( form3_mem_reg( mem, src ) ); + ins_encode(simple_form3_mem_reg( mem, src ) ); ins_pipe(fstoreD_mem_reg); %} @@ -6004,7 +6009,7 @@ instruct storeA8B0(memory mem, immI0 zero) %{ size(4); format %{ "STX $zero,$mem\t! packed8B" %} opcode(Assembler::stx_op3); - ins_encode( form3_mem_reg( mem, R_G0 ) ); + ins_encode(simple_form3_mem_reg( mem, R_G0 ) ); ins_pipe(fstoreD_mem_zero); %} @@ -6015,7 +6020,7 @@ instruct storeA4C(memory mem, regD src) %{ size(4); format %{ "STDF $src,$mem\t! packed4C" %} opcode(Assembler::stdf_op3); - ins_encode( form3_mem_reg( mem, src ) ); + ins_encode(simple_form3_mem_reg( mem, src ) ); ins_pipe(fstoreD_mem_reg); %} @@ -6026,7 +6031,7 @@ instruct storeA4C0(memory mem, immI0 zero) %{ size(4); format %{ "STX $zero,$mem\t! packed4C" %} opcode(Assembler::stx_op3); - ins_encode( form3_mem_reg( mem, R_G0 ) ); + ins_encode(simple_form3_mem_reg( mem, R_G0 ) ); ins_pipe(fstoreD_mem_zero); %} @@ -6037,7 +6042,7 @@ instruct storeA2I(memory mem, regD src) %{ size(4); format %{ "STDF $src,$mem\t! packed2I" %} opcode(Assembler::stdf_op3); - ins_encode( form3_mem_reg( mem, src ) ); + ins_encode(simple_form3_mem_reg( mem, src ) ); ins_pipe(fstoreD_mem_reg); %} @@ -6048,7 +6053,7 @@ instruct storeA2I0(memory mem, immI0 zero) %{ size(4); format %{ "STX $zero,$mem\t! packed2I" %} opcode(Assembler::stx_op3); - ins_encode( form3_mem_reg( mem, R_G0 ) ); + ins_encode(simple_form3_mem_reg( mem, R_G0 ) ); ins_pipe(fstoreD_mem_zero); %} @@ -6162,7 +6167,7 @@ instruct stfSSD(stackSlotD stkSlot, regD src) %{ ins_cost(MEMORY_REF_COST); format %{ "STDF $src,$stkSlot\t!stk" %} opcode(Assembler::stdf_op3); - ins_encode(form3_mem_reg(stkSlot, src)); + ins_encode(simple_form3_mem_reg(stkSlot, src)); ins_pipe(fstoreD_stk_reg); %} @@ -6172,7 +6177,7 @@ instruct ldfSSD(regD dst, stackSlotD stkSlot) %{ ins_cost(MEMORY_REF_COST); format %{ "LDDF $stkSlot,$dst\t!stk" %} opcode(Assembler::lddf_op3); - ins_encode(form3_mem_reg(stkSlot, dst)); + ins_encode(simple_form3_mem_reg(stkSlot, dst)); ins_pipe(floadD_stk); %} @@ -6182,7 +6187,7 @@ instruct stfSSF(stackSlotF stkSlot, regF src) %{ ins_cost(MEMORY_REF_COST); format %{ "STF $src,$stkSlot\t!stk" %} opcode(Assembler::stf_op3); - ins_encode(form3_mem_reg(stkSlot, src)); + ins_encode(simple_form3_mem_reg(stkSlot, src)); ins_pipe(fstoreF_stk_reg); %} @@ -6584,7 +6589,7 @@ instruct loadLLocked(iRegL dst, memory mem) %{ size(4); format %{ "LDX $mem,$dst\t! long" %} opcode(Assembler::ldx_op3); - ins_encode( form3_mem_reg( mem, dst ) ); + ins_encode(simple_form3_mem_reg( mem, dst ) ); ins_pipe(iload_mem); %} @@ -7666,7 +7671,7 @@ instruct convI2D_mem( regD_low dst, memory mem ) %{ format %{ "LDF $mem,$dst\n\t" "FITOD $dst,$dst" %} opcode(Assembler::ldf_op3, Assembler::fitod_opf); - ins_encode( form3_mem_reg( mem, dst ), form3_convI2F(dst, dst)); + ins_encode(simple_form3_mem_reg( mem, dst ), form3_convI2F(dst, dst)); ins_pipe(floadF_mem); %} @@ -7696,7 +7701,7 @@ instruct convI2F_mem( regF dst, memory mem ) %{ format %{ "LDF $mem,$dst\n\t" "FITOS $dst,$dst" %} opcode(Assembler::ldf_op3, Assembler::fitos_opf); - ins_encode( form3_mem_reg( mem, dst ), form3_convI2F(dst, dst)); + ins_encode(simple_form3_mem_reg( mem, dst ), form3_convI2F(dst, dst)); ins_pipe(floadF_mem); %} @@ -7738,7 +7743,7 @@ instruct MoveF2I_stack_reg(iRegI dst, stackSlotF src) %{ size(4); format %{ "LDUW $src,$dst\t! MoveF2I" %} opcode(Assembler::lduw_op3); - ins_encode( form3_mem_reg( src, dst ) ); + ins_encode(simple_form3_mem_reg( src, dst ) ); ins_pipe(iload_mem); %} @@ -7750,7 +7755,7 @@ instruct MoveI2F_stack_reg(regF dst, stackSlotI src) %{ size(4); format %{ "LDF $src,$dst\t! MoveI2F" %} opcode(Assembler::ldf_op3); - ins_encode(form3_mem_reg(src, dst)); + ins_encode(simple_form3_mem_reg(src, dst)); ins_pipe(floadF_stk); %} @@ -7762,7 +7767,7 @@ instruct MoveD2L_stack_reg(iRegL dst, stackSlotD src) %{ size(4); format %{ "LDX $src,$dst\t! MoveD2L" %} opcode(Assembler::ldx_op3); - ins_encode( form3_mem_reg( src, dst ) ); + ins_encode(simple_form3_mem_reg( src, dst ) ); ins_pipe(iload_mem); %} @@ -7774,7 +7779,7 @@ instruct MoveL2D_stack_reg(regD dst, stackSlotL src) %{ size(4); format %{ "LDDF $src,$dst\t! MoveL2D" %} opcode(Assembler::lddf_op3); - ins_encode(form3_mem_reg(src, dst)); + ins_encode(simple_form3_mem_reg(src, dst)); ins_pipe(floadD_stk); %} @@ -7786,7 +7791,7 @@ instruct MoveF2I_reg_stack(stackSlotI dst, regF src) %{ size(4); format %{ "STF $src,$dst\t!MoveF2I" %} opcode(Assembler::stf_op3); - ins_encode(form3_mem_reg(dst, src)); + ins_encode(simple_form3_mem_reg(dst, src)); ins_pipe(fstoreF_stk_reg); %} @@ -7798,7 +7803,7 @@ instruct MoveI2F_reg_stack(stackSlotF dst, iRegI src) %{ size(4); format %{ "STW $src,$dst\t!MoveI2F" %} opcode(Assembler::stw_op3); - ins_encode( form3_mem_reg( dst, src ) ); + ins_encode(simple_form3_mem_reg( dst, src ) ); ins_pipe(istore_mem_reg); %} @@ -7810,7 +7815,7 @@ instruct MoveD2L_reg_stack(stackSlotL dst, regD src) %{ size(4); format %{ "STDF $src,$dst\t!MoveD2L" %} opcode(Assembler::stdf_op3); - ins_encode(form3_mem_reg(dst, src)); + ins_encode(simple_form3_mem_reg(dst, src)); ins_pipe(fstoreD_stk_reg); %} @@ -7822,7 +7827,7 @@ instruct MoveL2D_reg_stack(stackSlotD dst, iRegL src) %{ size(4); format %{ "STX $src,$dst\t!MoveL2D" %} opcode(Assembler::stx_op3); - ins_encode( form3_mem_reg( dst, src ) ); + ins_encode(simple_form3_mem_reg( dst, src ) ); ins_pipe(istore_mem_reg); %} diff --git a/hotspot/src/cpu/x86/vm/x86_32.ad b/hotspot/src/cpu/x86/vm/x86_32.ad index 589051e06bf..30e5fc979c3 100644 --- a/hotspot/src/cpu/x86/vm/x86_32.ad +++ b/hotspot/src/cpu/x86/vm/x86_32.ad @@ -495,8 +495,8 @@ void encode_CopyXD( CodeBuffer &cbuf, int dst_encoding, int src_encoding ) { void MachPrologNode::format( PhaseRegAlloc *ra_, outputStream* st ) const { Compile* C = ra_->C; if( C->in_24_bit_fp_mode() ) { - tty->print("FLDCW 24 bit fpu control word"); - tty->print_cr(""); tty->print("\t"); + st->print("FLDCW 24 bit fpu control word"); + st->print_cr(""); st->print("\t"); } int framesize = C->frame_slots() << LogBytesPerInt; @@ -510,22 +510,22 @@ void MachPrologNode::format( PhaseRegAlloc *ra_, outputStream* st ) const { // stack. But the stack safety zone should account for that. // See bugs 4446381, 4468289, 4497237. if (C->need_stack_bang(framesize)) { - tty->print_cr("# stack bang"); tty->print("\t"); + st->print_cr("# stack bang"); st->print("\t"); } - tty->print_cr("PUSHL EBP"); tty->print("\t"); + st->print_cr("PUSHL EBP"); st->print("\t"); if( VerifyStackAtCalls ) { // Majik cookie to verify stack depth - tty->print("PUSH 0xBADB100D\t# Majik cookie for stack depth check"); - tty->print_cr(""); tty->print("\t"); + st->print("PUSH 0xBADB100D\t# Majik cookie for stack depth check"); + st->print_cr(""); st->print("\t"); framesize -= wordSize; } if ((C->in_24_bit_fp_mode() || VerifyStackAtCalls ) && framesize < 128 ) { if (framesize) { - tty->print("SUB ESP,%d\t# Create frame",framesize); + st->print("SUB ESP,%d\t# Create frame",framesize); } } else { - tty->print("SUB ESP,%d\t# Create frame",framesize); + st->print("SUB ESP,%d\t# Create frame",framesize); } } #endif @@ -725,18 +725,19 @@ static enum RC rc_class( OptoReg::Name reg ) { return rc_xmm; } -static int impl_helper( CodeBuffer *cbuf, bool do_size, bool is_load, int offset, int reg, int opcode, const char *op_str, int size ) { +static int impl_helper( CodeBuffer *cbuf, bool do_size, bool is_load, int offset, int reg, + int opcode, const char *op_str, int size, outputStream* st ) { if( cbuf ) { emit_opcode (*cbuf, opcode ); encode_RegMem(*cbuf, Matcher::_regEncode[reg], ESP_enc, 0x4, 0, offset, false); #ifndef PRODUCT } else if( !do_size ) { - if( size != 0 ) tty->print("\n\t"); + if( size != 0 ) st->print("\n\t"); if( opcode == 0x8B || opcode == 0x89 ) { // MOV - if( is_load ) tty->print("%s %s,[ESP + #%d]",op_str,Matcher::regName[reg],offset); - else tty->print("%s [ESP + #%d],%s",op_str,offset,Matcher::regName[reg]); + if( is_load ) st->print("%s %s,[ESP + #%d]",op_str,Matcher::regName[reg],offset); + else st->print("%s [ESP + #%d],%s",op_str,offset,Matcher::regName[reg]); } else { // FLD, FST, PUSH, POP - tty->print("%s [ESP + #%d]",op_str,offset); + st->print("%s [ESP + #%d]",op_str,offset); } #endif } @@ -746,7 +747,7 @@ static int impl_helper( CodeBuffer *cbuf, bool do_size, bool is_load, int offset // Helper for XMM registers. Extra opcode bits, limited syntax. static int impl_x_helper( CodeBuffer *cbuf, bool do_size, bool is_load, - int offset, int reg_lo, int reg_hi, int size ) { + int offset, int reg_lo, int reg_hi, int size, outputStream* st ) { if( cbuf ) { if( reg_lo+1 == reg_hi ) { // double move? if( is_load && !UseXmmLoadAndClearUpper ) @@ -764,17 +765,17 @@ static int impl_x_helper( CodeBuffer *cbuf, bool do_size, bool is_load, encode_RegMem(*cbuf, Matcher::_regEncode[reg_lo], ESP_enc, 0x4, 0, offset, false); #ifndef PRODUCT } else if( !do_size ) { - if( size != 0 ) tty->print("\n\t"); + if( size != 0 ) st->print("\n\t"); if( reg_lo+1 == reg_hi ) { // double move? - if( is_load ) tty->print("%s %s,[ESP + #%d]", + if( is_load ) st->print("%s %s,[ESP + #%d]", UseXmmLoadAndClearUpper ? "MOVSD " : "MOVLPD", Matcher::regName[reg_lo], offset); - else tty->print("MOVSD [ESP + #%d],%s", + else st->print("MOVSD [ESP + #%d],%s", offset, Matcher::regName[reg_lo]); } else { - if( is_load ) tty->print("MOVSS %s,[ESP + #%d]", + if( is_load ) st->print("MOVSS %s,[ESP + #%d]", Matcher::regName[reg_lo], offset); - else tty->print("MOVSS [ESP + #%d],%s", + else st->print("MOVSS [ESP + #%d],%s", offset, Matcher::regName[reg_lo]); } #endif @@ -785,7 +786,7 @@ static int impl_x_helper( CodeBuffer *cbuf, bool do_size, bool is_load, static int impl_movx_helper( CodeBuffer *cbuf, bool do_size, int src_lo, int dst_lo, - int src_hi, int dst_hi, int size ) { + int src_hi, int dst_hi, int size, outputStream* st ) { if( UseXmmRegToRegMoveAll ) {//Use movaps,movapd to move between xmm registers if( cbuf ) { if( (src_lo+1 == src_hi && dst_lo+1 == dst_hi) ) { @@ -796,11 +797,11 @@ static int impl_movx_helper( CodeBuffer *cbuf, bool do_size, int src_lo, int dst emit_rm (*cbuf, 0x3, Matcher::_regEncode[dst_lo], Matcher::_regEncode[src_lo] ); #ifndef PRODUCT } else if( !do_size ) { - if( size != 0 ) tty->print("\n\t"); + if( size != 0 ) st->print("\n\t"); if( src_lo+1 == src_hi && dst_lo+1 == dst_hi ) { // double move? - tty->print("MOVAPD %s,%s",Matcher::regName[dst_lo],Matcher::regName[src_lo]); + st->print("MOVAPD %s,%s",Matcher::regName[dst_lo],Matcher::regName[src_lo]); } else { - tty->print("MOVAPS %s,%s",Matcher::regName[dst_lo],Matcher::regName[src_lo]); + st->print("MOVAPS %s,%s",Matcher::regName[dst_lo],Matcher::regName[src_lo]); } #endif } @@ -813,11 +814,11 @@ static int impl_movx_helper( CodeBuffer *cbuf, bool do_size, int src_lo, int dst emit_rm (*cbuf, 0x3, Matcher::_regEncode[dst_lo], Matcher::_regEncode[src_lo] ); #ifndef PRODUCT } else if( !do_size ) { - if( size != 0 ) tty->print("\n\t"); + if( size != 0 ) st->print("\n\t"); if( src_lo+1 == src_hi && dst_lo+1 == dst_hi ) { // double move? - tty->print("MOVSD %s,%s",Matcher::regName[dst_lo],Matcher::regName[src_lo]); + st->print("MOVSD %s,%s",Matcher::regName[dst_lo],Matcher::regName[src_lo]); } else { - tty->print("MOVSS %s,%s",Matcher::regName[dst_lo],Matcher::regName[src_lo]); + st->print("MOVSS %s,%s",Matcher::regName[dst_lo],Matcher::regName[src_lo]); } #endif } @@ -825,28 +826,29 @@ static int impl_movx_helper( CodeBuffer *cbuf, bool do_size, int src_lo, int dst } } -static int impl_mov_helper( CodeBuffer *cbuf, bool do_size, int src, int dst, int size ) { +static int impl_mov_helper( CodeBuffer *cbuf, bool do_size, int src, int dst, int size, outputStream* st ) { if( cbuf ) { emit_opcode(*cbuf, 0x8B ); emit_rm (*cbuf, 0x3, Matcher::_regEncode[dst], Matcher::_regEncode[src] ); #ifndef PRODUCT } else if( !do_size ) { - if( size != 0 ) tty->print("\n\t"); - tty->print("MOV %s,%s",Matcher::regName[dst],Matcher::regName[src]); + if( size != 0 ) st->print("\n\t"); + st->print("MOV %s,%s",Matcher::regName[dst],Matcher::regName[src]); #endif } return size+2; } -static int impl_fp_store_helper( CodeBuffer *cbuf, bool do_size, int src_lo, int src_hi, int dst_lo, int dst_hi, int offset, int size ) { +static int impl_fp_store_helper( CodeBuffer *cbuf, bool do_size, int src_lo, int src_hi, int dst_lo, int dst_hi, + int offset, int size, outputStream* st ) { if( src_lo != FPR1L_num ) { // Move value to top of FP stack, if not already there if( cbuf ) { emit_opcode( *cbuf, 0xD9 ); // FLD (i.e., push it) emit_d8( *cbuf, 0xC0-1+Matcher::_regEncode[src_lo] ); #ifndef PRODUCT } else if( !do_size ) { - if( size != 0 ) tty->print("\n\t"); - tty->print("FLD %s",Matcher::regName[src_lo]); + if( size != 0 ) st->print("\n\t"); + st->print("FLD %s",Matcher::regName[src_lo]); #endif } size += 2; @@ -864,7 +866,7 @@ static int impl_fp_store_helper( CodeBuffer *cbuf, bool do_size, int src_lo, int assert( !OptoReg::is_valid(src_hi) && !OptoReg::is_valid(dst_hi), "no non-adjacent float-stores" ); } - return impl_helper(cbuf,do_size,false,offset,st_op,op,op_str,size); + return impl_helper(cbuf,do_size,false,offset,st_op,op,op_str,size, st); } uint MachSpillCopyNode::implementation( CodeBuffer *cbuf, PhaseRegAlloc *ra_, bool do_size, outputStream* st ) const { @@ -892,16 +894,16 @@ uint MachSpillCopyNode::implementation( CodeBuffer *cbuf, PhaseRegAlloc *ra_, bo if( src_first_rc == rc_stack && dst_first_rc == rc_stack ) { if( src_second == dst_first ) { // overlapping stack copy ranges assert( src_second_rc == rc_stack && dst_second_rc == rc_stack, "we only expect a stk-stk copy here" ); - size = impl_helper(cbuf,do_size,true ,ra_->reg2offset(src_second),ESI_num,0xFF,"PUSH ",size); - size = impl_helper(cbuf,do_size,false,ra_->reg2offset(dst_second),EAX_num,0x8F,"POP ",size); + size = impl_helper(cbuf,do_size,true ,ra_->reg2offset(src_second),ESI_num,0xFF,"PUSH ",size, st); + size = impl_helper(cbuf,do_size,false,ra_->reg2offset(dst_second),EAX_num,0x8F,"POP ",size, st); src_second_rc = dst_second_rc = rc_bad; // flag as already moved the second bits } // move low bits - size = impl_helper(cbuf,do_size,true ,ra_->reg2offset(src_first),ESI_num,0xFF,"PUSH ",size); - size = impl_helper(cbuf,do_size,false,ra_->reg2offset(dst_first),EAX_num,0x8F,"POP ",size); + size = impl_helper(cbuf,do_size,true ,ra_->reg2offset(src_first),ESI_num,0xFF,"PUSH ",size, st); + size = impl_helper(cbuf,do_size,false,ra_->reg2offset(dst_first),EAX_num,0x8F,"POP ",size, st); if( src_second_rc == rc_stack && dst_second_rc == rc_stack ) { // mov second bits - size = impl_helper(cbuf,do_size,true ,ra_->reg2offset(src_second),ESI_num,0xFF,"PUSH ",size); - size = impl_helper(cbuf,do_size,false,ra_->reg2offset(dst_second),EAX_num,0x8F,"POP ",size); + size = impl_helper(cbuf,do_size,true ,ra_->reg2offset(src_second),ESI_num,0xFF,"PUSH ",size, st); + size = impl_helper(cbuf,do_size,false,ra_->reg2offset(dst_second),EAX_num,0x8F,"POP ",size, st); } return size; } @@ -909,15 +911,15 @@ uint MachSpillCopyNode::implementation( CodeBuffer *cbuf, PhaseRegAlloc *ra_, bo // -------------------------------------- // Check for integer reg-reg copy if( src_first_rc == rc_int && dst_first_rc == rc_int ) - size = impl_mov_helper(cbuf,do_size,src_first,dst_first,size); + size = impl_mov_helper(cbuf,do_size,src_first,dst_first,size, st); // Check for integer store if( src_first_rc == rc_int && dst_first_rc == rc_stack ) - size = impl_helper(cbuf,do_size,false,ra_->reg2offset(dst_first),src_first,0x89,"MOV ",size); + size = impl_helper(cbuf,do_size,false,ra_->reg2offset(dst_first),src_first,0x89,"MOV ",size, st); // Check for integer load if( dst_first_rc == rc_int && src_first_rc == rc_stack ) - size = impl_helper(cbuf,do_size,true ,ra_->reg2offset(src_first),dst_first,0x8B,"MOV ",size); + size = impl_helper(cbuf,do_size,true ,ra_->reg2offset(src_first),dst_first,0x8B,"MOV ",size, st); // -------------------------------------- // Check for float reg-reg copy @@ -951,7 +953,7 @@ uint MachSpillCopyNode::implementation( CodeBuffer *cbuf, PhaseRegAlloc *ra_, bo // Check for float store if( src_first_rc == rc_float && dst_first_rc == rc_stack ) { - return impl_fp_store_helper(cbuf,do_size,src_first,src_second,dst_first,dst_second,ra_->reg2offset(dst_first),size); + return impl_fp_store_helper(cbuf,do_size,src_first,src_second,dst_first,dst_second,ra_->reg2offset(dst_first),size, st); } // Check for float load @@ -987,17 +989,17 @@ uint MachSpillCopyNode::implementation( CodeBuffer *cbuf, PhaseRegAlloc *ra_, bo assert( (src_second_rc == rc_bad && dst_second_rc == rc_bad) || (src_first+1 == src_second && dst_first+1 == dst_second), "no non-adjacent float-moves" ); - return impl_movx_helper(cbuf,do_size,src_first,dst_first,src_second, dst_second, size); + return impl_movx_helper(cbuf,do_size,src_first,dst_first,src_second, dst_second, size, st); } // Check for xmm store if( src_first_rc == rc_xmm && dst_first_rc == rc_stack ) { - return impl_x_helper(cbuf,do_size,false,ra_->reg2offset(dst_first),src_first, src_second, size); + return impl_x_helper(cbuf,do_size,false,ra_->reg2offset(dst_first),src_first, src_second, size, st); } // Check for float xmm load if( dst_first_rc == rc_xmm && src_first_rc == rc_stack ) { - return impl_x_helper(cbuf,do_size,true ,ra_->reg2offset(src_first),dst_first, dst_second, size); + return impl_x_helper(cbuf,do_size,true ,ra_->reg2offset(src_first),dst_first, dst_second, size, st); } // Copy from float reg to xmm reg @@ -1017,10 +1019,10 @@ uint MachSpillCopyNode::implementation( CodeBuffer *cbuf, PhaseRegAlloc *ra_, bo } size += 4; - size = impl_fp_store_helper(cbuf,do_size,src_first,src_second,dst_first,dst_second,0,size); + size = impl_fp_store_helper(cbuf,do_size,src_first,src_second,dst_first,dst_second,0,size, st); // Copy from the temp memory to the xmm reg. - size = impl_x_helper(cbuf,do_size,true ,0,dst_first, dst_second, size); + size = impl_x_helper(cbuf,do_size,true ,0,dst_first, dst_second, size, st); if( cbuf ) { emit_opcode(*cbuf,0x8D); // LEA ESP,[ESP+8] @@ -1047,15 +1049,15 @@ uint MachSpillCopyNode::implementation( CodeBuffer *cbuf, PhaseRegAlloc *ra_, bo // Check for second word int-int move if( src_second_rc == rc_int && dst_second_rc == rc_int ) - return impl_mov_helper(cbuf,do_size,src_second,dst_second,size); + return impl_mov_helper(cbuf,do_size,src_second,dst_second,size, st); // Check for second word integer store if( src_second_rc == rc_int && dst_second_rc == rc_stack ) - return impl_helper(cbuf,do_size,false,ra_->reg2offset(dst_second),src_second,0x89,"MOV ",size); + return impl_helper(cbuf,do_size,false,ra_->reg2offset(dst_second),src_second,0x89,"MOV ",size, st); // Check for second word integer load if( dst_second_rc == rc_int && src_second_rc == rc_stack ) - return impl_helper(cbuf,do_size,true ,ra_->reg2offset(src_second),dst_second,0x8B,"MOV ",size); + return impl_helper(cbuf,do_size,true ,ra_->reg2offset(src_second),dst_second,0x8B,"MOV ",size, st); Unimplemented(); @@ -1318,7 +1320,11 @@ const uint Matcher::vector_ideal_reg(void) { // // NOTE: If the platform does not provide any short branch variants, then // this method should return false for offset 0. -bool Matcher::is_short_branch_offset(int offset) { +bool Matcher::is_short_branch_offset(int rule, int offset) { + // the short version of jmpConUCF2 contains multiple branches, + // making the reach slightly less + if (rule == jmpConUCF2_rule) + return (-126 <= offset && offset <= 125); return (-128 <= offset && offset <= 127); } @@ -5272,6 +5278,15 @@ operand eFlagsRegU() %{ interface(REG_INTER); %} +operand eFlagsRegUCF() %{ + constraint(ALLOC_IN_RC(int_flags)); + match(RegFlags); + predicate(false); + + format %{ "EFLAGS_U_CF" %} + interface(REG_INTER); +%} + // Condition Code Register used by long compare operand flagsReg_long_LTGE() %{ constraint(ALLOC_IN_RC(int_flags)); @@ -5749,12 +5764,12 @@ operand cmpOp() %{ format %{ "" %} interface(COND_INTER) %{ - equal(0x4); - not_equal(0x5); - less(0xC); - greater_equal(0xD); - less_equal(0xE); - greater(0xF); + equal(0x4, "e"); + not_equal(0x5, "ne"); + less(0xC, "l"); + greater_equal(0xD, "ge"); + less_equal(0xE, "le"); + greater(0xF, "g"); %} %} @@ -5766,12 +5781,47 @@ operand cmpOpU() %{ format %{ "" %} interface(COND_INTER) %{ - equal(0x4); - not_equal(0x5); - less(0x2); - greater_equal(0x3); - less_equal(0x6); - greater(0x7); + equal(0x4, "e"); + not_equal(0x5, "ne"); + less(0x2, "b"); + greater_equal(0x3, "nb"); + less_equal(0x6, "be"); + greater(0x7, "nbe"); + %} +%} + +// Floating comparisons that don't require any fixup for the unordered case +operand cmpOpUCF() %{ + match(Bool); + predicate(n->as_Bool()->_test._test == BoolTest::lt || + n->as_Bool()->_test._test == BoolTest::ge || + n->as_Bool()->_test._test == BoolTest::le || + n->as_Bool()->_test._test == BoolTest::gt); + format %{ "" %} + interface(COND_INTER) %{ + equal(0x4, "e"); + not_equal(0x5, "ne"); + less(0x2, "b"); + greater_equal(0x3, "nb"); + less_equal(0x6, "be"); + greater(0x7, "nbe"); + %} +%} + + +// Floating comparisons that can be fixed up with extra conditional jumps +operand cmpOpUCF2() %{ + match(Bool); + predicate(n->as_Bool()->_test._test == BoolTest::ne || + n->as_Bool()->_test._test == BoolTest::eq); + format %{ "" %} + interface(COND_INTER) %{ + equal(0x4, "e"); + not_equal(0x5, "ne"); + less(0x2, "b"); + greater_equal(0x3, "nb"); + less_equal(0x6, "be"); + greater(0x7, "nbe"); %} %} @@ -5796,12 +5846,12 @@ operand cmpOp_commute() %{ format %{ "" %} interface(COND_INTER) %{ - equal(0x4); - not_equal(0x5); - less(0xF); - greater_equal(0xE); - less_equal(0xD); - greater(0xC); + equal(0x4, "e"); + not_equal(0x5, "ne"); + less(0xF, "g"); + greater_equal(0xE, "le"); + less_equal(0xD, "ge"); + greater(0xC, "l"); %} %} @@ -7357,7 +7407,7 @@ instruct cmovI_reg(eRegI dst, eRegI src, eFlagsReg cr, cmpOp cop ) %{ ins_pipe( pipe_cmov_reg ); %} -instruct cmovI_regU( eRegI dst, eRegI src, eFlagsRegU cr, cmpOpU cop ) %{ +instruct cmovI_regU( cmpOpU cop, eFlagsRegU cr, eRegI dst, eRegI src ) %{ predicate(VM_Version::supports_cmov() ); match(Set dst (CMoveI (Binary cop cr) (Binary dst src))); ins_cost(200); @@ -7367,6 +7417,15 @@ instruct cmovI_regU( eRegI dst, eRegI src, eFlagsRegU cr, cmpOpU cop ) %{ ins_pipe( pipe_cmov_reg ); %} +instruct cmovI_regUCF( cmpOpUCF cop, eFlagsRegUCF cr, eRegI dst, eRegI src ) %{ + predicate(VM_Version::supports_cmov() ); + match(Set dst (CMoveI (Binary cop cr) (Binary dst src))); + ins_cost(200); + expand %{ + cmovI_regU(cop, cr, dst, src); + %} +%} + // Conditional move instruct cmovI_mem(cmpOp cop, eFlagsReg cr, eRegI dst, memory src) %{ predicate(VM_Version::supports_cmov() ); @@ -7379,7 +7438,7 @@ instruct cmovI_mem(cmpOp cop, eFlagsReg cr, eRegI dst, memory src) %{ %} // Conditional move -instruct cmovI_memu(cmpOpU cop, eFlagsRegU cr, eRegI dst, memory src) %{ +instruct cmovI_memU(cmpOpU cop, eFlagsRegU cr, eRegI dst, memory src) %{ predicate(VM_Version::supports_cmov() ); match(Set dst (CMoveI (Binary cop cr) (Binary dst (LoadI src)))); ins_cost(250); @@ -7389,6 +7448,15 @@ instruct cmovI_memu(cmpOpU cop, eFlagsRegU cr, eRegI dst, memory src) %{ ins_pipe( pipe_cmov_mem ); %} +instruct cmovI_memUCF(cmpOpUCF cop, eFlagsRegUCF cr, eRegI dst, memory src) %{ + predicate(VM_Version::supports_cmov() ); + match(Set dst (CMoveI (Binary cop cr) (Binary dst (LoadI src)))); + ins_cost(250); + expand %{ + cmovI_memU(cop, cr, dst, src); + %} +%} + // Conditional move instruct cmovP_reg(eRegP dst, eRegP src, eFlagsReg cr, cmpOp cop ) %{ predicate(VM_Version::supports_cmov() ); @@ -7416,7 +7484,7 @@ instruct cmovP_reg_nonP6(eRegP dst, eRegP src, eFlagsReg cr, cmpOp cop ) %{ %} // Conditional move -instruct cmovP_regU(eRegP dst, eRegP src, eFlagsRegU cr, cmpOpU cop ) %{ +instruct cmovP_regU(cmpOpU cop, eFlagsRegU cr, eRegP dst, eRegP src ) %{ predicate(VM_Version::supports_cmov() ); match(Set dst (CMoveP (Binary cop cr) (Binary dst src))); ins_cost(200); @@ -7426,6 +7494,15 @@ instruct cmovP_regU(eRegP dst, eRegP src, eFlagsRegU cr, cmpOpU cop ) %{ ins_pipe( pipe_cmov_reg ); %} +instruct cmovP_regUCF(cmpOpUCF cop, eFlagsRegUCF cr, eRegP dst, eRegP src ) %{ + predicate(VM_Version::supports_cmov() ); + match(Set dst (CMoveP (Binary cop cr) (Binary dst src))); + ins_cost(200); + expand %{ + cmovP_regU(cop, cr, dst, src); + %} +%} + // DISABLED: Requires the ADLC to emit a bottom_type call that // correctly meets the two pointer arguments; one is an incoming // register but the other is a memory operand. ALSO appears to @@ -7555,6 +7632,15 @@ instruct fcmovX_regU(cmpOpU cop, eFlagsRegU cr, regX dst, regX src) %{ ins_pipe( pipe_slow ); %} +instruct fcmovX_regUCF(cmpOpUCF cop, eFlagsRegUCF cr, regX dst, regX src) %{ + predicate (UseSSE>=1); + match(Set dst (CMoveF (Binary cop cr) (Binary dst src))); + ins_cost(200); + expand %{ + fcmovX_regU(cop, cr, dst, src); + %} +%} + // unsigned version instruct fcmovXD_regU(cmpOpU cop, eFlagsRegU cr, regXD dst, regXD src) %{ predicate (UseSSE>=2); @@ -7573,6 +7659,15 @@ instruct fcmovXD_regU(cmpOpU cop, eFlagsRegU cr, regXD dst, regXD src) %{ ins_pipe( pipe_slow ); %} +instruct fcmovXD_regUCF(cmpOpUCF cop, eFlagsRegUCF cr, regXD dst, regXD src) %{ + predicate (UseSSE>=2); + match(Set dst (CMoveD (Binary cop cr) (Binary dst src))); + ins_cost(200); + expand %{ + fcmovXD_regU(cop, cr, dst, src); + %} +%} + instruct cmovL_reg(cmpOp cop, eFlagsReg cr, eRegL dst, eRegL src) %{ predicate(VM_Version::supports_cmov() ); match(Set dst (CMoveL (Binary cop cr) (Binary dst src))); @@ -7595,6 +7690,15 @@ instruct cmovL_regU(cmpOpU cop, eFlagsRegU cr, eRegL dst, eRegL src) %{ ins_pipe( pipe_cmov_reg_long ); %} +instruct cmovL_regUCF(cmpOpUCF cop, eFlagsRegUCF cr, eRegL dst, eRegL src) %{ + predicate(VM_Version::supports_cmov() ); + match(Set dst (CMoveL (Binary cop cr) (Binary dst src))); + ins_cost(200); + expand %{ + cmovL_regU(cop, cr, dst, src); + %} +%} + //----------Arithmetic Instructions-------------------------------------------- //----------Addition Instructions---------------------------------------------- // Integer Addition Instructions @@ -9200,6 +9304,18 @@ instruct cmpD_cc_P6(eFlagsRegU cr, regD src1, regD src2, eAXRegI rax) %{ ins_pipe( pipe_slow ); %} +instruct cmpD_cc_P6CF(eFlagsRegUCF cr, regD src1, regD src2) %{ + predicate(VM_Version::supports_cmov() && UseSSE <=1); + match(Set cr (CmpD src1 src2)); + ins_cost(150); + format %{ "FLD $src1\n\t" + "FUCOMIP ST,$src2 // P6 instruction" %} + opcode(0xDF, 0x05); /* DF E8+i or DF /5 */ + ins_encode( Push_Reg_D(src1), + OpcP, RegOpc(src2)); + ins_pipe( pipe_slow ); +%} + // Compare & branch instruct cmpD_cc(eFlagsRegU cr, regD src1, regD src2, eAXRegI rax) %{ predicate(UseSSE<=1); @@ -9264,6 +9380,16 @@ instruct cmpXD_cc(eFlagsRegU cr, regXD dst, regXD src, eAXRegI rax) %{ ins_pipe( pipe_slow ); %} +instruct cmpXD_ccCF(eFlagsRegUCF cr, regXD dst, regXD src) %{ + predicate(UseSSE>=2); + match(Set cr (CmpD dst src)); + ins_cost(100); + format %{ "COMISD $dst,$src" %} + opcode(0x66, 0x0F, 0x2F); + ins_encode(OpcP, OpcS, Opcode(tertiary), RegReg(dst, src)); + ins_pipe( pipe_slow ); +%} + // float compare and set condition codes in EFLAGS by XMM regs instruct cmpXD_ccmem(eFlagsRegU cr, regXD dst, memory src, eAXRegI rax) %{ predicate(UseSSE>=2); @@ -9280,6 +9406,16 @@ instruct cmpXD_ccmem(eFlagsRegU cr, regXD dst, memory src, eAXRegI rax) %{ ins_pipe( pipe_slow ); %} +instruct cmpXD_ccmemCF(eFlagsRegUCF cr, regXD dst, memory src) %{ + predicate(UseSSE>=2); + match(Set cr (CmpD dst (LoadD src))); + ins_cost(100); + format %{ "COMISD $dst,$src" %} + opcode(0x66, 0x0F, 0x2F); + ins_encode(OpcP, OpcS, Opcode(tertiary), RegMem(dst, src)); + ins_pipe( pipe_slow ); +%} + // Compare into -1,0,1 in XMM instruct cmpXD_reg(eRegI dst, regXD src1, regXD src2, eFlagsReg cr) %{ predicate(UseSSE>=2); @@ -10167,6 +10303,18 @@ instruct cmpF_cc_P6(eFlagsRegU cr, regF src1, regF src2, eAXRegI rax) %{ ins_pipe( pipe_slow ); %} +instruct cmpF_cc_P6CF(eFlagsRegUCF cr, regF src1, regF src2) %{ + predicate(VM_Version::supports_cmov() && UseSSE == 0); + match(Set cr (CmpF src1 src2)); + ins_cost(100); + format %{ "FLD $src1\n\t" + "FUCOMIP ST,$src2 // P6 instruction" %} + opcode(0xDF, 0x05); /* DF E8+i or DF /5 */ + ins_encode( Push_Reg_D(src1), + OpcP, RegOpc(src2)); + ins_pipe( pipe_slow ); +%} + // Compare & branch instruct cmpF_cc(eFlagsRegU cr, regF src1, regF src2, eAXRegI rax) %{ @@ -10232,6 +10380,16 @@ instruct cmpX_cc(eFlagsRegU cr, regX dst, regX src, eAXRegI rax) %{ ins_pipe( pipe_slow ); %} +instruct cmpX_ccCF(eFlagsRegUCF cr, regX dst, regX src) %{ + predicate(UseSSE>=1); + match(Set cr (CmpF dst src)); + ins_cost(100); + format %{ "COMISS $dst,$src" %} + opcode(0x0F, 0x2F); + ins_encode(OpcP, OpcS, RegReg(dst, src)); + ins_pipe( pipe_slow ); +%} + // float compare and set condition codes in EFLAGS by XMM regs instruct cmpX_ccmem(eFlagsRegU cr, regX dst, memory src, eAXRegI rax) %{ predicate(UseSSE>=1); @@ -10248,6 +10406,16 @@ instruct cmpX_ccmem(eFlagsRegU cr, regX dst, memory src, eAXRegI rax) %{ ins_pipe( pipe_slow ); %} +instruct cmpX_ccmemCF(eFlagsRegUCF cr, regX dst, memory src) %{ + predicate(UseSSE>=1); + match(Set cr (CmpF dst (LoadF src))); + ins_cost(100); + format %{ "COMISS $dst,$src" %} + opcode(0x0F, 0x2F); + ins_encode(OpcP, OpcS, RegMem(dst, src)); + ins_pipe( pipe_slow ); +%} + // Compare into -1,0,1 in XMM instruct cmpX_reg(eRegI dst, regX src1, regX src2, eFlagsReg cr) %{ predicate(UseSSE>=1); @@ -12099,6 +12267,19 @@ instruct jmpLoopEndU(cmpOpU cop, eFlagsRegU cmp, label labl) %{ ins_pc_relative(1); %} +instruct jmpLoopEndUCF(cmpOpUCF cop, eFlagsRegUCF cmp, label labl) %{ + match(CountedLoopEnd cop cmp); + effect(USE labl); + + ins_cost(200); + format %{ "J$cop,u $labl\t# Loop end" %} + size(6); + opcode(0x0F, 0x80); + ins_encode( Jcc( cop, labl) ); + ins_pipe( pipe_jcc ); + ins_pc_relative(1); +%} + // Jump Direct Conditional - using unsigned comparison instruct jmpConU(cmpOpU cop, eFlagsRegU cmp, label labl) %{ match(If cop cmp); @@ -12108,8 +12289,63 @@ instruct jmpConU(cmpOpU cop, eFlagsRegU cmp, label labl) %{ format %{ "J$cop,u $labl" %} size(6); opcode(0x0F, 0x80); - ins_encode( Jcc( cop, labl) ); - ins_pipe( pipe_jcc ); + ins_encode(Jcc(cop, labl)); + ins_pipe(pipe_jcc); + ins_pc_relative(1); +%} + +instruct jmpConUCF(cmpOpUCF cop, eFlagsRegUCF cmp, label labl) %{ + match(If cop cmp); + effect(USE labl); + + ins_cost(200); + format %{ "J$cop,u $labl" %} + size(6); + opcode(0x0F, 0x80); + ins_encode(Jcc(cop, labl)); + ins_pipe(pipe_jcc); + ins_pc_relative(1); +%} + +instruct jmpConUCF2(cmpOpUCF2 cop, eFlagsRegUCF cmp, label labl) %{ + match(If cop cmp); + effect(USE labl); + + ins_cost(200); + format %{ $$template + if ($cop$$cmpcode == Assembler::notEqual) { + $$emit$$"JP,u $labl\n\t" + $$emit$$"J$cop,u $labl" + } else { + $$emit$$"JP,u done\n\t" + $$emit$$"J$cop,u $labl\n\t" + $$emit$$"done:" + } + %} + size(12); + opcode(0x0F, 0x80); + ins_encode %{ + Label* l = $labl$$label; + $$$emit8$primary; + emit_cc(cbuf, $secondary, Assembler::parity); + int parity_disp = -1; + bool ok = false; + if ($cop$$cmpcode == Assembler::notEqual) { + // the two jumps 6 bytes apart so the jump distances are too + parity_disp = l ? (l->loc_pos() - (cbuf.code_size() + 4)) : 0; + } else if ($cop$$cmpcode == Assembler::equal) { + parity_disp = 6; + ok = true; + } else { + ShouldNotReachHere(); + } + emit_d32(cbuf, parity_disp); + $$$emit8$primary; + emit_cc(cbuf, $secondary, $cop$$cmpcode); + int disp = l ? (l->loc_pos() - (cbuf.code_size() + 4)) : 0; + emit_d32(cbuf, disp); + %} + ins_pipe(pipe_jcc); ins_pc_relative(1); %} @@ -12208,7 +12444,7 @@ instruct jmpLoopEnd_short(cmpOp cop, eFlagsReg cr, label labl) %{ effect(USE labl); ins_cost(300); - format %{ "J$cop,s $labl" %} + format %{ "J$cop,s $labl\t# Loop end" %} size(2); opcode(0x70); ins_encode( JccShort( cop, labl) ); @@ -12223,7 +12459,21 @@ instruct jmpLoopEndU_short(cmpOpU cop, eFlagsRegU cmp, label labl) %{ effect(USE labl); ins_cost(300); - format %{ "J$cop,us $labl" %} + format %{ "J$cop,us $labl\t# Loop end" %} + size(2); + opcode(0x70); + ins_encode( JccShort( cop, labl) ); + ins_pipe( pipe_jcc ); + ins_pc_relative(1); + ins_short_branch(1); +%} + +instruct jmpLoopEndUCF_short(cmpOpUCF cop, eFlagsRegUCF cmp, label labl) %{ + match(CountedLoopEnd cop cmp); + effect(USE labl); + + ins_cost(300); + format %{ "J$cop,us $labl\t# Loop end" %} size(2); opcode(0x70); ins_encode( JccShort( cop, labl) ); @@ -12247,6 +12497,60 @@ instruct jmpConU_short(cmpOpU cop, eFlagsRegU cmp, label labl) %{ ins_short_branch(1); %} +instruct jmpConUCF_short(cmpOpUCF cop, eFlagsRegUCF cmp, label labl) %{ + match(If cop cmp); + effect(USE labl); + + ins_cost(300); + format %{ "J$cop,us $labl" %} + size(2); + opcode(0x70); + ins_encode( JccShort( cop, labl) ); + ins_pipe( pipe_jcc ); + ins_pc_relative(1); + ins_short_branch(1); +%} + +instruct jmpConUCF2_short(cmpOpUCF2 cop, eFlagsRegUCF cmp, label labl) %{ + match(If cop cmp); + effect(USE labl); + + ins_cost(300); + format %{ $$template + if ($cop$$cmpcode == Assembler::notEqual) { + $$emit$$"JP,u,s $labl\n\t" + $$emit$$"J$cop,u,s $labl" + } else { + $$emit$$"JP,u,s done\n\t" + $$emit$$"J$cop,u,s $labl\n\t" + $$emit$$"done:" + } + %} + size(4); + opcode(0x70); + ins_encode %{ + Label* l = $labl$$label; + emit_cc(cbuf, $primary, Assembler::parity); + int parity_disp = -1; + if ($cop$$cmpcode == Assembler::notEqual) { + parity_disp = l ? (l->loc_pos() - (cbuf.code_size() + 1)) : 0; + } else if ($cop$$cmpcode == Assembler::equal) { + parity_disp = 2; + } else { + ShouldNotReachHere(); + } + emit_d8(cbuf, parity_disp); + emit_cc(cbuf, $primary, $cop$$cmpcode); + int disp = l ? (l->loc_pos() - (cbuf.code_size() + 1)) : 0; + emit_d8(cbuf, disp); + assert(-128 <= disp && disp <= 127, "Displacement too large for short jmp"); + assert(-128 <= parity_disp && parity_disp <= 127, "Displacement too large for short jmp"); + %} + ins_pipe(pipe_jcc); + ins_pc_relative(1); + ins_short_branch(1); +%} + // ============================================================================ // Long Compare // diff --git a/hotspot/src/cpu/x86/vm/x86_64.ad b/hotspot/src/cpu/x86/vm/x86_64.ad index 4245284593d..32a7ee8f051 100644 --- a/hotspot/src/cpu/x86/vm/x86_64.ad +++ b/hotspot/src/cpu/x86/vm/x86_64.ad @@ -2004,9 +2004,12 @@ const uint Matcher::vector_ideal_reg(void) { // // NOTE: If the platform does not provide any short branch variants, then // this method should return false for offset 0. -bool Matcher::is_short_branch_offset(int offset) -{ - return -0x80 <= offset && offset < 0x80; +bool Matcher::is_short_branch_offset(int rule, int offset) { + // the short version of jmpConUCF2 contains multiple branches, + // making the reach slightly less + if (rule == jmpConUCF2_rule) + return (-126 <= offset && offset <= 125); + return (-128 <= offset && offset <= 127); } const bool Matcher::isSimpleConstant64(jlong value) { @@ -5134,6 +5137,15 @@ operand rFlagsRegU() interface(REG_INTER); %} +operand rFlagsRegUCF() %{ + constraint(ALLOC_IN_RC(int_flags)); + match(RegFlags); + predicate(false); + + format %{ "RFLAGS_U_CF" %} + interface(REG_INTER); +%} + // Float register operands operand regF() %{ @@ -5405,12 +5417,12 @@ operand cmpOp() format %{ "" %} interface(COND_INTER) %{ - equal(0x4); - not_equal(0x5); - less(0xC); - greater_equal(0xD); - less_equal(0xE); - greater(0xF); + equal(0x4, "e"); + not_equal(0x5, "ne"); + less(0xC, "l"); + greater_equal(0xD, "ge"); + less_equal(0xE, "le"); + greater(0xF, "g"); %} %} @@ -5423,12 +5435,48 @@ operand cmpOpU() format %{ "" %} interface(COND_INTER) %{ - equal(0x4); - not_equal(0x5); - less(0x2); - greater_equal(0x3); - less_equal(0x6); - greater(0x7); + equal(0x4, "e"); + not_equal(0x5, "ne"); + less(0x2, "b"); + greater_equal(0x3, "nb"); + less_equal(0x6, "be"); + greater(0x7, "nbe"); + %} +%} + + +// Floating comparisons that don't require any fixup for the unordered case +operand cmpOpUCF() %{ + match(Bool); + predicate(n->as_Bool()->_test._test == BoolTest::lt || + n->as_Bool()->_test._test == BoolTest::ge || + n->as_Bool()->_test._test == BoolTest::le || + n->as_Bool()->_test._test == BoolTest::gt); + format %{ "" %} + interface(COND_INTER) %{ + equal(0x4, "e"); + not_equal(0x5, "ne"); + less(0x2, "b"); + greater_equal(0x3, "nb"); + less_equal(0x6, "be"); + greater(0x7, "nbe"); + %} +%} + + +// Floating comparisons that can be fixed up with extra conditional jumps +operand cmpOpUCF2() %{ + match(Bool); + predicate(n->as_Bool()->_test._test == BoolTest::ne || + n->as_Bool()->_test._test == BoolTest::eq); + format %{ "" %} + interface(COND_INTER) %{ + equal(0x4, "e"); + not_equal(0x5, "ne"); + less(0x2, "b"); + greater_equal(0x3, "nb"); + less_equal(0x6, "be"); + greater(0x7, "nbe"); %} %} @@ -7176,8 +7224,7 @@ instruct cmovI_reg(rRegI dst, rRegI src, rFlagsReg cr, cmpOp cop) ins_pipe(pipe_cmov_reg); %} -instruct cmovI_regU(rRegI dst, rRegI src, rFlagsRegU cr, cmpOpU cop) -%{ +instruct cmovI_regU(cmpOpU cop, rFlagsRegU cr, rRegI dst, rRegI src) %{ match(Set dst (CMoveI (Binary cop cr) (Binary dst src))); ins_cost(200); // XXX @@ -7187,9 +7234,16 @@ instruct cmovI_regU(rRegI dst, rRegI src, rFlagsRegU cr, cmpOpU cop) ins_pipe(pipe_cmov_reg); %} +instruct cmovI_regUCF(cmpOpUCF cop, rFlagsRegUCF cr, rRegI dst, rRegI src) %{ + match(Set dst (CMoveI (Binary cop cr) (Binary dst src))); + ins_cost(200); + expand %{ + cmovI_regU(cop, cr, dst, src); + %} +%} + // Conditional move -instruct cmovI_mem(cmpOp cop, rFlagsReg cr, rRegI dst, memory src) -%{ +instruct cmovI_mem(cmpOp cop, rFlagsReg cr, rRegI dst, memory src) %{ match(Set dst (CMoveI (Binary cop cr) (Binary dst (LoadI src)))); ins_cost(250); // XXX @@ -7211,6 +7265,14 @@ instruct cmovI_memU(cmpOpU cop, rFlagsRegU cr, rRegI dst, memory src) ins_pipe(pipe_cmov_mem); %} +instruct cmovI_memUCF(cmpOpUCF cop, rFlagsRegUCF cr, rRegI dst, memory src) %{ + match(Set dst (CMoveI (Binary cop cr) (Binary dst (LoadI src)))); + ins_cost(250); + expand %{ + cmovI_memU(cop, cr, dst, src); + %} +%} + // Conditional move instruct cmovN_reg(rRegN dst, rRegN src, rFlagsReg cr, cmpOp cop) %{ @@ -7224,7 +7286,7 @@ instruct cmovN_reg(rRegN dst, rRegN src, rFlagsReg cr, cmpOp cop) %} // Conditional move -instruct cmovN_regU(rRegN dst, rRegN src, rFlagsRegU cr, cmpOpU cop) +instruct cmovN_regU(cmpOpU cop, rFlagsRegU cr, rRegN dst, rRegN src) %{ match(Set dst (CMoveN (Binary cop cr) (Binary dst src))); @@ -7235,6 +7297,14 @@ instruct cmovN_regU(rRegN dst, rRegN src, rFlagsRegU cr, cmpOpU cop) ins_pipe(pipe_cmov_reg); %} +instruct cmovN_regUCF(cmpOpUCF cop, rFlagsRegUCF cr, rRegN dst, rRegN src) %{ + match(Set dst (CMoveN (Binary cop cr) (Binary dst src))); + ins_cost(200); + expand %{ + cmovN_regU(cop, cr, dst, src); + %} +%} + // Conditional move instruct cmovP_reg(rRegP dst, rRegP src, rFlagsReg cr, cmpOp cop) %{ @@ -7248,7 +7318,7 @@ instruct cmovP_reg(rRegP dst, rRegP src, rFlagsReg cr, cmpOp cop) %} // Conditional move -instruct cmovP_regU(rRegP dst, rRegP src, rFlagsRegU cr, cmpOpU cop) +instruct cmovP_regU(cmpOpU cop, rFlagsRegU cr, rRegP dst, rRegP src) %{ match(Set dst (CMoveP (Binary cop cr) (Binary dst src))); @@ -7259,6 +7329,14 @@ instruct cmovP_regU(rRegP dst, rRegP src, rFlagsRegU cr, cmpOpU cop) ins_pipe(pipe_cmov_reg); // XXX %} +instruct cmovP_regUCF(cmpOpUCF cop, rFlagsRegUCF cr, rRegP dst, rRegP src) %{ + match(Set dst (CMoveP (Binary cop cr) (Binary dst src))); + ins_cost(200); + expand %{ + cmovP_regU(cop, cr, dst, src); + %} +%} + // DISABLED: Requires the ADLC to emit a bottom_type call that // correctly meets the two pointer arguments; one is an incoming // register but the other is a memory operand. ALSO appears to @@ -7319,6 +7397,14 @@ instruct cmovL_regU(cmpOpU cop, rFlagsRegU cr, rRegL dst, rRegL src) ins_pipe(pipe_cmov_reg); // XXX %} +instruct cmovL_regUCF(cmpOpUCF cop, rFlagsRegUCF cr, rRegL dst, rRegL src) %{ + match(Set dst (CMoveL (Binary cop cr) (Binary dst src))); + ins_cost(200); + expand %{ + cmovL_regU(cop, cr, dst, src); + %} +%} + instruct cmovL_memU(cmpOpU cop, rFlagsRegU cr, rRegL dst, memory src) %{ match(Set dst (CMoveL (Binary cop cr) (Binary dst (LoadL src)))); @@ -7330,6 +7416,14 @@ instruct cmovL_memU(cmpOpU cop, rFlagsRegU cr, rRegL dst, memory src) ins_pipe(pipe_cmov_mem); // XXX %} +instruct cmovL_memUCF(cmpOpUCF cop, rFlagsRegUCF cr, rRegL dst, memory src) %{ + match(Set dst (CMoveL (Binary cop cr) (Binary dst (LoadL src)))); + ins_cost(200); + expand %{ + cmovL_memU(cop, cr, dst, src); + %} +%} + instruct cmovF_reg(cmpOp cop, rFlagsReg cr, regF dst, regF src) %{ match(Set dst (CMoveF (Binary cop cr) (Binary dst src))); @@ -7366,6 +7460,14 @@ instruct cmovF_regU(cmpOpU cop, rFlagsRegU cr, regF dst, regF src) ins_pipe(pipe_slow); %} +instruct cmovF_regUCF(cmpOpUCF cop, rFlagsRegUCF cr, regF dst, regF src) %{ + match(Set dst (CMoveF (Binary cop cr) (Binary dst src))); + ins_cost(200); + expand %{ + cmovF_regU(cop, cr, dst, src); + %} +%} + instruct cmovD_reg(cmpOp cop, rFlagsReg cr, regD dst, regD src) %{ match(Set dst (CMoveD (Binary cop cr) (Binary dst src))); @@ -7390,6 +7492,14 @@ instruct cmovD_regU(cmpOpU cop, rFlagsRegU cr, regD dst, regD src) ins_pipe(pipe_slow); %} +instruct cmovD_regUCF(cmpOpUCF cop, rFlagsRegUCF cr, regD dst, regD src) %{ + match(Set dst (CMoveD (Binary cop cr) (Binary dst src))); + ins_cost(200); + expand %{ + cmovD_regU(cop, cr, dst, src); + %} +%} + //----------Arithmetic Instructions-------------------------------------------- //----------Addition Instructions---------------------------------------------- @@ -9716,6 +9826,17 @@ instruct cmpF_cc_reg(rFlagsRegU cr, regF src1, regF src2) ins_pipe(pipe_slow); %} +instruct cmpF_cc_reg_CF(rFlagsRegUCF cr, regF src1, regF src2) %{ + match(Set cr (CmpF src1 src2)); + + ins_cost(145); + format %{ "ucomiss $src1, $src2" %} + ins_encode %{ + __ ucomiss($src1$$XMMRegister, $src2$$XMMRegister); + %} + ins_pipe(pipe_slow); +%} + instruct cmpF_cc_mem(rFlagsRegU cr, regF src1, memory src2) %{ match(Set cr (CmpF src1 (LoadF src2))); @@ -9733,6 +9854,16 @@ instruct cmpF_cc_mem(rFlagsRegU cr, regF src1, memory src2) ins_pipe(pipe_slow); %} +instruct cmpF_cc_memCF(rFlagsRegUCF cr, regF src1, memory src2) %{ + match(Set cr (CmpF src1 (LoadF src2))); + + ins_cost(100); + format %{ "ucomiss $src1, $src2" %} + opcode(0x0F, 0x2E); + ins_encode(REX_reg_mem(src1, src2), OpcP, OpcS, reg_mem(src1, src2)); + ins_pipe(pipe_slow); +%} + instruct cmpF_cc_imm(rFlagsRegU cr, regF src1, immF src2) %{ match(Set cr (CmpF src1 src2)); @@ -9750,6 +9881,16 @@ instruct cmpF_cc_imm(rFlagsRegU cr, regF src1, immF src2) ins_pipe(pipe_slow); %} +instruct cmpF_cc_immCF(rFlagsRegUCF cr, regF src1, immF src2) %{ + match(Set cr (CmpF src1 src2)); + + ins_cost(100); + format %{ "ucomiss $src1, $src2" %} + opcode(0x0F, 0x2E); + ins_encode(REX_reg_mem(src1, src2), OpcP, OpcS, load_immF(src1, src2)); + ins_pipe(pipe_slow); +%} + instruct cmpD_cc_reg(rFlagsRegU cr, regD src1, regD src2) %{ match(Set cr (CmpD src1 src2)); @@ -9767,6 +9908,17 @@ instruct cmpD_cc_reg(rFlagsRegU cr, regD src1, regD src2) ins_pipe(pipe_slow); %} +instruct cmpD_cc_reg_CF(rFlagsRegUCF cr, regD src1, regD src2) %{ + match(Set cr (CmpD src1 src2)); + + ins_cost(100); + format %{ "ucomisd $src1, $src2 test" %} + ins_encode %{ + __ ucomisd($src1$$XMMRegister, $src2$$XMMRegister); + %} + ins_pipe(pipe_slow); +%} + instruct cmpD_cc_mem(rFlagsRegU cr, regD src1, memory src2) %{ match(Set cr (CmpD src1 (LoadD src2))); @@ -9784,6 +9936,16 @@ instruct cmpD_cc_mem(rFlagsRegU cr, regD src1, memory src2) ins_pipe(pipe_slow); %} +instruct cmpD_cc_memCF(rFlagsRegUCF cr, regD src1, memory src2) %{ + match(Set cr (CmpD src1 (LoadD src2))); + + ins_cost(100); + format %{ "ucomisd $src1, $src2" %} + opcode(0x66, 0x0F, 0x2E); + ins_encode(OpcP, REX_reg_mem(src1, src2), OpcS, OpcT, reg_mem(src1, src2)); + ins_pipe(pipe_slow); +%} + instruct cmpD_cc_imm(rFlagsRegU cr, regD src1, immD src2) %{ match(Set cr (CmpD src1 src2)); @@ -9801,6 +9963,16 @@ instruct cmpD_cc_imm(rFlagsRegU cr, regD src1, immD src2) ins_pipe(pipe_slow); %} +instruct cmpD_cc_immCF(rFlagsRegUCF cr, regD src1, immD src2) %{ + match(Set cr (CmpD src1 src2)); + + ins_cost(100); + format %{ "ucomisd $src1, [$src2]" %} + opcode(0x66, 0x0F, 0x2E); + ins_encode(OpcP, REX_reg_mem(src1, src2), OpcS, OpcT, load_immD(src1, src2)); + ins_pipe(pipe_slow); +%} + // Compare into -1,0,1 instruct cmpF_reg(rRegI dst, regF src1, regF src2, rFlagsReg cr) %{ @@ -11406,8 +11578,7 @@ instruct jmpLoopEnd(cmpOp cop, rFlagsReg cr, label labl) %} // Jump Direct Conditional - Label defines a relative address from Jcc+1 -instruct jmpLoopEndU(cmpOpU cop, rFlagsRegU cmp, label labl) -%{ +instruct jmpLoopEndU(cmpOpU cop, rFlagsRegU cmp, label labl) %{ match(CountedLoopEnd cop cmp); effect(USE labl); @@ -11420,14 +11591,26 @@ instruct jmpLoopEndU(cmpOpU cop, rFlagsRegU cmp, label labl) ins_pc_relative(1); %} +instruct jmpLoopEndUCF(cmpOpUCF cop, rFlagsRegUCF cmp, label labl) %{ + match(CountedLoopEnd cop cmp); + effect(USE labl); + + ins_cost(200); + format %{ "j$cop,u $labl\t# loop end" %} + size(6); + opcode(0x0F, 0x80); + ins_encode(Jcc(cop, labl)); + ins_pipe(pipe_jcc); + ins_pc_relative(1); +%} + // Jump Direct Conditional - using unsigned comparison -instruct jmpConU(cmpOpU cop, rFlagsRegU cmp, label labl) -%{ +instruct jmpConU(cmpOpU cop, rFlagsRegU cmp, label labl) %{ match(If cop cmp); effect(USE labl); ins_cost(300); - format %{ "j$cop,u $labl" %} + format %{ "j$cop,u $labl" %} size(6); opcode(0x0F, 0x80); ins_encode(Jcc(cop, labl)); @@ -11435,6 +11618,59 @@ instruct jmpConU(cmpOpU cop, rFlagsRegU cmp, label labl) ins_pc_relative(1); %} +instruct jmpConUCF(cmpOpUCF cop, rFlagsRegUCF cmp, label labl) %{ + match(If cop cmp); + effect(USE labl); + + ins_cost(200); + format %{ "j$cop,u $labl" %} + size(6); + opcode(0x0F, 0x80); + ins_encode(Jcc(cop, labl)); + ins_pipe(pipe_jcc); + ins_pc_relative(1); +%} + +instruct jmpConUCF2(cmpOpUCF2 cop, rFlagsRegUCF cmp, label labl) %{ + match(If cop cmp); + effect(USE labl); + + ins_cost(200); + format %{ $$template + if ($cop$$cmpcode == Assembler::notEqual) { + $$emit$$"jp,u $labl\n\t" + $$emit$$"j$cop,u $labl" + } else { + $$emit$$"jp,u done\n\t" + $$emit$$"j$cop,u $labl\n\t" + $$emit$$"done:" + } + %} + size(12); + opcode(0x0F, 0x80); + ins_encode %{ + Label* l = $labl$$label; + $$$emit8$primary; + emit_cc(cbuf, $secondary, Assembler::parity); + int parity_disp = -1; + if ($cop$$cmpcode == Assembler::notEqual) { + // the two jumps 6 bytes apart so the jump distances are too + parity_disp = l ? (l->loc_pos() - (cbuf.code_size() + 4)) : 0; + } else if ($cop$$cmpcode == Assembler::equal) { + parity_disp = 6; + } else { + ShouldNotReachHere(); + } + emit_d32(cbuf, parity_disp); + $$$emit8$primary; + emit_cc(cbuf, $secondary, $cop$$cmpcode); + int disp = l ? (l->loc_pos() - (cbuf.code_size() + 4)) : 0; + emit_d32(cbuf, disp); + %} + ins_pipe(pipe_jcc); + ins_pc_relative(1); +%} + // ============================================================================ // The 2nd slow-half of a subtype check. Scan the subklass's 2ndary // superklass array for an instance of the superklass. Set a hidden @@ -11505,8 +11741,7 @@ instruct partialSubtypeCheck_vs_Zero(rFlagsReg cr, // specific code section of the file. // Jump Direct - Label defines a relative address from JMP+1 -instruct jmpDir_short(label labl) -%{ +instruct jmpDir_short(label labl) %{ match(Goto); effect(USE labl); @@ -11521,8 +11756,7 @@ instruct jmpDir_short(label labl) %} // Jump Direct Conditional - Label defines a relative address from Jcc+1 -instruct jmpCon_short(cmpOp cop, rFlagsReg cr, label labl) -%{ +instruct jmpCon_short(cmpOp cop, rFlagsReg cr, label labl) %{ match(If cop cr); effect(USE labl); @@ -11537,13 +11771,12 @@ instruct jmpCon_short(cmpOp cop, rFlagsReg cr, label labl) %} // Jump Direct Conditional - Label defines a relative address from Jcc+1 -instruct jmpLoopEnd_short(cmpOp cop, rFlagsReg cr, label labl) -%{ +instruct jmpLoopEnd_short(cmpOp cop, rFlagsReg cr, label labl) %{ match(CountedLoopEnd cop cr); effect(USE labl); ins_cost(300); - format %{ "j$cop,s $labl" %} + format %{ "j$cop,s $labl\t# loop end" %} size(2); opcode(0x70); ins_encode(JccShort(cop, labl)); @@ -11553,11 +11786,39 @@ instruct jmpLoopEnd_short(cmpOp cop, rFlagsReg cr, label labl) %} // Jump Direct Conditional - Label defines a relative address from Jcc+1 -instruct jmpLoopEndU_short(cmpOpU cop, rFlagsRegU cmp, label labl) -%{ +instruct jmpLoopEndU_short(cmpOpU cop, rFlagsRegU cmp, label labl) %{ match(CountedLoopEnd cop cmp); effect(USE labl); + ins_cost(300); + format %{ "j$cop,us $labl\t# loop end" %} + size(2); + opcode(0x70); + ins_encode(JccShort(cop, labl)); + ins_pipe(pipe_jcc); + ins_pc_relative(1); + ins_short_branch(1); +%} + +instruct jmpLoopEndUCF_short(cmpOpUCF cop, rFlagsRegUCF cmp, label labl) %{ + match(CountedLoopEnd cop cmp); + effect(USE labl); + + ins_cost(300); + format %{ "j$cop,us $labl\t# loop end" %} + size(2); + opcode(0x70); + ins_encode(JccShort(cop, labl)); + ins_pipe(pipe_jcc); + ins_pc_relative(1); + ins_short_branch(1); +%} + +// Jump Direct Conditional - using unsigned comparison +instruct jmpConU_short(cmpOpU cop, rFlagsRegU cmp, label labl) %{ + match(If cop cmp); + effect(USE labl); + ins_cost(300); format %{ "j$cop,us $labl" %} size(2); @@ -11568,9 +11829,7 @@ instruct jmpLoopEndU_short(cmpOpU cop, rFlagsRegU cmp, label labl) ins_short_branch(1); %} -// Jump Direct Conditional - using unsigned comparison -instruct jmpConU_short(cmpOpU cop, rFlagsRegU cmp, label labl) -%{ +instruct jmpConUCF_short(cmpOpUCF cop, rFlagsRegUCF cmp, label labl) %{ match(If cop cmp); effect(USE labl); @@ -11584,6 +11843,46 @@ instruct jmpConU_short(cmpOpU cop, rFlagsRegU cmp, label labl) ins_short_branch(1); %} +instruct jmpConUCF2_short(cmpOpUCF2 cop, rFlagsRegUCF cmp, label labl) %{ + match(If cop cmp); + effect(USE labl); + + ins_cost(300); + format %{ $$template + if ($cop$$cmpcode == Assembler::notEqual) { + $$emit$$"jp,u,s $labl\n\t" + $$emit$$"j$cop,u,s $labl" + } else { + $$emit$$"jp,u,s done\n\t" + $$emit$$"j$cop,u,s $labl\n\t" + $$emit$$"done:" + } + %} + size(4); + opcode(0x70); + ins_encode %{ + Label* l = $labl$$label; + emit_cc(cbuf, $primary, Assembler::parity); + int parity_disp = -1; + if ($cop$$cmpcode == Assembler::notEqual) { + parity_disp = l ? (l->loc_pos() - (cbuf.code_size() + 1)) : 0; + } else if ($cop$$cmpcode == Assembler::equal) { + parity_disp = 2; + } else { + ShouldNotReachHere(); + } + emit_d8(cbuf, parity_disp); + emit_cc(cbuf, $primary, $cop$$cmpcode); + int disp = l ? (l->loc_pos() - (cbuf.code_size() + 1)) : 0; + emit_d8(cbuf, disp); + assert(-128 <= disp && disp <= 127, "Displacement too large for short jmp"); + assert(-128 <= parity_disp && parity_disp <= 127, "Displacement too large for short jmp"); + %} + ins_pipe(pipe_jcc); + ins_pc_relative(1); + ins_short_branch(1); +%} + // ============================================================================ // inlined locking and unlocking diff --git a/hotspot/src/share/vm/adlc/adlparse.cpp b/hotspot/src/share/vm/adlc/adlparse.cpp index 6ebef89f27f..c266df104c8 100644 --- a/hotspot/src/share/vm/adlc/adlparse.cpp +++ b/hotspot/src/share/vm/adlc/adlparse.cpp @@ -33,7 +33,6 @@ ADLParser::ADLParser(FileBuff& buffer, ArchDesc& archDesc) _globalNames(archDesc.globalNames()) { _AD._syntax_errs = _AD._semantic_errs = 0; // No errors so far this file _AD._warnings = 0; // No warnings either - _linenum = 0; // Will increment to first line _curline = _ptr = NULL; // No pointers into buffer yet _preproc_depth = 0; @@ -76,7 +75,7 @@ ADLParser::~ADLParser() { } if (!_AD._quiet_mode) fprintf(stderr,"-----------------------------------------------------------------------------\n"); - _AD._TotalLines += _linenum-1; // -1 for overshoot in "nextline" routine + _AD._TotalLines += linenum()-1; // -1 for overshoot in "nextline" routine // Write out information we have stored // // UNIXism == fsync(stderr); @@ -148,7 +147,7 @@ void ADLParser::instr_parse(void) { if( (ident = get_unique_ident(_globalNames,"instruction")) == NULL ) return; instr = new InstructForm(ident); // Create new instruction form - instr->_linenum = _linenum; + instr->_linenum = linenum(); _globalNames.Insert(ident, instr); // Add name to the name table // Debugging Stuff if (_AD._adl_debug > 1) @@ -404,7 +403,7 @@ void ADLParser::oper_parse(void) { if( (ident = get_unique_ident(_globalNames,"operand")) == NULL ) return; oper = new OperandForm(ident); // Create new operand form - oper->_linenum = _linenum; + oper->_linenum = linenum(); _globalNames.Insert(ident, oper); // Add name to the name table // Debugging Stuff @@ -774,7 +773,7 @@ void ADLParser::reg_parse(void) { // Create the RegisterForm for the architecture description. RegisterForm *regBlock = new RegisterForm(); // Build new Source object - regBlock->_linenum = _linenum; + regBlock->_linenum = linenum(); _AD.addForm(regBlock); skipws(); // Skip leading whitespace @@ -847,7 +846,7 @@ void ADLParser::enc_class_parse(void) { } EncClass *encoding = _AD._encode->add_EncClass(ec_name); - encoding->_linenum = _linenum; + encoding->_linenum = linenum(); skipws(); // Skip leading whitespace // Check for optional parameter list @@ -905,7 +904,7 @@ void ADLParser::enc_class_parse_block(EncClass* encoding, char* ec_name) { // Prepend location descriptor, for debugging; cf. ADLParser::find_cpp_block if (_AD._adlocation_debug) { const char* file = _AD._ADL_file._name; - int line = _linenum; + int line = linenum(); char* location = (char *)malloc(strlen(file) + 100); sprintf(location, "#line %d \"%s\"\n", line, file); encoding->add_code(location); @@ -2776,7 +2775,7 @@ InsEncode *ADLParser::ins_encode_parse_block(InstructForm &inst) { assert(_AD._encode->encClass(ec_name) == NULL, "shouldn't already exist"); EncClass *encoding = _AD._encode->add_EncClass(ec_name); - encoding->_linenum = _linenum; + encoding->_linenum = linenum(); // synthesize the arguments list for the enc_class from the // arguments to the instruct definition. @@ -2852,7 +2851,7 @@ InsEncode *ADLParser::ins_encode_parse(InstructForm &inst) { skipws(); InsEncode *encrule = new InsEncode(); // Encode class for instruction - encrule->_linenum = _linenum; + encrule->_linenum = linenum(); char *ec_name = NULL; // String representation of encode rule // identifier is optional. while (_curchar != ')') { @@ -3203,6 +3202,12 @@ Interface *ADLParser::cond_interface_parse(void) { char *greater_equal; char *less_equal; char *greater; + const char *equal_format = "eq"; + const char *not_equal_format = "ne"; + const char *less_format = "lt"; + const char *greater_equal_format = "ge"; + const char *less_equal_format = "le"; + const char *greater_format = "gt"; if (_curchar != '%') { parse_err(SYNERR, "Missing '%{' for 'cond_interface' block.\n"); @@ -3222,22 +3227,22 @@ Interface *ADLParser::cond_interface_parse(void) { return NULL; } if ( strcmp(field,"equal") == 0 ) { - equal = interface_field_parse(); + equal = interface_field_parse(&equal_format); } else if ( strcmp(field,"not_equal") == 0 ) { - not_equal = interface_field_parse(); + not_equal = interface_field_parse(¬_equal_format); } else if ( strcmp(field,"less") == 0 ) { - less = interface_field_parse(); + less = interface_field_parse(&less_format); } else if ( strcmp(field,"greater_equal") == 0 ) { - greater_equal = interface_field_parse(); + greater_equal = interface_field_parse(&greater_equal_format); } else if ( strcmp(field,"less_equal") == 0 ) { - less_equal = interface_field_parse(); + less_equal = interface_field_parse(&less_equal_format); } else if ( strcmp(field,"greater") == 0 ) { - greater = interface_field_parse(); + greater = interface_field_parse(&greater_format); } else { parse_err(SYNERR, "Expected keyword, base|index|scale|disp, or '%}' ending interface.\n"); @@ -3252,14 +3257,18 @@ Interface *ADLParser::cond_interface_parse(void) { next_char(); // Skip '}' // Construct desired object and return - Interface *inter = new CondInterface(equal, not_equal, less, greater_equal, - less_equal, greater); + Interface *inter = new CondInterface(equal, equal_format, + not_equal, not_equal_format, + less, less_format, + greater_equal, greater_equal_format, + less_equal, less_equal_format, + greater, greater_format); return inter; } //------------------------------interface_field_parse-------------------------- -char *ADLParser::interface_field_parse(void) { +char *ADLParser::interface_field_parse(const char ** format) { char *iface_field = NULL; // Get interface field @@ -3280,6 +3289,32 @@ char *ADLParser::interface_field_parse(void) { return NULL; } skipws(); + if (format != NULL && _curchar == ',') { + next_char(); + skipws(); + if (_curchar != '"') { + parse_err(SYNERR, "Missing '\"' in field format .\n"); + return NULL; + } + next_char(); + char *start = _ptr; // Record start of the next string + while ((_curchar != '"') && (_curchar != '%') && (_curchar != '\n')) { + if (_curchar == '\\') next_char(); // superquote + if (_curchar == '\n') parse_err(SYNERR, "newline in string"); // unimplemented! + next_char(); + } + if (_curchar != '"') { + parse_err(SYNERR, "Missing '\"' at end of field format .\n"); + return NULL; + } + // If a string was found, terminate it and record in FormatRule + if ( start != _ptr ) { + *_ptr = '\0'; // Terminate the string + *format = start; + } + next_char(); + skipws(); + } if (_curchar != ')') { parse_err(SYNERR, "Missing ')' after interface field.\n"); return NULL; @@ -3342,6 +3377,12 @@ FormatRule* ADLParser::format_parse(void) { next_char(); // Move past the '{' skipws(); + if (_curchar == '$') { + char* ident = get_rep_var_ident(); + if (strcmp(ident, "$$template") == 0) return template_parse(); + parse_err(SYNERR, "Unknown \"%s\" directive in format", ident); + return NULL; + } // Check for the opening '"' inside the format description if ( _curchar == '"' ) { next_char(); // Move past the initial '"' @@ -3433,6 +3474,131 @@ FormatRule* ADLParser::format_parse(void) { } +//------------------------------template_parse----------------------------------- +FormatRule* ADLParser::template_parse(void) { + char *desc = NULL; + FormatRule *format = (new FormatRule(desc)); + + skipws(); + while ( (_curchar != '%') && (*(_ptr+1) != '}') ) { + + // (1) + // Check if there is a string to pass through to output + char *start = _ptr; // Record start of the next string + while ((_curchar != '$') && ((_curchar != '%') || (*(_ptr+1) != '}')) ) { + // If at the start of a comment, skip past it + if( (_curchar == '/') && ((*(_ptr+1) == '/') || (*(_ptr+1) == '*')) ) { + skipws_no_preproc(); + } else { + // ELSE advance to the next character, or start of the next line + next_char_or_line(); + } + } + // If a string was found, terminate it and record in EncClass + if ( start != _ptr ) { + *_ptr = '\0'; // Terminate the string + // Add flag to _strings list indicating we should check _rep_vars + format->_strings.addName(NameList::_signal2); + format->_strings.addName(start); + } + + // (2) + // If we are at a replacement variable, + // copy it and record in EncClass + if ( _curchar == '$' ) { + // Found replacement Variable + char *rep_var = get_rep_var_ident_dup(); + if (strcmp(rep_var, "$emit") == 0) { + // switch to normal format parsing + next_char(); + next_char(); + skipws(); + // Check for the opening '"' inside the format description + if ( _curchar == '"' ) { + next_char(); // Move past the initial '"' + if( _curchar == '"' ) { // Handle empty format string case + *_ptr = '\0'; // Terminate empty string + format->_strings.addName(_ptr); + } + + // Collect the parts of the format description + // (1) strings that are passed through to tty->print + // (2) replacement/substitution variable, preceeded by a '$' + // (3) multi-token ANSIY C style strings + while ( true ) { + if ( _curchar == '%' || _curchar == '\n' ) { + parse_err(SYNERR, "missing '\"' at end of format block"); + return NULL; + } + + // (1) + // Check if there is a string to pass through to output + char *start = _ptr; // Record start of the next string + while ((_curchar != '$') && (_curchar != '"') && (_curchar != '%') && (_curchar != '\n')) { + if (_curchar == '\\') next_char(); // superquote + if (_curchar == '\n') parse_err(SYNERR, "newline in string"); // unimplemented! + next_char(); + } + // If a string was found, terminate it and record in FormatRule + if ( start != _ptr ) { + *_ptr = '\0'; // Terminate the string + format->_strings.addName(start); + } + + // (2) + // If we are at a replacement variable, + // copy it and record in FormatRule + if ( _curchar == '$' ) { + next_char(); // Move past the '$' + char* rep_var = get_ident(); // Nil terminate the variable name + rep_var = strdup(rep_var);// Copy the string + *_ptr = _curchar; // and replace Nil with original character + format->_rep_vars.addName(rep_var); + // Add flag to _strings list indicating we should check _rep_vars + format->_strings.addName(NameList::_signal); + } + + // (3) + // Allow very long strings to be broken up, + // using the ANSI C syntax "foo\n" "bar" + if ( _curchar == '"') { + next_char(); // Move past the '"' + skipws(); // Skip white space before next string token + if ( _curchar != '"') { + break; + } else { + // Found one. Skip both " and the whitespace in between. + next_char(); + } + } + } // end while part of format description + } + } else { + // Add flag to _strings list indicating we should check _rep_vars + format->_rep_vars.addName(rep_var); + // Add flag to _strings list indicating we should check _rep_vars + format->_strings.addName(NameList::_signal3); + } + } // end while part of format description + } + + skipws(); + // Past format description, at '%' + if ( _curchar != '%' || *(_ptr+1) != '}' ) { + parse_err(SYNERR, "missing '%}' at end of format block"); + return NULL; + } + next_char(); // Move past the '%' + next_char(); // Move past the '}' + + // Debug Stuff + if (_AD._adl_debug > 1) fprintf(stderr,"Format Rule: %s\n", desc); + + skipws(); + return format; +} + + //------------------------------effect_parse----------------------------------- void ADLParser::effect_parse(InstructForm *instr) { char* desc = NULL; @@ -3777,7 +3943,7 @@ char* ADLParser::find_cpp_block(const char* description) { skipws_no_preproc(); // Skip leading whitespace cppBlock = _ptr; // Point to start of expression const char* file = _AD._ADL_file._name; - int line = _linenum; + int line = linenum(); next = _ptr + 1; while(((_curchar != '%') || (*next != '}')) && (_curchar != '\0')) { next_char_or_line(); @@ -4297,11 +4463,11 @@ void ADLParser::parse_err(int flag, const char *fmt, ...) { va_start(args, fmt); if (flag == 1) - _AD._syntax_errs += _AD.emit_msg(0, flag, _linenum, fmt, args); + _AD._syntax_errs += _AD.emit_msg(0, flag, linenum(), fmt, args); else if (flag == 2) - _AD._semantic_errs += _AD.emit_msg(0, flag, _linenum, fmt, args); + _AD._semantic_errs += _AD.emit_msg(0, flag, linenum(), fmt, args); else - _AD._warnings += _AD.emit_msg(0, flag, _linenum, fmt, args); + _AD._warnings += _AD.emit_msg(0, flag, linenum(), fmt, args); int error_char = _curchar; char* error_ptr = _ptr+1; @@ -4515,7 +4681,7 @@ void ADLParser::next_char_or_line() { //---------------------------next_line----------------------------------------- void ADLParser::next_line() { - _curline = _buf.get_line(); _linenum++; + _curline = _buf.get_line(); } //-------------------------is_literal_constant--------------------------------- diff --git a/hotspot/src/share/vm/adlc/adlparse.hpp b/hotspot/src/share/vm/adlc/adlparse.hpp index 853a104f7cd..42329ac279e 100644 --- a/hotspot/src/share/vm/adlc/adlparse.hpp +++ b/hotspot/src/share/vm/adlc/adlparse.hpp @@ -70,7 +70,6 @@ class ADLParser { protected: char *_curline; // Start of current line char *_ptr; // Pointer into current location in File Buffer - int _linenum; // Count of line numbers seen so far char _curchar; // Current character from buffer FormDict &_globalNames; // Global names @@ -160,9 +159,10 @@ protected: Interface *interface_parse(); // Parse operand interface rule Interface *mem_interface_parse(); // Parse memory interface rule Interface *cond_interface_parse(); // Parse conditional interface rule - char *interface_field_parse();// Parse field contents + char *interface_field_parse(const char** format = NULL);// Parse field contents FormatRule *format_parse(void); // Parse format rule + FormatRule *template_parse(void); // Parse format rule void effect_parse(InstructForm *instr); // Parse effect rule ExpandRule *expand_parse(InstructForm *instr); // Parse expand rule RewriteRule *rewrite_parse(void); // Parse rewrite rule @@ -263,7 +263,7 @@ public: void parse(void); // Do the parsing & build forms lists - int getlines( ) { return _linenum; } + int linenum() { return _buf.linenum(); } static bool is_literal_constant(const char *hex_string); static bool is_hex_digit(char digit); diff --git a/hotspot/src/share/vm/adlc/filebuff.cpp b/hotspot/src/share/vm/adlc/filebuff.cpp index 502354edcf0..6fe23fcbae7 100644 --- a/hotspot/src/share/vm/adlc/filebuff.cpp +++ b/hotspot/src/share/vm/adlc/filebuff.cpp @@ -41,6 +41,7 @@ FileBuff::FileBuff( BufferedFile *fptr, ArchDesc& archDesc) : _fp(fptr), _AD(arc exit(1); // Exit on seek error } _filepos = ftell(_fp->_fp); // Reset current file position + _linenum = 0; _bigbuf = new char[_bufferSize]; // Create buffer to hold text for parser if( !_bigbuf ) { @@ -76,6 +77,7 @@ char *FileBuff::get_line(void) { // Check for end of file & return NULL if (_bufeol >= _bufmax) return NULL; + _linenum++; retval = ++_bufeol; // return character following end of previous line if (*retval == '\0') return NULL; // Check for EOF sentinal // Search for newline character which must end each line diff --git a/hotspot/src/share/vm/adlc/filebuff.hpp b/hotspot/src/share/vm/adlc/filebuff.hpp index fdfa985db4c..c36fdbaf3fa 100644 --- a/hotspot/src/share/vm/adlc/filebuff.hpp +++ b/hotspot/src/share/vm/adlc/filebuff.hpp @@ -51,6 +51,7 @@ class FileBuff { int _err; // Error flag for file seek/read operations long _filepos; // Current offset from start of file + int _linenum; ArchDesc& _AD; // Reference to Architecture Description @@ -66,6 +67,7 @@ class FileBuff { // This returns a pointer to the start of the current line in the buffer, // and increments bufeol and filepos to point at the end of that line. char *get_line(void); + int linenum() const { return _linenum; } // This converts a pointer into the buffer to a file offset. It only works // when the pointer is valid (i.e. just obtained from getline()). diff --git a/hotspot/src/share/vm/adlc/forms.cpp b/hotspot/src/share/vm/adlc/forms.cpp index e9d7de211ea..e2083c68259 100644 --- a/hotspot/src/share/vm/adlc/forms.cpp +++ b/hotspot/src/share/vm/adlc/forms.cpp @@ -35,6 +35,8 @@ Arena *Form::generate_arena() { //------------------------------NameList--------------------------------------- // reserved user-defined string const char *NameList::_signal = "$$SIGNAL$$"; +const char *NameList::_signal2 = "$$SIGNAL2$$"; +const char *NameList::_signal3 = "$$SIGNAL3$$"; // Constructor and Destructor NameList::NameList() : _cur(0), _max(4), _iter(0), _justReset(true) { diff --git a/hotspot/src/share/vm/adlc/forms.hpp b/hotspot/src/share/vm/adlc/forms.hpp index c510ac43aef..bf930b8e6da 100644 --- a/hotspot/src/share/vm/adlc/forms.hpp +++ b/hotspot/src/share/vm/adlc/forms.hpp @@ -329,6 +329,8 @@ protected: public: static const char *_signal; // reserved user-defined string + static const char *_signal2; // reserved user-defined string + static const char *_signal3; // reserved user-defined string enum { Not_in_list = -1 }; void addName(const char *name); diff --git a/hotspot/src/share/vm/adlc/formssel.cpp b/hotspot/src/share/vm/adlc/formssel.cpp index 2957ae39fc8..1146b57aeb4 100644 --- a/hotspot/src/share/vm/adlc/formssel.cpp +++ b/hotspot/src/share/vm/adlc/formssel.cpp @@ -1574,10 +1574,10 @@ Opcode::opcode_type Opcode::as_opcode_type(const char *param) { return Opcode::NOT_AN_OPCODE; } -void Opcode::print_opcode(FILE *fp, Opcode::opcode_type desired_opcode) { +bool Opcode::print_opcode(FILE *fp, Opcode::opcode_type desired_opcode) { // Default values previously provided by MachNode::primary()... - const char *description = "default_opcode()"; - const char *value = "-1"; + const char *description = NULL; + const char *value = NULL; // Check if user provided any opcode definitions if( this != NULL ) { // Update 'value' if user provided a definition in the instruction @@ -1599,7 +1599,10 @@ void Opcode::print_opcode(FILE *fp, Opcode::opcode_type desired_opcode) { break; } } - fprintf(fp, "(%s /*%s*/)", value, description); + if (value != NULL) { + fprintf(fp, "(%s /*%s*/)", value, description); + } + return value != NULL; } void Opcode::dump() { @@ -2610,14 +2613,19 @@ void MemInterface::output(FILE *fp) { } //------------------------------CondInterface---------------------------------- -CondInterface::CondInterface(char *equal, char *not_equal, - char *less, char *greater_equal, - char *less_equal, char *greater) +CondInterface::CondInterface(const char* equal, const char* equal_format, + const char* not_equal, const char* not_equal_format, + const char* less, const char* less_format, + const char* greater_equal, const char* greater_equal_format, + const char* less_equal, const char* less_equal_format, + const char* greater, const char* greater_format) : Interface("COND_INTER"), - _equal(equal), _not_equal(not_equal), - _less(less), _greater_equal(greater_equal), - _less_equal(less_equal), _greater(greater) { - // + _equal(equal), _equal_format(equal_format), + _not_equal(not_equal), _not_equal_format(not_equal_format), + _less(less), _less_format(less_format), + _greater_equal(greater_equal), _greater_equal_format(greater_equal_format), + _less_equal(less_equal), _less_equal_format(less_equal_format), + _greater(greater), _greater_format(greater_format) { } CondInterface::~CondInterface() { // not owner of any character arrays diff --git a/hotspot/src/share/vm/adlc/formssel.hpp b/hotspot/src/share/vm/adlc/formssel.hpp index 8ed2885c890..9bcbe636ef7 100644 --- a/hotspot/src/share/vm/adlc/formssel.hpp +++ b/hotspot/src/share/vm/adlc/formssel.hpp @@ -397,7 +397,7 @@ public: void output(FILE *fp); // --------------------------- FILE *output_routines - void print_opcode(FILE *fp, Opcode::opcode_type desired_opcode); + bool print_opcode(FILE *fp, Opcode::opcode_type desired_opcode); }; //------------------------------InsEncode-------------------------------------- @@ -779,10 +779,20 @@ public: const char *_greater_equal; const char *_less_equal; const char *_greater; + const char *_equal_format; + const char *_not_equal_format; + const char *_less_format; + const char *_greater_equal_format; + const char *_less_equal_format; + const char *_greater_format; // Public Methods - CondInterface(char *equal, char *not_equal, char *less, char *greater_equal, - char *less_equal, char *greater); + CondInterface(const char* equal, const char* equal_format, + const char* not_equal, const char* not_equal_format, + const char* less, const char* less_format, + const char* greater_equal, const char* greater_equal_format, + const char* less_equal, const char* less_equal_format, + const char* greater, const char* greater_format); ~CondInterface(); void dump(); diff --git a/hotspot/src/share/vm/adlc/output_c.cpp b/hotspot/src/share/vm/adlc/output_c.cpp index eb33e67b376..dbc287b1d1a 100644 --- a/hotspot/src/share/vm/adlc/output_c.cpp +++ b/hotspot/src/share/vm/adlc/output_c.cpp @@ -1619,6 +1619,7 @@ void ArchDesc::defineExpand(FILE *fp, InstructForm *node) { } // Iterate over the new instruction's operands + int prev_pos = -1; for( expand_instr->reset(); (opid = expand_instr->iter()) != NULL; ) { // Use 'parameter' at current position in list of new instruction's formals // instead of 'opid' when looking up info internal to new_inst @@ -1642,6 +1643,18 @@ void ArchDesc::defineExpand(FILE *fp, InstructForm *node) { // ins = (InstructForm *) _globalNames[new_id]; exp_pos = node->operand_position_format(opid); assert(exp_pos != -1, "Bad expand rule"); + if (prev_pos > exp_pos && expand_instruction->_matrule != NULL) { + // For the add_req calls below to work correctly they need + // to added in the same order that a match would add them. + // This means that they would need to be in the order of + // the components list instead of the formal parameters. + // This is a sort of hidden invariant that previously + // wasn't checked and could lead to incorrectly + // constructed nodes. + syntax_err(node->_linenum, "For expand in %s to work, parameter declaration order in %s must follow matchrule\n", + node->_ident, new_inst->_ident); + } + prev_pos = exp_pos; new_pos = new_inst->operand_position(parameter,Component::USE); if (new_pos != -1) { @@ -2306,7 +2319,12 @@ private: _processing_noninput = false; // A replacement variable, originally '$' if ( Opcode::as_opcode_type(rep_var) != Opcode::NOT_AN_OPCODE ) { - _inst._opcode->print_opcode(_fp, Opcode::as_opcode_type(rep_var) ); + if (!_inst._opcode->print_opcode(_fp, Opcode::as_opcode_type(rep_var) )) { + // Missing opcode + _AD.syntax_err( _inst._linenum, + "Missing $%s opcode definition in %s, used by encoding %s\n", + rep_var, _inst._ident, _encoding._name); + } } else { // Lookup its position in parameter list @@ -2348,7 +2366,13 @@ private: else if( Opcode::as_opcode_type(inst_rep_var) != Opcode::NOT_AN_OPCODE ) { // else check if "primary", "secondary", "tertiary" assert( _constant_status == LITERAL_ACCESSED, "Must be processing a literal constant parameter"); - _inst._opcode->print_opcode(_fp, Opcode::as_opcode_type(inst_rep_var) ); + if (!_inst._opcode->print_opcode(_fp, Opcode::as_opcode_type(inst_rep_var) )) { + // Missing opcode + _AD.syntax_err( _inst._linenum, + "Missing $%s opcode definition in %s\n", + rep_var, _inst._ident); + + } _constant_status = LITERAL_OUTPUT; } else if((_AD.get_registers() != NULL ) && (_AD.get_registers()->getRegDef(inst_rep_var) != NULL)) { diff --git a/hotspot/src/share/vm/adlc/output_h.cpp b/hotspot/src/share/vm/adlc/output_h.cpp index 04cddcd28c8..c5c0bd683bb 100644 --- a/hotspot/src/share/vm/adlc/output_h.cpp +++ b/hotspot/src/share/vm/adlc/output_h.cpp @@ -355,17 +355,19 @@ static void defineConstructor(FILE *fp, const char *name, uint num_consts, // --------------------------------------------------------------------------- // Generate the format rule for condition codes -static void defineCCodeDump(FILE *fp, int i) { - fprintf(fp, " if( _c%d == BoolTest::eq ) st->print(\"eq\");\n",i); - fprintf(fp, " else if( _c%d == BoolTest::ne ) st->print(\"ne\");\n",i); - fprintf(fp, " else if( _c%d == BoolTest::le ) st->print(\"le\");\n",i); - fprintf(fp, " else if( _c%d == BoolTest::ge ) st->print(\"ge\");\n",i); - fprintf(fp, " else if( _c%d == BoolTest::lt ) st->print(\"lt\");\n",i); - fprintf(fp, " else if( _c%d == BoolTest::gt ) st->print(\"gt\");\n",i); +static void defineCCodeDump(OperandForm* oper, FILE *fp, int i) { + assert(oper != NULL, "what"); + CondInterface* cond = oper->_interface->is_CondInterface(); + fprintf(fp, " if( _c%d == BoolTest::eq ) st->print(\"%s\");\n",i,cond->_equal_format); + fprintf(fp, " else if( _c%d == BoolTest::ne ) st->print(\"%s\");\n",i,cond->_not_equal_format); + fprintf(fp, " else if( _c%d == BoolTest::le ) st->print(\"%s\");\n",i,cond->_less_equal_format); + fprintf(fp, " else if( _c%d == BoolTest::ge ) st->print(\"%s\");\n",i,cond->_greater_equal_format); + fprintf(fp, " else if( _c%d == BoolTest::lt ) st->print(\"%s\");\n",i,cond->_less_format); + fprintf(fp, " else if( _c%d == BoolTest::gt ) st->print(\"%s\");\n",i,cond->_greater_format); } // Output code that dumps constant values, increment "i" if type is constant -static uint dump_spec_constant(FILE *fp, const char *ideal_type, uint i) { +static uint dump_spec_constant(FILE *fp, const char *ideal_type, uint i, OperandForm* oper) { if (!strcmp(ideal_type, "ConI")) { fprintf(fp," st->print(\"#%%d\", _c%d);\n", i); ++i; @@ -391,7 +393,7 @@ static uint dump_spec_constant(FILE *fp, const char *ideal_type, uint i) { ++i; } else if (!strcmp(ideal_type, "Bool")) { - defineCCodeDump(fp,i); + defineCCodeDump(oper, fp,i); ++i; } @@ -476,7 +478,7 @@ void gen_oper_format(FILE *fp, FormDict &globals, OperandForm &oper, bool for_c_ } // ALWAYS! Provide a special case output for condition codes. if( oper.is_ideal_bool() ) { - defineCCodeDump(fp,0); + defineCCodeDump(&oper, fp,0); } fprintf(fp,"}\n"); @@ -549,7 +551,7 @@ void gen_oper_format(FILE *fp, FormDict &globals, OperandForm &oper, bool for_c_ } // ALWAYS! Provide a special case output for condition codes. if( oper.is_ideal_bool() ) { - defineCCodeDump(fp,0); + defineCCodeDump(&oper, fp,0); } fprintf(fp, "}\n"); fprintf(fp, "#endif\n"); @@ -583,10 +585,53 @@ void gen_inst_format(FILE *fp, FormDict &globals, InstructForm &inst, bool for_c while( (string = inst._format->_strings.iter()) != NULL ) { fprintf(fp," "); // Check if this is a standard string or a replacement variable - if( string != NameList::_signal ) // Normal string. Pass through. + if( string == NameList::_signal ) { // Replacement variable + const char* rep_var = inst._format->_rep_vars.iter(); + inst.rep_var_format( fp, rep_var); + } else if( string == NameList::_signal3 ) { // Replacement variable in raw text + const char* rep_var = inst._format->_rep_vars.iter(); + const Form *form = inst._localNames[rep_var]; + if (form == NULL) { + fprintf(stderr, "unknown replacement variable in format statement: '%s'\n", rep_var); + assert(false, "ShouldNotReachHere()"); + } + OpClassForm *opc = form->is_opclass(); + assert( opc, "replacement variable was not found in local names"); + // Lookup the index position of the replacement variable + int idx = inst.operand_position_format(rep_var); + if ( idx == -1 ) { + assert( strcmp(opc->_ident,"label")==0, "Unimplemented"); + assert( false, "ShouldNotReachHere()"); + } + + if (inst.is_noninput_operand(idx)) { + assert( false, "ShouldNotReachHere()"); + } else { + // Output the format call for this operand + fprintf(fp,"opnd_array(%d)",idx); + } + rep_var = inst._format->_rep_vars.iter(); + inst._format->_strings.iter(); + if ( strcmp(rep_var,"$constant") == 0 && opc->is_operand()) { + Form::DataType constant_type = form->is_operand()->is_base_constant(globals); + if ( constant_type == Form::idealD ) { + fprintf(fp,"->constantD()"); + } else if ( constant_type == Form::idealF ) { + fprintf(fp,"->constantF()"); + } else if ( constant_type == Form::idealL ) { + fprintf(fp,"->constantL()"); + } else { + fprintf(fp,"->constant()"); + } + } else if ( strcmp(rep_var,"$cmpcode") == 0) { + fprintf(fp,"->ccode()"); + } else { + assert( false, "ShouldNotReachHere()"); + } + } else if( string == NameList::_signal2 ) // Raw program text + fputs(inst._format->_strings.iter(), fp); + else fprintf(fp,"st->print(\"%s\");\n", string); - else // Replacement variable - inst.rep_var_format( fp, inst._format->_rep_vars.iter() ); } // Done with all format strings } // Done generating the user-defined portion of the format @@ -1404,7 +1449,7 @@ void ArchDesc::declareClasses(FILE *fp) { oper->_components.reset(); if ((comp = oper->_components.iter()) == NULL) { assert(num_consts == 1, "Bad component list detected.\n"); - i = dump_spec_constant( fp, type, i ); + i = dump_spec_constant( fp, type, i, oper ); // Check that type actually matched assert( i != 0, "Non-constant operand lacks component list."); } // end if NULL @@ -1414,7 +1459,7 @@ void ArchDesc::declareClasses(FILE *fp) { oper->_components.reset(); while((comp = oper->_components.iter()) != NULL) { type = comp->base_type(_globalNames); - i = dump_spec_constant( fp, type, i ); + i = dump_spec_constant( fp, type, i, NULL ); } } // finish line (3) diff --git a/hotspot/src/share/vm/opto/matcher.hpp b/hotspot/src/share/vm/opto/matcher.hpp index d4ba9ef10e8..a042c04b003 100644 --- a/hotspot/src/share/vm/opto/matcher.hpp +++ b/hotspot/src/share/vm/opto/matcher.hpp @@ -324,7 +324,7 @@ public: virtual int regnum_to_fpu_offset(int regnum); // Is this branch offset small enough to be addressed by a short branch? - bool is_short_branch_offset(int offset); + bool is_short_branch_offset(int rule, int offset); // Optional scaling for the parameter to the ClearArray/CopyArray node. static const bool init_array_count_is_in_bytes; diff --git a/hotspot/src/share/vm/opto/output.cpp b/hotspot/src/share/vm/opto/output.cpp index a3c877077b5..d6cfb0d94ff 100644 --- a/hotspot/src/share/vm/opto/output.cpp +++ b/hotspot/src/share/vm/opto/output.cpp @@ -332,6 +332,7 @@ void Compile::Shorten_branches(Label *labels, int& code_size, int& reloc_size, i uint *jmp_end = NEW_RESOURCE_ARRAY(uint,_cfg->_num_blocks); uint *blk_starts = NEW_RESOURCE_ARRAY(uint,_cfg->_num_blocks+1); DEBUG_ONLY( uint *jmp_target = NEW_RESOURCE_ARRAY(uint,_cfg->_num_blocks); ) + DEBUG_ONLY( uint *jmp_rule = NEW_RESOURCE_ARRAY(uint,_cfg->_num_blocks); ) blk_starts[0] = 0; // Initialize the sizes to 0 @@ -443,9 +444,9 @@ void Compile::Shorten_branches(Label *labels, int& code_size, int& reloc_size, i uintptr_t target = blk_starts[bnum]; if( mach->is_pc_relative() ) { int offset = target-(blk_starts[i] + jmp_end[i]); - if (_matcher->is_short_branch_offset(offset)) { + if (_matcher->is_short_branch_offset(mach->rule(), offset)) { // We've got a winner. Replace this branch. - MachNode *replacement = mach->short_branch_version(this); + MachNode* replacement = mach->short_branch_version(this); b->_nodes.map(j, replacement); mach->subsume_by(replacement); @@ -453,6 +454,7 @@ void Compile::Shorten_branches(Label *labels, int& code_size, int& reloc_size, i // next pass. jmp_end[i] -= (mach->size(_regalloc) - replacement->size(_regalloc)); DEBUG_ONLY( jmp_target[i] = bnum; ); + DEBUG_ONLY( jmp_rule[i] = mach->rule(); ); } } else { #ifndef PRODUCT @@ -524,10 +526,10 @@ void Compile::Shorten_branches(Label *labels, int& code_size, int& reloc_size, i for( i=0; i<_cfg->_num_blocks; i++ ) { // For all blocks if( jmp_target[i] != 0 ) { int offset = blk_starts[jmp_target[i]]-(blk_starts[i] + jmp_end[i]); - if (!_matcher->is_short_branch_offset(offset)) { + if (!_matcher->is_short_branch_offset(jmp_rule[i], offset)) { tty->print_cr("target (%d) - jmp_end(%d) = offset (%d), jmp_block B%d, target_block B%d", blk_starts[jmp_target[i]], blk_starts[i] + jmp_end[i], offset, i, jmp_target[i]); } - assert(_matcher->is_short_branch_offset(offset), "Displacement too large for short jmp"); + assert(_matcher->is_short_branch_offset(jmp_rule[i], offset), "Displacement too large for short jmp"); } } #endif @@ -1069,7 +1071,7 @@ void Compile::Fill_buffer() { // If this machine supports different size branch offsets, then pre-compute // the length of the blocks - if( _matcher->is_short_branch_offset(0) ) { + if( _matcher->is_short_branch_offset(-1, 0) ) { Shorten_branches(blk_labels, code_req, locs_req, stub_req, const_req); labels_not_set = false; } diff --git a/hotspot/src/share/vm/opto/reg_split.cpp b/hotspot/src/share/vm/opto/reg_split.cpp index 6db3a76d5f7..003df4c48b7 100644 --- a/hotspot/src/share/vm/opto/reg_split.cpp +++ b/hotspot/src/share/vm/opto/reg_split.cpp @@ -53,6 +53,7 @@ Node *PhaseChaitin::get_spillcopy_wide( Node *def, Node *use, uint uidx ) { // Bail rather than abort int ireg = def->ideal_reg(); if( ireg == 0 || ireg == Op_RegFlags ) { + assert(false, "attempted to spill a non-spillable item"); C->record_method_not_compilable("attempted to spill a non-spillable item"); return NULL; } From 540b83b6b19d1615a1a56503aec3707104cb5b37 Mon Sep 17 00:00:00 2001 From: Eamonn McManus Date: Tue, 28 Oct 2008 18:21:36 +0100 Subject: [PATCH 091/267] 6763051: MXBean: Incorrect type names for parametrized dealing with arrays (openType) 6713777: developer diagnosability of errors in uncompliant mxbean interfaces Reviewed-by: dfuchs --- .../DefaultMXBeanMappingFactory.java | 56 ++++- .../jmx/mbeanserver/MXBeanIntrospector.java | 12 +- .../MBeanServerInvocationHandler.java | 8 +- .../mxbean/ExceptionDiagnosisTest.java | 237 ++++++++++++++++++ .../javax/management/mxbean/TypeNameTest.java | 32 ++- 5 files changed, 323 insertions(+), 22 deletions(-) create mode 100644 jdk/test/javax/management/mxbean/ExceptionDiagnosisTest.java diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java index d7ca5b0f629..1b653c28eaf 100644 --- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java +++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/DefaultMXBeanMappingFactory.java @@ -26,7 +26,8 @@ package com.sun.jmx.mbeanserver; import static com.sun.jmx.mbeanserver.Util.*; -import java.lang.annotation.ElementType; +import static com.sun.jmx.mbeanserver.MXBeanIntrospector.typeName; + import javax.management.openmbean.MXBeanMappingClass; import static javax.management.openmbean.SimpleType.*; @@ -247,8 +248,10 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { public synchronized MXBeanMapping mappingForType(Type objType, MXBeanMappingFactory factory) throws OpenDataException { - if (inProgress.containsKey(objType)) - throw new OpenDataException("Recursive data structure"); + if (inProgress.containsKey(objType)) { + throw new OpenDataException( + "Recursive data structure, including " + typeName(objType)); + } MXBeanMapping mapping; @@ -259,6 +262,8 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { inProgress.put(objType, objType); try { mapping = makeMapping(objType, factory); + } catch (OpenDataException e) { + throw openDataException("Cannot convert type: " + typeName(objType), e); } finally { inProgress.remove(objType); } @@ -411,7 +416,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { MXBeanMappingFactory factory) throws OpenDataException { - final String objTypeName = objType.toString(); + final String objTypeName = typeName(objType); final MXBeanMapping keyMapping = factory.mappingForType(keyType, factory); final MXBeanMapping valueMapping = factory.mappingForType(valueType, factory); final OpenType keyOpenType = keyMapping.getOpenType(); @@ -926,6 +931,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { concatenating each Builder's explanation of why it isn't applicable. */ final StringBuilder whyNots = new StringBuilder(); + Throwable possibleCause = null; find: for (CompositeBuilder[] relatedBuilders : builders) { for (int i = 0; i < relatedBuilders.length; i++) { @@ -935,6 +941,9 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { foundBuilder = builder; break find; } + Throwable cause = builder.possibleCause(); + if (cause != null) + possibleCause = cause; if (whyNot.length() > 0) { if (whyNots.length() > 0) whyNots.append("; "); @@ -945,10 +954,12 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { } } if (foundBuilder == null) { - final String msg = + String msg = "Do not know how to make a " + targetClass.getName() + " from a CompositeData: " + whyNots; - throw new InvalidObjectException(msg); + if (possibleCause != null) + msg += ". Remaining exceptions show a POSSIBLE cause."; + throw invalidObjectException(msg, possibleCause); } compositeBuilder = foundBuilder; } @@ -996,6 +1007,16 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { abstract String applicable(Method[] getters) throws InvalidObjectException; + /** If the subclass returns an explanation of why it is not applicable, + it can additionally indicate an exception with details. This is + potentially confusing, because the real problem could be that one + of the other subclasses is supposed to be applicable but isn't. + But the advantage of less information loss probably outweighs the + disadvantage of possible confusion. */ + Throwable possibleCause() { + return null; + } + abstract Object fromCompositeData(CompositeData cd, String[] itemNames, MXBeanMapping[] converters) @@ -1031,8 +1052,8 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { if (fromMethod.getReturnType() != getTargetClass()) { final String msg = "Method from(CompositeData) returns " + - fromMethod.getReturnType().getName() + - " not " + targetClass.getName(); + typeName(fromMethod.getReturnType()) + + " not " + typeName(targetClass); throw new InvalidObjectException(msg); } @@ -1083,6 +1104,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { try { getterConverters[i].checkReconstructible(); } catch (InvalidObjectException e) { + possibleCause = e; return "method " + getters[i].getName() + " returns type " + "that cannot be mapped back from OpenData"; } @@ -1090,6 +1112,11 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { return ""; } + @Override + Throwable possibleCause() { + return possibleCause; + } + final Object fromCompositeData(CompositeData cd, String[] itemNames, MXBeanMapping[] converters) { @@ -1097,6 +1124,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { } private final MXBeanMapping[] getterConverters; + private Throwable possibleCause; } /** Builder for when the target class has a setter for every getter. */ @@ -1227,10 +1255,16 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory { for (int i = 0; i < propertyNames.length; i++) { String propertyName = propertyNames[i]; if (!getterMap.containsKey(propertyName)) { - final String msg = + String msg = "@ConstructorProperties includes name " + propertyName + - " which does not correspond to a property: " + - constr; + " which does not correspond to a property"; + for (String getterName : getterMap.keySet()) { + if (getterName.equalsIgnoreCase(propertyName)) { + msg += " (differs only in case from property " + + getterName + ")"; + } + } + msg += ": " + constr; throw new InvalidObjectException(msg); } int getterIndex = getterMap.get(propertyName); diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/MXBeanIntrospector.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/MXBeanIntrospector.java index bcb6f869c20..af5420c38f3 100644 --- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/MXBeanIntrospector.java +++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/MXBeanIntrospector.java @@ -391,26 +391,26 @@ class MXBeanIntrospector extends MBeanIntrospector { if (type instanceof Class) return ((Class) type).getName(); else - return genericTypeString(type); + return typeName(type); } - private static String genericTypeString(Type type) { + static String typeName(Type type) { if (type instanceof Class) { Class c = (Class) type; if (c.isArray()) - return genericTypeString(c.getComponentType()) + "[]"; + return typeName(c.getComponentType()) + "[]"; else return c.getName(); } else if (type instanceof GenericArrayType) { GenericArrayType gat = (GenericArrayType) type; - return genericTypeString(gat.getGenericComponentType()) + "[]"; + return typeName(gat.getGenericComponentType()) + "[]"; } else if (type instanceof ParameterizedType) { ParameterizedType pt = (ParameterizedType) type; StringBuilder sb = new StringBuilder(); - sb.append(genericTypeString(pt.getRawType())).append("<"); + sb.append(typeName(pt.getRawType())).append("<"); String sep = ""; for (Type t : pt.getActualTypeArguments()) { - sb.append(sep).append(genericTypeString(t)); + sb.append(sep).append(typeName(t)); sep = ", "; } return sb.append(">").toString(); diff --git a/jdk/src/share/classes/javax/management/MBeanServerInvocationHandler.java b/jdk/src/share/classes/javax/management/MBeanServerInvocationHandler.java index 936b03ce489..20c934f15c6 100644 --- a/jdk/src/share/classes/javax/management/MBeanServerInvocationHandler.java +++ b/jdk/src/share/classes/javax/management/MBeanServerInvocationHandler.java @@ -361,7 +361,13 @@ public class MBeanServerInvocationHandler implements InvocationHandler { if (p != null) return p; } - p = new MXBeanProxy(mxbeanInterface, mappingFactory); + try { + p = new MXBeanProxy(mxbeanInterface, mappingFactory); + } catch (IllegalArgumentException e) { + String msg = "Cannot make MXBean proxy for " + + mxbeanInterface.getName() + ": " + e.getMessage(); + throw new IllegalArgumentException(msg, e.getCause()); + } classToProxy.put(mxbeanInterface, new WeakReference(p)); return p; } diff --git a/jdk/test/javax/management/mxbean/ExceptionDiagnosisTest.java b/jdk/test/javax/management/mxbean/ExceptionDiagnosisTest.java new file mode 100644 index 00000000000..d44e289efd8 --- /dev/null +++ b/jdk/test/javax/management/mxbean/ExceptionDiagnosisTest.java @@ -0,0 +1,237 @@ +/* + * @test + * @bug 6713777 + * @summary Test that exception messages include all relevant information + * @author Eamonn McManus + */ + +import java.beans.ConstructorProperties; +import java.io.File; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import javax.management.JMX; +import javax.management.MBeanServer; +import javax.management.MBeanServerFactory; +import javax.management.NotCompliantMBeanException; +import javax.management.ObjectName; + +public class ExceptionDiagnosisTest { + private static volatile String failure; + + // ------ Illegal MXBeans ------ + + // Test that all of BdelloidMXBean, Rotifer, and File appear in the + // exception messages. File is not an allowed type because of recursive + // getters like "File getParentFile()". + public static interface BdelloidMXBean { + public Rotifer getRotifer(); + } + + public static class Bdelloid implements BdelloidMXBean { + public Rotifer getRotifer() { + return null; + } + } + + public static class Rotifer { + public File getFile() { + return null; + } + } + + // Test that all of IndirectHashMapMXBean, HashMapContainer, and + // HashMap appear in the exception messages. + // HashMap is not an allowed type because only the + // java.util interface such as Map are allowed with generic parameters, + // not their concrete implementations like HashMap. + public static interface IndirectHashMapMXBean { + public HashMapContainer getContainer(); + } + + public static class IndirectHashMap implements IndirectHashMapMXBean { + public HashMapContainer getContainer() { + return null; + } + } + + public static class HashMapContainer { + public HashMap getHashMap() {return null;} + } + + // ------ MXBeans that are legal but where proxies are not ------ + + // Test that all of BlimMXBean, BlimContainer, Blim, and Blam appear + // in the exception messages for a proxy for this MXBean. Blam is + // legal in MXBeans but is not reconstructible so you cannot make + // a proxy for BlimMXBean. + public static interface BlimMXBean { + public BlimContainer getBlimContainer(); + } + + public static class BlimImpl implements BlimMXBean { + public BlimContainer getBlimContainer() { + return null; + } + } + + public static class BlimContainer { + public Blim getBlim() {return null;} + public void setBlim(Blim blim) {} + } + + public static class Blim { + public Blam getBlam() {return null;} + public void setBlam(Blam blam) {} + } + + public static class Blam { + public Blam(int x) {} + + public int getX() {return 0;} + } + + + // ------ Property name differing only in case ------ + + public static interface CaseProbMXBean { + public CaseProb getCaseProb(); + } + + public static class CaseProbImpl implements CaseProbMXBean { + public CaseProb getCaseProb() {return null;} + } + + public static class CaseProb { + @ConstructorProperties({"urlPath"}) + public CaseProb(String urlPath) {} + + public String getURLPath() {return null;} + } + + + public static void main(String[] args) throws Exception { + testMXBeans(new Bdelloid(), BdelloidMXBean.class, Rotifer.class, File.class); + testMXBeans(new IndirectHashMap(), + IndirectHashMapMXBean.class, HashMapContainer.class, + HashMapContainer.class.getMethod("getHashMap").getGenericReturnType()); + + testProxies(new BlimImpl(), BlimMXBean.class, BlimMXBean.class, + BlimContainer.class, Blim.class, Blam.class); + + testCaseProb(); + + if (failure == null) + System.out.println("TEST PASSED"); + else + throw new Exception("TEST FAILED: " + failure); + } + + private static void testMXBeans(Object mbean, Type... expectedTypes) + throws Exception { + try { + MBeanServer mbs = MBeanServerFactory.newMBeanServer(); + ObjectName name = new ObjectName("a:b=c"); + mbs.registerMBean(mbean, name); + fail("No exception from registerMBean for " + mbean); + } catch (NotCompliantMBeanException e) { + checkExceptionChain("MBean " + mbean, e, expectedTypes); + } + } + + private static void testProxies( + Object mbean, Class mxbeanClass, Type... expectedTypes) + throws Exception { + MBeanServer mbs = MBeanServerFactory.newMBeanServer(); + ObjectName name = new ObjectName("a:b=c"); + mbs.registerMBean(mbean, name); + T proxy = JMX.newMXBeanProxy(mbs, name, mxbeanClass); + List methods = new ArrayList(); + for (Method m : mxbeanClass.getMethods()) { + if (m.getDeclaringClass() == mxbeanClass) + methods.add(m); + } + if (methods.size() != 1) { + fail("TEST BUG: expected to find exactly one method in " + + mxbeanClass.getName() + ": " + methods); + } + Method getter = methods.get(0); + try { + try { + getter.invoke(proxy); + fail("No exception from proxy method " + getter.getName() + + " in " + mxbeanClass.getName()); + } catch (InvocationTargetException e) { + Throwable cause = e.getCause(); + if (cause instanceof Exception) + throw (Exception) cause; + else + throw (Error) cause; + } + } catch (IllegalArgumentException e) { + checkExceptionChain( + "Proxy for " + mxbeanClass.getName(), e, expectedTypes); + } + } + + private static void testCaseProb() throws Exception { + MBeanServer mbs = MBeanServerFactory.newMBeanServer(); + ObjectName name = new ObjectName("a:b=c"); + Object mbean = new CaseProbImpl(); + mbs.registerMBean(new CaseProbImpl(), name); + CaseProbMXBean proxy = JMX.newMXBeanProxy(mbs, name, CaseProbMXBean.class); + try { + CaseProb prob = proxy.getCaseProb(); + fail("No exception from proxy method getCaseProb"); + } catch (IllegalArgumentException e) { + String messageChain = messageChain(e); + if (messageChain.contains("URLPath")) { + System.out.println("Message chain contains URLPath as required: " + + messageChain); + } else { + fail("Exception chain for CaseProb does not mention property" + + " URLPath differing only in case"); + System.out.println("Full stack trace:"); + e.printStackTrace(System.out); + } + } + } + + private static void checkExceptionChain( + String what, Throwable e, Type[] expectedTypes) { + System.out.println("Exceptions in chain for " + what + ":"); + for (Throwable t = e; t != null; t = t.getCause()) + System.out.println(".." + t); + + String messageChain = messageChain(e); + + // Now check that each of the classes is mentioned in those messages + for (Type type : expectedTypes) { + String name = (type instanceof Class) ? + ((Class) type).getName() : type.toString(); + if (!messageChain.contains(name)) { + fail("Exception chain for " + what + " does not mention " + + name); + System.out.println("Full stack trace:"); + e.printStackTrace(System.out); + } + } + + System.out.println(); + } + + private static String messageChain(Throwable t) { + String msg = "//"; + for ( ; t != null; t = t.getCause()) + msg += " " + t.getMessage() + " //"; + return msg; + } + + private static void fail(String why) { + failure = why; + System.out.println("FAIL: " + why); + } +} diff --git a/jdk/test/javax/management/mxbean/TypeNameTest.java b/jdk/test/javax/management/mxbean/TypeNameTest.java index f5f48bccacb..ede7fdc69bf 100644 --- a/jdk/test/javax/management/mxbean/TypeNameTest.java +++ b/jdk/test/javax/management/mxbean/TypeNameTest.java @@ -40,6 +40,8 @@ import javax.management.MBeanServer; import javax.management.MBeanServerFactory; import javax.management.ObjectName; import javax.management.StandardMBean; +import javax.management.openmbean.TabularData; +import javax.management.openmbean.TabularType; public class TypeNameTest { public static interface TestMXBean { @@ -63,7 +65,7 @@ public class TypeNameTest { } }; - static String failure; + static volatile String failure; public static void main(String[] args) throws Exception { TestMXBean testImpl = (TestMXBean) Proxy.newProxyInstance( @@ -74,24 +76,46 @@ public class TypeNameTest { mbs.registerMBean(mxbean, name); MBeanInfo mbi = mbs.getMBeanInfo(name); MBeanAttributeInfo[] mbais = mbi.getAttributes(); + boolean sawTabular = false; for (MBeanAttributeInfo mbai : mbais) { String attrName = mbai.getName(); String attrTypeName = (String) mbai.getDescriptor().getFieldValue("originalType"); String fieldName = attrName + "Name"; Field nameField = TestMXBean.class.getField(fieldName); String expectedTypeName = (String) nameField.get(null); + if (expectedTypeName.equals(attrTypeName)) { System.out.println("OK: " + attrName + ": " + attrTypeName); } else { - failure = "For attribute " + attrName + " expected type name \"" + + fail("For attribute " + attrName + " expected type name \"" + expectedTypeName + "\", found type name \"" + attrTypeName + - "\""; - System.out.println("FAIL: " + failure); + "\""); + } + + if (mbai.getType().equals(TabularData.class.getName())) { + sawTabular = true; + TabularType tt = (TabularType) mbai.getDescriptor().getFieldValue("openType"); + if (tt.getTypeName().equals(attrTypeName)) { + System.out.println("OK: TabularType name for " + attrName); + } else { + fail("For attribute " + attrName + " expected TabularType " + + "name \"" + attrTypeName + "\", found \"" + + tt.getTypeName()); + } } } + + if (!sawTabular) + fail("Test bug: did not test TabularType name"); + if (failure == null) System.out.println("TEST PASSED"); else throw new Exception("TEST FAILED: " + failure); } + + private static void fail(String why) { + System.out.println("FAIL: " + why); + failure = why; + } } From 85375338730caf61eb120dca9897d6bd25309e84 Mon Sep 17 00:00:00 2001 From: Tom Rodriguez Date: Tue, 28 Oct 2008 18:02:09 -0700 Subject: [PATCH 092/267] 6649622: HotSpot Biased locking needs tuning on latest CPUs Reviewed-by: rasbold, kvn, kamg --- hotspot/src/share/vm/runtime/arguments.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp index b8bf9f1cd9c..f46aa9c2fb5 100644 --- a/hotspot/src/share/vm/runtime/arguments.cpp +++ b/hotspot/src/share/vm/runtime/arguments.cpp @@ -1365,6 +1365,9 @@ void Arguments::set_aggressive_opts_flags() { if (AggressiveOpts && FLAG_IS_DEFAULT(SpecialArraysEquals)) { FLAG_SET_DEFAULT(SpecialArraysEquals, true); } + if (AggressiveOpts && FLAG_IS_DEFAULT(BiasedLockingStartupDelay)) { + FLAG_SET_DEFAULT(BiasedLockingStartupDelay, 500); + } #endif if (AggressiveOpts) { From 401e04572ae917dc0eebbab8acf57fb91be2dd92 Mon Sep 17 00:00:00 2001 From: John Coomes Date: Wed, 29 Oct 2008 06:30:02 -0700 Subject: [PATCH 093/267] 6765804: GC "dead ratios" should be unsigned Reviewed-by: ysr, tonyp --- .../parallelScavenge/psMarkSweepDecorator.cpp | 14 ++++++------ .../parallelScavenge/psMarkSweepDecorator.hpp | 22 ++++++++++--------- hotspot/src/share/vm/memory/space.cpp | 4 ++-- hotspot/src/share/vm/memory/space.hpp | 8 +++---- .../src/share/vm/memory/tenuredGeneration.hpp | 1 - hotspot/src/share/vm/runtime/globals.hpp | 4 ++-- 6 files changed, 27 insertions(+), 26 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp index 40fb6a1b1b6..310ad40d1b7 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp @@ -90,10 +90,10 @@ void PSMarkSweepDecorator::precompact() { */ bool skip_dead = ((PSMarkSweep::total_invocations() % MarkSweepAlwaysCompactCount) != 0); - ssize_t allowed_deadspace = 0; + size_t allowed_deadspace = 0; if (skip_dead) { - int ratio = allowed_dead_ratio(); - allowed_deadspace = (space()->capacity_in_bytes() * ratio / 100) / HeapWordSize; + const size_t ratio = allowed_dead_ratio(); + allowed_deadspace = space()->capacity_in_words() * ratio / 100; } // Fetch the current destination decorator @@ -271,10 +271,10 @@ void PSMarkSweepDecorator::precompact() { dest->set_compaction_top(compact_top); } -bool PSMarkSweepDecorator::insert_deadspace(ssize_t& allowed_deadspace_words, - HeapWord* q, size_t deadlength) { - allowed_deadspace_words -= deadlength; - if (allowed_deadspace_words >= 0) { +bool PSMarkSweepDecorator::insert_deadspace(size_t& allowed_deadspace_words, + HeapWord* q, size_t deadlength) { + if (allowed_deadspace_words >= deadlength) { + allowed_deadspace_words -= deadlength; oop(q)->set_mark(markOopDesc::prototype()->set_marked()); const size_t aligned_min_int_array_size = align_object_size(typeArrayOopDesc::header_size(T_INT)); diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.hpp index 4c7cfdcb55c..affd17edc4c 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.hpp @@ -39,14 +39,16 @@ class PSMarkSweepDecorator: public CHeapObj { HeapWord* _first_dead; HeapWord* _end_of_live; HeapWord* _compaction_top; - unsigned int _allowed_dead_ratio; + size_t _allowed_dead_ratio; - bool insert_deadspace(ssize_t& allowed_deadspace_words, HeapWord* q, size_t word_len); + bool insert_deadspace(size_t& allowed_deadspace_words, HeapWord* q, + size_t word_len); public: PSMarkSweepDecorator(MutableSpace* space, ObjectStartArray* start_array, - unsigned int allowed_dead_ratio) : - _space(space), _start_array(start_array), _allowed_dead_ratio(allowed_dead_ratio) { } + size_t allowed_dead_ratio) : + _space(space), _start_array(start_array), + _allowed_dead_ratio(allowed_dead_ratio) { } // During a compacting collection, we need to collapse objects into // spaces in a given order. We want to fill space A, space B, and so @@ -57,14 +59,14 @@ class PSMarkSweepDecorator: public CHeapObj { static PSMarkSweepDecorator* destination_decorator(); // Accessors - MutableSpace* space() { return _space; } - ObjectStartArray* start_array() { return _start_array; } + MutableSpace* space() { return _space; } + ObjectStartArray* start_array() { return _start_array; } - HeapWord* compaction_top() { return _compaction_top; } - void set_compaction_top(HeapWord* value) { _compaction_top = value; } + HeapWord* compaction_top() { return _compaction_top; } + void set_compaction_top(HeapWord* value) { _compaction_top = value; } - unsigned int allowed_dead_ratio() { return _allowed_dead_ratio; } - void set_allowed_dead_ratio(unsigned int value) { _allowed_dead_ratio = value; } + size_t allowed_dead_ratio() { return _allowed_dead_ratio; } + void set_allowed_dead_ratio(size_t value) { _allowed_dead_ratio = value; } // Work methods void adjust_pointers(); diff --git a/hotspot/src/share/vm/memory/space.cpp b/hotspot/src/share/vm/memory/space.cpp index 37e6f61d2cc..82529444c0a 100644 --- a/hotspot/src/share/vm/memory/space.cpp +++ b/hotspot/src/share/vm/memory/space.cpp @@ -997,11 +997,11 @@ void OffsetTableContigSpace::serialize_block_offset_array_offsets( } -int TenuredSpace::allowed_dead_ratio() const { +size_t TenuredSpace::allowed_dead_ratio() const { return MarkSweepDeadRatio; } -int ContigPermSpace::allowed_dead_ratio() const { +size_t ContigPermSpace::allowed_dead_ratio() const { return PermMarkSweepDeadRatio; } diff --git a/hotspot/src/share/vm/memory/space.hpp b/hotspot/src/share/vm/memory/space.hpp index 8edfd49e444..a102c5f220c 100644 --- a/hotspot/src/share/vm/memory/space.hpp +++ b/hotspot/src/share/vm/memory/space.hpp @@ -421,7 +421,7 @@ public: // The maximum percentage of objects that can be dead in the compacted // live part of a compacted space ("deadwood" support.) - virtual int allowed_dead_ratio() const { return 0; }; + virtual size_t allowed_dead_ratio() const { return 0; }; // Some contiguous spaces may maintain some data structures that should // be updated whenever an allocation crosses a boundary. This function @@ -507,7 +507,7 @@ protected: \ size_t allowed_deadspace = 0; \ if (skip_dead) { \ - int ratio = allowed_dead_ratio(); \ + const size_t ratio = allowed_dead_ratio(); \ allowed_deadspace = (capacity() * ratio / 100) / HeapWordSize; \ } \ \ @@ -1079,7 +1079,7 @@ class TenuredSpace: public OffsetTableContigSpace { friend class VMStructs; protected: // Mark sweep support - int allowed_dead_ratio() const; + size_t allowed_dead_ratio() const; public: // Constructor TenuredSpace(BlockOffsetSharedArray* sharedOffsetArray, @@ -1094,7 +1094,7 @@ class ContigPermSpace: public OffsetTableContigSpace { friend class VMStructs; protected: // Mark sweep support - int allowed_dead_ratio() const; + size_t allowed_dead_ratio() const; public: // Constructor ContigPermSpace(BlockOffsetSharedArray* sharedOffsetArray, MemRegion mr) : diff --git a/hotspot/src/share/vm/memory/tenuredGeneration.hpp b/hotspot/src/share/vm/memory/tenuredGeneration.hpp index 18aa8b37fb3..a7c22c9bb3a 100644 --- a/hotspot/src/share/vm/memory/tenuredGeneration.hpp +++ b/hotspot/src/share/vm/memory/tenuredGeneration.hpp @@ -73,7 +73,6 @@ class TenuredGeneration: public OneContigSpaceCardGeneration { // Mark sweep support void compute_new_size(); - int allowed_dead_ratio() const; virtual void gc_prologue(bool full); virtual void gc_epilogue(bool full); diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index cba2b991403..ab5a6489451 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -2792,7 +2792,7 @@ class CommandLineFlags { product(intx, TargetSurvivorRatio, 50, \ "Desired percentage of survivor space used after scavenge") \ \ - product(intx, MarkSweepDeadRatio, 5, \ + product(uintx, MarkSweepDeadRatio, 5, \ "Percentage (0-100) of the old gen allowed as dead wood." \ "Serial mark sweep treats this as both the min and max value." \ "CMS uses this value only if it falls back to mark sweep." \ @@ -2801,7 +2801,7 @@ class CommandLineFlags { "either completely full or completely empty. Par compact also" \ "has a smaller default value; see arguments.cpp.") \ \ - product(intx, PermMarkSweepDeadRatio, 20, \ + product(uintx, PermMarkSweepDeadRatio, 20, \ "Percentage (0-100) of the perm gen allowed as dead wood." \ "See MarkSweepDeadRatio for collector-specific comments.") \ \ From 44dcc74e788b9aa6350e30f5c2e9b981dc5c2587 Mon Sep 17 00:00:00 2001 From: Eamonn McManus Date: Thu, 30 Oct 2008 17:46:50 +0100 Subject: [PATCH 094/267] 6252609: Two different default descriptor forms defined for ModelMBeanInfoSupport 6253137: Documentation for NotificationListener's handback parameter is confusing 6368691: javadoc for JMX Descriptors has bugs and is very hard to navigate 6602699: support for async notification of mbeaninfo update 6759612: [javadoc] EventClient.NOTIFS_LOST has a garbled href to addEventClientListener 6759619: Clarify what EventClient.getEventClientNotificationInfo does 6759622: Clarify what EventClient.getListeners list does Documentation fixes, plus simple bugfix for 6759619. Reviewed-by: dfuchs --- .../classes/javax/management/Descriptor.java | 167 +++++++++++++++--- .../classes/javax/management/MBeanInfo.java | 51 +++++- .../classes/javax/management/MBeanServer.java | 10 +- .../management/NotificationListener.java | 11 +- .../javax/management/event/EventClient.java | 27 +-- .../modelmbean/DescriptorSupport.java | 4 +- .../modelmbean/ModelMBeanAttributeInfo.java | 75 +++++--- .../modelmbean/ModelMBeanConstructorInfo.java | 37 ++-- .../management/modelmbean/ModelMBeanInfo.java | 70 +++++--- .../ModelMBeanNotificationInfo.java | 58 +++--- .../modelmbean/ModelMBeanOperationInfo.java | 63 ++++--- .../eventService/CustomForwarderTest.java | 52 +++++- .../javax/management/mxbean/TypeNameTest.java | 2 +- 13 files changed, 467 insertions(+), 160 deletions(-) diff --git a/jdk/src/share/classes/javax/management/Descriptor.java b/jdk/src/share/classes/javax/management/Descriptor.java index 70c17f2eedb..a74fb11cde7 100644 --- a/jdk/src/share/classes/javax/management/Descriptor.java +++ b/jdk/src/share/classes/javax/management/Descriptor.java @@ -101,7 +101,7 @@ import javax.management.openmbean.OpenType; * * NameTypeUsed inMeaning * - * defaultValueObject + * defaultValueObject * MBeanAttributeInfo
MBeanParameterInfo * * Default value for an attribute or parameter. See @@ -144,7 +144,7 @@ import javax.management.openmbean.OpenType; * might be disabled if it cannot currently be emitted but could be in * other circumstances. * - * immutableInfoString + * immutableInfoString * MBeanInfo * * The string {@code "true"} or {@code "false"} according as this @@ -153,20 +153,24 @@ import javax.management.openmbean.OpenType; * the lifetime of the MBean. Hence, a client can read it once and * cache the read value. When this field is false or absent, there is * no such guarantee, although that does not mean that the MBeanInfo - * will necessarily change. + * will necessarily change. See also the {@code "jmx.mbean.info.changed"} + * notification. * * infoTimeoutString
LongMBeanInfo * - * The time in milli-seconds that the MBeanInfo can reasonably be - * expected to be unchanged. The value can be a {@code Long} or a - * decimal string. This provides a hint from a DynamicMBean or any + * The time in milli-seconds that the MBeanInfo can + * reasonably be expected to be unchanged. The value can be a {@code Long} + * or a decimal string. This provides a hint from a DynamicMBean or any * MBean that does not define {@code immutableInfo} as {@code true} * that the MBeanInfo is not likely to change within this period and * therefore can be cached. When this field is missing or has the * value zero, it is not recommended to cache the MBeanInfo unless it - * has the {@code immutableInfo} set to {@code true}. + * has the {@code immutableInfo} set to {@code true} or it has {@code "jmx.mbean.info.changed"} in + * its {@link MBeanNotificationInfo} array. * - * interfaceClassName + * interfaceClassName * StringMBeanInfo * * The Java interface name for a Standard MBean or MXBean, as @@ -175,19 +179,19 @@ import javax.management.openmbean.OpenType; * StandardMBean} class will have this field in its MBeanInfo * Descriptor. * - * legalValues + * legalValues * {@literal Set}MBeanAttributeInfo
MBeanParameterInfo * * Legal values for an attribute or parameter. See * {@link javax.management.openmbean}. * - * maxValueObject + * maxValueObject * MBeanAttributeInfo
MBeanParameterInfo * * Maximum legal value for an attribute or parameter. See * {@link javax.management.openmbean}. * - * metricTypeString + * metricTypeString * MBeanAttributeInfo
MBeanOperationInfo * * The type of a metric, one of the strings "counter" or "gauge". @@ -200,13 +204,13 @@ import javax.management.openmbean.OpenType; * that can increase or decrease. Examples might be the number of * open connections or a cache hit rate or a temperature reading. * - * minValueObject + * minValueObject * MBeanAttributeInfo
MBeanParameterInfo * * Minimum legal value for an attribute or parameter. See * {@link javax.management.openmbean}. * - * mxbeanString + * mxbeanString * MBeanInfo * * The string {@code "true"} or {@code "false"} according as this @@ -223,7 +227,7 @@ import javax.management.openmbean.OpenType; * MXBean, if it was not the {@linkplain MXBeanMappingFactory#DEFAULT default} * one. * - * openType{@link OpenType} + * openType{@link OpenType} * MBeanAttributeInfo
MBeanOperationInfo
MBeanParameterInfo * *

The Open Type of this element. In the case of {@code @@ -240,7 +244,7 @@ import javax.management.openmbean.OpenType; * which case it indicates the Open Type that the {@link * Notification#getUserData() user data} will have. * - * originalTypeString + * originalTypeString * MBeanAttributeInfo
MBeanOperationInfo
MBeanParameterInfo * *

The original Java type of this element as it appeared in the @@ -282,11 +286,132 @@ import javax.management.openmbean.OpenType; * * * - *

Some additional fields are defined by Model MBeans. See - * {@link javax.management.modelmbean.ModelMBeanInfo ModelMBeanInfo} - * and related classes and the chapter "Model MBeans" of the - * - * JMX Specification.

+ *

Some additional fields are defined by Model MBeans. See the + * information for {@code ModelMBeanInfo}, + * {@code ModelMBeanAttributeInfo}, + * {@code ModelMBeanConstructorInfo}, + * {@code ModelMBeanNotificationInfo}, and + * {@code ModelMBeanOperationInfo}, as + * well as the chapter "Model MBeans" of the JMX + * Specification. The following table summarizes these fields. Note + * that when the Type in this table is Number, a String that is the decimal + * representation of a Long can also be used.

+ * + *

Nothing prevents the use of these fields in MBeans that are not Model + * MBeans. The displayName, severity, and visibility fields are of + * interest outside Model MBeans, for example. But only Model MBeans have + * a predefined behavior for these fields.

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
NameTypeUsed inMeaning
classStringModelMBeanOperationInfoClass where method is defined (fully qualified).
currencyTimeLimitNumberModelMBeanInfo
ModelMBeanAttributeInfo
ModelMBeanOperationInfo
How long cached value is valid: <0 never, =0 always, + * >0 seconds.
defaultObjectModelMBeanAttributeInfoDefault value for attribute.
descriptorTypeStringAnyType of descriptor, "mbean", "attribute", "constructor", "operation", + * or "notification".
displayNameStringAnyHuman readable name of this item.
exportStringModelMBeanInfoName to be used to export/expose this MBean so that it is + * findable by other JMX Agents.
getMethodStringModelMBeanAttributeInfoName of operation descriptor for get method.
lastUpdatedTimeStampNumberModelMBeanAttributeInfo
ModelMBeanOperationInfo
When value was set.
logStringModelMBeanInfo
ModelMBeanNotificationInfo
t or T: log all notifications, f or F: log no notifications.
logFileStringModelMBeanInfo
ModelMBeanNotificationInfo
Fully qualified filename to log events to.
messageIDStringModelMBeanNotificationInfoUnique key for message text (to allow translation, analysis).
messageTextStringModelMBeanNotificationInfoText of notification.
nameStringAnyName of this item.
persistFileStringModelMBeanInfoFile name into which the MBean should be persisted.
persistLocationStringModelMBeanInfoThe fully qualified directory name where the MBean should be + * persisted (if appropriate).
persistPeriodNumberModelMBeanInfo
ModelMBeanAttributeInfo
Frequency of persist cycle in seconds. Used when persistPolicy is + * "OnTimer" or "NoMoreOftenThan".
persistPolicyStringModelMBeanInfo
ModelMBeanAttributeInfo
One of: OnUpdate|OnTimer|NoMoreOftenThan|OnUnregister|Always|Never. + * See the section "MBean Descriptor Fields" in the JMX specification + * document.
presentationStringStringAnyXML formatted string to allow presentation of data.
protocolMapDescriptorModelMBeanAttributeInfoSee the section "Protocol Map Support" in the JMX specification + * document. Mappings must be appropriate for the attribute and entries + * can be updated or augmented at runtime.
roleStringModelMBeanConstructorInfo
ModelMBeanOperationInfo
One of "constructor", "operation", "getter", or "setter".
setMethodStringModelMBeanAttributeInfoName of operation descriptor for set method.
severityNumberModelMBeanNotificationInfo0-6 where 0: unknown; 1: non-recoverable; + * 2: critical, failure; 3: major, severe; + * 4: minor, marginal, error; 5: warning; + * 6: normal, cleared, informative
targetObjectObjectModelMBeanOperationInfoObject on which to execute this method.
targetTypeStringModelMBeanOperationInfotype of object reference for targetObject. Can be: + * ObjectReference | Handle | EJBHandle | IOR | RMIReference.
valueObjectModelMBeanAttributeInfo
ModelMBeanOperationInfo
Current (cached) value for attribute or operation.
visibilityNumberAny1-4 where 1: always visible, 4: rarely visible.
* * @since 1.5 */ @@ -439,7 +564,7 @@ public interface Descriptor extends Serializable, Cloneable public boolean isValid() throws RuntimeOperationsException; /** - * Compares this descriptor to the given object. The objects are equal if + *

Compares this descriptor to the given object. The objects are equal if * the given object is also a Descriptor, and if the two Descriptors have * the same field names (possibly differing in case) and the same * associated values. The respective values for a field in the two diff --git a/jdk/src/share/classes/javax/management/MBeanInfo.java b/jdk/src/share/classes/javax/management/MBeanInfo.java index 722e96fedd9..3561e3cfc13 100644 --- a/jdk/src/share/classes/javax/management/MBeanInfo.java +++ b/jdk/src/share/classes/javax/management/MBeanInfo.java @@ -45,6 +45,17 @@ import static javax.management.ImmutableDescriptor.nonNullDescriptor; * management operations. Instances of this class are immutable. * Subclasses may be mutable but this is not recommended.

* + *

Usually the {@code MBeanInfo} for any given MBean does + * not change over the lifetime of that MBean. Dynamic MBeans can change their + * {@code MBeanInfo} and in that case it is recommended that they emit a {@link + * Notification} with a {@linkplain Notification#getType() type} of {@code + * "jmx.mbean.info.changed"} and a {@linkplain Notification#getUserData() + * userData} that is the new {@code MBeanInfo}. This is not required, but + * provides a conventional way for clients of the MBean to discover the change. + * See also the immutableInfo and + * infoTimeout fields in the {@code + * MBeanInfo} {@link Descriptor}.

+ * *

The contents of the MBeanInfo for a Dynamic MBean * are determined by its {@link DynamicMBean#getMBeanInfo * getMBeanInfo()} method. This includes Open MBeans and Model @@ -62,27 +73,49 @@ import static javax.management.ImmutableDescriptor.nonNullDescriptor; * constructors in that object; * *

  • {@link #getAttributes()} returns the list of all attributes - * whose existence is deduced from the presence in the MBean interface - * of a getName, isName, or - * setName method that conforms to the conventions + * whose existence is deduced as follows: + *
      + *
    • if the Standard MBean is defined with an MBean interface, + * from getName, isName, or + * setName methods that conform to the conventions * for Standard MBeans; + *
    • if the Standard MBean is defined with the {@link MBean @MBean} or + * {@link MXBean @MXBean} annotation on a class, from methods with the + * {@link ManagedAttribute @ManagedAttribute} annotation; + *
    * - *
  • {@link #getOperations()} returns the list of all methods in + *
  • {@link #getOperations()} returns the list of all operations whose + * existence is deduced as follows: + *
      + *
    • if the Standard MBean is defined with an MBean interface, from methods in * the MBean interface that do not represent attributes; + *
    • if the Standard MBean is defined with the {@link MBean @MBean} or + * {@link MXBean @MXBean} annotation on a class, from methods with the + * {@link ManagedOperation @ManagedOperation} annotation; + *
    * - *
  • {@link #getNotifications()} returns an empty array if the MBean - * does not implement the {@link NotificationBroadcaster} interface, - * otherwise the result of calling {@link + *
  • {@link #getNotifications()} returns: + *
      + *
    • if the MBean implements the {@link NotificationBroadcaster} interface, + * the result of calling {@link * NotificationBroadcaster#getNotificationInfo()} on it; + *
    • otherwise, if there is a {@link NotificationInfo @NotificationInfo} + * or {@link NotificationInfos @NotificationInfos} annotation on the + * MBean interface or @MBean or @MXBean + * class, the array implied by those annotations; + *
    • otherwise an empty array; + *
    * *
  • {@link #getDescriptor()} returns a descriptor containing the contents - * of any descriptor annotations in the MBean interface. + * of any descriptor annotations in the MBean interface (see + * {@link DescriptorFields @DescriptorFields} and + * {@link DescriptorKey @DescriptorKey}). * * * *

    The description returned by {@link #getDescription()} and the * descriptions of the contained attributes and operations are determined - * by the corresponding Description annotations if any; + * by the corresponding {@link Description} annotations if any; * otherwise their contents are not specified.

    * *

    The remaining details of the MBeanInfo for a diff --git a/jdk/src/share/classes/javax/management/MBeanServer.java b/jdk/src/share/classes/javax/management/MBeanServer.java index 90d42d2df6c..e6d79e5bd94 100644 --- a/jdk/src/share/classes/javax/management/MBeanServer.java +++ b/jdk/src/share/classes/javax/management/MBeanServer.java @@ -377,19 +377,19 @@ public interface MBeanServer extends MBeanServerConnection { * MBean will not be registered. * @exception RuntimeMBeanException If the postRegister * (MBeanRegistration interface) method of the MBean throws a - * RuntimeException, the registerMBean method will + * RuntimeException, the registerMBean method will * throw a RuntimeMBeanException, although the MBean * registration succeeded. In such a case, the MBean will be actually - * registered even though the registerMBean method + * registered even though the registerMBean method * threw an exception. Note that RuntimeMBeanException can * also be thrown by preRegister, in which case the MBean * will not be registered. * @exception RuntimeErrorException If the postRegister * (MBeanRegistration interface) method of the MBean throws an - * Error, the registerMBean method will + * Error, the registerMBean method will * throw a RuntimeErrorException, although the MBean * registration succeeded. In such a case, the MBean will be actually - * registered even though the registerMBean method + * registered even though the registerMBean method * threw an exception. Note that RuntimeErrorException can * also be thrown by preRegister, in which case the MBean * will not be registered. @@ -411,6 +411,8 @@ public interface MBeanServer extends MBeanServerConnection { * is sent as described above.

    * * @throws RuntimeOperationsException {@inheritDoc} + * @throws RuntimeMBeanException {@inheritDoc} + * @throws RuntimeErrorException {@inheritDoc} */ public void unregisterMBean(ObjectName name) throws InstanceNotFoundException, MBeanRegistrationException; diff --git a/jdk/src/share/classes/javax/management/NotificationListener.java b/jdk/src/share/classes/javax/management/NotificationListener.java index eb29f8bd072..1e7b26c10d8 100644 --- a/jdk/src/share/classes/javax/management/NotificationListener.java +++ b/jdk/src/share/classes/javax/management/NotificationListener.java @@ -39,11 +39,10 @@ public interface NotificationListener extends java.util.EventListener { * blocking its notification broadcaster. * * @param notification The notification. - * @param handback An opaque object which helps the listener to associate information - * regarding the MBean emitter. This object is passed to the MBean during the - * addListener call and resent, without modification, to the listener. The MBean object - * should not use or modify the object. - * + * @param handback An opaque object which helps the listener to associate + * information regarding the MBean emitter. This object is passed to the + * addNotificationListener call and resent, without modification, to the + * listener. */ - public void handleNotification(Notification notification, Object handback) ; + public void handleNotification(Notification notification, Object handback); } diff --git a/jdk/src/share/classes/javax/management/event/EventClient.java b/jdk/src/share/classes/javax/management/event/EventClient.java index cfce77b0879..96c4017e450 100644 --- a/jdk/src/share/classes/javax/management/event/EventClient.java +++ b/jdk/src/share/classes/javax/management/event/EventClient.java @@ -117,12 +117,12 @@ public class EventClient implements EventConsumer, NotificationManager { public static final String NONFATAL = "jmx.event.service.nonfatal"; /** - *

    A notification string type used by an {@code EventClient} object to - * inform a listener added by {@code #addEventClientListener} that it - * has detected that notifications have been lost. The {@link - * Notification#getUserData() userData} of the notification is a Long which - * is an upper bound on the number of lost notifications that have just - * been detected.

    + *

    A notification string type used by an {@code EventClient} object + * to inform a listener added by {@link #addEventClientListener + * addEventClientListener} that it has detected that notifications have + * been lost. The {@link Notification#getUserData() userData} of the + * notification is a Long which is an upper bound on the number of lost + * notifications that have just been detected.

    * * @see #addEventClientListener */ @@ -577,8 +577,13 @@ public class EventClient implements EventConsumer, NotificationManager { } /** - * Returns the set of listeners that have been added through - * this {@code EventClient} and not subsequently removed. + *

    Returns the collection of listeners that have been added through + * this {@code EventClient} and not subsequently removed. The returned + * collection contains one entry for every listener added with + * {@link #addNotificationListener addNotificationListener} or + * {@link #subscribe subscribe} and not subsequently removed with + * {@link #removeNotificationListener removeNotificationListener} or + * {@link #unsubscribe unsubscribe}, respectively.

    * * @return A collection of listener information. Empty if there are no * current listeners or if this {@code EventClient} has been {@linkplain @@ -927,8 +932,10 @@ public class EventClient implements EventConsumer, NotificationManager { private final static MBeanNotificationInfo[] myInfo = new MBeanNotificationInfo[] { new MBeanNotificationInfo( - new String[] {FAILED, NOTIFS_LOST}, - Notification.class.getName(), "")}; + new String[] {FAILED, NONFATAL, NOTIFS_LOST}, + Notification.class.getName(), + "Notifications that can be sent to a listener added with " + + "EventClient.addEventClientListener")}; private final NotificationBroadcasterSupport broadcaster = new NotificationBroadcasterSupport(); diff --git a/jdk/src/share/classes/javax/management/modelmbean/DescriptorSupport.java b/jdk/src/share/classes/javax/management/modelmbean/DescriptorSupport.java index 4e9db9dcd54..ee8e3030e54 100644 --- a/jdk/src/share/classes/javax/management/modelmbean/DescriptorSupport.java +++ b/jdk/src/share/classes/javax/management/modelmbean/DescriptorSupport.java @@ -884,9 +884,9 @@ public class DescriptorSupport * not a String with value "t", "f", "true", "false". These String * values must not be case sensitive. *
  • visibility fieldName, if defined, is null, or not a - * Numeric String or a not Numeric Value >= 1 and <= 4 + * Numeric String or a not Numeric Value >= 1 and <= 4 *
  • severity fieldName, if defined, is null, or not a Numeric - * String or not a Numeric Value >= 0 and <= 6
    + * String or not a Numeric Value >= 0 and <= 6
    *
  • persistPolicy fieldName, if defined, is null, or not one of * the following strings:
    * "OnUpdate", "OnTimer", "NoMoreOftenThan", "OnUnregister", "Always", diff --git a/jdk/src/share/classes/javax/management/modelmbean/ModelMBeanAttributeInfo.java b/jdk/src/share/classes/javax/management/modelmbean/ModelMBeanAttributeInfo.java index cc2ec0b7a41..9ee9a6b4635 100644 --- a/jdk/src/share/classes/javax/management/modelmbean/ModelMBeanAttributeInfo.java +++ b/jdk/src/share/classes/javax/management/modelmbean/ModelMBeanAttributeInfo.java @@ -39,7 +39,6 @@ import java.io.ObjectOutputStream; import java.io.ObjectStreamField; import java.lang.reflect.Method; import java.security.AccessController; -import java.security.PrivilegedAction; import java.util.logging.Level; import javax.management.Descriptor; @@ -49,32 +48,56 @@ import javax.management.MBeanAttributeInfo; import javax.management.RuntimeOperationsException; /** - * The ModelMBeanAttributeInfo object describes an attribute of the ModelMBean. + *

    The ModelMBeanAttributeInfo object describes an attribute of the ModelMBean. * It is a subclass of MBeanAttributeInfo with the addition of an associated Descriptor - * and an implementation of the DescriptorAccess interface. - *

    - * The fields in the descriptor are defined, but not limited to, the following:

    - *

    - * name           : attribute name
    - * descriptorType : must be "attribute"
    - * value          : current value for attribute
    - * default        : default value for attribute
    - * displayName    : name of attribute to be used in displays
    - * getMethod      : name of operation descriptor for get method
    - * setMethod      : name of operation descriptor for set method
    - * protocolMap    : object which implements the Descriptor interface: mappings
    - *                  must be appropriate for the attribute
    - *                  and entries can be updated or augmented at runtime.
    - * persistPolicy  : OnUpdate|OnTimer|NoMoreOftenThan|OnUnregister|Always|Never
    - * persistPeriod  : seconds - frequency of persist cycle. Used when persistPolicy
    - *                  is "OnTimer" or "NoMoreOftenThan".
    - * currencyTimeLimit : how long value is valid, <0 never, =0 always, >0 seconds
    - * lastUpdatedTimeStamp : when value was set
    - * visibility     : 1-4 where 1: always visible, 4: rarely visible
    - * presentationString : xml formatted string to allow presentation of data
    - * 
    - * The default descriptor contains the name, descriptorType and displayName fields. - * The default value of the name and displayName fields is the name of the attribute. + * and an implementation of the DescriptorAccess interface.

    + * + *

    + * The fields in the descriptor are defined, but not limited to, the following. + * Note that when the Type in this table is Number, a String that is the decimal + * representation of a Long can also be used.

    + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    NameTypeMeaning
    nameStringAttribute name.
    descriptorTypeStringMust be "attribute".
    valueObjectCurrent (cached) value for attribute.
    defaultObjectDefault value for attribute.
    displayNameStringName of attribute to be used in displays.
    getMethodStringName of operation descriptor for get method.
    setMethodStringName of operation descriptor for set method.
    protocolMapDescriptorSee the section "Protocol Map Support" in the JMX specification + * document. Mappings must be appropriate for the attribute and entries + * can be updated or augmented at runtime.
    persistPolicyStringOne of: OnUpdate|OnTimer|NoMoreOftenThan|OnUnregister|Always|Never. + * See the section "MBean Descriptor Fields" in the JMX specification + * document.
    persistPeriodNumberFrequency of persist cycle in seconds. Used when persistPolicy is + * "OnTimer" or "NoMoreOftenThan".
    currencyTimeLimitNumberHow long value is valid: <0 never, + * =0 always, >0 seconds.
    lastUpdatedTimeStampNumberWhen value was set.
    visibilityNumber1-4 where 1: always visible, 4: rarely visible.
    presentationStringStringXML formatted string to allow presentation of data.
    + * + *

    The default descriptor contains the name, descriptorType and displayName + * fields. The default value of the name and displayName fields is the name of + * the attribute.

    * *

    Note: because of inconsistencies in previous versions of * this specification, it is recommended not to use negative or zero diff --git a/jdk/src/share/classes/javax/management/modelmbean/ModelMBeanConstructorInfo.java b/jdk/src/share/classes/javax/management/modelmbean/ModelMBeanConstructorInfo.java index 89948d5c92c..ecf8ecf002b 100644 --- a/jdk/src/share/classes/javax/management/modelmbean/ModelMBeanConstructorInfo.java +++ b/jdk/src/share/classes/javax/management/modelmbean/ModelMBeanConstructorInfo.java @@ -49,22 +49,33 @@ import javax.management.MBeanParameterInfo; import javax.management.RuntimeOperationsException; /** - * The ModelMBeanConstructorInfo object describes a constructor of the ModelMBean. + *

    The ModelMBeanConstructorInfo object describes a constructor of the ModelMBean. * It is a subclass of MBeanConstructorInfo with the addition of an associated Descriptor - * and an implementation of the DescriptorAccess interface. - *

    - *

    - * The fields in the descriptor are defined, but not limited to, the following: 

    - * name : constructor name - * descriptorType : must be "operation" - * role : must be "constructor" - * displayName : human readable name of constructor - * visibility : 1-4 where 1: always visible 4: rarely visible - * presentationString : xml formatted string to describe how to present operation - *

    + * and an implementation of the DescriptorAccess interface.

    + * + *

    + * The fields in the descriptor are defined, but not limited to, the following. + * Note that when the Type in this table is Number, a String that is the decimal + * representation of a Long can also be used.

    + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    NameTypeMeaning
    nameStringConstructor name.
    descriptorTypeStringMust be "operation".
    roleStringMust be "constructor".
    displayNameStringHuman readable name of constructor.
    visibilityNumber1-4 where 1: always visible 4: rarely visible.
    presentationStringStringXML formatted string to describe how to present operation
    * *

    The {@code persistPolicy} and {@code currencyTimeLimit} fields - * are meaningless for constructors, but are not considered invalid. + * are meaningless for constructors, but are not considered invalid.

    * *

    The default descriptor will have the {@code name}, {@code * descriptorType}, {@code displayName} and {@code role} fields. The diff --git a/jdk/src/share/classes/javax/management/modelmbean/ModelMBeanInfo.java b/jdk/src/share/classes/javax/management/modelmbean/ModelMBeanInfo.java index 367e616eb09..70c0e74f9f2 100644 --- a/jdk/src/share/classes/javax/management/modelmbean/ModelMBeanInfo.java +++ b/jdk/src/share/classes/javax/management/modelmbean/ModelMBeanInfo.java @@ -156,29 +156,55 @@ public interface ModelMBeanInfo /** - * Returns the ModelMBean's descriptor which contains MBean wide policies. This descriptor contains - * metadata about the MBean and default policies for persistence and caching. - *

    - * The fields in the descriptor are defined, but not limited to, the following: - *

    -     * name           : MBean name
    -     * descriptorType : must be "mbean"
    -     * displayName    : name of attribute to be used in displays
    -     * persistPolicy  : OnUpdate|OnTimer|NoMoreOftenThan|OnUnregister|Always|Never
    -     * persistLocation : The fully qualified directory name where the MBean should be persisted (if appropriate)
    -     * persistFile    : File name into which the MBean should be persisted
    -     * persistPeriod  : seconds - frequency of persist cycle for OnTime and NoMoreOftenThan PersistPolicy
    -     * currencyTimeLimit : how long value is valid, <0 never, =0 always, >0 seconds
    -     * log            : where t: log all notifications f: log no notifications
    -     * logfile        : fully qualified filename to log events to
    -     * visibility     : 1-4 where 1: always visible 4: rarely visible
    -     * export         : name to be used to export/expose this MBean so that it is findable by
    -     *                  other JMX Agents.
    -     * presentationString : xml formatted string to allow presentation of data to be associated with the MBean.
    -     * 
    + *

    Returns the ModelMBean's descriptor which contains MBean wide + * policies. This descriptor contains metadata about the MBean and default + * policies for persistence and caching.

    + * + *

    + * The fields in the descriptor are defined, but not limited to, the + * following. Note that when the Type in this table is Number, a String + * that is the decimal representation of a Long can also be used.

    + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    NameTypeMeaning
    nameStringMBean name.
    descriptorTypeStringMust be "mbean".
    displayNameStringName of MBean to be used in displays.
    persistPolicyStringOne of: OnUpdate|OnTimer|NoMoreOftenThan|OnUnregister|Always|Never. + * See the section "MBean Descriptor Fields" in the JMX specification + * document.
    persistLocationStringThe fully qualified directory name where the MBean should be + * persisted (if appropriate).
    persistFileStringFile name into which the MBean should be persisted.
    persistPeriodNumberFrequency of persist cycle in seconds, for OnTime and + * NoMoreOftenThan PersistPolicy
    currencyTimeLimitNumberHow long cached value is valid: <0 never, =0 always, + * >0 seconds.
    logStringt: log all notifications, f: log no notifications.
    logfileStringFully qualified filename to log events to.
    visibilityNumber1-4 where 1: always visible 4: rarely visible.
    exportStringName to be used to export/expose this MBean so that it is + * findable by other JMX Agents.
    presentationStringStringXML formatted string to allow presentation of data to be + * associated with the MBean.
    + * *

    * The default descriptor is: name=className,descriptorType="mbean", displayName=className, - * persistPolicy="never",log="F",export="F",visibility="1" + * persistPolicy="never",log="F",visibility="1" * If the descriptor does not contain all these fields, they will be added with these default values. * *

    Note: because of inconsistencies in previous versions of @@ -207,7 +233,7 @@ public interface ModelMBeanInfo * does a complete replacement of the descriptor, no merging is done. If the descriptor to * set to is null then the default descriptor will be created. * The default descriptor is: name=className,descriptorType="mbean", displayName=className, - * persistPolicy="never",log="F",export="F",visibility="1" + * persistPolicy="never",log="F",visibility="1" * If the descriptor does not contain all these fields, they will be added with these default values. * * See {@link #getMBeanDescriptor getMBeanDescriptor} method javadoc for description of valid field names. diff --git a/jdk/src/share/classes/javax/management/modelmbean/ModelMBeanNotificationInfo.java b/jdk/src/share/classes/javax/management/modelmbean/ModelMBeanNotificationInfo.java index 52f1317db81..4b637ee08f8 100644 --- a/jdk/src/share/classes/javax/management/modelmbean/ModelMBeanNotificationInfo.java +++ b/jdk/src/share/classes/javax/management/modelmbean/ModelMBeanNotificationInfo.java @@ -46,34 +46,46 @@ import javax.management.MBeanNotificationInfo; import javax.management.RuntimeOperationsException; /** - * The ModelMBeanNotificationInfo object describes a notification emitted + *

    The ModelMBeanNotificationInfo object describes a notification emitted * by a ModelMBean. * It is a subclass of MBeanNotificationInfo with the addition of an - * associated Descriptor and an implementation of the Descriptor interface. - *

    - * The fields in the descriptor are defined, but not limited to, - * the following: - *

    - * name           : notification name
    - * descriptorType : must be "notification"
    - * severity       : 0-6 where 0: unknown; 1: non-recoverable;
    - *                  2: critical, failure; 3: major, severe;
    - *                  4: minor, marginal, error; 5: warning;
    - *                  6: normal, cleared, informative
    - * messageID      : unique key for message text (to allow translation,
    - *                  analysis)
    - * messageText    : text of notification
    - * log            : T - log message F - do not log message
    - * logfile        : string fully qualified file name appropriate for
    - *                  operating system
    - * visibility     : 1-4 where 1: always visible 4: rarely visible
    - * presentationString : xml formatted string to allow presentation of data
    - * 
    - * The default descriptor contains the name, descriptorType, + * associated Descriptor and an implementation of the Descriptor interface.

    + * + *

    + * The fields in the descriptor are defined, but not limited to, the following. + * Note that when the Type in this table is Number, a String that is the decimal + * representation of a Long can also be used.

    + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    NameTypeMeaning
    nameStringNotification name.
    descriptorTypeStringMust be "notification".
    severityNumber0-6 where 0: unknown; 1: non-recoverable; + * 2: critical, failure; 3: major, severe; + * 4: minor, marginal, error; 5: warning; + * 6: normal, cleared, informative
    messageIDStringUnique key for message text (to allow translation, analysis).
    messageTextStringText of notification.
    logStringT - log message, F - do not log message.
    logfileStringfully qualified file name appropriate for operating system.
    visibilityNumber1-4 where 1: always visible 4: rarely visible.
    presentationStringStringXML formatted string to allow presentation of data.
    + * + *

    The default descriptor contains the name, descriptorType, * displayName and severity(=6) fields. The default value of the name * and displayName fields is the name of the Notification class (as * specified by the name parameter of the - * ModelMBeanNotificationInfo constructor). + * ModelMBeanNotificationInfo constructor).

    * *

    The serialVersionUID of this class is -7445681389570207141L. * diff --git a/jdk/src/share/classes/javax/management/modelmbean/ModelMBeanOperationInfo.java b/jdk/src/share/classes/javax/management/modelmbean/ModelMBeanOperationInfo.java index 2ed99224067..6ebea49954d 100644 --- a/jdk/src/share/classes/javax/management/modelmbean/ModelMBeanOperationInfo.java +++ b/jdk/src/share/classes/javax/management/modelmbean/ModelMBeanOperationInfo.java @@ -49,27 +49,48 @@ import javax.management.MBeanParameterInfo; import javax.management.RuntimeOperationsException; /** - * The ModelMBeanOperationInfo object describes a management operation of the ModelMBean. - * It is a subclass of MBeanOperationInfo with the addition of an associated Descriptor - * and an implementation of the DescriptorAccess interface. - *

    - *

    - * The fields in the descriptor are defined, but not limited to, the following:
    - * name           : operation name
    - * descriptorType : must be "operation"
    - * class          : class where method is defined (fully qualified)
    - * role           : must be "operation", "getter", or "setter
    - * targetObject   : object on which to execute this method
    - * targetType     : type of object reference for targetObject. Can be:
    - *                  ObjectReference | Handle | EJBHandle | IOR | RMIReference.
    - * value          : cached value for operation
    - * currencyTimeLimit : how long cached value is valid
    - * lastUpdatedTimeStamp : when cached value was set
    - * visibility            : 1-4 where 1: always visible 4: rarely visible
    - * presentationString :  xml formatted string to describe how to present operation
    - * 
    - * The default descriptor will have name, descriptorType, displayName and role fields set. - * The default value of the name and displayName fields is the operation name. + *

    The ModelMBeanOperationInfo object describes a management operation of + * the ModelMBean. It is a subclass of MBeanOperationInfo with the addition + * of an associated Descriptor and an implementation of the DescriptorAccess + * interface.

    + * + *

    + * The fields in the descriptor are defined, but not limited to, the following. + * Note that when the Type in this table is Number, a String that is the decimal + * representation of a Long can also be used.

    + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    NameTypeMeaning
    nameStringOperation name.
    descriptorTypeStringMust be "operation".
    classStringClass where method is defined (fully qualified).
    roleStringMust be "operation", "getter", or "setter".
    targetObjectObjectObject on which to execute this method.
    targetTypeStringtype of object reference for targetObject. Can be: + * ObjectReference | Handle | EJBHandle | IOR | RMIReference.
    valueObjectCached value for operation.
    displayNameStringHuman readable display name of the operation.
    currencyTimeLimitNumberHow long cached value is valid.
    lastUpdatedTimeStampNumberWhen cached value was set.
    visibilityNumber1-4 where 1: always visible 4: rarely visible.
    presentationStringStringXML formatted string to describe how to present operation
    + * + *

    The default descriptor will have name, descriptorType, displayName and + * role fields set. The default value of the name and displayName fields is + * the operation name.

    * *

    Note: because of inconsistencies in previous versions of * this specification, it is recommended not to use negative or zero diff --git a/jdk/test/javax/management/eventService/CustomForwarderTest.java b/jdk/test/javax/management/eventService/CustomForwarderTest.java index 22238b37505..c9c866aaee0 100644 --- a/jdk/test/javax/management/eventService/CustomForwarderTest.java +++ b/jdk/test/javax/management/eventService/CustomForwarderTest.java @@ -23,7 +23,7 @@ /* * @test CustomForwarderTest - * @bug 5108776 + * @bug 5108776 6759619 * @summary Test that a custom EventForwarder can be added * @author Eamonn McManus */ @@ -45,6 +45,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; +import javax.management.MBeanNotificationInfo; import javax.management.MBeanServer; import javax.management.MBeanServerInvocationHandler; import javax.management.Notification; @@ -107,6 +108,14 @@ public class CustomForwarderTest { socket.close(); } + void simulateNonFatal() { + receiver.nonFatal(new Exception("NonFatal")); + } + + void simulateFailed() { + receiver.failed(new Error("Failed")); + } + private class Receiver implements Runnable { public void run() { byte[] buf = new byte[1024]; @@ -216,16 +225,26 @@ public class CustomForwarderTest { EventClientDelegateMBean.OBJECT_NAME, EventClientDelegateMBean.class, false); - EventRelay relay = new UdpEventRelay(delegate); + UdpEventRelay relay = new UdpEventRelay(delegate); EventClient client = new EventClient(delegate, relay, null, null, 0L); final Semaphore lostCountSema = new Semaphore(0); + final BlockingQueue nonFatalNotifs = + new ArrayBlockingQueue(1); + final BlockingQueue failedNotifs = + new ArrayBlockingQueue(1); NotificationListener lostListener = new NotificationListener() { public void handleNotification(Notification notification, Object handback) { if (notification.getType().equals(EventClient.NOTIFS_LOST)) { System.out.println("Got lost-notifs notif: count=" + notification.getUserData()); lostCountSema.release(((Long) notification.getUserData()).intValue()); + } else if (notification.getType().equals(EventClient.NONFATAL)) { + System.out.println("Got nonFatal notif"); + nonFatalNotifs.add(notification); + } else if (notification.getType().equals(EventClient.FAILED)) { + System.out.println("Got failed notif"); + failedNotifs.add(notification); } else System.out.println("Mysterious EventClient notif: " + notification); } @@ -300,6 +319,35 @@ public class CustomForwarderTest { Thread.sleep(10); assertEquals("Further lost-notifs", 0, lostCountSema.availablePermits()); + System.out.println("Testing error notifs"); + relay.simulateNonFatal(); + n = nonFatalNotifs.poll(10, TimeUnit.SECONDS); + assertEquals("Exception message for non-fatal exception", "NonFatal", + ((Throwable) n.getSource()).getMessage()); + relay.simulateFailed(); + n = failedNotifs.poll(10, TimeUnit.SECONDS); + assertEquals("Exception message for failed exception", "Failed", + ((Throwable) n.getSource()).getMessage()); + + // 6759619 + System.out.println("Test EventClient.getEventClientNotificationInfo"); + MBeanNotificationInfo[] mbnis = client.getEventClientNotificationInfo(); + final String[] expectedTypes = { + EventClient.NOTIFS_LOST, EventClient.NONFATAL, EventClient.FAILED + }; + check: + for (String type : expectedTypes) { + for (MBeanNotificationInfo mbni : mbnis) { + for (String t : mbni.getNotifTypes()) { + if (type.equals(t)) { + System.out.println("...found " + type); + continue check; + } + } + } + throw new Exception("TEST FAILED: Did not find notif type " + type); + } + client.close(); System.out.println("TEST PASSED"); diff --git a/jdk/test/javax/management/mxbean/TypeNameTest.java b/jdk/test/javax/management/mxbean/TypeNameTest.java index ede7fdc69bf..b8189691c0b 100644 --- a/jdk/test/javax/management/mxbean/TypeNameTest.java +++ b/jdk/test/javax/management/mxbean/TypeNameTest.java @@ -23,7 +23,7 @@ /* * @test - * @bug 6757225 + * @bug 6757225 6763051 * @summary Test that type names in MXBeans match their spec. * @author Eamonn McManus */ From 8f7e2b93577f7d4dc658297a42aa65bb7d36756b Mon Sep 17 00:00:00 2001 From: Eamonn McManus Date: Thu, 30 Oct 2008 18:19:48 +0100 Subject: [PATCH 095/267] 6450848: make it easier to get the ObjectName of a JMX Proxy Rework proxy javadoc to explain how to do this. Reviewed-by: sjiang --- .../share/classes/javax/management/JMX.java | 51 +++++++++++++++++-- 1 file changed, 47 insertions(+), 4 deletions(-) diff --git a/jdk/src/share/classes/javax/management/JMX.java b/jdk/src/share/classes/javax/management/JMX.java index 82704db0a47..ac7468d07dd 100644 --- a/jdk/src/share/classes/javax/management/JMX.java +++ b/jdk/src/share/classes/javax/management/JMX.java @@ -463,6 +463,12 @@ public class JMX { * likewise for the other methods of {@link * NotificationBroadcaster} and {@link NotificationEmitter}.

    * + *

    This method is equivalent to {@link + * #newMBeanProxy(MBeanServerConnection, ObjectName, Class, JMX.MBeanOptions) + * newMBeanProxy(connection, objectName, interfaceClass, opts)}, where + * {@code opts} is a {@link JMX.ProxyOptions} representing the + * {@code notificationEmitter} parameter.

    + * * @param connection the MBean server to forward to. * @param objectName the name of the MBean within * {@code connection} to forward to. @@ -555,10 +561,6 @@ public class JMX { * * * - *

    The object returned by this method is a - * {@link Proxy} whose {@code InvocationHandler} is an - * {@link MBeanServerInvocationHandler}.

    - * *

    This method is equivalent to {@link * #newMXBeanProxy(MBeanServerConnection, ObjectName, Class, * boolean) newMXBeanProxy(connection, objectName, interfaceClass, @@ -601,6 +603,17 @@ public class JMX { * likewise for the other methods of {@link * NotificationBroadcaster} and {@link NotificationEmitter}.

    * + *

    This method is equivalent to {@link + * #newMBeanProxy(MBeanServerConnection, ObjectName, Class, JMX.MBeanOptions) + * newMBeanProxy(connection, objectName, interfaceClass, opts)}, where + * {@code opts} is a {@link JMX.ProxyOptions} where the {@link + * JMX.ProxyOptions#getMXBeanMappingFactory() MXBeanMappingFactory} + * property is + * {@link MXBeanMappingFactory#forInterface(Class) + * MXBeanMappingFactory.forInterface(interfaceClass)} and the {@link + * JMX.ProxyOptions#isNotificationEmitter() notificationEmitter} property + * is equal to the {@code notificationEmitter} parameter.

    + * * @param connection the MBean server to forward to. * @param objectName the name of the MBean within * {@code connection} to forward to. @@ -655,6 +668,36 @@ public class JMX { * arbitrary Java types and Open Types.
  • * * + *

    The object returned by this method is a + * {@link Proxy} whose {@code InvocationHandler} is an + * {@link MBeanServerInvocationHandler}. This means that it is possible + * to retrieve the parameters that were used to produce the proxy. If the + * proxy was produced as follows...

    + * + *
    +     * FooMBean proxy =
    +     *     JMX.newMBeanProxy(connection, objectName, FooMBean.class, opts);
    +     * 
    + * + *

    ...then you can get the {@code MBeanServerInvocationHandler} like + * this...

    + * + *
    +     * MBeanServerInvocationHandler mbsih = (MBeanServerInvocationHandler)
    +     *     {@link Proxy#getInvocationHandler(Object)
    +     *            Proxy.getInvocationHandler}(proxy);
    +     * 
    + * + *

    ...and you can retrieve {@code connection}, {@code + * objectName}, and {@code opts} using the {@link + * MBeanServerInvocationHandler#getMBeanServerConnection() + * getMBeanServerConnection()}, {@link + * MBeanServerInvocationHandler#getObjectName() getObjectName()}, and + * {@link MBeanServerInvocationHandler#getMBeanOptions() getMBeanOptions()} + * methods on {@code mbsih}. You can retrieve {@code FooMBean.class} + * using {@code proxy.getClass().}{@link + * Class#getInterfaces() getInterfaces()}.

    + * * @param connection the MBean server to forward to. * @param objectName the name of the MBean within * {@code connection} to forward to. From 7de6d649be5c65b9d3b594f5d4cffa45e1dde5ee Mon Sep 17 00:00:00 2001 From: Keith McGuigan Date: Thu, 30 Oct 2008 15:48:59 -0400 Subject: [PATCH 096/267] 6756528: Bytecodes::special_length_at reads past end of code buffer Add end-of-buffer indicator for paths used by the verifier Reviewed-by: acorn, coleenp --- .../share/vm/interpreter/bytecodeStream.cpp | 13 ++++++++---- .../src/share/vm/interpreter/bytecodes.cpp | 20 +++++++++++++++---- .../src/share/vm/interpreter/bytecodes.hpp | 6 ++++-- 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/hotspot/src/share/vm/interpreter/bytecodeStream.cpp b/hotspot/src/share/vm/interpreter/bytecodeStream.cpp index 9152907e199..bb051e53049 100644 --- a/hotspot/src/share/vm/interpreter/bytecodeStream.cpp +++ b/hotspot/src/share/vm/interpreter/bytecodeStream.cpp @@ -28,8 +28,9 @@ Bytecodes::Code RawBytecodeStream::raw_next_special(Bytecodes::Code code) { assert(!is_last_bytecode(), "should have been checked"); // set next bytecode position - address bcp = RawBytecodeStream::bcp(); - int l = Bytecodes::raw_special_length_at(bcp); + address bcp = RawBytecodeStream::bcp(); + address end = method()->code_base() + end_bci(); + int l = Bytecodes::raw_special_length_at(bcp, end); if (l <= 0 || (_bci + l) > _end_bci) { code = Bytecodes::_illegal; } else { @@ -39,8 +40,12 @@ Bytecodes::Code RawBytecodeStream::raw_next_special(Bytecodes::Code code) { _is_wide = false; // check for special (uncommon) cases if (code == Bytecodes::_wide) { - code = (Bytecodes::Code)bcp[1]; - _is_wide = true; + if (bcp + 1 >= end) { + code = Bytecodes::_illegal; + } else { + code = (Bytecodes::Code)bcp[1]; + _is_wide = true; + } } } _code = code; diff --git a/hotspot/src/share/vm/interpreter/bytecodes.cpp b/hotspot/src/share/vm/interpreter/bytecodes.cpp index 1060a0797a7..396c87f958b 100644 --- a/hotspot/src/share/vm/interpreter/bytecodes.cpp +++ b/hotspot/src/share/vm/interpreter/bytecodes.cpp @@ -54,13 +54,19 @@ Bytecodes::Code Bytecodes::non_breakpoint_code_at(address bcp, methodOop method) return method->orig_bytecode_at(method->bci_from(bcp)); } -int Bytecodes::special_length_at(address bcp) { +int Bytecodes::special_length_at(address bcp, address end) { Code code = code_at(bcp); switch (code) { case _wide: + if (end != NULL && bcp + 1 >= end) { + return -1; // don't read past end of code buffer + } return wide_length_for(cast(*(bcp + 1))); case _tableswitch: { address aligned_bcp = (address)round_to((intptr_t)bcp + 1, jintSize); + if (end != NULL && aligned_bcp + 3*jintSize >= end) { + return -1; // don't read past end of code buffer + } jlong lo = (jint)Bytes::get_Java_u4(aligned_bcp + 1*jintSize); jlong hi = (jint)Bytes::get_Java_u4(aligned_bcp + 2*jintSize); jlong len = (aligned_bcp - bcp) + (3 + hi - lo + 1)*jintSize; @@ -73,6 +79,9 @@ int Bytecodes::special_length_at(address bcp) { case _fast_binaryswitch: // fall through case _fast_linearswitch: { address aligned_bcp = (address)round_to((intptr_t)bcp + 1, jintSize); + if (end != NULL && aligned_bcp + 2*jintSize >= end) { + return -1; // don't read past end of code buffer + } jlong npairs = (jint)Bytes::get_Java_u4(aligned_bcp + jintSize); jlong len = (aligned_bcp - bcp) + (2 + 2*npairs)*jintSize; // only return len if it can be represented as a positive int; @@ -90,14 +99,17 @@ int Bytecodes::special_length_at(address bcp) { // verifier when reading in bytecode to verify. Other mechanisms that // run at runtime (such as generateOopMaps) need to iterate over the code // and don't expect to see breakpoints: they want to see the instruction -// which was replaces so that they can get the correct length and find +// which was replaced so that they can get the correct length and find // the next bytecode. -int Bytecodes::raw_special_length_at(address bcp) { +// +// 'end' indicates the end of the code buffer, which we should not try to read +// past. +int Bytecodes::raw_special_length_at(address bcp, address end) { Code code = code_or_bp_at(bcp); if (code == _breakpoint) { return 1; } else { - return special_length_at(bcp); + return special_length_at(bcp, end); } } diff --git a/hotspot/src/share/vm/interpreter/bytecodes.hpp b/hotspot/src/share/vm/interpreter/bytecodes.hpp index 16ddc863bd6..f9201d953f5 100644 --- a/hotspot/src/share/vm/interpreter/bytecodes.hpp +++ b/hotspot/src/share/vm/interpreter/bytecodes.hpp @@ -340,8 +340,10 @@ class Bytecodes: AllStatic { const char* wf = wide_format(code); return (wf == NULL) ? 0 : (int)strlen(wf); } - static int special_length_at(address bcp); - static int raw_special_length_at(address bcp); + // if 'end' is provided, it indicates the end of the code buffer which + // should not be read past when parsing. + static int special_length_at(address bcp, address end = NULL); + static int raw_special_length_at(address bcp, address end = NULL); static int length_at (address bcp) { int l = length_for(code_at(bcp)); return l > 0 ? l : special_length_at(bcp); } static int java_length_at (address bcp) { int l = length_for(java_code_at(bcp)); return l > 0 ? l : special_length_at(bcp); } static bool is_java_code (Code code) { return 0 <= code && code < number_of_java_codes; } From 38f19ad4b77b0ef6c373696693e7c926973ea1ce Mon Sep 17 00:00:00 2001 From: Sean Mullan Date: Thu, 30 Oct 2008 17:24:08 -0400 Subject: [PATCH 097/267] 6764553: com.sun.org.apache.xml.internal.security.utils.IdResolver is not thread safe Reviewed-by: valeriep --- .../xml/internal/security/utils/IdResolver.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/IdResolver.java b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/IdResolver.java index d7565157e49..da5c4960973 100644 --- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/IdResolver.java +++ b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/IdResolver.java @@ -70,10 +70,13 @@ public class IdResolver { */ public static void registerElementById(Element element, String idValue) { Document doc = element.getOwnerDocument(); - WeakHashMap elementMap = (WeakHashMap) docMap.get(doc); - if(elementMap == null) { - elementMap = new WeakHashMap(); - docMap.put(doc, elementMap); + WeakHashMap elementMap; + synchronized (docMap) { + elementMap = (WeakHashMap) docMap.get(doc); + if (elementMap == null) { + elementMap = new WeakHashMap(); + docMap.put(doc, elementMap); + } } elementMap.put(idValue, new WeakReference(element)); } @@ -153,7 +156,10 @@ public class IdResolver { private static Element getElementByIdType(Document doc, String id) { if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE, "getElementByIdType() Search for ID " + id); - WeakHashMap elementMap = (WeakHashMap) docMap.get(doc); + WeakHashMap elementMap; + synchronized (docMap) { + elementMap = (WeakHashMap) docMap.get(doc); + } if (elementMap != null) { WeakReference weakReference = (WeakReference) elementMap.get(id); if (weakReference != null) { From 7bcfb5965da003ab2b1fb13e8b60c546e7ad0dd9 Mon Sep 17 00:00:00 2001 From: Tom Rodriguez Date: Thu, 30 Oct 2008 17:08:48 -0700 Subject: [PATCH 098/267] 6764622: IdealGraphVisualizer fixes Reviewed-by: rasbold, jrose --- .../bytecodes/BytecodeViewTopComponent.java | 7 +- .../igv/controlflow/ControlFlowScene.java | 7 +- .../controlflow/ControlFlowTopComponent.java | 7 +- .../hotspot/igv/coordinator/FolderNode.java | 18 +- .../sun/hotspot/igv/data/GraphDocument.java | 2 +- .../src/com/sun/hotspot/igv/data/Group.java | 2 +- .../com/sun/hotspot/igv/data/InputGraph.java | 27 ++- .../com/sun/hotspot/igv/data/InputMethod.java | 2 +- .../com/sun/hotspot/igv/data/InputNode.java | 2 +- .../com/sun/hotspot/igv/data/Properties.java | 156 ++++++++++++------ .../com/sun/hotspot/igv/data/Property.java | 26 +-- .../igv/data/serialization/Parser.java | 39 +++-- .../igv/data/serialization/Printer.java | 2 +- .../igv/data/serialization/XMLParser.java | 8 +- .../igv/data/serialization/XMLWriter.java | 8 +- .../hotspot/igv/difference/Difference.java | 27 +-- .../IdealGraphVisualizer/Filter/manifest.mf | 12 +- .../sun/hotspot/igv/filter/CustomFilter.java | 3 +- .../sun/hotspot/igv/filter/SplitFilter.java | 4 +- .../com/sun/hotspot/igv/graph/Diagram.java | 4 +- .../src/com/sun/hotspot/igv/graph/Figure.java | 2 +- .../hotspot/igv/hierarchicallayout/Graph.java | 10 +- .../HierarchicalClusterLayoutManager.java | 26 +-- .../sun/hotspot/igv/layout/LayoutGraph.java | 14 +- .../share/tools/IdealGraphVisualizer/README | 19 +-- .../sun/hotspot/igv/util/PropertiesSheet.java | 6 +- .../hotspot/igv/util/RangeSliderModel.java | 8 +- .../sun/hotspot/igv/view/DiagramScene.java | 18 +- .../hotspot/igv/view/DiagramViewModel.java | 39 ++++- .../com/sun/hotspot/igv/view/FindPanel.java | 2 +- .../nbproject/platform.properties | 12 +- .../nbproject/project.properties | 5 +- hotspot/src/share/vm/adlc/output_h.cpp | 2 +- hotspot/src/share/vm/opto/compile.cpp | 2 +- hotspot/src/share/vm/opto/type.cpp | 2 +- hotspot/src/share/vm/runtime/frame.cpp | 8 +- 36 files changed, 331 insertions(+), 207 deletions(-) diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewTopComponent.java b/hotspot/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewTopComponent.java index 6fbbe90e912..d5b2a2ecdc0 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewTopComponent.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Bytecodes/src/com/sun/hotspot/igv/bytecodes/BytecodeViewTopComponent.java @@ -28,6 +28,7 @@ import com.sun.hotspot.igv.data.InputGraph; import com.sun.hotspot.igv.data.services.InputGraphProvider; import java.awt.BorderLayout; import java.io.Serializable; +import javax.swing.SwingUtilities; import org.openide.ErrorManager; import org.openide.explorer.ExplorerManager; import org.openide.explorer.ExplorerUtils; @@ -151,14 +152,18 @@ final class BytecodeViewTopComponent extends TopComponent implements ExplorerMan } public void resultChanged(LookupEvent lookupEvent) { - InputGraphProvider p = Lookup.getDefault().lookup(InputGraphProvider.class); + final InputGraphProvider p = Lookup.getDefault().lookup(InputGraphProvider.class); if (p != null) { + SwingUtilities.invokeLater(new Runnable() { + public void run() { InputGraph graph = p.getGraph(); if (graph != null) { Group g = graph.getGroup(); rootNode.update(graph, g.getMethod()); } } + }); + } } final static class ResolvableHelper implements Serializable { diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowScene.java b/hotspot/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowScene.java index 8b794b11aa5..e497b349f6c 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowScene.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowScene.java @@ -33,7 +33,7 @@ import java.awt.Point; import java.awt.Rectangle; import java.util.ArrayList; import java.util.HashSet; -import java.util.Hashtable; +import java.util.HashMap; import java.util.Set; import javax.swing.BorderFactory; import org.netbeans.api.visual.action.ActionFactory; @@ -44,7 +44,6 @@ import org.netbeans.api.visual.action.SelectProvider; import org.netbeans.api.visual.action.WidgetAction; import org.netbeans.api.visual.anchor.AnchorFactory; import org.netbeans.api.visual.anchor.AnchorShape; -import com.sun.hotspot.igv.controlflow.HierarchicalGraphLayout; import org.netbeans.api.visual.layout.LayoutFactory; import org.netbeans.api.visual.router.RouterFactory; import org.netbeans.api.visual.widget.LayerWidget; @@ -61,8 +60,8 @@ import org.openide.util.Lookup; */ public class ControlFlowScene extends GraphScene implements SelectProvider, MoveProvider, RectangularSelectDecorator, RectangularSelectProvider { - private Set selection; - private Hashtable blockMap; + private HashSet selection; + private HashMap blockMap; private InputGraph oldGraph; private LayerWidget edgeLayer; private LayerWidget mainLayer; diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowTopComponent.java b/hotspot/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowTopComponent.java index 968cdd531b7..8cb6405f669 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowTopComponent.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/ControlFlow/src/com/sun/hotspot/igv/controlflow/ControlFlowTopComponent.java @@ -28,6 +28,7 @@ import com.sun.hotspot.igv.data.services.InputGraphProvider; import java.awt.BorderLayout; import java.io.Serializable; import javax.swing.JScrollPane; +import javax.swing.SwingUtilities; import org.openide.ErrorManager; import org.openide.util.Lookup; import org.openide.util.LookupEvent; @@ -143,13 +144,17 @@ final class ControlFlowTopComponent extends TopComponent implements LookupListen public void resultChanged(LookupEvent lookupEvent) { - InputGraphProvider p = Lookup.getDefault().lookup(InputGraphProvider.class); + final InputGraphProvider p = Lookup.getDefault().lookup(InputGraphProvider.class); if (p != null) { + SwingUtilities.invokeLater(new Runnable() { + public void run() { InputGraph g = p.getGraph(); if (g != null) { scene.setGraph(g); } } + }); + } } @Override diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/FolderNode.java b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/FolderNode.java index b5398edaeea..2805d749df8 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/FolderNode.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/FolderNode.java @@ -24,6 +24,7 @@ package com.sun.hotspot.igv.coordinator; import com.sun.hotspot.igv.coordinator.actions.RemoveCookie; +import com.sun.hotspot.igv.data.ChangedListener; import com.sun.hotspot.igv.data.Group; import com.sun.hotspot.igv.data.services.GroupOrganizer; import com.sun.hotspot.igv.data.InputGraph; @@ -50,17 +51,24 @@ public class FolderNode extends AbstractNode { private List subFolders; private FolderChildren children; - private static class FolderChildren extends Children.Keys { + private static class FolderChildren extends Children.Keys implements ChangedListener { private FolderNode parent; + private List registeredGroups; public void setParent(FolderNode parent) { this.parent = parent; + this.registeredGroups = new ArrayList(); } @Override protected Node[] createNodes(Object arg0) { + for(Group g : registeredGroups) { + g.getChangedEvent().removeListener(this); + } + registeredGroups.clear(); + Pair> p = (Pair>) arg0; if (p.getLeft().length() == 0) { @@ -69,6 +77,8 @@ public class FolderNode extends AbstractNode { for (InputGraph graph : g.getGraphs()) { curNodes.add(new GraphNode(graph)); } + g.getChangedEvent().addListener(this); + registeredGroups.add(g); } Node[] result = new Node[curNodes.size()]; @@ -85,7 +95,13 @@ public class FolderNode extends AbstractNode { @Override public void addNotify() { this.setKeys(parent.structure); + } + public void changed(Group source) { + List>> newStructure = new ArrayList>>(); + for(Pair> p : parent.structure) { + refreshKey(p); + } } } diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/GraphDocument.java b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/GraphDocument.java index 27d09c38f71..53f90f24255 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/GraphDocument.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/GraphDocument.java @@ -31,7 +31,7 @@ import java.util.List; * * @author Thomas Wuerthinger */ -public class GraphDocument extends Properties.Object implements ChangedEventProvider { +public class GraphDocument extends Properties.Entity implements ChangedEventProvider { private List groups; private ChangedEvent changedEvent; diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Group.java b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Group.java index 8f0aa15e992..a54cd19bc0b 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Group.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Group.java @@ -37,7 +37,7 @@ import java.util.Set; * * @author Thomas Wuerthinger */ -public class Group extends Properties.Object implements ChangedEventProvider { +public class Group extends Properties.Entity implements ChangedEventProvider { private List graphs; private transient ChangedEvent changedEvent; diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputGraph.java b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputGraph.java index b929fd627c6..9e18344234e 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputGraph.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputGraph.java @@ -23,26 +23,25 @@ */ package com.sun.hotspot.igv.data; -import com.sun.hotspot.igv.data.Properties; +import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashSet; -import java.util.Hashtable; +import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.Set; /** * * @author Thomas Wuerthinger */ -public class InputGraph extends Properties.Object { +public class InputGraph extends Properties.Entity { - private Map nodes; - private Set edges; + private HashMap nodes; + private ArrayList edges; private Group parent; - private Map blocks; - private Map nodeToBlock; + private HashMap blocks; + private HashMap nodeToBlock; private boolean isDifferenceGraph; public InputGraph(Group parent) { @@ -61,10 +60,10 @@ public class InputGraph extends Properties.Object { public InputGraph(Group parent, InputGraph last, String name) { this.parent = parent; setName(name); - nodes = new Hashtable(); - edges = new HashSet(); - blocks = new Hashtable(); - nodeToBlock = new Hashtable(); + nodes = new HashMap(); + edges = new ArrayList(); + blocks = new HashMap(); + nodeToBlock = new HashMap(); if (last != null) { for (InputNode n : last.getNodes()) { @@ -182,8 +181,8 @@ public class InputGraph extends Properties.Object { return nodes.remove(index); } - public Set getEdges() { - return Collections.unmodifiableSet(edges); + public Collection getEdges() { + return Collections.unmodifiableList(edges); } public void removeEdge(InputEdge c) { diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputMethod.java b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputMethod.java index eac6b1a0308..586efdc975c 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputMethod.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputMethod.java @@ -32,7 +32,7 @@ import java.util.List; * * @author Thomas Wuerthinger */ -public class InputMethod extends Properties.Object { +public class InputMethod extends Properties.Entity { private String name; private int bci; diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputNode.java b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputNode.java index ad15d141ac9..27dd3a52abb 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputNode.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/InputNode.java @@ -27,7 +27,7 @@ package com.sun.hotspot.igv.data; * * @author Thomas Wuerthinger */ -public class InputNode extends Properties.Object { +public class InputNode extends Properties.Entity { private int id; diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Properties.java b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Properties.java index 07a29962f9f..75c62611d4b 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Properties.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Properties.java @@ -26,24 +26,22 @@ package com.sun.hotspot.igv.data; import java.io.Serializable; import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; +import java.util.Iterator; import java.util.List; -import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; + /** * * @author Thomas Wuerthinger */ -public class Properties implements Serializable { +public class Properties implements Serializable, Iterable { public static final long serialVersionUID = 1L; - private Map map; + private String[] map = new String[4]; public Properties() { - map = new HashMap(5); } @Override @@ -54,10 +52,7 @@ public class Properties implements Serializable { Properties p = (Properties) o; - if (getProperties().size() != p.getProperties().size()) { - return false; - } - for (Property prop : getProperties()) { + for (Property prop : this) { String value = p.get(prop.getName()); if (value == null || !value.equals(prop.getValue())) { return false; @@ -75,32 +70,33 @@ public class Properties implements Serializable { public Properties(String name, String value) { this(); - this.add(new Property(name, value)); + this.setProperty(name, value); } public Properties(String name, String value, String name1, String value1) { this(name, value); - this.add(new Property(name1, value1)); + this.setProperty(name1, value1); } public Properties(String name, String value, String name1, String value1, String name2, String value2) { this(name, value, name1, value1); - this.add(new Property(name2, value2)); + this.setProperty(name2, value2); } public Properties(Properties p) { - map = new HashMap(p.map); + map = new String[p.map.length]; + System.arraycopy(map, 0, p.map, 0, p.map.length); } - public static class Object implements Provider { + public static class Entity implements Provider { private Properties properties; - public Object() { + public Entity() { properties = new Properties(); } - public Object(Properties.Object object) { + public Entity(Properties.Entity object) { properties = new Properties(object.getProperties()); } @@ -109,6 +105,14 @@ public class Properties implements Serializable { } } + private String getProperty(String key) { + for (int i = 0; i < map.length; i += 2) + if (map[i] != null && map[i].equals(key)) { + return map[i + 1]; + } + return null; + } + public interface PropertyMatcher { String getName(); @@ -173,13 +177,15 @@ public class Properties implements Serializable { } public Property selectSingle(PropertyMatcher matcher) { - - Property p = this.map.get(matcher.getName()); - if (p == null) { - return null; + String value = null; + for (int i = 0; i < map.length; i += 2) { + if (map[i] != null && matcher.getName().equals(map[i])) { + value = map[i + 1]; + break; + } } - if (matcher.match(p.getValue())) { - return p; + if (value != null && matcher.match(value)) { + return new Property(matcher.getName(), value); } else { return null; } @@ -194,8 +200,11 @@ public class Properties implements Serializable { public String toString() { StringBuilder sb = new StringBuilder(); sb.append("["); - for (Property p : map.values()) { - sb.append(p.toString()); + for (int i = 0; i < map.length; i += 2) { + if (map[i + 1] != null) { + String p = map[i + 1]; + sb.append(map[i] + " = " + map[i + 1] + "; "); + } } return sb.append("]").toString(); } @@ -241,41 +250,51 @@ public class Properties implements Serializable { } public String get(String key) { - Property p = map.get(key); - if (p == null) { - return null; - } else { - return p.getValue(); - } - } - - public String getProperty(String string) { - return get(string); - } - - public Property setProperty(String name, String value) { - - if (value == null) { - // remove this property - return map.remove(name); - } else { - Property p = map.get(name); - if (p == null) { - p = new Property(name, value); - map.put(name, p); - } else { - p.setValue(value); + for (int i = 0; i < map.length; i += 2) { + if (map[i] != null && map[i].equals(key)) { + return map[i + 1]; } - return p; } + return null; } - public Collection getProperties() { - return Collections.unmodifiableCollection(map.values()); + public void setProperty(String name, String value) { + for (int i = 0; i < map.length; i += 2) { + if (map[i] != null && map[i].equals(name)) { + String p = map[i + 1]; + if (value == null) { + // remove this property + map[i] = null; + map[i + 1] = null; + } else { + map[i + 1] = value; + } + return; + } + } + if (value == null) { + return; + } + for (int i = 0; i < map.length; i += 2) { + if (map[i] == null) { + map[i] = name; + map[i + 1] = value; + return; + } + } + String[] newMap = new String[map.length + 4]; + System.arraycopy(map, 0, newMap, 0, map.length); + newMap[map.length] = name; + newMap[map.length + 1] = value; + map = newMap; + } + + public Iterator getProperties() { + return iterator(); } public void add(Properties properties) { - for (Property p : properties.getProperties()) { + for (Property p : properties) { add(p); } } @@ -283,6 +302,35 @@ public class Properties implements Serializable { public void add(Property property) { assert property.getName() != null; assert property.getValue() != null; - map.put(property.getName(), property); + setProperty(property.getName(), property.getValue()); + } + class PropertiesIterator implements Iterator, Iterable { + public Iterator iterator() { + return this; + } + + int index; + + public boolean hasNext() { + while (index < map.length && map[index + 1] == null) + index += 2; + return index < map.length; + } + + public Property next() { + if (index < map.length) { + index += 2; + return new Property(map[index - 2], map[index - 1]); + } + return null; + } + + public void remove() { + throw new UnsupportedOperationException("Not supported yet."); + } + + } + public Iterator iterator() { + return new PropertiesIterator(); } } diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Property.java b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Property.java index 6694153d3b7..d18990805c2 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Property.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/Property.java @@ -32,18 +32,19 @@ import java.io.Serializable; public class Property implements Serializable { public static final long serialVersionUID = 1L; + private String name; private String value; - public Property() { + private Property() { this(null, null); } - public Property(Property p) { + private Property(Property p) { this(p.getName(), p.getValue()); } - public Property(String name) { + private Property(String name) { this(name, null); } @@ -60,16 +61,19 @@ public class Property implements Serializable { return value; } - public void setName(String s) { - this.name = s; - } - - public void setValue(String s) { - this.value = s; - } - @Override public String toString() { return name + " = " + value + "; "; } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Property)) return false; + Property p2 = (Property)o; + return name.equals(p2.name) && value.equals(p2.value); + } + @Override + public int hashCode() { + return name.hashCode() + value == null ? 0 : value.hashCode(); + } } diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/Parser.java b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/Parser.java index 410ee7c41a8..3d3c9e60892 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/Parser.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/Parser.java @@ -38,6 +38,7 @@ import com.sun.hotspot.igv.data.serialization.XMLParser.HandoverElementHandler; import com.sun.hotspot.igv.data.serialization.XMLParser.ParseMonitor; import com.sun.hotspot.igv.data.serialization.XMLParser.TopElementHandler; import java.io.IOException; +import java.util.HashMap; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; @@ -88,6 +89,18 @@ public class Parser { private TopElementHandler xmlDocument = new TopElementHandler(); private boolean difference; private GroupCallback groupCallback; + private HashMap idCache = new HashMap(); + private int maxId = 0; + + private int lookupID(String i) { + Integer id = idCache.get(i); + if (id == null) { + id = maxId++; + idCache.put(i, id); + } + return id.intValue(); + } + // private ElementHandler topHandler = new ElementHandler(TOP_ELEMENT) { @@ -187,13 +200,13 @@ public class Parser { previous = null; } InputGraph curGraph = new InputGraph(getParentObject(), previous, name); - getParentObject().addGraph(curGraph); this.graph = curGraph; return curGraph; } @Override protected void end(String text) throws SAXException { + getParentObject().addGraph(graph); graph.resolveBlockLinks(); } }; @@ -207,7 +220,7 @@ public class Parser { @Override protected InputBlock start() throws SAXException { InputGraph graph = getParentObject(); - String name = readRequiredAttribute(BLOCK_NAME_PROPERTY); + String name = readRequiredAttribute(BLOCK_NAME_PROPERTY).intern(); InputBlock b = new InputBlock(getParentObject(), name); graph.addBlock(b); return b; @@ -224,7 +237,7 @@ public class Parser { int id = 0; try { - id = Integer.parseInt(s); + id = lookupID(s); } catch (NumberFormatException e) { throw new SAXException(e); } @@ -252,7 +265,7 @@ public class Parser { String s = readRequiredAttribute(NODE_ID_PROPERTY); int id = 0; try { - id = Integer.parseInt(s); + id = lookupID(s); } catch (NumberFormatException e) { throw new SAXException(e); } @@ -269,7 +282,7 @@ public class Parser { String s = readRequiredAttribute(NODE_ID_PROPERTY); int id = 0; try { - id = Integer.parseInt(s); + id = lookupID(s); } catch (NumberFormatException e) { throw new SAXException(e); } @@ -280,7 +293,7 @@ public class Parser { private HandoverElementHandler edgesHandler = new HandoverElementHandler(EDGES_ELEMENT); // Local class for edge elements - private static class EdgeElementHandler extends ElementHandler { + private class EdgeElementHandler extends ElementHandler { public EdgeElementHandler(String name) { super(name); @@ -298,8 +311,8 @@ public class Parser { toIndex = Integer.parseInt(toIndexString); } - from = Integer.parseInt(readRequiredAttribute(FROM_PROPERTY)); - to = Integer.parseInt(readRequiredAttribute(TO_PROPERTY)); + from = lookupID(readRequiredAttribute(FROM_PROPERTY)); + to = lookupID(readRequiredAttribute(TO_PROPERTY)); } catch (NumberFormatException e) { throw new SAXException(e); } @@ -344,18 +357,16 @@ public class Parser { } }; // - private ElementHandler propertyHandler = new XMLParser.ElementHandler(PROPERTY_ELEMENT, true) { + private ElementHandler propertyHandler = new XMLParser.ElementHandler(PROPERTY_ELEMENT, true) { @Override - public Property start() throws SAXException { - String value = ""; - String name = readRequiredAttribute(PROPERTY_NAME_PROPERTY).intern(); - return getParentObject().getProperties().setProperty(name, value); + public String start() throws SAXException { + return readRequiredAttribute(PROPERTY_NAME_PROPERTY).intern(); } @Override public void end(String text) { - getObject().setValue(text.trim().intern()); + getParentObject().getProperties().setProperty(getObject(), text.trim().intern()); } }; diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/Printer.java b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/Printer.java index c5b794fce2f..b9053ec30ac 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/Printer.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/Printer.java @@ -67,7 +67,7 @@ public class Printer { private void export(XMLWriter writer, Group g) throws IOException { Properties attributes = new Properties(); - attributes.add(new Property("difference", Boolean.toString(true))); + attributes.setProperty("difference", Boolean.toString(true)); writer.startTag(Parser.GROUP_ELEMENT, attributes); writer.writeProperties(g.getProperties()); diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/XMLParser.java b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/XMLParser.java index 1efcd06dec9..24cd0f7d3be 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/XMLParser.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/XMLParser.java @@ -25,7 +25,7 @@ package com.sun.hotspot.igv.data.serialization; import com.sun.hotspot.igv.data.Property; import com.sun.hotspot.igv.data.Properties; -import java.util.Hashtable; +import java.util.HashMap; import java.util.Stack; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; @@ -89,7 +89,7 @@ public class XMLParser implements ContentHandler { private Attributes attr; private StringBuilder currentText; private ParseMonitor monitor; - private Hashtable> hashtable; + private HashMap> hashtable; private boolean needsText; private ElementHandler parentElement; @@ -110,7 +110,7 @@ public class XMLParser implements ContentHandler { } public ElementHandler(String name, boolean needsText) { - this.hashtable = new Hashtable>(); + this.hashtable = new HashMap>(); this.name = name; this.needsText = needsText; } @@ -153,7 +153,7 @@ public class XMLParser implements ContentHandler { for (int i = 0; i < length; i++) { String val = attr.getValue(i).intern(); String localName = attr.getLocalName(i).intern(); - p.add(new Property(val, localName)); + p.setProperty(val, localName); } } diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/XMLWriter.java b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/XMLWriter.java index e112dbf4f07..8ff54f75d41 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/XMLWriter.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/XMLWriter.java @@ -89,7 +89,7 @@ public class XMLWriter extends Writer { inner.write("<" + name); elementStack.push(name); - for (Property p : attributes.getProperties()) { + for (Property p : attributes) { inner.write(" " + p.getName() + "=\""); write(p.getValue().toCharArray()); inner.write("\""); @@ -101,7 +101,7 @@ public class XMLWriter extends Writer { public void simpleTag(String name, Properties attributes) throws IOException { inner.write("<" + name); - for (Property p : attributes.getProperties()) { + for (Property p : attributes) { inner.write(" " + p.getName() + "=\""); write(p.getValue().toCharArray()); inner.write("\""); @@ -111,13 +111,13 @@ public class XMLWriter extends Writer { } public void writeProperties(Properties props) throws IOException { - if (props.getProperties().size() == 0) { + if (props.getProperties().hasNext() == false) { return; } startTag(Parser.PROPERTIES_ELEMENT); - for (Property p : props.getProperties()) { + for (Property p : props) { startTag(Parser.PROPERTY_ELEMENT, new Properties(Parser.PROPERTY_NAME_PROPERTY, p.getName())); this.write(p.getValue().toCharArray()); endTag(); diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Difference/src/com/sun/hotspot/igv/difference/Difference.java b/hotspot/src/share/tools/IdealGraphVisualizer/Difference/src/com/sun/hotspot/igv/difference/Difference.java index 335344eb77b..650ee5f63ed 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Difference/src/com/sun/hotspot/igv/difference/Difference.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Difference/src/com/sun/hotspot/igv/difference/Difference.java @@ -29,6 +29,7 @@ import com.sun.hotspot.igv.data.InputEdge; import com.sun.hotspot.igv.data.InputGraph; import com.sun.hotspot.igv.data.InputNode; import com.sun.hotspot.igv.data.Property; +import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Map; @@ -124,8 +125,8 @@ public class Difference { inputNodeMap.put(n, n2); } - Set edgesA = a.getEdges(); - Set edgesB = b.getEdges(); + Collection edgesA = a.getEdges(); + Collection edgesB = b.getEdges(); Set newEdges = new HashSet(); @@ -182,7 +183,7 @@ public class Difference { public double getValue() { double result = 0.0; - for (Property p : n1.getProperties().getProperties()) { + for (Property p : n1.getProperties()) { double faktor = 1.0; for (String forbidden : IGNORE_PROPERTIES) { if (p.getName().equals(forbidden)) { @@ -287,34 +288,34 @@ public class Difference { private static void markAsChanged(InputNode n, InputNode firstNode, InputNode otherNode) { boolean difference = false; - for (Property p : otherNode.getProperties().getProperties()) { - String s = firstNode.getProperties().getProperty(p.getName()); + for (Property p : otherNode.getProperties()) { + String s = firstNode.getProperties().get(p.getName()); if (!p.getValue().equals(s)) { difference = true; - n.getProperties().add(new Property(OLD_PREFIX + p.getName(), p.getValue())); + n.getProperties().setProperty(OLD_PREFIX + p.getName(), p.getValue()); } } - for (Property p : firstNode.getProperties().getProperties()) { - String s = otherNode.getProperties().getProperty(p.getName()); + for (Property p : firstNode.getProperties()) { + String s = otherNode.getProperties().get(p.getName()); if (s == null && p.getValue().length() > 0) { difference = true; - n.getProperties().add(new Property(OLD_PREFIX + p.getName(), "")); + n.getProperties().setProperty(OLD_PREFIX + p.getName(), ""); } } if (difference) { - n.getProperties().add(new Property(PROPERTY_STATE, VALUE_CHANGED)); + n.getProperties().setProperty(PROPERTY_STATE, VALUE_CHANGED); } else { - n.getProperties().add(new Property(PROPERTY_STATE, VALUE_SAME)); + n.getProperties().setProperty(PROPERTY_STATE, VALUE_SAME); } } private static void markAsDeleted(InputNode n) { - n.getProperties().add(new Property(PROPERTY_STATE, VALUE_DELETED)); + n.getProperties().setProperty(PROPERTY_STATE, VALUE_DELETED); } private static void markAsNew(InputNode n) { - n.getProperties().add(new Property(PROPERTY_STATE, VALUE_NEW)); + n.getProperties().setProperty(PROPERTY_STATE, VALUE_NEW); } } diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Filter/manifest.mf b/hotspot/src/share/tools/IdealGraphVisualizer/Filter/manifest.mf index 185ff360536..da8d443b487 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Filter/manifest.mf +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Filter/manifest.mf @@ -1,6 +1,6 @@ -Manifest-Version: 1.0 -OpenIDE-Module: com.sun.hotspot.igv.filter -OpenIDE-Module-Layer: com/sun/hotspot/igv/filter/layer.xml -OpenIDE-Module-Localizing-Bundle: com/sun/hotspot/igv/filter/Bundle.properties -OpenIDE-Module-Specification-Version: 1.0 - +Manifest-Version: 1.0 +OpenIDE-Module: com.sun.hotspot.igv.filter +OpenIDE-Module-Layer: com/sun/hotspot/igv/filter/layer.xml +OpenIDE-Module-Localizing-Bundle: com/sun/hotspot/igv/filter/Bundle.properties +OpenIDE-Module-Specification-Version: 1.0 + diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/CustomFilter.java b/hotspot/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/CustomFilter.java index 762d8d2a22e..18a8841f66d 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/CustomFilter.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/CustomFilter.java @@ -25,7 +25,6 @@ package com.sun.hotspot.igv.filter; import com.sun.hotspot.igv.graph.Diagram; -import com.sun.hotspot.igv.data.Property; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; @@ -56,7 +55,7 @@ public class CustomFilter extends AbstractFilter { public CustomFilter(String name, String code) { this.name = name; this.code = code; - getProperties().add(new Property("name", name)); + getProperties().setProperty("name", name); } public String getName() { diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/SplitFilter.java b/hotspot/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/SplitFilter.java index e4c2554bda5..baf1ca8c723 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/SplitFilter.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/SplitFilter.java @@ -56,8 +56,8 @@ public class SplitFilter extends AbstractFilter { for (OutputSlot os : f.getOutputSlots()) { for (Connection c : os.getConnections()) { InputSlot is = c.getInputSlot(); - is.setName(f.getProperties().getProperty("dump_spec")); - String s = f.getProperties().getProperty("short_name"); + is.setName(f.getProperties().get("dump_spec")); + String s = f.getProperties().get("short_name"); if (s != null) { is.setShortName(s); } diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Diagram.java b/hotspot/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Diagram.java index 00d48f6e926..2584b44fd91 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Diagram.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Diagram.java @@ -35,7 +35,7 @@ import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; -import java.util.Hashtable; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; @@ -126,7 +126,7 @@ public class Diagram { d.updateBlocks(); Collection nodes = graph.getNodes(); - Hashtable figureHash = new Hashtable(); + HashMap figureHash = new HashMap(); for (InputNode n : nodes) { Figure f = d.createFigure(); f.getSource().addSourceNode(n); diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Figure.java b/hotspot/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Figure.java index cfb913ca318..d61bb286d3f 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Figure.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Graph/src/com/sun/hotspot/igv/graph/Figure.java @@ -42,7 +42,7 @@ import java.util.Set; * * @author Thomas Wuerthinger */ -public class Figure extends Properties.Object implements Source.Provider, Vertex { +public class Figure extends Properties.Entity implements Source.Provider, Vertex { public static final int INSET = 6; public static final int SLOT_WIDTH = 10; diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/Graph.java b/hotspot/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/Graph.java index 98dbe392c21..ada9d678617 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/Graph.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/Graph.java @@ -26,7 +26,7 @@ package com.sun.hotspot.igv.hierarchicallayout; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; -import java.util.Hashtable; +import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Queue; @@ -37,13 +37,13 @@ import java.util.Queue; */ public class Graph { - private Hashtable> nodes; - private Hashtable> edges; + private HashMap> nodes; + private HashMap> edges; private List> nodeList; public Graph() { - nodes = new Hashtable>(); - edges = new Hashtable>(); + nodes = new HashMap>(); + edges = new HashMap>(); nodeList = new ArrayList>(); } diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/HierarchicalClusterLayoutManager.java b/hotspot/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/HierarchicalClusterLayoutManager.java index 1dc1b3691d7..37b05d245c1 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/HierarchicalClusterLayoutManager.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/HierarchicalLayout/src/com/sun/hotspot/igv/hierarchicallayout/HierarchicalClusterLayoutManager.java @@ -25,7 +25,7 @@ package com.sun.hotspot.igv.hierarchicallayout; import java.awt.Point; import java.awt.Rectangle; -import java.util.Hashtable; +import java.util.HashMap; import java.util.List; import java.util.Set; import java.util.ArrayList; @@ -69,19 +69,19 @@ public class HierarchicalClusterLayoutManager implements LayoutManager { assert graph.verify(); - Hashtable> lists = new Hashtable>(); - Hashtable> listsConnection = new Hashtable>(); - Hashtable> clusterInputSlotHash = new Hashtable>(); - Hashtable> clusterOutputSlotHash = new Hashtable>(); + HashMap> lists = new HashMap>(); + HashMap> listsConnection = new HashMap>(); + HashMap> clusterInputSlotHash = new HashMap>(); + HashMap> clusterOutputSlotHash = new HashMap>(); - Hashtable clusterNodes = new Hashtable(); - Hashtable> clusterInputSlotSet = new Hashtable>(); - Hashtable> clusterOutputSlotSet = new Hashtable>(); + HashMap clusterNodes = new HashMap(); + HashMap> clusterInputSlotSet = new HashMap>(); + HashMap> clusterOutputSlotSet = new HashMap>(); Set clusterEdges = new HashSet(); Set interClusterEdges = new HashSet(); - Hashtable linkClusterOutgoingConnection = new Hashtable(); - Hashtable linkInterClusterConnection = new Hashtable(); - Hashtable linkClusterIngoingConnection = new Hashtable(); + HashMap linkClusterOutgoingConnection = new HashMap(); + HashMap linkInterClusterConnection = new HashMap(); + HashMap linkClusterIngoingConnection = new HashMap(); Set clusterNodeSet = new HashSet(); Set cluster = graph.getClusters(); @@ -89,8 +89,8 @@ public class HierarchicalClusterLayoutManager implements LayoutManager { for (Cluster c : cluster) { lists.put(c, new ArrayList()); listsConnection.put(c, new ArrayList()); - clusterInputSlotHash.put(c, new Hashtable()); - clusterOutputSlotHash.put(c, new Hashtable()); + clusterInputSlotHash.put(c, new HashMap()); + clusterOutputSlotHash.put(c, new HashMap()); clusterOutputSlotSet.put(c, new TreeSet()); clusterInputSlotSet.put(c, new TreeSet()); ClusterNode cn = new ClusterNode(c, "" + z); diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Layout/src/com/sun/hotspot/igv/layout/LayoutGraph.java b/hotspot/src/share/tools/IdealGraphVisualizer/Layout/src/com/sun/hotspot/igv/layout/LayoutGraph.java index ac262c95e74..50edc14a864 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Layout/src/com/sun/hotspot/igv/layout/LayoutGraph.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Layout/src/com/sun/hotspot/igv/layout/LayoutGraph.java @@ -24,7 +24,7 @@ package com.sun.hotspot.igv.layout; import java.util.HashSet; -import java.util.Hashtable; +import java.util.HashMap; import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; @@ -37,9 +37,9 @@ public class LayoutGraph { private Set links; private SortedSet vertices; - private Hashtable> inputPorts; - private Hashtable> outputPorts; - private Hashtable> portLinks; + private HashMap> inputPorts; + private HashMap> outputPorts; + private HashMap> portLinks; public LayoutGraph(Set links) { this(links, new HashSet()); @@ -50,9 +50,9 @@ public class LayoutGraph { assert verify(); vertices = new TreeSet(); - portLinks = new Hashtable>(); - inputPorts = new Hashtable>(); - outputPorts = new Hashtable>(); + portLinks = new HashMap>(); + inputPorts = new HashMap>(); + outputPorts = new HashMap>(); for (Link l : links) { Port p = l.getFrom(); diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/README b/hotspot/src/share/tools/IdealGraphVisualizer/README index 80e16329506..5c9a16601bc 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/README +++ b/hotspot/src/share/tools/IdealGraphVisualizer/README @@ -5,21 +5,16 @@ of Linz in Austria and has been included as part of hotspot since that was the primary target of the tool. The tool itself is fairly general with only a few modules that contain C2 specific elements. -The tool is built on top of the NetBeans 6.0 rich client +The tool is built on top of the NetBeans 6.1 rich client infrastructure and so requires NetBeans to build. It currently requires Java 6 to run as it needs support for JavaScript for its filtering mechanism and assumes it's built into the platform. It -should build out of the box whit NetBeans 6 and Java 6 or later. It's -possible to run it on 1.5 by including Rhino on the classpath though -that currently isn't working correctly. Support for exporting graphs -as SVG can be enabled by adding batik to the classpath which isn't -included by default. - -It can be built on top of NetBeans 6.1 if you change the required -modules to be platform8 instead of platform7. The tool could run on -JDK 1.5 with some reworking of the how the JavaScript support is -enabled but currently it requires some tweaking of the setup. This -will be fixed in a later setup. +should build out of the box with NetBeans 6.1 and Java 6 or later. +It's possible to run it on 1.5 by including Rhino on the classpath +though that currently isn't working correctly. Support for exporting +graphs as SVG can be enabled by adding batik to the classpath which +isn't included by default. It can be built on top of NetBeans 6.0 if +you change the required modules to be platform7 instead of platform8. The JVM support is controlled by the flag -XX:PrintIdealGraphLevel=# where # is: diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/PropertiesSheet.java b/hotspot/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/PropertiesSheet.java index f058edda6ae..ab7da78f2c4 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/PropertiesSheet.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/PropertiesSheet.java @@ -36,11 +36,11 @@ import org.openide.nodes.Sheet; */ public class PropertiesSheet { - public static void initializeSheet(Properties properties, Sheet s) { + public static void initializeSheet(final Properties properties, Sheet s) { Sheet.Set set1 = Sheet.createPropertiesSet(); set1.setDisplayName("Properties"); - for (final Property p : properties.getProperties()) { + for (final Property p : properties) { Node.Property prop = new Node.Property(String.class) { @Override @@ -60,7 +60,7 @@ public class PropertiesSheet { @Override public void setValue(String arg0) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { - p.setValue(arg0); + properties.setProperty(p.getName(), arg0); } }; prop.setName(p.getName()); diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/RangeSliderModel.java b/hotspot/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/RangeSliderModel.java index 71766ec3b67..a179d1ee08c 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/RangeSliderModel.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/RangeSliderModel.java @@ -65,13 +65,19 @@ public class RangeSliderModel implements ChangedEventProvider public RangeSliderModel(List positions) { assert positions.size() > 0; - this.positions = positions; this.changedEvent = new ChangedEvent(this); this.colorChangedEvent = new ChangedEvent(this); + setPositions(positions); + } + + protected void setPositions(List positions) { + this.positions = positions; colors = new ArrayList(); for (int i = 0; i < positions.size(); i++) { colors.add(Color.black); } + changedEvent.fire(); + colorChangedEvent.fire(); } public void setColors(List colors) { diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/DiagramScene.java b/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/DiagramScene.java index 2ee3067acfe..7ebfbbe866a 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/DiagramScene.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/DiagramScene.java @@ -63,7 +63,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; -import java.util.Hashtable; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; @@ -104,10 +104,10 @@ import org.openide.util.lookup.InstanceContent; */ public class DiagramScene extends Scene implements ChangedListener { - private Hashtable figureWidgets; - private Hashtable slotWidgets; - private Hashtable connectionWidgets; - private Hashtable blockWidgets; + private HashMap figureWidgets; + private HashMap slotWidgets; + private HashMap connectionWidgets; + private HashMap blockWidgets; private Widget hoverWidget; private WidgetAction hoverAction; private List selectedWidgets; @@ -414,7 +414,7 @@ public class DiagramScene extends Scene implements ChangedListener(); + blockWidgets = new HashMap(); boolean b = this.getUndoRedoEnabled(); this.setUndoRedoEnabled(false); @@ -543,9 +543,9 @@ public class DiagramScene extends Scene implements ChangedListener(); - slotWidgets = new Hashtable(); - connectionWidgets = new Hashtable(); + figureWidgets = new HashMap(); + slotWidgets = new HashMap(); + connectionWidgets = new HashMap(); WidgetAction selectAction = new ExtendedSelectAction(selectProvider); Diagram d = getModel().getDiagramToView(); diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/DiagramViewModel.java b/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/DiagramViewModel.java index e374873b584..5d1da8ceacf 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/DiagramViewModel.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/DiagramViewModel.java @@ -55,6 +55,7 @@ public class DiagramViewModel extends RangeSliderModel implements ChangedListene private FilterChain filterChain; private FilterChain sequenceFilterChain; private Diagram diagram; + private ChangedEvent groupChangedEvent; private ChangedEvent diagramChangedEvent; private ChangedEvent viewChangedEvent; private ChangedEvent viewPropertiesChangedEvent; @@ -67,6 +68,7 @@ public class DiagramViewModel extends RangeSliderModel implements ChangedListene } }; + @Override public DiagramViewModel copy() { DiagramViewModel result = new DiagramViewModel(group, filterChain, sequenceFilterChain); result.setData(this); @@ -79,6 +81,7 @@ public class DiagramViewModel extends RangeSliderModel implements ChangedListene boolean viewChanged = false; boolean viewPropertiesChanged = false; + boolean groupChanged = (group == newModel.group); this.group = newModel.group; diagramChanged |= (filterChain != newModel.filterChain); this.filterChain = newModel.filterChain; @@ -97,6 +100,10 @@ public class DiagramViewModel extends RangeSliderModel implements ChangedListene viewPropertiesChanged |= (showNodeHull != newModel.showNodeHull); this.showNodeHull = newModel.showNodeHull; + if(groupChanged) { + groupChangedEvent.fire(); + } + if (diagramChanged) { diagramChangedEvent.fire(); } @@ -143,11 +150,38 @@ public class DiagramViewModel extends RangeSliderModel implements ChangedListene diagramChangedEvent = new ChangedEvent(this); viewChangedEvent = new ChangedEvent(this); viewPropertiesChangedEvent = new ChangedEvent(this); + groupChangedEvent = new ChangedEvent(this); + groupChangedEvent.addListener(groupChangedListener); + groupChangedEvent.fire(); filterChain.getChangedEvent().addListener(filterChainChangedListener); sequenceFilterChain.getChangedEvent().addListener(filterChainChangedListener); } + private final ChangedListener groupChangedListener = new ChangedListener() { + + private Group oldGroup; + + public void changed(DiagramViewModel source) { + if(oldGroup != null) { + oldGroup.getChangedEvent().removeListener(groupContentChangedListener); + } + group.getChangedEvent().addListener(groupContentChangedListener); + oldGroup = group; + } + }; + + + private final ChangedListener groupContentChangedListener = new ChangedListener() { + + public void changed(Group source) { + assert source == group; + setPositions(calculateStringList(source)); + setSelectedNodes(selectedNodes); + } + + }; + public ChangedEvent getDiagramChangedEvent() { return diagramChangedEvent; } @@ -268,7 +302,10 @@ public class DiagramViewModel extends RangeSliderModel implements ChangedListene } public InputGraph getSecondGraph() { - return group.getGraphs().get(getSecondPosition()); + List graphs = group.getGraphs(); + if (graphs.size() >= getSecondPosition()) + return group.getGraphs().get(getSecondPosition()); + return getFirstGraph(); } public void selectGraph(InputGraph g) { diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/FindPanel.java b/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/FindPanel.java index 7d45f1b35c6..961dc54d882 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/FindPanel.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/FindPanel.java @@ -67,7 +67,7 @@ class FindPanel extends JPanel implements KeyListener { for (Figure f : figures) { Properties prop = f.getProperties(); - for (Property p : prop.getProperties()) { + for (Property p : prop) { if (!propertyNames.contains(p.getName())) { propertyNames.add(p.getName()); } diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/nbproject/platform.properties b/hotspot/src/share/tools/IdealGraphVisualizer/nbproject/platform.properties index 4768730f129..881365d0eda 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/nbproject/platform.properties +++ b/hotspot/src/share/tools/IdealGraphVisualizer/nbproject/platform.properties @@ -1,16 +1,16 @@ # Deprecated since 5.0u1; for compatibility with 5.0: disabled.clusters=\ apisupport1,\ + gsf1,\ harness,\ - ide8,\ - java1,\ - nb6.0,\ - profiler2 + ide9,\ + java2,\ + nb6.1,\ + profiler3 disabled.modules=\ org.netbeans.core.execution,\ org.netbeans.core.multiview,\ org.netbeans.core.output2,\ - org.netbeans.modules.applemenu,\ org.netbeans.modules.autoupdate.services,\ org.netbeans.modules.autoupdate.ui,\ org.netbeans.modules.core.kit,\ @@ -24,6 +24,6 @@ disabled.modules=\ org.openide.execution,\ org.openide.util.enumerations enabled.clusters=\ - platform7 + platform8 nbjdk.active=default nbplatform.active=default diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/nbproject/project.properties b/hotspot/src/share/tools/IdealGraphVisualizer/nbproject/project.properties index 1b524d231f3..b00f22d78fc 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/nbproject/project.properties +++ b/hotspot/src/share/tools/IdealGraphVisualizer/nbproject/project.properties @@ -15,7 +15,6 @@ modules=\ ${project.com.sun.hotspot.igv.difference}:\ ${project.com.sun.hotspot.igv.settings}:\ ${project.com.sun.hotspot.igv.util}:\ - ${project.com.sun.hotspot.igv.rhino}:\ ${project.com.sun.hotspot.igv.svg}:\ ${project.com.sun.hotspot.connection}:\ ${project.com.sun.hotspot.igv.servercompilerscheduler}:\ @@ -31,10 +30,10 @@ project.com.sun.hotspot.igv.filterwindow=FilterWindow project.com.sun.hotspot.igv.graph=Graph project.com.sun.hotspot.igv.hierarchicallayout=HierarchicalLayout project.com.sun.hotspot.igv.layout=Layout -project.com.sun.hotspot.igv.rhino=RhinoScriptEngineProxy project.com.sun.hotspot.igv.servercompilerscheduler=ServerCompiler project.com.sun.hotspot.igv.settings=Settings project.com.sun.hotspot.igv.svg=BatikSVGProxy project.com.sun.hotspot.igv.view=View project.com.sun.hotspot.igv.util=Util -run.args = -server -J-Xms64m -J-Xmx512m -J-da +run.args = -J-server -J-Xms64m -J-Xmx1g -J-da +run.args.extra = -J-server -J-Xms64m -J-Xmx1g -J-da diff --git a/hotspot/src/share/vm/adlc/output_h.cpp b/hotspot/src/share/vm/adlc/output_h.cpp index c5c0bd683bb..d2fd489abe9 100644 --- a/hotspot/src/share/vm/adlc/output_h.cpp +++ b/hotspot/src/share/vm/adlc/output_h.cpp @@ -377,7 +377,7 @@ static uint dump_spec_constant(FILE *fp, const char *ideal_type, uint i, Operand ++i; } else if (!strcmp(ideal_type, "ConN")) { - fprintf(fp," _c%d->dump();\n", i); + fprintf(fp," _c%d->dump_on(st);\n", i); ++i; } else if (!strcmp(ideal_type, "ConL")) { diff --git a/hotspot/src/share/vm/opto/compile.cpp b/hotspot/src/share/vm/opto/compile.cpp index 91ae2e6b8f5..26c2a1d0f41 100644 --- a/hotspot/src/share/vm/opto/compile.cpp +++ b/hotspot/src/share/vm/opto/compile.cpp @@ -551,7 +551,7 @@ Compile::Compile( ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, int osr rethrow_exceptions(kit.transfer_exceptions_into_jvms()); } - print_method("Before RemoveUseless"); + print_method("Before RemoveUseless", 3); // Remove clutter produced by parsing. if (!failing()) { diff --git a/hotspot/src/share/vm/opto/type.cpp b/hotspot/src/share/vm/opto/type.cpp index 3e9b66ba32e..f433a125535 100644 --- a/hotspot/src/share/vm/opto/type.cpp +++ b/hotspot/src/share/vm/opto/type.cpp @@ -3541,7 +3541,7 @@ intptr_t TypeNarrowOop::get_con() const { #ifndef PRODUCT void TypeNarrowOop::dump2( Dict & d, uint depth, outputStream *st ) const { - tty->print("narrowoop: "); + st->print("narrowoop: "); _ooptype->dump2(d, depth, st); } #endif diff --git a/hotspot/src/share/vm/runtime/frame.cpp b/hotspot/src/share/vm/runtime/frame.cpp index 6baf659d0ff..e84d6d3ad8b 100644 --- a/hotspot/src/share/vm/runtime/frame.cpp +++ b/hotspot/src/share/vm/runtime/frame.cpp @@ -83,12 +83,12 @@ void RegisterMap::print_on(outputStream* st) const { intptr_t* src = (intptr_t*) location(r); if (src != NULL) { - r->print(); - tty->print(" [" INTPTR_FORMAT "] = ", src); + r->print_on(st); + st->print(" [" INTPTR_FORMAT "] = ", src); if (((uintptr_t)src & (sizeof(*src)-1)) != 0) { - tty->print_cr(""); + st->print_cr(""); } else { - tty->print_cr(INTPTR_FORMAT, *src); + st->print_cr(INTPTR_FORMAT, *src); } } } From 5118c7cd7f7aa458b7aec0e4bb8c64d57966bf55 Mon Sep 17 00:00:00 2001 From: Eamonn McManus Date: Fri, 31 Oct 2008 17:34:52 +0100 Subject: [PATCH 099/267] 6766173: Spec should say that createMBean wraps a constructor RuntimeException in a RuntimeMBeanException JMX spec clarification Reviewed-by: dfuchs --- .../management/MBeanServerConnection.java | 16 +++- .../namespace/MBeanServerSupport.java | 50 +++++------ .../MBeanServer/MBeanExceptionTest.java | 87 ++++++++++++++++++- 3 files changed, 117 insertions(+), 36 deletions(-) diff --git a/jdk/src/share/classes/javax/management/MBeanServerConnection.java b/jdk/src/share/classes/javax/management/MBeanServerConnection.java index 0897684a0b5..16ce58bb883 100644 --- a/jdk/src/share/classes/javax/management/MBeanServerConnection.java +++ b/jdk/src/share/classes/javax/management/MBeanServerConnection.java @@ -76,7 +76,9 @@ public interface MBeanServerConnection extends NotificationManager { * preRegister (MBeanRegistration * interface) method of the MBean has thrown an exception. The * MBean will not be registered. - * @exception RuntimeMBeanException If the postRegister + * @exception RuntimeMBeanException If the MBean's constructor or its + * {@code preRegister} or {@code postRegister} method threw + * a {@code RuntimeException}. If the postRegister * (MBeanRegistration interface) method of the MBean throws a * RuntimeException, the createMBean method will * throw a RuntimeMBeanException, although the MBean creation @@ -148,7 +150,9 @@ public interface MBeanServerConnection extends NotificationManager { * preRegister (MBeanRegistration * interface) method of the MBean has thrown an exception. The * MBean will not be registered. - * @exception RuntimeMBeanException If the postRegister + * @exception RuntimeMBeanException If the MBean's constructor or its + * {@code preRegister} or {@code postRegister} method threw + * a {@code RuntimeException}. If the postRegister * (MBeanRegistration interface) method of the MBean throws a * RuntimeException, the createMBean method will * throw a RuntimeMBeanException, although the MBean creation @@ -223,7 +227,9 @@ public interface MBeanServerConnection extends NotificationManager { * preRegister (MBeanRegistration * interface) method of the MBean has thrown an exception. The * MBean will not be registered. - * @exception RuntimeMBeanException If the postRegister + * @exception RuntimeMBeanException If the MBean's constructor or its + * {@code preRegister} or {@code postRegister} method threw + * a {@code RuntimeException}. If the postRegister * (MBeanRegistration interface) method of the MBean throws a * RuntimeException, the createMBean method will * throw a RuntimeMBeanException, although the MBean creation @@ -295,7 +301,9 @@ public interface MBeanServerConnection extends NotificationManager { * preRegister (MBeanRegistration * interface) method of the MBean has thrown an exception. The * MBean will not be registered. - * @exception RuntimeMBeanException If the postRegister + * @exception RuntimeMBeanException The MBean's constructor or its + * {@code preRegister} or {@code postRegister} method threw + * a {@code RuntimeException}. If the postRegister * (MBeanRegistration interface) method of the MBean throws a * RuntimeException, the createMBean method will * throw a RuntimeMBeanException, although the MBean creation diff --git a/jdk/src/share/classes/javax/management/namespace/MBeanServerSupport.java b/jdk/src/share/classes/javax/management/namespace/MBeanServerSupport.java index 903be3c308f..ea070ae262e 100644 --- a/jdk/src/share/classes/javax/management/namespace/MBeanServerSupport.java +++ b/jdk/src/share/classes/javax/management/namespace/MBeanServerSupport.java @@ -457,7 +457,11 @@ public abstract class MBeanServerSupport implements MBeanServer { * All the various flavors of {@code MBeanServer.createMBean} methods * will eventually call this method. A subclass that wishes to * support MBean creation through {@code createMBean} thus only - * needs to provide an implementation for this one method. + * needs to provide an implementation for this one method.

    + * + *

    A subclass implementation of this method should respect the contract + * of the various {@code createMBean} methods in the {@link MBeanServer} + * interface, in particular as regards exception wrapping.

    * * @param className The class name of the MBean to be instantiated. * @param name The object name of the MBean. May be null. @@ -488,6 +492,17 @@ public abstract class MBeanServerSupport implements MBeanServer { * preRegister (MBeanRegistration * interface) method of the MBean has thrown an exception. The * MBean will not be registered. + * @exception RuntimeMBeanException If the MBean's constructor or its + * {@code preRegister} or {@code postRegister} method threw + * a {@code RuntimeException}. If the postRegister + * (MBeanRegistration interface) method of the MBean throws a + * RuntimeException, the createMBean method will + * throw a RuntimeMBeanException, although the MBean creation + * and registration succeeded. In such a case, the MBean will be actually + * registered even though the createMBean method + * threw an exception. Note that RuntimeMBeanException can + * also be thrown by preRegister, in which case the MBean + * will not be registered. * @exception MBeanException The constructor of the MBean has * thrown an exception * @exception NotCompliantMBeanException This class is not a JMX @@ -1096,7 +1111,7 @@ public abstract class MBeanServerSupport implements MBeanServer { MBeanRegistrationException, MBeanException, NotCompliantMBeanException { try { - return safeCreateMBean(className, name, null, params, signature, true); + return createMBean(className, name, null, params, signature, true); } catch (InstanceNotFoundException ex) { // should not happen! throw new MBeanException(ex, "Unexpected exception: " + ex); @@ -1113,7 +1128,7 @@ public abstract class MBeanServerSupport implements MBeanServer { throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException { - return safeCreateMBean(className, name, loaderName, params, signature, false); + return createMBean(className, name, loaderName, params, signature, false); } /** @@ -1126,7 +1141,7 @@ public abstract class MBeanServerSupport implements MBeanServer { MBeanRegistrationException, MBeanException, NotCompliantMBeanException { try { - return safeCreateMBean(className, name, null, null, null, true); + return createMBean(className, name, null, null, null, true); } catch (InstanceNotFoundException ex) { // should not happen! throw new MBeanException(ex, "Unexpected exception: " + ex); @@ -1143,32 +1158,7 @@ public abstract class MBeanServerSupport implements MBeanServer { throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException { - return safeCreateMBean(className, name, loaderName, null, null, false); - } - - // make sure all exceptions are correctly wrapped in a JMXException - private ObjectInstance safeCreateMBean(String className, - ObjectName name, ObjectName loaderName, Object[] params, - String[] signature, boolean useRepository) - throws ReflectionException, InstanceAlreadyExistsException, - MBeanRegistrationException, MBeanException, - NotCompliantMBeanException, InstanceNotFoundException { - try { - return createMBean(className, name, loaderName, params, - signature, useRepository); - } catch (ReflectionException x) { throw x; - } catch (InstanceAlreadyExistsException x) { throw x; - } catch (MBeanRegistrationException x) { throw x; - } catch (MBeanException x) { throw x; - } catch (NotCompliantMBeanException x) { throw x; - } catch (InstanceNotFoundException x) { throw x; - } catch (SecurityException x) { throw x; - } catch (JMRuntimeException x) { throw x; - } catch (RuntimeException x) { - throw new RuntimeOperationsException(x, x.toString()); - } catch (Exception x) { - throw new MBeanException(x, x.toString()); - } + return createMBean(className, name, loaderName, null, null, false); } diff --git a/jdk/test/javax/management/MBeanServer/MBeanExceptionTest.java b/jdk/test/javax/management/MBeanServer/MBeanExceptionTest.java index 25260e0c15e..3516953d750 100644 --- a/jdk/test/javax/management/MBeanServer/MBeanExceptionTest.java +++ b/jdk/test/javax/management/MBeanServer/MBeanExceptionTest.java @@ -23,16 +23,19 @@ /* * @test - * @bug 5035217 + * @bug 5035217 6766173 * @summary Test that MBean's RuntimeException is wrapped in * RuntimeMBeanException and (for Standard MBeans) that checked exceptions * are wrapped in MBeanException * @author Eamonn McManus - * @compile -source 1.4 MBeanExceptionTest.java + * @compile MBeanExceptionTest.java * @run main MBeanExceptionTest */ +import java.util.Collections; +import java.util.Set; import javax.management.*; +import javax.management.namespace.MBeanServerSupport; public class MBeanExceptionTest { public static void main(String[] args) throws Exception { @@ -56,6 +59,53 @@ public class MBeanExceptionTest { failures += test(mbs, standardName, true); failures += test(mbs, standardMBeanName, true); failures += test(mbs, dynamicName, false); + + final boolean[] booleans = {false, true}; + + for (boolean mbss : booleans) { + for (boolean runtimeX : booleans) { + Class excC = + runtimeX ? RuntimeMBeanException.class : MBeanException.class; + String excS = + runtimeX ? "a RuntimeMBeanException" : "an MBeanException"; + String mbsS = + mbss ? "a conformant MBeanServerSupport" : "a plain MBeanServer"; + MBeanServer xmbs = + mbss ? new CreateExceptionMBS() : mbs; + System.out.println( + "Test that, with " + mbsS + ", " + excS + " is wrapped " + + "in " + excS); + // E.g. "Test that, with a plain MBeanServer, an MBeanException + // is wrapped in an MBeanException". + try { + mbs.createMBean( + Except.class.getName(), new ObjectName(":name=Oops"), + new Object[] {runtimeX}, + new String[] {boolean.class.getName()}); + System.out.println( + "FAIL: createMBean succeeded but should not have"); + failures++; + } catch (Exception e) { + if (!excC.isInstance(e)) { + System.out.println( + "FAIL: expected " + excC.getName() + " from " + + "createMBean, got " + e); + failures++; + } else { + Throwable cause = e.getCause(); + if (!excC.isInstance(cause)) { + System.out.println( + "FAIL: expected " + excC.getName() + + " as cause of " + excC.getName() + + ", got " + e); + failures++; + } else + System.out.println("...ok"); + } + } + } + } + if (failures == 0) System.out.println("Test passed"); else { @@ -153,6 +203,15 @@ public class MBeanExceptionTest { } public static class Except implements ExceptMBean { + public Except() {} + + public Except(boolean runtimeX) throws MBeanException { + if (runtimeX) + throw new RuntimeMBeanException(new RuntimeException(), "Bang"); + else + throw new MBeanException(new Exception(), "Bang"); + } + public String getUncheckedException() { throw theUncheckedException; } @@ -221,4 +280,28 @@ public class MBeanExceptionTest { private static final RuntimeException theUncheckedException = new UnsupportedOperationException("The unchecked exception " + "that should be seen"); + + private static class CreateExceptionMBS extends MBeanServerSupport { + @Override + protected Set getNames() { + return Collections.emptySet(); + } + + @Override + public DynamicMBean getDynamicMBeanFor(ObjectName name) + throws InstanceNotFoundException { + throw new InstanceNotFoundException(name); + } + + @Override + public ObjectInstance createMBean(String className, + ObjectName name, ObjectName loaderName, Object[] params, + String[] signature, boolean useCLR) + throws ReflectionException, InstanceAlreadyExistsException, + MBeanRegistrationException, MBeanException, + NotCompliantMBeanException, InstanceNotFoundException { + Exception wrapped = new MBeanException(new Exception(), "Bang"); + throw new MBeanException(wrapped, "Bang"); + } + } } From ec4b93457e50158db0ba6d84402cbed1f11b7c02 Mon Sep 17 00:00:00 2001 From: Sean Mullan Date: Wed, 5 Nov 2008 15:55:00 -0500 Subject: [PATCH 100/267] 6744888: OCSP validation code should permit some clock skew when checking validity of OCSP responses Allow for up to 10 minutes of clock skew when validating OCSP responses Reviewed-by: vinnie --- .../sun/security/provider/certpath/OCSPResponse.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/jdk/src/share/classes/sun/security/provider/certpath/OCSPResponse.java b/jdk/src/share/classes/sun/security/provider/certpath/OCSPResponse.java index 24d88374c1c..e9afb29f5e5 100644 --- a/jdk/src/share/classes/sun/security/provider/certpath/OCSPResponse.java +++ b/jdk/src/share/classes/sun/security/provider/certpath/OCSPResponse.java @@ -151,6 +151,10 @@ class OCSPResponse { private SingleResponse singleResponse; + // Maximum clock skew in milliseconds (10 minutes) allowed when checking + // validity of OCSP responses + private static final long MAX_CLOCK_SKEW = 600000; + // an array of all of the CRLReasons (used in SingleResponse) private static CRLReason[] values = CRLReason.values(); @@ -583,7 +587,9 @@ class OCSPResponse { } } - Date now = new Date(); + long now = System.currentTimeMillis(); + Date nowPlusSkew = new Date(now + MAX_CLOCK_SKEW); + Date nowMinusSkew = new Date(now - MAX_CLOCK_SKEW); if (DEBUG != null) { String until = ""; if (nextUpdate != null) { @@ -593,8 +599,8 @@ class OCSPResponse { thisUpdate + until); } // Check that the test date is within the validity interval - if ((thisUpdate != null && now.before(thisUpdate)) || - (nextUpdate != null && now.after(nextUpdate))) { + if ((thisUpdate != null && nowPlusSkew.before(thisUpdate)) || + (nextUpdate != null && nowMinusSkew.after(nextUpdate))) { if (DEBUG != null) { DEBUG.println("Response is unreliable: its validity " + From cb4eb96188a97044e42a75cadc6019175bd0f75c Mon Sep 17 00:00:00 2001 From: Sean Mullan Date: Thu, 6 Nov 2008 12:12:39 -0500 Subject: [PATCH 101/267] 6765046: CertPathValidatorException(Throwable).getMessage() always returns null since b37 Reviewed-by: vinnie --- .../cert/CertPathValidatorException.java | 2 +- .../GetMessage.java | 63 +++++++++++++++++++ 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 jdk/test/java/security/cert/CertPathValidatorException/GetMessage.java diff --git a/jdk/src/share/classes/java/security/cert/CertPathValidatorException.java b/jdk/src/share/classes/java/security/cert/CertPathValidatorException.java index 8a04aeff5f3..c1ca1d2b8de 100644 --- a/jdk/src/share/classes/java/security/cert/CertPathValidatorException.java +++ b/jdk/src/share/classes/java/security/cert/CertPathValidatorException.java @@ -113,7 +113,7 @@ public class CertPathValidatorException extends GeneralSecurityException { * permitted, and indicates that the cause is nonexistent or unknown.) */ public CertPathValidatorException(Throwable cause) { - this(null, cause); + this((cause == null ? null : cause.toString()), cause); } /** diff --git a/jdk/test/java/security/cert/CertPathValidatorException/GetMessage.java b/jdk/test/java/security/cert/CertPathValidatorException/GetMessage.java new file mode 100644 index 00000000000..dd51af7e42c --- /dev/null +++ b/jdk/test/java/security/cert/CertPathValidatorException/GetMessage.java @@ -0,0 +1,63 @@ +/* + * 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. + * + * 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 6765046 + * @summary check that getMessage(cause) returns cause.toString if cause != null + */ + +import java.security.cert.CertPathValidatorException; + +public class GetMessage { + private static volatile boolean failed = false; + public static void main(String[] args) throws Exception { + + Throwable[] causes = { + new Throwable(), + new Throwable("message"), + new Throwable("message", new Throwable()) }; + + for (Throwable cause: causes) { + CertPathValidatorException cpve = + new CertPathValidatorException(cause); + + // from CertPathValidatorException(Throwable cause) spec: + // The detail message is set to (cause==null ? null : cause.toString() ) + // (which typically contains the class and detail message of cause). + String expMsg = (cause == null ? null : cause.toString()); + String actualMsg = cpve.getMessage(); + + boolean msgsEqual = + (expMsg == null ? actualMsg == null : expMsg.equals(actualMsg)); + if (!msgsEqual) { + System.out.println("expected message:" + expMsg); + System.out.println("getMessage():" + actualMsg); + failed = true; + } + } + if (failed) { + throw new Exception("Some tests FAILED"); + } + } +} From fc59049c531df82fe6cb6c832b5895506f1c6169 Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena Date: Thu, 6 Nov 2008 12:10:15 -0800 Subject: [PATCH 102/267] Added tag jdk7-b39 for changeset 731c67277e2b --- .hgtags-top-repo | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags-top-repo b/.hgtags-top-repo index 65dc4a6d39c..c0b9b72f57d 100644 --- a/.hgtags-top-repo +++ b/.hgtags-top-repo @@ -13,3 +13,4 @@ bb1ef4ee3d2c8cbf43a37d372325a7952be590b9 jdk7-b33 4b4f5fea8d7d0743f0c30d91fcd9bf9d96e5d2ad jdk7-b36 744554f5a3290e11c71cd2ddb1aff49e431f9ed0 jdk7-b37 cc47a76899ed33a2c513cb688348244c9b5a1288 jdk7-b38 +ab523b49de1fc73fefe6855ce1e0349bdbd7af29 jdk7-b39 From b0133ca5b4b6dec1e2f0f41b037b8b98a246fd62 Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena Date: Thu, 6 Nov 2008 12:10:16 -0800 Subject: [PATCH 103/267] Added tag jdk7-b39 for changeset 4d2a283e9da2 --- corba/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/corba/.hgtags b/corba/.hgtags index baa91282f79..ae11865afed 100644 --- a/corba/.hgtags +++ b/corba/.hgtags @@ -13,3 +13,4 @@ ef6af34d75a7b44e77083f1d4ee47631fa09d3b4 jdk7-b31 0723891eb8d1c27e67c54163af0b4cea05a4e036 jdk7-b36 59d5848bdedebe91cc2753acce78911bcb4a66db jdk7-b37 08be802754b0296c91a7713b6d85a015dbcd5349 jdk7-b38 +55078b6661e286e90387d1d9950bd865f5cc436e jdk7-b39 From ec8b80fefc44e71be866538f592f81641f4191a1 Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena Date: Thu, 6 Nov 2008 12:10:20 -0800 Subject: [PATCH 104/267] Added tag jdk7-b39 for changeset c483fc7ff658 --- hotspot/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/hotspot/.hgtags b/hotspot/.hgtags index 15a4678d894..f7cd42cd696 100644 --- a/hotspot/.hgtags +++ b/hotspot/.hgtags @@ -13,3 +13,4 @@ b727c32788a906c04839516ae7443a085185a300 jdk7-b32 e91159f921a58af3698e6479ea1fc5818da66d09 jdk7-b36 9ee9cf798b59e7d51f8c0a686959f313867a55d6 jdk7-b37 d9bc824aa078573829bb66572af847e26e1bd12e jdk7-b38 +49ca90d77f34571b0757ebfcb8a7848ef2696b88 jdk7-b39 From 452ff15c375012383227cd9defe190203eedcff6 Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena Date: Thu, 6 Nov 2008 12:10:24 -0800 Subject: [PATCH 105/267] Added tag jdk7-b39 for changeset b7877f7986a3 --- jaxp/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxp/.hgtags b/jaxp/.hgtags index 617465552f9..a0629ba363f 100644 --- a/jaxp/.hgtags +++ b/jaxp/.hgtags @@ -13,3 +13,4 @@ eac46d1eb7f0935ba04f1c7929ec15423fd0309e jdk7-b35 c84ca638db42a8b6b227b4e3b63bca192c5ca634 jdk7-b36 af49591bc486d82aa04b832257de0d18adc9af52 jdk7-b37 e9f750f0a3a00413a7b77028b2ecdabb7129ae32 jdk7-b38 +831b80be6cea8e7d7da197ccdac5fd4c701a5033 jdk7-b39 From 6759fbba865681d4f9928852f4a59e1ca1d5fe41 Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena Date: Thu, 6 Nov 2008 12:10:26 -0800 Subject: [PATCH 106/267] Added tag jdk7-b39 for changeset 83ca2ddee2dd --- jaxws/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxws/.hgtags b/jaxws/.hgtags index bd52eb7b738..f578d68a15c 100644 --- a/jaxws/.hgtags +++ b/jaxws/.hgtags @@ -13,3 +13,4 @@ b0f01c2508b690dd225298edfec70b5e8b8dc367 jdk7-b35 f60187f44a0d62906a5e2f6bd0989b5b24c1ca1e jdk7-b36 a2a6f9edf761934faf59ea60d7fe7178371302cd jdk7-b37 9ce439969184c753a9ba3caf8ed277b05230f2e5 jdk7-b38 +077bc9b1b035a409a76bd5366f73ed9dd9846934 jdk7-b39 From 85ab3e2820d24ec3ebc7c53d884da5f44d7d0aa8 Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena Date: Thu, 6 Nov 2008 12:10:31 -0800 Subject: [PATCH 107/267] Added tag jdk7-b39 for changeset 94a146b4f52a --- jdk/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/.hgtags b/jdk/.hgtags index d9b8755cd4d..8b57d704d5d 100644 --- a/jdk/.hgtags +++ b/jdk/.hgtags @@ -13,3 +13,4 @@ cf4894b78ceb966326e93bf221db0c2d14d59218 jdk7-b35 134fd1a656ea85acd1f97f6700f75029b9b472a0 jdk7-b36 14f50aee4989b75934d385c56a83da0c23d2f68b jdk7-b37 cc5f810b5af8a3a83b0df5a29d9e24d7a0ff8086 jdk7-b38 +4e51997582effa006dde5c6d8b8820b2045b9c7f jdk7-b39 From 803f241db6469f1124e3db1dab56798573b47eda Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena Date: Thu, 6 Nov 2008 12:10:41 -0800 Subject: [PATCH 108/267] Added tag jdk7-b39 for changeset 628049ac53ed --- langtools/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/langtools/.hgtags b/langtools/.hgtags index efee9345fcf..f65d30fbffd 100644 --- a/langtools/.hgtags +++ b/langtools/.hgtags @@ -13,3 +13,4 @@ eaf608c64fecf70f955dc9f29f94c055b183aeec jdk7-b30 258af9b67b7cb4262ab1b5424160c9ad22d52e8f jdk7-b36 24a47c3062fe8869fcfb533ce0ff770c8ceb550d jdk7-b37 3fd42dfa6f27f2767a241fb82bc01a613f0c2096 jdk7-b38 +3fb51e47622bb771571680bc6a7b64c6172b482d jdk7-b39 From 0e63b7609a2aeb27203ccd6b6093bb4d79c8984d Mon Sep 17 00:00:00 2001 From: Chuck Rasbold Date: Thu, 6 Nov 2008 14:59:10 -0800 Subject: [PATCH 109/267] 6743900: frequency based block layout Post-register allocation pass that drives block layout by edge frequencies Reviewed-by: never, kvn --- hotspot/src/share/vm/opto/block.cpp | 610 +++++++++++++++++++++-- hotspot/src/share/vm/opto/block.hpp | 222 ++++++++- hotspot/src/share/vm/opto/c2_globals.hpp | 10 + hotspot/src/share/vm/opto/compile.cpp | 11 +- hotspot/src/share/vm/opto/compile.hpp | 3 + hotspot/src/share/vm/opto/gcm.cpp | 218 ++++++-- hotspot/src/share/vm/opto/output.cpp | 49 +- hotspot/src/share/vm/opto/phase.cpp | 6 +- hotspot/src/share/vm/opto/phase.hpp | 8 +- 9 files changed, 1003 insertions(+), 134 deletions(-) diff --git a/hotspot/src/share/vm/opto/block.cpp b/hotspot/src/share/vm/opto/block.cpp index e74eca8d12c..1de186518d9 100644 --- a/hotspot/src/share/vm/opto/block.cpp +++ b/hotspot/src/share/vm/opto/block.cpp @@ -57,6 +57,14 @@ void Block_List::insert(uint i, Block *b) { _blocks[i] = b; } +#ifndef PRODUCT +void Block_List::print() { + for (uint i=0; i < size(); i++) { + tty->print("B%d ", _blocks[i]->_pre_order); + } + tty->print("size = %d\n", size()); +} +#endif //============================================================================= @@ -66,6 +74,12 @@ uint Block::code_alignment() { // Check for Start block if( _pre_order == 1 ) return InteriorEntryAlignment; // Check for loop alignment + if (has_loop_alignment()) return loop_alignment(); + + return 1; // no particular alignment +} + +uint Block::compute_loop_alignment() { Node *h = head(); if( h->is_Loop() && h->as_Loop()->is_inner_loop() ) { // Pre- and post-loops have low trip count so do not bother with @@ -83,13 +97,15 @@ uint Block::code_alignment() { } return OptoLoopAlignment; // Otherwise align loop head } + return 1; // no particular alignment } //----------------------------------------------------------------------------- // Compute the size of first 'inst_cnt' instructions in this block. // Return the number of instructions left to compute if the block has -// less then 'inst_cnt' instructions. +// less then 'inst_cnt' instructions. Stop, and return 0 if sum_size +// exceeds OptoLoopAlignment. uint Block::compute_first_inst_size(uint& sum_size, uint inst_cnt, PhaseRegAlloc* ra) { uint last_inst = _nodes.size(); @@ -307,6 +323,8 @@ void Block::dump_head( const Block_Array *bbs ) const { tty->print("\tLoop: B%d-B%d ", bhead->_pre_order, bx->_pre_order); // Dump any loop-specific bits, especially for CountedLoops. loop->dump_spec(tty); + } else if (has_loop_alignment()) { + tty->print(" top-of-loop"); } tty->print(" Freq: %g",_freq); if( Verbose || WizardMode ) { @@ -509,9 +527,11 @@ static bool no_flip_branch( Block *b ) { int branch_idx = b->_nodes.size() - b->_num_succs-1; if( branch_idx < 1 ) return false; Node *bra = b->_nodes[branch_idx]; - if( bra->is_Catch() ) return true; + if( bra->is_Catch() ) + return true; if( bra->is_Mach() ) { - if( bra->is_MachNullCheck() ) return true; + if( bra->is_MachNullCheck() ) + return true; int iop = bra->as_Mach()->ideal_Opcode(); if( iop == Op_FastLock || iop == Op_FastUnlock ) return true; @@ -557,10 +577,10 @@ void PhaseCFG::convert_NeverBranch_to_Goto(Block *b) { dead->_nodes[k]->del_req(j); } -//------------------------------MoveToNext------------------------------------- +//------------------------------move_to_next----------------------------------- // Helper function to move block bx to the slot following b_index. Return // true if the move is successful, otherwise false -bool PhaseCFG::MoveToNext(Block* bx, uint b_index) { +bool PhaseCFG::move_to_next(Block* bx, uint b_index) { if (bx == NULL) return false; // Return false if bx is already scheduled. @@ -591,9 +611,9 @@ bool PhaseCFG::MoveToNext(Block* bx, uint b_index) { return true; } -//------------------------------MoveToEnd-------------------------------------- +//------------------------------move_to_end------------------------------------ // Move empty and uncommon blocks to the end. -void PhaseCFG::MoveToEnd(Block *b, uint i) { +void PhaseCFG::move_to_end(Block *b, uint i) { int e = b->is_Empty(); if (e != Block::not_empty) { if (e == Block::empty_with_goto) { @@ -609,15 +629,31 @@ void PhaseCFG::MoveToEnd(Block *b, uint i) { _blocks.push(b); } -//------------------------------RemoveEmpty------------------------------------ -// Remove empty basic blocks and useless branches. -void PhaseCFG::RemoveEmpty() { +//---------------------------set_loop_alignment-------------------------------- +// Set loop alignment for every block +void PhaseCFG::set_loop_alignment() { + uint last = _num_blocks; + assert( _blocks[0] == _broot, "" ); + + for (uint i = 1; i < last; i++ ) { + Block *b = _blocks[i]; + if (b->head()->is_Loop()) { + b->set_loop_alignment(b); + } + } +} + +//-----------------------------remove_empty------------------------------------ +// Make empty basic blocks to be "connector" blocks, Move uncommon blocks +// to the end. +void PhaseCFG::remove_empty() { // Move uncommon blocks to the end uint last = _num_blocks; - uint i; assert( _blocks[0] == _broot, "" ); - for( i = 1; i < last; i++ ) { + + for (uint i = 1; i < last; i++) { Block *b = _blocks[i]; + if (b->is_connector()) break; // Check for NeverBranch at block end. This needs to become a GOTO to the // true target. NeverBranch are treated as a conditional branch that @@ -629,37 +665,40 @@ void PhaseCFG::RemoveEmpty() { convert_NeverBranch_to_Goto(b); // Look for uncommon blocks and move to end. - if( b->is_uncommon(_bbs) ) { - MoveToEnd(b, i); - last--; // No longer check for being uncommon! - if( no_flip_branch(b) ) { // Fall-thru case must follow? - b = _blocks[i]; // Find the fall-thru block - MoveToEnd(b, i); - last--; + if (!C->do_freq_based_layout()) { + if( b->is_uncommon(_bbs) ) { + move_to_end(b, i); + last--; // No longer check for being uncommon! + if( no_flip_branch(b) ) { // Fall-thru case must follow? + b = _blocks[i]; // Find the fall-thru block + move_to_end(b, i); + last--; + } + i--; // backup block counter post-increment } - i--; // backup block counter post-increment } } - // Remove empty blocks - uint j1; + // Move empty blocks to the end last = _num_blocks; - for( i=0; i < last; i++ ) { + for (uint i = 1; i < last; i++) { Block *b = _blocks[i]; - if (i > 0) { - if (b->is_Empty() != Block::not_empty) { - MoveToEnd(b, i); - last--; - i--; - } + if (b->is_Empty() != Block::not_empty) { + move_to_end(b, i); + last--; + i--; } } // End of for all blocks +} +//-----------------------------fixup_flow-------------------------------------- +// Fix up the final control flow for basic blocks. +void PhaseCFG::fixup_flow() { // Fixup final control flow for the blocks. Remove jump-to-next // block. If neither arm of a IF follows the conditional branch, we // have to add a second jump after the conditional. We place the // TRUE branch target in succs[0] for both GOTOs and IFs. - for( i=0; i < _num_blocks; i++ ) { + for (uint i=0; i < _num_blocks; i++) { Block *b = _blocks[i]; b->_pre_order = i; // turn pre-order into block-index @@ -700,7 +739,7 @@ void PhaseCFG::RemoveEmpty() { } } // Remove all CatchProjs - for (j1 = 0; j1 < b->_num_succs; j1++) b->_nodes.pop(); + for (uint j1 = 0; j1 < b->_num_succs; j1++) b->_nodes.pop(); } else if (b->_num_succs == 1) { // Block ends in a Goto? @@ -730,8 +769,7 @@ void PhaseCFG::RemoveEmpty() { // successors after the current one, provided that the // successor was previously unscheduled, but moveable // (i.e., all paths to it involve a branch). - if( bnext != bs0 && bnext != bs1 ) { - + if( !C->do_freq_based_layout() && bnext != bs0 && bnext != bs1 ) { // Choose the more common successor based on the probability // of the conditional branch. Block *bx = bs0; @@ -751,9 +789,9 @@ void PhaseCFG::RemoveEmpty() { } // Attempt the more common successor first - if (MoveToNext(bx, i)) { + if (move_to_next(bx, i)) { bnext = bx; - } else if (MoveToNext(by, i)) { + } else if (move_to_next(by, i)) { bnext = by; } } @@ -774,10 +812,8 @@ void PhaseCFG::RemoveEmpty() { // Flip projection for each target { ProjNode *tmp = proj0; proj0 = proj1; proj1 = tmp; } - } else if( bnext == bs1 ) { // Fall-thru is already in succs[1] - - } else { // Else need a double-branch - + } else if( bnext != bs1 ) { + // Need a double-branch // The existing conditional branch need not change. // Add a unconditional branch to the false target. // Alas, it must appear in its own block and adding a @@ -786,8 +822,9 @@ void PhaseCFG::RemoveEmpty() { } // Make sure we TRUE branch to the target - if( proj0->Opcode() == Op_IfFalse ) + if( proj0->Opcode() == Op_IfFalse ) { iff->negate(); + } b->_nodes.pop(); // Remove IfFalse & IfTrue projections b->_nodes.pop(); @@ -796,9 +833,7 @@ void PhaseCFG::RemoveEmpty() { // Multi-exit block, e.g. a switch statement // But we don't need to do anything here } - } // End of for all blocks - } @@ -905,7 +940,7 @@ void UnionFind::reset( uint max ) { // Force the Union-Find mapping to be at least this large extend(max,0); // Initialize to be the ID mapping. - for( uint i=0; i<_max; i++ ) map(i,i); + for( uint i=0; i= _max ) return idx; uint next = lookup(idx); while( next != idx ) { // Scan chain of equivalences - assert( next < idx, "always union smaller" ); idx = next; // until find a fixed-point next = lookup(idx); } @@ -956,3 +990,491 @@ void UnionFind::Union( uint idx1, uint idx2 ) { assert( src < dst, "always union smaller" ); map(dst,src); } + +#ifndef PRODUCT +static void edge_dump(GrowableArray *edges) { + tty->print_cr("---- Edges ----"); + for (int i = 0; i < edges->length(); i++) { + CFGEdge *e = edges->at(i); + if (e != NULL) { + edges->at(i)->dump(); + } + } +} + +static void trace_dump(Trace *traces[], int count) { + tty->print_cr("---- Traces ----"); + for (int i = 0; i < count; i++) { + Trace *tr = traces[i]; + if (tr != NULL) { + tr->dump(); + } + } +} + +void Trace::dump( ) const { + tty->print_cr("Trace (freq %f)", first_block()->_freq); + for (Block *b = first_block(); b != NULL; b = next(b)) { + tty->print(" B%d", b->_pre_order); + if (b->head()->is_Loop()) { + tty->print(" (L%d)", b->compute_loop_alignment()); + } + if (b->has_loop_alignment()) { + tty->print(" (T%d)", b->code_alignment()); + } + } + tty->cr(); +} + +void CFGEdge::dump( ) const { + tty->print(" B%d --> B%d Freq: %f out:%3d%% in:%3d%% State: ", + from()->_pre_order, to()->_pre_order, freq(), _from_pct, _to_pct); + switch(state()) { + case connected: + tty->print("connected"); + break; + case open: + tty->print("open"); + break; + case interior: + tty->print("interior"); + break; + } + if (infrequent()) { + tty->print(" infrequent"); + } + tty->cr(); +} +#endif + +//============================================================================= + +//------------------------------edge_order------------------------------------- +// Comparison function for edges +static int edge_order(CFGEdge **e0, CFGEdge **e1) { + float freq0 = (*e0)->freq(); + float freq1 = (*e1)->freq(); + if (freq0 != freq1) { + return freq0 > freq1 ? -1 : 1; + } + + int dist0 = (*e0)->to()->_rpo - (*e0)->from()->_rpo; + int dist1 = (*e1)->to()->_rpo - (*e1)->from()->_rpo; + + return dist1 - dist0; +} + +//------------------------------trace_frequency_order-------------------------- +// Comparison function for edges +static int trace_frequency_order(const void *p0, const void *p1) { + Trace *tr0 = *(Trace **) p0; + Trace *tr1 = *(Trace **) p1; + Block *b0 = tr0->first_block(); + Block *b1 = tr1->first_block(); + + // The trace of connector blocks goes at the end; + // we only expect one such trace + if (b0->is_connector() != b1->is_connector()) { + return b1->is_connector() ? -1 : 1; + } + + // Pull more frequently executed blocks to the beginning + float freq0 = b0->_freq; + float freq1 = b1->_freq; + if (freq0 != freq1) { + return freq0 > freq1 ? -1 : 1; + } + + int diff = tr0->first_block()->_rpo - tr1->first_block()->_rpo; + + return diff; +} + +//------------------------------find_edges------------------------------------- +// Find edges of interest, i.e, those which can fall through. Presumes that +// edges which don't fall through are of low frequency and can be generally +// ignored. Initialize the list of traces. +void PhaseBlockLayout::find_edges() +{ + // Walk the blocks, creating edges and Traces + uint i; + Trace *tr = NULL; + for (i = 0; i < _cfg._num_blocks; i++) { + Block *b = _cfg._blocks[i]; + tr = new Trace(b, next, prev); + traces[tr->id()] = tr; + + // All connector blocks should be at the end of the list + if (b->is_connector()) break; + + // If this block and the next one have a one-to-one successor + // predecessor relationship, simply append the next block + int nfallthru = b->num_fall_throughs(); + while (nfallthru == 1 && + b->succ_fall_through(0)) { + Block *n = b->_succs[0]; + + // Skip over single-entry connector blocks, we don't want to + // add them to the trace. + while (n->is_connector() && n->num_preds() == 1) { + n = n->_succs[0]; + } + + // We see a merge point, so stop search for the next block + if (n->num_preds() != 1) break; + + i++; + assert(n = _cfg._blocks[i], "expecting next block"); + tr->append(n); + uf->map(n->_pre_order, tr->id()); + traces[n->_pre_order] = NULL; + nfallthru = b->num_fall_throughs(); + b = n; + } + + if (nfallthru > 0) { + // Create a CFGEdge for each outgoing + // edge that could be a fall-through. + for (uint j = 0; j < b->_num_succs; j++ ) { + if (b->succ_fall_through(j)) { + Block *target = b->non_connector_successor(j); + float freq = b->_freq * b->succ_prob(j); + int from_pct = (int) ((100 * freq) / b->_freq); + int to_pct = (int) ((100 * freq) / target->_freq); + edges->append(new CFGEdge(b, target, freq, from_pct, to_pct)); + } + } + } + } + + // Group connector blocks into one trace + for (i++; i < _cfg._num_blocks; i++) { + Block *b = _cfg._blocks[i]; + assert(b->is_connector(), "connector blocks at the end"); + tr->append(b); + uf->map(b->_pre_order, tr->id()); + traces[b->_pre_order] = NULL; + } +} + +//------------------------------union_traces---------------------------------- +// Union two traces together in uf, and null out the trace in the list +void PhaseBlockLayout::union_traces(Trace* updated_trace, Trace* old_trace) +{ + uint old_id = old_trace->id(); + uint updated_id = updated_trace->id(); + + uint lo_id = updated_id; + uint hi_id = old_id; + + // If from is greater than to, swap values to meet + // UnionFind guarantee. + if (updated_id > old_id) { + lo_id = old_id; + hi_id = updated_id; + + // Fix up the trace ids + traces[lo_id] = traces[updated_id]; + updated_trace->set_id(lo_id); + } + + // Union the lower with the higher and remove the pointer + // to the higher. + uf->Union(lo_id, hi_id); + traces[hi_id] = NULL; +} + +//------------------------------grow_traces------------------------------------- +// Append traces together via the most frequently executed edges +void PhaseBlockLayout::grow_traces() +{ + // Order the edges, and drive the growth of Traces via the most + // frequently executed edges. + edges->sort(edge_order); + for (int i = 0; i < edges->length(); i++) { + CFGEdge *e = edges->at(i); + + if (e->state() != CFGEdge::open) continue; + + Block *src_block = e->from(); + Block *targ_block = e->to(); + + // Don't grow traces along backedges? + if (!BlockLayoutRotateLoops) { + if (targ_block->_rpo <= src_block->_rpo) { + targ_block->set_loop_alignment(targ_block); + continue; + } + } + + Trace *src_trace = trace(src_block); + Trace *targ_trace = trace(targ_block); + + // If the edge in question can join two traces at their ends, + // append one trace to the other. + if (src_trace->last_block() == src_block) { + if (src_trace == targ_trace) { + e->set_state(CFGEdge::interior); + if (targ_trace->backedge(e)) { + // Reset i to catch any newly eligible edge + // (Or we could remember the first "open" edge, and reset there) + i = 0; + } + } else if (targ_trace->first_block() == targ_block) { + e->set_state(CFGEdge::connected); + src_trace->append(targ_trace); + union_traces(src_trace, targ_trace); + } + } + } +} + +//------------------------------merge_traces----------------------------------- +// Embed one trace into another, if the fork or join points are sufficiently +// balanced. +void PhaseBlockLayout::merge_traces(bool fall_thru_only) +{ + // Walk the edge list a another time, looking at unprocessed edges. + // Fold in diamonds + for (int i = 0; i < edges->length(); i++) { + CFGEdge *e = edges->at(i); + + if (e->state() != CFGEdge::open) continue; + if (fall_thru_only) { + if (e->infrequent()) continue; + } + + Block *src_block = e->from(); + Trace *src_trace = trace(src_block); + bool src_at_tail = src_trace->last_block() == src_block; + + Block *targ_block = e->to(); + Trace *targ_trace = trace(targ_block); + bool targ_at_start = targ_trace->first_block() == targ_block; + + if (src_trace == targ_trace) { + // This may be a loop, but we can't do much about it. + e->set_state(CFGEdge::interior); + continue; + } + + if (fall_thru_only) { + // If the edge links the middle of two traces, we can't do anything. + // Mark the edge and continue. + if (!src_at_tail & !targ_at_start) { + continue; + } + + // Don't grow traces along backedges? + if (!BlockLayoutRotateLoops && (targ_block->_rpo <= src_block->_rpo)) { + continue; + } + + // If both ends of the edge are available, why didn't we handle it earlier? + assert(src_at_tail ^ targ_at_start, "Should have caught this edge earlier."); + + if (targ_at_start) { + // Insert the "targ" trace in the "src" trace if the insertion point + // is a two way branch. + // Better profitability check possible, but may not be worth it. + // Someday, see if the this "fork" has an associated "join"; + // then make a policy on merging this trace at the fork or join. + // For example, other things being equal, it may be better to place this + // trace at the join point if the "src" trace ends in a two-way, but + // the insertion point is one-way. + assert(src_block->num_fall_throughs() == 2, "unexpected diamond"); + e->set_state(CFGEdge::connected); + src_trace->insert_after(src_block, targ_trace); + union_traces(src_trace, targ_trace); + } else if (src_at_tail) { + if (src_trace != trace(_cfg._broot)) { + e->set_state(CFGEdge::connected); + targ_trace->insert_before(targ_block, src_trace); + union_traces(targ_trace, src_trace); + } + } + } else if (e->state() == CFGEdge::open) { + // Append traces, even without a fall-thru connection. + // But leave root entry at the begining of the block list. + if (targ_trace != trace(_cfg._broot)) { + e->set_state(CFGEdge::connected); + src_trace->append(targ_trace); + union_traces(src_trace, targ_trace); + } + } + } +} + +//----------------------------reorder_traces----------------------------------- +// Order the sequence of the traces in some desirable way, and fixup the +// jumps at the end of each block. +void PhaseBlockLayout::reorder_traces(int count) +{ + ResourceArea *area = Thread::current()->resource_area(); + Trace ** new_traces = NEW_ARENA_ARRAY(area, Trace *, count); + Block_List worklist; + int new_count = 0; + + // Compact the traces. + for (int i = 0; i < count; i++) { + Trace *tr = traces[i]; + if (tr != NULL) { + new_traces[new_count++] = tr; + } + } + + // The entry block should be first on the new trace list. + Trace *tr = trace(_cfg._broot); + assert(tr == new_traces[0], "entry trace misplaced"); + + // Sort the new trace list by frequency + qsort(new_traces + 1, new_count - 1, sizeof(new_traces[0]), trace_frequency_order); + + // Patch up the successor blocks + _cfg._blocks.reset(); + _cfg._num_blocks = 0; + for (int i = 0; i < new_count; i++) { + Trace *tr = new_traces[i]; + if (tr != NULL) { + tr->fixup_blocks(_cfg); + } + } +} + +//------------------------------PhaseBlockLayout------------------------------- +// Order basic blocks based on frequency +PhaseBlockLayout::PhaseBlockLayout(PhaseCFG &cfg) : + Phase(BlockLayout), + _cfg(cfg) +{ + ResourceMark rm; + ResourceArea *area = Thread::current()->resource_area(); + + // List of traces + int size = _cfg._num_blocks + 1; + traces = NEW_ARENA_ARRAY(area, Trace *, size); + memset(traces, 0, size*sizeof(Trace*)); + next = NEW_ARENA_ARRAY(area, Block *, size); + memset(next, 0, size*sizeof(Block *)); + prev = NEW_ARENA_ARRAY(area, Block *, size); + memset(prev , 0, size*sizeof(Block *)); + + // List of edges + edges = new GrowableArray; + + // Mapping block index --> block_trace + uf = new UnionFind(size); + uf->reset(size); + + // Find edges and create traces. + find_edges(); + + // Grow traces at their ends via most frequent edges. + grow_traces(); + + // Merge one trace into another, but only at fall-through points. + // This may make diamonds and other related shapes in a trace. + merge_traces(true); + + // Run merge again, allowing two traces to be catenated, even if + // one does not fall through into the other. This appends loosely + // related traces to be near each other. + merge_traces(false); + + // Re-order all the remaining traces by frequency + reorder_traces(size); + + assert(_cfg._num_blocks >= (uint) (size - 1), "number of blocks can not shrink"); +} + + +//------------------------------backedge--------------------------------------- +// Edge e completes a loop in a trace. If the target block is head of the +// loop, rotate the loop block so that the loop ends in a conditional branch. +bool Trace::backedge(CFGEdge *e) { + bool loop_rotated = false; + Block *src_block = e->from(); + Block *targ_block = e->to(); + + assert(last_block() == src_block, "loop discovery at back branch"); + if (first_block() == targ_block) { + if (BlockLayoutRotateLoops && last_block()->num_fall_throughs() < 2) { + // Find the last block in the trace that has a conditional + // branch. + Block *b; + for (b = last_block(); b != NULL; b = prev(b)) { + if (b->num_fall_throughs() == 2) { + break; + } + } + + if (b != last_block() && b != NULL) { + loop_rotated = true; + + // Rotate the loop by doing two-part linked-list surgery. + append(first_block()); + break_loop_after(b); + } + } + + // Backbranch to the top of a trace + // Scroll foward through the trace from the targ_block. If we find + // a loop head before another loop top, use the the loop head alignment. + for (Block *b = targ_block; b != NULL; b = next(b)) { + if (b->has_loop_alignment()) { + break; + } + if (b->head()->is_Loop()) { + targ_block = b; + break; + } + } + + first_block()->set_loop_alignment(targ_block); + + } else { + // Backbranch into the middle of a trace + targ_block->set_loop_alignment(targ_block); + } + + return loop_rotated; +} + +//------------------------------fixup_blocks----------------------------------- +// push blocks onto the CFG list +// ensure that blocks have the correct two-way branch sense +void Trace::fixup_blocks(PhaseCFG &cfg) { + Block *last = last_block(); + for (Block *b = first_block(); b != NULL; b = next(b)) { + cfg._blocks.push(b); + cfg._num_blocks++; + if (!b->is_connector()) { + int nfallthru = b->num_fall_throughs(); + if (b != last) { + if (nfallthru == 2) { + // Ensure that the sense of the branch is correct + Block *bnext = next(b); + Block *bs0 = b->non_connector_successor(0); + + MachNode *iff = b->_nodes[b->_nodes.size()-3]->as_Mach(); + ProjNode *proj0 = b->_nodes[b->_nodes.size()-2]->as_Proj(); + ProjNode *proj1 = b->_nodes[b->_nodes.size()-1]->as_Proj(); + + if (bnext == bs0) { + // Fall-thru case in succs[0], should be in succs[1] + + // Flip targets in _succs map + Block *tbs0 = b->_succs[0]; + Block *tbs1 = b->_succs[1]; + b->_succs.map( 0, tbs1 ); + b->_succs.map( 1, tbs0 ); + + // Flip projections to match targets + b->_nodes.map(b->_nodes.size()-2, proj1); + b->_nodes.map(b->_nodes.size()-1, proj0); + } + } + } + } + } +} diff --git a/hotspot/src/share/vm/opto/block.hpp b/hotspot/src/share/vm/opto/block.hpp index 8708a4dedf8..52163809568 100644 --- a/hotspot/src/share/vm/opto/block.hpp +++ b/hotspot/src/share/vm/opto/block.hpp @@ -75,6 +75,7 @@ public: void insert( uint i, Block *n ); uint size() const { return _cnt; } void reset() { _cnt = 0; } + void print(); }; @@ -129,7 +130,11 @@ class Block : public CFGElement { uint _rpo; // Number in reverse post order walk virtual bool is_block() { return true; } - float succ_prob(uint i); // return probability of i'th successor + float succ_prob(uint i); // return probability of i'th successor + int num_fall_throughs(); // How many fall-through candidate this block has + void update_uncommon_branch(Block* un); // Lower branch prob to uncommon code + bool succ_fall_through(uint i); // Is successor "i" is a fall-through candidate + Block* lone_fall_through(); // Return lone fall-through Block or null Block* dom_lca(Block* that); // Compute LCA in dominator tree. #ifdef ASSERT @@ -144,6 +149,7 @@ class Block : public CFGElement { // Report the alignment required by this block. Must be a power of 2. // The previous block will insert nops to get this alignment. uint code_alignment(); + uint compute_loop_alignment(); // BLOCK_FREQUENCY is a sentinel to mark uses of constant block frequencies. // It is currently also used to scale such frequencies relative to @@ -184,11 +190,12 @@ class Block : public CFGElement { int current_alignment = current_offset & max_pad; if( current_alignment != 0 ) { uint padding = (block_alignment-current_alignment) & max_pad; - if( !head()->is_Loop() || - padding <= (uint)MaxLoopPad || - first_inst_size() > padding ) { - return padding; + if( has_loop_alignment() && + padding > (uint)MaxLoopPad && + first_inst_size() <= padding ) { + return 0; } + return padding; } } return 0; @@ -202,6 +209,21 @@ class Block : public CFGElement { void set_connector() { _connector = true; } bool is_connector() const { return _connector; }; + // Loop_alignment will be set for blocks which are at the top of loops. + // The block layout pass may rotate loops such that the loop head may not + // be the sequentially first block of the loop encountered in the linear + // list of blocks. If the layout pass is not run, loop alignment is set + // for each block which is the head of a loop. + uint _loop_alignment; + void set_loop_alignment(Block *loop_top) { + uint new_alignment = loop_top->compute_loop_alignment(); + if (new_alignment > _loop_alignment) { + _loop_alignment = new_alignment; + } + } + uint loop_alignment() const { return _loop_alignment; } + bool has_loop_alignment() const { return loop_alignment() > 0; } + // Create a new Block with given head Node. // Creates the (empty) predecessor arrays. Block( Arena *a, Node *headnode ) @@ -219,7 +241,8 @@ class Block : public CFGElement { _raise_LCA_mark(0), _raise_LCA_visited(0), _first_inst_size(999999), - _connector(false) { + _connector(false), + _loop_alignment(0) { _nodes.push(headnode); } @@ -275,6 +298,16 @@ class Block : public CFGElement { return s; } + // Return true if b is a successor of this block + bool has_successor(Block* b) const { + for (uint i = 0; i < _num_succs; i++ ) { + if (non_connector_successor(i) == b) { + return true; + } + } + return false; + } + // Successor block, after forwarding through connectors Block* non_connector_successor(int i) const { return _succs[i]->non_connector(); @@ -319,7 +352,6 @@ class PhaseCFG : public Phase { // I'll need a few machine-specific GotoNodes. Clone from this one. MachNode *_goto; - void insert_goto_at(uint block_no, uint succ_no); Block* insert_anti_dependences(Block* LCA, Node* load, bool verify = false); void verify_anti_dependences(Block* LCA, Node* load) { @@ -379,10 +411,15 @@ class PhaseCFG : public Phase { // Compute the instruction global latency with a backwards walk void ComputeLatenciesBackwards(VectorSet &visited, Node_List &stack); + // Set loop alignment + void set_loop_alignment(); + // Remove empty basic blocks - void RemoveEmpty(); - bool MoveToNext(Block* bx, uint b_index); - void MoveToEnd(Block* bx, uint b_index); + void remove_empty(); + void fixup_flow(); + bool move_to_next(Block* bx, uint b_index); + void move_to_end(Block* bx, uint b_index); + void insert_goto_at(uint block_no, uint succ_no); // Check for NeverBranch at block end. This needs to become a GOTO to the // true target. NeverBranch are treated as a conditional branch that always @@ -413,7 +450,7 @@ class PhaseCFG : public Phase { }; -//------------------------------UnionFindInfo---------------------------------- +//------------------------------UnionFind-------------------------------------- // Map Block indices to a block-index for a cfg-cover. // Array lookup in the optimized case. class UnionFind : public ResourceObj { @@ -508,3 +545,166 @@ class CFGLoop : public CFGElement { void dump_tree() const; #endif }; + + +//----------------------------------CFGEdge------------------------------------ +// A edge between two basic blocks that will be embodied by a branch or a +// fall-through. +class CFGEdge : public ResourceObj { + private: + Block * _from; // Source basic block + Block * _to; // Destination basic block + float _freq; // Execution frequency (estimate) + int _state; + bool _infrequent; + int _from_pct; + int _to_pct; + + // Private accessors + int from_pct() const { return _from_pct; } + int to_pct() const { return _to_pct; } + int from_infrequent() const { return from_pct() < BlockLayoutMinDiamondPercentage; } + int to_infrequent() const { return to_pct() < BlockLayoutMinDiamondPercentage; } + + public: + enum { + open, // initial edge state; unprocessed + connected, // edge used to connect two traces together + interior // edge is interior to trace (could be backedge) + }; + + CFGEdge(Block *from, Block *to, float freq, int from_pct, int to_pct) : + _from(from), _to(to), _freq(freq), + _from_pct(from_pct), _to_pct(to_pct), _state(open) { + _infrequent = from_infrequent() || to_infrequent(); + } + + float freq() const { return _freq; } + Block* from() const { return _from; } + Block* to () const { return _to; } + int infrequent() const { return _infrequent; } + int state() const { return _state; } + + void set_state(int state) { _state = state; } + +#ifndef PRODUCT + void dump( ) const; +#endif +}; + + +//-----------------------------------Trace------------------------------------- +// An ordered list of basic blocks. +class Trace : public ResourceObj { + private: + uint _id; // Unique Trace id (derived from initial block) + Block ** _next_list; // Array mapping index to next block + Block ** _prev_list; // Array mapping index to previous block + Block * _first; // First block in the trace + Block * _last; // Last block in the trace + + // Return the block that follows "b" in the trace. + Block * next(Block *b) const { return _next_list[b->_pre_order]; } + void set_next(Block *b, Block *n) const { _next_list[b->_pre_order] = n; } + + // Return the block that preceeds "b" in the trace. + Block * prev(Block *b) const { return _prev_list[b->_pre_order]; } + void set_prev(Block *b, Block *p) const { _prev_list[b->_pre_order] = p; } + + // We've discovered a loop in this trace. Reset last to be "b", and first as + // the block following "b + void break_loop_after(Block *b) { + _last = b; + _first = next(b); + set_prev(_first, NULL); + set_next(_last, NULL); + } + + public: + + Trace(Block *b, Block **next_list, Block **prev_list) : + _first(b), + _last(b), + _next_list(next_list), + _prev_list(prev_list), + _id(b->_pre_order) { + set_next(b, NULL); + set_prev(b, NULL); + }; + + // Return the id number + uint id() const { return _id; } + void set_id(uint id) { _id = id; } + + // Return the first block in the trace + Block * first_block() const { return _first; } + + // Return the last block in the trace + Block * last_block() const { return _last; } + + // Insert a trace in the middle of this one after b + void insert_after(Block *b, Trace *tr) { + set_next(tr->last_block(), next(b)); + if (next(b) != NULL) { + set_prev(next(b), tr->last_block()); + } + + set_next(b, tr->first_block()); + set_prev(tr->first_block(), b); + + if (b == _last) { + _last = tr->last_block(); + } + } + + void insert_before(Block *b, Trace *tr) { + Block *p = prev(b); + assert(p != NULL, "use append instead"); + insert_after(p, tr); + } + + // Append another trace to this one. + void append(Trace *tr) { + insert_after(_last, tr); + } + + // Append a block at the end of this trace + void append(Block *b) { + set_next(_last, b); + set_prev(b, _last); + _last = b; + } + + // Adjust the the blocks in this trace + void fixup_blocks(PhaseCFG &cfg); + bool backedge(CFGEdge *e); + +#ifndef PRODUCT + void dump( ) const; +#endif +}; + +//------------------------------PhaseBlockLayout------------------------------- +// Rearrange blocks into some canonical order, based on edges and their frequencies +class PhaseBlockLayout : public Phase { + PhaseCFG &_cfg; // Control flow graph + + GrowableArray *edges; + Trace **traces; + Block **next; + Block **prev; + UnionFind *uf; + + // Given a block, find its encompassing Trace + Trace * trace(Block *b) { + return traces[uf->Find_compress(b->_pre_order)]; + } + public: + PhaseBlockLayout(PhaseCFG &cfg); + + void find_edges(); + void grow_traces(); + void merge_traces(bool loose_connections); + void reorder_traces(int count); + void union_traces(Trace* from, Trace* to); +}; diff --git a/hotspot/src/share/vm/opto/c2_globals.hpp b/hotspot/src/share/vm/opto/c2_globals.hpp index affd56a86e2..ab960fdc8e5 100644 --- a/hotspot/src/share/vm/opto/c2_globals.hpp +++ b/hotspot/src/share/vm/opto/c2_globals.hpp @@ -396,5 +396,15 @@ \ diagnostic(intx, DominatorSearchLimit, 1000, \ "Iterations limit in Node::dominates") \ + \ + product(bool, BlockLayoutByFrequency, true, \ + "Use edge frequencies to drive block ordering") \ + \ + product(intx, BlockLayoutMinDiamondPercentage, 20, \ + "Miniumum %% of a successor (predecessor) for which block layout "\ + "a will allow a fork (join) in a single chain") \ + \ + product(bool, BlockLayoutRotateLoops, false, \ + "Allow back branches to be fall throughs in the block layour") \ C2_FLAGS(DECLARE_DEVELOPER_FLAG, DECLARE_PD_DEVELOPER_FLAG, DECLARE_PRODUCT_FLAG, DECLARE_PD_PRODUCT_FLAG, DECLARE_DIAGNOSTIC_FLAG, DECLARE_NOTPRODUCT_FLAG) diff --git a/hotspot/src/share/vm/opto/compile.cpp b/hotspot/src/share/vm/opto/compile.cpp index 26c2a1d0f41..df1a293f112 100644 --- a/hotspot/src/share/vm/opto/compile.cpp +++ b/hotspot/src/share/vm/opto/compile.cpp @@ -822,6 +822,7 @@ void Compile::Init(int aliaslevel) { Copy::zero_to_bytes(_trap_hist, sizeof(_trap_hist)); set_decompile_count(0); + set_do_freq_based_layout(BlockLayoutByFrequency || method_has_option("BlockLayoutByFrequency")); // Compilation level related initialization if (env()->comp_level() == CompLevel_fast_compile) { set_num_loop_opts(Tier1LoopOptsCount); @@ -1701,8 +1702,14 @@ void Compile::Code_Gen() { // are not adding any new instructions. If any basic block is empty, we // can now safely remove it. { - NOT_PRODUCT( TracePhase t2("removeEmpty", &_t_removeEmptyBlocks, TimeCompiler); ) - cfg.RemoveEmpty(); + NOT_PRODUCT( TracePhase t2("blockOrdering", &_t_blockOrdering, TimeCompiler); ) + cfg.remove_empty(); + if (do_freq_based_layout()) { + PhaseBlockLayout layout(cfg); + } else { + cfg.set_loop_alignment(); + } + cfg.fixup_flow(); } // Perform any platform dependent postallocation verifications. diff --git a/hotspot/src/share/vm/opto/compile.hpp b/hotspot/src/share/vm/opto/compile.hpp index 3310bb99003..dcd6813a893 100644 --- a/hotspot/src/share/vm/opto/compile.hpp +++ b/hotspot/src/share/vm/opto/compile.hpp @@ -154,6 +154,7 @@ class Compile : public Phase { uint _decompile_count; // Cumulative decompilation counts. bool _do_inlining; // True if we intend to do inlining bool _do_scheduling; // True if we intend to do scheduling + bool _do_freq_based_layout; // True if we intend to do frequency based block layout bool _do_count_invocations; // True if we generate code to count invocations bool _do_method_data_update; // True if we generate code to update methodDataOops int _AliasLevel; // Locally-adjusted version of AliasLevel flag. @@ -307,6 +308,8 @@ class Compile : public Phase { void set_do_inlining(bool z) { _do_inlining = z; } bool do_scheduling() const { return _do_scheduling; } void set_do_scheduling(bool z) { _do_scheduling = z; } + bool do_freq_based_layout() const{ return _do_freq_based_layout; } + void set_do_freq_based_layout(bool z){ _do_freq_based_layout = z; } bool do_count_invocations() const{ return _do_count_invocations; } void set_do_count_invocations(bool z){ _do_count_invocations = z; } bool do_method_data_update() const { return _do_method_data_update; } diff --git a/hotspot/src/share/vm/opto/gcm.cpp b/hotspot/src/share/vm/opto/gcm.cpp index b65101197cb..c3d9db916bc 100644 --- a/hotspot/src/share/vm/opto/gcm.cpp +++ b/hotspot/src/share/vm/opto/gcm.cpp @@ -1319,11 +1319,33 @@ void PhaseCFG::GlobalCodeMotion( Matcher &matcher, uint unique, Node_List &proj_ //------------------------------Estimate_Block_Frequency----------------------- // Estimate block frequencies based on IfNode probabilities. void PhaseCFG::Estimate_Block_Frequency() { - int cnts = C->method() ? C->method()->interpreter_invocation_count() : 1; - // Most of our algorithms will die horribly if frequency can become - // negative so make sure cnts is a sane value. - if( cnts <= 0 ) cnts = 1; - float f = (float)cnts/(float)FreqCountInvocations; + + // Force conditional branches leading to uncommon traps to be unlikely, + // not because we get to the uncommon_trap with less relative frequency, + // but because an uncommon_trap typically causes a deopt, so we only get + // there once. + if (C->do_freq_based_layout()) { + Block_List worklist; + Block* root_blk = _blocks[0]; + for (uint i = 1; i < root_blk->num_preds(); i++) { + Block *pb = _bbs[root_blk->pred(i)->_idx]; + if (pb->has_uncommon_code()) { + worklist.push(pb); + } + } + while (worklist.size() > 0) { + Block* uct = worklist.pop(); + if (uct == _broot) continue; + for (uint i = 1; i < uct->num_preds(); i++) { + Block *pb = _bbs[uct->pred(i)->_idx]; + if (pb->_num_succs == 1) { + worklist.push(pb); + } else if (pb->num_fall_throughs() == 2) { + pb->update_uncommon_branch(uct); + } + } + } + } // Create the loop tree and calculate loop depth. _root_loop = create_loop_tree(); @@ -1333,27 +1355,29 @@ void PhaseCFG::Estimate_Block_Frequency() { _root_loop->compute_freq(); // Adjust all frequencies to be relative to a single method entry - _root_loop->_freq = f * 1.0; + _root_loop->_freq = 1.0; _root_loop->scale_freq(); // force paths ending at uncommon traps to be infrequent - Block_List worklist; - Block* root_blk = _blocks[0]; - for (uint i = 0; i < root_blk->num_preds(); i++) { - Block *pb = _bbs[root_blk->pred(i)->_idx]; - if (pb->has_uncommon_code()) { - worklist.push(pb); - } - } - while (worklist.size() > 0) { - Block* uct = worklist.pop(); - uct->_freq = PROB_MIN; - for (uint i = 0; i < uct->num_preds(); i++) { - Block *pb = _bbs[uct->pred(i)->_idx]; - if (pb->_num_succs == 1 && pb->_freq > PROB_MIN) { + if (!C->do_freq_based_layout()) { + Block_List worklist; + Block* root_blk = _blocks[0]; + for (uint i = 1; i < root_blk->num_preds(); i++) { + Block *pb = _bbs[root_blk->pred(i)->_idx]; + if (pb->has_uncommon_code()) { worklist.push(pb); } } + while (worklist.size() > 0) { + Block* uct = worklist.pop(); + uct->_freq = PROB_MIN; + for (uint i = 1; i < uct->num_preds(); i++) { + Block *pb = _bbs[uct->pred(i)->_idx]; + if (pb->_num_succs == 1 && pb->_freq > PROB_MIN) { + worklist.push(pb); + } + } + } } #ifndef PRODUCT @@ -1556,22 +1580,6 @@ void CFGLoop::compute_freq() { } } -#if 0 - // Raise frequency of the loop backedge block, in an effort - // to keep it empty. Skip the method level "loop". - if (_parent != NULL) { - CFGElement* s = _members.at(_members.length() - 1); - if (s->is_block()) { - Block* bk = s->as_Block(); - if (bk->_num_succs == 1 && bk->_succs[0] == hd) { - // almost any value >= 1.0f works - // FIXME: raw constant - bk->_freq = 1.05f; - } - } - } -#endif - // For all loops other than the outer, "method" loop, // sum and normalize the exit probability. The "method" loop // should keep the initial exit probability of 1, so that @@ -1589,12 +1597,15 @@ void CFGLoop::compute_freq() { // the probability of exit per loop entry. for (int i = 0; i < _exits.length(); i++) { Block* et = _exits.at(i).get_target(); - float new_prob = _exits.at(i).get_prob() / exits_sum; + float new_prob = 0.0f; + if (_exits.at(i).get_prob() > 0.0f) { + new_prob = _exits.at(i).get_prob() / exits_sum; + } BlockProbPair bpp(et, new_prob); _exits.at_put(i, bpp); } - // Save the total, but guard against unreasoable probability, + // Save the total, but guard against unreasonable probability, // as the value is used to estimate the loop trip count. // An infinite trip count would blur relative block // frequencies. @@ -1688,6 +1699,137 @@ float Block::succ_prob(uint i) { return 0.0f; } +//------------------------------num_fall_throughs----------------------------- +// Return the number of fall-through candidates for a block +int Block::num_fall_throughs() { + int eidx = end_idx(); + Node *n = _nodes[eidx]; // Get ending Node + + int op = n->Opcode(); + if (n->is_Mach()) { + if (n->is_MachNullCheck()) { + // In theory, either side can fall-thru, for simplicity sake, + // let's say only the false branch can now. + return 1; + } + op = n->as_Mach()->ideal_Opcode(); + } + + // Switch on branch type + switch( op ) { + case Op_CountedLoopEnd: + case Op_If: + return 2; + + case Op_Root: + case Op_Goto: + return 1; + + case Op_Catch: { + for (uint i = 0; i < _num_succs; i++) { + const CatchProjNode *ci = _nodes[i + eidx + 1]->as_CatchProj(); + if (ci->_con == CatchProjNode::fall_through_index) { + return 1; + } + } + return 0; + } + + case Op_Jump: + case Op_NeverBranch: + case Op_TailCall: + case Op_TailJump: + case Op_Return: + case Op_Halt: + case Op_Rethrow: + return 0; + + default: + ShouldNotReachHere(); + } + + return 0; +} + +//------------------------------succ_fall_through----------------------------- +// Return true if a specific successor could be fall-through target. +bool Block::succ_fall_through(uint i) { + int eidx = end_idx(); + Node *n = _nodes[eidx]; // Get ending Node + + int op = n->Opcode(); + if (n->is_Mach()) { + if (n->is_MachNullCheck()) { + // In theory, either side can fall-thru, for simplicity sake, + // let's say only the false branch can now. + return _nodes[i + eidx + 1]->Opcode() == Op_IfFalse; + } + op = n->as_Mach()->ideal_Opcode(); + } + + // Switch on branch type + switch( op ) { + case Op_CountedLoopEnd: + case Op_If: + case Op_Root: + case Op_Goto: + return true; + + case Op_Catch: { + const CatchProjNode *ci = _nodes[i + eidx + 1]->as_CatchProj(); + return ci->_con == CatchProjNode::fall_through_index; + } + + case Op_Jump: + case Op_NeverBranch: + case Op_TailCall: + case Op_TailJump: + case Op_Return: + case Op_Halt: + case Op_Rethrow: + return false; + + default: + ShouldNotReachHere(); + } + + return false; +} + +//------------------------------update_uncommon_branch------------------------ +// Update the probability of a two-branch to be uncommon +void Block::update_uncommon_branch(Block* ub) { + int eidx = end_idx(); + Node *n = _nodes[eidx]; // Get ending Node + + int op = n->as_Mach()->ideal_Opcode(); + + assert(op == Op_CountedLoopEnd || op == Op_If, "must be a If"); + assert(num_fall_throughs() == 2, "must be a two way branch block"); + + // Which successor is ub? + uint s; + for (s = 0; s <_num_succs; s++) { + if (_succs[s] == ub) break; + } + assert(s < 2, "uncommon successor must be found"); + + // If ub is the true path, make the proability small, else + // ub is the false path, and make the probability large + bool invert = (_nodes[s + eidx + 1]->Opcode() == Op_IfFalse); + + // Get existing probability + float p = n->as_MachIf()->_prob; + + if (invert) p = 1.0 - p; + if (p > PROB_MIN) { + p = PROB_MIN; + } + if (invert) p = 1.0 - p; + + n->as_MachIf()->_prob = p; +} + //------------------------------update_succ_freq------------------------------- // Update the appropriate frequency associated with block 'b', a succesor of // a block in this loop. diff --git a/hotspot/src/share/vm/opto/output.cpp b/hotspot/src/share/vm/opto/output.cpp index d6cfb0d94ff..604ab7536ad 100644 --- a/hotspot/src/share/vm/opto/output.cpp +++ b/hotspot/src/share/vm/opto/output.cpp @@ -263,7 +263,7 @@ bool Compile::is_node_getting_a_safepoint( Node* n) { # endif // ENABLE_ZAP_DEAD_LOCALS //------------------------------compute_loop_first_inst_sizes------------------ -// Compute the size of first NumberOfLoopInstrToAlign instructions at head +// Compute the size of first NumberOfLoopInstrToAlign instructions at the top // of a loop. When aligning a loop we need to provide enough instructions // in cpu's fetch buffer to feed decoders. The loop alignment could be // avoided if we have enough instructions in fetch buffer at the head of a loop. @@ -284,34 +284,23 @@ void Compile::compute_loop_first_inst_sizes() { for( uint i=1; i <= last_block; i++ ) { Block *b = _cfg->_blocks[i]; // Check the first loop's block which requires an alignment. - if( b->head()->is_Loop() && - b->code_alignment() > (uint)relocInfo::addr_unit() ) { + if( b->loop_alignment() > (uint)relocInfo::addr_unit() ) { uint sum_size = 0; uint inst_cnt = NumberOfLoopInstrToAlign; - inst_cnt = b->compute_first_inst_size(sum_size, inst_cnt, - _regalloc); - // Check the next fallthrough block if first loop's block does not have - // enough instructions. - if( inst_cnt > 0 && i < last_block ) { - // First, check if the first loop's block contains whole loop. - // LoopNode::LoopBackControl == 2. - Block *bx = _cfg->_bbs[b->pred(2)->_idx]; - // Skip connector blocks (with limit in case of irreducible loops). - int search_limit = 16; - while( bx->is_connector() && search_limit-- > 0) { - bx = _cfg->_bbs[bx->pred(1)->_idx]; - } - if( bx != b ) { // loop body is in several blocks. - Block *nb = NULL; - while( inst_cnt > 0 && i < last_block && nb != bx && - !_cfg->_blocks[i+1]->head()->is_Loop() ) { - i++; - nb = _cfg->_blocks[i]; - inst_cnt = nb->compute_first_inst_size(sum_size, inst_cnt, - _regalloc); - } // while( inst_cnt > 0 && i < last_block ) - } // if( bx != b ) - } // if( inst_cnt > 0 && i < last_block ) + inst_cnt = b->compute_first_inst_size(sum_size, inst_cnt, _regalloc); + + // Check subsequent fallthrough blocks if the loop's first + // block(s) does not have enough instructions. + Block *nb = b; + while( inst_cnt > 0 && + i < last_block && + !_cfg->_blocks[i+1]->has_loop_alignment() && + !nb->has_successor(b) ) { + i++; + nb = _cfg->_blocks[i]; + inst_cnt = nb->compute_first_inst_size(sum_size, inst_cnt, _regalloc); + } // while( inst_cnt > 0 && i < last_block ) + b->set_first_inst_size(sum_size); } // f( b->head()->is_Loop() ) } // for( i <= last_block ) @@ -512,7 +501,7 @@ void Compile::Shorten_branches(Label *labels, int& code_size, int& reloc_size, i // Get the size of the block uint blk_size = adr - blk_starts[i]; - // When the next block starts a loop, we may insert pad NOP + // When the next block is the top of a loop, we may insert pad NOP // instructions. Block *nb = _cfg->_blocks[i+1]; int current_offset = blk_starts[i] + blk_size; @@ -1382,8 +1371,8 @@ void Compile::Fill_buffer() { } // End for all instructions in block - // If the next block _starts_ a loop, pad this block out to align - // the loop start a little. Helps prevent pipe stalls at loop starts + // If the next block is the top of a loop, pad this block out to align + // the loop top a little. Helps prevent pipe stalls at loop back branches. int nop_size = (new (this) MachNopNode())->size(_regalloc); if( i<_cfg->_num_blocks-1 ) { Block *nb = _cfg->_blocks[i+1]; diff --git a/hotspot/src/share/vm/opto/phase.cpp b/hotspot/src/share/vm/opto/phase.cpp index 5e046dab061..8bed29122f0 100644 --- a/hotspot/src/share/vm/opto/phase.cpp +++ b/hotspot/src/share/vm/opto/phase.cpp @@ -46,7 +46,7 @@ elapsedTimer Phase::_t_output; #ifndef PRODUCT elapsedTimer Phase::_t_graphReshaping; elapsedTimer Phase::_t_scheduler; -elapsedTimer Phase::_t_removeEmptyBlocks; +elapsedTimer Phase::_t_blockOrdering; elapsedTimer Phase::_t_macroExpand; elapsedTimer Phase::_t_peephole; elapsedTimer Phase::_t_codeGeneration; @@ -128,7 +128,7 @@ void Phase::print_timers() { tty->print_cr (" subtotal : %3.3f sec, %3.2f %%", regalloc_subtotal, percent_of_regalloc); } tty->print_cr (" macroExpand : %3.3f sec", Phase::_t_macroExpand.seconds()); - tty->print_cr (" removeEmpty : %3.3f sec", Phase::_t_removeEmptyBlocks.seconds()); + tty->print_cr (" blockOrdering: %3.3f sec", Phase::_t_blockOrdering.seconds()); tty->print_cr (" peephole : %3.3f sec", Phase::_t_peephole.seconds()); tty->print_cr (" codeGen : %3.3f sec", Phase::_t_codeGeneration.seconds()); tty->print_cr (" install_code : %3.3f sec", Phase::_t_registerMethod.seconds()); @@ -137,7 +137,7 @@ void Phase::print_timers() { (DoEscapeAnalysis ? Phase::_t_escapeAnalysis.seconds() : 0.0) + Phase::_t_optimizer.seconds() + Phase::_t_graphReshaping.seconds() + Phase::_t_matcher.seconds() + Phase::_t_scheduler.seconds() + - Phase::_t_registerAllocation.seconds() + Phase::_t_removeEmptyBlocks.seconds() + + Phase::_t_registerAllocation.seconds() + Phase::_t_blockOrdering.seconds() + Phase::_t_macroExpand.seconds() + Phase::_t_peephole.seconds() + Phase::_t_codeGeneration.seconds() + Phase::_t_registerMethod.seconds(); double percent_of_method_compile = ((phase_subtotal == 0.0) ? 0.0 : phase_subtotal / Phase::_t_methodCompilation.seconds()) * 100.0; diff --git a/hotspot/src/share/vm/opto/phase.hpp b/hotspot/src/share/vm/opto/phase.hpp index bee7dfef70d..788f07acc71 100644 --- a/hotspot/src/share/vm/opto/phase.hpp +++ b/hotspot/src/share/vm/opto/phase.hpp @@ -40,16 +40,12 @@ public: Optimistic, // Optimistic analysis phase GVN, // Pessimistic global value numbering phase Ins_Select, // Instruction selection phase - Copy_Elimination, // Copy Elimination - Dead_Code_Elimination, // DCE and compress Nodes - Conditional_Constant, // Conditional Constant Propagation CFG, // Build a CFG - DefUse, // Build Def->Use chains + BlockLayout, // Linear ordering of blocks Register_Allocation, // Register allocation, duh LIVE, // Dragon-book LIVE range problem Interference_Graph, // Building the IFG Coalesce, // Coalescing copies - Conditional_CProp, // Conditional Constant Propagation Ideal_Loop, // Find idealized trip-counted loops Macro_Expand, // Expand macro nodes Peephole, // Apply peephole optimizations @@ -80,7 +76,7 @@ protected: #ifndef PRODUCT static elapsedTimer _t_graphReshaping; static elapsedTimer _t_scheduler; - static elapsedTimer _t_removeEmptyBlocks; + static elapsedTimer _t_blockOrdering; static elapsedTimer _t_macroExpand; static elapsedTimer _t_peephole; static elapsedTimer _t_codeGeneration; From 2c3b8ec969df8b2c733e6126a72bc1a64dc36560 Mon Sep 17 00:00:00 2001 From: Tom Rodriguez Date: Thu, 6 Nov 2008 20:00:03 -0800 Subject: [PATCH 110/267] 6761594: framesize rounding code rounds using wrong units leading to slightly oversized frames Reviewed-by: rasbold, kvn --- hotspot/src/share/vm/opto/chaitin.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hotspot/src/share/vm/opto/chaitin.cpp b/hotspot/src/share/vm/opto/chaitin.cpp index 74a0fce9014..0456db5dc11 100644 --- a/hotspot/src/share/vm/opto/chaitin.cpp +++ b/hotspot/src/share/vm/opto/chaitin.cpp @@ -440,9 +440,7 @@ void PhaseChaitin::Register_Allocate() { assert((int)(_matcher._new_SP+_framesize) >= (int)_matcher._out_arg_limit, "framesize must be large enough"); // This frame must preserve the required fp alignment - const int stack_alignment_in_words = Matcher::stack_alignment_in_slots(); - if (stack_alignment_in_words > 0) - _framesize = round_to(_framesize, Matcher::stack_alignment_in_bytes()); + _framesize = round_to(_framesize, Matcher::stack_alignment_in_slots()); assert( _framesize >= 0 && _framesize <= 1000000, "sanity check" ); #ifndef PRODUCT _total_framesize += _framesize; From ab227cb6710d61179ffbc13c20d0ecbd339f8491 Mon Sep 17 00:00:00 2001 From: Eamonn McManus Date: Fri, 7 Nov 2008 11:48:07 +0100 Subject: [PATCH 111/267] 5072267: A way to communicate client context such as locale to the JMX server Support for client contexts and also for localization of descriptions Reviewed-by: dfuchs --- .../com/sun/jmx/defaults/ServiceName.java | 4 +- .../com/sun/jmx/event/EventParams.java | 2 +- .../com/sun/jmx/event/LeaseManager.java | 6 +- .../jmx/interceptor/SingleMBeanForwarder.java | 52 +- .../sun/jmx/mbeanserver/JmxMBeanServer.java | 4 +- .../sun/jmx/namespace/JMXNamespaceUtils.java | 354 ------ .../sun/jmx/namespace/ObjectNameRouter.java | 7 - .../jmx/namespace/RoutingConnectionProxy.java | 33 +- .../com/sun/jmx/namespace/RoutingProxy.java | 72 +- .../sun/jmx/namespace/RoutingServerProxy.java | 30 +- .../remote/util/EventClientConnection.java | 4 +- .../javax/management/ClientContext.java | 1091 +++++++++++++++++ .../classes/javax/management/Descriptor.java | 32 +- .../share/classes/javax/management/JMX.java | 32 +- .../classes/javax/management/MBeanInfo.java | 384 ++++++ .../management/MBeanServerNotification.java | 38 +- .../javax/management/Notification.java | 44 +- .../javax/management/event/EventClient.java | 56 +- .../management/event/EventClientDelegate.java | 58 +- .../event/EventClientDelegateMBean.java | 7 +- .../javax/management/event/EventRelay.java | 1 - .../javax/management/event/package-info.java | 4 +- .../management/namespace/JMXNamespaces.java | 40 +- .../namespace/JMXRemoteNamespace.java | 249 ++-- .../remote/JMXConnectorFactory.java | 19 +- .../management/remote/JMXConnectorServer.java | 384 +++--- .../remote/JMXConnectorServerMBean.java | 4 +- .../management/remote/rmi/RMIConnector.java | 924 +++++++------- .../remote/rmi/RMIConnectorServer.java | 32 +- .../Introspector/AnnotationTest.java | 321 +++-- .../context/ContextForwarderTest.java | 103 ++ .../javax/management/context/ContextTest.java | 534 ++++++++ .../context/LocaleAwareBroadcasterTest.java | 328 +++++ .../javax/management/context/LocaleTest.java | 140 +++ .../management/context/LocalizableTest.java | 192 +++ .../management/context/RemoteContextTest.java | 496 ++++++++ .../localizable/MBeanDescriptions.properties | 9 + .../localizable/MBeanDescriptions_fr.java | 42 + .../context/localizable/Whatsit.java | 59 + .../context/localizable/WhatsitMBean.java | 53 + .../eventService/CustomForwarderTest.java | 3 +- .../eventService/EventClientExecutorTest.java | 3 +- .../eventService/EventManagerTest.java | 2 +- .../management/eventService/ListenerTest.java | 2 +- .../NotSerializableNotifTest.java | 2 +- .../eventService/UsingEventService.java | 23 + .../EventWithNamespaceControlTest.java | 1 + .../namespace/JMXNamespaceSecurityTest.java | 1 + .../namespace/JMXNamespaceViewTest.java | 6 +- .../namespace/JMXRemoteTargetNamespace.java | 22 +- .../namespace/NamespaceNotificationsTest.java | 16 +- .../namespace/NullDomainObjectNameTest.java | 2 +- .../namespace/NullObjectNameTest.java | 2 +- .../openmbean/CompositeDataStringTest.java | 8 +- .../connectorServer/ForwarderChainTest.java | 31 +- .../StandardForwardersTest.java | 28 +- .../mandatory/provider/ProviderTest.java | 12 +- .../subjectDelegation/SimpleStandard.java | 14 +- 58 files changed, 4875 insertions(+), 1547 deletions(-) delete mode 100644 jdk/src/share/classes/com/sun/jmx/namespace/JMXNamespaceUtils.java create mode 100644 jdk/src/share/classes/javax/management/ClientContext.java create mode 100644 jdk/test/javax/management/context/ContextForwarderTest.java create mode 100644 jdk/test/javax/management/context/ContextTest.java create mode 100644 jdk/test/javax/management/context/LocaleAwareBroadcasterTest.java create mode 100644 jdk/test/javax/management/context/LocaleTest.java create mode 100644 jdk/test/javax/management/context/LocalizableTest.java create mode 100644 jdk/test/javax/management/context/RemoteContextTest.java create mode 100644 jdk/test/javax/management/context/localizable/MBeanDescriptions.properties create mode 100644 jdk/test/javax/management/context/localizable/MBeanDescriptions_fr.java create mode 100644 jdk/test/javax/management/context/localizable/Whatsit.java create mode 100644 jdk/test/javax/management/context/localizable/WhatsitMBean.java diff --git a/jdk/src/share/classes/com/sun/jmx/defaults/ServiceName.java b/jdk/src/share/classes/com/sun/jmx/defaults/ServiceName.java index f70730b8d21..a01ea89e258 100644 --- a/jdk/src/share/classes/com/sun/jmx/defaults/ServiceName.java +++ b/jdk/src/share/classes/com/sun/jmx/defaults/ServiceName.java @@ -69,9 +69,9 @@ public class ServiceName { /** * The version of the JMX specification implemented by this product. *
    - * The value is 1.4. + * The value is 2.0. */ - public static final String JMX_SPEC_VERSION = "1.4"; + public static final String JMX_SPEC_VERSION = "2.0"; /** * The vendor of the JMX specification implemented by this product. diff --git a/jdk/src/share/classes/com/sun/jmx/event/EventParams.java b/jdk/src/share/classes/com/sun/jmx/event/EventParams.java index 7d875e1385b..c0e76634cbd 100644 --- a/jdk/src/share/classes/com/sun/jmx/event/EventParams.java +++ b/jdk/src/share/classes/com/sun/jmx/event/EventParams.java @@ -41,7 +41,7 @@ public class EventParams { @SuppressWarnings("cast") // cast for jdk 1.5 public static long getLeaseTimeout() { - long timeout = EventClient.DEFAULT_LEASE_TIMEOUT; + long timeout = EventClient.DEFAULT_REQUESTED_LEASE_TIME; try { final GetPropertyAction act = new GetPropertyAction(DEFAULT_LEASE_TIMEOUT); diff --git a/jdk/src/share/classes/com/sun/jmx/event/LeaseManager.java b/jdk/src/share/classes/com/sun/jmx/event/LeaseManager.java index 09a7a03a42d..2db6fea146b 100644 --- a/jdk/src/share/classes/com/sun/jmx/event/LeaseManager.java +++ b/jdk/src/share/classes/com/sun/jmx/event/LeaseManager.java @@ -29,6 +29,7 @@ import com.sun.jmx.remote.util.ClassLogger; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; /** @@ -143,9 +144,10 @@ public class LeaseManager { private final Runnable callback; private ScheduledFuture scheduled; // If null, the lease has expired. + private static final ThreadFactory threadFactory = + new DaemonThreadFactory("JMX LeaseManager %d"); private final ScheduledExecutorService executor - = Executors.newScheduledThreadPool(1, - new DaemonThreadFactory("JMX LeaseManager %d")); + = Executors.newScheduledThreadPool(1, threadFactory); private static final ClassLogger logger = new ClassLogger("javax.management.event", "LeaseManager"); diff --git a/jdk/src/share/classes/com/sun/jmx/interceptor/SingleMBeanForwarder.java b/jdk/src/share/classes/com/sun/jmx/interceptor/SingleMBeanForwarder.java index 4a47d4ce3aa..cfb40092557 100644 --- a/jdk/src/share/classes/com/sun/jmx/interceptor/SingleMBeanForwarder.java +++ b/jdk/src/share/classes/com/sun/jmx/interceptor/SingleMBeanForwarder.java @@ -55,9 +55,19 @@ import javax.management.namespace.JMXNamespaces; import javax.management.namespace.MBeanServerSupport; import javax.management.remote.IdentityMBeanServerForwarder; +/** + *

    An {@link MBeanServerForwarder} that simulates the existence of a + * given MBean. Requests for that MBean, call it X, are intercepted by the + * forwarder, and requests for any other MBean are forwarded to the next + * forwarder in the chain. Requests such as queryNames which can span both the + * X and other MBeans are handled by merging the results for X with the results + * from the next forwarder, unless the "visible" parameter is false, in which + * case X is invisible to such requests.

    + */ public class SingleMBeanForwarder extends IdentityMBeanServerForwarder { private final ObjectName mbeanName; + private final boolean visible; private DynamicMBean mbean; private MBeanServer mbeanMBS = new MBeanServerSupport() { @@ -85,10 +95,20 @@ public class SingleMBeanForwarder extends IdentityMBeanServerForwarder { return null; } + // This will only be called if mbeanName has an empty domain. + // In that case a getAttribute (e.g.) of that name will have the + // domain replaced by MBeanServerSupport with the default domain, + // so we must be sure that the default domain is empty too. + @Override + public String getDefaultDomain() { + return mbeanName.getDomain(); + } }; - public SingleMBeanForwarder(ObjectName mbeanName, DynamicMBean mbean) { + public SingleMBeanForwarder( + ObjectName mbeanName, DynamicMBean mbean, boolean visible) { this.mbeanName = mbeanName; + this.visible = visible; setSingleMBean(mbean); } @@ -213,8 +233,10 @@ public class SingleMBeanForwarder extends IdentityMBeanServerForwarder { @Override public String[] getDomains() { - TreeSet domainSet = - new TreeSet(Arrays.asList(super.getDomains())); + String[] domains = super.getDomains(); + if (!visible) + return domains; + TreeSet domainSet = new TreeSet(Arrays.asList(domains)); domainSet.add(mbeanName.getDomain()); return domainSet.toArray(new String[domainSet.size()]); } @@ -222,7 +244,7 @@ public class SingleMBeanForwarder extends IdentityMBeanServerForwarder { @Override public Integer getMBeanCount() { Integer count = super.getMBeanCount(); - if (!super.isRegistered(mbeanName)) + if (visible && !super.isRegistered(mbeanName)) count++; return count; } @@ -284,7 +306,7 @@ public class SingleMBeanForwarder extends IdentityMBeanServerForwarder { */ private boolean applies(ObjectName pattern) { // we know pattern is not null. - if (!pattern.apply(mbeanName)) + if (!visible || !pattern.apply(mbeanName)) return false; final String dompat = pattern.getDomain(); @@ -306,10 +328,12 @@ public class SingleMBeanForwarder extends IdentityMBeanServerForwarder { @Override public Set queryMBeans(ObjectName name, QueryExp query) { Set names = super.queryMBeans(name, query); - if (name == null || applies(name) ) { - // Don't assume mbs.queryNames returns a writable set. - names = Util.cloneSet(names); - names.addAll(mbeanMBS.queryMBeans(name, query)); + if (visible) { + if (name == null || applies(name) ) { + // Don't assume mbs.queryNames returns a writable set. + names = Util.cloneSet(names); + names.addAll(mbeanMBS.queryMBeans(name, query)); + } } return names; } @@ -317,10 +341,12 @@ public class SingleMBeanForwarder extends IdentityMBeanServerForwarder { @Override public Set queryNames(ObjectName name, QueryExp query) { Set names = super.queryNames(name, query); - if (name == null || applies(name)) { - // Don't assume mbs.queryNames returns a writable set. - names = Util.cloneSet(names); - names.addAll(mbeanMBS.queryNames(name, query)); + if (visible) { + if (name == null || applies(name)) { + // Don't assume mbs.queryNames returns a writable set. + names = Util.cloneSet(names); + names.addAll(mbeanMBS.queryNames(name, query)); + } } return names; } diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/JmxMBeanServer.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/JmxMBeanServer.java index 14ee0ac5279..4fc25e91278 100644 --- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/JmxMBeanServer.java +++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/JmxMBeanServer.java @@ -122,7 +122,7 @@ public final class JmxMBeanServer * {@link javax.management.MBeanServerFactory#newMBeanServer(java.lang.String)} * instead. *

    - * By default, {@link MBeanServerInterceptor} are disabled. Use + * By default, interceptors are disabled. Use * {@link #JmxMBeanServer(java.lang.String,javax.management.MBeanServer,javax.management.MBeanServerDelegate,boolean)} to enable them. * * @param domain The default domain name used by this MBeanServer. @@ -239,7 +239,7 @@ public final class JmxMBeanServer this.mBeanServerDelegateObject = delegate; this.outerShell = outer; - final Repository repository = new Repository(domain,fairLock); + final Repository repository = new Repository(domain); this.mbsInterceptor = new NamespaceDispatchInterceptor(outer, delegate, instantiator, repository); diff --git a/jdk/src/share/classes/com/sun/jmx/namespace/JMXNamespaceUtils.java b/jdk/src/share/classes/com/sun/jmx/namespace/JMXNamespaceUtils.java deleted file mode 100644 index 49f875144f2..00000000000 --- a/jdk/src/share/classes/com/sun/jmx/namespace/JMXNamespaceUtils.java +++ /dev/null @@ -1,354 +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 com.sun.jmx.namespace; - -import com.sun.jmx.defaults.JmxProperties; - -import java.io.IOException; -import java.util.Collections; -import java.util.Map; -import java.util.WeakHashMap; -import java.util.logging.Level; -import java.util.logging.Logger; - -import javax.management.ListenerNotFoundException; -import javax.management.MBeanServerConnection; -import javax.management.NotificationFilter; -import javax.management.NotificationListener; -import javax.management.event.EventClient; -import javax.management.event.EventClientDelegateMBean; -import javax.management.namespace.JMXNamespace; -import javax.management.namespace.JMXNamespaces; -import javax.management.remote.JMXAddressable; -import javax.management.remote.JMXConnector; -import javax.management.remote.JMXServiceURL; -import javax.security.auth.Subject; - -/** - * A collection of methods that provide JMXConnector wrappers for - * JMXRemoteNamepaces underlying connectors. - *

    - * This API is a Sun internal API and is subject to changes without notice. - *

    - * @since 1.7 - */ -public final class JMXNamespaceUtils { - - /** - * A logger for this class. - **/ - private static final Logger LOG = JmxProperties.NAMESPACE_LOGGER; - - - private static Map newWeakHashMap() { - return new WeakHashMap(); - } - - /** There are no instances of this class */ - private JMXNamespaceUtils() { - } - - // returns un unmodifiable view of a map. - public static Map unmodifiableMap(Map aMap) { - if (aMap == null || aMap.isEmpty()) - return Collections.emptyMap(); - return Collections.unmodifiableMap(aMap); - } - - - /** - * A base class that helps writing JMXConnectors that return - * MBeanServerConnection wrappers. - * This base class wraps an inner JMXConnector (the source), and preserve - * its caching policy. If a connection is cached in the source, its wrapper - * will be cached in this connector too. - * Author's note: rewriting this with java.lang.reflect.Proxy could be - * envisaged. It would avoid the combinatory sub-classing introduced by - * JMXAddressable. - *

    - * Note: all the standard JMXConnector implementations are serializable. - * This implementation here is not. Should it be? - * I believe it must not be serializable unless it becomes - * part of a public API (either standard or officially exposed - * and supported in a documented com.sun package) - **/ - static class JMXCachingConnector - implements JMXConnector { - - // private static final long serialVersionUID = -2279076110599707875L; - - final JMXConnector source; - - // if this object is made serializable, then the variable below - // needs to become volatile transient and be lazyly-created... - private final - Map connectionMap; - - - public JMXCachingConnector(JMXConnector source) { - this.source = checkNonNull(source, "source"); - connectionMap = newWeakHashMap(); - } - - private MBeanServerConnection - getCached(MBeanServerConnection inner) { - return connectionMap.get(inner); - } - - private MBeanServerConnection putCached(final MBeanServerConnection inner, - final MBeanServerConnection wrapper) { - if (inner == wrapper) return wrapper; - synchronized (this) { - final MBeanServerConnection concurrent = - connectionMap.get(inner); - if (concurrent != null) return concurrent; - connectionMap.put(inner,wrapper); - } - return wrapper; - } - - public void addConnectionNotificationListener(NotificationListener - listener, NotificationFilter filter, Object handback) { - source.addConnectionNotificationListener(listener,filter,handback); - } - - public void close() throws IOException { - source.close(); - } - - public void connect() throws IOException { - source.connect(); - } - - public void connect(Map env) throws IOException { - source.connect(env); - } - - public String getConnectionId() throws IOException { - return source.getConnectionId(); - } - - /** - * Preserve caching policy of the underlying connector. - **/ - public MBeanServerConnection - getMBeanServerConnection() throws IOException { - final MBeanServerConnection inner = - source.getMBeanServerConnection(); - final MBeanServerConnection cached = getCached(inner); - if (cached != null) return cached; - final MBeanServerConnection wrapper = wrap(inner); - return putCached(inner,wrapper); - } - - public MBeanServerConnection - getMBeanServerConnection(Subject delegationSubject) - throws IOException { - final MBeanServerConnection wrapped = - source.getMBeanServerConnection(delegationSubject); - synchronized (this) { - final MBeanServerConnection cached = getCached(wrapped); - if (cached != null) return cached; - final MBeanServerConnection wrapper = - wrapWithSubject(wrapped,delegationSubject); - return putCached(wrapped,wrapper); - } - } - - public void removeConnectionNotificationListener( - NotificationListener listener) - throws ListenerNotFoundException { - source.removeConnectionNotificationListener(listener); - } - - public void removeConnectionNotificationListener( - NotificationListener l, NotificationFilter f, - Object handback) throws ListenerNotFoundException { - source.removeConnectionNotificationListener(l,f,handback); - } - - /** - * This is the method that subclass will redefine. This method - * is called by {@code this.getMBeanServerConnection()}. - * {@code inner} is the connection returned by - * {@code source.getMBeanServerConnection()}. - **/ - protected MBeanServerConnection wrap(MBeanServerConnection inner) - throws IOException { - return inner; - } - - /** - * Subclass may also want to redefine this method. - * By default it calls wrap(inner). This method - * is called by {@code this.getMBeanServerConnection(Subject)}. - * {@code inner} is the connection returned by - * {@code source.getMBeanServerConnection(Subject)}. - **/ - protected MBeanServerConnection wrapWithSubject( - MBeanServerConnection inner, Subject delegationSubject) - throws IOException { - return wrap(inner); - } - - @Override - public String toString() { - if (source instanceof JMXAddressable) { - final JMXServiceURL address = - ((JMXAddressable)source).getAddress(); - if (address != null) - return address.toString(); - } - return source.toString(); - } - - } - - - /** - * The name space connector can do 'cd' - **/ - static class JMXNamespaceConnector extends JMXCachingConnector { - - // private static final long serialVersionUID = -4813611540843020867L; - - private final String toDir; - private final boolean closeable; - - public JMXNamespaceConnector(JMXConnector source, String toDir, - boolean closeable) { - super(source); - this.toDir = toDir; - this.closeable = closeable; - } - - @Override - public void close() throws IOException { - if (!closeable) - throw new UnsupportedOperationException("close"); - else super.close(); - } - - @Override - protected MBeanServerConnection wrap(MBeanServerConnection wrapped) - throws IOException { - if (LOG.isLoggable(Level.FINER)) - LOG.finer("Creating name space proxy connection for source: "+ - "namespace="+toDir); - return JMXNamespaces.narrowToNamespace(wrapped,toDir); - } - - @Override - public String toString() { - return "JMXNamespaces.narrowToNamespace("+ - super.toString()+ - ", \""+toDir+"\")"; - } - - } - - static class JMXEventConnector extends JMXCachingConnector { - - // private static final long serialVersionUID = 4742659236340242785L; - - JMXEventConnector(JMXConnector wrapped) { - super(wrapped); - } - - @Override - protected MBeanServerConnection wrap(MBeanServerConnection inner) - throws IOException { - return EventClient.getEventClientConnection(inner); - } - - - @Override - public String toString() { - return "EventClient.withEventClient("+super.toString()+")"; - } - } - - static class JMXAddressableEventConnector extends JMXEventConnector - implements JMXAddressable { - - // private static final long serialVersionUID = -9128520234812124712L; - - JMXAddressableEventConnector(JMXConnector wrapped) { - super(wrapped); - } - - public JMXServiceURL getAddress() { - return ((JMXAddressable)source).getAddress(); - } - } - - /** - * Creates a connector whose MBeamServerConnection will point to the - * given sub name space inside the source connector. - * @see JMXNamespace - **/ - public static JMXConnector cd(final JMXConnector source, - final String toNamespace, - final boolean closeable) - throws IOException { - - checkNonNull(source, "JMXConnector"); - - if (toNamespace == null || toNamespace.equals("")) - return source; - - return new JMXNamespaceConnector(source,toNamespace,closeable); - } - - - /** - * Returns a JMX Connector that will use an {@link EventClient} - * to subscribe for notifications. If the server doesn't have - * an {@link EventClientDelegateMBean}, then the connector will - * use the legacy notification mechanism instead. - * - * @param source The underlying JMX Connector wrapped by the returned - * connector. - * @return A JMX Connector that will uses an {@link EventClient}, if - * available. - * @see EventClient#getEventClientConnection(MBeanServerConnection) - */ - public static JMXConnector withEventClient(final JMXConnector source) { - checkNonNull(source, "JMXConnector"); - if (source instanceof JMXAddressable) - return new JMXAddressableEventConnector(source); - else - return new JMXEventConnector(source); - } - - public static T checkNonNull(T parameter, String name) { - if (parameter == null) - throw new IllegalArgumentException(name+" must not be null"); - return parameter; - } - - -} diff --git a/jdk/src/share/classes/com/sun/jmx/namespace/ObjectNameRouter.java b/jdk/src/share/classes/com/sun/jmx/namespace/ObjectNameRouter.java index 3c7065c478e..7d668169fc7 100644 --- a/jdk/src/share/classes/com/sun/jmx/namespace/ObjectNameRouter.java +++ b/jdk/src/share/classes/com/sun/jmx/namespace/ObjectNameRouter.java @@ -49,11 +49,6 @@ public class ObjectNameRouter { final int tlen; final boolean identity; - - public ObjectNameRouter(String targetDirName) { - this(targetDirName,null); - } - /** Creates a new instance of ObjectNameRouter */ public ObjectNameRouter(final String remove, final String add) { this.targetPrefix = (remove==null?"":remove); @@ -186,6 +181,4 @@ public class ObjectNameRouter { b.append(NAMESPACE_SEPARATOR); return b.toString(); } - - } diff --git a/jdk/src/share/classes/com/sun/jmx/namespace/RoutingConnectionProxy.java b/jdk/src/share/classes/com/sun/jmx/namespace/RoutingConnectionProxy.java index 443c80f2ae5..b09bc84365c 100644 --- a/jdk/src/share/classes/com/sun/jmx/namespace/RoutingConnectionProxy.java +++ b/jdk/src/share/classes/com/sun/jmx/namespace/RoutingConnectionProxy.java @@ -31,7 +31,6 @@ import java.util.logging.Level; import java.util.logging.Logger; import javax.management.MBeanServerConnection; -import javax.management.namespace.JMXNamespaces; /** @@ -57,22 +56,14 @@ public class RoutingConnectionProxy private static final Logger LOG = JmxProperties.NAMESPACE_LOGGER; - /** - * Creates a new instance of RoutingConnectionProxy - */ - public RoutingConnectionProxy(MBeanServerConnection source, - String sourceDir) { - this(source,sourceDir,"",false); - } - /** * Creates a new instance of RoutingConnectionProxy */ public RoutingConnectionProxy(MBeanServerConnection source, String sourceDir, String targetDir, - boolean forwardsContext) { - super(source,sourceDir,targetDir,forwardsContext); + boolean probe) { + super(source, sourceDir, targetDir, probe); if (LOG.isLoggable(Level.FINER)) LOG.finer("RoutingConnectionProxy for " + getSourceNamespace() + @@ -85,15 +76,13 @@ public class RoutingConnectionProxy final String sourceNs = getSourceNamespace(); String wrapped = String.valueOf(source()); if ("".equals(targetNs)) { - if (forwardsContext) - wrapped = "ClientContext.withDynamicContext("+wrapped+")"; return "JMXNamespaces.narrowToNamespace("+ wrapped+", \""+ sourceNs+"\")"; } return this.getClass().getSimpleName()+"("+wrapped+", \""+ sourceNs+"\", \""+ - targetNs+"\", "+forwardsContext+")"; + targetNs+"\")"; } static final RoutingProxyFactory @@ -102,22 +91,16 @@ public class RoutingConnectionProxy () { public RoutingConnectionProxy newInstance(MBeanServerConnection source, - String sourcePath, String targetPath, - boolean forwardsContext) { + String sourcePath, String targetPath, boolean probe) { return new RoutingConnectionProxy(source,sourcePath, - targetPath,forwardsContext); - } - - public RoutingConnectionProxy newInstance( - MBeanServerConnection source, String sourcePath) { - return new RoutingConnectionProxy(source,sourcePath); + targetPath, probe); } }; - public static MBeanServerConnection cd(MBeanServerConnection source, - String sourcePath) { + public static MBeanServerConnection cd( + MBeanServerConnection source, String sourcePath, boolean probe) { return RoutingProxy.cd(RoutingConnectionProxy.class, FACTORY, - source, sourcePath); + source, sourcePath, probe); } } diff --git a/jdk/src/share/classes/com/sun/jmx/namespace/RoutingProxy.java b/jdk/src/share/classes/com/sun/jmx/namespace/RoutingProxy.java index aa35c5bdaed..12d4b4ceb02 100644 --- a/jdk/src/share/classes/com/sun/jmx/namespace/RoutingProxy.java +++ b/jdk/src/share/classes/com/sun/jmx/namespace/RoutingProxy.java @@ -30,6 +30,7 @@ import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; +import javax.management.InstanceNotFoundException; import javax.management.MBeanException; import javax.management.MBeanRegistrationException; @@ -90,17 +91,9 @@ import javax.management.namespace.JMXNamespaces; // targetNs= // context must be removed from object name // sourceNs="" // nothing to add... // -// RoutingProxies can also be used on the client side to implement -// "withClientContext" operations. In that case, the boolean parameter -// 'forwards context' is set to true, targetNs is "", and sourceNS may -// also be "". When forwardsContext is true, the RoutingProxy dynamically -// creates an ObjectNameRouter for each operation - in order to dynamically add -// the context attached to the thread to the routing ObjectName. This is -// performed in the getObjectNameRouter() method. -// // Finally, in order to avoid too many layers of wrapping, // RoutingConnectionProxy and RoutingServerProxy can be created through a -// factory method that can concatenate namespace pathes in order to +// factory method that can concatenate namespace paths in order to // return a single RoutingProxy - rather than wrapping a RoutingProxy inside // another RoutingProxy. See RoutingConnectionProxy.cd and // RoutingServerProxy.cd @@ -146,25 +139,27 @@ public abstract class RoutingProxy private final T source; // The name space we're narrowing to (usually some name space in - // the source MBeanServerConnection + // the source MBeanServerConnection), e.g. "a" for the namespace + // "a//". This is empty in the case of ClientContext described above. private final String sourceNs; - // The name space we pretend to be mounted in (usually "") + // The name space we pretend to be mounted in. This is empty except + // in the case of ClientContext described above (where it will be + // something like "jmx.context//foo=bar". private final String targetNs; // The name of the JMXNamespace that handles the source name space private final ObjectName handlerName; private final ObjectNameRouter router; - final boolean forwardsContext; private volatile String defaultDomain = null; /** * Creates a new instance of RoutingProxy */ protected RoutingProxy(T source, - String sourceNs, - String targetNs, - boolean forwardsContext) { + String sourceNs, + String targetNs, + boolean probe) { if (source == null) throw new IllegalArgumentException("null"); this.sourceNs = JMXNamespaces.normalizeNamespaceName(sourceNs); @@ -177,13 +172,17 @@ public abstract class RoutingProxy // System.err.println("sourceNs: "+sourceNs); this.handlerName = JMXNamespaces.getNamespaceObjectName(this.sourceNs); - try { - // System.err.println("handlerName: "+handlerName); - if (!source.isRegistered(handlerName)) - throw new IllegalArgumentException(sourceNs + - ": no such name space"); - } catch (IOException x) { - throw new IllegalArgumentException("source stale: "+x,x); + if (probe) { + try { + if (!source.isRegistered(handlerName)) { + InstanceNotFoundException infe = + new InstanceNotFoundException(handlerName); + throw new IllegalArgumentException(sourceNs + + ": no such name space", infe); + } + } catch (IOException x) { + throw new IllegalArgumentException("source stale: "+x,x); + } } } this.source = source; @@ -191,7 +190,6 @@ public abstract class RoutingProxy JMXNamespaces.normalizeNamespaceName(targetNs)); this.router = new ObjectNameRouter(this.targetNs,this.sourceNs); - this.forwardsContext = forwardsContext; if (LOG.isLoggable(Level.FINER)) LOG.finer("RoutingProxy for " + this.sourceNs + " created"); @@ -200,14 +198,6 @@ public abstract class RoutingProxy @Override public T source() { return source; } - ObjectNameRouter getObjectNameRouter() { -// TODO: uncomment this when contexts are added -// if (forwardsContext) -// return ObjectNameRouter.wrapWithContext(router); -// else - return router; - } - @Override public ObjectName toSource(ObjectName targetName) throws MalformedObjectNameException { @@ -222,8 +212,7 @@ public abstract class RoutingProxy if (defaultDomain != null) targetName = targetName.withDomain(defaultDomain); } - final ObjectNameRouter r = getObjectNameRouter(); - return r.toSourceContext(targetName,true); + return router.toSourceContext(targetName,true); } @Override @@ -243,8 +232,7 @@ public abstract class RoutingProxy public ObjectName toTarget(ObjectName sourceName) throws MalformedObjectNameException { if (sourceName == null) return null; - final ObjectNameRouter r = getObjectNameRouter(); - return r.toTargetContext(sourceName,false); + return router.toTargetContext(sourceName,false); } private Object getAttributeFromHandler(String attributeName) @@ -357,11 +345,8 @@ public abstract class RoutingProxy // instance. static interface RoutingProxyFactory> { - R newInstance(T source, - String sourcePath, String targetPath, - boolean forwardsContext); - R newInstance(T source, - String sourcePath); + public R newInstance( + T source, String sourcePath, String targetPath, boolean probe); } // Performs a narrowDownToNamespace operation. @@ -377,7 +362,7 @@ public abstract class RoutingProxy static > R cd(Class routingProxyClass, RoutingProxyFactory factory, - T source, String sourcePath) { + T source, String sourcePath, boolean probe) { if (source == null) throw new IllegalArgumentException("null"); if (source.getClass().equals(routingProxyClass)) { // cast is OK here, but findbugs complains unless we use class.cast @@ -400,14 +385,13 @@ public abstract class RoutingProxy final String path = JMXNamespaces.concat(other.getSourceNamespace(), sourcePath); - return factory.newInstance(other.source(),path,"", - other.forwardsContext); + return factory.newInstance(other.source(), path, "", probe); } // Note: we could do possibly something here - but it would involve // removing part of targetDir, and possibly adding // something to sourcePath. // Too complex to bother! => simply default to stacking... } - return factory.newInstance(source,sourcePath); + return factory.newInstance(source, sourcePath, "", probe); } } diff --git a/jdk/src/share/classes/com/sun/jmx/namespace/RoutingServerProxy.java b/jdk/src/share/classes/com/sun/jmx/namespace/RoutingServerProxy.java index f58e39816d3..a11b0eccbf5 100644 --- a/jdk/src/share/classes/com/sun/jmx/namespace/RoutingServerProxy.java +++ b/jdk/src/share/classes/com/sun/jmx/namespace/RoutingServerProxy.java @@ -54,7 +54,6 @@ import javax.management.OperationsException; import javax.management.QueryExp; import javax.management.ReflectionException; import javax.management.loading.ClassLoaderRepository; -import javax.management.namespace.JMXNamespaces; /** * A RoutingServerProxy is an MBeanServer proxy that proxies a @@ -76,19 +75,11 @@ public class RoutingServerProxy extends RoutingProxy implements MBeanServer { - /** - * Creates a new instance of RoutingServerProxy - */ - public RoutingServerProxy(MBeanServer source, - String sourceNs) { - this(source,sourceNs,"",false); - } - public RoutingServerProxy(MBeanServer source, String sourceNs, String targetNs, - boolean forwardsContext) { - super(source,sourceNs,targetNs,forwardsContext); + boolean probe) { + super(source, sourceNs, targetNs, probe); } /** @@ -571,20 +562,15 @@ public class RoutingServerProxy FACTORY = new RoutingProxyFactory() { public RoutingServerProxy newInstance(MBeanServer source, - String sourcePath, String targetPath, - boolean forwardsContext) { - return new RoutingServerProxy(source,sourcePath, - targetPath,forwardsContext); - } - - public RoutingServerProxy newInstance( - MBeanServer source, String sourcePath) { - return new RoutingServerProxy(source,sourcePath); + String sourcePath, String targetPath, boolean probe) { + return new RoutingServerProxy( + source, sourcePath, targetPath, probe); } }; - public static MBeanServer cd(MBeanServer source, String sourcePath) { + public static MBeanServer cd( + MBeanServer source, String sourcePath, boolean probe) { return RoutingProxy.cd(RoutingServerProxy.class, FACTORY, - source, sourcePath); + source, sourcePath, probe); } } diff --git a/jdk/src/share/classes/com/sun/jmx/remote/util/EventClientConnection.java b/jdk/src/share/classes/com/sun/jmx/remote/util/EventClientConnection.java index b660898731a..d02da69c047 100644 --- a/jdk/src/share/classes/com/sun/jmx/remote/util/EventClientConnection.java +++ b/jdk/src/share/classes/com/sun/jmx/remote/util/EventClientConnection.java @@ -430,13 +430,11 @@ public class EventClientConnection implements InvocationHandler, * The {@code EventClient} is created lazily, when it is needed * for the first time. If null, a default factory will be used * (see {@link #createEventClient}). - * @return the + * @return the MBeanServerConnection. **/ public static MBeanServerConnection getEventConnectionFor( MBeanServerConnection connection, Callable eventClientFactory) { - // if c already uses an EventClient no need to create a new one. - // if (connection instanceof EventClientFactory && eventClientFactory != null) throw new IllegalArgumentException("connection already uses EventClient"); diff --git a/jdk/src/share/classes/javax/management/ClientContext.java b/jdk/src/share/classes/javax/management/ClientContext.java new file mode 100644 index 00000000000..bddde7ca64c --- /dev/null +++ b/jdk/src/share/classes/javax/management/ClientContext.java @@ -0,0 +1,1091 @@ +/* + * Copyright 2007 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 javax.management; + +import com.sun.jmx.interceptor.SingleMBeanForwarder; +import com.sun.jmx.namespace.RoutingConnectionProxy; +import com.sun.jmx.namespace.RoutingProxy; +import com.sun.jmx.namespace.RoutingServerProxy; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; +import java.net.URLDecoder; +import java.net.URLEncoder; +import java.util.Arrays; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Locale; +import java.util.Map; +import java.util.Set; +import java.util.StringTokenizer; +import java.util.TreeMap; +import java.util.concurrent.Callable; +import java.util.logging.Level; +import java.util.logging.Logger; +import static javax.management.namespace.JMXNamespaces.NAMESPACE_SEPARATOR; +import javax.management.namespace.JMXNamespaces; +import javax.management.namespace.JMXNamespace; +import javax.management.namespace.JMXNamespaceMBean; +import javax.management.namespace.MBeanServerSupport; +import javax.management.remote.IdentityMBeanServerForwarder; +import javax.management.remote.MBeanServerForwarder; + +/** + *

    Methods to communicate a client context to MBeans. A context is + * a {@literal Map} that is provided by the client and + * that an MBean can consult using the {@link #getContext()} method. + * The context is set on a per-thread basis and can be consulted by any + * code that the target MBean calls within the thread.

    + * + *

    One common usage of client context is to communicate the client's + * {@link Locale} to MBeans. For example, if an MBean has a String attribute + * {@code LastProblemDescription}, the value of that attribute could be + * a description of the last problem encountered by the MBean, translated + * into the client's locale. Different clients accessing this attribute + * from different locales would each see the appropriate version for their + * locale.

    + * + *

    The locale case is sufficiently important that it has a special + * shorthand, the {@link #getLocale()} method. This method calls + * {@link #getContext()}.get({@link #LOCALE_KEY}) and converts the + * resultant String into a Locale object.

    + * + *

    Here is what an MBean with a localized {@code LastProblemDescription} + * attribute might look like:

    + * + *
    + * public class LocaleSensitive implements LocaleSensitiveMBean {
    + *     ...
    + *     public String getLastProblemDescription() {
    + *         Locale loc = {@link #getLocale() ClientContext.getLocale()};
    + *         ResourceBundle rb = ResourceBundle.getBundle("MyResources", loc);
    + *         String resourceKey = getLastProblemResourceKey();
    + *         return rb.getString(resourceKey);
    + *     }
    + *     ...
    + * }
    + * 
    + * + *

    Here is how a client can communicate its locale to the target + * MBean:

    + * + *
    + * JMXConnector connector = JMXConnectorFactory.connect(url);
    + * MBeanServerConnection connection = connector.getMBeanServerConnection();
    + * MBeanServerConnection localizedConnection =
    + *     {@link #withLocale(MBeanServerConnection, Locale)
    + *      ClientContext.withLocale}(connection, Locale.getDefault());
    + * String problem = localizedConnection.getAttribute(
    + *          objectName, "LastProblemDescription");
    + * 
    + * + *

    In the more general case where the client wants to communicate context + * other than the locale, it can use {@link #withContext(MBeanServerConnection, + * String, String) withContext} instead of {@code withLocale}, and the target + * MBean can retrieve the context using {@link #getContext()}.

    + * + * + *

    Remote use of contexts

    + * + *

    The various {@code with*} methods, for example {@link + * #withLocale(javax.management.MBeanServer, java.util.Locale) withLocale}, + * transmit the context of each request by encoding it in the ObjectName of + * the request. For example, if a client creates a connection in the + * French locale like this...

    + * + *
    + * MBeanServerConnection mbsc = ...;
    + * Locale french = new Locale("fr");
    + * MBeanServerConnection localizedConnection = ClientContext.withLocale(mbsc, french);
    + * 
    + * + *

    ...or, equivalently, like this...

    + * + *
    + * MBeanServerConnection localizedConnection =
    + *     ClientContext.withContext(mbsc, {@link #LOCALE_KEY "jmx.locale"}, "fr");
    + * 
    + * + *

    ...then the context associates {@code "jmx.locale"} with {@code "fr"} + * and a request such as
    + * {@code localizedConnection.getAttribute("java.lang:type=Runtime", "Name")}
    + * is translated into
    + * {@code mbsc.getAttribute("jmx.context//jmx.locale=fr//java.lang:Runtime", "Name")}.
    + * A special {@linkplain javax.management.namespace namespace} {@code jmx.context//} + * extracts the context from the string {@code jmx.locale=fr} and establishes + * it in the thread that will do
    + * {@code getAttribute("java.lang:Runtime", "Name")}.

    + * + *

    The details of how contexts are encoded into ObjectNames are explained + * in the {@link #encode encode} method.

    + * + *

    The namespace {@code jmx.context//} just mentioned is only needed by + * remote clients, since local clients can set the context directly using + * {@link #doWithContext doWithContext}. Accordingly, this namespace is not + * present by default in the {@code MBeanServer}. Instead, it is + * simulated by the standard RMI connector using a special + * {@link MBeanServerForwarder}. If you are using this connector, you do not + * need to do anything special. Other connectors may or may not simulate this + * namespace in the same way. If the connector server returns true from the + * method {@link + * javax.management.remote.JMXConnectorServer#supportsSystemMBeanServerForwarder() + * supportsSystemMBeanServerForwarder} then it does simulate the namespace. + * If you are using another connector, or if you want to be able to use the + * {@code with*} methods locally, then you can install the {@code + * MBeanServerForwarder} yourself as described in the method {@link + * #newContextForwarder newContextForwarder}.

    + */ +public class ClientContext { + /** + *

    The context key for the client locale. The string associated with + * this key is an encoded locale such as {@code en_US} which could be + * returned by {@link Locale#toString()}.

    + */ + public static final String LOCALE_KEY = "jmx.locale"; + + private static final Logger LOG = + Logger.getLogger("javax.management.context"); + + /** + *

    The namespace that implements contexts, {@value}.

    + */ + public static final String + NAMESPACE = "jmx.context"; + private static final String NAMESPACE_PLUS_SEP = + NAMESPACE + NAMESPACE_SEPARATOR; + static final ObjectName CLIENT_CONTEXT_NAMESPACE_HANDLER = + ObjectName.valueOf(NAMESPACE_PLUS_SEP + ":" + + JMXNamespace.TYPE_ASSIGNMENT); + private static final ObjectName NAMESPACE_HANDLER_WITHOUT_NAMESPACE = + ObjectName.valueOf(":" + JMXNamespace.TYPE_ASSIGNMENT); + + private static final ThreadLocal> contextThreadLocal = + new InheritableThreadLocal>() { + @Override + protected Map initialValue() { + return Collections.emptyMap(); + } + }; + + /** There are no instances of this class. */ + private ClientContext() { + } + + /** + *

    Get the client context associated with the current thread. + * + * @return the client context associated with the current thread. + * This may be an empty Map, but it cannot be null. The returned + * Map cannot be modified. + */ + public static Map getContext() { + return Collections.unmodifiableMap(contextThreadLocal.get()); + } + + /** + *

    Get the client locale associated with the current thread. + * If the client context includes the {@value #LOCALE_KEY} key + * then the returned value is the Locale encoded in that key. + * Otherwise the returned value is the {@linkplain Locale#getDefault() + * default locale}. + * + * @return the client locale. + */ + public static Locale getLocale() { + String localeS = getContext().get(LOCALE_KEY); + if (localeS == null) + return Locale.getDefault(); + // Parse the locale string. Why isn't there a method in Locale for this? + String language, country, variant; + int ui = localeS.indexOf('_'); + if (ui < 0) { + language = localeS; + country = variant = ""; + } else { + language = localeS.substring(0, ui); + localeS = localeS.substring(ui + 1); + ui = localeS.indexOf('_'); + if (ui < 0) { + country = localeS; + variant = ""; + } else { + country = localeS.substring(0, ui); + variant = localeS.substring(ui + 1); + } + } + return new Locale(language, country, variant); + } + + /** + *

    Execute the given {@code task} with the client context set to + * the given Map. This Map will be the result of {@link #getContext()} + * within the {@code task}.

    + * + *

    The {@code task} may include nested calls to {@code doWithContext}. + * The value returned by {@link #getContext} at any point is the Map + * provided to the most recent {@code doWithContext} (in the current thread) + * that has not yet returned.

    + * + *

    The {@link #getContext()} method returns the same value immediately + * after a call to this method as immediately before. In other words, + * {@code doWithContext} only affects the context during the execution of + * the {@code task}.

    + * + *

    As an example, suppose you want to get an attribute with whatever + * context has already been set, plus the locale set to "fr". You could + * write this:

    + * + *
    +     * {@code Map} context =
    +     *     new {@code HashMap}(ClientContext.getContext());
    +     * context.put(ClientContext.LOCALE_KEY, "fr");
    +     * String lastProblemDescription =
    +     *     ClientContext.doWithContext(context, new {@code Callable}() {
    +     *         public String call() {
    +     *             return (String) mbeanServer.getAttribute(mbean, "LastProblemDescription");
    +     *         }
    +     *     });
    +     * 
    + * + * @param the type of value that the task will return. This type + * parameter is usually inferred from the type of the {@code task} + * parameter. For example, if {@code task} is a {@code Callable} + * then {@code T} is {@code String}. If the task does not return a value, + * use a {@code Callable} and return null from its + * {@link Callable#call call} method. + * @param context the context to use while executing {@code task}. + * @param task the task to run with the {@code key}={@code value} + * binding. + * @return the result of {@link Callable#call() task.call()}. + * @throws IllegalArgumentException if either parameter is null, or + * if any key in {@code context} is null or empty, or if any value + * in {@code context} is null. + * @throws Exception If {@link Callable#call() task.call()} throws an + * exception, {@code doWithContext} throws the same exception. + */ + public static T doWithContext(Map context, Callable task) + throws Exception { + if (context == null || task == null) + throw new IllegalArgumentException("Null parameter"); + Map contextCopy = new TreeMap(context); + validateContext(contextCopy); + Map oldContextMap = contextThreadLocal.get(); + try { + contextThreadLocal.set(contextCopy); + return task.call(); + } finally { + contextThreadLocal.set(oldContextMap); + } + } + + private static void validateContext(Map context) { + for (Map.Entry entry : context.entrySet()) { + // If the user passes a raw Map rather than a Map, + // entries could contain objects other than Strings. If so, + // we'll get a ClassCastException here. + String key = entry.getKey(); + String value = entry.getValue(); + if (key == null || value == null) + throw new IllegalArgumentException("Null key or value in context"); + if (key.equals("")) + throw new IllegalArgumentException("Empty key in context"); + } + } + + /** + *

    Return an MBeanServer object that is equivalent to the given + * MBeanServer object except that operations on MBeans run with + * the given Locale in their {@linkplain #getContext() thread context}. + * Note that this will only work if the given MBeanServer supports + * contexts, as described above.

    + * + *

    This method is equivalent to {@link #withContext(MBeanServer, + * String, String) withContext}(mbs, {@value LOCALE_KEY}, + * locale.toString()).

    + * + * @throws IllegalArgumentException if either parameter is null, or if + * {@code mbs} does not support contexts. In the second case only, + * the cause of the {@code IllegalArgumentException} will be an {@link + * InstanceNotFoundException}. + */ + public static MBeanServer withLocale(MBeanServer mbs, Locale locale) { + return withLocale(mbs, MBeanServer.class, locale); + } + + /** + *

    Return an MBeanServerConnection object that is equivalent to the given + * MBeanServerConnection object except that operations on MBeans run with + * the given Locale in their {@linkplain #getContext() thread context}. + * Note that this will only work if the given MBeanServerConnection supports + * contexts, as described above.

    + * + *

    This method is equivalent to {@link #withContext(MBeanServerConnection, + * String, String) withContext}(mbs, {@value LOCALE_KEY}, + * locale.toString()).

    + * + * @throws IllegalArgumentException if either parameter is null, or if + * the communication with {@code mbsc} fails, or if {@code mbsc} does not + * support contexts. If the communication with {@code mbsc} fails, the + * {@linkplain Throwable#getCause() cause} of this exception will be an + * {@code IOException}. If {@code mbsc} does not support contexts, the + * cause will be an {@link InstanceNotFoundException}. + */ + public static MBeanServerConnection withLocale( + MBeanServerConnection mbsc, Locale locale) { + return withLocale(mbsc, MBeanServerConnection.class, locale); + } + + private static T withLocale( + T mbsc, Class mbscClass, Locale locale) { + if (locale == null) + throw new IllegalArgumentException("Null locale"); + return withContext(mbsc, mbscClass, LOCALE_KEY, locale.toString()); + } + + /** + *

    Return an MBeanServer object that is equivalent to the given + * MBeanServer object except that operations on MBeans run with + * the given key bound to the given value in their {@linkplain + * #getContext() thread context}. + * Note that this will only work if the given MBeanServer supports + * contexts, as described above.

    + * + * @param mbs the original MBeanServer. + * @param key the key to bind in the context of MBean operations + * in the returned MBeanServer object. + * @param value the value to bind to the key in the context of MBean + * operations in the returned MBeanServer object. + * @throws IllegalArgumentException if any parameter is null, or + * if {@code key} is the empty string, or if {@code mbs} does not support + * contexts. In the last case only, the cause of the {@code + * IllegalArgumentException} will be an {@link InstanceNotFoundException}. + */ + public static MBeanServer withContext( + MBeanServer mbs, String key, String value) { + return withContext(mbs, MBeanServer.class, key, value); + } + + /** + *

    Return an MBeanServerConnection object that is equivalent to the given + * MBeanServerConnection object except that operations on MBeans run with + * the given key bound to the given value in their {@linkplain + * #getContext() thread context}. + * Note that this will only work if the given MBeanServerConnection supports + * contexts, as described above.

    + * + * @param mbsc the original MBeanServerConnection. + * @param key the key to bind in the context of MBean operations + * in the returned MBeanServerConnection object. + * @param value the value to bind to the key in the context of MBean + * operations in the returned MBeanServerConnection object. + * @throws IllegalArgumentException if any parameter is null, or + * if {@code key} is the empty string, or if the communication with {@code + * mbsc} fails, or if {@code mbsc} does not support contexts. If + * the communication with {@code mbsc} fails, the {@linkplain + * Throwable#getCause() cause} of this exception will be an {@code + * IOException}. If {@code mbsc} does not support contexts, the cause will + * be an {@link InstanceNotFoundException}. + */ + public static MBeanServerConnection withContext( + MBeanServerConnection mbsc, String key, String value) { + return withContext(mbsc, MBeanServerConnection.class, key, value); + } + + + /** + *

    Returns an MBeanServerConnection object that is equivalent to the + * given MBeanServerConnection object except that remote operations on + * MBeans run with the context that has been established by the client + * using {@link #doWithContext doWithContext}. Note that this will + * only work if the remote system supports contexts, as described above.

    + * + *

    For example, suppose the remote system does support contexts, and you + * have created a {@code JMXConnector} like this:

    + * + *
    +     * JMXServiceURL url = ...;
    +     * JMXConnector client = JMXConnectorFactory.connect(url);
    +     * MBeanServerConnection mbsc = client.getMBeanServerConnection();
    +     * mbsc = ClientContext.withDynamicContext(mbsc);
    +     * 
    + * + *

    Then if you do this...

    + * + *
    +     * MBeanInfo mbi = ClientContext.doWithContext(
    +     *     Collections.singletonMap(ClientContext.LOCALE_KEY, "fr"),
    +     *     new {@code Callable}() {
    +     *         public MBeanInfo call() {
    +     *             return mbsc.getMBeanInfo(objectName);
    +     *         }
    +     *     });
    +     * 
    + * + *

    ...then the context with the locale set to "fr" will be in place + * when the {@code getMBeanInfo} is executed on the remote MBean Server.

    + * + * @param mbsc the original MBeanServerConnection. + * + * @throws IllegalArgumentException if the {@code mbsc} parameter is null, + * or if the communication with {@code mbsc} fails, or if {@code mbsc} + * does not support contexts. If the communication with {@code mbsc} + * fails, the {@linkplain Throwable#getCause() cause} of this exception + * will be an {@code IOException}. If {@code mbsc} does not support + * contexts, the cause will be an {@link InstanceNotFoundException}. + */ + public static MBeanServerConnection withDynamicContext( + MBeanServerConnection mbsc) { + // Probe mbsc to get the right exception if it's incommunicado or + // doesn't support namespaces. + JMXNamespaces.narrowToNamespace(mbsc, NAMESPACE); + return (MBeanServerConnection) Proxy.newProxyInstance( + MBeanServerConnection.class.getClassLoader(), + new Class[] {MBeanServerConnection.class}, + new DynamicContextIH(mbsc)); + } + + private static class DynamicContextIH implements InvocationHandler { + private final MBeanServerConnection mbsc; + + public DynamicContextIH(MBeanServerConnection mbsc) { + this.mbsc = mbsc; + } + + public Object invoke(Object proxy, Method method, Object[] args) + throws Throwable { + MBeanServerConnection dynMBSC = withContext( + mbsc, MBeanServerConnection.class, getContext(), false); + try { + return method.invoke(dynMBSC, args); + } catch (InvocationTargetException e) { + throw e.getCause(); + } + } + } + + private static T withContext( + T mbsc, Class mbscClass, String key, String value) { + return withContext( + mbsc, mbscClass, Collections.singletonMap(key, value), true); + } + + private static T withContext( + T mbsc, Class mbscClass, Map context, + boolean probe) { + if (mbsc == null || context == null) + throw new IllegalArgumentException("Null parameter"); + if (context.isEmpty()) + return mbsc; + validateContext(context); + Map contextMap = null; + if (mbsc.getClass() == RoutingServerProxy.class || + mbsc.getClass() == RoutingProxy.class) { + RoutingProxy nsp = (RoutingProxy) mbsc; + String where = nsp.getSourceNamespace(); + if (where.startsWith(NAMESPACE_PLUS_SEP)) { + /* Try to merge the existing context namespace with the + * new one. If it doesn't work, we fall back to just + * prefixing jmx.context//key=value, which + * might lead to a name like jmx.c//k1=v1//jmx.c//k2=v2//d:k=v. + */ + String encodedContext = + where.substring(NAMESPACE_PLUS_SEP.length()); + if (encodedContext.indexOf(NAMESPACE_SEPARATOR) < 0) { + contextMap = stringToMapOrNull(encodedContext); + if (contextMap != null) { + contextMap.putAll(context); + mbsc = mbscClass.cast(nsp.source()); + } + } + } + } + if (contextMap == null) + contextMap = context; + String contextDir = NAMESPACE_PLUS_SEP + mapToString(contextMap); + if (mbscClass == MBeanServer.class) { + return mbscClass.cast(RoutingServerProxy.cd( + (MBeanServer) mbsc, contextDir, probe)); + } else if (mbscClass == MBeanServerConnection.class) { + return mbscClass.cast(RoutingConnectionProxy.cd( + mbsc, contextDir, probe)); + } else + throw new AssertionError("Bad MBSC: " + mbscClass); + } + + /** + *

    Returns an encoded context prefix for ObjectNames. + * If the given context is empty, {@code ""} is returned. + * Otherwise, this method returns a string of the form + * {@code "jmx.context//key=value;key=value;..."}. + * For example, if the context has keys {@code "jmx.locale"} + * and {@code "xid"} with respective values {@code "fr"} + * and {@code "1234"}, this method will return + * {@code "jmx.context//jmx.locale=fr;xid=1234"} or + * {@code "jmx.context//xid=1234;jmx.locale=fr"}.

    + * + *

    Each key and each value in the encoded string is subject to + * encoding as if by the method {@link URLEncoder#encode(String, String)} + * with a character encoding of {@code "UTF-8"}, but with the additional + * encoding of any {@code *} character as {@code "%2A"}. This ensures + * that keys and values can contain any character. Without encoding, + * characters such as {@code =} and {@code :} would pose problems.

    + * + * @param context the context to encode. + * + * @return the context in encoded form. + * + * @throws IllegalArgumentException if the {@code context} parameter + * is null or if it contains a null key or value. + **/ + public static String encode(Map context) { + if (context == null) + throw new IllegalArgumentException("Null context"); + if (context.isEmpty()) + return ""; + StringBuilder sb = new StringBuilder(); + for (Map.Entry entry : context.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + if (key == null || value == null) + throw new IllegalArgumentException("Null key or value"); + if (sb.length() > 0) + sb.append(";"); + sb.append(encode(key)).append("=").append(encode(value)); + } + sb.insert(0, NAMESPACE_PLUS_SEP); + return sb.toString(); + } + + /** + *

    Create a new {@link MBeanServerForwarder} that applies the context + * received from a client to the current thread. A client using + * one of the various {@code with*} methods (for example {@link + * #withContext(MBeanServerConnection, String, String) withContext}) will + * encode that context into the {@code ObjectName} of each + * {@code MBeanServer} request. The object returned by this method + * decodes the context from that {@code ObjectName} and applies it + * as described for {@link #doWithContext doWithContext} while performing + * the {@code MBeanServer} request using the {@code ObjectName} without + * the encoded context.

    + * + *

    This forwarder can be used in a number of ways:

    + * + *
      + *
    • + *

      To add context decoding to a local {@code MBeanServer}, you can + * write:

      + *
      +     * MBeanServer mbs = {@link
      +     * java.lang.management.ManagementFactory#getPlatformMBeanServer()
      +     * ManagementFactory.getPlatformMBeanServer()};  // for example
      +     * mbs = ClientContext.newContextForwarder(mbs, null);
      +     * 
      + * + *
    • + *

      To add context decoding to a {@linkplain + * javax.management.remote.JMXConnectorServer connector server}:

      + *
      +     * JMXConnectorServer cs = JMXConnectorServerFactory.newJMXConnectorServer(...);
      +     * MBeanServer nextMBS = cs.getMBeanServer();
      +     * MBeanServerForwarder mbsf = ClientContext.newContextForwarder(nextMBS, null);
      +     * cs.{@link
      +     * javax.management.remote.JMXConnectorServer#setMBeanServerForwarder
      +     * setMBeanServerForwarder}(mbsf);
      +     * 
      + * + *
    • + *

      For connectors, such as the standard RMI connector, that support + * a {@linkplain + * javax.management.remote.JMXConnectorServer#getSystemMBeanServerForwarder + * system chain} of {@code MBeanServerForwarder}s, this forwarder will + * be installed in that chain by default. See + * {@link javax.management.remote.JMXConnectorServer#CONTEXT_FORWARDER + * JMXConnectorServer.CONTEXT_FORWARDER}. + *

      + * + *
    + * + * @param nextMBS the next {@code MBeanServer} in the chain of + * forwarders, which might be another {@code MBeanServerForwarder} or + * a plain {@code MBeanServer}. This is the object to which {@code + * MBeanServer} requests that do not include a context are sent. It + * will be the value of {@link MBeanServerForwarder#getMBeanServer() + * getMBeanServer()} on the returned object, and can be changed with {@link + * MBeanServerForwarder#setMBeanServer setMBeanServer}. It can be null but + * must be set to a non-null value before any {@code MBeanServer} requests + * arrive. + * + * @param loopMBS the {@code MBeanServer} to which requests that contain + * an encoded context should be sent once the context has been decoded. + * For example, if the request is {@link MBeanServer#getAttribute + * getAttribute}{@code ("jmx.context//jmx.locale=fr//java.lang:type=Runtime", + * "Name")}, then the {@linkplain #getContext() context} of the thread + * executing that request will have {@code "jmx.locale"} set to {@code "fr"} + * while executing {@code loopMBS.getAttribute("java.lang:type=Runtime", + * "Name")}. If this parameter is null, then these requests will be + * sent to the newly-created {@code MBeanServerForwarder}. Usually + * the parameter will either be null or will be the result of {@link + * javax.management.remote.JMXConnectorServer#getSystemMBeanServerForwarder + * getSystemMBeanServerForwarder()} for the connector server in which + * this forwarder will be installed. + * + * @return a new {@code MBeanServerForwarder} that decodes client context + * from {@code ObjectName}s. + */ + /* + * What we're building here is confusing enough to need a diagram. + * The MBSF that we return is actually the composition of two forwarders: + * the first one simulates the existence of the MBean + * jmx.context//:type=JMXNamespace, and the second one simulates the + * existence of the namespace jmx.context//. Furthermore, that namespace + * loops back to the composed forwarder, so that something like + * jmx.context//foo=bar//jmxcontext//baz=buh will work. And the loopback + * goes through yet another forwarder, which simulates the existence of + * (e.g.) jmx.context//foo=bar//:type=JMXNamespace, which is needed + * notably so that narrowToNamespace will work. + * + * | +--------------------------------------------------+ + * v v | + * +----------------+ | + * | Handler MBSF |->accesses to jmx.context//:type=JMXNamespace | + * +----------------+ (handled completely here) +-------------------+ + * | | 2nd Handler MBSF | + * v +-------------------+ + * +----------------+ ^ + * | Namespace MBSF |->accesses to jmx.context//**-------------------+ + * +----------------+ (after attaching context to thread) + * | + * v accesses to anything else + * + * And finally, we need to ensure that from the outside the composed object + * looks like a single forwarder, so that its get/setMBeanServer methods + * will do the expected thing. That's what the anonymous subclass is for. + */ + public static MBeanServerForwarder newContextForwarder( + MBeanServer nextMBS, MBeanServer loopMBS) { + final MBeanServerForwarder mbsWrapper = + new IdentityMBeanServerForwarder(nextMBS); + DynamicMBean handlerMBean = new StandardMBean( + new JMXNamespace(mbsWrapper), JMXNamespaceMBean.class, false); + SingleMBeanForwarder handlerForwarder = new SingleMBeanForwarder( + CLIENT_CONTEXT_NAMESPACE_HANDLER, handlerMBean, true) { + @Override + public MBeanServer getMBeanServer() { + return ((MBeanServerForwarder) super.getMBeanServer()).getMBeanServer(); + } + + @Override + public void setMBeanServer(MBeanServer mbs1) { + MBeanServerForwarder mbsf1 = (MBeanServerForwarder) + super.getMBeanServer(); + if (mbsf1 != null) + mbsf1.setMBeanServer(mbs1); + else + super.setMBeanServer(mbs1); + mbsWrapper.setMBeanServer(mbs1); + } + }; + if (loopMBS == null) + loopMBS = handlerForwarder; + ContextInvocationHandler contextIH = + new ContextInvocationHandler(nextMBS, loopMBS); + MBeanServerForwarder contextForwarder = newForwarderProxy(contextIH); + handlerForwarder.setMBeanServer(contextForwarder); + return handlerForwarder; + } + + /** + *

    Create a new {@link MBeanServerForwarder} that localizes + * descriptions in {@code MBeanInfo} instances returned by + * {@link MBeanServer#getMBeanInfo getMBeanInfo}. The {@code + * MBeanServerForwarder} returned by this method passes all {@code + * MBeanServer} methods through unchanged to the supplied object, {@code + * mbs}, with the exception of {@code getMBeanInfo}. To handle {@code + * getMBeanInfo(objectName)}, it calls {@code mbs.getMBeanInfo(objectName)} + * to get an {@code MBeanInfo}, {@code mbi}; it calls {@link + * MBeanServer#getClassLoaderFor mbs.getClassLoaderFor(objectName)} to + * get a {@code ClassLoader}, {@code cl}; and it calls {@link + * #getLocale} to get a {@code Locale}, {@code locale}. The order + * of these three calls is not specified. Then the result is {@code + * mbi.localizeDescriptions(locale, loader)}.

    + * + *

    This forwarder can be used in a number of ways:

    + * + *
      + *
    • + *

      To add description localization to a local {@code MBeanServer}, you + * can write:

      + * + *
      +     * MBeanServer mbs = {@link
      +     * java.lang.management.ManagementFactory#getPlatformMBeanServer()
      +     * ManagementFactory.getPlatformMBeanServer()};  // for example
      +     * mbs = ClientContext.newLocalizeMBeanInfoForwarder(mbs);
      +     * 
      + * + *
    • + *

      To add description localization to a {@linkplain + * javax.management.remote.JMXConnectorServer connector server}, you will + * need to add both a {@linkplain #newContextForwarder context forwarder} + * and a localization forwarder, for example like this:

      + * + *
      +     * JMXConnectorServer cs = JMXConnectorServerFactory.newJMXConnectorServer(...);
      +     * MBeanServer nextMBS = cs.getMBeanServer();
      +     * MBeanServerForwarder localizeMBSF =
      +     *     ClientContext.newLocalizeMBeanInfoForwarder(nextMBS);
      +     * MBeanServerForwarder contextMBSF =
      +     *     ClientContext.newContextForwarder(localizeMBSF, null);
      +     * cs.{@link
      +     * javax.management.remote.JMXConnectorServer#setMBeanServerForwarder
      +     * setMBeanServerForwarder}(contextMBSF);
      +     * 
      + * + *

      Notice that the context forwarder must run before the localization + * forwarder, so that the locale is correctly established when the latter + * runs. So the {@code nextMBS} parameter of the context forwarder must + * be the localization forwarder, and not vice versa.

      + * + *
    • + *

      For connectors, such as the standard RMI connector, that support + * a {@linkplain + * javax.management.remote.JMXConnectorServer#getSystemMBeanServerForwarder + * system chain} of {@code MBeanServerForwarder}s, the context forwarder and + * the localization forwarder will be installed in that chain, in the right + * order, if you include + * {@link + * javax.management.remote.JMXConnectorServer#LOCALIZE_MBEAN_INFO_FORWARDER + * LOCALIZE_MBEAN_INFO_FORWARDER} in the environment {@code Map} with + * the value {@code "true"}, for example like this:

      + *

      + *
      +     * MBeanServer mbs = ...;
      +     * JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://...");
      +     * {@code Map} env = new {@code HashMap}();
      +     * env.put(JMXConnectorServer.LOCALIZE_MBEAN_INFO_FORWARDER, "true");
      +     * JMXConnectorServer cs = JMXConnectorServerFactory.newJMXConnectorServer(
      +     *     url, env, mbs);
      +     * 
      + * + *
    + * + * @param mbs the next {@code MBeanServer} in the chain of + * forwarders, which might be another {@code MBeanServerForwarder} + * or a plain {@code MBeanServer}. It will be the value of + * {@link MBeanServerForwarder#getMBeanServer() getMBeanServer()} + * on the returned object, and can be changed with {@link + * MBeanServerForwarder#setMBeanServer setMBeanServer}. It can be null but + * must be set to a non-null value before any {@code MBeanServer} requests + * arrive. + * + * @return a new {@code MBeanServerForwarder} that localizes descriptions + * in the result of {@code getMBeanInfo}. + */ + public static MBeanServerForwarder newLocalizeMBeanInfoForwarder( + MBeanServer mbs) { + return new IdentityMBeanServerForwarder(mbs) { + @Override + public MBeanInfo getMBeanInfo(ObjectName name) + throws InstanceNotFoundException, IntrospectionException, + ReflectionException { + MBeanInfo mbi = super.getMBeanInfo(name); + Locale locale = getLocale(); + ClassLoader loader = getClassLoaderFor(name); + return mbi.localizeDescriptions(locale, loader); + } + }; + } + + private static MBeanServerForwarder newForwarderProxy(InvocationHandler ih) { + return (MBeanServerForwarder) Proxy.newProxyInstance( + MBeanServerForwarder.class.getClassLoader(), + new Class[] {MBeanServerForwarder.class}, + ih); + } + + // A proxy connection that will strip the 'contextDir' at input (routing), + // and put it back at output (createMBean / registerMBean / query* / + // getObjectInstance). Usually RoutingProxy / RoutingServerProxy are used + // the other way round (they are used for 'cd' - where they need to add + // something at input and remove it at output). + // For 'cd' operations we create RoutingProxys with a non empty sourceDir, + // and a possibly non-empty targetDir. This is the only case where we use + // RoutingProxies with an empty sourceDir (sourceDir is what we add at input + // and remove at output, targetDir is what we remove at input and add at + // output. + // + // Note that using a transient ContextRoutingConnection + // is possible only because RoutingProxys don't rewrite + // notifications sources - otherwise we would have to + // keep the ContextRoutingConnection - just to preserve + // the 'wrapping listeners' + // + private static final class ContextRoutingConnection + extends RoutingServerProxy { + public ContextRoutingConnection(MBeanServer source, + String contextDir) { + super(source, "", contextDir, false); + } + + // Not really needed - but this is safer and more optimized. + // See RoutingProxy for more details. + // + @Override + public Integer getMBeanCount() { + return source().getMBeanCount(); + } + + // Not really needed - but this is safer and more optimized. + // See RoutingProxy for more details. + // + @Override + public String[] getDomains() { + return source().getDomains(); + } + + // Not really needed - but this is safer and more optimized. + // See RoutingProxy for more details. + // + @Override + public String getDefaultDomain() { + return source().getDefaultDomain(); + } + + } + + private static class ContextInvocationHandler implements InvocationHandler { + /* + * MBeanServer requests that don't include jmx.context//foo=bar// + * are forwarded to forwardMBS, which is the unadorned MBeanServer + * that knows nothing about the context namespace. + * MBeanServer requests that do include this prefix will + * usually (depending on the value of the loopMBS parameter to + * newContextForwarder) loop back to the combined MBeanServerForwarder + * that first implements + * jmx.context//:type=JMXNamespace and then implements + * jmx.context//foo=bar//. The reason is that it is valid + * to have jmx.context//foo=bar//jmx.context//baz=buh//, although + * usually that will be combined into jmx.context//foo=bar;baz=buh//. + * + * Before forwarding to loopMBS, we must check for :type=JMXNamespace + * so that jmx.context//foo=bar//:type=JMXNamespace will exist. Its + * existence is partial because it must remain "invisible": it should + * not show up in queryNames or getMBeanCount even though it does + * accept getAttribute and isRegistered and all other methods that + * reference a single MBean. + */ + private MBeanServer forwardMBS; + private final MBeanServer loopMBS; + private static final MBeanServer emptyMBS = new MBeanServerSupport() { + @Override + public DynamicMBean getDynamicMBeanFor(ObjectName name) + throws InstanceNotFoundException { + throw new InstanceNotFoundException(name.toString()); + } + + @Override + protected Set getNames() { + return Collections.emptySet(); + } + }; + + ContextInvocationHandler(MBeanServer forwardMBS, MBeanServer loopMBS) { + this.forwardMBS = forwardMBS; + DynamicMBean handlerMBean = new StandardMBean( + new JMXNamespace(loopMBS), JMXNamespaceMBean.class, false); + MBeanServerForwarder handlerMBS = new SingleMBeanForwarder( + NAMESPACE_HANDLER_WITHOUT_NAMESPACE, handlerMBean, false); + handlerMBS.setMBeanServer(loopMBS); + this.loopMBS = handlerMBS; + } + + public Object invoke(Object proxy, final Method method, final Object[] args) + throws Throwable { + String methodName = method.getName(); + Class[] paramTypes = method.getParameterTypes(); + + // If this is a method from MBeanServerForwarder, handle it here. + // There are only two such methods: getMBeanServer() and + // setMBeanServer(mbs). + if (methodName.equals("getMBeanServer")) + return forwardMBS; + else if (methodName.equals("setMBeanServer")) { + this.forwardMBS = (MBeanServer) args[0]; + return null; + } + + // It is a method from MBeanServer. + // Find the first parameter whose declared type is ObjectName, + // and see if it is in the context namespace. If so we need to + // trigger the logic for that namespace. If not, we simply + // forward to the next MBeanServer in the chain. This logic + // depends on the fact that if a method in the MBeanServer interface + // has a "routing" ObjectName parameter, it is always the first + // parameter of that type. Conversely, if a method has an + // ObjectName parameter, then it makes sense to "route" that + // method. Except for deserialize and instantiate, but if we + // recognize a context namespace in those methods' ObjectName + // parameters it is pretty harmless. + int objectNameI = -1; + for (int i = 0; i < paramTypes.length; i++) { + if (paramTypes[i] == ObjectName.class) { + objectNameI = i; + break; + } + } + + if (objectNameI < 0) + return invoke(method, forwardMBS, args); + + ObjectName target = (ObjectName) args[objectNameI]; + if (target == null || + !target.getDomain().startsWith(NAMESPACE_PLUS_SEP)) + return invoke(method, forwardMBS, args); + + String domain = target.getDomain().substring(NAMESPACE_PLUS_SEP.length()); + + // The method routes through the (simulated) context namespace. + // Decode the context after it, e.g. jmx.context//jmx.locale=fr//... + // If there is no context part, we can throw an exception, + // because a forwarder has already handled the unique MBean + // jmx.context//:type=JMXNamespace. + int sep = domain.indexOf(NAMESPACE_SEPARATOR); + if (sep < 0) + return invoke(method, emptyMBS, args); // throw exception + final String encodedContext = domain.substring(0, sep); + + if (method.getName().startsWith("query") && + (encodedContext.contains("*") || encodedContext.contains("?"))) { + // Queries like jmx.context//*//d:k=v return + // an empty set, consistent with "real" namespaces. + return Collections.EMPTY_SET; + } + + Map ctx = new TreeMap(getContext()); + ctx.putAll(stringToMap(encodedContext)); + + return doWithContext(ctx, new Callable() { + public Object call() throws Exception { + // Create a proxy connection that will strip + // "jmx.context//" + encodedContext + "//" on input, + // and put it back on output. + // + // Note that using a transient ContextRoutingConnection + // is possible only because it doesn't rewrite + // notification sources - otherwise we would have to + // keep the ContextRoutingConnection - just to preserve + // the 'wrapping listeners' + // + String namespace = NAMESPACE_PLUS_SEP + encodedContext; + final ContextRoutingConnection route = + new ContextRoutingConnection(loopMBS, namespace); + + if (LOG.isLoggable(Level.FINE)) + LOG.fine("context="+encodedContext); + if (LOG.isLoggable(Level.FINER)) + LOG.finer(method.getName()+""+ + ((args==null)?"()":(""+Arrays.asList(args)))); + + return invoke(method, route, args); + } + }); + } + + private static Object invoke(Method method, Object target, Object[] args) + throws Exception { + try { + return method.invoke(target, args); + } catch (InvocationTargetException e) { + Throwable cause = e.getCause(); + if (cause instanceof Error) + throw (Error) cause; + throw (Exception) cause; + } + } + } + + private static String mapToString(Map map) { + StringBuilder sb = new StringBuilder(); + for (Map.Entry entry : map.entrySet()) { + String key = encode(entry.getKey()); + String value = encode(entry.getValue()); + if (sb.length() > 0) + sb.append(";"); + sb.append(key).append("=").append(value); + } + return sb.toString(); + } + + private static Map stringToMap(String encodedContext) { + Map map = stringToMapOrNull(encodedContext); + if (map == null) { + throw new IllegalArgumentException( + "Invalid encoded context: " + encodedContext); + } + return map; + } + + private static Map stringToMapOrNull(String encodedContext) { + Map map = new LinkedHashMap(); + StringTokenizer stok = new StringTokenizer(encodedContext, ";"); + while (stok.hasMoreTokens()) { + String tok = stok.nextToken(); + int eq = tok.indexOf('='); + if (eq < 0) + return null; + String key = decode(tok.substring(0, eq)); + if (key.equals("")) + return null; + String value = decode(tok.substring(eq + 1)); + map.put(key, value); + } + return map; + } + + private static String encode(String s) { + try { + s = URLEncoder.encode(s, "UTF-8"); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); // Should not happen + } + return s.replace("*", "%2A"); + // The * character is left intact in URL encodings, but for us it + // is special (an ObjectName wildcard) so we must map it. + // We are assuming that URLDecoder will decode it the same way as any + // other hex escape. + } + + private static String decode(String s) { + try { + return URLDecoder.decode(s, "UTF-8"); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + } +} diff --git a/jdk/src/share/classes/javax/management/Descriptor.java b/jdk/src/share/classes/javax/management/Descriptor.java index a74fb11cde7..b9c98f4068b 100644 --- a/jdk/src/share/classes/javax/management/Descriptor.java +++ b/jdk/src/share/classes/javax/management/Descriptor.java @@ -35,8 +35,8 @@ import java.io.Serializable; // Javadoc imports: import java.lang.management.MemoryUsage; import java.util.Arrays; +import java.util.Locale; import java.util.ResourceBundle; - import javax.management.openmbean.CompositeData; import javax.management.openmbean.MXBeanMappingFactory; import javax.management.openmbean.OpenMBeanAttributeInfoSupport; @@ -118,19 +118,22 @@ import javax.management.openmbean.OpenType; * deprecation, for example {@code "1.3 Replaced by the Capacity * attribute"}. * - * - * descriptionResource
    BundleBaseNameStringAny + * descriptionResource
    + * BundleBaseName
    StringAny * * The base name for the {@link ResourceBundle} in which the key given in * the {@code descriptionResourceKey} field can be found, for example - * {@code "com.example.myapp.MBeanResources"}. + * {@code "com.example.myapp.MBeanResources"}. See + * {@link MBeanInfo#localizeDescriptions MBeanInfo.localizeDescriptions}. * - * - * descriptionResourceKeyStringAny + * descriptionResourceKey + * StringAny * * A resource key for the description of this element. In * conjunction with the {@code descriptionResourceBundleBaseName}, - * this can be used to find a localized version of the description. + * this can be used to find a localized version of the description. + * See {@link MBeanInfo#localizeDescriptions MBeanInfo.localizeDescriptions}. + * * * enabledString * MBeanAttributeInfo
    MBeanNotificationInfo
    MBeanOperationInfo @@ -157,11 +160,11 @@ import javax.management.openmbean.OpenType; * href="MBeanInfo.html#info-changed">{@code "jmx.mbean.info.changed"} * notification. * - * infoTimeoutString
    LongMBeanInfo + * infoTimeoutString
    LongMBeanInfo * - * The time in milli-seconds that the MBeanInfo can - * reasonably be expected to be unchanged. The value can be a {@code Long} - * or a decimal string. This provides a hint from a DynamicMBean or any + * The time in milli-seconds that the MBeanInfo can reasonably be + * expected to be unchanged. The value can be a {@code Long} or a + * decimal string. This provides a hint from a DynamicMBean or any * MBean that does not define {@code immutableInfo} as {@code true} * that the MBeanInfo is not likely to change within this period and * therefore can be cached. When this field is missing or has the @@ -185,6 +188,13 @@ import javax.management.openmbean.OpenType; * Legal values for an attribute or parameter. See * {@link javax.management.openmbean}. * + * locale + * StringAny + * + * The {@linkplain Locale locale} of the description in this + * {@code MBeanInfo}, {@code MBeanAttributeInfo}, etc, as returned + * by {@link Locale#toString()}. + * * maxValueObject * MBeanAttributeInfo
    MBeanParameterInfo * diff --git a/jdk/src/share/classes/javax/management/JMX.java b/jdk/src/share/classes/javax/management/JMX.java index ac7468d07dd..90770d48110 100644 --- a/jdk/src/share/classes/javax/management/JMX.java +++ b/jdk/src/share/classes/javax/management/JMX.java @@ -30,6 +30,7 @@ import com.sun.jmx.mbeanserver.MBeanInjector; import com.sun.jmx.remote.util.ClassLogger; import java.beans.BeanInfo; import java.beans.PropertyDescriptor; +import java.io.IOException; import java.io.Serializable; import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationTargetException; @@ -37,6 +38,7 @@ import java.lang.reflect.Method; import java.lang.reflect.Proxy; import java.util.Map; import java.util.TreeMap; +import javax.management.namespace.JMXNamespaces; import javax.management.openmbean.MXBeanMappingFactory; /** @@ -60,6 +62,21 @@ public class JMX { */ public static final String DEFAULT_VALUE_FIELD = "defaultValue"; + /** + * The name of the {@code + * descriptionResourceBundleBaseName} field. + */ + public static final String DESCRIPTION_RESOURCE_BUNDLE_BASE_NAME_FIELD = + "descriptionResourceBundleBaseName"; + + /** + * The name of the {@code + * descriptionResourceKey} field. + */ + public static final String DESCRIPTION_RESOURCE_KEY_FIELD = + "descriptionResourceKey"; + /** * The name of the {@code * immutableInfo} field. @@ -78,6 +95,12 @@ public class JMX { */ public static final String LEGAL_VALUES_FIELD = "legalValues"; + /** + * The name of the {@code locale} + * field. + */ + public static final String LOCALE_FIELD = "locale"; + /** * The name of the {@code * maxValue} field. @@ -120,13 +143,12 @@ public class JMX { *

    Options to apply to an MBean proxy or to an instance of {@link * StandardMBean}.

    * - *

    For example, to specify a custom {@link MXBeanMappingFactory} - * for a {@code StandardMBean}, you might write this:

    + *

    For example, to specify the "wrapped object visible" option for a + * {@code StandardMBean}, you might write this:

    * *
    -     * MXBeanMappingFactory factory = new MyMXBeanMappingFactory();
    -     * JMX.MBeanOptions opts = new JMX.MBeanOptions();
    -     * opts.setMXBeanMappingFactory(factory);
    +     * StandardMBean.Options opts = new StandardMBean.Options();
    +     * opts.setWrappedObjectVisible(true);
          * StandardMBean mbean = new StandardMBean(impl, intf, opts);
          * 
    * diff --git a/jdk/src/share/classes/javax/management/MBeanInfo.java b/jdk/src/share/classes/javax/management/MBeanInfo.java index 3561e3cfc13..49973c66ce6 100644 --- a/jdk/src/share/classes/javax/management/MBeanInfo.java +++ b/jdk/src/share/classes/javax/management/MBeanInfo.java @@ -25,6 +25,7 @@ package javax.management; +import com.sun.jmx.mbeanserver.Util; import java.io.IOException; import java.io.StreamCorruptedException; import java.io.Serializable; @@ -37,6 +38,12 @@ import java.util.WeakHashMap; import java.security.AccessController; import java.security.PrivilegedAction; +import java.util.HashMap; +import java.util.Locale; +import java.util.MissingResourceException; +import java.util.ResourceBundle; +import java.util.logging.Level; +import java.util.logging.Logger; import static javax.management.ImmutableDescriptor.nonNullDescriptor; /** @@ -290,6 +297,7 @@ public class MBeanInfo implements Cloneable, Serializable, DescriptorRead { *

    Since this class is immutable, the clone method is chiefly of * interest to subclasses.

    */ + @Override public Object clone () { try { return super.clone() ; @@ -474,6 +482,7 @@ public class MBeanInfo implements Cloneable, Serializable, DescriptorRead { return (Descriptor) nonNullDescriptor(descriptor).clone(); } + @Override public String toString() { return getClass().getName() + "[" + @@ -505,6 +514,7 @@ public class MBeanInfo implements Cloneable, Serializable, DescriptorRead { * @return true if and only if o is an MBeanInfo that is equal * to this one according to the rules above. */ + @Override public boolean equals(Object o) { if (o == this) return true; @@ -524,6 +534,7 @@ public class MBeanInfo implements Cloneable, Serializable, DescriptorRead { Arrays.equals(p.fastGetNotifications(), fastGetNotifications())); } + @Override public int hashCode() { /* Since computing the hashCode is quite expensive, we cache it. If by some terrible misfortune the computed value is 0, the @@ -747,4 +758,377 @@ public class MBeanInfo implements Cloneable, Serializable, DescriptorRead { throw new StreamCorruptedException("Got unexpected byte."); } } + + /** + *

    Return an {@code MBeanInfo} object that is the same as this one + * except that its descriptions are localized in the given locale. + * This means the text returned by {@link MBeanInfo#getDescription} + * (the description of the MBean itself), and the text returned by the + * {@link MBeanFeatureInfo#getDescription getDescription()} method + * for every {@linkplain MBeanAttributeInfo attribute}, {@linkplain + * MBeanOperationInfo operation}, {@linkplain MBeanConstructorInfo + * constructor}, and {@linkplain MBeanNotificationInfo notification} + * contained in the {@code MBeanInfo}.

    + * + *

    Here is how the description {@code this.getDescription()} is + * localized.

    + * + *

    First, if the {@linkplain #getDescriptor() descriptor} + * of this {@code MBeanInfo} contains a field "locale", and the value of + * the field is the same as {@code locale.toString()}, then this {@code + * MBeanInfo} is returned. Otherwise, localization proceeds as follows, + * and the {@code "locale"} field in the returned {@code MBeanInfo} will + * be {@code locale.toString()}. + * + *

    A {@code className} is determined. If this + * {@code MBeanInfo} contains a descriptor with the field + * {@code + * "interfaceClassName"}, then the value of that field is the + * {@code className}. Otherwise, it is {@link #getClassName()}. + * Everything before the last period (.) in the {@code className} is + * the {@code package}, and everything after is the {@code + * simpleClassName}. (If there is no period, then the {@code package} + * is empty and the {@code simpleClassName} is the same as the {@code + * className}.)

    + * + *

    A {@code resourceKey} is determined. If this {@code + * MBeanInfo} contains a {@linkplain MBeanInfo#getDescriptor() descriptor} + * with a field {@link JMX#DESCRIPTION_RESOURCE_KEY_FIELD + * "descriptionResourceKey"}, the value of the field is + * the {@code resourceKey}. Otherwise, the {@code resourceKey} is {@code + * simpleClassName + ".mbean"}.

    + * + *

    A {@code resourceBundleBaseName} is determined. If + * this {@code MBeanInfo} contains a descriptor with a field {@link + * JMX#DESCRIPTION_RESOURCE_BUNDLE_BASE_NAME_FIELD + * "descriptionResourceBundleBaseName"}, the value of the field + * is the {@code resourceBundleBaseName}. Otherwise, the {@code + * resourceBundleBaseName} is {@code package + ".MBeanDescriptions"}. + * + *

    Then, a {@link java.util.ResourceBundle ResourceBundle} is + * determined, using
    {@link java.util.ResourceBundle#getBundle(String, + * Locale, ClassLoader) ResourceBundle.getBundle(resourceBundleBaseName, + * locale, loader)}. If this succeeds, and if {@link + * java.util.ResourceBundle#getString(String) getString(resourceKey)} + * returns a string, then that string is the localized description. + * Otherwise, the original description is unchanged.

    + * + *

    A localized description for an {@code MBeanAttributeInfo} is + * obtained similarly. The default {@code resourceBundleBaseName} + * is the same as above. The default description and the + * descriptor fields {@code "descriptionResourceKey"} and {@code + * "descriptionResourceBundleBaseName"} come from the {@code + * MBeanAttributeInfo} rather than the {@code MBeanInfo}. If the + * attribute's {@linkplain MBeanFeatureInfo#getName() name} is {@code + * Foo} then its default {@code resourceKey} is {@code simpleClassName + + * ".attribute.Foo"}.

    + * + *

    Similar rules apply for operations, constructors, and notifications. + * If the name of the operation, constructor, or notification is {@code + * Foo} then the default {@code resourceKey} is respectively {@code + * simpleClassName + ".operation.Foo"}, {@code simpleClassName + + * ".constructor.Foo"}, or {@code simpleClassName + ".notification.Foo"}. + * If two operations or constructors have the same name (overloading) then + * they have the same default {@code resourceKey}; if different localized + * descriptions are needed then a non-default key must be supplied using + * {@code "descriptionResourceKey"}.

    + * + *

    Similar rules also apply for descriptions of parameters ({@link + * MBeanParameterInfo}). The default {@code resourceKey} for a parameter + * whose {@linkplain MBeanFeatureInfo#getName() name} is {@code + * Bar} in an operation or constructor called {@code Foo} is {@code + * simpleClassName + ".operation.Foo.Bar"} or {@code simpleClassName + + * ".constructor.Foo.Bar"} respectively.

    + * + *

    Example

    + * + *

    Suppose you have an MBean defined by these two Java source files:

    + * + *
    +     * // ConfigurationMBean.java
    +     * package com.example;
    +     * public interface ConfigurationMBean {
    +     *     public String getName();
    +     *     public void save(String fileName);
    +     * }
    +     *
    +     * // Configuration.java
    +     * package com.example;
    +     * public class Configuration implements ConfigurationMBean {
    +     *     public Configuration(String defaultName) {
    +     *         ...
    +     *     }
    +     *     ...
    +     * }
    +     * 
    + * + *

    Then you could define the default descriptions for the MBean, by + * including a resource bundle called {@code com/example/MBeanDescriptions} + * with the compiled classes. Most often this is done by creating a file + * {@code MBeanDescriptions.properties} in the same directory as {@code + * ConfigurationMBean.java}. Make sure that this file is copied into the + * same place as the compiled classes; in typical build environments that + * will be true by default.

    + * + *

    The file {@code com/example/MBeanDescriptions.properties} might + * look like this:

    + * + *
    +     * # Description of the MBean
    +     * ConfigurationMBean.mbean = Configuration manager
    +     *
    +     * # Description of the Name attribute
    +     * ConfigurationMBean.attribute.Name = The name of the configuration
    +     *
    +     * # Description of the save operation
    +     * ConfigurationMBean.operation.save = Save the configuration to a file
    +     *
    +     * # Description of the parameter to the save operation.
    +     * # Parameter names from the original Java source are not available,
    +     * # so the default names are p1, p2, etc.  If the names were available,
    +     * # this would be ConfigurationMBean.operation.save.fileName
    +     * ConfigurationMBean.operation.save.p1 = The name of the file
    +     *
    +     * # Description of the constructor.  The default name of a constructor is
    +     * # its fully-qualified class name.
    +     * ConfigurationMBean.constructor.com.example.Configuration = Constructor with name of default file
    +     * # Description of the constructor parameter.
    +     * ConfigurationMBean.constructor.com.example.Configuration.p1 = Name of the default file
    +     * 
    + * + *

    Starting with this file, you could create descriptions for the French + * locale by creating {@code com/example/MBeanDescriptions_fr.properties}. + * The keys in this file are the same as before but the text has been + * translated: + * + *

    +     * ConfigurationMBean.mbean = Gestionnaire de configuration
    +     *
    +     * ConfigurationMBean.attribute.Name = Le nom de la configuration
    +     *
    +     * ConfigurationMBean.operation.save = Sauvegarder la configuration dans un fichier
    +     *
    +     * ConfigurationMBean.operation.save.p1 = Le nom du fichier
    +     *
    +     * ConfigurationMBean.constructor.com.example.Configuration = Constructeur avec nom du fichier par défaut
    +     * ConfigurationMBean.constructor.com.example.Configuration.p1 = Nom du fichier par défaut
    +     * 
    + * + *

    The descriptions in {@code MBeanDescriptions.properties} and + * {@code MBeanDescriptions_fr.properties} will only be consulted if + * {@code localizeDescriptions} is called, perhaps because the + * MBean Server has been wrapped by {@link + * ClientContext#newLocalizeMBeanInfoForwarder} or because the + * connector server has been created with the {@link + * javax.management.remote.JMXConnectorServer#LOCALIZE_MBEAN_INFO_FORWARDER + * LOCALIZE_MBEAN_INFO_FORWARDER} option. If you want descriptions + * even when there is no localization step, then you should consider + * using {@link Description @Description} annotations. Annotations + * provide descriptions by default but are overridden if {@code + * localizeDescriptions} is called.

    + * + * @param locale the target locale for descriptions. Cannot be null. + * + * @param loader the {@code ClassLoader} to use for looking up resource + * bundles. + * + * @return an {@code MBeanInfo} with descriptions appropriately localized. + * + * @throws NullPointerException if {@code locale} is null. + */ + public MBeanInfo localizeDescriptions(Locale locale, ClassLoader loader) { + if (locale == null) + throw new NullPointerException("locale"); + Descriptor d = getDescriptor(); + String mbiLocaleString = (String) d.getFieldValue(JMX.LOCALE_FIELD); + if (locale.toString().equals(mbiLocaleString)) + return this; + return new Rewriter(this, locale, loader).getMBeanInfo(); + } + + private static class Rewriter { + private final MBeanInfo mbi; + private final ClassLoader loader; + private final Locale locale; + private final String packageName; + private final String simpleClassNamePlusDot; + private ResourceBundle defaultBundle; + private boolean defaultBundleLoaded; + + // ResourceBundle.getBundle throws NullPointerException + // if the loader is null, even though that is perfectly + // valid and means the bootstrap loader. So we work + // around with a ClassLoader that is equivalent to the + // bootstrap loader but is not null. + private static final ClassLoader bootstrapLoader = + new ClassLoader(null) {}; + + Rewriter(MBeanInfo mbi, Locale locale, ClassLoader loader) { + this.mbi = mbi; + this.locale = locale; + if (loader == null) + loader = bootstrapLoader; + this.loader = loader; + + String intfName = (String) + mbi.getDescriptor().getFieldValue("interfaceClassName"); + if (intfName == null) + intfName = mbi.getClassName(); + int lastDot = intfName.lastIndexOf('.'); + this.packageName = intfName.substring(0, lastDot + 1); + this.simpleClassNamePlusDot = intfName.substring(lastDot + 1) + "."; + // Inner classes show up as Outer$Inner so won't match the dot. + // When there is no dot, lastDot is -1, + // packageName is empty, and simpleClassNamePlusDot is intfName. + } + + MBeanInfo getMBeanInfo() { + MBeanAttributeInfo[] mbais = + rewrite(mbi.getAttributes(), "attribute."); + MBeanOperationInfo[] mbois = + rewrite(mbi.getOperations(), "operation."); + MBeanConstructorInfo[] mbcis = + rewrite(mbi.getConstructors(), "constructor."); + MBeanNotificationInfo[] mbnis = + rewrite(mbi.getNotifications(), "notification."); + Descriptor d = mbi.getDescriptor(); + d = changeLocale(d); + String description = getDescription(d, "mbean", ""); + if (description == null) + description = mbi.getDescription(); + return new MBeanInfo( + mbi.getClassName(), description, + mbais, mbcis, mbois, mbnis, d); + } + + private Descriptor changeLocale(Descriptor d) { + if (d.getFieldValue(JMX.LOCALE_FIELD) != null) { + Map map = new HashMap(); + for (String field : d.getFieldNames()) + map.put(field, d.getFieldValue(field)); + map.remove(JMX.LOCALE_FIELD); + d = new ImmutableDescriptor(map); + } + return ImmutableDescriptor.union( + d, new ImmutableDescriptor(JMX.LOCALE_FIELD + "=" + locale)); + } + + private String getDescription( + Descriptor d, String defaultPrefix, String defaultSuffix) { + ResourceBundle bundle = bundleFromDescriptor(d); + if (bundle == null) + return null; + String key = + (String) d.getFieldValue(JMX.DESCRIPTION_RESOURCE_KEY_FIELD); + if (key == null) + key = simpleClassNamePlusDot + defaultPrefix + defaultSuffix; + return descriptionFromResource(bundle, key); + } + + private T[] rewrite( + T[] features, String resourcePrefix) { + for (int i = 0; i < features.length; i++) { + T feature = features[i]; + Descriptor d = feature.getDescriptor(); + String description = + getDescription(d, resourcePrefix, feature.getName()); + if (description != null && + !description.equals(feature.getDescription())) { + features[i] = setDescription(feature, description); + } + } + return features; + } + + private T setDescription( + T feature, String description) { + + Object newf; + String name = feature.getName(); + Descriptor d = feature.getDescriptor(); + + if (feature instanceof MBeanAttributeInfo) { + MBeanAttributeInfo mbai = (MBeanAttributeInfo) feature; + newf = new MBeanAttributeInfo( + name, mbai.getType(), description, + mbai.isReadable(), mbai.isWritable(), mbai.isIs(), + d); + } else if (feature instanceof MBeanOperationInfo) { + MBeanOperationInfo mboi = (MBeanOperationInfo) feature; + MBeanParameterInfo[] sig = rewrite( + mboi.getSignature(), "operation." + name + "."); + newf = new MBeanOperationInfo( + name, description, sig, + mboi.getReturnType(), mboi.getImpact(), d); + } else if (feature instanceof MBeanConstructorInfo) { + MBeanConstructorInfo mbci = (MBeanConstructorInfo) feature; + MBeanParameterInfo[] sig = rewrite( + mbci.getSignature(), "constructor." + name + "."); + newf = new MBeanConstructorInfo( + name, description, sig, d); + } else if (feature instanceof MBeanNotificationInfo) { + MBeanNotificationInfo mbni = (MBeanNotificationInfo) feature; + newf = new MBeanNotificationInfo( + mbni.getNotifTypes(), name, description, d); + } else if (feature instanceof MBeanParameterInfo) { + MBeanParameterInfo mbpi = (MBeanParameterInfo) feature; + newf = new MBeanParameterInfo( + name, mbpi.getType(), description, d); + } else { + logger().log(Level.FINE, "Unknown feature type: " + + feature.getClass()); + newf = feature; + } + + return Util.cast(newf); + } + + private ResourceBundle bundleFromDescriptor(Descriptor d) { + String bundleName = (String) d.getFieldValue( + JMX.DESCRIPTION_RESOURCE_BUNDLE_BASE_NAME_FIELD); + + if (bundleName != null) + return getBundle(bundleName); + + if (defaultBundleLoaded) + return defaultBundle; + + bundleName = packageName + "MBeanDescriptions"; + defaultBundle = getBundle(bundleName); + defaultBundleLoaded = true; + return defaultBundle; + } + + private String descriptionFromResource( + ResourceBundle bundle, String key) { + try { + return bundle.getString(key); + } catch (MissingResourceException e) { + logger().log(Level.FINEST, "No resource for " + key, e); + } catch (Exception e) { + logger().log(Level.FINE, "Bad resource for " + key, e); + } + return null; + } + + private ResourceBundle getBundle(String name) { + try { + return ResourceBundle.getBundle(name, locale, loader); + } catch (Exception e) { + logger().log(Level.FINE, + "Could not load ResourceBundle " + name, e); + return null; + } + } + + private Logger logger() { + return Logger.getLogger("javax.management.locale"); + } + } } diff --git a/jdk/src/share/classes/javax/management/MBeanServerNotification.java b/jdk/src/share/classes/javax/management/MBeanServerNotification.java index 723d2d4c1e6..55e71cec331 100644 --- a/jdk/src/share/classes/javax/management/MBeanServerNotification.java +++ b/jdk/src/share/classes/javax/management/MBeanServerNotification.java @@ -27,15 +27,43 @@ package javax.management; /** - * Represents a notification emitted by the MBean server through the MBeanServerDelegate MBean. + * Represents a notification emitted by the MBean Server through the MBeanServerDelegate MBean. * The MBean Server emits the following types of notifications: MBean registration, MBean - * de-registration. + * unregistration. *

    - * To receive to MBeanServerNotifications, you need to be declared as listener to - * the {@link javax.management.MBeanServerDelegate javax.management.MBeanServerDelegate} MBean - * that represents the MBeanServer. The ObjectName of the MBeanServerDelegate is: + * To receive MBeanServerNotifications, you need to register a listener with + * the {@link MBeanServerDelegate MBeanServerDelegate} MBean + * that represents the MBeanServer. The ObjectName of the MBeanServerDelegate is + * {@link MBeanServerDelegate#DELEGATE_NAME}, which is * JMImplementation:type=MBeanServerDelegate. * + *

    The following code prints a message every time an MBean is registered + * or unregistered in the MBean Server {@code mbeanServer}:

    + * + *
    + * private static final NotificationListener printListener = new NotificationListener() {
    + *     public void handleNotification(Notification n, Object handback) {
    + *         if (!(n instanceof MBeanServerNotification)) {
    + *             System.out.println("Ignored notification of class " + n.getClass().getName());
    + *             return;
    + *         }
    + *         MBeanServerNotification mbsn = (MBeanServerNotification) n;
    + *         String what;
    + *         if (n.getType().equals(MBeanServerNotification.REGISTRATION_NOTIFICATION))
    + *             what = "MBean registered";
    + *         else if (n.getType().equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION))
    + *             what = "MBean unregistered";
    + *         else
    + *             what = "Unknown type " + n.getType();
    + *         System.out.println("Received MBean Server notification: " + what + ": " +
    + *                 mbsn.getMBeanName());
    + * };
    + *
    + * ...
    + *     mbeanServer.addNotificationListener(
    + *             MBeanServerDelegate.DELEGATE_NAME, printListener, null, null);
    + * 
    + * * @since 1.5 */ public class MBeanServerNotification extends Notification { diff --git a/jdk/src/share/classes/javax/management/Notification.java b/jdk/src/share/classes/javax/management/Notification.java index 07fc19b3e36..de07ec44748 100644 --- a/jdk/src/share/classes/javax/management/Notification.java +++ b/jdk/src/share/classes/javax/management/Notification.java @@ -54,7 +54,7 @@ import com.sun.jmx.mbeanserver.GetPropertyAction; * @since 1.5 */ @SuppressWarnings("serial") // serialVersionUID is not constant -public class Notification extends EventObject { +public class Notification extends EventObject implements Cloneable { // Serialization compatibility stuff: // Two serial forms are supported in this class. The selected form depends @@ -243,6 +243,26 @@ public class Notification extends EventObject { this.message = message ; } + /** + *

    Creates and returns a copy of this object. The copy is created as + * described for {@link Object#clone()}. This means, first, that the + * class of the object will be the same as the class of this object, and, + * second, that the copy is a "shallow copy". Fields of this notification + * are not themselves copied. In particular, the {@linkplain + * #getUserData user data} of the copy is the same object as the + * original.

    + * + * @return a copy of this object. + */ + @Override + public Object clone() { + try { + return super.clone(); + } catch (CloneNotSupportedException e) { + throw new AssertionError(e); + } + } + /** * Sets the source. * @@ -285,8 +305,10 @@ public class Notification extends EventObject { /** * Get the notification type. * - * @return The notification type. It's a string expressed in a dot notation similar - * to Java properties. An example of a notification type is network.alarm.router . + * @return The notification type. It's a string expressed in a dot notation + * similar to Java properties. It is recommended that the notification type + * should follow the reverse-domain-name convention used by Java package + * names. An example of a notification type is com.example.alarm.router. */ public String getType() { return type ; @@ -317,14 +339,25 @@ public class Notification extends EventObject { /** * Get the notification message. * - * @return The message string of this notification object. It contains in a string, - * which could be the explanation of the notification for displaying to a user + * @return The message string of this notification object. * + * @see #setMessage */ public String getMessage() { return message ; } + /** + * Set the notification message. + * + * @param message the new notification message. + * + * @see #getMessage + */ + public void setMessage(String message) { + this.message = message; + } + /** * Get the user data. * @@ -355,6 +388,7 @@ public class Notification extends EventObject { * * @return A String representation of this notification. */ + @Override public String toString() { return super.toString()+"[type="+type+"][message="+message+"]"; } diff --git a/jdk/src/share/classes/javax/management/event/EventClient.java b/jdk/src/share/classes/javax/management/event/EventClient.java index 96c4017e450..a2f6bc617fe 100644 --- a/jdk/src/share/classes/javax/management/event/EventClient.java +++ b/jdk/src/share/classes/javax/management/event/EventClient.java @@ -29,7 +29,6 @@ import com.sun.jmx.event.DaemonThreadFactory; import com.sun.jmx.event.LeaseRenewer; import com.sun.jmx.event.ReceiverBuffer; import com.sun.jmx.event.RepeatedSingletonJob; -import com.sun.jmx.namespace.JMXNamespaceUtils; import com.sun.jmx.mbeanserver.PerThreadGroupPool; import com.sun.jmx.remote.util.ClassLogger; @@ -58,7 +57,6 @@ import javax.management.NotificationBroadcasterSupport; import javax.management.NotificationFilter; import javax.management.NotificationListener; import javax.management.ObjectName; -import javax.management.remote.JMXConnector; import javax.management.remote.NotificationResult; import javax.management.remote.TargetedNotification; @@ -129,11 +127,12 @@ public class EventClient implements EventConsumer, NotificationManager { public static final String NOTIFS_LOST = "jmx.event.service.notifs.lost"; /** - * The default lease time, {@value}, in milliseconds. + * The default lease time that EventClient instances will request, in + * milliseconds. This value is {@value}. * * @see EventClientDelegateMBean#lease */ - public static final long DEFAULT_LEASE_TIMEOUT = 300000; + public static final long DEFAULT_REQUESTED_LEASE_TIME = 300000; /** *

    Constructs a default {@code EventClient} object.

    @@ -173,7 +172,7 @@ public class EventClient implements EventConsumer, NotificationManager { */ public EventClient(EventClientDelegateMBean delegate) throws IOException { - this(delegate, null, null, null, DEFAULT_LEASE_TIMEOUT); + this(delegate, null, null, null, DEFAULT_REQUESTED_LEASE_TIME); } /** @@ -196,7 +195,7 @@ public class EventClient implements EventConsumer, NotificationManager { * If {@code null}, a default scheduler will be used. * @param requestedLeaseTime The lease time used to keep this client alive * in the {@link EventClientDelegateMBean}. A value of zero is equivalent - * to the {@linkplain #DEFAULT_LEASE_TIMEOUT default value}. + * to the {@linkplain #DEFAULT_REQUESTED_LEASE_TIME default value}. * * @throws IllegalArgumentException If {@code delegate} is null. * @throws IOException If an I/O error occurs when communicating with the @@ -213,7 +212,7 @@ public class EventClient implements EventConsumer, NotificationManager { } if (requestedLeaseTime == 0) - requestedLeaseTime = DEFAULT_LEASE_TIMEOUT; + requestedLeaseTime = DEFAULT_REQUESTED_LEASE_TIME; else if (requestedLeaseTime < 0) { throw new IllegalArgumentException( "Negative lease time: " + requestedLeaseTime); @@ -269,7 +268,13 @@ public class EventClient implements EventConsumer, NotificationManager { new ScheduledThreadPoolExecutor(20, daemonThreadFactory); executor.setKeepAliveTime(1, TimeUnit.SECONDS); executor.allowCoreThreadTimeOut(true); - executor.setRemoveOnCancelPolicy(true); + if (setRemoveOnCancelPolicy != null) { + try { + setRemoveOnCancelPolicy.invoke(executor, true); + } catch (Exception e) { + logger.trace("setRemoveOnCancelPolicy", e); + } + } // By default, a ScheduledThreadPoolExecutor will keep jobs // in its queue even after they have been cancelled. They // will only be removed when their scheduled time arrives. @@ -277,12 +282,25 @@ public class EventClient implements EventConsumer, NotificationManager { // this EventClient, this can lead to a moderately large number // of objects remaining referenced until the renewal time // arrives. Hence the above call, which removes the job from - // the queue as soon as it is cancelled. + // the queue as soon as it is cancelled. Since the call is + // new with JDK 7, we invoke it via reflection to make it + // easier to use this code on JDK 6. return executor; } }; return leaseRenewerThreadPool.getThreadPoolExecutor(create); + } + private static final Method setRemoveOnCancelPolicy; + static { + Method m; + try { + m = ScheduledThreadPoolExecutor.class.getMethod( + "setRemoveOnCancelPolicy", boolean.class); + } catch (Exception e) { + m = null; + } + setRemoveOnCancelPolicy = m; } /** @@ -1042,7 +1060,7 @@ public class EventClient implements EventConsumer, NotificationManager { final public EventClient call() throws Exception { EventClientDelegateMBean ecd = EventClientDelegate.getProxy(conn); return new EventClient(ecd, eventRelay, null, null, - DEFAULT_LEASE_TIMEOUT); + DEFAULT_REQUESTED_LEASE_TIME); } }; @@ -1080,24 +1098,6 @@ public class EventClient implements EventConsumer, NotificationManager { return clientId; } - /** - * Returns a JMX Connector that will use an {@link EventClient} - * to subscribe for notifications. If the server doesn't have - * an {@link EventClientDelegateMBean}, then the connector will - * use the legacy notification mechanism instead. - * - * @param wrapped The underlying JMX Connector wrapped by the returned - * connector. - * - * @return A JMX Connector that will uses an {@link EventClient}, if - * available. - * - * @see EventClient#getEventClientConnection(MBeanServerConnection) - */ - public static JMXConnector withEventClient(final JMXConnector wrapped) { - return JMXNamespaceUtils.withEventClient(wrapped); - } - private static final PerThreadGroupPool leaseRenewerThreadPool = PerThreadGroupPool.make(); } diff --git a/jdk/src/share/classes/javax/management/event/EventClientDelegate.java b/jdk/src/share/classes/javax/management/event/EventClientDelegate.java index 13329ea9e6f..8eeeeb1f5c1 100644 --- a/jdk/src/share/classes/javax/management/event/EventClientDelegate.java +++ b/jdk/src/share/classes/javax/management/event/EventClientDelegate.java @@ -149,6 +149,7 @@ public class EventClientDelegate implements EventClientDelegateMBean { // of a setMBeanServer on some other forwarder later in the chain. private static class Forwarder extends SingleMBeanForwarder { + private MBeanServer loopMBS; private static class UnsupportedInvocationHandler implements InvocationHandler { @@ -173,7 +174,11 @@ public class EventClientDelegate implements EventClientDelegateMBean { private volatile boolean madeECD; Forwarder() { - super(OBJECT_NAME, makeUnsupportedECD()); + super(OBJECT_NAME, makeUnsupportedECD(), true); + } + + synchronized void setLoopMBS(MBeanServer loopMBS) { + this.loopMBS = loopMBS; } @Override @@ -186,7 +191,7 @@ public class EventClientDelegate implements EventClientDelegateMBean { AccessController.doPrivileged( new PrivilegedAction() { public EventClientDelegate run() { - return getEventClientDelegate(Forwarder.this); + return getEventClientDelegate(loopMBS); } }); DynamicMBean mbean = new StandardMBean( @@ -208,11 +213,46 @@ public class EventClientDelegate implements EventClientDelegateMBean { * that are targeted for that MBean and handles them itself. All other * requests are forwarded to the next element in the forwarder chain.

    * + * @param nextMBS the next {@code MBeanServer} in the chain of forwarders, + * which might be another {@code MBeanServerForwarder} or a plain {@code + * MBeanServer}. This is the object to which {@code MBeanServer} requests + * that do not concern the {@code EventClientDelegateMBean} are sent. + * It will be the value of {@link MBeanServerForwarder#getMBeanServer() + * getMBeanServer()} on the returned object, and can be changed with {@link + * MBeanServerForwarder#setMBeanServer setMBeanServer}. It can be null but + * must be set to a non-null value before any {@code MBeanServer} requests + * arrive. + * + * @param loopMBS the {@code MBeanServer} to which requests from the + * {@code EventClientDelegateMBean} should be sent. For example, + * when you invoke the {@link EventClientDelegateMBean#addListener + * addListener} operation on the {@code EventClientDelegateMBean}, it will + * result in a call to {@link + * MBeanServer#addNotificationListener(ObjectName, NotificationListener, + * NotificationFilter, Object) addNotificationListener} on this object. + * If this parameter is null, then these requests will be sent to the + * newly-created {@code MBeanServerForwarder}. Usually the parameter will + * either be null or will be the result of {@link + * javax.management.remote.JMXConnectorServer#getSystemMBeanServerForwarder() + * getSystemMBeanServerForwarder()} for the connector server in which + * this forwarder will be installed. + * * @return a new {@code MBeanServerForwarder} that simulates the existence * of an {@code EventClientDelegateMBean}. + * + * @see javax.management.remote.JMXConnectorServer#installStandardForwarders */ - public static MBeanServerForwarder newForwarder() { - return new Forwarder(); + public static MBeanServerForwarder newForwarder( + MBeanServer nextMBS, MBeanServer loopMBS) { + Forwarder mbsf = new Forwarder(); + // We must setLoopMBS before setMBeanServer, because when we + // setMBeanServer that will call getEventClientDelegate(loopMBS). + if (loopMBS == null) + loopMBS = mbsf; + mbsf.setLoopMBS(loopMBS); + if (nextMBS != null) + mbsf.setMBeanServer(nextMBS); + return mbsf; } /** @@ -437,10 +477,9 @@ public class EventClientDelegate implements EventClientDelegateMBean { // private classes // ------------------------------------ private class ClientInfo { - String clientId; - EventBuffer buffer; - NotificationListener clientListener; - Map listenerInfoMap = + final String clientId; + final NotificationListener clientListener; + final Map listenerInfoMap = new HashMap(); ClientInfo(String clientId, EventForwarder forwarder) { @@ -703,7 +742,8 @@ public class EventClientDelegate implements EventClientDelegateMBean { clientInfo = clientInfoMap.get(clientId); if (clientInfo == null) { - throw new EventClientNotFoundException("The client is not found."); + throw new EventClientNotFoundException( + "Client not found (id " + clientId + ")"); } return clientInfo; diff --git a/jdk/src/share/classes/javax/management/event/EventClientDelegateMBean.java b/jdk/src/share/classes/javax/management/event/EventClientDelegateMBean.java index a9718a931dc..e6030b613a9 100644 --- a/jdk/src/share/classes/javax/management/event/EventClientDelegateMBean.java +++ b/jdk/src/share/classes/javax/management/event/EventClientDelegateMBean.java @@ -51,7 +51,8 @@ import javax.management.remote.NotificationResult; * and the MBean Server, that will intercept accesses to the Event Client * Delegate MBean and treat them as the real MBean would. This forwarder is * inserted by default with the standard RMI Connector Server, and can also - * be created explicitly using {@link EventClientDelegate#newForwarder()}. + * be created explicitly using {@link EventClientDelegate#newForwarder + * EventClientDelegate.newForwarder}. * *
  • A variant on the above is to replace the MBean Server that is * used locally with a forwarder as described above. Since @@ -61,9 +62,7 @@ import javax.management.remote.NotificationResult; * *

      * MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();  // or whatever
    - * MBeanServerForwarder mbsf = EventClientDelegate.newForwarder();
    - * mbsf.setMBeanServer(mbs);
    - * mbs = mbsf;
    + * mbs = EventClientDelegate.newForwarder(mbs, null);
      * // now use mbs just as you did before, but it will have an EventClientDelegate
      * 
    * diff --git a/jdk/src/share/classes/javax/management/event/EventRelay.java b/jdk/src/share/classes/javax/management/event/EventRelay.java index d723bb04c4e..d106a160551 100644 --- a/jdk/src/share/classes/javax/management/event/EventRelay.java +++ b/jdk/src/share/classes/javax/management/event/EventRelay.java @@ -27,7 +27,6 @@ package javax.management.event; import java.io.IOException; import java.util.concurrent.Executors; // for javadoc -import java.util.concurrent.ScheduledFuture; /** * This interface is used to specify a way to receive diff --git a/jdk/src/share/classes/javax/management/event/package-info.java b/jdk/src/share/classes/javax/management/event/package-info.java index c4c7dbed63d..728b095139e 100644 --- a/jdk/src/share/classes/javax/management/event/package-info.java +++ b/jdk/src/share/classes/javax/management/event/package-info.java @@ -83,8 +83,8 @@ * javax.management.event.EventClientDelegateMBean EventClientDelegateMBean} * must be registered in the MBean Server, or the connector server must * be configured to simulate the existence of this MBean, for example - * using {@link javax.management.event.EventClientDelegate#newForwarder() - * EventClientDelegate.newForwarder()}. The standard RMI connector is so + * using {@link javax.management.event.EventClientDelegate#newForwarder + * EventClientDelegate.newForwarder}. The standard RMI connector is so * configured by default. The {@code EventClientDelegateMBean} documentation * has further details.

    * diff --git a/jdk/src/share/classes/javax/management/namespace/JMXNamespaces.java b/jdk/src/share/classes/javax/management/namespace/JMXNamespaces.java index 429a9d466d6..f19dfa570e4 100644 --- a/jdk/src/share/classes/javax/management/namespace/JMXNamespaces.java +++ b/jdk/src/share/classes/javax/management/namespace/JMXNamespaces.java @@ -26,21 +26,19 @@ package javax.management.namespace; import com.sun.jmx.defaults.JmxProperties; -import com.sun.jmx.namespace.JMXNamespaceUtils; import com.sun.jmx.namespace.ObjectNameRouter; import com.sun.jmx.namespace.serial.RewritingProcessor; import com.sun.jmx.namespace.RoutingConnectionProxy; import com.sun.jmx.namespace.RoutingServerProxy; -import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; +import javax.management.InstanceNotFoundException; import javax.management.MBeanServer; import javax.management.MBeanServerConnection; import javax.management.MalformedObjectNameException; import javax.management.ObjectName; -import javax.management.remote.JMXConnector; /** * Static constants and utility methods to help work with @@ -68,23 +66,6 @@ public class JMXNamespaces { NAMESPACE_SEPARATOR.length(); - /** - * Returns a connector connected to a sub name space exposed through - * the parent connector. - * @param parent the parent connector. - * @param namespace the {@linkplain javax.management.namespace name space} - * to which the returned connector is - * connected. - * @return A connector connected to a sub name space exposed through - * the parent connector. - **/ - public static JMXConnector narrowToNamespace(final JMXConnector parent, - final String namespace) - throws IOException { - - return JMXNamespaceUtils.cd(parent,namespace,true); - } - /** * Creates a new {@code MBeanServerConnection} proxy on a * {@linkplain javax.management.namespace sub name space} @@ -96,15 +77,18 @@ public class JMXNamespaces { * name space} in which to narrow. * @return A new {@code MBeanServerConnection} proxy that shows the content * of that name space. - * @throws IllegalArgumentException if the name space does not exist, or - * if a proxy for that name space cannot be created. + * @throws IllegalArgumentException if either argument is null, + * or the name space does not exist, or if a proxy for that name space + * cannot be created. The {@linkplain Throwable#getCause() cause} of + * this exception will be an {@link InstanceNotFoundException} if and only + * if the name space is found not to exist. */ public static MBeanServerConnection narrowToNamespace( MBeanServerConnection parent, String namespace) { if (LOG.isLoggable(Level.FINER)) LOG.finer("Making MBeanServerConnection for: " +namespace); - return RoutingConnectionProxy.cd(parent,namespace); + return RoutingConnectionProxy.cd(parent, namespace, true); } /** @@ -120,13 +104,15 @@ public class JMXNamespaces { * of that name space. * @throws IllegalArgumentException if either argument is null, * or the name space does not exist, or if a proxy for that name space - * cannot be created. + * cannot be created. The {@linkplain Throwable#getCause() cause} of + * this exception will be an {@link InstanceNotFoundException} if and only + * if the name space is found not to exist. */ public static MBeanServer narrowToNamespace(MBeanServer parent, String namespace) { if (LOG.isLoggable(Level.FINER)) - LOG.finer("Making NamespaceServerProxy for: " +namespace); - return RoutingServerProxy.cd(parent,namespace); + LOG.finer("Making MBeanServer for: " +namespace); + return RoutingServerProxy.cd(parent, namespace, true); } /** @@ -266,7 +252,7 @@ public class JMXNamespaces { ObjectNameRouter.normalizeNamespacePath(namespace,false, true,false); try { - // We could use Util.newObjectName here - but throwing an + // We could use ObjectName.valueOf here - but throwing an // IllegalArgumentException that contains just the supplied // namespace instead of the whole ObjectName seems preferable. return ObjectName.getInstance(sourcePath+ diff --git a/jdk/src/share/classes/javax/management/namespace/JMXRemoteNamespace.java b/jdk/src/share/classes/javax/management/namespace/JMXRemoteNamespace.java index 6958f57f2d7..1c4d29bae30 100644 --- a/jdk/src/share/classes/javax/management/namespace/JMXRemoteNamespace.java +++ b/jdk/src/share/classes/javax/management/namespace/JMXRemoteNamespace.java @@ -27,10 +27,10 @@ package javax.management.namespace; import com.sun.jmx.defaults.JmxProperties; import com.sun.jmx.mbeanserver.Util; -import com.sun.jmx.namespace.JMXNamespaceUtils; import com.sun.jmx.remote.util.EnvHelp; import java.io.IOException; +import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.concurrent.atomic.AtomicLong; @@ -39,6 +39,7 @@ import java.util.logging.Logger; import javax.management.AttributeChangeNotification; +import javax.management.ClientContext; import javax.management.InstanceNotFoundException; import javax.management.ListenerNotFoundException; import javax.management.MBeanNotificationInfo; @@ -220,17 +221,26 @@ public class JMXRemoteNamespace initParentOnce(this); // URL must not be null. - this.jmxURL = JMXNamespaceUtils.checkNonNull(sourceURL,"url"); + if (sourceURL == null) + throw new IllegalArgumentException("Null URL"); + this.jmxURL = sourceURL; this.broadcaster = new NotificationBroadcasterSupport(connectNotification); // handles options - this.optionsMap = JMXNamespaceUtils.unmodifiableMap(optionsMap); + this.optionsMap = unmodifiableMap(optionsMap); // handles (dis)connection events this.listener = new ConnectionListener(); } + // returns un unmodifiable view of a map. + private static Map unmodifiableMap(Map aMap) { + if (aMap == null || aMap.isEmpty()) + return Collections.emptyMap(); + return Collections.unmodifiableMap(aMap); + } + /** * Returns the {@code JMXServiceURL} that is (or will be) used to * connect to the remote name space.

    @@ -483,106 +493,171 @@ public class JMXRemoteNamespace } } - JMXConnector connect(JMXServiceURL url, Map env) + private JMXConnector connect(JMXServiceURL url, Map env) throws IOException { - final JMXConnector c = newJMXConnector(jmxURL, env); + final JMXConnector c = newJMXConnector(url, env); c.connect(env); return c; } /** - * Creates a new JMXConnector with the specified {@code url} and - * {@code env} options map. - *

    - * This method first calls {@link JMXConnectorFactory#newJMXConnector - * JMXConnectorFactory.newJMXConnector(jmxURL, env)} to obtain a new - * JMX connector, and returns that. - *

    - *

    - * A subclass of {@link JMXRemoteNamespace} can provide an implementation - * that connects to a sub namespace of the remote server by subclassing - * this class in the following way: - *

    -     * class JMXRemoteSubNamespace extends JMXRemoteNamespace {
    -     *    private final String subnamespace;
    -     *    JMXRemoteSubNamespace(JMXServiceURL url,
    -     *              Map{@code } env, String subnamespace) {
    -     *        super(url,options);
    -     *        this.subnamespace = subnamespace;
    -     *    }
    -     *    protected JMXConnector newJMXConnector(JMXServiceURL url,
    -     *              Map env) throws IOException {
    -     *        final JMXConnector inner = super.newJMXConnector(url,env);
    -     *        return {@link JMXNamespaces#narrowToNamespace(JMXConnector,String)
    -     *               JMXNamespaces.narrowToNamespace(inner,subnamespace)};
    -     *    }
    -     * }
    -     * 
    - *

    - *

    - * Some connectors, like the JMXMP connector server defined by the - * version 1.2 of the JMX API may not have been upgraded to use the - * new {@linkplain javax.management.event Event Service} defined in this - * version of the JMX API. - *

    - * In that case, and if the remote server to which this JMXRemoteNamespace - * connects also contains namespaces, it may be necessary to configure - * explicitly an {@linkplain - * javax.management.event.EventClientDelegate#newForwarder() - * Event Client Forwarder} on the remote server side, and to force the use - * of an {@link EventClient} on this client side. - *
    - * A subclass of {@link JMXRemoteNamespace} can provide an implementation - * of {@code newJMXConnector} that will force notification subscriptions - * to flow through an {@link EventClient} over a legacy protocol by - * overriding this method in the following way: - *

    - *
    -     * class JMXRemoteEventClientNamespace extends JMXRemoteNamespace {
    -     *    JMXRemoteSubNamespaceConnector(JMXServiceURL url,
    -     *              Map env) {
    -     *        super(url,options);
    -     *    }
    -     *    protected JMXConnector newJMXConnector(JMXServiceURL url,
    -     *              Map env) throws IOException {
    -     *        final JMXConnector inner = super.newJMXConnector(url,env);
    -     *        return {@link EventClient#withEventClient(
    -     *                JMXConnector) EventClient.withEventClient(inner)};
    -     *    }
    -     * }
    -     * 
    - *

    - * Note that the remote server also needs to provide an {@link - * javax.management.event.EventClientDelegateMBean}: only configuring - * the client side (this object) is not enough.
    - * In summary, this technique should be used if the remote server - * supports JMX namespaces, but uses a JMX Connector Server whose - * implementation does not transparently use the new Event Service - * (as would be the case with the JMXMPConnectorServer implementation - * from the reference implementation of the JMX Remote API 1.0 - * specification). - *

    + *

    Creates a new JMXConnector with the specified {@code url} and + * {@code env} options map. The default implementation of this method + * returns {@link JMXConnectorFactory#newJMXConnector + * JMXConnectorFactory.newJMXConnector(jmxURL, env)}. Subclasses can + * override this method to customize behavior.

    + * * @param url The JMXServiceURL of the remote server. - * @param optionsMap An unmodifiable options map that will be passed to the + * @param optionsMap An options map that will be passed to the * {@link JMXConnectorFactory} when {@linkplain * JMXConnectorFactory#newJMXConnector creating} the * {@link JMXConnector} that can connect to the remote source * MBean Server. - * @return An unconnected JMXConnector to use to connect to the remote - * server - * @throws java.io.IOException if the connector could not be created. + * @return A JMXConnector to use to connect to the remote server + * @throws IOException if the connector could not be created. * @see JMXConnectorFactory#newJMXConnector(javax.management.remote.JMXServiceURL, java.util.Map) * @see #JMXRemoteNamespace */ protected JMXConnector newJMXConnector(JMXServiceURL url, Map optionsMap) throws IOException { - final JMXConnector c = - JMXConnectorFactory.newJMXConnector(jmxURL, optionsMap); -// TODO: uncomment this when contexts are added -// return ClientContext.withDynamicContext(c); - return c; + return JMXConnectorFactory.newJMXConnector(jmxURL, optionsMap); } + /** + *

    Called when a new connection is established using {@link #connect} + * so that subclasses can customize the connection. The default + * implementation of this method effectively does the following:

    + * + *
    +     * MBeanServerConnection mbsc = {@link JMXConnector#getMBeanServerConnection()
    +     *                               jmxc.getMBeanServerConnection()};
    +     * try {
    +     *     return {@link ClientContext#withDynamicContext
    +     *             ClientContext.withDynamicContext(mbsc)};
    +     * } catch (IllegalArgumentException e) {
    +     *     return mbsc;
    +     * }
    +     * 
    + * + *

    In other words, it arranges for the client context to be forwarded + * to the remote MBean Server if the remote MBean Server supports contexts; + * otherwise it ignores the client context.

    + * + *

    Example: connecting to a remote namespace

    + * + *

    A subclass that wanted to narrow into a namespace of + * the remote MBeanServer might look like this:

    + * + *
    +     * class JMXRemoteSubNamespace extends JMXRemoteNamespace {
    +     *     private final String subnamespace;
    +     *
    +     *     JMXRemoteSubNamespace(
    +     *             JMXServiceURL url, Map{@code } env, String subnamespace) {
    +     *        super(url, env);
    +     *        this.subnamespace = subnamespace;
    +     *     }
    +     *
    +     *     {@code @Override}
    +     *     protected MBeanServerConnection getMBeanServerConnection(
    +     *             JMXConnector jmxc) throws IOException {
    +     *         MBeanServerConnection mbsc = super.getMBeanServerConnection(jmxc);
    +     *         return {@link JMXNamespaces#narrowToNamespace(MBeanServerConnection,String)
    +     *                 JMXNamespaces.narrowToNamespace(mbsc, subnamespace)};
    +     *     }
    +     * }
    +     * 
    + * + *

    Example: using the Event Service for notifications

    + * + *

    Some connectors may have been designed to work with an earlier + * version of the JMX API, and may not have been upgraded to use + * the {@linkplain javax.management.event Event Service} defined in + * this version of the JMX API. In that case, and if the remote + * server to which this JMXRemoteNamespace connects also contains + * namespaces, it may be necessary to configure explicitly an {@linkplain + * javax.management.event.EventClientDelegate#newForwarder Event Client + * Forwarder} on the remote server side, and to force the use of an {@link + * EventClient} on this client side.

    + * + *

    A subclass of {@link JMXRemoteNamespace} can provide an + * implementation of {@code getMBeanServerConnection} that will force + * notification subscriptions to flow through an {@link EventClient} over + * a legacy protocol. It can do so by overriding this method in the + * following way:

    + * + *
    +     * class JMXRemoteEventClientNamespace extends JMXRemoteNamespace {
    +     *     JMXRemoteEventClientNamespace(JMXServiceURL url, {@code Map} env) {
    +     *         super(url, env);
    +     *     }
    +     *
    +     *     {@code @Override}
    +     *     protected MBeanServerConnection getMBeanServerConnection(JMXConnector jmxc)
    +     *             throws IOException {
    +     *         MBeanServerConnection mbsc = super.getMBeanServerConnection(jmxc);
    +     *         return EventClient.getEventClientConnection(mbsc);
    +     *     }
    +     * }
    +     * 
    + * + *

    + * Note that the remote server also needs to provide an {@link + * javax.management.event.EventClientDelegateMBean}: configuring only + * the client side (this object) is not enough.

    + * + *

    In summary, this technique should be used if the remote server + * supports JMX namespaces, but uses a JMX Connector Server whose + * implementation does not transparently use the new Event Service + * (as would be the case with the JMXMPConnectorServer implementation + * from the reference implementation of the JMX Remote API 1.0 + * specification).

    + * + * @param jmxc the newly-created {@code JMXConnector}. + * + * @return an {@code MBeanServerConnection} connected to the remote + * MBeanServer. + * + * @throws IOException if the connection cannot be made. If this method + * throws {@code IOException} then the calling {@link #connect()} method + * will also fail with an {@code IOException}. + * + * @see #connect + */ + protected MBeanServerConnection getMBeanServerConnection(JMXConnector jmxc) + throws IOException { + final MBeanServerConnection mbsc = jmxc.getMBeanServerConnection(); + try { + return ClientContext.withDynamicContext(mbsc); + } catch (IllegalArgumentException e) { + LOG.log(Level.FINER, "ClientContext.withDynamicContext", e); + return mbsc; + } + } + + /** + * {@inheritDoc} + * + *

    The sequence of events when this method is called includes, + * effectively, the following code:

    + * + *
    +     * JMXServiceURL url = {@link #getJMXServiceURL getJMXServiceURL}();
    +     * JMXConnector jmxc = {@link #newJMXConnector newJMXConnector}(url, env);
    +     * jmxc.connect();
    +     * MBeanServerConnection mbsc = {@link #getMBeanServerConnection(JMXConnector)
    +     *                               getMBeanServerConnection}(jmxc);
    +     * 
    + * + *

    Here, {@code env} is a {@code Map} containing the entries from the + * {@code optionsMap} that was passed to the {@linkplain #JMXRemoteNamespace + * constructor} or to the {@link #newJMXRemoteNamespace newJMXRemoteNamespace} + * factory method.

    + * + *

    Subclasses can customize connection behavior by overriding the + * {@code getJMXServiceURL}, {@code newJMXConnector}, or + * {@code getMBeanServerConnection} methods.

    + */ public void connect() throws IOException { LOG.fine("connecting..."); final Map env = @@ -590,7 +665,7 @@ public class JMXRemoteNamespace try { // XXX: We should probably document this... // This allows to specify a loader name - which will be - // retrieved from the paret MBeanServer. + // retrieved from the parent MBeanServer. defaultClassLoader = EnvHelp.resolveServerClassLoader(env,getMBeanServer()); } catch (InstanceNotFoundException x) { @@ -604,7 +679,7 @@ public class JMXRemoteNamespace final JMXConnector aconn = connect(url,env); final MBeanServerConnection msc; try { - msc = aconn.getMBeanServerConnection(); + msc = getMBeanServerConnection(aconn); aconn.addConnectionNotificationListener(listener,null,aconn); } catch (IOException io) { close(aconn); diff --git a/jdk/src/share/classes/javax/management/remote/JMXConnectorFactory.java b/jdk/src/share/classes/javax/management/remote/JMXConnectorFactory.java index 051d8b34c45..77f700c3215 100644 --- a/jdk/src/share/classes/javax/management/remote/JMXConnectorFactory.java +++ b/jdk/src/share/classes/javax/management/remote/JMXConnectorFactory.java @@ -322,10 +322,12 @@ public class JMXConnectorFactory { JMXConnectorProvider.class; final String protocol = serviceURL.getProtocol(); final String providerClassName = "ClientProvider"; + final JMXServiceURL providerURL = serviceURL; - JMXConnectorProvider provider = - getProvider(serviceURL, envcopy, providerClassName, - targetInterface, loader); + JMXConnectorProvider provider = getProvider(providerURL, envcopy, + providerClassName, + targetInterface, + loader); IOException exception = null; if (provider == null) { @@ -336,7 +338,7 @@ public class JMXConnectorFactory { if (loader != null) { try { JMXConnector connection = - getConnectorAsService(loader, serviceURL, envcopy); + getConnectorAsService(loader, providerURL, envcopy); if (connection != null) return connection; } catch (JMXProviderException e) { @@ -345,8 +347,7 @@ public class JMXConnectorFactory { exception = e; } } - provider = - getProvider(protocol, PROTOCOL_PROVIDER_DEFAULT_PACKAGE, + provider = getProvider(protocol, PROTOCOL_PROVIDER_DEFAULT_PACKAGE, JMXConnectorFactory.class.getClassLoader(), providerClassName, targetInterface); } @@ -448,9 +449,10 @@ public class JMXConnectorFactory { getProviderIterator(JMXConnectorProvider.class, loader); JMXConnector connection; IOException exception = null; - while(providers.hasNext()) { + while (providers.hasNext()) { + JMXConnectorProvider provider = providers.next(); try { - connection = providers.next().newJMXConnector(url, map); + connection = provider.newJMXConnector(url, map); return connection; } catch (JMXProviderException e) { throw e; @@ -553,4 +555,5 @@ public class JMXConnectorFactory { private static String protocol2package(String protocol) { return protocol.replace('+', '.').replace('-', '_'); } + } diff --git a/jdk/src/share/classes/javax/management/remote/JMXConnectorServer.java b/jdk/src/share/classes/javax/management/remote/JMXConnectorServer.java index 88348ff5de3..c9b4721911b 100644 --- a/jdk/src/share/classes/javax/management/remote/JMXConnectorServer.java +++ b/jdk/src/share/classes/javax/management/remote/JMXConnectorServer.java @@ -33,6 +33,7 @@ import java.util.List; import java.util.Map; import java.util.NoSuchElementException; +import javax.management.ClientContext; import javax.management.MBeanInfo; // for javadoc import javax.management.MBeanNotificationInfo; import javax.management.MBeanRegistration; @@ -101,6 +102,56 @@ public abstract class JMXConnectorServer public static final String DELEGATE_TO_EVENT_SERVICE = "jmx.remote.delegate.event.service"; + /** + *

    Name of the attribute that specifies whether this connector + * server allows clients to communicate a context with each request. + * The value associated with this attribute, if any, must be a string + * that is equal to {@code "true"} or {@code "false"}, ignoring case. + * If it is {@code "true"}, then the connector server will simulate + * a namespace {@code jmx.context//}, as described in + * {@link ClientContext#newContextForwarder}. This namespace is needed + * for {@link ClientContext#withContext ClientContext.withContext} to + * function correctly.

    + * + *

    Not all connector servers will understand this attribute, but the + * standard {@linkplain javax.management.remote.rmi.RMIConnectorServer + * RMI Connector Server} does. For a connector server that understands + * this attribute, the default value is {@code "true"}.

    + * + * @since 1.7 + */ + public static final String CONTEXT_FORWARDER = + "jmx.remote.context.forwarder"; + + /** + *

    Name of the attribute that specifies whether this connector server + * localizes the descriptions in the {@link MBeanInfo} object returned by + * {@link MBeanServer#getMBeanInfo MBeanServer.getMBeanInfo}, based on the + * locale communicated by the client.

    + * + *

    The value associated with this attribute, if any, must be a string + * that is equal to {@code "true"} or {@code "false"}, ignoring case. + * If it is {@code "true"}, then the connector server will localize + * {@code MBeanInfo} descriptions as specified in {@link + * ClientContext#newLocalizeMBeanInfoForwarder}.

    + * + *

    Not all connector servers will understand this attribute, but the + * standard {@linkplain javax.management.remote.rmi.RMIConnectorServer + * RMI Connector Server} does. For a connector server that understands + * this attribute, the default value is {@code "false"}.

    + * + *

    Because localization requires the client to be able to communicate + * its locale, it does not make sense to specify this attribute as + * {@code "true"} if {@link #CONTEXT_FORWARDER} is not also {@code "true"}. + * For a connector server that understands these attributes, specifying + * this inconsistent combination will result in an {@link + * IllegalArgumentException}.

    + * + * @since 1.7 + */ + public static final String LOCALIZE_MBEAN_INFO_FORWARDER = + "jmx.remote.localize.mbean.info"; + /** *

    Name of the attribute that specifies whether this connector * server simulates the existence of the {@link EventClientDelegate} @@ -155,7 +206,7 @@ public abstract class JMXConnectorServer * to, or null if it is not yet attached to an MBean server. * * @see #setMBeanServerForwarder - * @see #getSystemMBeanServer + * @see #getSystemMBeanServerForwarder */ public synchronized MBeanServer getMBeanServer() { return userMBeanServer; @@ -176,30 +227,36 @@ public abstract class JMXConnectorServer * this method, the first occurrence in the chain of an object that is * {@linkplain Object#equals equal} to {@code mbsf} will have been * removed.

    + * * @param mbsf the forwarder to remove + * * @throws NoSuchElementException if there is no occurrence of {@code mbsf} * in the chain. - * @throws IllegalArgumentException if {@code mbsf} is null. + * @throws IllegalArgumentException if {@code mbsf} is null or is the + * {@linkplain #getSystemMBeanServerForwarder() system forwarder}. + * + * @since 1.7 */ public synchronized void removeMBeanServerForwarder(MBeanServerForwarder mbsf) { if (mbsf == null) throw new IllegalArgumentException("Invalid null argument: mbsf"); + if (systemMBeanServerForwarder.equals(mbsf)) + throw new IllegalArgumentException("Cannot remove system forwarder"); - MBeanServerForwarder prev = null; - MBeanServer curr = systemMBeanServer; - while (curr instanceof MBeanServerForwarder && !mbsf.equals(curr)) { - prev = (MBeanServerForwarder) curr; + MBeanServerForwarder prev = systemMBeanServerForwarder; + MBeanServer curr; + while (true) { curr = prev.getMBeanServer(); + if (mbsf.equals(curr)) + break; + if (curr instanceof MBeanServerForwarder) + prev = (MBeanServerForwarder) curr; + else + throw new NoSuchElementException("MBeanServerForwarder not in chain"); } - if (!(curr instanceof MBeanServerForwarder)) - throw new NoSuchElementException("MBeanServerForwarder not in chain"); - MBeanServerForwarder deleted = (MBeanServerForwarder) curr; - MBeanServer next = deleted.getMBeanServer(); - if (prev != null) - prev.setMBeanServer(next); - if (systemMBeanServer == deleted) - systemMBeanServer = next; - if (userMBeanServer == deleted) + MBeanServer next = mbsf.getMBeanServer(); + prev.setMBeanServer(next); + if (userMBeanServer == mbsf) userMBeanServer = next; } @@ -209,66 +266,63 @@ public abstract class JMXConnectorServer * the systemMBeanServer and userMBeanServer field declarations. */ private void insertUserMBeanServer(MBeanServer mbs) { - MBeanServerForwarder lastSystemMBSF = null; - for (MBeanServer mbsi = systemMBeanServer; - mbsi != userMBeanServer; - mbsi = lastSystemMBSF.getMBeanServer()) { + MBeanServerForwarder lastSystemMBSF = systemMBeanServerForwarder; + while (true) { + MBeanServer mbsi = lastSystemMBSF.getMBeanServer(); + if (mbsi == userMBeanServer) + break; lastSystemMBSF = (MBeanServerForwarder) mbsi; } userMBeanServer = mbs; - if (lastSystemMBSF == null) - systemMBeanServer = mbs; - else - lastSystemMBSF.setMBeanServer(mbs); + lastSystemMBSF.setMBeanServer(mbs); } /** *

    Returns the first item in the chain of system and then user - * forwarders. In the simplest case, a {@code JMXConnectorServer} - * is connected directly to an {@code MBeanServer}. But there can - * also be a chain of {@link MBeanServerForwarder}s between the two. - * This chain consists of two sub-chains: first the system chain - * and then the user chain. Incoming requests are given to the - * first forwarder in the system chain. Each forwarder can handle - * a request itself, or more usually forward it to the next forwarder, - * perhaps with some extra behavior such as logging or security - * checking before or after the forwarding. The last forwarder in - * the system chain is followed by the first forwarder in the user - * chain.

    + * forwarders. There is a chain of {@link MBeanServerForwarder}s between + * a {@code JMXConnectorServer} and its {@code MBeanServer}. This chain + * consists of two sub-chains: first the system chain and then + * the user chain. Incoming requests are given to the first + * forwarder in the system chain. Each forwarder can handle a request + * itself, or more usually forward it to the next forwarder, perhaps with + * some extra behavior such as logging or security checking before or after + * the forwarding. The last forwarder in the system chain is followed by + * the first forwarder in the user chain.

    * - *

    The system chain is usually - * defined by a connector server based on the environment Map; - * see {@link JMXConnectorServerFactory#newJMXConnectorServer}. Allowing the - * connector server to define its forwarders in this way ensures that - * they are in the correct order - some forwarders need to be inserted - * before others for correct behavior. It is possible to modify the - * system chain, for example using {@link #setSystemMBeanServerForwarder} or - * {@link #removeMBeanServerForwarder}, but in that case the system - * chain is no longer guaranteed to be correct.

    + *

    The object returned by this method is the first forwarder in the + * system chain. For a given {@code JMXConnectorServer}, this method + * always returns the same object, which simply forwards every request + * to the next object in the chain.

    + * + *

    Not all connector servers support a system chain of forwarders, + * although the standard {@linkplain + * javax.management.remote.rmi.RMIConnectorServer RMI connector + * server} does. For those that do not, this method will throw {@code + * UnsupportedOperationException}. All + * connector servers do support a user chain of forwarders.

    + * + *

    The system chain is usually defined by a + * connector server based on the environment Map; see {@link + * JMXConnectorServerFactory#newJMXConnectorServer + * JMXConnectorServerFactory.newJMXConnectorServer}. Allowing + * the connector server to define its forwarders in this way + * ensures that they are in the correct order - some forwarders + * need to be inserted before others for correct behavior. It is + * possible to modify the system chain, for example using {@code + * connectorServer.getSystemMBeanServerForwarder().setMBeanServer(mbsf)} or + * {@link #removeMBeanServerForwarder removeMBeanServerForwarder}, but in + * that case the system chain is no longer guaranteed to be correct.

    * *

    The user chain is defined by calling {@link - * #setMBeanServerForwarder} to insert forwarders at the head of the user - * chain.

    - * - *

    If there are no forwarders in either chain, then both - * {@link #getMBeanServer()} and {@code getSystemMBeanServer()} will - * return the {@code MBeanServer} for this connector server. If there - * are forwarders in the user chain but not the system chain, then - * both methods will return the first forwarder in the user chain. - * If there are forwarders in the system chain but not the user chain, - * then {@code getSystemMBeanServer()} will return the first forwarder - * in the system chain, and {@code getMBeanServer()} will return the - * {@code MBeanServer} for this connector server. Finally, if there - * are forwarders in each chain then {@code getSystemMBeanServer()} - * will return the first forwarder in the system chain, and {@code - * getMBeanServer()} will return the first forwarder in the user chain.

    + * #setMBeanServerForwarder setMBeanServerForwarder} to insert forwarders + * at the head of the user chain.

    * *

    This code illustrates how the chains can be traversed:

    * *
          * JMXConnectorServer cs;
          * System.out.println("system chain:");
    -     * MBeanServer mbs = cs.getSystemMBeanServer();
    +     * MBeanServer mbs = cs.getSystemMBeanServerForwarder();
          * while (true) {
          *     if (mbs == cs.getMBeanServer())
          *         System.out.println("user chain:");
    @@ -281,65 +335,40 @@ public abstract class JMXConnectorServer
          * System.out.println("--MBean Server");
          * 
    * + *

    Note for connector server implementors

    + * + *

    Existing connector server implementations can be updated to support + * a system chain of forwarders as follows:

    + * + *
      + *
    • Override the {@link #supportsSystemMBeanServerForwarder()} + * method so that it returns true.

      + * + *
    • Call {@link #installStandardForwarders} from the constructor of + * the connector server.

      + * + *
    • Direct incoming requests to the result of {@link + * #getSystemMBeanServerForwarder()} instead of the result of {@link + * #getMBeanServer()}.

      + *
    + * * @return the first item in the system chain of forwarders. * - * @see #setSystemMBeanServerForwarder + * @throws UnsupportedOperationException if {@link + * #supportsSystemMBeanServerForwarder} returns false. + * + * @see #supportsSystemMBeanServerForwarder + * @see #setMBeanServerForwarder + * + * @since 1.7 */ - public synchronized MBeanServer getSystemMBeanServer() { - return systemMBeanServer; - } - - /** - *

    Inserts an object that intercepts requests for the MBean server - * that arrive through this connector server. This object will be - * supplied as the MBeanServer for any new connection - * created by this connector server. Existing connections are - * unaffected.

    - * - *

    This method can be called more than once with different - * {@link MBeanServerForwarder} objects. The result is a chain - * of forwarders. The last forwarder added is the first in the chain.

    - * - *

    This method modifies the system chain of {@link MBeanServerForwarder}s. - * Usually user code should change the user chain instead, via - * {@link #setMBeanServerForwarder}.

    - * - *

    Not all connector servers support a system chain of forwarders. - * Calling this method on a connector server that does not will produce an - * {@link UnsupportedOperationException}.

    - * - *

    Suppose {@code mbs} is the result of {@link #getSystemMBeanServer()} - * before calling this method. If {@code mbs} is not null, then - * {@code mbsf.setMBeanServer(mbs)} will be called. If doing so - * produces an exception, this method throws the same exception without - * any other effect. If {@code mbs} is null, or if the call to - * {@code mbsf.setMBeanServer(mbs)} succeeds, then this method will - * return normally and {@code getSystemMBeanServer()} will then return - * {@code mbsf}.

    - * - *

    The result of {@link #getMBeanServer()} is unchanged by this method.

    - * - * @param mbsf the new MBeanServerForwarder. - * - * @throws IllegalArgumentException if the call to {@link - * MBeanServerForwarder#setMBeanServer mbsf.setMBeanServer} fails - * with IllegalArgumentException, or if - * mbsf is null. - * - * @throws UnsupportedOperationException if - * {@link #supportsSystemMBeanServerForwarder} returns false. - * - * @see #getSystemMBeanServer() - */ - public synchronized void setSystemMBeanServerForwarder( - MBeanServerForwarder mbsf) { - if (mbsf == null) - throw new IllegalArgumentException("Invalid null argument: mbsf"); - mustSupportSystemMBSF(); - - if (systemMBeanServer != null) - mbsf.setMBeanServer(systemMBeanServer); - systemMBeanServer = mbsf; + public MBeanServerForwarder getSystemMBeanServerForwarder() { + if (!supportsSystemMBeanServerForwarder()) { + throw new UnsupportedOperationException( + "System MBeanServerForwarder not supported by this " + + "connector server"); + } + return systemMBeanServerForwarder; } /** @@ -350,19 +379,13 @@ public abstract class JMXConnectorServer * * @return true if this connector server supports the system chain of * forwarders. + * + * @since 1.7 */ public boolean supportsSystemMBeanServerForwarder() { return false; } - private void mustSupportSystemMBSF() { - if (!supportsSystemMBeanServerForwarder()) { - throw new UnsupportedOperationException( - "System MBeanServerForwarder not supported by this " + - "connector server"); - } - } - /** *

    Install {@link MBeanServerForwarder}s in the system chain * based on the attributes in the given {@code Map}. A connector @@ -374,34 +397,90 @@ public abstract class JMXConnectorServer *

      * *
    • If {@link #EVENT_CLIENT_DELEGATE_FORWARDER} is absent, or is - * present with the value {@code "true"}, then a forwarder with the - * functionality of {@link EventClientDelegate#newForwarder} is inserted - * at the start of the system chain.
    • + * present with the value {@code "true"}, then a forwarder + * equivalent to {@link EventClientDelegate#newForwarder + * EventClientDelegate.newForwarder}{@code (sysMBSF.getMBeanServer(), + * sysMBSF)} is inserted at the start of the system chain, + * where {@code sysMBSF} is the object returned by {@link + * #getSystemMBeanServerForwarder()}. + * + *
    • If {@link #LOCALIZE_MBEAN_INFO_FORWARDER} is present with the + * value {@code "true"}, then a forwarder equivalent to + * {@link ClientContext#newLocalizeMBeanInfoForwarder + * ClientContext.newLocalizeMBeanInfoForwarder}{@code + * (sysMBSF.getMBeanServer())} is inserted at the start of the system + * chain.
    • + * + *
    • If {@link #CONTEXT_FORWARDER} is absent, or is present with + * the value {@code "true"}, then a forwarder equivalent to + * {@link ClientContext#newContextForwarder + * ClientContext.newContextForwarder}{@code (sysMSBF.getMBeanServer(), + * sysMBSF)} is inserted at the tart of the system chain.
    • * *
    * - *

    For {@code EVENT_CLIENT_DELEGATE_FORWARDER}, if the - * attribute is absent from the {@code Map} and a system property - * of the same name is defined, then the value of the system - * property is used as if it were in the {@code Map}. + *

    For {@code EVENT_CLIENT_DELEGATE_FORWARDER} and {@code + * CONTEXT_FORWARDER}, if the attribute is absent from the {@code + * Map} and a system property of the same name is defined, then + * the value of the system property is used as if it were in the + * {@code Map}. + * + *

    Since each forwarder is inserted at the start of the chain, + * the final order of the forwarders is the reverse of the order + * above. This is important, because the {@code + * LOCALIZE_MBEAN_INFO_FORWARDER} can only work if the {@code + * CONTEXT_FORWARDER} has already installed the remote client's locale + * in the {@linkplain ClientContext#getContext context} of the current + * thread.

    * *

    Attributes in {@code env} that are not listed above are ignored * by this method.

    * * @throws UnsupportedOperationException if {@link * #supportsSystemMBeanServerForwarder} is false. + * + * @throws IllegalArgumentException if the relevant attributes in {@code env} are + * inconsistent, for example if {@link #LOCALIZE_MBEAN_INFO_FORWARDER} is + * {@code "true"} but {@link #CONTEXT_FORWARDER} is {@code "false"}; or + * if one of the attributes has an illegal value. + * + * @since 1.7 */ protected void installStandardForwarders(Map env) { - mustSupportSystemMBSF(); + MBeanServerForwarder sysMBSF = getSystemMBeanServerForwarder(); // Remember that forwarders must be added in reverse order! boolean ecd = EnvHelp.computeBooleanFromString( env, EVENT_CLIENT_DELEGATE_FORWARDER, false, true); + boolean localize = EnvHelp.computeBooleanFromString( + env, LOCALIZE_MBEAN_INFO_FORWARDER, false, false); + boolean context = EnvHelp.computeBooleanFromString( + env, CONTEXT_FORWARDER, false, true); + + if (localize && !context) { + throw new IllegalArgumentException( + "Inconsistent environment parameters: " + + LOCALIZE_MBEAN_INFO_FORWARDER + "=\"true\" requires " + + CONTEXT_FORWARDER + "=\"true\""); + } if (ecd) { - MBeanServerForwarder mbsf = EventClientDelegate.newForwarder(); - setSystemMBeanServerForwarder(mbsf); + MBeanServerForwarder mbsf = EventClientDelegate.newForwarder( + sysMBSF.getMBeanServer(), sysMBSF); + sysMBSF.setMBeanServer(mbsf); + } + + if (localize) { + MBeanServerForwarder mbsf = ClientContext.newLocalizeMBeanInfoForwarder( + sysMBSF.getMBeanServer()); + sysMBSF.setMBeanServer(mbsf); + } + + if (context) { + MBeanServerForwarder mbsf = ClientContext.newContextForwarder( + sysMBSF.getMBeanServer(), sysMBSF); + sysMBSF.setMBeanServer(mbsf); } } @@ -473,6 +552,7 @@ public abstract class JMXConnectorServer * * @return the array of possible notifications. */ + @Override public MBeanNotificationInfo[] getNotificationInfo() { final String[] types = { JMXConnectionNotification.OPENED, @@ -684,30 +764,29 @@ public abstract class JMXConnectorServer * Fields describing the chains of forwarders (MBeanServerForwarders). * In the general case, the forwarders look something like this: * - * systemMBeanServer userMBeanServer - * | | - * v v - * mbsf1 -> mbsf2 -> mbsf3 -> mbsf4 -> mbsf5 -> mbs + * userMBeanServer + * | + * v + * systemMBeanServerForwarder -> mbsf2 -> mbsf3 -> mbsf4 -> mbsf5 -> mbs * * Here, each mbsfi is an MBeanServerForwarder, and the arrows * illustrate its getMBeanServer() method. The last MBeanServerForwarder * can point to an MBeanServer that is not instanceof MBeanServerForwarder, * here mbs. * - * Initially, the chain can be empty if this JMXConnectorServer was - * constructed without an MBeanServer. In this case, both systemMBS - * and userMBS will be null. If there is initially an MBeanServer, - * then both systemMBS and userMBS will point to it. + * The system chain is never empty because it always has at least + * systemMBeanServerForwarder. Initially, the user chain can be empty if + * this JMXConnectorServer was constructed without an MBeanServer. In + * this case, userMBS will be null. If there is initially an MBeanServer, + * userMBS will point to it. * - * Whenever userMBS is changed, the system chain must be updated. If there - * are forwarders in the system chain (between systemMBS and userMBS in the - * picture above), then the last one must point to the old value of userMBS - * (possibly null). It must be updated to point to the new value. If there - * are no forwarders in the system chain, then systemMBS must be updated to - * the new value of userMBS. The invariant is that starting from systemMBS - * and repeatedly calling MBSF.getMBeanServer() you will end up at - * userMBS. The implication is that you will not see any MBeanServer - * object on the way that is not also an MBeanServerForwarder. + * Whenever userMBS is changed, the system chain must be updated. Before + * the update, the last forwarder in the system chain points to the old + * value of userMBS (possibly null). It must be updated to point to + * the new value. The invariant is that starting from systemMBSF and + * repeatedly calling MBSF.getMBeanServer() you will end up at userMBS. + * The implication is that you will not see any MBeanServer object on the + * way that is not also an MBeanServerForwarder. * * The method insertUserMBeanServer contains the logic to change userMBS * and adjust the system chain appropriately. @@ -716,7 +795,7 @@ public abstract class JMXConnectorServer * MBeanServer, then userMBS becomes that MBeanServer, and the system * chain must be updated as just described. * - * When systemMBS is updated, there is no effect on userMBS. The system + * When systemMBSF is updated, there is no effect on userMBS. The system * chain may contain forwarders even though the user chain is empty * (there is no MBeanServer). In that case an attempt to forward an * incoming request through the chain will fall off the end and fail with a @@ -726,7 +805,8 @@ public abstract class JMXConnectorServer private MBeanServer userMBeanServer; - private MBeanServer systemMBeanServer; + private final MBeanServerForwarder systemMBeanServerForwarder = + new IdentityMBeanServerForwarder(); /** * The name used to registered this server in an MBeanServer. diff --git a/jdk/src/share/classes/javax/management/remote/JMXConnectorServerMBean.java b/jdk/src/share/classes/javax/management/remote/JMXConnectorServerMBean.java index fb6f883a2b7..b784b87e48c 100644 --- a/jdk/src/share/classes/javax/management/remote/JMXConnectorServerMBean.java +++ b/jdk/src/share/classes/javax/management/remote/JMXConnectorServerMBean.java @@ -132,7 +132,7 @@ public interface JMXConnectorServerMBean { * *

    A connector server may support two chains of forwarders, * a system chain and a user chain. See {@link - * JMXConnectorServer#setSystemMBeanServerForwarder} for details.

    + * JMXConnectorServer#getSystemMBeanServerForwarder} for details.

    * * @param mbsf the new MBeanServerForwarder. * @@ -141,7 +141,7 @@ public interface JMXConnectorServerMBean { * with IllegalArgumentException. This includes the * case where mbsf is null. * - * @see JMXConnectorServer#setSystemMBeanServerForwarder + * @see JMXConnectorServer#getSystemMBeanServerForwarder */ public void setMBeanServerForwarder(MBeanServerForwarder mbsf); diff --git a/jdk/src/share/classes/javax/management/remote/rmi/RMIConnector.java b/jdk/src/share/classes/javax/management/remote/rmi/RMIConnector.java index 1f17143b948..5f1b8ac71ce 100644 --- a/jdk/src/share/classes/javax/management/remote/rmi/RMIConnector.java +++ b/jdk/src/share/classes/javax/management/remote/rmi/RMIConnector.java @@ -134,14 +134,14 @@ import sun.rmi.transport.LiveRef; public class RMIConnector implements JMXConnector, Serializable, JMXAddressable { private static final ClassLogger logger = - new ClassLogger("javax.management.remote.rmi", "RMIConnector"); + new ClassLogger("javax.management.remote.rmi", "RMIConnector"); private static final long serialVersionUID = 817323035842634473L; private RMIConnector(RMIServer rmiServer, JMXServiceURL address, - Map environment) { + Map environment) { if (rmiServer == null && address == null) throw new - IllegalArgumentException("rmiServer and jmxServiceURL both null"); + IllegalArgumentException("rmiServer and jmxServiceURL both null"); initTransients(); @@ -257,7 +257,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable } public synchronized void connect(Map environment) - throws IOException { + throws IOException { final boolean tracing = logger.traceOn(); String idstr = (tracing?"["+this.toString()+"]":null); @@ -274,8 +274,8 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable if (tracing) logger.trace("connect",idstr + " connecting..."); final Map usemap = - new HashMap((this.env==null) ? - Collections.emptyMap() : this.env); + new HashMap((this.env==null) ? + Collections.emptyMap() : this.env); if (environment != null) { @@ -315,7 +315,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable defaultClassLoader = EnvHelp.resolveClientClassLoader(usemap); usemap.put(JMXConnectorFactory.DEFAULT_CLASS_LOADER, - defaultClassLoader); + defaultClassLoader); rmiNotifClient = new RMINotifClient(defaultClassLoader, usemap); @@ -333,12 +333,12 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable eventServiceEnabled = EnvHelp.eventServiceEnabled(env); Notification connectedNotif = - new JMXConnectionNotification(JMXConnectionNotification.OPENED, - this, - connectionId, - clientNotifSeqNo++, - "Successful connection", - null); + new JMXConnectionNotification(JMXConnectionNotification.OPENED, + this, + connectionId, + clientNotifSeqNo++, + "Successful connection", + null); sendNotification(connectedNotif); // whether or not event service @@ -363,7 +363,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable if (terminated || !connected) { if (logger.traceOn()) logger.trace("getConnectionId","["+this.toString()+ - "] not connected."); + "] not connected."); throw new IOException("Not connected"); } @@ -374,23 +374,23 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable } public synchronized MBeanServerConnection getMBeanServerConnection() - throws IOException { + throws IOException { return getMBeanServerConnection(null); } public synchronized MBeanServerConnection - getMBeanServerConnection(Subject delegationSubject) + getMBeanServerConnection(Subject delegationSubject) throws IOException { if (terminated) { if (logger.traceOn()) logger.trace("getMBeanServerConnection","[" + this.toString() + - "] already closed."); + "] already closed."); throw new IOException("Connection closed"); } else if (!connected) { if (logger.traceOn()) logger.trace("getMBeanServerConnection","[" + this.toString() + - "] is not connected."); + "] is not connected."); throw new IOException("Not connected"); } @@ -405,7 +405,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable rmbsc, EventClientDelegateMBean.OBJECT_NAME, EventClientDelegateMBean.class); EventClient ec = new EventClient(ecd, null, defaultExecutor(), null, - EventClient.DEFAULT_LEASE_TIMEOUT); + EventClient.DEFAULT_REQUESTED_LEASE_TIME); rmbsc = EventConnection.Factory.make(rmbsc, ec); ec.addEventClientListener( @@ -433,17 +433,17 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable } public void - addConnectionNotificationListener(NotificationListener listener, - NotificationFilter filter, - Object handback) { + addConnectionNotificationListener(NotificationListener listener, + NotificationFilter filter, + Object handback) { if (listener == null) throw new NullPointerException("listener"); connectionBroadcaster.addNotificationListener(listener, filter, - handback); + handback); } public void - removeConnectionNotificationListener(NotificationListener listener) + removeConnectionNotificationListener(NotificationListener listener) throws ListenerNotFoundException { if (listener == null) throw new NullPointerException("listener"); @@ -451,14 +451,14 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable } public void - removeConnectionNotificationListener(NotificationListener listener, - NotificationFilter filter, - Object handback) + removeConnectionNotificationListener(NotificationListener listener, + NotificationFilter filter, + Object handback) throws ListenerNotFoundException { if (listener == null) throw new NullPointerException("listener"); connectionBroadcaster.removeNotificationListener(listener, filter, - handback); + handback); } private void sendNotification(Notification n) { @@ -526,11 +526,11 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable try { rmiNotifClient.terminate(); if (tracing) logger.trace("close",idstr + - " RMI Notification client terminated."); + " RMI Notification client terminated."); } catch (RuntimeException x) { closeException = x; if (tracing) logger.trace("close",idstr + - " Failed to terminate RMI Notification client: " + x); + " Failed to terminate RMI Notification client: " + x); if (debug) logger.debug("close",x); } } @@ -544,7 +544,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable } catch (IOException e) { closeException = e; if (tracing) logger.trace("close",idstr + - " Failed to close RMIServer: " + e); + " Failed to close RMIServer: " + e); if (debug) logger.debug("close",e); } } @@ -559,12 +559,12 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable if (savedConnectionId != null) { Notification closedNotif = - new JMXConnectionNotification(JMXConnectionNotification.CLOSED, - this, - savedConnectionId, - clientNotifSeqNo++, - "Client has been closed", - null); + new JMXConnectionNotification(JMXConnectionNotification.CLOSED, + this, + savedConnectionId, + clientNotifSeqNo++, + "Client has been closed", + null); sendNotification(closedNotif); } @@ -572,13 +572,13 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable // if (closeException != null) { if (tracing) logger.trace("close",idstr + " failed to close: " + - closeException); + closeException); if (closeException instanceof IOException) throw (IOException) closeException; if (closeException instanceof RuntimeException) throw (RuntimeException) closeException; final IOException x = - new IOException("Failed to close: " + closeException); + new IOException("Failed to close: " + closeException); throw EnvHelp.initCause(x,closeException); } } @@ -593,7 +593,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable final boolean debug = logger.debugOn(); if (debug) logger.debug("addListenerWithSubject", - "(ObjectName,MarshalledObject,Subject)"); + "(ObjectName,MarshalledObject,Subject)"); final ObjectName[] names = new ObjectName[] {name}; final MarshalledObject[] filters = @@ -603,11 +603,11 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable }; final Integer[] listenerIDs = - addListenersWithSubjects(names,filters,delegationSubjects, - reconnect); + addListenersWithSubjects(names,filters,delegationSubjects, + reconnect); if (debug) logger.debug("addListenerWithSubject","listenerID=" - + listenerIDs[0]); + + listenerIDs[0]); return listenerIDs[0]; } @@ -620,24 +620,24 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable final boolean debug = logger.debugOn(); if (debug) - logger.debug("addListenersWithSubjects", - "(ObjectName[],MarshalledObject[],Subject[])"); + logger.debug("addListenersWithSubjects", + "(ObjectName[],MarshalledObject[],Subject[])"); final ClassLoader old = pushDefaultClassLoader(); Integer[] listenerIDs = null; try { listenerIDs = connection.addNotificationListeners(names, - filters, - delegationSubjects); + filters, + delegationSubjects); } catch (NoSuchObjectException noe) { // maybe reconnect if (reconnect) { communicatorAdmin.gotIOException(noe); listenerIDs = connection.addNotificationListeners(names, - filters, - delegationSubjects); + filters, + delegationSubjects); } else { throw noe; } @@ -671,65 +671,65 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable } public ObjectInstance createMBean(String className, - ObjectName name) + ObjectName name) throws ReflectionException, - InstanceAlreadyExistsException, - MBeanRegistrationException, - MBeanException, - NotCompliantMBeanException, - IOException { + InstanceAlreadyExistsException, + MBeanRegistrationException, + MBeanException, + NotCompliantMBeanException, + IOException { if (logger.debugOn()) logger.debug("createMBean(String,ObjectName)", - "className=" + className + ", name=" + - name); + "className=" + className + ", name=" + + name); final ClassLoader old = pushDefaultClassLoader(); try { return connection.createMBean(className, - name, - delegationSubject); + name, + delegationSubject); } catch (IOException ioe) { communicatorAdmin.gotIOException(ioe); return connection.createMBean(className, - name, - delegationSubject); + name, + delegationSubject); } finally { popDefaultClassLoader(old); } } public ObjectInstance createMBean(String className, - ObjectName name, - ObjectName loaderName) - throws ReflectionException, - InstanceAlreadyExistsException, - MBeanRegistrationException, - MBeanException, - NotCompliantMBeanException, - InstanceNotFoundException, - IOException { + ObjectName name, + ObjectName loaderName) + throws ReflectionException, + InstanceAlreadyExistsException, + MBeanRegistrationException, + MBeanException, + NotCompliantMBeanException, + InstanceNotFoundException, + IOException { if (logger.debugOn()) logger.debug("createMBean(String,ObjectName,ObjectName)", - "className=" + className + ", name=" - + name + ", loaderName=" - + loaderName + ")"); + "className=" + className + ", name=" + + name + ", loaderName=" + + loaderName + ")"); final ClassLoader old = pushDefaultClassLoader(); try { return connection.createMBean(className, - name, - loaderName, - delegationSubject); + name, + loaderName, + delegationSubject); } catch (IOException ioe) { communicatorAdmin.gotIOException(ioe); return connection.createMBean(className, - name, - loaderName, - delegationSubject); + name, + loaderName, + delegationSubject); } finally { popDefaultClassLoader(old); @@ -737,90 +737,90 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable } public ObjectInstance createMBean(String className, - ObjectName name, - Object params[], - String signature[]) + ObjectName name, + Object params[], + String signature[]) throws ReflectionException, - InstanceAlreadyExistsException, - MBeanRegistrationException, - MBeanException, - NotCompliantMBeanException, - IOException { + InstanceAlreadyExistsException, + MBeanRegistrationException, + MBeanException, + NotCompliantMBeanException, + IOException { if (logger.debugOn()) - logger.debug("createMBean(String,ObjectName,Object[],String[])", - "className=" + className + ", name=" - + name + ", params=" - + objects(params) + ", signature=" - + strings(signature)); + logger.debug("createMBean(String,ObjectName,Object[],String[])", + "className=" + className + ", name=" + + name + ", params=" + + objects(params) + ", signature=" + + strings(signature)); final MarshalledObject sParams = new MarshalledObject(params); final ClassLoader old = pushDefaultClassLoader(); try { return connection.createMBean(className, - name, - sParams, - signature, - delegationSubject); + name, + sParams, + signature, + delegationSubject); } catch (IOException ioe) { communicatorAdmin.gotIOException(ioe); return connection.createMBean(className, - name, - sParams, - signature, - delegationSubject); + name, + sParams, + signature, + delegationSubject); } finally { popDefaultClassLoader(old); } } public ObjectInstance createMBean(String className, - ObjectName name, - ObjectName loaderName, - Object params[], - String signature[]) + ObjectName name, + ObjectName loaderName, + Object params[], + String signature[]) throws ReflectionException, - InstanceAlreadyExistsException, - MBeanRegistrationException, - MBeanException, - NotCompliantMBeanException, - InstanceNotFoundException, - IOException { + InstanceAlreadyExistsException, + MBeanRegistrationException, + MBeanException, + NotCompliantMBeanException, + InstanceNotFoundException, + IOException { if (logger.debugOn()) logger.debug( - "createMBean(String,ObjectName,ObjectName,Object[],String[])", - "className=" + className + ", name=" + name + ", loaderName=" - + loaderName + ", params=" + objects(params) - + ", signature=" + strings(signature)); + "createMBean(String,ObjectName,ObjectName,Object[],String[])", + "className=" + className + ", name=" + name + ", loaderName=" + + loaderName + ", params=" + objects(params) + + ", signature=" + strings(signature)); final MarshalledObject sParams = new MarshalledObject(params); final ClassLoader old = pushDefaultClassLoader(); try { return connection.createMBean(className, - name, - loaderName, - sParams, - signature, - delegationSubject); + name, + loaderName, + sParams, + signature, + delegationSubject); } catch (IOException ioe) { communicatorAdmin.gotIOException(ioe); return connection.createMBean(className, - name, - loaderName, - sParams, - signature, - delegationSubject); + name, + loaderName, + sParams, + signature, + delegationSubject); } finally { popDefaultClassLoader(old); } } public void unregisterMBean(ObjectName name) - throws InstanceNotFoundException, - MBeanRegistrationException, - IOException { + throws InstanceNotFoundException, + MBeanRegistrationException, + IOException { if (logger.debugOn()) logger.debug("unregisterMBean", "name=" + name); @@ -837,8 +837,8 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable } public ObjectInstance getObjectInstance(ObjectName name) - throws InstanceNotFoundException, - IOException { + throws InstanceNotFoundException, + IOException { if (logger.debugOn()) logger.debug("getObjectInstance", "name=" + name); @@ -855,10 +855,10 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable } public Set queryMBeans(ObjectName name, - QueryExp query) - throws IOException { + QueryExp query) + throws IOException { if (logger.debugOn()) logger.debug("queryMBeans", - "name=" + name + ", query=" + query); + "name=" + name + ", query=" + query); final MarshalledObject sQuery = new MarshalledObject(query); @@ -875,10 +875,10 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable } public Set queryNames(ObjectName name, - QueryExp query) + QueryExp query) throws IOException { if (logger.debugOn()) logger.debug("queryNames", - "name=" + name + ", query=" + query); + "name=" + name + ", query=" + query); final MarshalledObject sQuery = new MarshalledObject(query); @@ -895,7 +895,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable } public boolean isRegistered(ObjectName name) - throws IOException { + throws IOException { if (logger.debugOn()) logger.debug("isRegistered", "name=" + name); @@ -912,7 +912,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable } public Integer getMBeanCount() - throws IOException { + throws IOException { if (logger.debugOn()) logger.debug("getMBeanCount", ""); final ClassLoader old = pushDefaultClassLoader(); @@ -928,53 +928,53 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable } public Object getAttribute(ObjectName name, - String attribute) + String attribute) throws MBeanException, - AttributeNotFoundException, - InstanceNotFoundException, - ReflectionException, - IOException { + AttributeNotFoundException, + InstanceNotFoundException, + ReflectionException, + IOException { if (logger.debugOn()) logger.debug("getAttribute", - "name=" + name + ", attribute=" - + attribute); + "name=" + name + ", attribute=" + + attribute); final ClassLoader old = pushDefaultClassLoader(); try { return connection.getAttribute(name, - attribute, - delegationSubject); + attribute, + delegationSubject); } catch (IOException ioe) { communicatorAdmin.gotIOException(ioe); return connection.getAttribute(name, - attribute, - delegationSubject); + attribute, + delegationSubject); } finally { popDefaultClassLoader(old); } } public AttributeList getAttributes(ObjectName name, - String[] attributes) + String[] attributes) throws InstanceNotFoundException, - ReflectionException, - IOException { + ReflectionException, + IOException { if (logger.debugOn()) logger.debug("getAttributes", - "name=" + name + ", attributes=" - + strings(attributes)); + "name=" + name + ", attributes=" + + strings(attributes)); final ClassLoader old = pushDefaultClassLoader(); try { return connection.getAttributes(name, - attributes, - delegationSubject); + attributes, + delegationSubject); } catch (IOException ioe) { communicatorAdmin.gotIOException(ioe); return connection.getAttributes(name, - attributes, - delegationSubject); + attributes, + delegationSubject); } finally { popDefaultClassLoader(old); } @@ -982,20 +982,20 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable public void setAttribute(ObjectName name, - Attribute attribute) - throws InstanceNotFoundException, - AttributeNotFoundException, - InvalidAttributeValueException, - MBeanException, - ReflectionException, - IOException { + Attribute attribute) + throws InstanceNotFoundException, + AttributeNotFoundException, + InvalidAttributeValueException, + MBeanException, + ReflectionException, + IOException { if (logger.debugOn()) logger.debug("setAttribute", - "name=" + name + ", attribute=" - + attribute); + "name=" + name + ", attribute=" + + attribute); final MarshalledObject sAttribute = - new MarshalledObject(attribute); + new MarshalledObject(attribute); final ClassLoader old = pushDefaultClassLoader(); try { connection.setAttribute(name, sAttribute, delegationSubject); @@ -1009,28 +1009,28 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable } public AttributeList setAttributes(ObjectName name, - AttributeList attributes) - throws InstanceNotFoundException, - ReflectionException, - IOException { + AttributeList attributes) + throws InstanceNotFoundException, + ReflectionException, + IOException { if (logger.debugOn()) logger.debug("setAttributes", - "name=" + name + ", attributes=" - + attributes); + "name=" + name + ", attributes=" + + attributes); final MarshalledObject sAttributes = - new MarshalledObject(attributes); + new MarshalledObject(attributes); final ClassLoader old = pushDefaultClassLoader(); try { return connection.setAttributes(name, - sAttributes, - delegationSubject); + sAttributes, + delegationSubject); } catch (IOException ioe) { communicatorAdmin.gotIOException(ioe); return connection.setAttributes(name, - sAttributes, - delegationSubject); + sAttributes, + delegationSubject); } finally { popDefaultClassLoader(old); } @@ -1038,37 +1038,37 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable public Object invoke(ObjectName name, - String operationName, - Object params[], - String signature[]) + String operationName, + Object params[], + String signature[]) throws InstanceNotFoundException, - MBeanException, - ReflectionException, - IOException { + MBeanException, + ReflectionException, + IOException { if (logger.debugOn()) logger.debug("invoke", - "name=" + name - + ", operationName=" + operationName - + ", params=" + objects(params) - + ", signature=" + strings(signature)); + "name=" + name + + ", operationName=" + operationName + + ", params=" + objects(params) + + ", signature=" + strings(signature)); final MarshalledObject sParams = new MarshalledObject(params); final ClassLoader old = pushDefaultClassLoader(); try { return connection.invoke(name, - operationName, - sParams, - signature, - delegationSubject); + operationName, + sParams, + signature, + delegationSubject); } catch (IOException ioe) { communicatorAdmin.gotIOException(ioe); return connection.invoke(name, - operationName, - sParams, - signature, - delegationSubject); + operationName, + sParams, + signature, + delegationSubject); } finally { popDefaultClassLoader(old); } @@ -1076,7 +1076,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable public String getDefaultDomain() - throws IOException { + throws IOException { if (logger.debugOn()) logger.debug("getDefaultDomain", ""); final ClassLoader old = pushDefaultClassLoader(); @@ -1107,10 +1107,10 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable } public MBeanInfo getMBeanInfo(ObjectName name) - throws InstanceNotFoundException, - IntrospectionException, - ReflectionException, - IOException { + throws InstanceNotFoundException, + IntrospectionException, + ReflectionException, + IOException { if (logger.debugOn()) logger.debug("getMBeanInfo", "name=" + name); final ClassLoader old = pushDefaultClassLoader(); @@ -1127,41 +1127,41 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable public boolean isInstanceOf(ObjectName name, - String className) + String className) throws InstanceNotFoundException, - IOException { + IOException { if (logger.debugOn()) logger.debug("isInstanceOf", "name=" + name + - ", className=" + className); + ", className=" + className); final ClassLoader old = pushDefaultClassLoader(); try { return connection.isInstanceOf(name, - className, - delegationSubject); + className, + delegationSubject); } catch (IOException ioe) { communicatorAdmin.gotIOException(ioe); return connection.isInstanceOf(name, - className, - delegationSubject); + className, + delegationSubject); } finally { popDefaultClassLoader(old); } } public void addNotificationListener(ObjectName name, - ObjectName listener, - NotificationFilter filter, - Object handback) + ObjectName listener, + NotificationFilter filter, + Object handback) throws InstanceNotFoundException, - IOException { + IOException { if (logger.debugOn()) logger.debug("addNotificationListener" + - "(ObjectName,ObjectName,NotificationFilter,Object)", - "name=" + name + ", listener=" + listener - + ", filter=" + filter + ", handback=" + handback); + "(ObjectName,ObjectName,NotificationFilter,Object)", + "name=" + name + ", listener=" + listener + + ", filter=" + filter + ", handback=" + handback); final MarshalledObject sFilter = new MarshalledObject(filter); @@ -1170,64 +1170,64 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable final ClassLoader old = pushDefaultClassLoader(); try { connection.addNotificationListener(name, - listener, - sFilter, - sHandback, - delegationSubject); + listener, + sFilter, + sHandback, + delegationSubject); } catch (IOException ioe) { communicatorAdmin.gotIOException(ioe); connection.addNotificationListener(name, - listener, - sFilter, - sHandback, - delegationSubject); + listener, + sFilter, + sHandback, + delegationSubject); } finally { popDefaultClassLoader(old); } } public void removeNotificationListener(ObjectName name, - ObjectName listener) + ObjectName listener) throws InstanceNotFoundException, - ListenerNotFoundException, - IOException { + ListenerNotFoundException, + IOException { if (logger.debugOn()) logger.debug("removeNotificationListener" + - "(ObjectName,ObjectName)", - "name=" + name - + ", listener=" + listener); + "(ObjectName,ObjectName)", + "name=" + name + + ", listener=" + listener); final ClassLoader old = pushDefaultClassLoader(); try { connection.removeNotificationListener(name, - listener, - delegationSubject); + listener, + delegationSubject); } catch (IOException ioe) { communicatorAdmin.gotIOException(ioe); connection.removeNotificationListener(name, - listener, - delegationSubject); + listener, + delegationSubject); } finally { popDefaultClassLoader(old); } } public void removeNotificationListener(ObjectName name, - ObjectName listener, - NotificationFilter filter, - Object handback) + ObjectName listener, + NotificationFilter filter, + Object handback) throws InstanceNotFoundException, - ListenerNotFoundException, - IOException { + ListenerNotFoundException, + IOException { if (logger.debugOn()) logger.debug("removeNotificationListener" + - "(ObjectName,ObjectName,NotificationFilter,Object)", - "name=" + name - + ", listener=" + listener - + ", filter=" + filter - + ", handback=" + handback); + "(ObjectName,ObjectName,NotificationFilter,Object)", + "name=" + name + + ", listener=" + listener + + ", filter=" + filter + + ", handback=" + handback); final MarshalledObject sFilter = new MarshalledObject(filter); @@ -1236,18 +1236,18 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable final ClassLoader old = pushDefaultClassLoader(); try { connection.removeNotificationListener(name, - listener, - sFilter, - sHandback, - delegationSubject); + listener, + sFilter, + sHandback, + delegationSubject); } catch (IOException ioe) { communicatorAdmin.gotIOException(ioe); connection.removeNotificationListener(name, - listener, - sFilter, - sHandback, - delegationSubject); + listener, + sFilter, + sHandback, + delegationSubject); } finally { popDefaultClassLoader(old); } @@ -1256,34 +1256,34 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable // Specific Notification Handle ---------------------------------- public void addNotificationListener(ObjectName name, - NotificationListener listener, - NotificationFilter filter, - Object handback) + NotificationListener listener, + NotificationFilter filter, + Object handback) throws InstanceNotFoundException, - IOException { + IOException { final boolean debug = logger.debugOn(); if (debug) logger.debug("addNotificationListener" + - "(ObjectName,NotificationListener,"+ - "NotificationFilter,Object)", - "name=" + name - + ", listener=" + listener - + ", filter=" + filter - + ", handback=" + handback); + "(ObjectName,NotificationListener,"+ + "NotificationFilter,Object)", + "name=" + name + + ", listener=" + listener + + ", filter=" + filter + + ", handback=" + handback); final Integer listenerID = - addListenerWithSubject(name, - new MarshalledObject(filter), - delegationSubject,true); + addListenerWithSubject(name, + new MarshalledObject(filter), + delegationSubject,true); rmiNotifClient.addNotificationListener(listenerID, name, listener, - filter, handback, - delegationSubject); + filter, handback, + delegationSubject); } public void removeNotificationListener(ObjectName name, - NotificationListener listener) + NotificationListener listener) throws InstanceNotFoundException, ListenerNotFoundException, IOException { @@ -1291,28 +1291,28 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable final boolean debug = logger.debugOn(); if (debug) logger.debug("removeNotificationListener"+ - "(ObjectName,NotificationListener)", - "name=" + name - + ", listener=" + listener); + "(ObjectName,NotificationListener)", + "name=" + name + + ", listener=" + listener); final Integer[] ret = - rmiNotifClient.removeNotificationListener(name, listener); + rmiNotifClient.removeNotificationListener(name, listener); if (debug) logger.debug("removeNotificationListener", - "listenerIDs=" + objects(ret)); + "listenerIDs=" + objects(ret)); final ClassLoader old = pushDefaultClassLoader(); try { connection.removeNotificationListeners(name, - ret, - delegationSubject); + ret, + delegationSubject); } catch (IOException ioe) { communicatorAdmin.gotIOException(ioe); connection.removeNotificationListeners(name, - ret, - delegationSubject); + ret, + delegationSubject); } finally { popDefaultClassLoader(old); } @@ -1320,41 +1320,41 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable } public void removeNotificationListener(ObjectName name, - NotificationListener listener, - NotificationFilter filter, - Object handback) - throws InstanceNotFoundException, - ListenerNotFoundException, - IOException { + NotificationListener listener, + NotificationFilter filter, + Object handback) + throws InstanceNotFoundException, + ListenerNotFoundException, + IOException { final boolean debug = logger.debugOn(); if (debug) logger.debug("removeNotificationListener"+ - "(ObjectName,NotificationListener,"+ - "NotificationFilter,Object)", - "name=" + name - + ", listener=" + listener - + ", filter=" + filter - + ", handback=" + handback); + "(ObjectName,NotificationListener,"+ + "NotificationFilter,Object)", + "name=" + name + + ", listener=" + listener + + ", filter=" + filter + + ", handback=" + handback); final Integer ret = - rmiNotifClient.removeNotificationListener(name, listener, - filter, handback); + rmiNotifClient.removeNotificationListener(name, listener, + filter, handback); if (debug) logger.debug("removeNotificationListener", - "listenerID=" + ret); + "listenerID=" + ret); final ClassLoader old = pushDefaultClassLoader(); try { connection.removeNotificationListeners(name, - new Integer[] {ret}, - delegationSubject); + new Integer[] {ret}, + delegationSubject); } catch (IOException ioe) { communicatorAdmin.gotIOException(ioe); connection.removeNotificationListeners(name, - new Integer[] {ret}, - delegationSubject); + new Integer[] {ret}, + delegationSubject); } finally { popDefaultClassLoader(old); } @@ -1369,16 +1369,16 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable } protected NotificationResult fetchNotifs(long clientSequenceNumber, - int maxNotifications, - long timeout) + int maxNotifications, + long timeout) throws IOException, ClassNotFoundException { IOException org; while (true) { // used for a successful re-connection try { return connection.fetchNotifications(clientSequenceNumber, - maxNotifications, - timeout); + maxNotifications, + timeout); } catch (IOException ioe) { org = ioe; @@ -1417,7 +1417,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable clear we can do much better. */ if (ume.detail instanceof WriteAbortedException) { WriteAbortedException wae = - (WriteAbortedException) ume.detail; + (WriteAbortedException) ume.detail; if (wae.detail instanceof IOException) throw (IOException) wae.detail; } @@ -1435,11 +1435,11 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable } protected Integer addListenerForMBeanRemovedNotif() - throws IOException, InstanceNotFoundException { + throws IOException, InstanceNotFoundException { NotificationFilterSupport clientFilter = - new NotificationFilterSupport(); + new NotificationFilterSupport(); clientFilter.enableType( - MBeanServerNotification.UNREGISTRATION_NOTIFICATION); + MBeanServerNotification.UNREGISTRATION_NOTIFICATION); MarshalledObject sFilter = new MarshalledObject(clientFilter); @@ -1451,36 +1451,36 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable final Subject[] subjects = new Subject[] {null}; try { listenerIDs = - connection.addNotificationListeners(names, - filters, - subjects); + connection.addNotificationListeners(names, + filters, + subjects); } catch (IOException ioe) { communicatorAdmin.gotIOException(ioe); listenerIDs = - connection.addNotificationListeners(names, - filters, - subjects); + connection.addNotificationListeners(names, + filters, + subjects); } return listenerIDs[0]; } protected void removeListenerForMBeanRemovedNotif(Integer id) - throws IOException, InstanceNotFoundException, - ListenerNotFoundException { + throws IOException, InstanceNotFoundException, + ListenerNotFoundException { try { connection.removeNotificationListeners( - MBeanServerDelegate.DELEGATE_NAME, - new Integer[] {id}, - null); + MBeanServerDelegate.DELEGATE_NAME, + new Integer[] {id}, + null); } catch (IOException ioe) { communicatorAdmin.gotIOException(ioe); connection.removeNotificationListeners( - MBeanServerDelegate.DELEGATE_NAME, - new Integer[] {id}, - null); + MBeanServerDelegate.DELEGATE_NAME, + new Integer[] {id}, + null); } } @@ -1530,7 +1530,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable // we should close the connection, // but send a failed notif at first final Notification failedNotif = - new JMXConnectionNotification( + new JMXConnectionNotification( JMXConnectionNotification.FAILED, this, connectionId, @@ -1559,7 +1559,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable will throw a ServerException at client side which wraps this UnmarshalException. No failed notif here. - */ + */ Throwable tt = ((ServerException)ioe).detail; if (tt instanceof IOException) { @@ -1600,11 +1600,11 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable for (i=0;i(newOrb); return newOrb; } @@ -1810,11 +1810,11 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable * @see #RMIConnector(RMIServer,Map) **/ private void readObject(java.io.ObjectInputStream s) - throws IOException, ClassNotFoundException { + throws IOException, ClassNotFoundException { s.defaultReadObject(); if (rmiServer == null && jmxServiceURL == null) throw new - InvalidObjectException("rmiServer and jmxServiceURL both null"); + InvalidObjectException("rmiServer and jmxServiceURL both null"); initTransients(); } @@ -1851,9 +1851,9 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable * @see #RMIConnector(RMIServer,Map) **/ private void writeObject(java.io.ObjectOutputStream s) - throws IOException { + throws IOException { if (rmiServer == null && jmxServiceURL == null) throw new - InvalidObjectException("rmiServer and jmxServiceURL both null."); + InvalidObjectException("rmiServer and jmxServiceURL both null."); connectStub(this.rmiServer,env); s.defaultWriteObject(); } @@ -1892,21 +1892,21 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable //-------------------------------------------------------------------- private static void checkStub(Remote stub, - Class stubClass) { + Class stubClass) { // Check remote stub is from the expected class. // if (stub.getClass() != stubClass) { if (!Proxy.isProxyClass(stub.getClass())) { throw new SecurityException( - "Expecting a " + stubClass.getName() + " stub!"); + "Expecting a " + stubClass.getName() + " stub!"); } else { InvocationHandler handler = Proxy.getInvocationHandler(stub); if (handler.getClass() != RemoteObjectInvocationHandler.class) throw new SecurityException( - "Expecting a dynamic proxy instance with a " + - RemoteObjectInvocationHandler.class.getName() + - " invocation handler!"); + "Expecting a dynamic proxy instance with a " + + RemoteObjectInvocationHandler.class.getName() + + " invocation handler!"); else stub = (Remote) handler; } @@ -1918,8 +1918,8 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable RemoteRef ref = ((RemoteObject)stub).getRef(); if (ref.getClass() != UnicastRef2.class) throw new SecurityException( - "Expecting a " + UnicastRef2.class.getName() + - " remote reference in stub!"); + "Expecting a " + UnicastRef2.class.getName() + + " remote reference in stub!"); // Check RMIClientSocketFactory in stub is from the expected class // "javax.rmi.ssl.SslRMIClientSocketFactory". @@ -1928,8 +1928,8 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable RMIClientSocketFactory csf = liveRef.getClientSocketFactory(); if (csf == null || csf.getClass() != SslRMIClientSocketFactory.class) throw new SecurityException( - "Expecting a " + SslRMIClientSocketFactory.class.getName() + - " RMI client socket factory in stub!"); + "Expecting a " + SslRMIClientSocketFactory.class.getName() + + " RMI client socket factory in stub!"); } //-------------------------------------------------------------------- @@ -1937,8 +1937,8 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable //-------------------------------------------------------------------- private RMIServer findRMIServer(JMXServiceURL directoryURL, - Map environment) - throws NamingException, IOException { + Map environment) + throws NamingException, IOException { final boolean isIiop = RMIConnectorServer.isIiopURL(directoryURL,true); if (isIiop) { // Make sure java.naming.corba.orb is in the Map. @@ -1956,7 +1956,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable return findRMIServerIIOP(path.substring(5,end), environment, isIiop); else { final String msg = "URL path must begin with /jndi/ or /stub/ " + - "or /ior/: " + path; + "or /ior/: " + path; throw new MalformedURLException(msg); } } @@ -1975,8 +1975,8 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable * @exception NamingException if the stub couldn't be found. **/ private RMIServer findRMIServerJNDI(String jndiURL, Map env, - boolean isIiop) - throws NamingException { + boolean isIiop) + throws NamingException { InitialContext ctx = new InitialContext(EnvHelp.mapToHashtable(env)); @@ -1997,11 +1997,11 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable private static RMIServer narrowIIOPServer(Object objref) { try { return (RMIServer) - PortableRemoteObject.narrow(objref, RMIServer.class); + PortableRemoteObject.narrow(objref, RMIServer.class); } catch (ClassCastException e) { if (logger.traceOn()) logger.trace("narrowIIOPServer","Failed to narrow objref=" + - objref + ": " + e); + objref + ": " + e); if (logger.debugOn()) logger.debug("narrowIIOPServer",e); return null; } @@ -2010,7 +2010,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable private RMIServer findRMIServerIIOP(String ior, Map env, boolean isIiop) { // could forbid "rmi:" URL here -- but do we need to? final ORB orb = (ORB) - env.get(EnvHelp.DEFAULT_ORB); + env.get(EnvHelp.DEFAULT_ORB); final Object stub = orb.string_to_object(ior); return (RMIServer) PortableRemoteObject.narrow(stub, RMIServer.class); } @@ -2023,15 +2023,15 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable serialized = base64ToByteArray(base64); } catch (IllegalArgumentException e) { throw new MalformedURLException("Bad BASE64 encoding: " + - e.getMessage()); + e.getMessage()); } final ByteArrayInputStream bin = new ByteArrayInputStream(serialized); final ClassLoader loader = EnvHelp.resolveClientClassLoader(env); final ObjectInputStream oin = - (loader == null) ? - new ObjectInputStream(bin) : - new ObjectInputStreamWithLoader(bin, loader); + (loader == null) ? + new ObjectInputStream(bin) : + new ObjectInputStreamWithLoader(bin, loader); final Object stub; try { stub = oin.readObject(); @@ -2044,7 +2044,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable private static final class ObjectInputStreamWithLoader extends ObjectInputStream { ObjectInputStreamWithLoader(InputStream in, ClassLoader cl) - throws IOException { + throws IOException { super(in); this.loader = cl; } @@ -2127,40 +2127,40 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable RMIServer.class.getName() + "Impl_Stub"; private static final Class rmiServerImplStubClass; private static final String rmiConnectionImplStubClassName = - RMIConnection.class.getName() + "Impl_Stub"; + RMIConnection.class.getName() + "Impl_Stub"; private static final Class rmiConnectionImplStubClass; private static final String pRefClassName = "com.sun.jmx.remote.internal.PRef"; private static final Constructor proxyRefConstructor; static { final String pRefByteCodeString = - "\312\376\272\276\0\0\0.\0\27\12\0\5\0\15\11\0\4\0\16\13\0\17\0"+ - "\20\7\0\21\7\0\22\1\0\6\1\0\36(Ljava/rmi/server/RemoteRef;"+ - ")V\1\0\4Code\1\0\6invoke\1\0S(Ljava/rmi/Remote;Ljava/lang/reflec"+ - "t/Method;[Ljava/lang/Object;J)Ljava/lang/Object;\1\0\12Exception"+ - "s\7\0\23\14\0\6\0\7\14\0\24\0\25\7\0\26\14\0\11\0\12\1\0\40com/"+ - "sun/jmx/remote/internal/PRef\1\0$com/sun/jmx/remote/internal/Pr"+ - "oxyRef\1\0\23java/lang/Exception\1\0\3ref\1\0\33Ljava/rmi/serve"+ - "r/RemoteRef;\1\0\31java/rmi/server/RemoteRef\0!\0\4\0\5\0\0\0\0"+ - "\0\2\0\1\0\6\0\7\0\1\0\10\0\0\0\22\0\2\0\2\0\0\0\6*+\267\0\1\261"+ - "\0\0\0\0\0\1\0\11\0\12\0\2\0\10\0\0\0\33\0\6\0\6\0\0\0\17*\264\0"+ - "\2+,-\26\4\271\0\3\6\0\260\0\0\0\0\0\13\0\0\0\4\0\1\0\14\0\0"; + "\312\376\272\276\0\0\0.\0\27\12\0\5\0\15\11\0\4\0\16\13\0\17\0"+ + "\20\7\0\21\7\0\22\1\0\6\1\0\36(Ljava/rmi/server/RemoteRef;"+ + ")V\1\0\4Code\1\0\6invoke\1\0S(Ljava/rmi/Remote;Ljava/lang/reflec"+ + "t/Method;[Ljava/lang/Object;J)Ljava/lang/Object;\1\0\12Exception"+ + "s\7\0\23\14\0\6\0\7\14\0\24\0\25\7\0\26\14\0\11\0\12\1\0\40com/"+ + "sun/jmx/remote/internal/PRef\1\0$com/sun/jmx/remote/internal/Pr"+ + "oxyRef\1\0\23java/lang/Exception\1\0\3ref\1\0\33Ljava/rmi/serve"+ + "r/RemoteRef;\1\0\31java/rmi/server/RemoteRef\0!\0\4\0\5\0\0\0\0"+ + "\0\2\0\1\0\6\0\7\0\1\0\10\0\0\0\22\0\2\0\2\0\0\0\6*+\267\0\1\261"+ + "\0\0\0\0\0\1\0\11\0\12\0\2\0\10\0\0\0\33\0\6\0\6\0\0\0\17*\264\0"+ + "\2+,-\26\4\271\0\3\6\0\260\0\0\0\0\0\13\0\0\0\4\0\1\0\14\0\0"; final byte[] pRefByteCode = - NoCallStackClassLoader.stringToBytes(pRefByteCodeString); + NoCallStackClassLoader.stringToBytes(pRefByteCodeString); PrivilegedExceptionAction> action = new PrivilegedExceptionAction>() { public Constructor run() throws Exception { Class thisClass = RMIConnector.class; ClassLoader thisLoader = thisClass.getClassLoader(); ProtectionDomain thisProtectionDomain = - thisClass.getProtectionDomain(); + thisClass.getProtectionDomain(); String[] otherClassNames = {ProxyRef.class.getName()}; ClassLoader cl = - new NoCallStackClassLoader(pRefClassName, - pRefByteCode, - otherClassNames, - thisLoader, - thisProtectionDomain); + new NoCallStackClassLoader(pRefClassName, + pRefByteCode, + otherClassNames, + thisLoader, + thisProtectionDomain); Class c = cl.loadClass(pRefClassName); return c.getConstructor(RemoteRef.class); } @@ -2171,8 +2171,8 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable serverStubClass = Class.forName(rmiServerImplStubClassName); } catch (Exception e) { logger.error("", - "Failed to instantiate " + - rmiServerImplStubClassName + ": " + e); + "Failed to instantiate " + + rmiServerImplStubClassName + ": " + e); logger.debug("",e); serverStubClass = null; } @@ -2185,8 +2185,8 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable constr = (Constructor) AccessController.doPrivileged(action); } catch (Exception e) { logger.error("", - "Failed to initialize proxy reference constructor "+ - "for " + rmiConnectionImplStubClassName + ": " + e); + "Failed to initialize proxy reference constructor "+ + "for " + rmiConnectionImplStubClassName + ": " + e); logger.debug("",e); stubClass = null; constr = null; @@ -2196,9 +2196,9 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable } private static RMIConnection shadowJrmpStub(RemoteObject stub) - throws InstantiationException, IllegalAccessException, - InvocationTargetException, ClassNotFoundException, - NoSuchMethodException { + throws InstantiationException, IllegalAccessException, + InvocationTargetException, ClassNotFoundException, + NoSuchMethodException { RemoteRef ref = stub.getRef(); RemoteRef proxyRef = (RemoteRef) proxyRefConstructor.newInstance(new Object[] {ref}); @@ -2206,7 +2206,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable rmiConnectionImplStubClass.getConstructor(RemoteRef.class); Object[] args = {proxyRef}; RMIConnection proxyStub = (RMIConnection) - rmiConnectionImplStubConstructor.newInstance(args); + rmiConnectionImplStubConstructor.newInstance(args); return proxyStub; } @@ -2326,55 +2326,55 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable */ private static final String iiopConnectionStubClassName = - "org.omg.stub.javax.management.remote.rmi._RMIConnection_Stub"; + "org.omg.stub.javax.management.remote.rmi._RMIConnection_Stub"; private static final String proxyStubClassName = - "com.sun.jmx.remote.internal.ProxyStub"; + "com.sun.jmx.remote.internal.ProxyStub"; private static final String pInputStreamClassName = "com.sun.jmx.remote.internal.PInputStream"; private static final Class proxyStubClass; static { final String proxyStubByteCodeString = - "\312\376\272\276\0\0\0.\0)\12\0\14\0\26\7\0\27\12\0\14\0\30\12"+ - "\0\2\0\31\7\0\32\12\0\5\0\33\12\0\5\0\34\12\0\5\0\35\12\0\2\0"+ - "\36\12\0\14\0\37\7\0\40\7\0!\1\0\6\1\0\3()V\1\0\4Code\1"+ - "\0\7_invoke\1\0K(Lorg/omg/CORBA/portable/OutputStream;)Lorg/o"+ - "mg/CORBA/portable/InputStream;\1\0\12Exceptions\7\0\"\1\0\15_"+ - "releaseReply\1\0'(Lorg/omg/CORBA/portable/InputStream;)V\14\0"+ - "\15\0\16\1\0(com/sun/jmx/remote/internal/PInputStream\14\0\20"+ - "\0\21\14\0\15\0\25\1\0+org/omg/CORBA/portable/ApplicationExce"+ - "ption\14\0#\0$\14\0%\0&\14\0\15\0'\14\0(\0$\14\0\24\0\25\1\0%"+ - "com/sun/jmx/remote/internal/ProxyStub\1\0\1\0\3()V\1\0\4Code\1"+ + "\0\7_invoke\1\0K(Lorg/omg/CORBA/portable/OutputStream;)Lorg/o"+ + "mg/CORBA/portable/InputStream;\1\0\12Exceptions\7\0\"\1\0\15_"+ + "releaseReply\1\0'(Lorg/omg/CORBA/portable/InputStream;)V\14\0"+ + "\15\0\16\1\0(com/sun/jmx/remote/internal/PInputStream\14\0\20"+ + "\0\21\14\0\15\0\25\1\0+org/omg/CORBA/portable/ApplicationExce"+ + "ption\14\0#\0$\14\0%\0&\14\0\15\0'\14\0(\0$\14\0\24\0\25\1\0%"+ + "com/sun/jmx/remote/internal/ProxyStub\1\0\1\0'(L"+ - "org/omg/CORBA/portable/InputStream;)V\1\0\4Code\1\0\10read_an"+ - "y\1\0\25()Lorg/omg/CORBA/Any;\1\0\12read_value\1\0)(Ljava/lan"+ - "g/Class;)Ljava/io/Serializable;\14\0\10\0\11\14\0\30\0\31\7\0"+ - "\32\14\0\13\0\14\14\0\33\0\34\7\0\35\14\0\15\0\16\1\0(com/sun"+ - "/jmx/remote/internal/PInputStream\1\0,com/sun/jmx/remote/inte"+ - "rnal/ProxyInputStream\1\0\2in\1\0$Lorg/omg/CORBA/portable/Inp"+ - "utStream;\1\0\"org/omg/CORBA/portable/InputStream\1\0\6narrow"+ - "\1\0*()Lorg/omg/CORBA_2_3/portable/InputStream;\1\0&org/omg/C"+ - "ORBA_2_3/portable/InputStream\0!\0\6\0\7\0\0\0\0\0\3\0\1\0\10"+ - "\0\11\0\1\0\12\0\0\0\22\0\2\0\2\0\0\0\6*+\267\0\1\261\0\0\0\0"+ - "\0\1\0\13\0\14\0\1\0\12\0\0\0\24\0\1\0\1\0\0\0\10*\264\0\2\266"+ - "\0\3\260\0\0\0\0\0\1\0\15\0\16\0\1\0\12\0\0\0\25\0\2\0\2\0\0\0"+ - "\11*\266\0\4+\266\0\5\260\0\0\0\0\0\0"; + "\312\376\272\276\0\0\0.\0\36\12\0\7\0\17\11\0\6\0\20\12\0\21\0"+ + "\22\12\0\6\0\23\12\0\24\0\25\7\0\26\7\0\27\1\0\6\1\0'(L"+ + "org/omg/CORBA/portable/InputStream;)V\1\0\4Code\1\0\10read_an"+ + "y\1\0\25()Lorg/omg/CORBA/Any;\1\0\12read_value\1\0)(Ljava/lan"+ + "g/Class;)Ljava/io/Serializable;\14\0\10\0\11\14\0\30\0\31\7\0"+ + "\32\14\0\13\0\14\14\0\33\0\34\7\0\35\14\0\15\0\16\1\0(com/sun"+ + "/jmx/remote/internal/PInputStream\1\0,com/sun/jmx/remote/inte"+ + "rnal/ProxyInputStream\1\0\2in\1\0$Lorg/omg/CORBA/portable/Inp"+ + "utStream;\1\0\"org/omg/CORBA/portable/InputStream\1\0\6narrow"+ + "\1\0*()Lorg/omg/CORBA_2_3/portable/InputStream;\1\0&org/omg/C"+ + "ORBA_2_3/portable/InputStream\0!\0\6\0\7\0\0\0\0\0\3\0\1\0\10"+ + "\0\11\0\1\0\12\0\0\0\22\0\2\0\2\0\0\0\6*+\267\0\1\261\0\0\0\0"+ + "\0\1\0\13\0\14\0\1\0\12\0\0\0\24\0\1\0\1\0\0\0\10*\264\0\2\266"+ + "\0\3\260\0\0\0\0\0\1\0\15\0\16\0\1\0\12\0\0\0\25\0\2\0\2\0\0\0"+ + "\11*\266\0\4+\266\0\5\260\0\0\0\0\0\0"; final byte[] proxyStubByteCode = - NoCallStackClassLoader.stringToBytes(proxyStubByteCodeString); + NoCallStackClassLoader.stringToBytes(proxyStubByteCodeString); final byte[] pInputStreamByteCode = - NoCallStackClassLoader.stringToBytes(pInputStreamByteCodeString); + NoCallStackClassLoader.stringToBytes(pInputStreamByteCodeString); final String[] classNames={proxyStubClassName, pInputStreamClassName}; final byte[][] byteCodes = {proxyStubByteCode, pInputStreamByteCode}; final String[] otherClassNames = { @@ -2388,13 +2388,13 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable Class thisClass = RMIConnector.class; ClassLoader thisLoader = thisClass.getClassLoader(); ProtectionDomain thisProtectionDomain = - thisClass.getProtectionDomain(); + thisClass.getProtectionDomain(); ClassLoader cl = - new NoCallStackClassLoader(classNames, - byteCodes, - otherClassNames, - thisLoader, - thisProtectionDomain); + new NoCallStackClassLoader(classNames, + byteCodes, + otherClassNames, + thisLoader, + thisProtectionDomain); return cl.loadClass(proxyStubClassName); } }; @@ -2403,7 +2403,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable stubClass = AccessController.doPrivileged(action); } catch (Exception e) { logger.error("", - "Unexpected exception making shadow IIOP stub class: "+e); + "Unexpected exception making shadow IIOP stub class: "+e); logger.debug("",e); stubClass = null; } @@ -2411,15 +2411,15 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable } private static RMIConnection shadowIiopStub(Stub stub) - throws InstantiationException, IllegalAccessException { + throws InstantiationException, IllegalAccessException { Stub proxyStub = (Stub) proxyStubClass.newInstance(); proxyStub._set_delegate(stub._get_delegate()); return (RMIConnection) proxyStub; } private static RMIConnection getConnection(RMIServer server, - Object credentials, - boolean checkStub) + Object credentials, + boolean checkStub) throws IOException { RMIConnection c = server.newClient(credentials); if (checkStub) checkStub(c, rmiConnectionImplStubClass); @@ -2429,14 +2429,14 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable if (c.getClass().getName().equals(iiopConnectionStubClassName)) return shadowIiopStub((Stub) c); logger.trace("getConnection", - "Did not wrap " + c.getClass() + " to foil " + - "stack search for classes: class loading semantics " + - "may be incorrect"); + "Did not wrap " + c.getClass() + " to foil " + + "stack search for classes: class loading semantics " + + "may be incorrect"); } catch (Exception e) { logger.error("getConnection", - "Could not wrap " + c.getClass() + " to foil " + - "stack search for classes: class loading semantics " + - "may be incorrect: " + e); + "Could not wrap " + c.getClass() + " to foil " + + "stack search for classes: class loading semantics " + + "may be incorrect: " + e); logger.debug("getConnection",e); // so just return the original stub, which will work for all // but the most exotic class loading situations @@ -2449,7 +2449,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable int numGroups = sLen/4; if (4*numGroups != sLen) throw new IllegalArgumentException( - "String length must be a multiple of four."); + "String length must be a multiple of four."); int missingBytesInLastGroup = 0; int numFullGroups = numGroups; if (sLen != 0) { @@ -2535,21 +2535,21 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable final ClassLoader old = t.getContextClassLoader(); if (defaultClassLoader != null) AccessController.doPrivileged(new PrivilegedAction() { - public Void run() { - t.setContextClassLoader(defaultClassLoader); - return null; - } - }); - return old; + public Void run() { + t.setContextClassLoader(defaultClassLoader); + return null; + } + }); + return old; } private void popDefaultClassLoader(final ClassLoader old) { AccessController.doPrivileged(new PrivilegedAction() { - public Void run() { - Thread.currentThread().setContextClassLoader(old); - return null; - } - }); + public Void run() { + Thread.currentThread().setContextClassLoader(old); + return null; + } + }); } //-------------------------------------------------------------------- diff --git a/jdk/src/share/classes/javax/management/remote/rmi/RMIConnectorServer.java b/jdk/src/share/classes/javax/management/remote/rmi/RMIConnectorServer.java index e56020b4722..9d38c7e8944 100644 --- a/jdk/src/share/classes/javax/management/remote/rmi/RMIConnectorServer.java +++ b/jdk/src/share/classes/javax/management/remote/rmi/RMIConnectorServer.java @@ -383,7 +383,7 @@ public class RMIConnectorServer extends JMXConnectorServer { try { if (tracing) logger.trace("start", "setting default class loader"); defaultClassLoader = EnvHelp.resolveServerClassLoader( - attributes, getSystemMBeanServer()); + attributes, getSystemMBeanServerForwarder()); } catch (InstanceNotFoundException infc) { IllegalArgumentException x = new IllegalArgumentException("ClassLoader not found: "+infc); @@ -398,7 +398,7 @@ public class RMIConnectorServer extends JMXConnectorServer { else rmiServer = newServer(); - rmiServer.setMBeanServer(getSystemMBeanServer()); + rmiServer.setMBeanServer(getSystemMBeanServerForwarder()); rmiServer.setDefaultClassLoader(defaultClassLoader); rmiServer.setRMIConnectorServer(this); rmiServer.export(); @@ -592,31 +592,6 @@ public class RMIConnectorServer extends JMXConnectorServer { return Collections.unmodifiableMap(map); } - @Override - public synchronized void setMBeanServerForwarder(MBeanServerForwarder mbsf) { - MBeanServer oldSMBS = getSystemMBeanServer(); - super.setMBeanServerForwarder(mbsf); - if (oldSMBS != getSystemMBeanServer()) - updateMBeanServer(); - // If the system chain of MBeanServerForwarders is not empty, then - // there is no need to call rmiServerImpl.setMBeanServer, because - // it is pointing to the head of the system chain and that has not - // changed. (The *end* of the system chain will have been changed - // to point to mbsf.) - } - - private void updateMBeanServer() { - if (rmiServerImpl != null) - rmiServerImpl.setMBeanServer(getSystemMBeanServer()); - } - - @Override - public synchronized void setSystemMBeanServerForwarder( - MBeanServerForwarder mbsf) { - super.setSystemMBeanServerForwarder(mbsf); - updateMBeanServer(); - } - /** * {@inheritDoc} * @return true, since this connector server does support a system chain @@ -631,16 +606,19 @@ public class RMIConnectorServer extends JMXConnectorServer { here so that they are accessible to other classes in this package even though they have protected access. */ + @Override protected void connectionOpened(String connectionId, String message, Object userData) { super.connectionOpened(connectionId, message, userData); } + @Override protected void connectionClosed(String connectionId, String message, Object userData) { super.connectionClosed(connectionId, message, userData); } + @Override protected void connectionFailed(String connectionId, String message, Object userData) { super.connectionFailed(connectionId, message, userData); diff --git a/jdk/test/javax/management/Introspector/AnnotationTest.java b/jdk/test/javax/management/Introspector/AnnotationTest.java index e6d3c10b042..49ca0d3405c 100644 --- a/jdk/test/javax/management/Introspector/AnnotationTest.java +++ b/jdk/test/javax/management/Introspector/AnnotationTest.java @@ -39,7 +39,8 @@ import javax.management.*; /* This test checks that annotations produce Descriptor entries as - specified in javax.management.DescriptorKey. It does two things: + specified in javax.management.DescriptorKey and javax.management.DescriptorField. + It does the following: - An annotation consisting of an int and a String, each with an appropriate @DescriptorKey annotation, is placed on every program @@ -61,6 +62,10 @@ import javax.management.*; The test checks that in each case the corresponding Descriptor appears in the appropriate place inside the MBean's MBeanInfo. + - A @DescriptorFields annotation defining two fields is placed in the + same places and again the test checks that the two fields appear + in the corresponding MBean*Info objects. + - An annotation consisting of enough other types to ensure coverage is placed on a getter. The test checks that the generated MBeanAttributeInfo contains the corresponding Descriptor. The tested @@ -78,12 +83,6 @@ import javax.management.*; public class AnnotationTest { private static String failed = null; -// @Retention(RetentionPolicy.RUNTIME) @Inherited -// @Target(ElementType.METHOD) -// public static @interface DescriptorKey { -// String value(); -// } - @Retention(RetentionPolicy.RUNTIME) public static @interface Pair { @DescriptorKey("x") @@ -112,11 +111,12 @@ public class AnnotationTest { boolean[] booleanArrayValue(); } - /* We use the annotation @Pair(x = 3, y = "foo") everywhere, and this is - the Descriptor that it should produce: */ + /* We use the annotations @Pair(x = 3, y = "foo") + and @DescriptorFields({"foo=bar", "baz="}) everywhere, and this is + the Descriptor that they should produce: */ private static Descriptor expectedDescriptor = - new ImmutableDescriptor(new String[] {"x", "y"}, - new Object[] {3, "foo"}); + new ImmutableDescriptor(new String[] {"x", "y", "foo", "baz"}, + new Object[] {3, "foo", "bar", ""}); private static Descriptor expectedFullDescriptor = new ImmutableDescriptor(new String[] { @@ -136,8 +136,10 @@ public class AnnotationTest { }); @Pair(x = 3, y = "foo") + @DescriptorFields({"foo=bar", "baz="}) public static interface ThingMBean { @Pair(x = 3, y = "foo") + @DescriptorFields({"foo=bar", "baz="}) @Full(classValue=Full.class, enumValue=RetentionPolicy.RUNTIME, booleanValue=false, @@ -149,32 +151,47 @@ public class AnnotationTest { int getReadOnly(); @Pair(x = 3, y = "foo") + @DescriptorFields({"foo=bar", "baz="}) void setWriteOnly(int x); @Pair(x = 3, y = "foo") + @DescriptorFields({"foo=bar", "baz="}) int getReadWrite1(); void setReadWrite1(int x); @Pair(x = 3, y = "foo") + @DescriptorFields({"foo=bar", "baz="}) int getReadWrite2(); @Pair(x = 3, y = "foo") + @DescriptorFields({"foo=bar", "baz="}) void setReadWrite2(int x); int getReadWrite3(); @Pair(x = 3, y = "foo") + @DescriptorFields({"foo=bar", "baz="}) void setReadWrite3(int x); @Pair(x = 3, y = "foo") - int operation(@Pair(x = 3, y = "foo") int p1, - @Pair(x = 3, y = "foo") int p2); + @DescriptorFields({"foo=bar", "baz="}) + int operation(@Pair(x = 3, y = "foo") + @DescriptorFields({"foo=bar", "baz="}) + int p1, + @Pair(x = 3, y = "foo") + @DescriptorFields({"foo=bar", "baz="}) + int p2); } public static class Thing implements ThingMBean { @Pair(x = 3, y = "foo") + @DescriptorFields({"foo=bar", "baz="}) public Thing() {} @Pair(x = 3, y = "foo") - public Thing(@Pair(x = 3, y = "foo") int p1) {} + @DescriptorFields({"foo=bar", "baz="}) + public Thing( + @Pair(x = 3, y = "foo") + @DescriptorFields({"foo=bar", "baz="}) + int p1) {} public int getReadOnly() {return 0;} @@ -193,14 +210,20 @@ public class AnnotationTest { } @Pair(x = 3, y = "foo") + @DescriptorFields({"foo=bar", "baz="}) public static interface ThingMXBean extends ThingMBean {} public static class ThingImpl implements ThingMXBean { @Pair(x = 3, y = "foo") + @DescriptorFields({"foo=bar", "baz="}) public ThingImpl() {} @Pair(x = 3, y = "foo") - public ThingImpl(@Pair(x = 3, y = "foo") int p1) {} + @DescriptorFields({"foo=bar", "baz="}) + public ThingImpl( + @Pair(x = 3, y = "foo") + @DescriptorFields({"foo=bar", "baz="}) + int p1) {} public int getReadOnly() {return 0;} @@ -218,6 +241,79 @@ public class AnnotationTest { public int operation(int p1, int p2) {return 0;} } + @Retention(RetentionPolicy.RUNTIME) + public static @interface DefaultTest { + @DescriptorKey(value = "string1", omitIfDefault = true) + String string1() default ""; + @DescriptorKey(value = "string2", omitIfDefault = true) + String string2() default "tiddly pom"; + @DescriptorKey(value = "int", omitIfDefault = true) + int intx() default 23; + @DescriptorKey(value = "intarray1", omitIfDefault = true) + int[] intArray1() default {}; + @DescriptorKey(value = "intarray2", omitIfDefault = true) + int[] intArray2() default {1, 2}; + @DescriptorKey(value = "stringarray1", omitIfDefault = true) + String[] stringArray1() default {}; + @DescriptorKey(value = "stringarray2", omitIfDefault = true) + String[] stringArray2() default {"foo", "bar"}; + } + + @Retention(RetentionPolicy.RUNTIME) + public static @interface Expect { + String[] value() default {}; + } + + public static interface DefaultMBean { + @DefaultTest + @Expect() + public void a(); + + @DefaultTest(string1="") + @Expect() + public void b(); + + @DefaultTest(string1="nondefault") + @Expect("string1=nondefault") + public void c(); + + @DefaultTest(string2="tiddly pom") + @Expect() + public void d(); + + @DefaultTest(intx=23) + @Expect() + public void e(); + + @DefaultTest(intx=34) + @Expect("int=34") + public void f(); + + @DefaultTest(intArray1={}) + @Expect() + public void g(); + + @DefaultTest(intArray1={2,3}) + @Expect("intarray1=[2, 3]") + public void h(); + + @DefaultTest(intArray2={}) + @Expect("intarray2=[]") + public void i(); + + @DefaultTest(stringArray1={}) + @Expect() + public void j(); + + @DefaultTest(stringArray1={"foo"}) + @Expect("stringarray1=[foo]") + public void k(); + + @DefaultTest(stringArray2={}) + @Expect("stringarray2=[]") + public void l(); + } + public static void main(String[] args) throws Exception { System.out.println("Testing that annotations are correctly " + "reflected in Descriptor entries"); @@ -225,20 +321,62 @@ public class AnnotationTest { MBeanServer mbs = java.lang.management.ManagementFactory.getPlatformMBeanServer(); ObjectName on = new ObjectName("a:b=c"); + Thing thing = new Thing(); mbs.registerMBean(thing, on); check(mbs, on); mbs.unregisterMBean(on); + ThingImpl thingImpl = new ThingImpl(); mbs.registerMBean(thingImpl, on); + Descriptor d = mbs.getMBeanInfo(on).getDescriptor(); + if (!d.getFieldValue("mxbean").equals("true")) { + System.out.println("NOT OK: expected MXBean"); + failed = "Expected MXBean"; + } check(mbs, on); + System.out.println(); + System.out.println("Testing that omitIfDefault works"); + DefaultMBean defaultImpl = (DefaultMBean) Proxy.newProxyInstance( + DefaultMBean.class.getClassLoader(), + new Class[] {DefaultMBean.class}, + new InvocationHandler(){ + public Object invoke(Object proxy, Method method, Object[] args) { + return null; + } + }); + DynamicMBean mbean = new StandardMBean(defaultImpl, DefaultMBean.class); + MBeanOperationInfo[] ops = mbean.getMBeanInfo().getOperations(); + for (MBeanOperationInfo op : ops) { + String name = op.getName(); + Expect expect = + DefaultMBean.class.getMethod(name).getAnnotation(Expect.class); + Descriptor opd = op.getDescriptor(); + List fields = new ArrayList(); + for (String fieldName : opd.getFieldNames()) { + Object value = opd.getFieldValue(fieldName); + String s = Arrays.deepToString(new Object[] {value}); + s = s.substring(1, s.length() - 1); + fields.add(fieldName + "=" + s); + } + Descriptor opds = new ImmutableDescriptor(fields.toArray(new String[0])); + Descriptor expd = new ImmutableDescriptor(expect.value()); + if (opds.equals(expd)) + System.out.println("OK: op " + name + ": " + opds); + else { + String failure = "Bad descriptor for op " + name + ": " + + "expected " + expd + ", got " + opds; + System.out.println("NOT OK: " + failure); + failed = failure; + } + } + System.out.println(); + if (failed == null) System.out.println("Test passed"); - else if (true) - throw new Exception("TEST FAILED: " + failed); else - System.out.println("Test disabled until 6221321 implemented"); + throw new Exception("TEST FAILED: " + failed); } private static void check(MBeanServer mbs, ObjectName on) throws Exception { @@ -295,151 +433,4 @@ public class AnnotationTest { for (DescriptorRead x : xx) check(x); } - - public static class AnnotatedMBean extends StandardMBean { - AnnotatedMBean(T resource, Class interfaceClass, boolean mx) { - super(resource, interfaceClass, mx); - } - - private static final String[] attrPrefixes = {"get", "set", "is"}; - - protected void cacheMBeanInfo(MBeanInfo info) { - MBeanAttributeInfo[] attrs = info.getAttributes(); - MBeanOperationInfo[] ops = info.getOperations(); - - for (int i = 0; i < attrs.length; i++) { - MBeanAttributeInfo attr = attrs[i]; - String name = attr.getName(); - Descriptor d = attr.getDescriptor(); - Method m; - if ((m = getMethod("get" + name)) != null) - d = ImmutableDescriptor.union(d, descriptorFor(m)); - if (attr.getType().equals("boolean") && - (m = getMethod("is" + name)) != null) - d = ImmutableDescriptor.union(d, descriptorFor(m)); - if ((m = getMethod("set" + name, attr)) != null) - d = ImmutableDescriptor.union(d, descriptorFor(m)); - if (!d.equals(attr.getDescriptor())) { - attrs[i] = - new MBeanAttributeInfo(name, attr.getType(), - attr.getDescription(), attr.isReadable(), - attr.isWritable(), attr.isIs(), d); - } - } - - for (int i = 0; i < ops.length; i++) { - MBeanOperationInfo op = ops[i]; - String name = op.getName(); - Descriptor d = op.getDescriptor(); - MBeanParameterInfo[] params = op.getSignature(); - Method m = getMethod(name, params); - if (m != null) { - d = ImmutableDescriptor.union(d, descriptorFor(m)); - Annotation[][] annots = m.getParameterAnnotations(); - for (int pi = 0; pi < params.length; pi++) { - MBeanParameterInfo param = params[pi]; - Descriptor pd = - ImmutableDescriptor.union(param.getDescriptor(), - descriptorFor(annots[pi])); - params[pi] = new MBeanParameterInfo(param.getName(), - param.getType(), param.getDescription(), pd); - } - op = new MBeanOperationInfo(op.getName(), - op.getDescription(), params, op.getReturnType(), - op.getImpact(), d); - if (!ops[i].equals(op)) - ops[i] = op; - } - } - - Descriptor id = descriptorFor(getMBeanInterface()); - info = new MBeanInfo(info.getClassName(), info.getDescription(), - attrs, info.getConstructors(), ops, info.getNotifications(), - ImmutableDescriptor.union(id, info.getDescriptor())); - super.cacheMBeanInfo(info); - } - - private Descriptor descriptorFor(AnnotatedElement x) { - Annotation[] annots = x.getAnnotations(); - return descriptorFor(annots); - } - - private Descriptor descriptorFor(Annotation[] annots) { - if (annots.length == 0) - return ImmutableDescriptor.EMPTY_DESCRIPTOR; - Map descriptorMap = new HashMap(); - for (Annotation a : annots) { - Class c = a.annotationType(); - Method[] elements = c.getMethods(); - for (Method element : elements) { - DescriptorKey key = - element.getAnnotation(DescriptorKey.class); - if (key != null) { - String name = key.value(); - Object value; - try { - value = element.invoke(a); - } catch (Exception e) { - // we don't expect this - throw new RuntimeException(e); - } - Object oldValue = descriptorMap.put(name, value); - if (oldValue != null && !oldValue.equals(value)) { - final String msg = - "Inconsistent values for descriptor field " + - name + " from annotations: " + value + " :: " + - oldValue; - throw new IllegalArgumentException(msg); - } - } - } - } - if (descriptorMap.isEmpty()) - return ImmutableDescriptor.EMPTY_DESCRIPTOR; - else - return new ImmutableDescriptor(descriptorMap); - } - - private Method getMethod(String name, MBeanFeatureInfo... params) { - Class intf = getMBeanInterface(); - ClassLoader loader = intf.getClassLoader(); - Class[] classes = new Class[params.length]; - for (int i = 0; i < params.length; i++) { - MBeanFeatureInfo param = params[i]; - Descriptor d = param.getDescriptor(); - String type = (String) d.getFieldValue("originalType"); - if (type == null) { - if (param instanceof MBeanAttributeInfo) - type = ((MBeanAttributeInfo) param).getType(); - else - type = ((MBeanParameterInfo) param).getType(); - } - Class c = primitives.get(type); - if (c == null) { - try { - c = Class.forName(type, false, loader); - } catch (ClassNotFoundException e) { - return null; - } - } - classes[i] = c; - } - try { - return intf.getMethod(name, classes); - } catch (Exception e) { - return null; - } - } - - private static final Map> primitives = - new HashMap>(); - static { - for (Class c : - new Class[] {boolean.class, byte.class, short.class, - int.class, long.class, float.class, - double.class, char.class, void.class}) { - primitives.put(c.getName(), c); - } - } - } } diff --git a/jdk/test/javax/management/context/ContextForwarderTest.java b/jdk/test/javax/management/context/ContextForwarderTest.java new file mode 100644 index 00000000000..d82acd3b63e --- /dev/null +++ b/jdk/test/javax/management/context/ContextForwarderTest.java @@ -0,0 +1,103 @@ +/* + * 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. + * + * 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 5072267 + * @summary Test that a context forwarder can be created and then installed. + * @author Eamonn McManus + */ + +/* The specific thing we're testing for is that the forwarder can be created + * with a null "next", and then installed with a real "next". An earlier + * defect meant that in this case the simulated jmx.context// namespace had a + * null handler that never changed. + */ + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; +import javax.management.ClientContext; +import javax.management.MBeanServer; +import javax.management.MBeanServerConnection; +import javax.management.MBeanServerFactory; +import javax.management.ObjectName; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXConnectorServer; +import javax.management.remote.JMXConnectorServerFactory; +import javax.management.remote.JMXServiceURL; +import javax.management.remote.MBeanServerForwarder; + +public class ContextForwarderTest { + private static String failure; + + public static void main(String[] args) throws Exception { + MBeanServer mbs = MBeanServerFactory.newMBeanServer(); + JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://"); + Map env = new HashMap(); + env.put(JMXConnectorServer.CONTEXT_FORWARDER, "false"); + JMXConnectorServer cs = JMXConnectorServerFactory.newJMXConnectorServer( + url, env, mbs); + MBeanServerForwarder sysMBSF = cs.getSystemMBeanServerForwarder(); + MBeanServerForwarder mbsf = ClientContext.newContextForwarder(mbs, sysMBSF); + sysMBSF.setMBeanServer(mbsf); + + int localCount = mbs.getMBeanCount(); + + cs.start(); + try { + JMXConnector cc = JMXConnectorFactory.connect(cs.getAddress()); + MBeanServerConnection mbsc = cc.getMBeanServerConnection(); + mbsc = ClientContext.withContext(mbsc, "foo", "bar"); + int contextCount = mbsc.getMBeanCount(); + if (localCount + 1 != contextCount) { + fail("Local MBean count %d, context MBean count %d", + localCount, contextCount); + } + Set localNames = + new TreeSet(mbs.queryNames(null, null)); + ObjectName contextNamespaceObjectName = + new ObjectName(ClientContext.NAMESPACE + "//:type=JMXNamespace"); + if (!localNames.add(contextNamespaceObjectName)) + fail("Local names already contained context namespace handler"); + Set contextNames = mbsc.queryNames(null, null); + if (!localNames.equals(contextNames)) { + fail("Name set differs locally and in context: " + + "local: %s; context: %s", localNames, contextNames); + } + } finally { + cs.stop(); + } + if (failure != null) + throw new Exception("TEST FAILED: " + failure); + else + System.out.println("TEST PASSED"); + } + + private static void fail(String msg, Object... params) { + failure = String.format(msg, params); + System.out.println("FAIL: " + failure); + } +} diff --git a/jdk/test/javax/management/context/ContextTest.java b/jdk/test/javax/management/context/ContextTest.java new file mode 100644 index 00000000000..1fb293ef574 --- /dev/null +++ b/jdk/test/javax/management/context/ContextTest.java @@ -0,0 +1,534 @@ +/* + * Copyright 2007 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 ContextTest + * @bug 5072267 + * @summary Test client contexts. + * @author Eamonn McManus + * TODO: Try registering with a null name replaced by preRegister (for example + * from the MLet class) and see if it now works. + */ + +import java.lang.management.ManagementFactory; +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Queue; +import java.util.Set; +import java.util.TreeMap; +import java.util.concurrent.Callable; +import javax.management.Attribute; +import javax.management.AttributeList; +import javax.management.ClientContext; +import javax.management.DynamicMBean; +import javax.management.JMX; +import javax.management.ListenerNotFoundException; +import javax.management.MBeanNotificationInfo; +import javax.management.MBeanRegistration; +import javax.management.MBeanServer; +import javax.management.MBeanServerDelegate; +import javax.management.Notification; +import javax.management.NotificationBroadcasterSupport; +import javax.management.NotificationFilter; +import javax.management.NotificationListener; +import javax.management.ObjectInstance; +import javax.management.ObjectName; +import javax.management.StandardMBean; +import javax.management.loading.MLet; +import javax.management.namespace.JMXNamespace; + +import javax.management.remote.MBeanServerForwarder; +import static java.util.Collections.emptyMap; +import static java.util.Collections.singletonMap; + +public class ContextTest { + private static String failure; + private static final Map emptyContext = emptyMap(); + + public static interface ShowContextMBean { + public Map getContext(); + public Map getCreationContext(); + public Set getCalledOps(); + public String getThing(); + public void setThing(String x); + public int add(int x, int y); + } + + public static class ShowContext + extends NotificationBroadcasterSupport + implements ShowContextMBean, MBeanRegistration { + private final Map creationContext; + private final Set calledOps = new HashSet(); + + public ShowContext() { + creationContext = getContext(); + } + + public Map getContext() { + return ClientContext.getContext(); + } + + public Map getCreationContext() { + return creationContext; + } + + public Set getCalledOps() { + return calledOps; + } + + public String getThing() { + return "x"; + } + + public void setThing(String x) { + } + + public int add(int x, int y) { + return x + y; + } + + public ObjectName preRegister(MBeanServer server, ObjectName name) { + assertEquals("preRegister context", creationContext, getContext()); + calledOps.add("preRegister"); + return name; + } + + public void postRegister(Boolean registrationDone) { + assertEquals("postRegister context", creationContext, getContext()); + calledOps.add("postRegister"); + } + + // The condition checked here is not guaranteed universally true, + // but is true every time we unregister an instance of this MBean + // in this test. + public void preDeregister() throws Exception { + assertEquals("preDeregister context", creationContext, getContext()); + } + + public void postDeregister() { + assertEquals("postDeregister context", creationContext, getContext()); + } + + // Same remark as for preDeregister + @Override + public MBeanNotificationInfo[] getNotificationInfo() { + calledOps.add("getNotificationInfo"); + return super.getNotificationInfo(); + } + + @Override + public void addNotificationListener( + NotificationListener listener, NotificationFilter filter, Object handback) { + calledOps.add("addNotificationListener"); + super.addNotificationListener(listener, filter, handback); + } + + @Override + public void removeNotificationListener( + NotificationListener listener) + throws ListenerNotFoundException { + calledOps.add("removeNL1"); + super.removeNotificationListener(listener); + } + + @Override + public void removeNotificationListener( + NotificationListener listener, NotificationFilter filter, Object handback) + throws ListenerNotFoundException { + calledOps.add("removeNL3"); + super.removeNotificationListener(listener, filter, handback); + } + } + + private static class LogRecord { + final String op; + final Object[] params; + final Map context; + LogRecord(String op, Object[] params, Map context) { + this.op = op; + this.params = params; + this.context = context; + } + + @Override + public String toString() { + return op + Arrays.deepToString(params) + " " + context; + } + } + + /* + * InvocationHandler that forwards all methods to a contained object + * but also records each forwarded method. This allows us to check + * that the appropriate methods were called with the appropriate + * parameters. It's similar to what's typically available in + * Mock Object frameworks. + */ + private static class LogIH implements InvocationHandler { + private final Object wrapped; + Queue log = new LinkedList(); + + LogIH(Object wrapped) { + this.wrapped = wrapped; + } + + public Object invoke(Object proxy, Method method, Object[] args) + throws Throwable { + if (method.getDeclaringClass() != Object.class) { + LogRecord lr = + new LogRecord( + method.getName(), args, ClientContext.getContext()); + log.add(lr); + } + try { + return method.invoke(wrapped, args); + } catch (InvocationTargetException e) { + throw e.getCause(); + } + } + } + + private static T newSnoop(Class wrappedClass, LogIH logIH) { + return wrappedClass.cast(Proxy.newProxyInstance( + wrappedClass.getClassLoader(), + new Class[] {wrappedClass}, + logIH)); + } + + public static void main(String[] args) throws Exception { + MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); + System.out.println(mbs.queryNames(null, null)); + ObjectName name = new ObjectName("a:b=c"); + mbs.registerMBean(new ShowContext(), name); + final ShowContextMBean show = + JMX.newMBeanProxy(mbs, name, ShowContextMBean.class); + + // Test local setting and getting within the MBeanServer + + assertEquals("initial context", emptyContext, show.getContext()); + ClientContext.doWithContext(singletonMap("foo", "bar"), new Callable() { + public Void call() { + assertEquals("context in doWithContext", + singletonMap("foo", "bar"), show.getContext()); + return null; + } + }); + assertEquals("initial context after doWithContext", + emptyContext, show.getContext()); + String got = ClientContext.doWithContext( + singletonMap("foo", "baz"), new Callable() { + public String call() { + return ClientContext.getContext().get("foo"); + } + }); + assertEquals("value extracted from context", "baz", got); + + Map combined = ClientContext.doWithContext( + singletonMap("foo", "baz"), new Callable>() { + public Map call() throws Exception { + return ClientContext.doWithContext( + singletonMap("fred", "jim"), + new Callable>() { + public Map call() { + return ClientContext.getContext(); + } + }); + } + }); + assertEquals("nested doWithContext context", + singletonMap("fred", "jim"), combined); + + final String ugh = "a!\u00c9//*=:\"% "; + ClientContext.doWithContext(singletonMap(ugh, ugh), new Callable() { + public Void call() { + assertEquals("context with tricky encoding", + singletonMap(ugh, ugh), show.getContext()); + return null; + } + }); + Map ughMap = new TreeMap(); + ughMap.put(ugh, ugh); + ughMap.put("fred", "jim"); + // Since this is a TreeMap and "fred" is greater than ugh (which begins + // with "a"), we will see the encoding of ugh first in the output string. + String encoded = ClientContext.encode(ughMap); + String expectedUghCoding = "a%21%C3%89%2F%2F%2A%3D%3A%22%25+"; + String expectedUghMapCoding = + ClientContext.NAMESPACE + "//" + expectedUghCoding + "=" + + expectedUghCoding + ";fred=jim"; + assertEquals("hairy context encoded as string", + expectedUghMapCoding, encoded); + + // Wrap the MBeanServer with a context MBSF so we can test withContext. + // Also check the simulated namespace directly. + + LogIH mbsIH = new LogIH(mbs); + MBeanServer snoopMBS = newSnoop(MBeanServer.class, mbsIH); + MBeanServerForwarder ctxMBS = + ClientContext.newContextForwarder(snoopMBS, null); + + // The MBSF returned by ClientContext is actually a compound of two + // forwarders, but that is supposed to be hidden by changing the + // behaviour of get/setMBeanServer. Check that it is indeed so. + assertEquals("next MBS of context forwarder", + snoopMBS, ctxMBS.getMBeanServer()); + // If the above assertion fails you may get a confusing message + // because the toString() of the two objects is likely to be the same + // so it will look as if they should be equal. + ctxMBS.setMBeanServer(null); + assertEquals("next MBS of context forwarder after setting it null", + null, ctxMBS.getMBeanServer()); + ctxMBS.setMBeanServer(snoopMBS); + + // The MBSF should look the same as the original MBeanServer except + // that it has the JMXNamespace for the simulated namespace. + + Set origNames = mbs.queryNames(null, null); + Set mbsfNames = ctxMBS.queryNames(null, null); + assertEquals("number of MBeans returned by queryNames within forwarder", + origNames.size() + 1, mbsfNames.size()); + assertEquals("MBeanCount within forwarder", + mbsfNames.size(), ctxMBS.getMBeanCount()); + assertCalled(mbsIH, "queryNames", emptyContext); + assertCalled(mbsIH, "getMBeanCount", emptyContext); + + ObjectName ctxNamespaceName = new ObjectName( + ClientContext.NAMESPACE + "//:" + JMXNamespace.TYPE_ASSIGNMENT); + origNames.add(ctxNamespaceName); + assertEquals("MBeans within forwarder", origNames, mbsfNames); + Set domains = new HashSet(Arrays.asList(ctxMBS.getDomains())); + assertEquals("domains include context namespace MBean", + true, domains.contains(ClientContext.NAMESPACE + "//")); + assertCalled(mbsIH, "getDomains", emptyContext); + + // Now test ClientContext.withContext. + + MBeanServer ughMBS = ClientContext.withContext(ctxMBS, ugh, ugh); + + ShowContextMBean ughshow = + JMX.newMBeanProxy(ughMBS, name, ShowContextMBean.class); + Map ughCtx = ughshow.getContext(); + Map ughExpect = singletonMap(ugh, ugh); + assertEquals("context seen by MBean accessed within namespace", + ughExpect, ughCtx); + assertCalled(mbsIH, "getAttribute", ughExpect, name, "Context"); + + MBeanServer cmbs = ClientContext.withContext( + ctxMBS, "mickey", "mouse"); + ShowContextMBean cshow = + JMX.newMBeanProxy(cmbs, name, ShowContextMBean.class); + assertEquals("context seen by MBean accessed within namespace", + singletonMap("mickey", "mouse"), cshow.getContext()); + + MBeanServer ccmbs = ClientContext.withContext( + cmbs, "donald", "duck"); + ShowContextMBean ccshow = + JMX.newMBeanProxy(ccmbs, name, ShowContextMBean.class); + Map disney = new HashMap(); + disney.put("mickey", "mouse"); + disney.put("donald", "duck"); + assertEquals("context seen by MBean in nested namespace", + disney, ccshow.getContext()); + + // Test that all MBS ops produce reasonable results + + ObjectName logger = new ObjectName("a:type=Logger"); + DynamicMBean showMBean = + new StandardMBean(new ShowContext(), ShowContextMBean.class); + LogIH mbeanLogIH = new LogIH(showMBean); + DynamicMBean logMBean = newSnoop(DynamicMBean.class, mbeanLogIH); + ObjectInstance loggerOI = ccmbs.registerMBean(logMBean, logger); + assertEquals("ObjectName returned by createMBean", + logger, loggerOI.getObjectName()); + + // We get an getMBeanInfo call to determine the className in the + // ObjectInstance to return from registerMBean. + assertCalled(mbeanLogIH, "getMBeanInfo", disney); + + ccmbs.getAttribute(logger, "Thing"); + assertCalled(mbeanLogIH, "getAttribute", disney); + + ccmbs.getAttributes(logger, new String[] {"Thing", "Context"}); + assertCalled(mbeanLogIH, "getAttributes", disney); + + ccmbs.setAttribute(logger, new Attribute("Thing", "bar")); + assertCalled(mbeanLogIH, "setAttribute", disney); + + ccmbs.setAttributes(logger, new AttributeList( + Arrays.asList(new Attribute("Thing", "baz")))); + assertCalled(mbeanLogIH, "setAttributes", disney); + + ccmbs.getMBeanInfo(logger); + assertCalled(mbeanLogIH, "getMBeanInfo", disney); + + Set names = ccmbs.queryNames(null, null); + Set expectedNames = new HashSet( + Collections.singleton(MBeanServerDelegate.DELEGATE_NAME)); + assertEquals("context namespace query includes expected names", + true, names.containsAll(expectedNames)); + + Set nsNames = ccmbs.queryNames(new ObjectName("*//:*"), null); + Set expectedNsNames = new HashSet( + Arrays.asList( + new ObjectName(ClientContext.NAMESPACE + + ObjectName.NAMESPACE_SEPARATOR + ":" + + JMXNamespace.TYPE_ASSIGNMENT))); + assertEquals("context namespace query includes namespace MBean", + true, nsNames.containsAll(expectedNsNames)); + + + + Set insts = ccmbs.queryMBeans( + MBeanServerDelegate.DELEGATE_NAME, null); + assertEquals("size of set from MBeanServerDelegate query", 1, insts.size()); + assertEquals("ObjectName from MBeanServerDelegate query", + MBeanServerDelegate.DELEGATE_NAME, + insts.iterator().next().getObjectName()); + + ObjectName createdName = new ObjectName("a:type=Created"); + ObjectInstance createdOI = + ccmbs.createMBean(ShowContext.class.getName(), createdName); + assertEquals("class name from createMBean", + ShowContext.class.getName(), createdOI.getClassName()); + assertEquals("ObjectName from createMBean", + createdName, createdOI.getObjectName()); + assertEquals("context within createMBean", + disney, ccmbs.getAttribute(createdName, "CreationContext")); + + NotificationListener nothingListener = new NotificationListener() { + public void handleNotification(Notification n, Object h) {} + }; + ccmbs.addNotificationListener(createdName, nothingListener, null, null); + ccmbs.removeNotificationListener(createdName, nothingListener, null, null); + ccmbs.addNotificationListener(createdName, nothingListener, null, null); + ccmbs.removeNotificationListener(createdName, nothingListener); + Set expectedOps = new HashSet(Arrays.asList( + "preRegister", "postRegister", "addNotificationListener", + "removeNL1", "removeNL3", "getNotificationInfo")); + assertEquals("operations called on MBean", + expectedOps, ccmbs.getAttribute(createdName, "CalledOps")); + + assertEquals("ClassLoader for MBean", + ShowContext.class.getClassLoader(), + ccmbs.getClassLoaderFor(createdName)); + + assertEquals("isRegistered", true, ccmbs.isRegistered(createdName)); + assertEquals("isInstanceOf", true, ccmbs.isInstanceOf(createdName, + ShowContext.class.getName())); + assertEquals("isInstanceOf", false, ccmbs.isInstanceOf(createdName, + DynamicMBean.class.getName())); + ccmbs.unregisterMBean(createdName); + assertEquals("isRegistered after unregister", + false, ccmbs.isRegistered(createdName)); + + MLet mlet = new MLet(); + ObjectName defaultMLetName = new ObjectName("DefaultDomain:type=MLet"); + + ccmbs.registerMBean(mlet, defaultMLetName); + + assertEquals("getClassLoader", mlet, ccmbs.getClassLoader(defaultMLetName)); + + assertEquals("number of MBean operations", 0, mbeanLogIH.log.size()); + + // Test that contexts still work when we can't combine two encoded contexts. + // Here, we wrap cmbs (mickey=mouse) so that ccmbs2 (donald=duck) cannot + // see that it already contains a context and therefore cannot combine + // into mickey=mouse;donald=duck. We don't actually use the snoop + // capabilities of the returned object -- we just want an opaque + // MBeanServer wrapper + MBeanServer cmbs2 = newSnoop(MBeanServer.class, new LogIH(cmbs)); + MBeanServer ccmbs2 = ClientContext.withContext(cmbs2, "donald", "duck"); + assertEquals("context when combination is impossible", + disney, ccmbs2.getAttribute(name, "Context")); + + // Test failure cases of ClientContext.encode + final List> badEncodeArgs = + Arrays.asList( + null, + Collections.singletonMap(null, "foo"), + Collections.singletonMap("foo", null)); + for (Map bad : badEncodeArgs) { + try { + String oops = ClientContext.encode(bad); + failed("ClientContext.encode(" + bad + ") should have failed: " + + oops); + } catch (Exception e) { + assertEquals("Exception for ClientContext.encode(" + bad + ")", + IllegalArgumentException.class, e.getClass()); + } + } + + // ADD NEW TESTS HERE ^^^ + + if (failure != null) + throw new Exception(failure); + } + + private static void assertEquals(String what, Object x, Object y) { + if (!equal(x, y)) + failed(what + ": expected " + string(x) + "; got " + string(y)); + } + + private static boolean equal(Object x, Object y) { + if (x == y) + return true; + if (x == null || y == null) + return false; + if (x.getClass().isArray()) + return Arrays.deepEquals(new Object[] {x}, new Object[] {y}); + return x.equals(y); + } + + private static String string(Object x) { + String s = Arrays.deepToString(new Object[] {x}); + return s.substring(1, s.length() - 1); + } + + private static void assertCalled( + LogIH logIH, String op, Map expectedContext) { + assertCalled(logIH, op, expectedContext, (Object[]) null); + } + + private static void assertCalled( + LogIH logIH, String op, Map expectedContext, + Object... params) { + LogRecord lr = logIH.log.remove(); + assertEquals("called operation", op, lr.op); + if (params != null) + assertEquals("operation parameters", params, lr.params); + assertEquals("operation context", expectedContext, lr.context); + } + + private static void failed(String why) { + failure = why; + new Throwable("FAILED: " + why).printStackTrace(System.out); + } +} diff --git a/jdk/test/javax/management/context/LocaleAwareBroadcasterTest.java b/jdk/test/javax/management/context/LocaleAwareBroadcasterTest.java new file mode 100644 index 00000000000..7963f9f33b6 --- /dev/null +++ b/jdk/test/javax/management/context/LocaleAwareBroadcasterTest.java @@ -0,0 +1,328 @@ +/* + * 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. + * + * 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 5072267 + * @summary Test that an MBean can handle localized Notification messages. + * @author Eamonn McManus + */ + +import java.util.Collections; +import java.util.ListResourceBundle; +import java.util.Locale; +import java.util.Map; +import java.util.MissingResourceException; +import java.util.ResourceBundle; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.Callable; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.TimeUnit; +import javax.management.ClientContext; +import javax.management.JMX; +import javax.management.ListenerNotFoundException; +import javax.management.MBeanNotificationInfo; +import javax.management.MBeanServer; +import javax.management.MBeanServerConnection; +import javax.management.MBeanServerFactory; +import javax.management.Notification; +import javax.management.NotificationBroadcasterSupport; +import javax.management.NotificationEmitter; +import javax.management.NotificationFilter; +import javax.management.NotificationListener; +import javax.management.ObjectName; +import javax.management.SendNotification; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXConnectorServer; +import javax.management.remote.JMXConnectorServerFactory; +import javax.management.remote.JMXServiceURL; + +public class LocaleAwareBroadcasterTest { + static final ObjectName mbeanName = ObjectName.valueOf("d:type=LocaleAware"); + + static final String + messageKey = "broken.window", + defaultMessage = "broken window", + frenchMessage = "fen\u00eatre bris\u00e9e", + irishMessage = "fuinneog briste"; + + public static class Bundle extends ListResourceBundle { + @Override + protected Object[][] getContents() { + return new Object[][] { + {messageKey, defaultMessage}, + }; + } + } + + public static class Bundle_fr extends ListResourceBundle { + @Override + protected Object[][] getContents() { + return new Object[][] { + {messageKey, frenchMessage}, + }; + } + } + + public static class Bundle_ga extends ListResourceBundle { + @Override + protected Object[][] getContents() { + return new Object[][] { + {messageKey, irishMessage}, + }; + } + } + + static volatile String failure; + + public static interface LocaleAwareMBean { + public void sendNotification(Notification n); + } + + public static class LocaleAware + implements LocaleAwareMBean, NotificationEmitter, SendNotification { + + private final ConcurrentMap + localeToEmitter = newConcurrentMap(); + + public void sendNotification(Notification n) { + for (Map.Entry entry : + localeToEmitter.entrySet()) { + Notification localizedNotif = + localizeNotification(n, entry.getKey()); + entry.getValue().sendNotification(localizedNotif); + } + } + + public void addNotificationListener( + NotificationListener listener, + NotificationFilter filter, + Object handback) + throws IllegalArgumentException { + Locale locale = ClientContext.getLocale(); + NotificationBroadcasterSupport broadcaster; + broadcaster = localeToEmitter.get(locale); + if (broadcaster == null) { + broadcaster = new NotificationBroadcasterSupport(); + NotificationBroadcasterSupport old = + localeToEmitter.putIfAbsent(locale, broadcaster); + if (old != null) + broadcaster = old; + } + broadcaster.addNotificationListener(listener, filter, handback); + } + + public void removeNotificationListener(NotificationListener listener) + throws ListenerNotFoundException { + Locale locale = ClientContext.getLocale(); + NotificationBroadcasterSupport broadcaster = + localeToEmitter.get(locale); + if (broadcaster == null) + throw new ListenerNotFoundException(); + broadcaster.removeNotificationListener(listener); + } + + public void removeNotificationListener( + NotificationListener listener, + NotificationFilter filter, + Object handback) + throws ListenerNotFoundException { + Locale locale = ClientContext.getLocale(); + NotificationBroadcasterSupport broadcaster = + localeToEmitter.get(locale); + if (broadcaster == null) + throw new ListenerNotFoundException(); + broadcaster.removeNotificationListener(listener, filter, handback); + } + + public MBeanNotificationInfo[] getNotificationInfo() { + return new MBeanNotificationInfo[0]; + } + } + + // Localize notif using the convention that the message looks like + // [resourcebundlename:resourcekey]defaultmessage + // for example [foo.bar.Resources:unknown.problem] + static Notification localizeNotification(Notification n, Locale locale) { + String msg = n.getMessage(); + if (!msg.startsWith("[")) + return n; + int close = msg.indexOf(']'); + if (close < 0) + throw new IllegalArgumentException("Bad notification message: " + msg); + int colon = msg.indexOf(':'); + if (colon < 0 || colon > close) + throw new IllegalArgumentException("Bad notification message: " + msg); + String bundleName = msg.substring(1, colon); + String key = msg.substring(colon + 1, close); + ClassLoader loader = LocaleAwareBroadcasterTest.class.getClassLoader(); + ResourceBundle bundle = + ResourceBundle.getBundle(bundleName, locale, loader); + try { + msg = bundle.getString(key); + } catch (MissingResourceException e) { + msg = msg.substring(close + 1); + } + n = (Notification) n.clone(); + n.setMessage(msg); + return n; + } + + public static void main(String[] args) throws Exception { + Locale.setDefault(new Locale("en")); + testLocal(); + testRemote(); + if (failure == null) + System.out.println("TEST PASSED"); + else + throw new Exception("TEST FAILED: " + failure); + } + + static interface AddListenerInLocale { + public void addListenerInLocale( + MBeanServerConnection mbsc, + NotificationListener listener, + Locale locale) throws Exception; + } + + private static void testLocal() throws Exception { + System.out.println("Test local MBeanServer using doWithContext"); + MBeanServer mbs = makeMBS(); + AddListenerInLocale addListener = new AddListenerInLocale() { + public void addListenerInLocale( + final MBeanServerConnection mbsc, + final NotificationListener listener, + Locale locale) throws Exception { + Map localeContext = Collections.singletonMap( + ClientContext.LOCALE_KEY, locale.toString()); + ClientContext.doWithContext( + localeContext, new Callable() { + public Void call() throws Exception { + mbsc.addNotificationListener( + mbeanName, listener, null, null); + return null; + } + }); + } + }; + test(mbs, addListener); + } + + private static void testRemote() throws Exception { + System.out.println("Test remote MBeanServer using withLocale"); + MBeanServer mbs = makeMBS(); + JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://"); + JMXConnectorServer cs = + JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbs); + cs.start(); + JMXServiceURL addr = cs.getAddress(); + JMXConnector cc = JMXConnectorFactory.connect(addr); + MBeanServerConnection mbsc = cc.getMBeanServerConnection(); + AddListenerInLocale addListenerInLocale = new AddListenerInLocale() { + public void addListenerInLocale( + MBeanServerConnection mbsc, + NotificationListener listener, + Locale locale) throws Exception { + mbsc = ClientContext.withLocale(mbsc, locale); + mbsc.addNotificationListener(mbeanName, listener, null, null); + } + }; + try { + test(mbsc, addListenerInLocale); + } finally { + try { + cc.close(); + } catch (Exception e) {} + cs.stop(); + } + } + + static class QueueListener implements NotificationListener { + final BlockingQueue queue = + new ArrayBlockingQueue(10); + + public void handleNotification(Notification notification, + Object handback) { + queue.add(notification); + } + } + + private static void test( + MBeanServerConnection mbsc, AddListenerInLocale addListener) + throws Exception { + QueueListener defaultListener = new QueueListener(); + QueueListener frenchListener = new QueueListener(); + QueueListener irishListener = new QueueListener(); + mbsc.addNotificationListener(mbeanName, defaultListener, null, null); + addListener.addListenerInLocale(mbsc, frenchListener, new Locale("fr")); + addListener.addListenerInLocale(mbsc, irishListener, new Locale("ga")); + + LocaleAwareMBean proxy = + JMX.newMBeanProxy(mbsc, mbeanName, LocaleAwareMBean.class); + String notifMsg = "[" + Bundle.class.getName() + ":" + messageKey + "]" + + "broken window (default message that should never be seen)"; + Notification notif = new Notification( + "notif.type", mbeanName, 0L, notifMsg); + proxy.sendNotification(notif); + + final Object[][] expected = { + {defaultListener, defaultMessage}, + {frenchListener, frenchMessage}, + {irishListener, irishMessage}, + }; + for (Object[] exp : expected) { + QueueListener ql = (QueueListener) exp[0]; + String msg = (String) exp[1]; + System.out.println("Checking: " + msg); + Notification n = ql.queue.poll(1, TimeUnit.SECONDS); + if (n == null) + fail("Did not receive expected notif: " + msg); + if (!n.getMessage().equals(msg)) { + fail("Received notif with wrong message: got " + + n.getMessage() + ", expected " + msg); + } + n = ql.queue.poll(2, TimeUnit.MILLISECONDS); + if (n != null) + fail("Received unexpected extra notif: " + n); + } + } + + private static MBeanServer makeMBS() throws Exception { + MBeanServer mbs = MBeanServerFactory.newMBeanServer(); + LocaleAware aware = new LocaleAware(); + mbs.registerMBean(aware, mbeanName); + return mbs; + } + + static ConcurrentMap newConcurrentMap() { + return new ConcurrentHashMap(); + } + + static void fail(String why) { + System.out.println("FAIL: " + why); + failure = why; + } +} diff --git a/jdk/test/javax/management/context/LocaleTest.java b/jdk/test/javax/management/context/LocaleTest.java new file mode 100644 index 00000000000..e5ea5309c21 --- /dev/null +++ b/jdk/test/javax/management/context/LocaleTest.java @@ -0,0 +1,140 @@ +/* + * Copyright 2007 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 LocaleTest.java + * @bug 5072267 + * @summary Test client locales. + * @author Eamonn McManus + */ + +import java.lang.management.ManagementFactory; +import java.util.Collections; +import java.util.ListResourceBundle; +import java.util.Locale; +import java.util.Map; +import java.util.ResourceBundle; +import java.util.concurrent.Callable; +import javax.management.ClientContext; +import java.util.Arrays; +import javax.management.MBeanServer; +import javax.management.ObjectName; + +public class LocaleTest { + private static String failure; + + public static void main(String[] args) throws Exception { + + // Test the translation String -> Locale + + Locale[] locales = Locale.getAvailableLocales(); + System.out.println("Testing String->Locale for " + locales.length + + " locales"); + for (Locale loc : locales) { + Map ctx = Collections.singletonMap( + ClientContext.LOCALE_KEY, loc.toString()); + Locale loc2 = ClientContext.doWithContext( + ctx, new Callable() { + public Locale call() { + return ClientContext.getLocale(); + } + }); + assertEquals(loc, loc2); + } + + // Test that a locale-sensitive attribute works + + MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); + mbs = ClientContext.newContextForwarder(mbs, null); + ObjectName name = new ObjectName("a:type=LocaleSensitive"); + mbs.registerMBean(new LocaleSensitive(), name); + Locale.setDefault(Locale.US); + + assertEquals("spectacular failure", + mbs.getAttribute(name, "LastProblemDescription")); + + MBeanServer frmbs = ClientContext.withContext( + mbs, ClientContext.LOCALE_KEY, Locale.FRANCE.toString()); + assertEquals("\u00e9chec r\u00e9tentissant", + frmbs.getAttribute(name, "LastProblemDescription")); + + if (failure == null) + System.out.println("TEST PASSED"); + else + throw new Exception("TEST FAILED: " + failure); + } + + public static interface LocaleSensitiveMBean { + public String getLastProblemDescription(); + } + + public static class LocaleSensitive implements LocaleSensitiveMBean { + public String getLastProblemDescription() { + Locale loc = ClientContext.getLocale(); + ResourceBundle rb = ResourceBundle.getBundle( + MyResources.class.getName(), loc); + return rb.getString("spectacular"); + } + } + + public static class MyResources extends ListResourceBundle { + protected Object[][] getContents() { + return new Object[][] { + {"spectacular", "spectacular failure"}, + }; + } + } + + public static class MyResources_fr extends ListResourceBundle { + protected Object[][] getContents() { + return new Object[][] { + {"spectacular", "\u00e9chec r\u00e9tentissant"}, + }; + } + } + + private static void assertEquals(Object x, Object y) { + if (!equal(x, y)) + failed("expected " + string(x) + "; got " + string(y)); + } + + private static boolean equal(Object x, Object y) { + if (x == y) + return true; + if (x == null || y == null) + return false; + if (x.getClass().isArray()) + return Arrays.deepEquals(new Object[] {x}, new Object[] {y}); + return x.equals(y); + } + + private static String string(Object x) { + String s = Arrays.deepToString(new Object[] {x}); + return s.substring(1, s.length() - 1); + } + + private static void failed(String why) { + failure = why; + new Throwable("FAILED: " + why).printStackTrace(System.out); + } +} diff --git a/jdk/test/javax/management/context/LocalizableTest.java b/jdk/test/javax/management/context/LocalizableTest.java new file mode 100644 index 00000000000..40a18af350d --- /dev/null +++ b/jdk/test/javax/management/context/LocalizableTest.java @@ -0,0 +1,192 @@ +/* + * Copyright 2007 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 LocalizableTest + * @bug 5072267 6635499 + * @summary Test localizable MBeanInfo using LocalizableMBeanFactory. + * @author Eamonn McManus + */ + +import java.lang.management.ManagementFactory; +import java.util.Locale; +import java.util.ResourceBundle; +import javax.management.ClientContext; +import javax.management.Description; +import javax.management.JMX; +import javax.management.MBeanAttributeInfo; +import javax.management.MBeanConstructorInfo; +import javax.management.MBeanInfo; +import javax.management.MBeanOperationInfo; +import javax.management.MBeanParameterInfo; +import javax.management.MBeanServer; +import javax.management.ObjectName; + +import localizable.MBeanDescriptions_fr; +import localizable.Whatsit; + +import static localizable.WhatsitMBean.*; + +public class LocalizableTest { + // If you change the order of the array elements or their number then + // you must also change these constants. + private static final int + MBEAN = 0, ATTR = 1, OPER = 2, PARAM = 3, CONSTR = 4, + CONSTR_PARAM = 5; + private static final String[] englishDescriptions = { + englishMBeanDescription, englishAttrDescription, englishOperDescription, + englishParamDescription, englishConstrDescription, + englishConstrParamDescription, + }; + private static final String[] defaultDescriptions = englishDescriptions.clone(); + static { + defaultDescriptions[MBEAN] = defaultMBeanDescription; + } + private static final String[] frenchDescriptions = { + frenchMBeanDescription, frenchAttrDescription, frenchOperDescription, + frenchParamDescription, frenchConstrDescription, + frenchConstrParamDescription, + }; + + private static String failure; + + @Description(unlocalizedMBeanDescription) + public static interface UnlocalizedMBean {} + public static class Unlocalized implements UnlocalizedMBean {} + + public static void main(String[] args) throws Exception { + ResourceBundle frenchBundle = new MBeanDescriptions_fr(); + // The purpose of the previous line is to force that class to be compiled + // when the test is run so it will be available for reflection. + // Yes, we could do this with a @build tag. + + MBeanServer plainMBS = ManagementFactory.getPlatformMBeanServer(); + MBeanServer unlocalizedMBS = + ClientContext.newContextForwarder(plainMBS, null); + MBeanServer localizedMBS = + ClientContext.newLocalizeMBeanInfoForwarder(plainMBS); + localizedMBS = ClientContext.newContextForwarder(localizedMBS, null); + ObjectName name = new ObjectName("a:b=c"); + + Whatsit whatsit = new Whatsit(); + Object[][] locales = { + {null, englishDescriptions}, + {"en", englishDescriptions}, + {"fr", frenchDescriptions}, + }; + + for (Object[] localePair : locales) { + String locale = (String) localePair[0]; + String[] localizedDescriptions = (String[]) localePair[1]; + System.out.println("===Testing locale " + locale + "==="); + for (boolean localized : new boolean[] {false, true}) { + String[] descriptions = localized ? + localizedDescriptions : defaultDescriptions; + MBeanServer mbs = localized ? localizedMBS : unlocalizedMBS; + System.out.println("Testing MBean " + whatsit + " with " + + "localized=" + localized); + mbs.registerMBean(whatsit, name); + System.out.println(mbs.getMBeanInfo(name)); + try { + test(mbs, name, locale, descriptions); + } catch (Exception e) { + fail("Caught exception: " + e); + } finally { + mbs.unregisterMBean(name); + } + } + } + + System.out.println("===Testing unlocalizable MBean==="); + Object mbean = new Unlocalized(); + localizedMBS.registerMBean(mbean, name); + try { + MBeanInfo mbi = localizedMBS.getMBeanInfo(name); + assertEquals("MBean description", unlocalizedMBeanDescription, + mbi.getDescription()); + } finally { + localizedMBS.unregisterMBean(name); + } + + System.out.println("===Testing MBeanInfo.localizeDescriptions==="); + plainMBS.registerMBean(whatsit, name); + MBeanInfo mbi = plainMBS.getMBeanInfo(name); + Locale french = new Locale("fr"); + mbi = mbi.localizeDescriptions(french, whatsit.getClass().getClassLoader()); + checkDescriptions(mbi, frenchDescriptions); + + if (failure == null) + System.out.println("TEST PASSED"); + else + throw new Exception("TEST FAILED: Last failure: " + failure); + } + + private static void test(MBeanServer mbs, ObjectName name, String locale, + String[] expectedDescriptions) + throws Exception { + if (locale != null) + mbs = ClientContext.withLocale(mbs, new Locale(locale)); + MBeanInfo mbi = mbs.getMBeanInfo(name); + checkDescriptions(mbi, expectedDescriptions); + } + + private static void checkDescriptions(MBeanInfo mbi, + String[] expectedDescriptions) { + assertEquals("MBean description", + expectedDescriptions[MBEAN], mbi.getDescription()); + MBeanAttributeInfo mbai = mbi.getAttributes()[0]; + assertEquals("Attribute description", + expectedDescriptions[ATTR], mbai.getDescription()); + MBeanOperationInfo mboi = mbi.getOperations()[0]; + assertEquals("Operation description", + expectedDescriptions[OPER], mboi.getDescription()); + MBeanParameterInfo mbpi = mboi.getSignature()[0]; + assertEquals("Parameter description", + expectedDescriptions[PARAM], mbpi.getDescription()); + MBeanConstructorInfo[] mbcis = mbi.getConstructors(); + assertEquals("Number of constructors", 2, mbcis.length); + for (MBeanConstructorInfo mbci : mbcis) { + MBeanParameterInfo[] mbcpis = mbci.getSignature(); + String constrName = mbcpis.length + "-arg constructor"; + assertEquals(constrName + " description", + expectedDescriptions[CONSTR], mbci.getDescription()); + if (mbcpis.length > 0) { + assertEquals(constrName + " parameter description", + expectedDescriptions[CONSTR_PARAM], + mbcpis[0].getDescription()); + } + } + } + + private static void assertEquals(String what, Object expect, Object actual) { + if (expect.equals(actual)) + System.out.println("...OK: " + what + " = " + expect); + else + fail(what + " should be " + expect + ", was " + actual); + } + + private static void fail(String why) { + System.out.println("FAIL: " + why); + failure = why; + } +} diff --git a/jdk/test/javax/management/context/RemoteContextTest.java b/jdk/test/javax/management/context/RemoteContextTest.java new file mode 100644 index 00000000000..56c7eab6c8b --- /dev/null +++ b/jdk/test/javax/management/context/RemoteContextTest.java @@ -0,0 +1,496 @@ +/* + * Copyright 2007-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. + * + * 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 RemoteContextTest.java + * @bug 5072267 + * @summary Test client contexts with namespaces. + * @author Eamonn McManus, Daniel Fuchs + */ + +import java.lang.management.ManagementFactory; +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; +import java.net.URLEncoder; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.Map; +import java.util.Queue; +import java.util.Set; +import java.util.concurrent.Callable; +import javax.management.Attribute; +import javax.management.AttributeList; +import javax.management.ClientContext; +import javax.management.DynamicMBean; +import javax.management.JMX; +import javax.management.ListenerNotFoundException; +import javax.management.MBeanNotificationInfo; +import javax.management.MBeanRegistration; +import javax.management.MBeanServer; +import javax.management.MBeanServerConnection; +import javax.management.MBeanServerDelegate; +import javax.management.Notification; +import javax.management.NotificationBroadcasterSupport; +import javax.management.NotificationFilter; +import javax.management.NotificationListener; +import javax.management.ObjectInstance; +import javax.management.ObjectName; +import javax.management.StandardMBean; +import javax.management.loading.MLet; +import javax.management.namespace.JMXNamespaces; +import javax.management.namespace.JMXRemoteNamespace; +import javax.management.namespace.JMXNamespace; + +import static java.util.Collections.singletonMap; +import javax.management.MBeanServerFactory; +import javax.management.remote.JMXConnectorServer; +import javax.management.remote.JMXConnectorServerFactory; +import javax.management.remote.JMXServiceURL; + +public class RemoteContextTest { + private static String failure; + + public static interface ShowContextMBean { + public Map getContext(); + public Map getCreationContext(); + public Set getCalledOps(); + public String getThing(); + public void setThing(String x); + public int add(int x, int y); + } + + public static class ShowContext + extends NotificationBroadcasterSupport + implements ShowContextMBean, MBeanRegistration { + private final Map creationContext; + private final Set calledOps = new HashSet(); + + public ShowContext() { + creationContext = getContext(); + } + + public Map getContext() { + return ClientContext.getContext(); + } + + public Map getCreationContext() { + return creationContext; + } + + public Set getCalledOps() { + return calledOps; + } + + public String getThing() { + return "x"; + } + + public void setThing(String x) { + } + + public int add(int x, int y) { + return x + y; + } + + public ObjectName preRegister(MBeanServer server, ObjectName name) { + assertEquals(creationContext, getContext()); + calledOps.add("preRegister"); + return name; + } + + public void postRegister(Boolean registrationDone) { + assertEquals(creationContext, getContext()); + calledOps.add("postRegister"); + } + + // The condition checked here is not guaranteed universally true, + // but is true every time we unregister an instance of this MBean + // in this test. + public void preDeregister() throws Exception { + assertEquals(creationContext, getContext()); + } + + public void postDeregister() { + assertEquals(creationContext, getContext()); + } + + // Same remark as for preDeregister + @Override + public MBeanNotificationInfo[] getNotificationInfo() { + calledOps.add("getNotificationInfo"); + return super.getNotificationInfo(); + } + + @Override + public void addNotificationListener( + NotificationListener listener, NotificationFilter filter, Object handback) { + calledOps.add("addNotificationListener"); + super.addNotificationListener(listener, filter, handback); + } + + @Override + public void removeNotificationListener( + NotificationListener listener) + throws ListenerNotFoundException { + calledOps.add("removeNL1"); + super.removeNotificationListener(listener); + } + + @Override + public void removeNotificationListener( + NotificationListener listener, NotificationFilter filter, Object handback) + throws ListenerNotFoundException { + calledOps.add("removeNL3"); + super.removeNotificationListener(listener, filter, handback); + } + } + + private static class LogRecord { + final String op; + final Object[] params; + final Map context; + LogRecord(String op, Object[] params, Map context) { + this.op = op; + this.params = params; + this.context = context; + } + + @Override + public String toString() { + return op + Arrays.deepToString(params) + " " + context; + } + } + + private static class LogIH implements InvocationHandler { + private final Object wrapped; + Queue log = new LinkedList(); + + LogIH(Object wrapped) { + this.wrapped = wrapped; + } + + public Object invoke(Object proxy, Method method, Object[] args) + throws Throwable { + if (method.getDeclaringClass() != Object.class) { + LogRecord lr = + new LogRecord( + method.getName(), args, ClientContext.getContext()); + log.add(lr); + } + try { + return method.invoke(wrapped, args); + } catch (InvocationTargetException e) { + throw e.getCause(); + } + } + } + + private static T newSnoop(Class wrappedClass, LogIH logIH) { + return wrappedClass.cast(Proxy.newProxyInstance( + wrappedClass.getClassLoader(), + new Class[] {wrappedClass}, + logIH)); + } + + public static void main(String[] args) throws Exception { + final String subnamespace = "sub"; + final ObjectName locname = new ObjectName("a:b=c"); + final ObjectName name = JMXNamespaces.insertPath(subnamespace,locname); + final MBeanServer mbs = ClientContext.newContextForwarder( + ManagementFactory.getPlatformMBeanServer(), null); + final MBeanServer sub = ClientContext.newContextForwarder( + MBeanServerFactory.newMBeanServer(), null); + final JMXServiceURL anonym = new JMXServiceURL("rmi",null,0); + final Map env = Collections.emptyMap(); + final Map emptyContext = Collections.emptyMap(); + final JMXConnectorServer srv = + JMXConnectorServerFactory.newJMXConnectorServer(anonym,env,sub); + sub.registerMBean(new ShowContext(), locname); + + srv.start(); + + try { + JMXRemoteNamespace subns = JMXRemoteNamespace. + newJMXRemoteNamespace(srv.getAddress(),null); + mbs.registerMBean(subns, JMXNamespaces.getNamespaceObjectName("sub")); + mbs.invoke(JMXNamespaces.getNamespaceObjectName("sub"), + "connect", null,null); + final ShowContextMBean show = + JMX.newMBeanProxy(mbs, name, ShowContextMBean.class); + + assertEquals(emptyContext, show.getContext()); + ClientContext.doWithContext(singletonMap("foo", "bar"), new Callable() { + public Void call() { + assertEquals(singletonMap("foo", "bar"), show.getContext()); + return null; + } + }); + assertEquals(emptyContext, show.getContext()); + String got = ClientContext.doWithContext( + singletonMap("foo", "baz"), new Callable() { + public String call() { + return ClientContext.getContext().get("foo"); + } + }); + assertEquals("baz", got); + + Map combined = ClientContext.doWithContext( + singletonMap("foo", "baz"), new Callable>() { + public Map call() throws Exception { + return ClientContext.doWithContext( + singletonMap("fred", "jim"), + new Callable>() { + public Map call() { + return ClientContext.getContext(); + } + }); + } + }); + assertEquals(singletonMap("fred", "jim"), combined); + + final String ugh = "a!?//*=:\"% "; + ClientContext.doWithContext(singletonMap(ugh, ugh), new Callable() { + public Void call() { + assertEquals(Collections.singletonMap(ugh, ugh), + ClientContext.getContext()); + return null; + } + }); + + // Basic withContext tests + + LogIH mbsIH = new LogIH(mbs); + MBeanServer snoopMBS = newSnoop(MBeanServer.class, mbsIH); + MBeanServer ughMBS = ClientContext.withContext(snoopMBS, ugh, ugh); + // ughMBS is never referenced but we check that the withContext call + // included a call to snoopMBS.isRegistered. + String encodedUgh = URLEncoder.encode(ugh, "UTF-8").replace("*", "%2A"); + ObjectName expectedName = new ObjectName( + ClientContext.NAMESPACE + ObjectName.NAMESPACE_SEPARATOR + + encodedUgh + "=" + encodedUgh + + ObjectName.NAMESPACE_SEPARATOR + ":" + + JMXNamespace.TYPE_ASSIGNMENT); + assertCalled(mbsIH, "isRegistered", new Object[] {expectedName}, + emptyContext); + + // Test withDynamicContext + + MBeanServerConnection dynamicSnoop = + ClientContext.withDynamicContext(snoopMBS); + assertCalled(mbsIH, "isRegistered", + new Object[] { + JMXNamespaces.getNamespaceObjectName(ClientContext.NAMESPACE) + }, + emptyContext); + final ShowContextMBean dynamicShow = + JMX.newMBeanProxy(dynamicSnoop, name, ShowContextMBean.class); + assertEquals(Collections.emptyMap(), dynamicShow.getContext()); + assertCalled(mbsIH, "getAttribute", new Object[] {name, "Context"}, + emptyContext); + + Map expectedDynamic = + Collections.singletonMap("gladstone", "gander"); + Map dynamic = ClientContext.doWithContext( + expectedDynamic, + new Callable>() { + public Map call() throws Exception { + return dynamicShow.getContext(); + } + }); + assertEquals(expectedDynamic, dynamic); + ObjectName expectedDynamicName = new ObjectName( + ClientContext.encode(expectedDynamic) + + ObjectName.NAMESPACE_SEPARATOR + name); + assertCalled(mbsIH, "getAttribute", + new Object[] {expectedDynamicName, "Context"}, dynamic); + + MBeanServer cmbs = ClientContext.withContext( + mbs, "mickey", "mouse"); + ShowContextMBean cshow = + JMX.newMBeanProxy(cmbs, name, ShowContextMBean.class); + assertEquals(Collections.singletonMap("mickey", "mouse"), cshow.getContext()); + + MBeanServer ccmbs = ClientContext.withContext( + cmbs, "donald", "duck"); + ShowContextMBean ccshow = + JMX.newMBeanProxy(ccmbs, name, ShowContextMBean.class); + Map disney = new HashMap(); + disney.put("mickey", "mouse"); + disney.put("donald", "duck"); + assertEquals(disney, ccshow.getContext()); + + // Test that all MBS ops produce reasonable results + + ObjectName logger = new ObjectName("a:type=Logger"); + DynamicMBean showMBean = + new StandardMBean(new ShowContext(), ShowContextMBean.class); + LogIH mbeanLogIH = new LogIH(showMBean); + DynamicMBean logMBean = newSnoop(DynamicMBean.class, mbeanLogIH); + ObjectInstance loggerOI = ccmbs.registerMBean(logMBean, logger); + assertEquals(logger, loggerOI.getObjectName()); + + // We get a getMBeanInfo call to determine the className in the + // ObjectInstance to return from registerMBean. + assertCalled(mbeanLogIH, "getMBeanInfo", disney); + + ccmbs.getAttribute(logger, "Thing"); + assertCalled(mbeanLogIH, "getAttribute", disney); + + ccmbs.getAttributes(logger, new String[] {"Thing", "Context"}); + assertCalled(mbeanLogIH, "getAttributes", disney); + + ccmbs.setAttribute(logger, new Attribute("Thing", "bar")); + assertCalled(mbeanLogIH, "setAttribute", disney); + + ccmbs.setAttributes(logger, new AttributeList( + Arrays.asList(new Attribute("Thing", "baz")))); + assertCalled(mbeanLogIH, "setAttributes", disney); + + ccmbs.getMBeanInfo(logger); + assertCalled(mbeanLogIH, "getMBeanInfo", disney); + + Set names = ccmbs.queryNames(null, null); + Set expectedNames = new HashSet( + Collections.singleton(MBeanServerDelegate.DELEGATE_NAME)); + expectedNames.removeAll(names); + assertEquals(0, expectedNames.size()); + + Set nsNames = + ccmbs.queryNames(new ObjectName("**?*?//:*"), null); + Set expectedNsNames = new HashSet( + Arrays.asList( + new ObjectName(ClientContext.NAMESPACE + + ObjectName.NAMESPACE_SEPARATOR + ":" + + JMXNamespace.TYPE_ASSIGNMENT))); + expectedNsNames.removeAll(nsNames); + assertEquals(0, expectedNsNames.size()); + + Set insts = ccmbs.queryMBeans( + MBeanServerDelegate.DELEGATE_NAME, null); + assertEquals(1, insts.size()); + assertEquals(MBeanServerDelegate.DELEGATE_NAME, + insts.iterator().next().getObjectName()); + + ObjectName createdName = new ObjectName("a:type=Created"); + ObjectInstance createdOI = + ccmbs.createMBean(ShowContext.class.getName(), createdName); + assertEquals(ShowContext.class.getName(), createdOI.getClassName()); + assertEquals(createdName, createdOI.getObjectName()); + assertEquals(disney, ccmbs.getAttribute(createdName, "CreationContext")); + + NotificationListener nothingListener = new NotificationListener() { + public void handleNotification(Notification n, Object h) {} + }; + ccmbs.addNotificationListener(createdName, nothingListener, null, null); + ccmbs.removeNotificationListener(createdName, nothingListener, null, null); + ccmbs.addNotificationListener(createdName, nothingListener, null, null); + ccmbs.removeNotificationListener(createdName, nothingListener); + Set expectedOps = new HashSet(Arrays.asList( + "preRegister", "postRegister", "addNotificationListener", + "removeNL1", "removeNL3", "getNotificationInfo")); + assertEquals(expectedOps, ccmbs.getAttribute(createdName, "CalledOps")); + + assertEquals(ShowContext.class.getClassLoader(), + ccmbs.getClassLoaderFor(createdName)); + + assertEquals(true, ccmbs.isRegistered(createdName)); + assertEquals(true, ccmbs.isInstanceOf(createdName, + ShowContext.class.getName())); + assertEquals(false, ccmbs.isInstanceOf(createdName, + DynamicMBean.class.getName())); + ccmbs.unregisterMBean(createdName); + assertEquals(false, ccmbs.isRegistered(createdName)); + + MLet mlet = new MLet(); + ObjectName defaultMLetName = new ObjectName("DefaultDomain:type=MLet"); + + ccmbs.registerMBean(mlet, defaultMLetName); + + assertEquals(mlet, ccmbs.getClassLoader(defaultMLetName)); + + assertEquals(0, mbeanLogIH.log.size()); + + // Test that contexts still work when we can't combine two encoded contexts. + // Here, we wrap cmbs (mickey=mouse) so that ccmbs2 (donald=duck) cannot + // see that it already contains a context and therefore cannot combine + // into mickey=mouse;donald=duck. We don't actually use the snoop + // capabilities of the returned object -- we just want an opaque + // MBeanServer wrapper + MBeanServer cmbs2 = newSnoop(MBeanServer.class, new LogIH(cmbs)); + MBeanServer ccmbs2 = ClientContext.withContext(cmbs2, "donald", "duck"); + assertEquals(disney, ccmbs2.getAttribute(name, "Context")); + + // ADD NEW TESTS HERE ^^^ + + if (failure != null) + throw new Exception(failure); + } finally { + srv.stop(); + } + } + + private static void assertEquals(Object x, Object y) { + if (!equal(x, y)) + failed("expected " + string(x) + "; got " + string(y)); + } + + private static boolean equal(Object x, Object y) { + if (x == y) + return true; + if (x == null || y == null) + return false; + if (x.getClass().isArray()) + return Arrays.deepEquals(new Object[] {x}, new Object[] {y}); + return x.equals(y); + } + + private static String string(Object x) { + String s = Arrays.deepToString(new Object[] {x}); + return s.substring(1, s.length() - 1); + } + + private static void assertCalled( + LogIH logIH, String op, Map expectedContext) { + assertCalled(logIH, op, null, expectedContext); + } + + private static void assertCalled( + LogIH logIH, String op, Object[] params, + Map expectedContext) { + LogRecord lr = logIH.log.remove(); + assertEquals(op, lr.op); + if (params != null) + assertEquals(params, lr.params); + assertEquals(expectedContext, lr.context); + } + + private static void failed(String why) { + failure = why; + new Throwable("FAILED: " + why).printStackTrace(System.out); + } +} diff --git a/jdk/test/javax/management/context/localizable/MBeanDescriptions.properties b/jdk/test/javax/management/context/localizable/MBeanDescriptions.properties new file mode 100644 index 00000000000..4722c5b5acc --- /dev/null +++ b/jdk/test/javax/management/context/localizable/MBeanDescriptions.properties @@ -0,0 +1,9 @@ +# This is the default description ResourceBundle for MBeans in this package. +# Resources here override the descriptions specified with @Description +# but only when localization is happening and when there is not a more +# specific resource for the description (for example from MBeanDescriptions_fr). + +WhatsitMBean.mbean = A whatsit +# This must be the same as WhatsitMBean.englishMBeanDescription for the +# purposes of this test. + diff --git a/jdk/test/javax/management/context/localizable/MBeanDescriptions_fr.java b/jdk/test/javax/management/context/localizable/MBeanDescriptions_fr.java new file mode 100644 index 00000000000..9e9cfa2ffea --- /dev/null +++ b/jdk/test/javax/management/context/localizable/MBeanDescriptions_fr.java @@ -0,0 +1,42 @@ +/* + * Copyright 2007 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. + */ + +package localizable; + +import java.util.ListResourceBundle; +import static localizable.WhatsitMBean.*; + +public class MBeanDescriptions_fr extends ListResourceBundle { + @Override + protected Object[][] getContents() { + String constrProp = "WhatsitMBean.constructor." + Whatsit.class.getName(); + return new Object[][] { + {"WhatsitMBean.mbean", frenchMBeanDescription}, + {"WhatsitMBean.attribute.Whatsit", frenchAttrDescription}, + {"WhatsitMBean.operation.frob", frenchOperDescription}, + {"WhatsitMBean.operation.frob.p1", frenchParamDescription}, + {constrProp, frenchConstrDescription}, + {constrProp + ".p1", frenchConstrParamDescription}, + }; + } +} diff --git a/jdk/test/javax/management/context/localizable/Whatsit.java b/jdk/test/javax/management/context/localizable/Whatsit.java new file mode 100644 index 00000000000..f140ad920cb --- /dev/null +++ b/jdk/test/javax/management/context/localizable/Whatsit.java @@ -0,0 +1,59 @@ +/* + * Copyright 2007 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. + */ + +package localizable; + +import javax.management.Description; + +public class Whatsit implements WhatsitMBean { + /** + * Attribute : NewAttribute0 + */ + private String newAttribute0; + @Description(englishConstrDescription) + public Whatsit() {} + + @Description(englishConstrDescription) + public Whatsit(@Description(englishConstrParamDescription) int type) {} + + public String getWhatsit() { + return "whatsit"; + } + + public void frob(String whatsit) { + } + + /** + * Get Tiddly + */ + public String getNewAttribute0() { + return newAttribute0; + } + + /** + * Set Tiddly + */ + public void setNewAttribute0(String value) { + newAttribute0 = value; + } +} diff --git a/jdk/test/javax/management/context/localizable/WhatsitMBean.java b/jdk/test/javax/management/context/localizable/WhatsitMBean.java new file mode 100644 index 00000000000..5bebc52f312 --- /dev/null +++ b/jdk/test/javax/management/context/localizable/WhatsitMBean.java @@ -0,0 +1,53 @@ +/* + * Copyright 2007 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. + */ + +package localizable; + +import javax.management.Description; + +@Description(WhatsitMBean.defaultMBeanDescription) +public interface WhatsitMBean { + public static final String + defaultMBeanDescription = "Default whatsit MBean description", + englishMBeanDescription = "A whatsit", + // Previous description appears in MBeanDescriptions.properties + // so it overrides the @Description when that file is used. + frenchMBeanDescription = "Un bidule", + englishAttrDescription = "The whatsit", + frenchAttrDescription = "Le bidule", + englishOperDescription = "Frob the whatsit", + frenchOperDescription = "Frober le bidule", + englishParamDescription = "The whatsit to frob", + frenchParamDescription = "Le bidule \u00e0 frober", + englishConstrDescription = "Make a whatsit", + frenchConstrDescription = "Fabriquer un bidule", + englishConstrParamDescription = "Type of whatsit to make", + frenchConstrParamDescription = "Type de bidule \u00e0 fabriquer", + unlocalizedMBeanDescription = "Unlocalized MBean"; + + @Description(englishAttrDescription) + public String getWhatsit(); + + @Description(englishOperDescription) + public void frob(@Description(englishParamDescription) String whatsit); +} diff --git a/jdk/test/javax/management/eventService/CustomForwarderTest.java b/jdk/test/javax/management/eventService/CustomForwarderTest.java index c9c866aaee0..4d7e3027e31 100644 --- a/jdk/test/javax/management/eventService/CustomForwarderTest.java +++ b/jdk/test/javax/management/eventService/CustomForwarderTest.java @@ -200,8 +200,7 @@ public class CustomForwarderTest { public static void main(String[] args) throws Exception { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); - MBeanServerForwarder mbsf = EventClientDelegate.newForwarder(); - mbsf.setMBeanServer(mbs); + MBeanServerForwarder mbsf = EventClientDelegate.newForwarder(mbs, null); mbs = mbsf; // for 1.5 diff --git a/jdk/test/javax/management/eventService/EventClientExecutorTest.java b/jdk/test/javax/management/eventService/EventClientExecutorTest.java index 19d6afdf814..5201335e8b9 100644 --- a/jdk/test/javax/management/eventService/EventClientExecutorTest.java +++ b/jdk/test/javax/management/eventService/EventClientExecutorTest.java @@ -65,8 +65,7 @@ public class EventClientExecutorTest { new NamedThreadFactory("LEASE")); MBeanServer mbs = MBeanServerFactory.newMBeanServer(); - MBeanServerForwarder mbsf = EventClientDelegate.newForwarder(); - mbsf.setMBeanServer(mbs); + MBeanServerForwarder mbsf = EventClientDelegate.newForwarder(mbs, null); mbs = mbsf; EventClientDelegateMBean ecd = EventClientDelegate.getProxy(mbs); diff --git a/jdk/test/javax/management/eventService/EventManagerTest.java b/jdk/test/javax/management/eventService/EventManagerTest.java index 2717c0e5103..66e4e36cf4a 100644 --- a/jdk/test/javax/management/eventService/EventManagerTest.java +++ b/jdk/test/javax/management/eventService/EventManagerTest.java @@ -98,7 +98,7 @@ public class EventManagerTest { succeed &= test(new EventClient(ecd, new RMIPushEventRelay(ecd), null, null, - EventClient.DEFAULT_LEASE_TIMEOUT)); + EventClient.DEFAULT_REQUESTED_LEASE_TIME)); conn.close(); server.stop(); diff --git a/jdk/test/javax/management/eventService/ListenerTest.java b/jdk/test/javax/management/eventService/ListenerTest.java index 7195736b662..c4c91135673 100644 --- a/jdk/test/javax/management/eventService/ListenerTest.java +++ b/jdk/test/javax/management/eventService/ListenerTest.java @@ -99,7 +99,7 @@ public class ListenerTest { succeed &= test(new EventClient(ecd, new RMIPushEventRelay(ecd), null, null, - EventClient.DEFAULT_LEASE_TIMEOUT)); + EventClient.DEFAULT_REQUESTED_LEASE_TIME)); conn.close(); server.stop(); diff --git a/jdk/test/javax/management/eventService/NotSerializableNotifTest.java b/jdk/test/javax/management/eventService/NotSerializableNotifTest.java index 0bf0bc5faae..4185b4dd9e4 100644 --- a/jdk/test/javax/management/eventService/NotSerializableNotifTest.java +++ b/jdk/test/javax/management/eventService/NotSerializableNotifTest.java @@ -95,7 +95,7 @@ public class NotSerializableNotifTest { FetchingEventRelay.DEFAULT_MAX_NOTIFICATIONS, null); EventClient ec = new EventClient(ecd, eventRelay, null, null, - EventClient.DEFAULT_LEASE_TIMEOUT); + EventClient.DEFAULT_REQUESTED_LEASE_TIME); // add listener from the client side Listener listener = new Listener(); diff --git a/jdk/test/javax/management/eventService/UsingEventService.java b/jdk/test/javax/management/eventService/UsingEventService.java index 3d768ed8d6f..b46ffe3f6d8 100644 --- a/jdk/test/javax/management/eventService/UsingEventService.java +++ b/jdk/test/javax/management/eventService/UsingEventService.java @@ -1,3 +1,26 @@ +/* + * 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. + * + * 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 UsingEventService.java 1.10 08/01/22 * @bug 5108776 diff --git a/jdk/test/javax/management/namespace/EventWithNamespaceControlTest.java b/jdk/test/javax/management/namespace/EventWithNamespaceControlTest.java index 1e3901104c7..9bfa9866d85 100644 --- a/jdk/test/javax/management/namespace/EventWithNamespaceControlTest.java +++ b/jdk/test/javax/management/namespace/EventWithNamespaceControlTest.java @@ -85,6 +85,7 @@ public class EventWithNamespaceControlTest extends EventWithNamespaceTest { } } + @Override public Map getServerMap() { Map retValue = Collections.emptyMap(); return retValue; diff --git a/jdk/test/javax/management/namespace/JMXNamespaceSecurityTest.java b/jdk/test/javax/management/namespace/JMXNamespaceSecurityTest.java index 213ffbfb63e..ec201dbda2c 100644 --- a/jdk/test/javax/management/namespace/JMXNamespaceSecurityTest.java +++ b/jdk/test/javax/management/namespace/JMXNamespaceSecurityTest.java @@ -51,6 +51,7 @@ import javax.management.namespace.JMXDomain; import javax.management.namespace.JMXNamespace; import javax.management.namespace.JMXNamespaces; import javax.management.remote.JMXConnectorServer; +import javax.management.ClientContext; /** * diff --git a/jdk/test/javax/management/namespace/JMXNamespaceViewTest.java b/jdk/test/javax/management/namespace/JMXNamespaceViewTest.java index e134968296b..4764f531f6f 100644 --- a/jdk/test/javax/management/namespace/JMXNamespaceViewTest.java +++ b/jdk/test/javax/management/namespace/JMXNamespaceViewTest.java @@ -42,6 +42,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; +import javax.management.ClientContext; import javax.management.JMException; import javax.management.MBeanRegistration; import javax.management.MBeanServer; @@ -62,11 +63,6 @@ import javax.management.remote.JMXServiceURL; */ public class JMXNamespaceViewTest { - // TODO: Remove this when contexts are added. - public static class ClientContext { - public final static String NAMESPACE = "jmx.context"; - } - /** * Describe the configuration of a namespace */ diff --git a/jdk/test/javax/management/namespace/JMXRemoteTargetNamespace.java b/jdk/test/javax/management/namespace/JMXRemoteTargetNamespace.java index 3d83844b1ff..633e9302142 100644 --- a/jdk/test/javax/management/namespace/JMXRemoteTargetNamespace.java +++ b/jdk/test/javax/management/namespace/JMXRemoteTargetNamespace.java @@ -68,13 +68,7 @@ public class JMXRemoteTargetNamespace extends JMXRemoteNamespace { public JMXRemoteTargetNamespace(JMXServiceURL sourceURL, Map optionsMap, String sourceNamespace) { - this(sourceURL,optionsMap,sourceNamespace,false); - } - - public JMXRemoteTargetNamespace(JMXServiceURL sourceURL, - Map optionsMap, String sourceNamespace, - boolean createEventClient) { - super(sourceURL,optionsMap); + super(sourceURL, optionsMap); this.sourceNamespace = sourceNamespace; this.createEventClient = createEventClient(optionsMap); } @@ -92,14 +86,14 @@ public class JMXRemoteTargetNamespace extends JMXRemoteNamespace { } @Override - protected JMXConnector newJMXConnector(JMXServiceURL url, - Map env) throws IOException { - JMXConnector sup = super.newJMXConnector(url, env); - if (sourceNamespace == null || "".equals(sourceNamespace)) - return sup; + protected MBeanServerConnection getMBeanServerConnection(JMXConnector jmxc) + throws IOException { + MBeanServerConnection mbsc = super.getMBeanServerConnection(jmxc); + if (sourceNamespace != null && sourceNamespace.length() > 0) + mbsc = JMXNamespaces.narrowToNamespace(mbsc, sourceNamespace); if (createEventClient) - sup = EventClient.withEventClient(sup); - return JMXNamespaces.narrowToNamespace(sup, sourceNamespace); + mbsc = EventClient.getEventClientConnection(mbsc); + return mbsc; } diff --git a/jdk/test/javax/management/namespace/NamespaceNotificationsTest.java b/jdk/test/javax/management/namespace/NamespaceNotificationsTest.java index 9c5a1a04a1c..0545a36b2ad 100644 --- a/jdk/test/javax/management/namespace/NamespaceNotificationsTest.java +++ b/jdk/test/javax/management/namespace/NamespaceNotificationsTest.java @@ -206,18 +206,10 @@ public class NamespaceNotificationsTest { aconn.addNotificationListener(deep,listener,null,deep); - final JMXServiceURL urlx = new JMXServiceURL(url1.toString()); - System.out.println("conn: "+urlx); - final JMXConnector jc2 = JMXNamespaces.narrowToNamespace( - JMXConnectorFactory.connect(urlx),"server1//server1"); - final JMXConnector jc3 = JMXNamespaces.narrowToNamespace(jc2,"server3"); - jc3.connect(); - System.out.println("JC#3: " + - ((jc3 instanceof JMXAddressable)? - ((JMXAddressable)jc3).getAddress(): - jc3.toString())); - final MBeanServerConnection bconn = - jc3.getMBeanServerConnection(); + MBeanServerConnection iconn = + JMXNamespaces.narrowToNamespace(aconn, "server1//server1"); + MBeanServerConnection bconn = + JMXNamespaces.narrowToNamespace(aconn, "server3"); final ObjectName shallow = new ObjectName("bush:"+ deep.getKeyPropertyListString()); diff --git a/jdk/test/javax/management/namespace/NullDomainObjectNameTest.java b/jdk/test/javax/management/namespace/NullDomainObjectNameTest.java index 3251d388a86..6b1ad51c252 100644 --- a/jdk/test/javax/management/namespace/NullDomainObjectNameTest.java +++ b/jdk/test/javax/management/namespace/NullDomainObjectNameTest.java @@ -155,7 +155,7 @@ public class NullDomainObjectNameTest { // namespace. // RoutingServerProxy proxy = - new RoutingServerProxy(sub, "", "faked", false); + new RoutingServerProxy(sub, "", "faked", true); // These should fail because the ObjectName doesn't start // with "faked//" diff --git a/jdk/test/javax/management/namespace/NullObjectNameTest.java b/jdk/test/javax/management/namespace/NullObjectNameTest.java index 156e7661db5..0e645dc1e3c 100644 --- a/jdk/test/javax/management/namespace/NullObjectNameTest.java +++ b/jdk/test/javax/management/namespace/NullObjectNameTest.java @@ -162,7 +162,7 @@ public class NullObjectNameTest { // this case. // RoutingServerProxy proxy = - new RoutingServerProxy(sub,"","faked",false); + new RoutingServerProxy(sub, "", "faked", true); final ObjectInstance moi3 = proxy.registerMBean(new MyWombat(),null); System.out.println(moi3.getObjectName().toString()+ diff --git a/jdk/test/javax/management/openmbean/CompositeDataStringTest.java b/jdk/test/javax/management/openmbean/CompositeDataStringTest.java index 286bfd1d41b..7a64e52305a 100644 --- a/jdk/test/javax/management/openmbean/CompositeDataStringTest.java +++ b/jdk/test/javax/management/openmbean/CompositeDataStringTest.java @@ -21,19 +21,19 @@ * have any questions. */ -import javax.management.openmbean.CompositeType; -import javax.management.openmbean.OpenType; -import javax.management.openmbean.SimpleType; - /* * @test * @bug 6610174 * @summary Test that CompositeDataSupport.toString() represents arrays correctly * @author Eamonn McManus */ + import javax.management.openmbean.ArrayType; import javax.management.openmbean.CompositeData; import javax.management.openmbean.CompositeDataSupport; +import javax.management.openmbean.CompositeType; +import javax.management.openmbean.OpenType; +import javax.management.openmbean.SimpleType; public class CompositeDataStringTest { public static void main(String[] args) throws Exception { diff --git a/jdk/test/javax/management/remote/mandatory/connectorServer/ForwarderChainTest.java b/jdk/test/javax/management/remote/mandatory/connectorServer/ForwarderChainTest.java index b6c6d87926f..e1dcbcb6e05 100644 --- a/jdk/test/javax/management/remote/mandatory/connectorServer/ForwarderChainTest.java +++ b/jdk/test/javax/management/remote/mandatory/connectorServer/ForwarderChainTest.java @@ -86,16 +86,20 @@ public class ForwarderChainTest { test(cs, mbs); System.out.println("===Remove any leftover forwarders==="); - while (cs.getSystemMBeanServer() instanceof MBeanServerForwarder) { - MBeanServerForwarder mbsf = - (MBeanServerForwarder) cs.getSystemMBeanServer(); - cs.removeMBeanServerForwarder(mbsf); + MBeanServerForwarder systemMBSF = cs.getSystemMBeanServerForwarder(); + // Real code would just do systemMBSF.setMBeanServer(mbs). + while (true) { + MBeanServer xmbs = systemMBSF.getMBeanServer(); + if (!(xmbs instanceof MBeanServerForwarder)) + break; + cs.removeMBeanServerForwarder((MBeanServerForwarder) xmbs); } expectChain(cs, "U", mbs); System.out.println("===Ensure forwarders are called==="); cs.setMBeanServerForwarder(forwarders[0]); - cs.setSystemMBeanServerForwarder(forwarders[1]); + systemMBSF.setMBeanServer(forwarders[1]); + forwarders[1].setMBeanServer(forwarders[0]); expectChain(cs, "1U0", mbs); cs.start(); if (forwarders[0].defaultDomainCount != 0 || @@ -125,8 +129,8 @@ public class ForwarderChainTest { private static void test(JMXConnectorServer cs, MBeanServer end) { // A newly-created connector server might have system forwarders, // so get rid of those. - while (cs.getSystemMBeanServer() != cs.getMBeanServer()) - cs.removeMBeanServerForwarder((MBeanServerForwarder) cs.getSystemMBeanServer()); + MBeanServerForwarder systemMBSF = cs.getSystemMBeanServerForwarder(); + systemMBSF.setMBeanServer(cs.getMBeanServer()); expectChain(cs, "U", end); @@ -139,7 +143,8 @@ public class ForwarderChainTest { expectChain(cs, "U10", end); System.out.println("Add a system forwarder"); - cs.setSystemMBeanServerForwarder(forwarders[2]); + forwarders[2].setMBeanServer(systemMBSF.getMBeanServer()); + systemMBSF.setMBeanServer(forwarders[2]); expectChain(cs, "2U10", end); System.out.println("Add another user forwarder"); @@ -147,7 +152,8 @@ public class ForwarderChainTest { expectChain(cs, "2U310", end); System.out.println("Add another system forwarder"); - cs.setSystemMBeanServerForwarder(forwarders[4]); + forwarders[4].setMBeanServer(systemMBSF.getMBeanServer()); + systemMBSF.setMBeanServer(forwarders[4]); expectChain(cs, "42U310", end); System.out.println("Remove the first user forwarder"); @@ -215,9 +221,8 @@ public class ForwarderChainTest { } case 2: { // add it to the system chain System.out.println("Add " + c + " to system chain"); - if (cs.getSystemMBeanServer() == null) - mbsf.setMBeanServer(null); - cs.setSystemMBeanServerForwarder(mbsf); + mbsf.setMBeanServer(systemMBSF.getMBeanServer()); + systemMBSF.setMBeanServer(mbsf); chain = c + chain; break; } @@ -240,7 +245,7 @@ public class ForwarderChainTest { private static void expectChain( JMXConnectorServer cs, String chain, MBeanServer end) { System.out.println("...expected chain: " + chain); - MBeanServer curr = cs.getSystemMBeanServer(); + MBeanServer curr = cs.getSystemMBeanServerForwarder().getMBeanServer(); int i = 0; while (i < chain.length()) { char c = chain.charAt(i); diff --git a/jdk/test/javax/management/remote/mandatory/connectorServer/StandardForwardersTest.java b/jdk/test/javax/management/remote/mandatory/connectorServer/StandardForwardersTest.java index d2d5e3771ff..25efde9dd0e 100644 --- a/jdk/test/javax/management/remote/mandatory/connectorServer/StandardForwardersTest.java +++ b/jdk/test/javax/management/remote/mandatory/connectorServer/StandardForwardersTest.java @@ -26,6 +26,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.management.ClientContext; import javax.management.MBeanServer; import javax.management.event.EventClientDelegate; import javax.management.remote.JMXConnectorServer; @@ -62,13 +63,23 @@ public class StandardForwardersTest { public static void main(String[] args) throws Exception { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); + MBeanServerForwarder ctxFwd = ClientContext.newContextForwarder(mbs, null); + Forwarder ctx = new Forwarder( + JMXConnectorServer.CONTEXT_FORWARDER, true, ctxFwd.getClass()); + + MBeanServerForwarder locFwd = + ClientContext.newLocalizeMBeanInfoForwarder(mbs); + Forwarder loc = new Forwarder( + JMXConnectorServer.LOCALIZE_MBEAN_INFO_FORWARDER, false, + locFwd.getClass()); + MBeanServerForwarder ecdFwd = - EventClientDelegate.newForwarder(); + EventClientDelegate.newForwarder(mbs, null); Forwarder ecd = new Forwarder( JMXConnectorServer.EVENT_CLIENT_DELEGATE_FORWARDER, true, ecdFwd.getClass()); - Forwarder[] forwarders = {ecd}; + Forwarder[] forwarders = {ctx, loc, ecd}; // Now go through every combination of forwarders. Each forwarder // may be explicitly enabled, explicitly disabled, or left to its @@ -154,9 +165,11 @@ public class StandardForwardersTest { } MBeanServer stop = cs.getMBeanServer(); List> foundClasses = new ArrayList>(); - for (MBeanServer mbs = cs.getSystemMBeanServer(); mbs != stop; - mbs = ((MBeanServerForwarder) mbs).getMBeanServer()) + for (MBeanServer mbs = cs.getSystemMBeanServerForwarder().getMBeanServer(); + mbs != stop; + mbs = ((MBeanServerForwarder) mbs).getMBeanServer()) { foundClasses.add(mbs.getClass()); + } if (!expectedClasses.equals(foundClasses)) { fail("Incorrect forwarder chain: expected " + expectedClasses + "; found " + foundClasses); @@ -165,9 +178,12 @@ public class StandardForwardersTest { // env is consistent if either (a) localizer is not enabled or (b) // localizer is enabled and context is enabled. - // Neither of those is present in this codebase so env is always consistent. private static boolean isConsistent(Map env) { - return true; + String ctxS = env.get(JMXConnectorServer.CONTEXT_FORWARDER); + boolean ctx = (ctxS == null) ? true : Boolean.parseBoolean(ctxS); + String locS = env.get(JMXConnectorServer.LOCALIZE_MBEAN_INFO_FORWARDER); + boolean loc = (locS == null) ? false : Boolean.parseBoolean(locS); + return !loc || ctx; } private static void fail(String why) { diff --git a/jdk/test/javax/management/remote/mandatory/provider/ProviderTest.java b/jdk/test/javax/management/remote/mandatory/provider/ProviderTest.java index 0c7e906b6a6..90aa130001d 100644 --- a/jdk/test/javax/management/remote/mandatory/provider/ProviderTest.java +++ b/jdk/test/javax/management/remote/mandatory/provider/ProviderTest.java @@ -46,6 +46,8 @@ import javax.management.MBeanServer; /* * Tests jar services provider are called */ +import provider.JMXConnectorProviderImpl; +import provider.JMXConnectorServerProviderImpl; public class ProviderTest { public static void main(String[] args) throws Exception { System.out.println("Starting ProviderTest"); @@ -56,8 +58,14 @@ public class ProviderTest { dotest(url, mbs); - if(!provider.JMXConnectorProviderImpl.called() || - !provider.JMXConnectorServerProviderImpl.called()) { + boolean clientCalled = provider.JMXConnectorProviderImpl.called(); + boolean serverCalled = provider.JMXConnectorServerProviderImpl.called(); + boolean ok = clientCalled && serverCalled; + if (!ok) { + if (!clientCalled) + System.out.println("Client provider not called"); + if (!serverCalled) + System.out.println("Server provider not called"); System.out.println("Test Failed"); System.exit(1); } diff --git a/jdk/test/javax/management/remote/mandatory/subjectDelegation/SimpleStandard.java b/jdk/test/javax/management/remote/mandatory/subjectDelegation/SimpleStandard.java index 1a0e1dfe66d..d0d75988b1e 100644 --- a/jdk/test/javax/management/remote/mandatory/subjectDelegation/SimpleStandard.java +++ b/jdk/test/javax/management/remote/mandatory/subjectDelegation/SimpleStandard.java @@ -75,7 +75,7 @@ public class SimpleStandard * @return the current value of the "State" attribute. */ public String getState() { - checkSubject(); + checkSubject("getState"); return state; } @@ -85,7 +85,7 @@ public class SimpleStandard * @param s the new value of the "State" attribute. */ public void setState(String s) { - checkSubject(); + checkSubject("setState"); state = s; nbChanges++; } @@ -97,7 +97,7 @@ public class SimpleStandard * @return the current value of the "NbChanges" attribute. */ public int getNbChanges() { - checkSubject(); + checkSubject("getNbChanges"); return nbChanges; } @@ -106,7 +106,7 @@ public class SimpleStandard * attributes of the "SimpleStandard" standard MBean. */ public void reset() { - checkSubject(); + checkSubject("reset"); AttributeChangeNotification acn = new AttributeChangeNotification(this, 0, @@ -149,18 +149,18 @@ public class SimpleStandard * Check that the principal contained in the Subject is of * type JMXPrincipal and refers to the principalName identity. */ - private void checkSubject() { + private void checkSubject(String op) { AccessControlContext acc = AccessController.getContext(); Subject subject = Subject.getSubject(acc); Set principals = subject.getPrincipals(); Principal principal = (Principal) principals.iterator().next(); if (!(principal instanceof JMXPrincipal)) - throw new SecurityException("Authenticated subject contains " + + throw new SecurityException(op+": Authenticated subject contains " + "invalid principal type = " + principal.getClass().getName()); String identity = principal.getName(); if (!identity.equals(principalName)) - throw new SecurityException("Authenticated subject contains " + + throw new SecurityException(op+": Authenticated subject contains " + "invalid principal name = " + identity); } From 0cecb67ae74f73121698943f3ddd326369fb1f40 Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Fri, 7 Nov 2008 11:03:32 -0500 Subject: [PATCH 112/267] 6760773: UseCompressedOops is broken with UseParNewGC Sparc code for gen_subtype_check was doing an ld for a compressed oop with the sign bit set so not comparing, leading to a ClassCastException. Reviewed-by: phh, never, acorn, kvn, xlu --- hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp | 2 +- hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp b/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp index 5881dd69be4..f134852e4d6 100644 --- a/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp @@ -906,7 +906,7 @@ void InterpreterMacroAssembler::gen_subtype_check(Register Rsub_klass, // load next super to check if (UseCompressedOops) { - ld( Rtmp2, arrayOopDesc::base_offset_in_bytes(T_OBJECT), Rtmp3); + lduw( Rtmp2, arrayOopDesc::base_offset_in_bytes(T_OBJECT), Rtmp3); // Bump array pointer forward one oop add( Rtmp2, 4, Rtmp2 ); } else { diff --git a/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp b/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp index a16d332ba6b..9b4981dff7a 100644 --- a/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp @@ -956,7 +956,7 @@ class StubGenerator: public StubCodeGenerator { // Load a little early; will load 1 off the end of the array. // Ok for now; revisit if we have other uses of this routine. if (UseCompressedOops) { - __ ld(L1_ary_ptr,0,L2_super);// Will load a little early + __ lduw(L1_ary_ptr,0,L2_super);// Will load a little early } else { __ ld_ptr(L1_ary_ptr,0,L2_super);// Will load a little early } @@ -973,7 +973,7 @@ class StubGenerator: public StubCodeGenerator { #ifdef _LP64 __ subcc(L2_super,L4_ooptmp,Rret); // Check for match; zero in Rret for a hit __ br( Assembler::notEqual, false, Assembler::pt, loop ); - __ delayed()->ld(L1_ary_ptr,0,L2_super);// Will load a little early + __ delayed()->lduw(L1_ary_ptr,0,L2_super);// Will load a little early #else ShouldNotReachHere(); #endif From 7aae40a95fefd53f9bcd82d12d195980dd144530 Mon Sep 17 00:00:00 2001 From: Vladimir Kozlov Date: Fri, 7 Nov 2008 09:29:38 -0800 Subject: [PATCH 113/267] 6462850: generate biased locking code in C2 ideal graph Inline biased locking code in C2 ideal graph during macro nodes expansion Reviewed-by: never --- hotspot/src/cpu/sparc/vm/assembler_sparc.cpp | 32 ++- hotspot/src/cpu/sparc/vm/assembler_sparc.hpp | 10 +- hotspot/src/cpu/sparc/vm/sparc.ad | 81 ++++-- hotspot/src/cpu/x86/vm/assembler_x86.cpp | 4 + hotspot/src/cpu/x86/vm/assembler_x86.hpp | 3 +- hotspot/src/cpu/x86/vm/x86_32.ad | 68 +++-- hotspot/src/cpu/x86/vm/x86_64.ad | 69 +++-- .../src/os_cpu/linux_x86/vm/linux_x86_32.ad | 6 +- .../os_cpu/solaris_x86/vm/solaris_x86_32.ad | 6 +- hotspot/src/share/vm/adlc/formssel.cpp | 2 +- hotspot/src/share/vm/opto/c2_globals.hpp | 3 + hotspot/src/share/vm/opto/callnode.cpp | 1 + hotspot/src/share/vm/opto/callnode.hpp | 4 + hotspot/src/share/vm/opto/classes.hpp | 1 + hotspot/src/share/vm/opto/compile.cpp | 1 + hotspot/src/share/vm/opto/library_call.cpp | 27 +- hotspot/src/share/vm/opto/loopTransform.cpp | 1 + hotspot/src/share/vm/opto/macro.cpp | 263 ++++++++++++++++-- hotspot/src/share/vm/opto/macro.hpp | 2 +- hotspot/src/share/vm/opto/matcher.cpp | 1 + hotspot/src/share/vm/opto/memnode.cpp | 8 + hotspot/src/share/vm/opto/memnode.hpp | 13 + hotspot/src/share/vm/opto/type.hpp | 6 + hotspot/src/share/vm/runtime/arguments.cpp | 6 + hotspot/src/share/vm/utilities/vmError.cpp | 2 +- 25 files changed, 472 insertions(+), 148 deletions(-) diff --git a/hotspot/src/cpu/sparc/vm/assembler_sparc.cpp b/hotspot/src/cpu/sparc/vm/assembler_sparc.cpp index 998f39508e7..07879e32a8b 100644 --- a/hotspot/src/cpu/sparc/vm/assembler_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/assembler_sparc.cpp @@ -2615,7 +2615,8 @@ void MacroAssembler::cas_under_lock(Register top_ptr_reg, Register top_reg, Regi } } -void MacroAssembler::biased_locking_enter(Register obj_reg, Register mark_reg, Register temp_reg, +void MacroAssembler::biased_locking_enter(Register obj_reg, Register mark_reg, + Register temp_reg, Label& done, Label* slow_case, BiasedLockingCounters* counters) { assert(UseBiasedLocking, "why call this otherwise?"); @@ -2691,8 +2692,7 @@ void MacroAssembler::biased_locking_enter(Register obj_reg, Register mark_reg, R markOopDesc::biased_lock_mask_in_place | markOopDesc::age_mask_in_place | markOopDesc::epoch_mask_in_place, mark_reg); or3(G2_thread, mark_reg, temp_reg); - casx_under_lock(mark_addr.base(), mark_reg, temp_reg, - (address)StubRoutines::Sparc::atomic_memory_operation_lock_addr()); + casn(mark_addr.base(), mark_reg, temp_reg); // If the biasing toward our thread failed, this means that // another thread succeeded in biasing it toward itself and we // need to revoke that bias. The revocation will occur in the @@ -2721,8 +2721,7 @@ void MacroAssembler::biased_locking_enter(Register obj_reg, Register mark_reg, R load_klass(obj_reg, temp_reg); ld_ptr(Address(temp_reg, 0, Klass::prototype_header_offset_in_bytes() + klassOopDesc::klass_part_offset_in_bytes()), temp_reg); or3(G2_thread, temp_reg, temp_reg); - casx_under_lock(mark_addr.base(), mark_reg, temp_reg, - (address)StubRoutines::Sparc::atomic_memory_operation_lock_addr()); + casn(mark_addr.base(), mark_reg, temp_reg); // If the biasing toward our thread failed, this means that // another thread succeeded in biasing it toward itself and we // need to revoke that bias. The revocation will occur in the @@ -2752,8 +2751,7 @@ void MacroAssembler::biased_locking_enter(Register obj_reg, Register mark_reg, R // bits in this situation. Should attempt to preserve them. load_klass(obj_reg, temp_reg); ld_ptr(Address(temp_reg, 0, Klass::prototype_header_offset_in_bytes() + klassOopDesc::klass_part_offset_in_bytes()), temp_reg); - casx_under_lock(mark_addr.base(), mark_reg, temp_reg, - (address)StubRoutines::Sparc::atomic_memory_operation_lock_addr()); + casn(mark_addr.base(), mark_reg, temp_reg); // Fall through to the normal CAS-based lock, because no matter what // the result of the above CAS, some thread must have succeeded in // removing the bias bit from the object's header. @@ -2815,8 +2813,10 @@ void MacroAssembler::casn (Register addr_reg, Register cmp_reg, Register set_reg // effect). -void MacroAssembler::compiler_lock_object(Register Roop, Register Rmark, Register Rbox, Register Rscratch, - BiasedLockingCounters* counters) { +void MacroAssembler::compiler_lock_object(Register Roop, Register Rmark, + Register Rbox, Register Rscratch, + BiasedLockingCounters* counters, + bool try_bias) { Address mark_addr(Roop, 0, oopDesc::mark_offset_in_bytes()); verify_oop(Roop); @@ -2838,7 +2838,7 @@ void MacroAssembler::compiler_lock_object(Register Roop, Register Rmark, Registe // Fetch object's markword ld_ptr(mark_addr, Rmark); - if (UseBiasedLocking) { + if (try_bias) { biased_locking_enter(Roop, Rmark, Rscratch, done, NULL, counters); } @@ -2881,7 +2881,7 @@ void MacroAssembler::compiler_lock_object(Register Roop, Register Rmark, Registe ld_ptr (mark_addr, Rmark); // fetch obj->mark // Triage: biased, stack-locked, neutral, inflated - if (UseBiasedLocking) { + if (try_bias) { biased_locking_enter(Roop, Rmark, Rscratch, done, NULL, counters); // Invariant: if control reaches this point in the emitted stream // then Rmark has not been modified. @@ -2945,7 +2945,7 @@ void MacroAssembler::compiler_lock_object(Register Roop, Register Rmark, Registe ld_ptr (mark_addr, Rmark); // fetch obj->mark // Triage: biased, stack-locked, neutral, inflated - if (UseBiasedLocking) { + if (try_bias) { biased_locking_enter(Roop, Rmark, Rscratch, done, NULL, counters); // Invariant: if control reaches this point in the emitted stream // then Rmark has not been modified. @@ -3039,7 +3039,9 @@ void MacroAssembler::compiler_lock_object(Register Roop, Register Rmark, Registe bind (done) ; } -void MacroAssembler::compiler_unlock_object(Register Roop, Register Rmark, Register Rbox, Register Rscratch) { +void MacroAssembler::compiler_unlock_object(Register Roop, Register Rmark, + Register Rbox, Register Rscratch, + bool try_bias) { Address mark_addr(Roop, 0, oopDesc::mark_offset_in_bytes()); Label done ; @@ -3050,7 +3052,7 @@ void MacroAssembler::compiler_unlock_object(Register Roop, Register Rmark, Regis } if (EmitSync & 8) { - if (UseBiasedLocking) { + if (try_bias) { biased_locking_exit(mark_addr, Rscratch, done); } @@ -3077,7 +3079,7 @@ void MacroAssembler::compiler_unlock_object(Register Roop, Register Rmark, Regis // I$ effects. Label LStacked ; - if (UseBiasedLocking) { + if (try_bias) { // TODO: eliminate redundant LDs of obj->mark biased_locking_exit(mark_addr, Rscratch, done); } diff --git a/hotspot/src/cpu/sparc/vm/assembler_sparc.hpp b/hotspot/src/cpu/sparc/vm/assembler_sparc.hpp index 3cea450cc2c..1d735ade174 100644 --- a/hotspot/src/cpu/sparc/vm/assembler_sparc.hpp +++ b/hotspot/src/cpu/sparc/vm/assembler_sparc.hpp @@ -2220,9 +2220,13 @@ class MacroAssembler: public Assembler { // These set the icc condition code to equal if the lock succeeded // and notEqual if it failed and requires a slow case - void compiler_lock_object(Register Roop, Register Rmark, Register Rbox, Register Rscratch, - BiasedLockingCounters* counters = NULL); - void compiler_unlock_object(Register Roop, Register Rmark, Register Rbox, Register Rscratch); + void compiler_lock_object(Register Roop, Register Rmark, Register Rbox, + Register Rscratch, + BiasedLockingCounters* counters = NULL, + bool try_bias = UseBiasedLocking); + void compiler_unlock_object(Register Roop, Register Rmark, Register Rbox, + Register Rscratch, + bool try_bias = UseBiasedLocking); // Biased locking support // Upon entry, lock_reg must point to the lock record on the stack, diff --git a/hotspot/src/cpu/sparc/vm/sparc.ad b/hotspot/src/cpu/sparc/vm/sparc.ad index 145a1564bb3..06af021d1fd 100644 --- a/hotspot/src/cpu/sparc/vm/sparc.ad +++ b/hotspot/src/cpu/sparc/vm/sparc.ad @@ -395,6 +395,7 @@ reg_class long_reg( R_G1H,R_G1, R_G3H,R_G3, R_G4H,R_G4, ); reg_class g1_regL(R_G1H,R_G1); +reg_class g3_regL(R_G3H,R_G3); reg_class o2_regL(R_O2H,R_O2); reg_class o7_regL(R_O7H,R_O7); @@ -2688,7 +2689,7 @@ enc_class Fast_Lock(iRegP oop, iRegP box, o7RegP scratch, iRegP scratch2) %{ assert(Rbox != Rscratch, ""); assert(Rbox != Rmark, ""); - __ compiler_lock_object(Roop, Rmark, Rbox, Rscratch, _counters); + __ compiler_lock_object(Roop, Rmark, Rbox, Rscratch, _counters, UseBiasedLocking && !UseOptoBiasInlining); %} enc_class Fast_Unlock(iRegP oop, iRegP box, o7RegP scratch, iRegP scratch2) %{ @@ -2704,7 +2705,7 @@ enc_class Fast_Unlock(iRegP oop, iRegP box, o7RegP scratch, iRegP scratch2) %{ assert(Rbox != Rscratch, ""); assert(Rbox != Rmark, ""); - __ compiler_unlock_object(Roop, Rmark, Rbox, Rscratch); + __ compiler_unlock_object(Roop, Rmark, Rbox, Rscratch, UseBiasedLocking && !UseOptoBiasInlining); %} enc_class enc_cas( iRegP mem, iRegP old, iRegP new ) %{ @@ -2716,8 +2717,7 @@ enc_class Fast_Unlock(iRegP oop, iRegP box, o7RegP scratch, iRegP scratch2) %{ // casx_under_lock picks 1 of 3 encodings: // For 32-bit pointers you get a 32-bit CAS // For 64-bit pointers you get a 64-bit CASX - __ casx_under_lock(Rmem, Rold, Rnew, // Swap(*Rmem,Rnew) if *Rmem == Rold - (address) StubRoutines::Sparc::atomic_memory_operation_lock_addr()); + __ casn(Rmem, Rold, Rnew); // Swap(*Rmem,Rnew) if *Rmem == Rold __ cmp( Rold, Rnew ); %} @@ -3766,6 +3766,14 @@ operand g1RegL() %{ interface(REG_INTER); %} +operand g3RegL() %{ + constraint(ALLOC_IN_RC(g3_regL)); + match(iRegL); + + format %{ %} + interface(REG_INTER); +%} + // Int Register safe // This is 64bit safe operand iRegIsafe() %{ @@ -6602,32 +6610,23 @@ instruct storePConditional( iRegP heap_top_ptr, iRegP oldval, g3RegP newval, fla ins_pipe( long_memory_op ); %} -instruct storeLConditional_bool(iRegP mem_ptr, iRegL oldval, iRegL newval, iRegI res, o7RegI tmp1, flagsReg ccr ) %{ - match(Set res (StoreLConditional mem_ptr (Binary oldval newval))); - effect( USE mem_ptr, KILL ccr, KILL tmp1); - // Marshal the register pairs into V9 64-bit registers, then do the compare-and-swap - format %{ - "MOV $newval,R_O7\n\t" - "CASXA [$mem_ptr],$oldval,R_O7\t! If $oldval==[$mem_ptr] Then store R_O7 into [$mem_ptr], set R_O7=[$mem_ptr] in any case\n\t" - "CMP $oldval,R_O7\t\t! See if we made progress\n\t" - "MOV 1,$res\n\t" - "MOVne xcc,R_G0,$res" - %} - ins_encode( enc_casx(mem_ptr, oldval, newval), - enc_lflags_ne_to_boolean(res) ); +// Conditional-store of an int value. +instruct storeIConditional( iRegP mem_ptr, iRegI oldval, g3RegI newval, flagsReg icc ) %{ + match(Set icc (StoreIConditional mem_ptr (Binary oldval newval))); + effect( KILL newval ); + format %{ "CASA [$mem_ptr],$oldval,$newval\t! If $oldval==[$mem_ptr] Then store $newval into [$mem_ptr], set $newval=[$mem_ptr] in any case\n\t" + "CMP $oldval,$newval\t\t! See if we made progress" %} + ins_encode( enc_cas(mem_ptr,oldval,newval) ); ins_pipe( long_memory_op ); %} -instruct storeLConditional_flags(iRegP mem_ptr, iRegL oldval, iRegL newval, flagsRegL xcc, o7RegI tmp1, immI0 zero) %{ - match(Set xcc (CmpI (StoreLConditional mem_ptr (Binary oldval newval)) zero)); - effect( USE mem_ptr, KILL tmp1); - // Marshal the register pairs into V9 64-bit registers, then do the compare-and-swap - format %{ - "MOV $newval,R_O7\n\t" - "CASXA [$mem_ptr],$oldval,R_O7\t! If $oldval==[$mem_ptr] Then store R_O7 into [$mem_ptr], set R_O7=[$mem_ptr] in any case\n\t" - "CMP $oldval,R_O7\t\t! See if we made progress" - %} - ins_encode( enc_casx(mem_ptr, oldval, newval)); +// Conditional-store of a long value. +instruct storeLConditional( iRegP mem_ptr, iRegL oldval, g3RegL newval, flagsRegL xcc ) %{ + match(Set xcc (StoreLConditional mem_ptr (Binary oldval newval))); + effect( KILL newval ); + format %{ "CASXA [$mem_ptr],$oldval,$newval\t! If $oldval==[$mem_ptr] Then store $newval into [$mem_ptr], set $newval=[$mem_ptr] in any case\n\t" + "CMP $oldval,$newval\t\t! See if we made progress" %} + ins_encode( enc_cas(mem_ptr,oldval,newval) ); ins_pipe( long_memory_op ); %} @@ -7410,6 +7409,34 @@ instruct orL_reg_imm13(iRegL dst, iRegL src1, immL13 con) %{ ins_pipe(ialu_reg_imm); %} +#ifndef _LP64 + +// Use sp_ptr_RegP to match G2 (TLS register) without spilling. +instruct orI_reg_castP2X(iRegI dst, iRegI src1, sp_ptr_RegP src2) %{ + match(Set dst (OrI src1 (CastP2X src2))); + + size(4); + format %{ "OR $src1,$src2,$dst" %} + opcode(Assembler::or_op3, Assembler::arith_op); + ins_encode( form3_rs1_rs2_rd( src1, src2, dst ) ); + ins_pipe(ialu_reg_reg); +%} + +#else + +instruct orL_reg_castP2X(iRegL dst, iRegL src1, sp_ptr_RegP src2) %{ + match(Set dst (OrL src1 (CastP2X src2))); + + ins_cost(DEFAULT_COST); + size(4); + format %{ "OR $src1,$src2,$dst\t! long" %} + opcode(Assembler::or_op3, Assembler::arith_op); + ins_encode( form3_rs1_rs2_rd( src1, src2, dst ) ); + ins_pipe(ialu_reg_reg); +%} + +#endif + // Xor Instructions // Register Xor instruct xorI_reg_reg(iRegI dst, iRegI src1, iRegI src2) %{ diff --git a/hotspot/src/cpu/x86/vm/assembler_x86.cpp b/hotspot/src/cpu/x86/vm/assembler_x86.cpp index ec208540ad0..edf0d3dbcaf 100644 --- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp +++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp @@ -621,6 +621,10 @@ address Assembler::locate_operand(address inst, WhichOperand which) { debug_only(has_disp32 = true); break; + case 0xF0: // Lock + assert(os::is_MP(), "only on MP"); + goto again_after_prefix; + case 0xF3: // For SSE case 0xF2: // For SSE2 switch (0xFF & *ip++) { diff --git a/hotspot/src/cpu/x86/vm/assembler_x86.hpp b/hotspot/src/cpu/x86/vm/assembler_x86.hpp index c2b64771803..32cb356a1a1 100644 --- a/hotspot/src/cpu/x86/vm/assembler_x86.hpp +++ b/hotspot/src/cpu/x86/vm/assembler_x86.hpp @@ -1780,7 +1780,8 @@ class MacroAssembler: public Assembler { // check info (currently consumed only by C1). If // swap_reg_contains_mark is true then returns -1 as it is assumed // the calling code has already passed any potential faults. - int biased_locking_enter(Register lock_reg, Register obj_reg, Register swap_reg, Register tmp_reg, + int biased_locking_enter(Register lock_reg, Register obj_reg, + Register swap_reg, Register tmp_reg, bool swap_reg_contains_mark, Label& done, Label* slow_case = NULL, BiasedLockingCounters* counters = NULL); diff --git a/hotspot/src/cpu/x86/vm/x86_32.ad b/hotspot/src/cpu/x86/vm/x86_32.ad index 30e5fc979c3..5f6f8724adb 100644 --- a/hotspot/src/cpu/x86/vm/x86_32.ad +++ b/hotspot/src/cpu/x86/vm/x86_32.ad @@ -3313,7 +3313,7 @@ encode %{ // Beware -- there's a subtle invariant that fetch of the markword // at [FETCH], below, will never observe a biased encoding (*101b). // If this invariant is not held we risk exclusion (safety) failure. - if (UseBiasedLocking) { + if (UseBiasedLocking && !UseOptoBiasInlining) { masm.biased_locking_enter(boxReg, objReg, tmpReg, scrReg, false, DONE_LABEL, NULL, _counters); } @@ -3534,7 +3534,7 @@ encode %{ // Critically, the biased locking test must have precedence over // and appear before the (box->dhw == 0) recursive stack-lock test. - if (UseBiasedLocking) { + if (UseBiasedLocking && !UseOptoBiasInlining) { masm.biased_locking_exit(objReg, tmpReg, DONE_LABEL); } @@ -7930,33 +7930,36 @@ instruct storePConditional( memory heap_top_ptr, eAXRegP oldval, eRegP newval, e ins_pipe( pipe_cmpxchg ); %} -// Conditional-store of a long value -// Returns a boolean value (0/1) on success. Implemented with a CMPXCHG8 on Intel. -// mem_ptr can actually be in either ESI or EDI -instruct storeLConditional( eRegI res, eSIRegP mem_ptr, eADXRegL oldval, eBCXRegL newval, eFlagsReg cr ) %{ - match(Set res (StoreLConditional mem_ptr (Binary oldval newval))); - effect(KILL cr); - // EDX:EAX is killed if there is contention, but then it's also unused. - // In the common case of no contention, EDX:EAX holds the new oop address. - format %{ "CMPXCHG8 [$mem_ptr],$newval\t# If EDX:EAX==[$mem_ptr] Then store $newval into [$mem_ptr]\n\t" - "MOV $res,0\n\t" - "JNE,s fail\n\t" - "MOV $res,1\n" - "fail:" %} - ins_encode( enc_cmpxchg8(mem_ptr), - enc_flags_ne_to_boolean(res) ); +// Conditional-store of an int value. +// ZF flag is set on success, reset otherwise. Implemented with a CMPXCHG on Intel. +instruct storeIConditional( memory mem, eAXRegI oldval, eRegI newval, eFlagsReg cr ) %{ + match(Set cr (StoreIConditional mem (Binary oldval newval))); + effect(KILL oldval); + format %{ "CMPXCHG $mem,$newval\t# If EAX==$mem Then store $newval into $mem" %} + ins_encode( lock_prefix, Opcode(0x0F), Opcode(0xB1), RegMem(newval, mem) ); ins_pipe( pipe_cmpxchg ); %} -// Conditional-store of a long value -// ZF flag is set on success, reset otherwise. Implemented with a CMPXCHG8 on Intel. -// mem_ptr can actually be in either ESI or EDI -instruct storeLConditional_flags( eSIRegP mem_ptr, eADXRegL oldval, eBCXRegL newval, eFlagsReg cr, immI0 zero ) %{ - match(Set cr (CmpI (StoreLConditional mem_ptr (Binary oldval newval)) zero)); - // EDX:EAX is killed if there is contention, but then it's also unused. - // In the common case of no contention, EDX:EAX holds the new oop address. - format %{ "CMPXCHG8 [$mem_ptr],$newval\t# If EAX==[$mem_ptr] Then store $newval into [$mem_ptr]\n\t" %} - ins_encode( enc_cmpxchg8(mem_ptr) ); +// Conditional-store of a long value. +// ZF flag is set on success, reset otherwise. Implemented with a CMPXCHG8 on Intel. +instruct storeLConditional( memory mem, eADXRegL oldval, eBCXRegL newval, eFlagsReg cr ) %{ + match(Set cr (StoreLConditional mem (Binary oldval newval))); + effect(KILL oldval); + format %{ "XCHG EBX,ECX\t# correct order for CMPXCHG8 instruction\n\t" + "CMPXCHG8 $mem,ECX:EBX\t# If EDX:EAX==$mem Then store ECX:EBX into $mem\n\t" + "XCHG EBX,ECX" + %} + ins_encode %{ + // Note: we need to swap rbx, and rcx before and after the + // cmpxchg8 instruction because the instruction uses + // rcx as the high order word of the new value to store but + // our register encoding uses rbx. + __ xchgl(as_Register(EBX_enc), as_Register(ECX_enc)); + if( os::is_MP() ) + __ lock(); + __ cmpxchg8(Address::make_raw($mem$$base, $mem$$index, $mem$$scale, $mem$$disp)); + __ xchgl(as_Register(EBX_enc), as_Register(ECX_enc)); + %} ins_pipe( pipe_cmpxchg ); %} @@ -8423,6 +8426,7 @@ instruct shrI_eReg_imm(eRegI dst, immI8 shift, eFlagsReg cr) %{ ins_pipe( ialu_reg ); %} + // Logical Shift Right by 24, followed by Arithmetic Shift Left by 24. // This idiom is used by the compiler for the i2b bytecode. instruct i2b(eRegI dst, xRegI src, immI_24 twentyfour, eFlagsReg cr) %{ @@ -8540,6 +8544,18 @@ instruct orI_eReg(eRegI dst, eRegI src, eFlagsReg cr) %{ ins_pipe( ialu_reg_reg ); %} +instruct orI_eReg_castP2X(eRegI dst, eRegP src, eFlagsReg cr) %{ + match(Set dst (OrI dst (CastP2X src))); + effect(KILL cr); + + size(2); + format %{ "OR $dst,$src" %} + opcode(0x0B); + ins_encode( OpcP, RegReg( dst, src) ); + ins_pipe( ialu_reg_reg ); +%} + + // Or Register with Immediate instruct orI_eReg_imm(eRegI dst, immI src, eFlagsReg cr) %{ match(Set dst (OrI dst src)); diff --git a/hotspot/src/cpu/x86/vm/x86_64.ad b/hotspot/src/cpu/x86/vm/x86_64.ad index 32a7ee8f051..9b5621f3903 100644 --- a/hotspot/src/cpu/x86/vm/x86_64.ad +++ b/hotspot/src/cpu/x86/vm/x86_64.ad @@ -3572,7 +3572,7 @@ encode %{ // at [FETCH], below, will never observe a biased encoding (*101b). // If this invariant is not held we'll suffer exclusion (safety) failure. - if (UseBiasedLocking) { + if (UseBiasedLocking && !UseOptoBiasInlining) { masm.biased_locking_enter(boxReg, objReg, tmpReg, scrReg, true, DONE_LABEL, NULL, _counters); masm.movptr(tmpReg, Address(objReg, 0)) ; // [FETCH] } @@ -3660,7 +3660,7 @@ encode %{ } else { Label DONE_LABEL, Stacked, CheckSucc ; - if (UseBiasedLocking) { + if (UseBiasedLocking && !UseOptoBiasInlining) { masm.biased_locking_exit(objReg, tmpReg, DONE_LABEL); } @@ -7845,7 +7845,7 @@ instruct storePConditional(memory heap_top_ptr, rFlagsReg cr) %{ match(Set cr (StorePConditional heap_top_ptr (Binary oldval newval))); - + format %{ "cmpxchgq $heap_top_ptr, $newval\t# (ptr) " "If rax == $heap_top_ptr then store $newval into $heap_top_ptr" %} opcode(0x0F, 0xB1); @@ -7856,53 +7856,40 @@ instruct storePConditional(memory heap_top_ptr, ins_pipe(pipe_cmpxchg); %} -// Conditional-store of a long value -// Returns a boolean value (0/1) on success. Implemented with a -// CMPXCHG8 on Intel. mem_ptr can actually be in either RSI or RDI - -instruct storeLConditional(rRegI res, - memory mem_ptr, - rax_RegL oldval, rRegL newval, - rFlagsReg cr) +// Conditional-store of an int value. +// ZF flag is set on success, reset otherwise. Implemented with a CMPXCHG. +instruct storeIConditional(memory mem, rax_RegI oldval, rRegI newval, rFlagsReg cr) %{ - match(Set res (StoreLConditional mem_ptr (Binary oldval newval))); - effect(KILL cr); + match(Set cr (StoreIConditional mem (Binary oldval newval))); + effect(KILL oldval); - format %{ "cmpxchgq $mem_ptr, $newval\t# (long) " - "If rax == $mem_ptr then store $newval into $mem_ptr\n\t" - "sete $res\n\t" - "movzbl $res, $res" %} + format %{ "cmpxchgl $mem, $newval\t# If rax == $mem then store $newval into $mem" %} opcode(0x0F, 0xB1); ins_encode(lock_prefix, - REX_reg_mem_wide(newval, mem_ptr), + REX_reg_mem(newval, mem), OpcP, OpcS, - reg_mem(newval, mem_ptr), - REX_breg(res), Opcode(0x0F), Opcode(0x94), reg(res), // sete - REX_reg_breg(res, res), // movzbl - Opcode(0xF), Opcode(0xB6), reg_reg(res, res)); + reg_mem(newval, mem)); ins_pipe(pipe_cmpxchg); %} -// Conditional-store of a long value -// ZF flag is set on success, reset otherwise. Implemented with a -// CMPXCHG8 on Intel. mem_ptr can actually be in either RSI or RDI -instruct storeLConditional_flags(memory mem_ptr, - rax_RegL oldval, rRegL newval, - rFlagsReg cr, - immI0 zero) +// Conditional-store of a long value. +// ZF flag is set on success, reset otherwise. Implemented with a CMPXCHG. +instruct storeLConditional(memory mem, rax_RegL oldval, rRegL newval, rFlagsReg cr) %{ - match(Set cr (CmpI (StoreLConditional mem_ptr (Binary oldval newval)) zero)); + match(Set cr (StoreLConditional mem (Binary oldval newval))); + effect(KILL oldval); - format %{ "cmpxchgq $mem_ptr, $newval\t# (long) " - "If rax == $mem_ptr then store $newval into $mem_ptr" %} + format %{ "cmpxchgq $mem, $newval\t# If rax == $mem then store $newval into $mem" %} opcode(0x0F, 0xB1); ins_encode(lock_prefix, - REX_reg_mem_wide(newval, mem_ptr), + REX_reg_mem_wide(newval, mem), OpcP, OpcS, - reg_mem(newval, mem_ptr)); + reg_mem(newval, mem)); ins_pipe(pipe_cmpxchg); %} + +// XXX No flag versions for CompareAndSwap{P,I,L} because matcher can't match them instruct compareAndSwapP(rRegI res, memory mem_ptr, rax_RegP oldval, rRegP newval, @@ -7926,7 +7913,6 @@ instruct compareAndSwapP(rRegI res, ins_pipe( pipe_cmpxchg ); %} -// XXX No flag versions for CompareAndSwap{P,I,L} because matcher can't match them instruct compareAndSwapL(rRegI res, memory mem_ptr, rax_RegL oldval, rRegL newval, @@ -8876,6 +8862,7 @@ instruct shrL_rReg_imm(rRegL dst, immI8 shift, rFlagsReg cr) ins_pipe(ialu_reg); %} + // Logical Shift Right by 8-bit immediate instruct shrL_mem_imm(memory dst, immI8 shift, rFlagsReg cr) %{ @@ -9585,6 +9572,18 @@ instruct orL_rReg(rRegL dst, rRegL src, rFlagsReg cr) ins_pipe(ialu_reg_reg); %} +// Use any_RegP to match R15 (TLS register) without spilling. +instruct orL_rReg_castP2X(rRegL dst, any_RegP src, rFlagsReg cr) %{ + match(Set dst (OrL dst (CastP2X src))); + effect(KILL cr); + + format %{ "orq $dst, $src\t# long" %} + opcode(0x0B); + ins_encode(REX_reg_reg_wide(dst, src), OpcP, reg_reg(dst, src)); + ins_pipe(ialu_reg_reg); +%} + + // Or Register with Immediate instruct orL_rReg_imm(rRegL dst, immL32 src, rFlagsReg cr) %{ diff --git a/hotspot/src/os_cpu/linux_x86/vm/linux_x86_32.ad b/hotspot/src/os_cpu/linux_x86/vm/linux_x86_32.ad index ec4725a1cbc..ed92526efe4 100644 --- a/hotspot/src/os_cpu/linux_x86/vm/linux_x86_32.ad +++ b/hotspot/src/os_cpu/linux_x86/vm/linux_x86_32.ad @@ -103,16 +103,16 @@ encode %{ // This name is KNOWN by the ADLC and cannot be changed. // The ADLC forces a 'TypeRawPtr::BOTTOM' output type // for this guy. -instruct tlsLoadP(eAXRegP dst, eFlagsReg cr) %{ +instruct tlsLoadP(eRegP dst, eFlagsReg cr) %{ match(Set dst (ThreadLocal)); effect(DEF dst, KILL cr); - format %{ "MOV EAX, Thread::current()" %} + format %{ "MOV $dst, Thread::current()" %} ins_encode( linux_tlsencode(dst) ); ins_pipe( ialu_reg_fat ); %} -instruct TLS(eAXRegP dst) %{ +instruct TLS(eRegP dst) %{ match(Set dst (ThreadLocal)); expand %{ diff --git a/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_32.ad b/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_32.ad index 911a8ad7d13..3f1110606ea 100644 --- a/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_32.ad +++ b/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_32.ad @@ -110,16 +110,16 @@ encode %{ // This name is KNOWN by the ADLC and cannot be changed. // The ADLC forces a 'TypeRawPtr::BOTTOM' output type // for this guy. -instruct tlsLoadP(eAXRegP dst, eFlagsReg cr) %{ +instruct tlsLoadP(eRegP dst, eFlagsReg cr) %{ match(Set dst (ThreadLocal)); effect(DEF dst, KILL cr); - format %{ "MOV EAX, Thread::current()" %} + format %{ "MOV $dst, Thread::current()" %} ins_encode( solaris_tlsencode(dst) ); ins_pipe( ialu_reg_fat ); %} -instruct TLS(eAXRegP dst) %{ +instruct TLS(eRegP dst) %{ match(Set dst (ThreadLocal)); expand %{ diff --git a/hotspot/src/share/vm/adlc/formssel.cpp b/hotspot/src/share/vm/adlc/formssel.cpp index 1146b57aeb4..fb91d83d2f6 100644 --- a/hotspot/src/share/vm/adlc/formssel.cpp +++ b/hotspot/src/share/vm/adlc/formssel.cpp @@ -3324,7 +3324,7 @@ int MatchNode::needs_ideal_memory_edge(FormDict &globals) const { "Load8B" ,"Load4B" ,"Load8C" ,"Load4C" ,"Load2C" ,"Load8S", "Load4S","Load2S", "LoadRange", "LoadKlass", "LoadNKlass", "LoadL_unaligned", "LoadD_unaligned", "LoadPLocked", "LoadLLocked", - "StorePConditional", "StoreLConditional", + "StorePConditional", "StoreIConditional", "StoreLConditional", "CompareAndSwapI", "CompareAndSwapL", "CompareAndSwapP", "CompareAndSwapN", "StoreCM", "ClearArray" diff --git a/hotspot/src/share/vm/opto/c2_globals.hpp b/hotspot/src/share/vm/opto/c2_globals.hpp index ab960fdc8e5..1342091350c 100644 --- a/hotspot/src/share/vm/opto/c2_globals.hpp +++ b/hotspot/src/share/vm/opto/c2_globals.hpp @@ -388,6 +388,9 @@ product(intx, EliminateAllocationArraySizeLimit, 64, \ "Array size (number of elements) limit for scalar replacement") \ \ + product(bool, UseOptoBiasInlining, true, \ + "Generate biased locking code in C2 ideal graph") \ + \ product(intx, ValueSearchLimit, 1000, \ "Recursion limit in PhaseMacroExpand::value_from_mem_phi") \ \ diff --git a/hotspot/src/share/vm/opto/callnode.cpp b/hotspot/src/share/vm/opto/callnode.cpp index 8e8fc24da20..b9e9cbd5587 100644 --- a/hotspot/src/share/vm/opto/callnode.cpp +++ b/hotspot/src/share/vm/opto/callnode.cpp @@ -967,6 +967,7 @@ SafePointScalarObjectNode::SafePointScalarObjectNode(const TypeOopPtr* tp, init_class_id(Class_SafePointScalarObject); } +bool SafePointScalarObjectNode::pinned() const { return true; } uint SafePointScalarObjectNode::ideal_reg() const { return 0; // No matching to machine instruction diff --git a/hotspot/src/share/vm/opto/callnode.hpp b/hotspot/src/share/vm/opto/callnode.hpp index 20192ddf0f6..45b6dd2148b 100644 --- a/hotspot/src/share/vm/opto/callnode.hpp +++ b/hotspot/src/share/vm/opto/callnode.hpp @@ -433,6 +433,10 @@ public: uint n_fields() const { return _n_fields; } DEBUG_ONLY(AllocateNode* alloc() const { return _alloc; }) + // SafePointScalarObject should be always pinned to the control edge + // of the SafePoint node for which it was generated. + virtual bool pinned() const; // { return true; } + virtual uint size_of() const { return sizeof(*this); } // Assumes that "this" is an argument to a safepoint node "s", and that diff --git a/hotspot/src/share/vm/opto/classes.hpp b/hotspot/src/share/vm/opto/classes.hpp index 0371736cf10..14b43120059 100644 --- a/hotspot/src/share/vm/opto/classes.hpp +++ b/hotspot/src/share/vm/opto/classes.hpp @@ -205,6 +205,7 @@ macro(StoreB) macro(StoreC) macro(StoreCM) macro(StorePConditional) +macro(StoreIConditional) macro(StoreLConditional) macro(StoreD) macro(StoreF) diff --git a/hotspot/src/share/vm/opto/compile.cpp b/hotspot/src/share/vm/opto/compile.cpp index df1a293f112..42eae3063d9 100644 --- a/hotspot/src/share/vm/opto/compile.cpp +++ b/hotspot/src/share/vm/opto/compile.cpp @@ -2001,6 +2001,7 @@ static void final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &fpu ) { case Op_StorePConditional: case Op_StoreI: case Op_StoreL: + case Op_StoreIConditional: case Op_StoreLConditional: case Op_CompareAndSwapI: case Op_CompareAndSwapL: diff --git a/hotspot/src/share/vm/opto/library_call.cpp b/hotspot/src/share/vm/opto/library_call.cpp index 52707d038b0..17a5c1f79d1 100644 --- a/hotspot/src/share/vm/opto/library_call.cpp +++ b/hotspot/src/share/vm/opto/library_call.cpp @@ -3485,11 +3485,32 @@ bool LibraryCallKit::inline_native_AtomicLong_attemptUpdate() { const TypePtr *adr_type = _gvn.type(adr)->is_ptr(); int alias_idx = C->get_alias_index(adr_type); - Node *result = _gvn.transform(new (C, 5) StoreLConditionalNode(control(), memory(alias_idx), adr, newVal, oldVal)); - Node *store_proj = _gvn.transform( new (C, 1) SCMemProjNode(result)); + Node *cas = _gvn.transform(new (C, 5) StoreLConditionalNode(control(), memory(alias_idx), adr, newVal, oldVal)); + Node *store_proj = _gvn.transform( new (C, 1) SCMemProjNode(cas)); set_memory(store_proj, alias_idx); + Node *bol = _gvn.transform( new (C, 2) BoolNode( cas, BoolTest::eq ) ); - push(result); + Node *result; + // CMove node is not used to be able fold a possible check code + // after attemptUpdate() call. This code could be transformed + // into CMove node by loop optimizations. + { + RegionNode *r = new (C, 3) RegionNode(3); + result = new (C, 3) PhiNode(r, TypeInt::BOOL); + + Node *iff = create_and_xform_if(control(), bol, PROB_FAIR, COUNT_UNKNOWN); + Node *iftrue = opt_iff(r, iff); + r->init_req(1, iftrue); + result->init_req(1, intcon(1)); + result->init_req(2, intcon(0)); + + set_control(_gvn.transform(r)); + record_for_igvn(r); + + C->set_has_split_ifs(true); // Has chance for split-if optimization + } + + push(_gvn.transform(result)); return true; } diff --git a/hotspot/src/share/vm/opto/loopTransform.cpp b/hotspot/src/share/vm/opto/loopTransform.cpp index f1c15b08344..caa676f6ffd 100644 --- a/hotspot/src/share/vm/opto/loopTransform.cpp +++ b/hotspot/src/share/vm/opto/loopTransform.cpp @@ -1519,6 +1519,7 @@ void IdealLoopTree::adjust_loop_exit_prob( PhaseIdealLoop *phase ) { Node *bol = iff->in(1); if( bol && bol->req() > 1 && bol->in(1) && ((bol->in(1)->Opcode() == Op_StorePConditional ) || + (bol->in(1)->Opcode() == Op_StoreIConditional ) || (bol->in(1)->Opcode() == Op_StoreLConditional ) || (bol->in(1)->Opcode() == Op_CompareAndSwapI ) || (bol->in(1)->Opcode() == Op_CompareAndSwapL ) || diff --git a/hotspot/src/share/vm/opto/macro.cpp b/hotspot/src/share/vm/opto/macro.cpp index 7de433e3aaa..892f5018310 100644 --- a/hotspot/src/share/vm/opto/macro.cpp +++ b/hotspot/src/share/vm/opto/macro.cpp @@ -82,16 +82,31 @@ void PhaseMacroExpand::copy_call_debug_info(CallNode *oldcall, CallNode * newcal } } -Node* PhaseMacroExpand::opt_iff(Node* region, Node* iff) { - IfNode *opt_iff = transform_later(iff)->as_If(); +Node* PhaseMacroExpand::opt_bits_test(Node* ctrl, Node* region, int edge, Node* word, int mask, int bits, bool return_fast_path) { + Node* cmp; + if (mask != 0) { + Node* and_node = transform_later(new (C, 3) AndXNode(word, MakeConX(mask))); + cmp = transform_later(new (C, 3) CmpXNode(and_node, MakeConX(bits))); + } else { + cmp = word; + } + Node* bol = transform_later(new (C, 2) BoolNode(cmp, BoolTest::ne)); + IfNode* iff = new (C, 2) IfNode( ctrl, bol, PROB_MIN, COUNT_UNKNOWN ); + transform_later(iff); - // Fast path taken; set region slot 2 - Node *fast_taken = transform_later( new (C, 1) IfFalseNode(opt_iff) ); - region->init_req(2,fast_taken); // Capture fast-control + // Fast path taken. + Node *fast_taken = transform_later( new (C, 1) IfFalseNode(iff) ); // Fast path not-taken, i.e. slow path - Node *slow_taken = transform_later( new (C, 1) IfTrueNode(opt_iff) ); - return slow_taken; + Node *slow_taken = transform_later( new (C, 1) IfTrueNode(iff) ); + + if (return_fast_path) { + region->init_req(edge, slow_taken); // Capture slow-control + return fast_taken; + } else { + region->init_req(edge, fast_taken); // Capture fast-control + return slow_taken; + } } //--------------------copy_predefined_input_for_runtime_call-------------------- @@ -854,7 +869,7 @@ void PhaseMacroExpand::set_eden_pointers(Node* &eden_top_adr, Node* &eden_end_ad Node* PhaseMacroExpand::make_load(Node* ctl, Node* mem, Node* base, int offset, const Type* value_type, BasicType bt) { Node* adr = basic_plus_adr(base, offset); - const TypePtr* adr_type = TypeRawPtr::BOTTOM; + const TypePtr* adr_type = adr->bottom_type()->is_ptr(); Node* value = LoadNode::make(_igvn, ctl, mem, adr, adr_type, value_type, bt); transform_later(value); return value; @@ -1583,12 +1598,194 @@ void PhaseMacroExpand::expand_lock_node(LockNode *lock) { Node* flock = lock->fastlock_node(); // Make the merge point - Node *region = new (C, 3) RegionNode(3); + Node *region; + Node *mem_phi; + Node *slow_path; - Node *bol = transform_later(new (C, 2) BoolNode(flock,BoolTest::ne)); - Node *iff = new (C, 2) IfNode( ctrl, bol, PROB_MIN, COUNT_UNKNOWN ); - // Optimize test; set region slot 2 - Node *slow_path = opt_iff(region,iff); + if (UseOptoBiasInlining) { + /* + * See the full descrition in MacroAssembler::biased_locking_enter(). + * + * if( (mark_word & biased_lock_mask) == biased_lock_pattern ) { + * // The object is biased. + * proto_node = klass->prototype_header; + * o_node = thread | proto_node; + * x_node = o_node ^ mark_word; + * if( (x_node & ~age_mask) == 0 ) { // Biased to the current thread ? + * // Done. + * } else { + * if( (x_node & biased_lock_mask) != 0 ) { + * // The klass's prototype header is no longer biased. + * cas(&mark_word, mark_word, proto_node) + * goto cas_lock; + * } else { + * // The klass's prototype header is still biased. + * if( (x_node & epoch_mask) != 0 ) { // Expired epoch? + * old = mark_word; + * new = o_node; + * } else { + * // Different thread or anonymous biased. + * old = mark_word & (epoch_mask | age_mask | biased_lock_mask); + * new = thread | old; + * } + * // Try to rebias. + * if( cas(&mark_word, old, new) == 0 ) { + * // Done. + * } else { + * goto slow_path; // Failed. + * } + * } + * } + * } else { + * // The object is not biased. + * cas_lock: + * if( FastLock(obj) == 0 ) { + * // Done. + * } else { + * slow_path: + * OptoRuntime::complete_monitor_locking_Java(obj); + * } + * } + */ + + region = new (C, 5) RegionNode(5); + // create a Phi for the memory state + mem_phi = new (C, 5) PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM); + + Node* fast_lock_region = new (C, 3) RegionNode(3); + Node* fast_lock_mem_phi = new (C, 3) PhiNode( fast_lock_region, Type::MEMORY, TypeRawPtr::BOTTOM); + + // First, check mark word for the biased lock pattern. + Node* mark_node = make_load(ctrl, mem, obj, oopDesc::mark_offset_in_bytes(), TypeX_X, TypeX_X->basic_type()); + + // Get fast path - mark word has the biased lock pattern. + ctrl = opt_bits_test(ctrl, fast_lock_region, 1, mark_node, + markOopDesc::biased_lock_mask_in_place, + markOopDesc::biased_lock_pattern, true); + // fast_lock_region->in(1) is set to slow path. + fast_lock_mem_phi->init_req(1, mem); + + // Now check that the lock is biased to the current thread and has + // the same epoch and bias as Klass::_prototype_header. + + // Special-case a fresh allocation to avoid building nodes: + Node* klass_node = AllocateNode::Ideal_klass(obj, &_igvn); + if (klass_node == NULL) { + Node* k_adr = basic_plus_adr(obj, oopDesc::klass_offset_in_bytes()); + klass_node = transform_later( LoadKlassNode::make(_igvn, mem, k_adr, _igvn.type(k_adr)->is_ptr()) ); + klass_node->init_req(0, ctrl); + } + Node *proto_node = make_load(ctrl, mem, klass_node, Klass::prototype_header_offset_in_bytes() + sizeof(oopDesc), TypeX_X, TypeX_X->basic_type()); + + Node* thread = transform_later(new (C, 1) ThreadLocalNode()); + Node* cast_thread = transform_later(new (C, 2) CastP2XNode(ctrl, thread)); + Node* o_node = transform_later(new (C, 3) OrXNode(cast_thread, proto_node)); + Node* x_node = transform_later(new (C, 3) XorXNode(o_node, mark_node)); + + // Get slow path - mark word does NOT match the value. + Node* not_biased_ctrl = opt_bits_test(ctrl, region, 3, x_node, + (~markOopDesc::age_mask_in_place), 0); + // region->in(3) is set to fast path - the object is biased to the current thread. + mem_phi->init_req(3, mem); + + + // Mark word does NOT match the value (thread | Klass::_prototype_header). + + + // First, check biased pattern. + // Get fast path - _prototype_header has the same biased lock pattern. + ctrl = opt_bits_test(not_biased_ctrl, fast_lock_region, 2, x_node, + markOopDesc::biased_lock_mask_in_place, 0, true); + + not_biased_ctrl = fast_lock_region->in(2); // Slow path + // fast_lock_region->in(2) - the prototype header is no longer biased + // and we have to revoke the bias on this object. + // We are going to try to reset the mark of this object to the prototype + // value and fall through to the CAS-based locking scheme. + Node* adr = basic_plus_adr(obj, oopDesc::mark_offset_in_bytes()); + Node* cas = new (C, 5) StoreXConditionalNode(not_biased_ctrl, mem, adr, + proto_node, mark_node); + transform_later(cas); + Node* proj = transform_later( new (C, 1) SCMemProjNode(cas)); + fast_lock_mem_phi->init_req(2, proj); + + + // Second, check epoch bits. + Node* rebiased_region = new (C, 3) RegionNode(3); + Node* old_phi = new (C, 3) PhiNode( rebiased_region, TypeX_X); + Node* new_phi = new (C, 3) PhiNode( rebiased_region, TypeX_X); + + // Get slow path - mark word does NOT match epoch bits. + Node* epoch_ctrl = opt_bits_test(ctrl, rebiased_region, 1, x_node, + markOopDesc::epoch_mask_in_place, 0); + // The epoch of the current bias is not valid, attempt to rebias the object + // toward the current thread. + rebiased_region->init_req(2, epoch_ctrl); + old_phi->init_req(2, mark_node); + new_phi->init_req(2, o_node); + + // rebiased_region->in(1) is set to fast path. + // The epoch of the current bias is still valid but we know + // nothing about the owner; it might be set or it might be clear. + Node* cmask = MakeConX(markOopDesc::biased_lock_mask_in_place | + markOopDesc::age_mask_in_place | + markOopDesc::epoch_mask_in_place); + Node* old = transform_later(new (C, 3) AndXNode(mark_node, cmask)); + cast_thread = transform_later(new (C, 2) CastP2XNode(ctrl, thread)); + Node* new_mark = transform_later(new (C, 3) OrXNode(cast_thread, old)); + old_phi->init_req(1, old); + new_phi->init_req(1, new_mark); + + transform_later(rebiased_region); + transform_later(old_phi); + transform_later(new_phi); + + // Try to acquire the bias of the object using an atomic operation. + // If this fails we will go in to the runtime to revoke the object's bias. + cas = new (C, 5) StoreXConditionalNode(rebiased_region, mem, adr, + new_phi, old_phi); + transform_later(cas); + proj = transform_later( new (C, 1) SCMemProjNode(cas)); + + // Get slow path - Failed to CAS. + not_biased_ctrl = opt_bits_test(rebiased_region, region, 4, cas, 0, 0); + mem_phi->init_req(4, proj); + // region->in(4) is set to fast path - the object is rebiased to the current thread. + + // Failed to CAS. + slow_path = new (C, 3) RegionNode(3); + Node *slow_mem = new (C, 3) PhiNode( slow_path, Type::MEMORY, TypeRawPtr::BOTTOM); + + slow_path->init_req(1, not_biased_ctrl); // Capture slow-control + slow_mem->init_req(1, proj); + + // Call CAS-based locking scheme (FastLock node). + + transform_later(fast_lock_region); + transform_later(fast_lock_mem_phi); + + // Get slow path - FastLock failed to lock the object. + ctrl = opt_bits_test(fast_lock_region, region, 2, flock, 0, 0); + mem_phi->init_req(2, fast_lock_mem_phi); + // region->in(2) is set to fast path - the object is locked to the current thread. + + slow_path->init_req(2, ctrl); // Capture slow-control + slow_mem->init_req(2, fast_lock_mem_phi); + + transform_later(slow_path); + transform_later(slow_mem); + // Reset lock's memory edge. + lock->set_req(TypeFunc::Memory, slow_mem); + + } else { + region = new (C, 3) RegionNode(3); + // create a Phi for the memory state + mem_phi = new (C, 3) PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM); + + // Optimize test; set region slot 2 + slow_path = opt_bits_test(ctrl, region, 2, flock, 0, 0); + mem_phi->init_req(2, mem); + } // Make slow path call CallNode *call = make_slow_call( (CallNode *) lock, OptoRuntime::complete_monitor_enter_Type(), OptoRuntime::complete_monitor_locking_Java(), NULL, slow_path, obj, box ); @@ -1614,16 +1811,11 @@ void PhaseMacroExpand::expand_lock_node(LockNode *lock) { transform_later(region); _igvn.subsume_node(_fallthroughproj, region); - // create a Phi for the memory state - Node *mem_phi = new (C, 3) PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM); - Node *memproj = transform_later( new (C, 1) ProjNode(call, TypeFunc::Memory) ); + Node *memproj = transform_later( new(C, 1) ProjNode(call, TypeFunc::Memory) ); mem_phi->init_req(1, memproj ); - mem_phi->init_req(2, mem); transform_later(mem_phi); - _igvn.hash_delete(_memproj_fallthrough); + _igvn.hash_delete(_memproj_fallthrough); _igvn.subsume_node(_memproj_fallthrough, mem_phi); - - } //------------------------------expand_unlock_node---------------------- @@ -1637,14 +1829,31 @@ void PhaseMacroExpand::expand_unlock_node(UnlockNode *unlock) { // No need for a null check on unlock // Make the merge point - RegionNode *region = new (C, 3) RegionNode(3); + Node *region; + Node *mem_phi; + + if (UseOptoBiasInlining) { + // Check for biased locking unlock case, which is a no-op. + // See the full descrition in MacroAssembler::biased_locking_exit(). + region = new (C, 4) RegionNode(4); + // create a Phi for the memory state + mem_phi = new (C, 4) PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM); + mem_phi->init_req(3, mem); + + Node* mark_node = make_load(ctrl, mem, obj, oopDesc::mark_offset_in_bytes(), TypeX_X, TypeX_X->basic_type()); + ctrl = opt_bits_test(ctrl, region, 3, mark_node, + markOopDesc::biased_lock_mask_in_place, + markOopDesc::biased_lock_pattern); + } else { + region = new (C, 3) RegionNode(3); + // create a Phi for the memory state + mem_phi = new (C, 3) PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM); + } FastUnlockNode *funlock = new (C, 3) FastUnlockNode( ctrl, obj, box ); funlock = transform_later( funlock )->as_FastUnlock(); - Node *bol = transform_later(new (C, 2) BoolNode(funlock,BoolTest::ne)); - Node *iff = new (C, 2) IfNode( ctrl, bol, PROB_MIN, COUNT_UNKNOWN ); // Optimize test; set region slot 2 - Node *slow_path = opt_iff(region,iff); + Node *slow_path = opt_bits_test(ctrl, region, 2, funlock, 0, 0); CallNode *call = make_slow_call( (CallNode *) unlock, OptoRuntime::complete_monitor_exit_Type(), CAST_FROM_FN_PTR(address, SharedRuntime::complete_monitor_unlocking_C), "complete_monitor_unlocking_C", slow_path, obj, box ); @@ -1666,16 +1875,12 @@ void PhaseMacroExpand::expand_unlock_node(UnlockNode *unlock) { transform_later(region); _igvn.subsume_node(_fallthroughproj, region); - // create a Phi for the memory state - Node *mem_phi = new (C, 3) PhiNode( region, Type::MEMORY, TypeRawPtr::BOTTOM); Node *memproj = transform_later( new(C, 1) ProjNode(call, TypeFunc::Memory) ); mem_phi->init_req(1, memproj ); mem_phi->init_req(2, mem); transform_later(mem_phi); - _igvn.hash_delete(_memproj_fallthrough); + _igvn.hash_delete(_memproj_fallthrough); _igvn.subsume_node(_memproj_fallthrough, mem_phi); - - } //------------------------------expand_macro_nodes---------------------- diff --git a/hotspot/src/share/vm/opto/macro.hpp b/hotspot/src/share/vm/opto/macro.hpp index 89ed2bd2f47..d5c28a461bb 100644 --- a/hotspot/src/share/vm/opto/macro.hpp +++ b/hotspot/src/share/vm/opto/macro.hpp @@ -93,7 +93,7 @@ private: int replace_input(Node *use, Node *oldref, Node *newref); void copy_call_debug_info(CallNode *oldcall, CallNode * newcall); - Node* opt_iff(Node* region, Node* iff); + Node* opt_bits_test(Node* ctrl, Node* region, int edge, Node* word, int mask, int bits, bool return_fast_path = false); void copy_predefined_input_for_runtime_call(Node * ctrl, CallNode* oldcall, CallNode* call); CallNode* make_slow_call(CallNode *oldcall, const TypeFunc* slow_call_type, address slow_call, const char* leaf_name, Node* slow_path, Node* parm0, Node* parm1); diff --git a/hotspot/src/share/vm/opto/matcher.cpp b/hotspot/src/share/vm/opto/matcher.cpp index 1fc7915b9d6..582cf2740b9 100644 --- a/hotspot/src/share/vm/opto/matcher.cpp +++ b/hotspot/src/share/vm/opto/matcher.cpp @@ -1951,6 +1951,7 @@ void Matcher::find_shared( Node *n ) { // Now hack a few special opcodes switch( n->Opcode() ) { // Handle some opcodes special case Op_StorePConditional: + case Op_StoreIConditional: case Op_StoreLConditional: case Op_CompareAndSwapI: case Op_CompareAndSwapL: diff --git a/hotspot/src/share/vm/opto/memnode.cpp b/hotspot/src/share/vm/opto/memnode.cpp index ea7e062aef9..4cfc0d233f3 100644 --- a/hotspot/src/share/vm/opto/memnode.cpp +++ b/hotspot/src/share/vm/opto/memnode.cpp @@ -227,6 +227,14 @@ Node *MemNode::Ideal_common(PhaseGVN *phase, bool can_reshape) { const Type *t_adr = phase->type( address ); if( t_adr == Type::TOP ) return NodeSentinel; // caller will return NULL + PhaseIterGVN *igvn = phase->is_IterGVN(); + if( can_reshape && igvn != NULL && igvn->_worklist.member(address) ) { + // The address's base and type may change when the address is processed. + // Delay this mem node transformation until the address is processed. + phase->is_IterGVN()->_worklist.push(this); + return NodeSentinel; // caller will return NULL + } + // Avoid independent memory operations Node* old_mem = mem; diff --git a/hotspot/src/share/vm/opto/memnode.hpp b/hotspot/src/share/vm/opto/memnode.hpp index 2b40a676c45..e1a84febc44 100644 --- a/hotspot/src/share/vm/opto/memnode.hpp +++ b/hotspot/src/share/vm/opto/memnode.hpp @@ -632,6 +632,17 @@ public: virtual uint ideal_reg() const { return Op_RegFlags; } }; +//------------------------------StoreIConditionalNode--------------------------- +// Conditionally store int to memory, if no change since prior +// load-locked. Sets flags for success or failure of the store. +class StoreIConditionalNode : public LoadStoreNode { +public: + StoreIConditionalNode( Node *c, Node *mem, Node *adr, Node *val, Node *ii ) : LoadStoreNode(c, mem, adr, val, ii) { } + virtual int Opcode() const; + // Produces flags + virtual uint ideal_reg() const { return Op_RegFlags; } +}; + //------------------------------StoreLConditionalNode--------------------------- // Conditionally store long to memory, if no change since prior // load-locked. Sets flags for success or failure of the store. @@ -639,6 +650,8 @@ class StoreLConditionalNode : public LoadStoreNode { public: StoreLConditionalNode( Node *c, Node *mem, Node *adr, Node *val, Node *ll ) : LoadStoreNode(c, mem, adr, val, ll) { } virtual int Opcode() const; + // Produces flags + virtual uint ideal_reg() const { return Op_RegFlags; } }; diff --git a/hotspot/src/share/vm/opto/type.hpp b/hotspot/src/share/vm/opto/type.hpp index 69bc06a7384..3d3f3ddd883 100644 --- a/hotspot/src/share/vm/opto/type.hpp +++ b/hotspot/src/share/vm/opto/type.hpp @@ -1183,6 +1183,9 @@ inline bool Type::is_floatingpoint() const { #define RShiftXNode RShiftLNode // For card marks and hashcodes #define URShiftXNode URShiftLNode +// UseOptoBiasInlining +#define XorXNode XorLNode +#define StoreXConditionalNode StoreLConditionalNode // Opcodes #define Op_LShiftX Op_LShiftL #define Op_AndX Op_AndL @@ -1222,6 +1225,9 @@ inline bool Type::is_floatingpoint() const { #define RShiftXNode RShiftINode // For card marks and hashcodes #define URShiftXNode URShiftINode +// UseOptoBiasInlining +#define XorXNode XorINode +#define StoreXConditionalNode StoreIConditionalNode // Opcodes #define Op_LShiftX Op_LShiftI #define Op_AndX Op_AndI diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp index f46aa9c2fb5..fa2ba23383b 100644 --- a/hotspot/src/share/vm/runtime/arguments.cpp +++ b/hotspot/src/share/vm/runtime/arguments.cpp @@ -2628,6 +2628,12 @@ jint Arguments::parse(const JavaVMInitArgs* args) { FLAG_SET_DEFAULT(UseBiasedLocking, false); #endif /* CC_INTERP */ +#ifdef COMPILER2 + if (!UseBiasedLocking || EmitSync != 0) { + UseOptoBiasInlining = false; + } +#endif + if (PrintCommandLineFlags) { CommandLineFlags::printSetFlags(); } diff --git a/hotspot/src/share/vm/utilities/vmError.cpp b/hotspot/src/share/vm/utilities/vmError.cpp index 71ab720f028..a9d7a72f1cd 100644 --- a/hotspot/src/share/vm/utilities/vmError.cpp +++ b/hotspot/src/share/vm/utilities/vmError.cpp @@ -263,7 +263,7 @@ void VMError::report(outputStream* st) { st->print("# java.lang.OutOfMemoryError: "); if (_size) { st->print("requested "); - sprintf(buf,"%d",_size); + sprintf(buf,SIZE_FORMAT,_size); st->print(buf); st->print(" bytes"); if (_message != NULL) { From bbac59f2184ef5477a2ac0b75229da546ca13c95 Mon Sep 17 00:00:00 2001 From: Eamonn McManus Date: Fri, 7 Nov 2008 19:19:08 +0100 Subject: [PATCH 114/267] 6336968: Methods to convert AttributeList to/from Map 6750008: Add JMX.getSpecificationVersion(MBeanServerConnection) and document interop 6750472: Add a way to convert a CompositeData into a Map 6752563: Allow CompositeDataSupport to have zero items Small JMX RFEs Reviewed-by: dfuchs --- .../javax/management/AttributeList.java | 206 +++++++----- .../share/classes/javax/management/JMX.java | 76 +++++ .../management/MBeanServerConnection.java | 96 +++++- .../management/MBeanServerNotification.java | 27 ++ .../management/QueryNotificationFilter.java | 6 +- .../openmbean/CompositeDataSupport.java | 314 ++++++++++-------- .../classes/javax/management/package.html | 226 +++++++++---- .../MBeanServer/AttributeListMapTest.java | 115 +++++++ .../AttributeListTypeSafeTest.java | 109 ++++++ .../openmbean/CompositeDataToMapTest.java | 116 +++++++ .../mandatory/version/JMXSpecVersionTest.java | 308 +++++++++++++++++ 11 files changed, 1302 insertions(+), 297 deletions(-) create mode 100644 jdk/test/javax/management/MBeanServer/AttributeListMapTest.java create mode 100644 jdk/test/javax/management/MBeanServer/AttributeListTypeSafeTest.java create mode 100644 jdk/test/javax/management/openmbean/CompositeDataToMapTest.java create mode 100644 jdk/test/javax/management/remote/mandatory/version/JMXSpecVersionTest.java diff --git a/jdk/src/share/classes/javax/management/AttributeList.java b/jdk/src/share/classes/javax/management/AttributeList.java index 1ce3004a337..a629d57ccd4 100644 --- a/jdk/src/share/classes/javax/management/AttributeList.java +++ b/jdk/src/share/classes/javax/management/AttributeList.java @@ -1,5 +1,5 @@ /* - * Copyright 1999-2005 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1999-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 @@ -27,17 +27,23 @@ package javax.management; import java.util.ArrayList; import java.util.Collection; +import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; /** - * Represents a list of values for attributes of an MBean. The methods - * used for the insertion of {@link javax.management.Attribute - * Attribute} objects in the AttributeList overrides the - * corresponding methods in the superclass - * ArrayList. This is needed in order to insure that the - * objects contained in the AttributeList are only - * Attribute objects. This avoids getting an exception - * when retrieving elements from the AttributeList. + *

    Represents a list of values for attributes of an MBean. See the + * {@link MBeanServerConnection#getAttributes getAttributes} and + * {@link MBeanServerConnection#setAttributes setAttributes} methods of + * {@link MBeanServer} and {@link MBeanServerConnection}.

    + * + *

    For compatibility reasons, it is possible, though + * highly discouraged, to add objects to an {@code AttributeList} that are + * not instances of {@code Attribute}. However, an {@code AttributeList} + * can be made type-safe, which means that an attempt to add + * an object that is not an {@code Attribute} will produce an {@code + * IllegalArgumentException}. An {@code AttributeList} becomes type-safe + * when the method {@link #asList()} is called on it.

    * * @since 1.5 */ @@ -58,8 +64,8 @@ import java.util.List; */ public class AttributeList extends ArrayList { - private transient boolean typeSafe; - private transient boolean tainted; + private transient volatile boolean typeSafe; + private transient volatile boolean tainted; /* Serial version */ private static final long serialVersionUID = -4077085769279709076L; @@ -124,13 +130,63 @@ public class AttributeList extends ArrayList { // Check for non-Attribute objects // - checkTypeSafe(list); + adding(list); // Build the List // super.addAll(list); } + /** + *

    Constructs an {@code AttributeList} containing the elements of + * the {@code Map} specified, in the order in which they appear in the + * {@code Map}'s {@link Map#entrySet entrySet}. For each {@code + * key} and {@code value} in the {@code Map}, the constructed + * {@code AttributeList} will contain {@link Attribute#Attribute + * Attribute(key, value)}.

    + * + * @param map the {@code Map} defining the elements of the new + * {@code AttributeList}. + */ + public AttributeList(Map map) { + for (Map.Entry entry : map.entrySet()) + add(new Attribute(entry.getKey(), entry.getValue())); + typeSafe = true; + } + + /** + *

    Return a {@code Map} that is a snapshot of the values in this + * {@code AttributeList}. Each key in the {@code Map} is the {@linkplain + * Attribute#getName() name} of an {@code Attribute} in the list, and each + * value is the corresponding {@linkplain Attribute#getValue() value} of + * that {@code Attribute}. The {@code AttributeList} and the {@code Map} + * are unrelated after the call, that is, changes to one do not affect the + * other.

    + * + *

    If the {@code AttributeList} contains more than one {@code Attribute} + * with the same name, then the {@code Map} will contain an entry + * for that name where the value is that of the last of those {@code + * Attribute}s.

    + * + * @return the new {@code Map}. + * + * @throws IllegalArgumentException if this {@code AttributeList} contains + * an element that is not an {@code Attribute}. + */ + public Map toMap() { + Map map = new LinkedHashMap(); + + // We can't call adding(this) because we're not necessarily typeSafe + if (tainted) + throw new IllegalArgumentException("AttributeList contains non-Attribute"); + + for (Object x : this) { + Attribute a = (Attribute) x; + map.put(a.getName(), a.getValue()); + } + return map; + } + /** * Return a view of this list as a {@code List}. * Changes to the returned value are reflected by changes @@ -154,11 +210,9 @@ public class AttributeList extends ArrayList { */ @SuppressWarnings("unchecked") public List asList() { - if (!typeSafe) { - if (tainted) - checkTypeSafe(this); - typeSafe = true; - } + typeSafe = true; + if (tainted) + adding((Collection) this); // will throw IllegalArgumentException return (List) (List) this; } @@ -175,7 +229,7 @@ public class AttributeList extends ArrayList { * Inserts the attribute specified as an element at the position specified. * Elements with an index greater than or equal to the current position are * shifted up. If the index is out of range (index < 0 || index > - * size() a RuntimeOperationsException should be raised, wrapping the + * size()) a RuntimeOperationsException should be raised, wrapping the * java.lang.IndexOutOfBoundsException thrown. * * @param object The Attribute object to be inserted. @@ -245,8 +299,7 @@ public class AttributeList extends ArrayList { public boolean addAll(int index, AttributeList list) { try { return super.addAll(index, list); - } - catch (IndexOutOfBoundsException e) { + } catch (IndexOutOfBoundsException e) { throw new RuntimeOperationsException(e, "The specified index is out of range"); } @@ -258,96 +311,77 @@ public class AttributeList extends ArrayList { * been called on this instance. */ + /** + * {@inheritDoc} + * @throws IllegalArgumentException if this {@code AttributeList} is + * type-safe and {@code element} is not an + * {@code Attribute}. + */ @Override - public boolean add(Object o) { - if (!tainted) - tainted = isTainted(o); - if (typeSafe) - checkTypeSafe(o); - return super.add(o); + public boolean add(Object element) { + adding(element); + return super.add(element); } + /** + * {@inheritDoc} + * @throws IllegalArgumentException if this {@code AttributeList} is + * type-safe and {@code element} is not an + * {@code Attribute}. + */ @Override public void add(int index, Object element) { - if (!tainted) - tainted = isTainted(element); - if (typeSafe) - checkTypeSafe(element); + adding(element); super.add(index, element); } + /** + * {@inheritDoc} + * @throws IllegalArgumentException if this {@code AttributeList} is + * type-safe and {@code c} contains an + * element that is not an {@code Attribute}. + */ @Override public boolean addAll(Collection c) { - if (!tainted) - tainted = isTainted(c); - if (typeSafe) - checkTypeSafe(c); + adding(c); return super.addAll(c); } + /** + * {@inheritDoc} + * @throws IllegalArgumentException if this {@code AttributeList} is + * type-safe and {@code c} contains an + * element that is not an {@code Attribute}. + */ @Override public boolean addAll(int index, Collection c) { - if (!tainted) - tainted = isTainted(c); - if (typeSafe) - checkTypeSafe(c); + adding(c); return super.addAll(index, c); } + /** + * {@inheritDoc} + * @throws IllegalArgumentException if this {@code AttributeList} is + * type-safe and {@code element} is not an + * {@code Attribute}. + */ @Override public Object set(int index, Object element) { - if (!tainted) - tainted = isTainted(element); - if (typeSafe) - checkTypeSafe(element); + adding(element); return super.set(index, element); } - /** - * IllegalArgumentException if o is a non-Attribute object. - */ - private static void checkTypeSafe(Object o) { - try { - o = (Attribute) o; - } catch (ClassCastException e) { - throw new IllegalArgumentException(e); - } + private void adding(Object x) { + if (x == null || x instanceof Attribute) + return; + if (typeSafe) + throw new IllegalArgumentException("Not an Attribute: " + x); + else + tainted = true; } - /** - * IllegalArgumentException if c contains any non-Attribute objects. - */ - private static void checkTypeSafe(Collection c) { - try { - Attribute a; - for (Object o : c) - a = (Attribute) o; - } catch (ClassCastException e) { - throw new IllegalArgumentException(e); - } - } - - /** - * Returns true if o is a non-Attribute object. - */ - private static boolean isTainted(Object o) { - try { - checkTypeSafe(o); - } catch (IllegalArgumentException e) { - return true; - } - return false; - } - - /** - * Returns true if c contains any non-Attribute objects. - */ - private static boolean isTainted(Collection c) { - try { - checkTypeSafe(c); - } catch (IllegalArgumentException e) { - return true; - } - return false; + private void adding(Collection c) { + for (Object x : c) + adding(x); } } diff --git a/jdk/src/share/classes/javax/management/JMX.java b/jdk/src/share/classes/javax/management/JMX.java index 90770d48110..60b9605b315 100644 --- a/jdk/src/share/classes/javax/management/JMX.java +++ b/jdk/src/share/classes/javax/management/JMX.java @@ -830,4 +830,80 @@ public class JMX { ((DynamicWrapperMBean) mbean).getWrappedObject() : mbean; return (MBeanInjector.injectsSendNotification(resource)); } + + /** + *

    Return the version of the JMX specification that a (possibly remote) + * MBean Server is using. The JMX specification described in this + * documentation is version 2.0. The earlier versions that might be + * reported by this method are 1.0, 1.1, 1.2, and 1.4. (There is no 1.3.) + * All of these versions and all future versions can be compared using + * {@link String#compareTo(String)}. So, for example, to tell if + * {@code mbsc} is running at least version 2.0 you can write:

    + * + *
    +     * String version = JMX.getSpecificationVersion(mbsc, null);
    +     * boolean atLeast2dot0 = (version.compareTo("2.0") >= 0);
    +     * 
    + * + *

    A remote MBean Server might be running an earlier version of the + * JMX API, and in that case certain + * features might not be available in it.

    + * + *

    The version of the MBean Server {@code mbsc} is not necessarily + * the version of all namespaces within that MBean Server, for example + * if some of them use {@link javax.management.namespace.JMXRemoteNamespace + * JMXRemoteNamespace}. To determine the version of the namespace + * that a particular MBean is in, give its name as the {@code mbeanName} + * parameter.

    + * + * @param mbsc a connection to an MBean Server. + * + * @param mbeanName the name of an MBean within that MBean Server, or null. + * If non-null, the namespace of this name, as determined by + * {@link JMXNamespaces#getContainingNamespace + * JMXNamespaces.getContainingNamespace}, is the one whose specification + * version will be returned. + * + * @return the JMX specification version reported by that MBean Server. + * + * @throws IllegalArgumentException if {@code mbsc} is null, or if + * {@code mbeanName} includes a wildcard character ({@code *} or {@code ?}) + * in its namespace. + * + * @throws IOException if the version cannot be obtained, either because + * there is a communication problem or because the remote MBean Server + * does not have the appropriate {@linkplain + * MBeanServerDelegateMBean#getSpecificationVersion() attribute}. + * + * @see Interoperability between + * versions of the JMX specification + * @see MBeanServerDelegateMBean#getSpecificationVersion + */ + public static String getSpecificationVersion( + MBeanServerConnection mbsc, ObjectName mbeanName) + throws IOException { + if (mbsc == null) + throw new IllegalArgumentException("Null MBeanServerConnection"); + + String namespace; + if (mbeanName == null) + namespace = ""; + else + namespace = JMXNamespaces.getContainingNamespace(mbeanName); + if (namespace.contains("*") || namespace.contains("?")) { + throw new IllegalArgumentException( + "ObjectName contains namespace wildcard: " + mbeanName); + } + + try { + if (namespace.length() > 0) + mbsc = JMXNamespaces.narrowToNamespace(mbsc, namespace); + return (String) mbsc.getAttribute( + MBeanServerDelegate.DELEGATE_NAME, "SpecificationVersion"); + } catch (IOException e) { + throw e; + } catch (Exception e) { + throw new IOException(e); + } + } } diff --git a/jdk/src/share/classes/javax/management/MBeanServerConnection.java b/jdk/src/share/classes/javax/management/MBeanServerConnection.java index 16ce58bb883..fadebc10730 100644 --- a/jdk/src/share/classes/javax/management/MBeanServerConnection.java +++ b/jdk/src/share/classes/javax/management/MBeanServerConnection.java @@ -532,8 +532,30 @@ public interface MBeanServerConnection extends NotificationManager { /** - * Enables the values of several attributes of a named MBean. The MBean - * is identified by its object name. + *

    Retrieves the values of several attributes of a named MBean. The MBean + * is identified by its object name.

    + * + *

    If one or more attributes cannot be retrieved for some reason, they + * will be omitted from the returned {@code AttributeList}. The caller + * should check that the list is the same size as the {@code attributes} + * array. To discover what problem prevented a given attribute from being + * retrieved, call {@link #getAttribute getAttribute} for that attribute.

    + * + *

    Here is an example of calling this method and checking that it + * succeeded in retrieving all the requested attributes:

    + * + *
    +     * String[] attrNames = ...;
    +     * AttributeList list = mbeanServerConnection.getAttributes(objectName, attrNames);
    +     * if (list.size() == attrNames.length)
    +     *     System.out.println("All attributes were retrieved successfully");
    +     * else {
    +     *     {@code List} missing = new {@code ArrayList}({@link java.util.Arrays#asList Arrays.asList}(attrNames));
    +     *     missing.removeAll(list.toMap().keySet());
    +     *     System.out.println("Did not retrieve: " + missing);
    +     * }
    +     * 
    * * @param name The object name of the MBean from which the * attributes are retrieved. @@ -557,6 +579,7 @@ public interface MBeanServerConnection extends NotificationManager { throws InstanceNotFoundException, ReflectionException, IOException; + /** * Sets the value of a specific attribute of a named MBean. The MBean * is identified by its object name. @@ -592,10 +615,36 @@ public interface MBeanServerConnection extends NotificationManager { ReflectionException, IOException; - /** - * Sets the values of several attributes of a named MBean. The MBean is - * identified by its object name. + *

    Sets the values of several attributes of a named MBean. The MBean is + * identified by its object name.

    + * + *

    If one or more attributes cannot be set for some reason, they will be + * omitted from the returned {@code AttributeList}. The caller should check + * that the input {@code AttributeList} is the same size as the output one. + * To discover what problem prevented a given attribute from being retrieved, + * it will usually be possible to call {@link #setAttribute setAttribute} + * for that attribute, although this is not guaranteed to work. (For + * example, the values of two attributes may have been rejected because + * they were inconsistent with each other. Setting one of them alone might + * be allowed.)

    + * + *

    Here is an example of calling this method and checking that it + * succeeded in setting all the requested attributes:

    + * + *
    +     * AttributeList inputAttrs = ...;
    +     * AttributeList outputAttrs = mbeanServerConnection.setAttributes(objectName, inputAttrs);
    +     * if (inputAttrs.size() == outputAttrs.size())
    +     *     System.out.println("All attributes were set successfully");
    +     * else {
    +     *     {@code List} missing = new {@code ArrayList}(inputAttrs.toMap().keySet());
    +     *     missing.removeAll(outputAttrs.toMap().keySet());
    +     *     System.out.println("Did not set: " + missing);
    +     * }
    +     * 
    * * @param name The object name of the MBean within which the * attributes are to be set. @@ -622,7 +671,39 @@ public interface MBeanServerConnection extends NotificationManager { throws InstanceNotFoundException, ReflectionException, IOException; /** - * Invokes an operation on an MBean. + *

    Invokes an operation on an MBean.

    + * + *

    Because of the need for a {@code signature} to differentiate + * possibly-overloaded operations, it is much simpler to invoke operations + * through an {@linkplain JMX#newMBeanProxy(MBeanServerConnection, ObjectName, + * Class) MBean proxy} where possible. For example, suppose you have a + * Standard MBean interface like this:

    + * + *
    +     * public interface FooMBean {
    +     *     public int countMatches(String[] patterns, boolean ignoreCase);
    +     * }
    +     * 
    + * + *

    The {@code countMatches} operation can be invoked as follows:

    + * + *
    +     * String[] myPatterns = ...;
    +     * int count = (Integer) mbeanServerConnection.invoke(
    +     *         objectName,
    +     *         "countMatches",
    +     *         new Object[] {myPatterns, true},
    +     *         new String[] {String[].class.getName(), boolean.class.getName()});
    +     * 
    + * + *

    Alternatively, it can be invoked through a proxy as follows:

    + * + *
    +     * String[] myPatterns = ...;
    +     * FooMBean fooProxy = JMX.newMBeanProxy(
    +     *         mbeanServerConnection, objectName, FooMBean.class);
    +     * int count = fooProxy.countMatches(myPatterns, true);
    +     * 
    * * @param name The object name of the MBean on which the method is * to be invoked. @@ -630,7 +711,8 @@ public interface MBeanServerConnection extends NotificationManager { * @param params An array containing the parameters to be set when * the operation is invoked * @param signature An array containing the signature of the - * operation. The class objects will be loaded using the same + * operation, an array of class names in the format returned by + * {@link Class#getName()}. The class objects will be loaded using the same * class loader as the one used for loading the MBean on which the * operation was invoked. * diff --git a/jdk/src/share/classes/javax/management/MBeanServerNotification.java b/jdk/src/share/classes/javax/management/MBeanServerNotification.java index 55e71cec331..d19c73a555a 100644 --- a/jdk/src/share/classes/javax/management/MBeanServerNotification.java +++ b/jdk/src/share/classes/javax/management/MBeanServerNotification.java @@ -64,6 +64,33 @@ package javax.management; * MBeanServerDelegate.DELEGATE_NAME, printListener, null, null); * * + *

    The following code prints a message every time an MBean is registered + * or unregistered in the MBean Server {@code mbeanServer}:

    + * + *
    + * private static final NotificationListener printListener = new NotificationListener() {
    + *     public void handleNotification(Notification n, Object handback) {
    + *         if (!(n instanceof MBeanServerNotification)) {
    + *             System.out.println("Ignored notification of class " + n.getClass().getName());
    + *             return;
    + *         }
    + *         MBeanServerNotification mbsn = (MBeanServerNotification) n;
    + *         String what;
    + *         if (n.getType().equals(MBeanServerNotification.REGISTRATION_NOTIFICATION))
    + *             what = "MBean registered";
    + *         else if (n.getType().equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION))
    + *             what = "MBean unregistered";
    + *         else
    + *             what = "Unknown type " + n.getType();
    + *         System.out.println("Received MBean Server notification: " + what + ": " +
    + *                 mbsn.getMBeanName());
    + * };
    + *
    + * ...
    + *     mbeanServer.addNotificationListener(
    + *             MBeanServerDelegate.DELEGATE_NAME, printListener, null, null);
    + * 
    + * * @since 1.5 */ public class MBeanServerNotification extends Notification { diff --git a/jdk/src/share/classes/javax/management/QueryNotificationFilter.java b/jdk/src/share/classes/javax/management/QueryNotificationFilter.java index 7d1990fa2b9..5d7e7815b80 100644 --- a/jdk/src/share/classes/javax/management/QueryNotificationFilter.java +++ b/jdk/src/share/classes/javax/management/QueryNotificationFilter.java @@ -26,7 +26,6 @@ package javax.management; import com.sun.jmx.mbeanserver.NotificationMBeanSupport; -import com.sun.jmx.mbeanserver.Util; import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -43,6 +42,11 @@ import java.util.Set; * on both the client and the server in the remote case, so using this class * instead is recommended where possible.

    * + *

    Because this class was introduced in version 2.0 of the JMX API, + * it may not be present on a remote JMX agent that is running an earlier + * version. The method {@link JMX#getSpecificationVersion + * JMX.getSpecificationVersion} can be used to determine the remote version.

    + * *

    This class uses the {@linkplain Query Query API} to specify the * filtering logic. For example, to select only notifications where the * {@linkplain Notification#getType() type} is {@code "com.example.mytype"}, diff --git a/jdk/src/share/classes/javax/management/openmbean/CompositeDataSupport.java b/jdk/src/share/classes/javax/management/openmbean/CompositeDataSupport.java index 4ef93b47611..bd7c77af9b4 100644 --- a/jdk/src/share/classes/javax/management/openmbean/CompositeDataSupport.java +++ b/jdk/src/share/classes/javax/management/openmbean/CompositeDataSupport.java @@ -33,12 +33,14 @@ import java.io.Serializable; import java.util.Arrays; import java.util.Collection; import java.util.Collections; +import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; import java.util.SortedMap; import java.util.TreeMap; // jmx import +import java.util.TreeSet; // @@ -60,16 +62,15 @@ public class CompositeDataSupport * respective values. * A {@link SortedMap} is used for faster retrieval of elements. */ - private SortedMap contents = new TreeMap(); + private final SortedMap contents; /** * @serial The composite type of this composite data instance. */ - private CompositeType compositeType; + private final CompositeType compositeType; /** - *

    - * Constructs a CompositeDataSupport instance with the specified + *

    Constructs a CompositeDataSupport instance with the specified * compositeType, whose item values * are specified by itemValues[], in the same order as in * itemNames[]. @@ -79,103 +80,67 @@ public class CompositeDataSupport * The items contained in this CompositeDataSupport instance are * internally stored in a TreeMap, * thus sorted in ascending lexicographic order of their names, for faster - * retrieval of individual item values. - *

    - * The constructor checks that all the constraints listed below for each + * retrieval of individual item values.

    + * + *

    The constructor checks that all the constraints listed below for each * parameter are satisfied, - * and throws the appropriate exception if they are not. - *

    - * @param compositeType the composite type of this composite - * data instance; - * must not be null. - *

    - * @param itemNames itemNames must list, in any order, all the - * item names defined in compositeType; - * the order in which the names are listed, is used to - * match values in itemValues[]; - * must not be null or empty. - *

    - * @param itemValues the values of the items, listed in the same order as - * their respective names in itemNames; - * each item value can be null, but if it is non-null it must be - * a valid value for the open type defined in compositeType for the corresponding item; - * must be of the same size as itemNames; must not be null or empty. - *

    - * @throws IllegalArgumentException compositeType is null, or itemNames[] or itemValues[] is null or empty, - * or one of the elements in itemNames[] is a null or empty string, - * or itemNames[] and itemValues[] are not of the same size. - *

    - * @throws OpenDataException itemNames[] or itemValues[]'s size differs from - * the number of items defined in compositeType, - * or one of the elements in itemNames[] does not exist as an item name defined in compositeType, - * or one of the elements in itemValues[] is not a valid value for the corresponding item - * as defined in compositeType. - *

    + * and throws the appropriate exception if they are not.

    + * + * @param compositeType the composite type of this composite + * data instance; must not be null. + * + * @param itemNames itemNames must list, in any order, all the + * item names defined in compositeType; the order in which the + * names are listed, is used to match values in itemValues[]; must + * not be null. + * + * @param itemValues the values of the items, listed in the same order as + * their respective names in itemNames; each item value can be + * null, but if it is non-null it must be a valid value for the open type + * defined in compositeType for the corresponding item; must be of + * the same size as itemNames; must not be null. + * + * @throws IllegalArgumentException compositeType is null, or + * itemNames[] or itemValues[] is null or empty, or one + * of the elements in itemNames[] is a null or empty string, or + * itemNames[] and itemValues[] are not of the same size. + * + * @throws OpenDataException itemNames[] or + * itemValues[]'s size differs from the number of items defined in + * compositeType, or one of the elements in itemNames[] + * does not exist as an item name defined in compositeType, or one + * of the elements in itemValues[] is not a valid value for the + * corresponding item as defined in compositeType. */ - public CompositeDataSupport(CompositeType compositeType, String[] itemNames, Object[] itemValues) - throws OpenDataException { + public CompositeDataSupport( + CompositeType compositeType, String[] itemNames, Object[] itemValues) + throws OpenDataException { + this(makeMap(itemNames, itemValues), compositeType); + } - // Check compositeType is not null - // - if (compositeType == null) { - throw new IllegalArgumentException("Argument compositeType cannot be null."); - } + private static SortedMap makeMap( + String[] itemNames, Object[] itemValues) + throws OpenDataException { - // item names defined in compositeType: - Set namesSet = compositeType.keySet(); - - // Check the array itemNames is not null or empty (length!=0) and - // that there is no null element or empty string in it - // - checkForNullElement(itemNames, "itemNames"); - checkForEmptyString(itemNames, "itemNames"); - - // Check the array itemValues is not null or empty (length!=0) - // (NOTE: we allow null values as array elements) - // - if ( (itemValues == null) || (itemValues.length == 0) ) { - throw new IllegalArgumentException("Argument itemValues[] cannot be null or empty."); - } - - // Check that the sizes of the 2 arrays itemNames and itemValues are the same - // + if (itemNames == null || itemValues == null) + throw new IllegalArgumentException("Null itemNames or itemValues"); if (itemNames.length != itemValues.length) { - throw new IllegalArgumentException("Array arguments itemNames[] and itemValues[] "+ - "should be of same length (got "+ itemNames.length + - " and "+ itemValues.length +")."); + throw new IllegalArgumentException( + "Different lengths: itemNames[" + itemNames.length + + "], itemValues[" + itemValues.length + "]"); } - // Check the size of the 2 arrays is equal to the number of items defined in compositeType - // - if (itemNames.length != namesSet.size()) { - throw new OpenDataException("The size of array arguments itemNames[] and itemValues[] should be equal to the number of items defined"+ - " in argument compositeType (found "+ itemNames.length +" elements in itemNames[] and itemValues[],"+ - " expecting "+ namesSet.size() +" elements according to compositeType."); + SortedMap map = new TreeMap(); + for (int i = 0; i < itemNames.length; i++) { + String name = itemNames[i]; + if (name == null || name.equals("")) + throw new IllegalArgumentException("Null or empty item name"); + if (map.containsKey(name)) + throw new OpenDataException("Duplicate item name " + name); + map.put(itemNames[i], itemValues[i]); } - // Check parameter itemNames[] contains all names defined in the compositeType of this instance - // - if ( ! Arrays.asList(itemNames).containsAll(namesSet) ) { - throw new OpenDataException("Argument itemNames[] does not contain all names defined in the compositeType of this instance."); - } - - // Check each element of itemValues[], if not null, is of the open type defined for the corresponding item - // - OpenType itemType; - for (int i=0; iitems. * This constructor converts the keys to a string array and the values to an object array and calls * CompositeDataSupport(javax.management.openmbean.CompositeType, java.lang.String[], java.lang.Object[]). - *

    + * * @param compositeType the composite type of this composite data instance; * must not be null. - *

    * @param items the mappings of all the item names to their values; * items must contain all the item names defined in compositeType; - * must not be null or empty. - *

    - * @throws IllegalArgumentException compositeType is null, or items is null or empty, - * or one of the keys in items is a null or empty string, - * or one of the values in items is null. - *

    - * @throws OpenDataException items' size differs from the number of items defined in compositeType, - * or one of the keys in items does not exist as an item name defined in compositeType, - * or one of the values in items is not a valid value for the corresponding item - * as defined in compositeType. - *

    - * @throws ArrayStoreException one or more keys in items is not of the class java.lang.String. - *

    + * must not be null. + * + * @throws IllegalArgumentException compositeType is null, or + * items is null, or one of the keys in items is a null + * or empty string. + * @throws OpenDataException items' size differs from the + * number of items defined in compositeType, or one of the + * keys in items does not exist as an item name defined in + * compositeType, or one of the values in items + * is not a valid value for the corresponding item as defined in + * compositeType. + * @throws ArrayStoreException one or more keys in items is not of + * the class java.lang.String. + * + * @see #toMap */ public CompositeDataSupport(CompositeType compositeType, Map items) throws OpenDataException { + this(makeMap(items), compositeType); + } + private static SortedMap makeMap(Map items) { + if (items == null) + throw new IllegalArgumentException("Null items map"); + if (items.containsKey(null) || items.containsKey("")) + throw new IllegalArgumentException("Null or empty item name"); - // Let the other constructor do the job, as the call to another constructor must be the first call + SortedMap map = new TreeMap(); + for (Object key : items.keySet()) { + if (!(key instanceof String)) { + throw new ArrayStoreException("Item name is not string: " + key); + // This can happen because of erasure. The particular + // exception is a historical artifact - an implementation + // detail that leaked into the API. + } + map.put((String) key, items.get(key)); + } + return map; + } + + private CompositeDataSupport( + SortedMap items, CompositeType compositeType) + throws OpenDataException { + + // Check compositeType is not null // - this( compositeType, - (items==null ? null : items.keySet().toArray(new String[items.size()])), // may raise an ArrayStoreException - (items==null ? null : items.values().toArray()) ); - } - - /** - * - */ - private static void checkForNullElement(Object[] arg, String argName) { - if ( (arg == null) || (arg.length == 0) ) { - throw new IllegalArgumentException( - "Argument "+ argName +"[] cannot be null or empty."); + if (compositeType == null) { + throw new IllegalArgumentException("Argument compositeType cannot be null."); } - for (int i=0; i namesFromType = compositeType.keySet(); + Set namesFromItems = items.keySet(); + + // This is just a comparison, but we do it this way for a better + // exception message. + if (!namesFromType.equals(namesFromItems)) { + Set extraFromType = new TreeSet(namesFromType); + extraFromType.removeAll(namesFromItems); + Set extraFromItems = new TreeSet(namesFromItems); + extraFromItems.removeAll(namesFromType); + if (!extraFromType.isEmpty() || !extraFromItems.isEmpty()) { + throw new OpenDataException( + "Item names do not match CompositeType: " + + "names in items but not in CompositeType: " + extraFromItems + + "; names in CompositeType but not in items: " + extraFromType); } } - } - /** - * - */ - private static void checkForEmptyString(String[] arg, String argName) { - for (int i=0; i itemType = compositeType.getType(name); + if (!itemType.isValue(value)) { + throw new OpenDataException( + "Argument value of wrong type for item " + name + + ": value " + value + ", type " + itemType); + } } } + + // Initialize internal fields: compositeType and contents + // + this.compositeType = compositeType; + this.contents = items; } /** @@ -328,6 +328,54 @@ public class CompositeDataSupport return Collections.unmodifiableCollection(contents.values()); } + /** + *

    Returns a Map representing the contents of the given CompositeData. + * Each item in the CompositeData is represented by an entry in the map, + * where the name and value of the item are the key and value of the entry. + * The returned value is modifiable but modifications to it have no effect + * on the original CompositeData.

    + * + *

    For example, if you have a CompositeData {@code cd1} and you want + * to produce another CompositeData {@code cd2} which is the same except + * that the value of its {@code id} item has been changed to 253, you + * could write:

    + * + *
    +     * CompositeData cd1 = ...;
    +     * {@code Map} map = CompositeDataSupport.toMap(cd1);
    +     * assert(map.get("id") instanceof Integer);
    +     * map.put("id", 253);
    +     * CompositeData cd2 = {@link #CompositeDataSupport(CompositeType, Map)
    +     * new CompositeDataSupport}(cd1.getCompositeType(), map);
    +     * 
    + * + *

    Logically, this method would be a method in the {@link CompositeData} + * interface, but cannot be for compatibility reasons.

    + * + * @param cd the CompositeData to convert to a Map. + * + * @return a Map that is a copy of the contents of {@code cd}. + * + * @throws IllegalArgumentException if {@code cd} is null. + * + * @see #CompositeDataSupport(CompositeType, Map) + */ + public static Map toMap(CompositeData cd) { + if (cd == null) + throw new IllegalArgumentException("Null argument"); + + // If we really wanted, we could check whether cd is a + // CompositeDataSupport and return a copy of cd.contents if so, + // but I don't think that would be substantially faster. + Map map = new LinkedHashMap(); + CompositeType ct = cd.getCompositeType(); + for (String key : ct.keySet()) { + Object value = cd.get(key); + map.put(key, value); + } + return map; + } + /** * Compares the specified obj parameter with this * CompositeDataSupport instance for equality. diff --git a/jdk/src/share/classes/javax/management/package.html b/jdk/src/share/classes/javax/management/package.html index 14027d648ea..372c30efd9f 100644 --- a/jdk/src/share/classes/javax/management/package.html +++ b/jdk/src/share/classes/javax/management/package.html @@ -1,7 +1,7 @@ - -javax.management package - - - -

    Provides the core classes for the Java Management Extensions.

    + --> + + +

    Provides the core classes for the Java Management Extensions.

    -

    The Java Management Extensions - (JMXTM) API is a standard - API for management and monitoring. Typical uses include:

    +

    The Java Management Extensions + (JMXTM) API is a standard + API for management and monitoring. Typical uses include:

    -
      -
    • consulting and changing application configuration
    • +
        +
      • consulting and changing application configuration
      • -
      • accumulating statistics about application behavior and - making them available
      • +
      • accumulating statistics about application behavior and + making them available
      • -
      • notifying of state changes and erroneous conditions.
      • -
      +
    • notifying of state changes and erroneous conditions.
    • +
    -

    The JMX API can also be used as part of a solution for - managing systems, networks, and so on.

    +

    The JMX API can also be used as part of a solution for + managing systems, networks, and so on.

    -

    The API includes remote access, so a remote management - program can interact with a running application for these - purposes.

    +

    The API includes remote access, so a remote management + program can interact with a running application for these + purposes.

    -

    MBeans

    +

    MBeans

    -

    The fundamental notion of the JMX API is the MBean. - An MBean is a named managed object representing a - resource. It has a management interface consisting - of:

    +

    The fundamental notion of the JMX API is the MBean. + An MBean is a named managed object representing a + resource. It has a management interface consisting + of:

    • named and typed attributes that can be read and/or @@ -92,40 +92,40 @@ have any questions.
           public interface ConfigurationMBean {
      -	public int getCacheSize();
      -	public void setCacheSize(int size);
      -	public long getLastChangedTime();
      -	public void save();
      +         public int getCacheSize();
      +         public void setCacheSize(int size);
      +         public long getLastChangedTime();
      +         public void save();
           }
      -      
      + -

      The methods getCacheSize and - setCacheSize define a read-write attribute of - type int called CacheSize (with an - initial capital, unlike the JavaBeans convention).

      +

      The methods getCacheSize and + setCacheSize define a read-write attribute of + type int called CacheSize (with an + initial capital, unlike the JavaBeans convention).

      -

      The method getLastChangedTime defines an - attribute of type long called - LastChangedTime. This is a read-only attribute, - since there is no method setLastChangedTime.

      +

      The method getLastChangedTime defines an + attribute of type long called + LastChangedTime. This is a read-only attribute, + since there is no method setLastChangedTime.

      -

      The method save defines an operation called - save. It is not an attribute, since its name - does not begin with get, set, or - is.

      +

      The method save defines an operation called + save. It is not an attribute, since its name + does not begin with get, set, or + is.

      -

      The exact naming patterns for Standard MBeans are detailed in - the JMX Specification.

      +

      The exact naming patterns for Standard MBeans are detailed in + the JMX Specification.

      -

      There are two ways to make a Java object that is an MBean - with this management interface. One is for the object to be - of a class that has exactly the same name as the Java - interface but without the MBean suffix. So in - the example the object would be of the class - Configuration, in the same Java package as - ConfigurationMBean. The second way is to use the - {@link javax.management.StandardMBean StandardMBean} - class.

      +

      There are two ways to make a Java object that is an MBean + with this management interface. One is for the object to be + of a class that has exactly the same name as the Java + interface but without the MBean suffix. So in + the example the object would be of the class + Configuration, in the same Java package as + ConfigurationMBean. The second way is to use the + {@link javax.management.StandardMBean StandardMBean} + class.

      Defining Standard MBeans with annotations

      @@ -272,37 +272,37 @@ have any questions.
           int cacheSize = mbs.getAttribute(name, "CacheSize");
           {@link javax.management.Attribute Attribute} newCacheSize =
      -    	new Attribute("CacheSize", new Integer(2000));
      +         new Attribute("CacheSize", new Integer(2000));
           mbs.setAttribute(name, newCacheSize);
           mbs.invoke(name, "save", new Object[0], new Class[0]);
      -      
      +

      Alternatively, if you have a Java interface that corresponds to the management interface for the MBean, you can use an MBean proxy like this:

      -
      +        
           ConfigurationMBean conf =
               {@link javax.management.JMX#newMBeanProxy
                   JMX.newMBeanProxy}(mbs, name, ConfigurationMBean.class);
           int cacheSize = conf.getCacheSize();
           conf.setCacheSize(2000);
           conf.save();
      -      
      +
      -

      Using an MBean proxy is just a convenience. The second - example ends up calling the same MBeanServer - operations as the first one.

      +

      Using an MBean proxy is just a convenience. The second + example ends up calling the same MBeanServer + operations as the first one.

      -

      An MBean Server can be queried for MBeans whose names match - certain patterns and/or whose attributes meet certain - constraints. Name patterns are constructed using the {@link - javax.management.ObjectName ObjectName} class and constraints - are constructed using the {@link javax.management.Query Query} - class. The methods {@link - javax.management.MBeanServer#queryNames queryNames} and {@link - javax.management.MBeanServer#queryMBeans queryMBeans} then - perform the query.

      +

      An MBean Server can be queried for MBeans whose names match + certain patterns and/or whose attributes meet certain + constraints. Name patterns are constructed using the {@link + javax.management.ObjectName ObjectName} class and constraints + are constructed using the {@link javax.management.Query Query} + class. The methods {@link + javax.management.MBeanServer#queryNames queryNames} and {@link + javax.management.MBeanServer#queryMBeans queryMBeans} then + perform the query.

      MBean lifecycle and resource injection

      @@ -407,6 +407,92 @@ have any questions. So for example an SNMP GET operation might result in a getAttribute on the MBean Server.

      +

      Interoperability between versions of the JMX + specification

      + +

      When a client connects to a server using the JMX Remote + API, it is possible that they do not have the same version + of the JMX specification. The version of the JMX + specification described here is version 2.0. Previous + versions were 1.0, 1.1, 1.2, and 1.4. (There was no 1.3.) + The standard JMX Remote API is defined to work with version + 1.2 onwards, so in standards-based deployment the only + interoperability questions that arise concern version 1.2 + onwards.

      + +

      Every version of the JMX specification continues to + implement the features of previous versions. So when the + client is running an earlier version than the server, there + should not be any interoperability concerns. The only + exception is the unlikely one where a pre-2.0 client used + the string {@code //} in the domain part of an {@link + javax.management.ObjectName ObjectName}.

      + +

      When the client is running a later version than the server, + certain newer features may not be available, as detailed in + the next sections. The method {@link + javax.management.JMX#getSpecificationVersion + JMX.getSpecificationVersion} can be used to determine the + server version to check if required features are + available.

      + +

      If the remote MBean Server is 1.4

      + +
        + +
      • You cannot use {@link + javax.management.QueryNotificationFilter + QueryNotificationFilter} in {@link + javax.management.MBeanServerConnection#addNotificationListener + addNotificationListener} since this class did not exist + in 1.4.

        + +
      • In an attribute in a query, you cannot access values + inside complex types using dot syntax, for example + {@link javax.management.Query#attr Query.attr}{@code + ("HeapMemoryUsage.used")}.

        + +
      • The packages {@link javax.management.event} and + {@link javax.management.namespace} did not exist in 1.4, + so you cannot remotely create instances of the MBeans + they define.

        + +
      • Even if the remote MBean Server is 2.0, you cannot in + general suppose that {@link + javax.management.event.EventClient EventClient} or + {@link javax.management.ClientContext ClientContext} + will work there without first checking. If the remote + MBean Server is 1.4 then those checks will return false. + An attempt to use these features without checking will + fail in the same way as for a remote 2.0 that is not + configured to support them.

        +
      + +

      If the remote MBean Server is 1.2

      + +

      In addition to the above,

      + +
        + +
      • You cannot use wildcards in a key property of an + {@link javax.management.ObjectName ObjectName}, for + example {@code domain:type=Foo,name=*}. Wildcards that + match whole properties are still allowed, for example + {@code *:*} or {@code *:type=Foo,*}.

        + +
      • You cannot use {@link + javax.management.Query#isInstanceOf Query.isInstanceOf} + in a query.

        + +
      • You cannot use dot syntax such as {@code + HeapMemoryUsage.used} in the {@linkplain + javax.management.monitor.Monitor#setObservedAttribute + observed attribute} of a monitor, as described in the + documentation for the {@link javax.management.monitor} + package.

        + +
      +

      @see Java SE 6 Platform documentation on JMX technology diff --git a/jdk/test/javax/management/MBeanServer/AttributeListMapTest.java b/jdk/test/javax/management/MBeanServer/AttributeListMapTest.java new file mode 100644 index 00000000000..94dd39306a3 --- /dev/null +++ b/jdk/test/javax/management/MBeanServer/AttributeListMapTest.java @@ -0,0 +1,115 @@ +/* + * 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. + * + * 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 6336968 + * @summary Test AttributeList.toMap + * @author Eamonn McManus + */ + +import java.math.BigInteger; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import javax.management.Attribute; +import javax.management.AttributeList; + +public class AttributeListMapTest { + + private static String failure; + + public static void main(String[] args) throws Exception { + AttributeList attrs = new AttributeList(Arrays.asList( + new Attribute("Str", "Five"), + new Attribute("Int", 5), + new Attribute("Flt", 5.0))); + + Map map = attrs.toMap(); + final Map expectMap = new HashMap(); + for (Attribute attr : attrs.asList()) + expectMap.put(attr.getName(), attr.getValue()); + assertEquals("Initial map", expectMap, map); + assertEquals("Initial map size", 3, map.size()); + assertEquals("Name set", expectMap.keySet(), map.keySet()); + assertEquals("Values", new HashSet(expectMap.values()), + new HashSet(map.values())); + assertEquals("Entry set", expectMap.entrySet(), map.entrySet()); + + AttributeList attrs2 = new AttributeList(map); + assertEquals("AttributeList from Map", attrs, attrs2); + // This assumes that the Map conserves the order of the attributes, + // which is not specified but true because we use LinkedHashMap. + + // Check that toMap fails if the list contains non-Attribute elements. + AttributeList attrs3 = new AttributeList(attrs); + attrs3.add("Hello"); // allowed but curious + try { + map = attrs3.toMap(); + fail("toMap succeeded on list with non-Attribute elements"); + } catch (Exception e) { + assertEquals("Exception for toMap with non-Atttribute elements", + IllegalArgumentException.class, e.getClass()); + } + + // Check that the Map does not reflect changes made to the list after + // the Map was obtained. + AttributeList attrs4 = new AttributeList(attrs); + map = attrs4.toMap(); + attrs4.add(new Attribute("Big", new BigInteger("5"))); + assertEquals("Map after adding element to list", expectMap, map); + + // Check that if there is more than one Attribute with the same name + // then toMap() chooses the last of them. + AttributeList attrs5 = new AttributeList(attrs); + attrs5.add(new Attribute("Str", "Cinq")); + map = attrs5.toMap(); + assertEquals("Size of Map for list with duplicate attribute name", + 3, map.size()); + Object value = map.get("Str"); + assertEquals("Value of Str in Map for list with two values for it", + "Cinq", value); + + if (failure == null) + System.out.println("TEST PASSED"); + else + throw new Exception("TEST FAILED: " + failure); + } + + private static void assertEquals(String what, Object expect, Object actual) { + if (eq(expect, actual)) + System.out.println("OK: " + what); + else + fail(what + ": expected " + expect + ", got " + actual); + } + + private static boolean eq(Object x, Object y) { + return (x == null) ? (y == null) : x.equals(y); + } + + private static void fail(String why) { + System.out.println("FAIL: " + why); + failure = why; + } +} diff --git a/jdk/test/javax/management/MBeanServer/AttributeListTypeSafeTest.java b/jdk/test/javax/management/MBeanServer/AttributeListTypeSafeTest.java new file mode 100644 index 00000000000..ed2fc96fd06 --- /dev/null +++ b/jdk/test/javax/management/MBeanServer/AttributeListTypeSafeTest.java @@ -0,0 +1,109 @@ +/* + * 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. + * + * 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 6336968 + * @summary Test adding non-Attribute values to an AttributeList. + * @author Eamonn McManus + */ + +import java.util.Collections; +import java.util.List; +import javax.management.Attribute; +import javax.management.AttributeList; + +public class AttributeListTypeSafeTest { + + private static String failure; + + public static void main(String[] args) throws Exception { + // Test calling asList after adding non-Attribute by various means + for (Op op : Op.values()) { + AttributeList alist = new AttributeList(); + alist.add(new Attribute("foo", "bar")); + doOp(alist, op); + String what = "asList() after calling " + op + " with non-Attribute"; + try { + List lista = alist.asList(); + fail(what + ": succeeded but should not have"); + } catch (IllegalArgumentException e) { + System.out.println("OK: " + what + ": got IllegalArgumentException"); + } + } + + // Test adding non-Attribute by various means after calling asList + for (Op op : Op.values()) { + AttributeList alist = new AttributeList(); + List lista = alist.asList(); + lista.add(new Attribute("foo", "bar")); + String what = op + " with non-Attribute after calling asList()"; + try { + doOp(alist, op); + fail(what + ": succeeded but should not have"); + } catch (IllegalArgumentException e) { + System.out.println("OK: " + what + ": got IllegalArgumentException"); + } + } + + if (failure == null) + System.out.println("TEST PASSED"); + else + throw new Exception("TEST FAILED: " + failure); + } + + private static enum Op { + ADD("add(Object)"), ADD_AT("add(int, Object)"), + ADD_ALL("add(Collection)"), ADD_ALL_AT("add(int, Collection)"), + SET("set(int, Object)"); + + private Op(String what) { + this.what = what; + } + + @Override + public String toString() { + return what; + } + + private final String what; + } + + private static void doOp(AttributeList alist, Op op) { + Object x = "oops"; + switch (op) { + case ADD: alist.add(x); break; + case ADD_AT: alist.add(0, x); break; + case ADD_ALL: alist.add(Collections.singleton(x)); break; + case ADD_ALL_AT: alist.add(0, Collections.singleton(x)); break; + case SET: alist.set(0, x); break; + default: throw new AssertionError("Case not covered"); + } + } + + private static void fail(String why) { + System.out.println("FAIL: " + why); + failure = why; + } + +} diff --git a/jdk/test/javax/management/openmbean/CompositeDataToMapTest.java b/jdk/test/javax/management/openmbean/CompositeDataToMapTest.java new file mode 100644 index 00000000000..30641b7c72f --- /dev/null +++ b/jdk/test/javax/management/openmbean/CompositeDataToMapTest.java @@ -0,0 +1,116 @@ +/* + * 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. + * + * 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 6750472 6752563 + * @summary Test CompositeDataSupport.toMap. + * @author Eamonn McManus + * @run main/othervm -ea CompositeDataToMapTest + */ + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import javax.management.openmbean.CompositeData; +import javax.management.openmbean.CompositeDataSupport; +import javax.management.openmbean.CompositeType; +import javax.management.openmbean.OpenType; +import javax.management.openmbean.SimpleType; + +public class CompositeDataToMapTest { + private static class IdentityInvocationHandler implements InvocationHandler { + private final Object wrapped; + + public IdentityInvocationHandler(Object wrapped) { + this.wrapped = wrapped; + } + + public Object invoke(Object proxy, Method m, Object[] args) + throws Throwable { + try { + return m.invoke(wrapped, args); + } catch (InvocationTargetException e) { + throw e.getCause(); + } + } + } + + private static T wrap(T x, Class intf) { + InvocationHandler ih = new IdentityInvocationHandler(x); + return intf.cast(Proxy.newProxyInstance( + intf.getClassLoader(), new Class[] {intf}, ih)); + } + + public static void main(String[] args) throws Exception { + if (!CompositeDataToMapTest.class.desiredAssertionStatus()) + throw new AssertionError("Must be run with -ea"); + + CompositeType emptyCT = new CompositeType( + "empty", "empty", new String[0], new String[0], new OpenType[0]); + CompositeData emptyCD = new CompositeDataSupport( + emptyCT, Collections.emptyMap()); + assert CompositeDataSupport.toMap(emptyCD).isEmpty() : + "Empty CD produces empty Map"; + + CompositeData emptyCD2 = new CompositeDataSupport( + emptyCT, new String[0], new Object[0]); + assert emptyCD.equals(emptyCD2) : "Empty CD can be constructed two ways"; + + CompositeType namedNumberCT = new CompositeType( + "NamedNumber", "NamedNumber", + new String[] {"name", "number"}, + new String[] {"name", "number"}, + new OpenType[] {SimpleType.STRING, SimpleType.INTEGER}); + Map namedNumberMap = new HashMap(); + namedNumberMap.put("name", "Deich"); + namedNumberMap.put("number", 10); + CompositeData namedNumberCD = new CompositeDataSupport( + namedNumberCT, namedNumberMap); + assert CompositeDataSupport.toMap(namedNumberCD).equals(namedNumberMap) : + "Map survives passage through CompositeData"; + + namedNumberCD = wrap(namedNumberCD, CompositeData.class); + assert CompositeDataSupport.toMap(namedNumberCD).equals(namedNumberMap) : + "Map survives passage through wrapped CompositeData"; + + namedNumberMap = CompositeDataSupport.toMap(namedNumberCD); + namedNumberMap.put("name", "Ceathar"); + namedNumberMap.put("number", 4); + namedNumberCD = new CompositeDataSupport(namedNumberCT, namedNumberMap); + assert CompositeDataSupport.toMap(namedNumberCD).equals(namedNumberMap) : + "Modified Map survives passage through CompositeData"; + + try { + namedNumberMap = CompositeDataSupport.toMap(null); + assert false : "Null toMap arg provokes exception"; + } catch (Exception e) { + assert e instanceof IllegalArgumentException : + "Exception for null toMap arg is IllegalArgumentException"; + } + } +} diff --git a/jdk/test/javax/management/remote/mandatory/version/JMXSpecVersionTest.java b/jdk/test/javax/management/remote/mandatory/version/JMXSpecVersionTest.java new file mode 100644 index 00000000000..69782690d0a --- /dev/null +++ b/jdk/test/javax/management/remote/mandatory/version/JMXSpecVersionTest.java @@ -0,0 +1,308 @@ +/* + * 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. + * + * 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 6750008 + * @summary Test JMX.getSpecificationVersion + * @author Eamonn McManus + */ + +import java.io.IOException; +import java.util.Collections; +import java.util.ListIterator; +import java.util.Set; +import javax.management.Attribute; +import javax.management.AttributeList; +import javax.management.AttributeNotFoundException; +import javax.management.DynamicMBean; +import javax.management.InstanceNotFoundException; +import javax.management.InvalidAttributeValueException; +import javax.management.JMX; +import javax.management.MBeanException; +import javax.management.MBeanInfo; +import javax.management.MBeanServer; +import javax.management.MBeanServerConnection; +import javax.management.MBeanServerDelegate; +import javax.management.MBeanServerDelegateMBean; +import javax.management.MBeanServerFactory; +import javax.management.ObjectName; +import javax.management.ReflectionException; +import javax.management.StandardMBean; +import javax.management.namespace.JMXNamespace; +import javax.management.namespace.JMXNamespaces; +import javax.management.namespace.MBeanServerSupport; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXConnectorServer; +import javax.management.remote.JMXConnectorServerFactory; +import javax.management.remote.JMXServiceURL; + +public class JMXSpecVersionTest { + private static String failure; + private static final Object POISON_PILL = new Object(); + + private static class FakeDelegate implements DynamicMBean { + private final Object specVersion; + private final DynamicMBean delegate = new StandardMBean( + new MBeanServerDelegate(), MBeanServerDelegateMBean.class, false); + + FakeDelegate(Object specVersion) { + this.specVersion = specVersion; + } + + public Object getAttribute(String attribute) + throws AttributeNotFoundException, MBeanException, + ReflectionException { + if ("SpecificationVersion".equals(attribute)) { + if (specVersion == POISON_PILL) + throw new AttributeNotFoundException(attribute); + else + return specVersion; + } else + return delegate.getAttribute(attribute); + } + + public void setAttribute(Attribute attribute) + throws AttributeNotFoundException, InvalidAttributeValueException, + MBeanException, ReflectionException { + delegate.setAttribute(attribute); + } + + public AttributeList getAttributes(String[] attributes) { + AttributeList list = delegate.getAttributes(attributes); + for (ListIterator it = list.asList().listIterator(); + it.hasNext(); ) { + Attribute attr = it.next(); + if (attr.getName().equals("SpecificationVersion")) { + it.remove(); + if (specVersion != POISON_PILL) { + attr = new Attribute(attr.getName(), specVersion); + it.add(attr); + } + } + } + return list; + } + + public AttributeList setAttributes(AttributeList attributes) { + return delegate.setAttributes(attributes); + } + + public Object invoke(String actionName, Object[] params, + String[] signature) throws MBeanException, + ReflectionException { + return delegate.invoke(actionName, params, signature); + } + + public MBeanInfo getMBeanInfo() { + throw new UnsupportedOperationException("Not supported yet."); + } + } + + private static class MBeanServerWithVersion extends MBeanServerSupport { + private final DynamicMBean delegate; + + public MBeanServerWithVersion(Object specVersion) { + this.delegate = new FakeDelegate(specVersion); + } + + @Override + public DynamicMBean getDynamicMBeanFor(ObjectName name) + throws InstanceNotFoundException { + if (MBeanServerDelegate.DELEGATE_NAME.equals(name)) + return delegate; + else + throw new InstanceNotFoundException(name); + } + + @Override + protected Set getNames() { + return Collections.singleton(MBeanServerDelegate.DELEGATE_NAME); + } + } + + private static class EmptyMBeanServer extends MBeanServerSupport { + @Override + public DynamicMBean getDynamicMBeanFor(ObjectName name) throws InstanceNotFoundException { + throw new InstanceNotFoundException(name); + } + + @Override + protected Set getNames() { + return Collections.emptySet(); + } + } + + public static void main(String[] args) throws Exception { + MBeanServer mbs = MBeanServerFactory.newMBeanServer(); + JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///"); + JMXConnectorServer cs = JMXConnectorServerFactory.newJMXConnectorServer( + url, null, mbs); + cs.start(); + + String realVersion = (String) mbs.getAttribute( + MBeanServerDelegate.DELEGATE_NAME, "SpecificationVersion"); + assertEquals("Reported local version", + realVersion, JMX.getSpecificationVersion(mbs, null)); + assertEquals("Reported local version >= \"2.0\"", + true, (realVersion.compareTo("2.0") >= 0)); + + JMXConnector cc = JMXConnectorFactory.connect(cs.getAddress()); + MBeanServerConnection mbsc = cc.getMBeanServerConnection(); + assertEquals("Reported remote version", + realVersion, JMX.getSpecificationVersion(mbsc, null)); + + cc.close(); + try { + String brokenVersion = JMX.getSpecificationVersion(mbsc, null); + fail("JMX.getSpecificationVersion succeded over closed connection" + + " (returned " + brokenVersion + ")"); + } catch (Exception e) { + assertEquals("Exception for closed connection", + IOException.class, e.getClass()); + } + + try { + String brokenVersion = JMX.getSpecificationVersion( + new EmptyMBeanServer(), null); + fail("JMX.getSpecificationVersion succeded with empty MBean Server" + + " (returned " + brokenVersion + ")"); + } catch (Exception e) { + assertEquals("Exception for empty MBean Server", + IOException.class, e.getClass()); + } + + try { + String brokenVersion = JMX.getSpecificationVersion(null, null); + fail("JMX.getSpecificationVersion succeded with null MBean Server" + + " (returned " + brokenVersion + ")"); + } catch (Exception e) { + assertEquals("Exception for null MBean Server", + IllegalArgumentException.class, e.getClass()); + } + + MBeanServer mbs1_2 = new MBeanServerWithVersion("1.2"); + String version1_2 = JMX.getSpecificationVersion(mbs1_2, null); + assertEquals("Version for 1.2 MBean Server", "1.2", version1_2); + + // It's completely nutty for an MBean Server to return null as the + // value of its spec version, and we don't actually say what happens + // in that case, but in fact we return the null to the caller. + MBeanServer mbs_null = new MBeanServerWithVersion(null); + String version_null = JMX.getSpecificationVersion(mbs_null, null); + assertEquals("Version for MBean Server that declares null spec version", + null, version_null); + + try { + MBeanServer mbs1_2_float = new MBeanServerWithVersion(1.2f); + String version1_2_float = + JMX.getSpecificationVersion(mbs1_2_float, null); + fail("JMX.getSpecificationVersion succeeded with version 1.2f" + + " (returned " + version1_2_float + ")"); + } catch (Exception e) { + assertEquals("Exception for non-string version (1.2f)", + IOException.class, e.getClass()); + } + + try { + MBeanServer mbs_missing = new MBeanServerWithVersion(POISON_PILL); + String version_missing = + JMX.getSpecificationVersion(mbs_missing, null); + fail("JMX.getSpecificationVersion succeeded with null version" + + " (returned " + version_missing + ")"); + } catch (Exception e) { + assertEquals("Exception for missing version", + IOException.class, e.getClass()); + } + + ObjectName wildcardNamespaceName = new ObjectName("foo//*//bar//baz:k=v"); + try { + String brokenVersion = + JMX.getSpecificationVersion(mbsc, wildcardNamespaceName); + fail("JMX.getSpecificationVersion succeeded with wildcard namespace" + + " (returned " + brokenVersion + ")"); + } catch (Exception e) { + assertEquals("Exception for wildcard namespace", + IllegalArgumentException.class, e.getClass()); + } + + String sub1_2namespace = "blibby"; + JMXNamespace sub1_2 = new JMXNamespace(mbs1_2); + ObjectName sub1_2name = + JMXNamespaces.getNamespaceObjectName(sub1_2namespace); + mbs.registerMBean(sub1_2, sub1_2name); + String sub1_2namespaceHandlerVersion = + JMX.getSpecificationVersion(mbs, sub1_2name); + assertEquals("Spec version of namespace handler", + realVersion, sub1_2namespaceHandlerVersion); + // The namespace handler is in the top-level namespace so its + // version should not be 1.2. + + for (String nameInSub : new String[] {"*:*", "d:k=v"}) { + ObjectName subName = new ObjectName(sub1_2namespace + "//" + nameInSub); + String subVersion = JMX.getSpecificationVersion(mbs, subName); + assertEquals("Spec version in 1.2 namespace (" + nameInSub + ")", + "1.2", subVersion); + } + + mbs.unregisterMBean(sub1_2name); + for (String noSuchNamespace : new String[] { + sub1_2namespace + "//*:*", sub1_2namespace + "//d:k=v", + }) { + try { + String brokenVersion = JMX.getSpecificationVersion( + mbs, new ObjectName(noSuchNamespace)); + fail("JMX.getSpecificationVersion succeeded with missing " + + "namespace (" + noSuchNamespace + " -> " + + brokenVersion); + } catch (Exception e) { + assertEquals("Exception for missing namespace", + IOException.class, e.getClass()); + } + } + + if (failure != null) + throw new Exception("TEST FAILED: " + failure); + System.out.println("TEST PASSED"); + } + + private static void assertEquals(String what, Object expect, Object actual) { + if (equal(expect, actual)) + System.out.println("OK: " + what + ": " + expect); + else + fail(what + ": expected " + expect + ", got " + actual); + } + + private static boolean equal(Object x, Object y) { + if (x == null) + return (y == null); + else + return x.equals(y); + } + + private static void fail(String why) { + System.out.println("FAILED: " + why); + failure = why; + } +} From 6fe817326c7ade248bbb4acb76bf47ce793c1d2f Mon Sep 17 00:00:00 2001 From: John Coomes Date: Tue, 11 Nov 2008 22:21:13 -0800 Subject: [PATCH 115/267] 6718879: cannot build on solaris nevada Reviewed-by: xlu --- hotspot/src/os/solaris/vm/os_solaris.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/hotspot/src/os/solaris/vm/os_solaris.cpp b/hotspot/src/os/solaris/vm/os_solaris.cpp index c4386d85988..05940869e48 100644 --- a/hotspot/src/os/solaris/vm/os_solaris.cpp +++ b/hotspot/src/os/solaris/vm/os_solaris.cpp @@ -3756,7 +3756,6 @@ int set_lwp_priority (int ThreadID, int lwpid, int newPrio ) int maxClamped = MIN2(iaLimits.maxPrio, (int)iaInfo->ia_uprilim); iaInfo->ia_upri = scale_to_lwp_priority(iaLimits.minPrio, maxClamped, newPrio); iaInfo->ia_uprilim = IA_NOCHANGE; - iaInfo->ia_nice = IA_NOCHANGE; iaInfo->ia_mode = IA_NOCHANGE; if (ThreadPriorityVerbose) { tty->print_cr ("IA: [%d...%d] %d->%d\n", From 98685a4d93b12316cd3d89d208d1cdae254e1cf5 Mon Sep 17 00:00:00 2001 From: John Coomes Date: Fri, 7 Nov 2008 12:52:16 -0800 Subject: [PATCH 116/267] 6769128: failure to run generateJvmOffsets is ignored Reviewed-by: xlu --- hotspot/make/solaris/makefiles/dtrace.make | 30 ++++++++++------------ 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/hotspot/make/solaris/makefiles/dtrace.make b/hotspot/make/solaris/makefiles/dtrace.make index bcc7819aa43..0561e188562 100644 --- a/hotspot/make/solaris/makefiles/dtrace.make +++ b/hotspot/make/solaris/makefiles/dtrace.make @@ -116,27 +116,25 @@ $(GENOFFS): $(DTRACE_SRCDIR)/$(GENOFFS)Main.c lib$(GENOFFS).so $(QUIETLY) $(LINK.CC) -z nodefs -o $@ $(DTRACE_SRCDIR)/$(GENOFFS)Main.c \ ./lib$(GENOFFS).so -# $@.tmp is created first. It's to avoid empty $(JVMOFFS).h produced in error case. +CONDITIONALLY_UPDATE_JVMOFFS_TARGET = \ + cmp -s $@ $@.tmp; \ + case $$? in \ + 0) rm -f $@.tmp;; \ + *) rm -f $@ && mv $@.tmp $@ && echo Updated $@;; \ + esac + +# $@.tmp is created first to avoid an empty $(JVMOFFS).h if an error occurs. $(JVMOFFS).h: $(GENOFFS) - $(QUIETLY) LD_LIBRARY_PATH=. ./$(GENOFFS) -header > $@.tmp ; \ - if [ `diff $@.tmp $@ > /dev/null 2>&1; echo $$?` -ne 0 ] ; \ - then rm -f $@; mv $@.tmp $@; echo Updated $@ ; \ - else rm -f $@.tmp; \ - fi + $(QUIETLY) LD_LIBRARY_PATH=. ./$(GENOFFS) -header > $@.tmp + $(QUIETLY) $(CONDITIONALLY_UPDATE_JVMOFFS_TARGET) $(JVMOFFS)Index.h: $(GENOFFS) - $(QUIETLY) LD_LIBRARY_PATH=. ./$(GENOFFS) -index > $@.tmp ; \ - if [ `diff $@.tmp $@ > /dev/null 2>&1; echo $$?` -ne 0 ] ; \ - then rm -f $@; mv $@.tmp $@; echo Updated $@ ; \ - else rm -f $@.tmp; \ - fi + $(QUIETLY) LD_LIBRARY_PATH=. ./$(GENOFFS) -index > $@.tmp + $(QUIETLY) $(CONDITIONALLY_UPDATE_JVMOFFS_TARGET) $(JVMOFFS).cpp: $(GENOFFS) $(JVMOFFS).h $(JVMOFFS)Index.h - $(QUIETLY) LD_LIBRARY_PATH=. ./$(GENOFFS) -table > $@.tmp ; \ - if [ `diff $@.tmp $@ > /dev/null 2>&1; echo $$?` -ne 0 ] ; \ - then rm -f $@; mv $@.tmp $@; echo Updated $@ ; \ - else rm -f $@.tmp; \ - fi + $(QUIETLY) LD_LIBRARY_PATH=. ./$(GENOFFS) -table > $@.tmp + $(QUIETLY) $(CONDITIONALLY_UPDATE_JVMOFFS_TARGET) $(JVMOFFS.o): $(JVMOFFS).h $(JVMOFFS).cpp $(QUIETLY) $(CCC) -c -I. -o $@ $(ARCHFLAG) -D$(TYPE) $(JVMOFFS).cpp From e9a892dd41294bd295d038ea23f8b218201d73df Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Tue, 11 Nov 2008 08:59:43 +0000 Subject: [PATCH 117/267] 6763122: ZipFile ctor does not throw exception when file is not a zip file Reviewed-by: bristor --- jdk/src/share/native/java/util/zip/zip_util.c | 15 +++-- jdk/test/java/util/zip/TestEmptyZip.java | 58 +++++++++++-------- 2 files changed, 42 insertions(+), 31 deletions(-) diff --git a/jdk/src/share/native/java/util/zip/zip_util.c b/jdk/src/share/native/java/util/zip/zip_util.c index 5d518cf4ced..3b00b9500ac 100644 --- a/jdk/src/share/native/java/util/zip/zip_util.c +++ b/jdk/src/share/native/java/util/zip/zip_util.c @@ -273,8 +273,8 @@ static const jlong END_MAXLEN = 0xFFFF + ENDHDR; /* * Searches for end of central directory (END) header. The contents of * the END header will be read and placed in endbuf. Returns the file - * position of the END header, otherwise returns 0 if the END header - * was not found or -1 if an error occurred. + * position of the END header, otherwise returns -1 if the END header + * was not found or an error occurred. */ static jlong findEND(jzfile *zip, void *endbuf) @@ -314,7 +314,7 @@ findEND(jzfile *zip, void *endbuf) } } } - return 0; /* END header not found */ + return -1; /* END header not found */ } /* @@ -460,9 +460,8 @@ if (1) { zip->msg = message; goto Catch; } else ((void)0) /* * Reads zip file central directory. Returns the file position of first - * CEN header, otherwise returns 0 if central directory not found or -1 - * if an error occurred. If zip->msg != NULL then the error was a zip - * format error and zip->msg has the error text. + * CEN header, otherwise returns -1 if an error occured. If zip->msg != NULL + * then the error was a zip format error and zip->msg has the error text. * Always pass in -1 for knownTotal; it's used for a recursive call. */ static jlong @@ -488,9 +487,9 @@ readCEN(jzfile *zip, jint knownTotal) /* Get position of END header */ if ((endpos = findEND(zip, endbuf)) == -1) - return -1; /* system error */ + return -1; /* no END header or system error */ - if (endpos == 0) return 0; /* END header not found */ + if (endpos == 0) return 0; /* only END header present */ freeCEN(zip); diff --git a/jdk/test/java/util/zip/TestEmptyZip.java b/jdk/test/java/util/zip/TestEmptyZip.java index d19dee4d446..f4ad29b60f2 100644 --- a/jdk/test/java/util/zip/TestEmptyZip.java +++ b/jdk/test/java/util/zip/TestEmptyZip.java @@ -39,34 +39,23 @@ public class TestEmptyZip { throw new Exception("failed to delete " + zipName); } - // Verify 0-length file cannot be read f.createNewFile(); - ZipFile zf = null; try { - zf = new ZipFile(f); - fail(); - } catch (Exception ex) { - check(ex.getMessage().contains("zip file is empty")); - } finally { - if (zf != null) { - zf.close(); - } - } + // Verify 0-length file cannot be read + checkCannotRead(f); - ZipInputStream zis = null; - try { - zis = new ZipInputStream(new FileInputStream(f)); - ZipEntry ze = zis.getNextEntry(); - check(ze == null); - } catch (Exception ex) { - unexpected(ex); - } finally { - if (zis != null) { - zis.close(); + // Verify non-zip file cannot be read + OutputStream out = new FileOutputStream(f); + try { + out.write("class Foo { }".getBytes()); + } finally { + out.close(); } - } + checkCannotRead(f); - f.delete(); + } finally { + f.delete(); + } // Verify 0-entries file can be written write(f); @@ -78,6 +67,29 @@ public class TestEmptyZip { f.delete(); } + static void checkCannotRead(File f) throws IOException { + try { + new ZipFile(f).close(); + fail(); + } catch (ZipException ze) { + if (f.length() == 0) { + check(ze.getMessage().contains("zip file is empty")); + } else { + pass(); + } + } + ZipInputStream zis = null; + try { + zis = new ZipInputStream(new FileInputStream(f)); + ZipEntry ze = zis.getNextEntry(); + check(ze == null); + } catch (IOException ex) { + unexpected(ex); + } finally { + if (zis != null) zis.close(); + } + } + static void write(File f) throws Exception { ZipOutputStream zos = null; try { From 12fd79632cfec54943eca6ef87697a55cb10122a Mon Sep 17 00:00:00 2001 From: Tim Bell Date: Tue, 11 Nov 2008 22:01:08 -0800 Subject: [PATCH 118/267] 6764892: VS2008 changes required to compile hotspot sources Minor changes required to build using the Visual Studio 2008 compiler Reviewed-by: kvn, ohair --- hotspot/make/windows/makefiles/adlc.make | 6 ++++ hotspot/make/windows/makefiles/compile.make | 34 ++++++++++++++++--- hotspot/make/windows/makefiles/debug.make | 6 ++++ hotspot/make/windows/makefiles/defs.make | 8 ++--- hotspot/make/windows/makefiles/fastdebug.make | 7 ++++ hotspot/make/windows/makefiles/product.make | 6 ++++ hotspot/make/windows/makefiles/sa.make | 10 +++++- .../cpu/x86/vm/register_definitions_x86.cpp | 3 -- 8 files changed, 67 insertions(+), 13 deletions(-) diff --git a/hotspot/make/windows/makefiles/adlc.make b/hotspot/make/windows/makefiles/adlc.make index b2f8132c64d..b6feb0e78b9 100644 --- a/hotspot/make/windows/makefiles/adlc.make +++ b/hotspot/make/windows/makefiles/adlc.make @@ -102,6 +102,12 @@ GENERATED_NAMES_IN_INCL=\ adlc.exe: main.obj adlparse.obj archDesc.obj arena.obj dfa.obj dict2.obj filebuff.obj \ forms.obj formsopt.obj formssel.obj opcodes.obj output_c.obj output_h.obj $(LINK) $(LINK_FLAGS) /subsystem:console /out:$@ $** +!if "$(MT)" != "" +# The previous link command created a .manifest file that we want to +# insert into the linked artifact so we do not need to track it +# separately. Use ";#2" for .dll and ";#1" for .exe: + $(MT) /manifest $@.manifest /outputresource:$@;#1 +!endif $(GENERATED_NAMES_IN_INCL): $(Platform_arch_model).ad adlc.exe includeDB.current rm -f $(GENERATED_NAMES) diff --git a/hotspot/make/windows/makefiles/compile.make b/hotspot/make/windows/makefiles/compile.make index bf6f3be9b2e..ddc9ea11a9f 100644 --- a/hotspot/make/windows/makefiles/compile.make +++ b/hotspot/make/windows/makefiles/compile.make @@ -30,7 +30,7 @@ CPP=cl.exe # /W3 Warning level 3 # /Zi Include debugging information # /WX Treat any warning error as a fatal error -# /MD Use dynamic multi-threaded runtime (msvcrt.dll or msvc*71.dll) +# /MD Use dynamic multi-threaded runtime (msvcrt.dll or msvc*NN.dll) # /MTd Use static multi-threaded runtime debug versions # /O1 Optimize for size (/Os), skips /Oi # /O2 Optimize for speed (/Ot), adds /Oi to /O1 @@ -80,8 +80,10 @@ CPP_FLAGS=$(CPP_FLAGS) /D "IA32" CPP=ARCH_ERROR !endif -# MSC_VER is a 4 digit number that tells us what compiler is being used, it is -# generated when the local.make file is created by the script gen_msc_ver.sh. +# MSC_VER is a 4 digit number that tells us what compiler is being used +# and is generated when the local.make file is created by build.make +# via the script get_msc_ver.sh +# # If MSC_VER is set, it overrides the above default setting. # But it should be set. # Possible values: @@ -89,13 +91,14 @@ CPP=ARCH_ERROR # 1300 and 1310 is VS2003 or VC7 # 1399 is our fake number for the VS2005 compiler that really isn't 1400 # 1400 is for VS2005 +# 1500 is for VS2008 # Do not confuse this MSC_VER with the predefined macro _MSC_VER that the # compiler provides, when MSC_VER==1399, _MSC_VER will be 1400. # Normally they are the same, but a pre-release of the VS2005 compilers # in the Windows 64bit Platform SDK said it was 1400 when it was really # closer to VS2003 in terms of option spellings, so we use 1399 for that # 1400 version that really isn't 1400. -# See the file gen_msc_ver.sh for more info. +# See the file get_msc_ver.sh for more info. !if "x$(MSC_VER)" == "x" COMPILER_NAME=$(DEFAULT_COMPILER_NAME) !else @@ -115,6 +118,9 @@ COMPILER_NAME=VS2003 !if "$(MSC_VER)" == "1400" COMPILER_NAME=VS2005 !endif +!if "$(MSC_VER)" == "1500" +COMPILER_NAME=VS2008 +!endif !endif # Add what version of the compiler we think this is to the compile line @@ -160,7 +166,25 @@ GX_OPTION = /EHsc # externals at link time. Even with /GS-, you need bufferoverflowU.lib. # NOTE: Currently we decided to not use /GS- BUFFEROVERFLOWLIB = bufferoverflowU.lib -LINK_FLAGS = $(LINK_FLAGS) $(BUFFEROVERFLOWLIB) +LINK_FLAGS = /manifest $(LINK_FLAGS) $(BUFFEROVERFLOWLIB) +# Manifest Tool - used in VS2005 and later to adjust manifests stored +# as resources inside build artifacts. +MT=mt.exe +!if "$(BUILDARCH)" == "i486" +# VS2005 on x86 restricts the use of certain libc functions without this +CPP_FLAGS=$(CPP_FLAGS) /D _CRT_SECURE_NO_DEPRECATE +!endif +!endif + +!if "$(COMPILER_NAME)" == "VS2008" +PRODUCT_OPT_OPTION = /O2 /Oy- +FASTDEBUG_OPT_OPTION = /O2 /Oy- +DEBUG_OPT_OPTION = /Od +GX_OPTION = /EHsc +LINK_FLAGS = /manifest $(LINK_FLAGS) +# Manifest Tool - used in VS2005 and later to adjust manifests stored +# as resources inside build artifacts. +MT=mt.exe !if "$(BUILDARCH)" == "i486" # VS2005 on x86 restricts the use of certain libc functions without this CPP_FLAGS=$(CPP_FLAGS) /D _CRT_SECURE_NO_DEPRECATE diff --git a/hotspot/make/windows/makefiles/debug.make b/hotspot/make/windows/makefiles/debug.make index afd987d9cd0..9bb52cce24c 100644 --- a/hotspot/make/windows/makefiles/debug.make +++ b/hotspot/make/windows/makefiles/debug.make @@ -50,6 +50,12 @@ $(AOUT): $(Res_Files) $(Obj_Files) $(LINK) @<< $(LINK_FLAGS) /out:$@ /implib:$*.lib /def:vm.def $(Obj_Files) $(Res_Files) << +!if "$(MT)" != "" +# The previous link command created a .manifest file that we want to +# insert into the linked artifact so we do not need to track it +# separately. Use ";#2" for .dll and ";#1" for .exe: + $(MT) /manifest $@.manifest /outputresource:$@;#2 +!endif !include $(WorkSpace)/make/windows/makefiles/shared.make !include $(WorkSpace)/make/windows/makefiles/sa.make diff --git a/hotspot/make/windows/makefiles/defs.make b/hotspot/make/windows/makefiles/defs.make index 4b2fc14b3e2..c264f9fd103 100644 --- a/hotspot/make/windows/makefiles/defs.make +++ b/hotspot/make/windows/makefiles/defs.make @@ -25,7 +25,7 @@ # The common definitions for hotspot windows builds. # Include the top level defs.make under make directory instead of this one. # This file is included into make/defs.make. -# On windows it is only used to construct parameters for +# On windows it is only used to construct parameters for # make/windows/build.make when make/Makefile is used to build VM. SLASH_JAVA ?= J: @@ -69,7 +69,7 @@ endif JDK_INCLUDE_SUBDIR=win32 -# HOTSPOT_RELEASE_VERSION and HOTSPOT_BUILD_VERSION are defined +# HOTSPOT_RELEASE_VERSION and HOTSPOT_BUILD_VERSION are defined # and added to MAKE_ARGS list in $(GAMMADIR)/make/defs.make. # next parameters are defined in $(GAMMADIR)/make/defs.make. @@ -125,7 +125,7 @@ ifneq ($(ALT_BUILD_WIN_SA),) endif ifeq ($(BUILD_WIN_SA), 1) - ifeq ($(ARCH),ia64) + ifeq ($(ARCH),ia64) BUILD_WIN_SA = 0 endif endif @@ -154,7 +154,7 @@ ifeq ($(BUILD_WIN_SA), 1) EXPORT_LIST += $(EXPORT_JRE_BIN_DIR)/sawindbg.dll EXPORT_LIST += $(EXPORT_JRE_BIN_DIR)/sawindbg.pdb EXPORT_LIST += $(EXPORT_JRE_BIN_DIR)/sawindbg.map - EXPORT_LIST += $(EXPORT_LIB_DIR)/sa-jdi.jar + EXPORT_LIST += $(EXPORT_LIB_DIR)/sa-jdi.jar # Must pass this down to nmake. MAKE_ARGS += BUILD_WIN_SA=1 endif diff --git a/hotspot/make/windows/makefiles/fastdebug.make b/hotspot/make/windows/makefiles/fastdebug.make index 064592bffe4..e15aaaae493 100644 --- a/hotspot/make/windows/makefiles/fastdebug.make +++ b/hotspot/make/windows/makefiles/fastdebug.make @@ -50,6 +50,13 @@ $(AOUT): $(Res_Files) $(Obj_Files) $(LINK) @<< $(LINK_FLAGS) /out:$@ /implib:$*.lib /def:vm.def $(Obj_Files) $(Res_Files) << +!if "$(MT)" != "" +# The previous link command created a .manifest file that we want to +# insert into the linked artifact so we do not need to track it +# separately. Use ";#2" for .dll and ";#1" for .exe: + $(MT) /manifest $@.manifest /outputresource:$@;#2 +!endif + !include $(WorkSpace)/make/windows/makefiles/shared.make !include $(WorkSpace)/make/windows/makefiles/sa.make diff --git a/hotspot/make/windows/makefiles/product.make b/hotspot/make/windows/makefiles/product.make index a143d6c99b5..a26ffbcffd3 100644 --- a/hotspot/make/windows/makefiles/product.make +++ b/hotspot/make/windows/makefiles/product.make @@ -61,6 +61,12 @@ $(AOUT): $(Res_Files) $(Obj_Files) $(LINK_FLAGS) /out:$@ /implib:$*.lib /def:vm.def $(Obj_Files) $(Res_Files) << !endif +!if "$(MT)" != "" +# The previous link command created a .manifest file that we want to +# insert into the linked artifact so we do not need to track it +# separately. Use ";#2" for .dll and ";#1" for .exe: + $(MT) /manifest $@.manifest /outputresource:$@;#2 +!endif !include $(WorkSpace)/make/windows/makefiles/shared.make !include $(WorkSpace)/make/windows/makefiles/sa.make diff --git a/hotspot/make/windows/makefiles/sa.make b/hotspot/make/windows/makefiles/sa.make index 57fd493f823..01886c13804 100644 --- a/hotspot/make/windows/makefiles/sa.make +++ b/hotspot/make/windows/makefiles/sa.make @@ -92,13 +92,18 @@ SA_LINK_FLAGS = bufferoverflowU.lib !else SA_CFLAGS = /nologo $(MS_RUNTIME_OPTION) /W3 /Gm $(GX_OPTION) /ZI /Od /D "WIN32" /D "_WINDOWS" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c !endif - +!if "$(MT)" != "" + SA_LINK_FLAGS = /manifest $(SA_LINK_FLAGS) +!endif SASRCFILE = $(AGENT_DIR)/src/os/win32/windbg/sawindbg.cpp SA_LFLAGS = $(SA_LINK_FLAGS) /nologo /subsystem:console /map /debug /machine:$(MACHINE) # Note that we do not keep sawindbj.obj around as it would then # get included in the dumpbin command in build_vm_def.sh +# In VS2005 or VS2008 the link command creates a .manifest file that we want +# to insert into the linked artifact so we do not need to track it separately. +# Use ";#2" for .dll and ";#1" for .exe in the MT command below: $(SAWINDBG): $(SASRCFILE) set INCLUDE=$(SA_INCLUDE)$(INCLUDE) $(CPP) @<< @@ -109,6 +114,9 @@ $(SAWINDBG): $(SASRCFILE) << set LIB=$(SA_LIB)$(LIB) $(LINK) /out:$@ /DLL sawindbg.obj dbgeng.lib $(SA_LFLAGS) +!if "$(MT)" != "" + $(MT) /manifest $(@F).manifest /outputresource:$(@F);#2 +!endif -@rm -f sawindbg.obj cleanall : diff --git a/hotspot/src/cpu/x86/vm/register_definitions_x86.cpp b/hotspot/src/cpu/x86/vm/register_definitions_x86.cpp index 1be2c138211..0aceac81405 100644 --- a/hotspot/src/cpu/x86/vm/register_definitions_x86.cpp +++ b/hotspot/src/cpu/x86/vm/register_definitions_x86.cpp @@ -22,9 +22,6 @@ * */ -// make sure the defines don't screw up the declarations later on in this file -#define DONT_USE_REGISTER_DEFINES - #include "incls/_precompiled.incl" #include "incls/_register_definitions_x86.cpp.incl" From 1716627be03d0e4ffa17399b68470ac9a168f061 Mon Sep 17 00:00:00 2001 From: Tom Rodriguez Date: Tue, 11 Nov 2008 23:03:35 -0800 Subject: [PATCH 119/267] 6758445: loop heads that are exception entry points can crash during count_edges/mark_loops Reviewed-by: kvn, jrose --- hotspot/src/share/vm/c1/c1_IR.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/hotspot/src/share/vm/c1/c1_IR.cpp b/hotspot/src/share/vm/c1/c1_IR.cpp index 005114b46e2..ccb6abfbbd7 100644 --- a/hotspot/src/share/vm/c1/c1_IR.cpp +++ b/hotspot/src/share/vm/c1/c1_IR.cpp @@ -574,12 +574,23 @@ void ComputeLinearScanOrder::count_edges(BlockBegin* cur, BlockBegin* parent) { TRACE_LINEAR_SCAN(3, tty->print_cr("backward branch")); assert(is_visited(cur), "block must be visisted when block is active"); assert(parent != NULL, "must have parent"); - assert(parent->number_of_sux() == 1, "loop end blocks must have one successor (critical edges are split)"); cur->set(BlockBegin::linear_scan_loop_header_flag); cur->set(BlockBegin::backward_branch_target_flag); parent->set(BlockBegin::linear_scan_loop_end_flag); + + // When a loop header is also the start of an exception handler, then the backward branch is + // an exception edge. Because such edges are usually critical edges which cannot be split, the + // loop must be excluded here from processing. + if (cur->is_set(BlockBegin::exception_entry_flag)) { + // Make sure that dominators are correct in this weird situation + _iterative_dominators = true; + return; + } + assert(parent->number_of_sux() == 1 && parent->sux_at(0) == cur, + "loop end blocks must have one successor (critical edges are split)"); + _loop_end_blocks.append(parent); return; } From 9f36c3b7c7479d2d54e28b989610274ce691d8af Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Wed, 12 Nov 2008 16:00:22 +0800 Subject: [PATCH 120/267] 6733095: Failure when SPNEGO request non-Mutual Reviewed-by: valeriep --- .../sun/security/jgss/GSSContextImpl.java | 5 +- .../security/jgss/spnego/SpNegoContext.java | 19 +++--- jdk/test/sun/security/krb5/auto/Context.java | 8 +++ .../security/krb5/auto/NonMutualSpnego.java | 58 +++++++++++++++++++ 4 files changed, 77 insertions(+), 13 deletions(-) create mode 100644 jdk/test/sun/security/krb5/auto/NonMutualSpnego.java diff --git a/jdk/src/share/classes/sun/security/jgss/GSSContextImpl.java b/jdk/src/share/classes/sun/security/jgss/GSSContextImpl.java index a506394703b..046f6478277 100644 --- a/jdk/src/share/classes/sun/security/jgss/GSSContextImpl.java +++ b/jdk/src/share/classes/sun/security/jgss/GSSContextImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2006 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2000-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 @@ -284,7 +284,8 @@ class GSSContextImpl implements GSSContext { ByteArrayOutputStream bos = new ByteArrayOutputStream(100); acceptSecContext(new ByteArrayInputStream(inTok, offset, len), bos); - return bos.toByteArray(); + byte[] out = bos.toByteArray(); + return (out.length == 0) ? null : out; } public void acceptSecContext(InputStream inStream, diff --git a/jdk/src/share/classes/sun/security/jgss/spnego/SpNegoContext.java b/jdk/src/share/classes/sun/security/jgss/spnego/SpNegoContext.java index 5ea5cd36aea..7185b0e08a7 100644 --- a/jdk/src/share/classes/sun/security/jgss/spnego/SpNegoContext.java +++ b/jdk/src/share/classes/sun/security/jgss/spnego/SpNegoContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2005-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 @@ -413,13 +413,14 @@ public class SpNegoContext implements GSSContextSpi { // pull out the mechanism token byte[] accept_token = targToken.getResponseToken(); if (accept_token == null) { - // return wth failure - throw new GSSException(errorCode, -1, - "mechansim token from server is null"); + if (!isMechContextEstablished()) { + // return with failure + throw new GSSException(errorCode, -1, + "mechanism token from server is null"); + } + } else { + mechToken = GSS_initSecContext(accept_token); } - - mechToken = GSS_initSecContext(accept_token); - // verify MIC if (!GSSUtil.useMSInterop()) { byte[] micToken = targToken.getMechListMIC(); @@ -428,7 +429,6 @@ public class SpNegoContext implements GSSContextSpi { "verification of MIC on MechList Failed!"); } } - if (isMechContextEstablished()) { state = STATE_DONE; retVal = mechToken; @@ -556,9 +556,6 @@ public class SpNegoContext implements GSSContextSpi { // get the token for mechanism byte[] accept_token = GSS_acceptSecContext(mechToken); - if (accept_token == null) { - valid = false; - } // verify MIC if (!GSSUtil.useMSInterop() && valid) { diff --git a/jdk/test/sun/security/krb5/auto/Context.java b/jdk/test/sun/security/krb5/auto/Context.java index 9f52dad1f1a..4bdaa252842 100644 --- a/jdk/test/sun/security/krb5/auto/Context.java +++ b/jdk/test/sun/security/krb5/auto/Context.java @@ -360,6 +360,10 @@ public class Context { if (me.x.isEstablished()) { me.f = true; System.out.println(c.name + " side established"); + if (input != null) { + throw new Exception("Context established but " + + "still receive token at " + c.name); + } return null; } else { System.out.println(c.name + " call initSecContext"); @@ -374,6 +378,10 @@ public class Context { if (me.x.isEstablished()) { me.f = true; System.out.println(s.name + " side established"); + if (input != null) { + throw new Exception("Context established but " + + "still receive token at " + s.name); + } return null; } else { System.out.println(s.name + " called acceptSecContext"); diff --git a/jdk/test/sun/security/krb5/auto/NonMutualSpnego.java b/jdk/test/sun/security/krb5/auto/NonMutualSpnego.java new file mode 100644 index 00000000000..f2e7812c3ed --- /dev/null +++ b/jdk/test/sun/security/krb5/auto/NonMutualSpnego.java @@ -0,0 +1,58 @@ +/* + * 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. + * + * 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 6733095 + * @summary Failure when SPNEGO request non-Mutual + */ + +import sun.security.jgss.GSSUtil; + +public class NonMutualSpnego { + + public static void main(String[] args) + throws Exception { + + // Create and start the KDC + new OneKDC(null).writeJAASConf(); + new NonMutualSpnego().go(); + } + + void go() throws Exception { + Context c = Context.fromJAAS("client"); + Context s = Context.fromJAAS("server"); + + c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_SPNEGO_MECH_OID); + c.x().requestMutualAuth(false); + s.startAsServer(GSSUtil.GSS_SPNEGO_MECH_OID); + + Context.handshake(c, s); + + Context.transmit("i say high --", c, s); + Context.transmit(" you say low", s, c); + + c.dispose(); + s.dispose(); + } +} From 5c6f569aa54178cfc02d9c98410b3bb89a6d05b0 Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Wed, 12 Nov 2008 16:01:06 +0800 Subject: [PATCH 121/267] 6765491: Krb5LoginModule a little too restrictive, and the doc is not clear Reviewed-by: valeriep --- .../security/auth/module/Krb5LoginModule.java | 116 ++++++----- jdk/test/sun/security/krb5/auto/Context.java | 17 +- jdk/test/sun/security/krb5/auto/KDC.java | 25 ++- .../krb5/auto/LoginModuleOptions.java | 184 ++++++++++++++++++ 4 files changed, 290 insertions(+), 52 deletions(-) create mode 100644 jdk/test/sun/security/krb5/auto/LoginModuleOptions.java diff --git a/jdk/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java b/jdk/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java index 7562f584ada..55972eefe89 100644 --- a/jdk/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java +++ b/jdk/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java @@ -86,6 +86,8 @@ import sun.misc.HexDumpEncoder; * the principal name from the configuration is used. In the * case where the principal property is not set and the principal * entry also does not exist, the user is prompted for the name. + * When this property of entry is set, and useTicketCache + * is set to true, only TGT belonging to this principal is used. * *

      The following is a list of configuration options supported * for Krb5LoginModule: @@ -101,18 +103,19 @@ import sun.misc.HexDumpEncoder; * to false if you do not want this module to use the ticket cache. * (Default is False). * This module will - * search for the tickect + * search for the ticket * cache in the following locations: - * For Windows 2000, it will use Local Security Authority (LSA) API - * to get the TGT. On Solaris and Linux + * On Solaris and Linux * it will look for the ticket cache in /tmp/krb5cc_uid * where the uid is numeric user * identifier. If the ticket cache is - * not available in either of the above locations, or if we are on a - * different Windows platform, it will look for the cache as + * not available in the above location, or if we are on a + * Windows platform, it will look for the cache as * {user.home}{file.separator}krb5cc_{user.name}. * You can override the ticket cache location by using - * ticketCache + * ticketCache. + * For Windows, if a ticket cannot be retrieved from the file ticket cache, + * it will use Local Security Authority (LSA) API to get the TGT. *

      *

      ticketCache:
      *
      Set this to the name of the ticket @@ -129,20 +132,20 @@ import sun.misc.HexDumpEncoder; *
      doNotPrompt:
      *
      Set this to true if you do not want to be * prompted for the password - * if credentials can - * not be obtained from the cache or keytab.(Default is false) - * If set to true authentication will fail if credentials can - * not be obtained from the cache or keytab.
      + * if credentials can not be obtained from the cache, the keytab, + * or through shared state.(Default is false) + * If set to true, credential must be obtained through cache, keytab, + * or shared state. Otherwise, authentication will fail. *

      *

      useKeyTab:
      *
      Set this to true if you * want the module to get the principal's key from the * the keytab.(default value is False) - * If keyatb + * If keytab * is not set then * the module will locate the keytab from the - * Kerberos configuration file.
      - * If it is not specifed in the Kerberos configuration file + * Kerberos configuration file. + * If it is not specified in the Kerberos configuration file * then it will look for the file * {user.home}{file.separator}krb5.keytab. *

      @@ -210,20 +213,34 @@ import sun.misc.HexDumpEncoder; * exist for the username and password in the shared * state, or if authentication fails. * - * clearPass if, true, this LoginModule clears the - * username and password stored in the module's shared - * state after both phases of authentication - * (login and commit) have completed. + * clearPass if, true, this LoginModule clears the + * username and password stored in the module's shared + * state after both phases of authentication + * (login and commit) have completed. * + *

      If the principal system property or key is already provided, the value of + * "javax.security.auth.login.name" in the shared state is ignored. + *

      When multiple mechanisms to retrieve a ticket or key is provided, the + * preference order looks like this: + *

        + *
      1. ticket cache + *
      2. keytab + *
      3. shared state + *
      4. user prompt + *
      + *

      Note that if any step fails, it will fallback to the next step. + * There's only one exception, it the shared state step fails and + * useFirstPass=true, no user prompt is made. *

      Examples of some configuration values for Krb5LoginModule in * JAAS config file and the results are: *

        *

        doNotPrompt=true; *

      - *

      This is an illegal combination since useTicketCache - * is not set and the user can not be prompted for the password. + *

      This is an illegal combination since none of useTicketCache, + * useKeyTab, useFirstPass and tryFirstPass + * is set and the user can not be prompted for the password. *

        - *

        ticketCache = < filename >; + *

        ticketCache = <filename>; *

      *

      This is an illegal combination since useTicketCache * is not set to true and the ticketCache is set. A configuration error @@ -240,9 +257,9 @@ import sun.misc.HexDumpEncoder; * *

      This is an illegal combination since storeKey is set to * true but the key can not be obtained either by prompting the user or from - * the keytab.A configuration error will occur. + * the keytab, or from the shared state. A configuration error will occur. *

        - *

        keyTab = < filename > doNotPrompt=true ; + *

        keyTab = <filename> doNotPrompt=true ; *

      *

      This is an illegal combination since useKeyTab is not set to true and * the keyTab is set. A configuration error will occur. @@ -260,7 +277,7 @@ import sun.misc.HexDumpEncoder; * with the principal and TGT. If the TGT is not available, * do not prompt the user, instead fail the authentication. *

        - *

        principal=< name >useTicketCache = true + *

        principal=<name>useTicketCache = true * doNotPrompt=true; *

      *

      Get the TGT from the default cache for the principal and populate the @@ -269,9 +286,9 @@ import sun.misc.HexDumpEncoder; * authentication will fail. *

        *

        useTicketCache = true - * ticketCache=< file name >useKeyTab = true - * keyTab=< keytab filename > - * principal = < principal name > + * ticketCache=<file name>useKeyTab = true + * keyTab=<keytab filename> + * principal = <principal name> * doNotPrompt=true; *

      *

      Search the cache for the principal's TGT. If it is not available @@ -281,7 +298,7 @@ import sun.misc.HexDumpEncoder; * If the key is not available or valid then authentication will fail. *

        *

        useTicketCache = true - * ticketCache=< file name > + * ticketCache=<file name> *

      *

      The TGT will be obtained from the cache specified. * The Kerberos principal name used will be the principal name in @@ -292,8 +309,8 @@ import sun.misc.HexDumpEncoder; * The Subject will be populated with the TGT. *

        *

        useKeyTab = true - * keyTab=< keytab filename > - * principal= < principal name > + * keyTab=<keytab filename> + * principal= <principal name> * storeKey=true; *

      *

      The key for the principal will be retrieved from the keytab. @@ -303,7 +320,7 @@ import sun.misc.HexDumpEncoder; * password entered. *

        *

        useKeyTab = true - * keyTab=< keytabname > + * keyTab=<keytabname> * storeKey=true * doNotPrompt=true; *

      @@ -316,21 +333,23 @@ import sun.misc.HexDumpEncoder; * Subject's private credentials set. Otherwise the authentication will * fail. *
        - *

        useKeyTab = true - * keyTab=< file name > storeKey=true - * principal= < principal name > + *

        * useTicketCache=true - * ticketCache=< file name >; + * ticketCache=<file name>; + * useKeyTab = true + * keyTab=<file name> storeKey=true + * principal= <principal name> *

      - *

      The principal's key will be retrieved from the keytab and added - * to the Subject's private credentials. If the key - * is not available, the - * user will be prompted for the password; the key derived from the password - * will be added to the Subject's private credentials set. The - * client's TGT will be retrieved from the ticket cache and added to the + *

      + * The client's TGT will be retrieved from the ticket cache and added to the * Subject's private credentials. If the TGT is not available - * in the ticket cache, it will be obtained using the authentication + * in the ticket cache, or the TGT's client name does not match the principal + * name, Java will use a secret key to obtain the TGT using the authentication * exchange and added to the Subject's private credentials. + * This secret key will be first retrieved from the keytab. If the key + * is not available, the user will be prompted for the password. In either + * case, the key derived from the password will be added to the + * Subject's private credentials set. *

        *

        isInitiator = false *

      @@ -856,11 +875,13 @@ public class Krb5LoginModule implements LoginModule { } private void validateConfiguration() throws LoginException { - if (doNotPrompt && !useTicketCache && !useKeyTab) + if (doNotPrompt && !useTicketCache && !useKeyTab + && !tryFirstPass && !useFirstPass) throw new LoginException ("Configuration Error" + " - either doNotPrompt should be " - + " false or useTicketCache/useKeyTab " + + " false or at least one of useTicketCache, " + + " useKeyTab, tryFirstPass and useFirstPass" + " should be true"); if (ticketCacheName != null && !useTicketCache) throw new LoginException @@ -872,11 +893,12 @@ public class Krb5LoginModule implements LoginModule { throw new LoginException ("Configuration Error - useKeyTab should be set to true " + "to use the keytab" + keyTabName); - if (storeKey && doNotPrompt && !useKeyTab) + if (storeKey && doNotPrompt && !useKeyTab + && !tryFirstPass && !useFirstPass) throw new LoginException - ("Configuration Error - either doNotPrompt " - + "should be set to false or " - + "useKeyTab must be set to true for storeKey option"); + ("Configuration Error - either doNotPrompt should be set to " + + " false or at least one of tryFirstPass, useFirstPass " + + "or useKeyTab must be set to true for storeKey option"); if (renewTGT && !useTicketCache) throw new LoginException ("Configuration Error" diff --git a/jdk/test/sun/security/krb5/auto/Context.java b/jdk/test/sun/security/krb5/auto/Context.java index 4bdaa252842..2439aa24037 100644 --- a/jdk/test/sun/security/krb5/auto/Context.java +++ b/jdk/test/sun/security/krb5/auto/Context.java @@ -109,13 +109,22 @@ public class Context { out.s = new Subject(); Krb5LoginModule krb5 = new Krb5LoginModule(); Map map = new HashMap(); - map.put("tryFirstPass", "true"); + Map shared = new HashMap(); + + if (pass != null) { + map.put("useFirstPass", "true"); + shared.put("javax.security.auth.login.name", user); + shared.put("javax.security.auth.login.password", pass); + } else { + map.put("doNotPrompt", "true"); + map.put("useTicketCache", "true"); + if (user != null) { + map.put("principal", user); + } + } if (storeKey) { map.put("storeKey", "true"); } - Map shared = new HashMap(); - shared.put("javax.security.auth.login.name", user); - shared.put("javax.security.auth.login.password", pass); krb5.initialize(out.s, null, shared, map); krb5.login(); diff --git a/jdk/test/sun/security/krb5/auto/KDC.java b/jdk/test/sun/security/krb5/auto/KDC.java index a875e090bb5..3e6a7792644 100644 --- a/jdk/test/sun/security/krb5/auto/KDC.java +++ b/jdk/test/sun/security/krb5/auto/KDC.java @@ -32,6 +32,7 @@ import java.util.*; import java.util.concurrent.*; import sun.security.krb5.*; import sun.security.krb5.internal.*; +import sun.security.krb5.internal.ccache.CredentialsCache; import sun.security.krb5.internal.crypto.KeyUsage; import sun.security.krb5.internal.ktab.KeyTab; import sun.security.util.DerInputStream; @@ -765,7 +766,29 @@ public class KDC { DerOutputStream out = new DerOutputStream(); out.write(DerValue.createTag(DerValue.TAG_APPLICATION, true, (byte)Krb5.KRB_AS_REP), asRep.asn1Encode()); - return out.toByteArray(); + byte[] result = out.toByteArray(); + + // Added feature: + // Write the current issuing TGT into a ccache file specified + // by the system property below. + String ccache = System.getProperty("test.kdc.save.ccache"); + if (ccache != null) { + asRep.encKDCRepPart = enc_part; + sun.security.krb5.internal.ccache.Credentials credentials = + new sun.security.krb5.internal.ccache.Credentials(asRep); + asReq.reqBody.cname.setRealm(getRealm()); + CredentialsCache cache = + CredentialsCache.create(asReq.reqBody.cname, ccache); + if (cache == null) { + throw new IOException("Unable to create the cache file " + + ccache); + } + cache.update(credentials); + cache.save(); + new File(ccache).deleteOnExit(); + } + + return result; } catch (KrbException ke) { ke.printStackTrace(System.out); KRBError kerr = ke.getError(); diff --git a/jdk/test/sun/security/krb5/auto/LoginModuleOptions.java b/jdk/test/sun/security/krb5/auto/LoginModuleOptions.java new file mode 100644 index 00000000000..4c0dd73b8d5 --- /dev/null +++ b/jdk/test/sun/security/krb5/auto/LoginModuleOptions.java @@ -0,0 +1,184 @@ +/* + * 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. + * + * 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 6765491 + * @summary Krb5LoginModule a little too restrictive, and the doc is not clear. + */ +import com.sun.security.auth.module.Krb5LoginModule; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import javax.security.auth.Subject; +import javax.security.auth.callback.Callback; +import javax.security.auth.callback.CallbackHandler; +import javax.security.auth.callback.NameCallback; +import javax.security.auth.callback.PasswordCallback; +import javax.security.auth.callback.UnsupportedCallbackException; + +public class LoginModuleOptions { + + private static final String NAME = "javax.security.auth.login.name"; + private static final String PWD = "javax.security.auth.login.password"; + + public static void main(String[] args) throws Exception { + OneKDC kdc = new OneKDC(null); + kdc.addPrincipal("foo", "bar".toCharArray()); + kdc.writeKtab(OneKDC.KTAB); // rewrite to add foo + + // All 4 works: keytab, shared state, callback, cache + login(null, "useKeyTab", "true", "principal", "dummy"); + login(null, "tryFirstPass", "true", NAME, OneKDC.USER, + PWD, OneKDC.PASS); + System.setProperty("test.kdc.save.ccache", "krbcc"); + login(new MyCallback(OneKDC.USER, OneKDC.PASS)); // save the cache + System.clearProperty("test.kdc.save.ccache"); + login(null, "useTicketCache", "true", "ticketCache", "krbcc"); + + // Fallbacks + // 1. ccache -> keytab + login(null, "useTicketCache", "true", "ticketCache", "krbcc_non_exists", + "useKeyTab", "true", "principal", "dummy"); + // 2. keytab -> shared + login(null, "useKeyTab", "true", "principal", "dummy", + "keyTab", "ktab_non_exist", + "tryFirstPass", "true", NAME, OneKDC.USER, PWD, OneKDC.PASS); + // 3. shared -> callback + // 3.1. useFirstPass, no callback + boolean failed = false; + try { + login(new MyCallback(OneKDC.USER, OneKDC.PASS), + "useFirstPass", "true", + NAME, OneKDC.USER, PWD, "haha".toCharArray()); + } catch (Exception e) { + failed = true; + } + if (!failed) { + throw new Exception("useFirstPass should not fallback to callback"); + } + // 3.2. tryFirstPass, has callback + login(new MyCallback(OneKDC.USER, OneKDC.PASS), + "tryFirstPass", "true", + NAME, OneKDC.USER, PWD, "haha".toCharArray()); + + // Preferences of type + // 1. ccache preferred to keytab + login(new MyCallback("foo", null), + "useTicketCache", "true", "ticketCache", "krbcc", + "useKeyTab", "true"); + // 2. keytab preferred to shared. This test case is not exactly correct, + // because principal=dummy would shadow the PWD setting in the shared + // state. So by only looking at the final authentication user name + // (which is how this program does), there's no way to tell if keyTab + // is picked first, or shared is tried first but fallback to keytab. + login(null, "useKeyTab", "true", "principal", "dummy", + "tryFirstPass", "true", NAME, "foo", PWD, "bar".toCharArray()); + // 3. shared preferred to callback + login(new MyCallback("foo", "bar".toCharArray()), + "tryFirstPass", "true", NAME, OneKDC.USER, PWD, OneKDC.PASS); + + // Preferences of username + // 1. principal preferred to NAME (NAME can be wrong or missing) + login(null, "principal", OneKDC.USER, + "tryFirstPass", "true", NAME, "someone_else", PWD, OneKDC.PASS); + login(null, "principal", OneKDC.USER, + "tryFirstPass", "true", PWD, OneKDC.PASS); + // 2. NAME preferred to callback + login(new MyCallback("someone_else", OneKDC.PASS), + "principal", OneKDC.USER); + // 3. With tryFirstPass, NAME preferred to callback + login(new MyCallback("someone_else", null), + "tryFirstPass", "true", NAME, OneKDC.USER, PWD, OneKDC.PASS); + // 3.1. you must provide a NAME (when there's no principal) + failed = false; + try { + login(new MyCallback(OneKDC.USER, null), + "tryFirstPass", "true", PWD, OneKDC.PASS); + } catch (Exception e) { + failed = true; + } + if (!failed) { + throw new Exception("useFirstPass must provide a NAME"); + } + // 3.2 Hybrid, you can use NAME as "", and provide it using callback. + // I don't think this is designed. + login(new MyCallback(OneKDC.USER, null), + "tryFirstPass", "true", NAME, "", PWD, OneKDC.PASS); + + // Test for the bug fix: doNotPrompt can be true if tryFirstPass=true + login(null, "doNotPrompt", "true", "storeKey", "true", + "tryFirstPass", "true", NAME, OneKDC.USER, PWD, OneKDC.PASS); + } + + static void login(CallbackHandler callback, Object... options) + throws Exception { + Krb5LoginModule krb5 = new Krb5LoginModule(); + Subject subject = new Subject(); + Map map = new HashMap(); + Map shared = new HashMap(); + + int count = options.length / 2; + for (int i = 0; i < count; i++) { + String key = (String) options[2 * i]; + Object value = options[2 * i + 1]; + if (key.startsWith("javax")) { + shared.put(key, value); + } else { + map.put(key, (String) value); + } + } + krb5.initialize(subject, callback, shared, map); + krb5.login(); + krb5.commit(); + if (!subject.getPrincipals().iterator().next() + .getName().startsWith(OneKDC.USER)) { + throw new Exception("The authenticated is not " + OneKDC.USER); + } + } + + static class MyCallback implements CallbackHandler { + + private String name; + private char[] password; + + public MyCallback(String name, char[] password) { + this.name = name; + this.password = password; + } + + public void handle(Callback[] callbacks) { + for (Callback callback : callbacks) { + System.err.println(callback); + if (callback instanceof NameCallback) { + System.err.println("name is " + name); + ((NameCallback) callback).setName(name); + } + if (callback instanceof PasswordCallback) { + System.err.println("pass is " + new String(password)); + ((PasswordCallback) callback).setPassword(password); + } + } + } + } +} From 454f269528efba912ed29bfa488c3c2a36bfd6e4 Mon Sep 17 00:00:00 2001 From: Maurizio Cimadamore Date: Wed, 12 Nov 2008 14:17:03 +0000 Subject: [PATCH 122/267] 6768932: Add support for multiline diagnostics Added basic support for multiline/tabular diagnostics Reviewed-by: jjg --- .../util/AbstractDiagnosticFormatter.java | 66 ++++++++++++++++++- .../com/sun/tools/javac/util/AbstractLog.java | 6 ++ .../sun/tools/javac/util/JCDiagnostic.java | 41 +++++++++++- .../tools/javac/util/LayoutCharacters.java | 4 ++ .../classes/com/sun/tools/javac/util/Log.java | 8 +-- .../javac/util/MandatoryWarningHandler.java | 2 +- .../javac/util/RawDiagnosticFormatter.java | 14 ++++ 7 files changed, 132 insertions(+), 9 deletions(-) diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java b/langtools/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java index 9ac5788516a..e930c75d67b 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java +++ b/langtools/src/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java @@ -27,13 +27,13 @@ package com.sun.tools.javac.util; import java.util.Collection; import java.util.Locale; import javax.tools.JavaFileObject; -import java.util.ResourceBundle; import com.sun.tools.javac.api.DiagnosticFormatter; import com.sun.tools.javac.api.Formattable; import com.sun.tools.javac.api.DiagnosticFormatter.PositionKind; import com.sun.tools.javac.file.JavacFileManager; import static com.sun.tools.javac.util.JCDiagnostic.DiagnosticType.*; +import static com.sun.tools.javac.util.LayoutCharacters.*; /** * This abstract class provides a basic implementation of the functionalities that should be provided @@ -72,8 +72,13 @@ public abstract class AbstractDiagnosticFormatter implements DiagnosticFormatter public String formatMessage(JCDiagnostic d, Locale l) { //this code should rely on the locale settings but it's not! See RFE 6443132 + StringBuilder buf = new StringBuilder(); Collection args = formatArguments(d, l); - return localize(l, d.getCode(), args.toArray()); + buf.append(localize(l, d.getCode(), args.toArray())); + if (d.isMultiline()) { + buf.append(formatSubdiagnostics(d, l)); + } + return buf.toString(); } public String formatKind(JCDiagnostic d, Locale l) { @@ -165,6 +170,23 @@ public abstract class AbstractDiagnosticFormatter implements DiagnosticFormatter return sbuf.toString(); } + /** + * Format all the subdiagnostics attached to a given diagnostic + * + * @param d diagnostic whose subdiagnostics are to be formatted + * @param l locale object to be used for i18n + * @return string representation of the subdiagnostics + */ + protected String formatSubdiagnostics(JCDiagnostic d, Locale l) { + StringBuilder buf = new StringBuilder(); + for (JCDiagnostic d2 : d.getSubdiagnostics()) { + buf.append('\n'); + String subdiagMsg = format(d2, l); + buf.append(indent(subdiagMsg, DiagInc)); + } + return buf.toString(); + } + /** Format the faulty source code line and point to the error. * @param d The diagnostic for which the error line should be printed */ @@ -201,4 +223,44 @@ public abstract class AbstractDiagnosticFormatter implements DiagnosticFormatter public boolean displaySource(JCDiagnostic d) { return showSource && d.getType() != FRAGMENT; } + + /** + * Creates a string with a given amount of empty spaces. Useful for + * indenting the text of a diagnostic message. + * + * @param nSpaces the amount of spaces to be added to the result string + * @return the indentation string + */ + protected String indentString(int nSpaces) { + String spaces = " "; + if (nSpaces <= spaces.length()) + return spaces.substring(0, nSpaces); + else { + StringBuilder buf = new StringBuilder(); + for (int i = 0 ; i < nSpaces ; i++) + buf.append(" "); + return buf.toString(); + } + } + + /** + * Indent a string by prepending a given amount of empty spaces to each line + * of the string + * + * @param s the string to be indented + * @param nSpaces the amount of spaces that should be prepended to each line + * of the string + * @return an indented string + */ + protected String indent(String s, int nSpaces) { + String indent = indentString(nSpaces); + StringBuilder buf = new StringBuilder(); + String nl = ""; + for (String line : s.split("\n")) { + buf.append(nl); + buf.append(indent + line); + nl = "\n"; + } + return buf.toString(); + } } diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/AbstractLog.java b/langtools/src/share/classes/com/sun/tools/javac/util/AbstractLog.java index 1de1e825d6b..7f0440f0567 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/util/AbstractLog.java +++ b/langtools/src/share/classes/com/sun/tools/javac/util/AbstractLog.java @@ -67,6 +67,12 @@ public abstract class AbstractLog { return s; } + /** Return the underlying diagnostic source + */ + public DiagnosticSource currentSource() { + return source; + } + /** Report an error, unless another error was already reported at same * source position. * @param key The key for the localized error message. diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/JCDiagnostic.java b/langtools/src/share/classes/com/sun/tools/javac/util/JCDiagnostic.java index 2e8227fbba7..ba4f4c7c683 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/util/JCDiagnostic.java +++ b/langtools/src/share/classes/com/sun/tools/javac/util/JCDiagnostic.java @@ -289,7 +289,7 @@ public class JCDiagnostic implements Diagnostic { this.source = source; this.position = pos; this.key = key; - this.args = args; + this.args = args; int n = (pos == null ? Position.NOPOS : pos.getPreferredPosition()); if (n == Position.NOPOS || source == null) @@ -308,6 +308,18 @@ public class JCDiagnostic implements Diagnostic { return type; } + /** + * Get the subdiagnostic list + * @return subdiagnostic list + */ + public List getSubdiagnostics() { + return List.nil(); + } + + public boolean isMultiline() { + return false; + } + /** * Check whether or not this diagnostic is required to be shown. * @return true if this diagnostic is required to be shown. @@ -440,7 +452,32 @@ public class JCDiagnostic implements Diagnostic { } public String getMessage(Locale locale) { - // RFE 6406133: JCDiagnostic.getMessage ignores locale argument return defaultFormatter.formatMessage(this, locale); } + + public static class MultilineDiagnostic extends JCDiagnostic { + + private final List subdiagnostics; + + public MultilineDiagnostic(JCDiagnostic other, List subdiagnostics) { + super(other.defaultFormatter, + other.getType(), + other.isMandatory(), + other.getDiagnosticSource(), + other.position, + other.getCode(), + other.getArgs()); + this.subdiagnostics = subdiagnostics; + } + + @Override + public List getSubdiagnostics() { + return subdiagnostics; + } + + @Override + public boolean isMultiline() { + return true; + } + } } diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/LayoutCharacters.java b/langtools/src/share/classes/com/sun/tools/javac/util/LayoutCharacters.java index eb82069fdd6..a9ed2b62ee1 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/util/LayoutCharacters.java +++ b/langtools/src/share/classes/com/sun/tools/javac/util/LayoutCharacters.java @@ -39,6 +39,10 @@ public interface LayoutCharacters { */ final static int TabInc = 8; + /** Diagnostic standard indentation + */ + final static int DiagInc = 2; + /** Tabulator character. */ final static byte TAB = 0x8; diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/Log.java b/langtools/src/share/classes/com/sun/tools/javac/util/Log.java index 222ab4de301..e9d21f712d3 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/util/Log.java +++ b/langtools/src/share/classes/com/sun/tools/javac/util/Log.java @@ -190,9 +190,9 @@ public class Log extends AbstractLog { getSource(name).setEndPosTable(table); } - /** Return current source name. + /** Return current sourcefile. */ - public JavaFileObject currentSource() { + public JavaFileObject currentSourceFile() { return source == null ? null : source.getFile(); } @@ -395,7 +395,7 @@ public class Log extends AbstractLog { printLines(errWriter, "error: " + msg); } else { int line = source.getLineNumber(pos); - JavaFileObject file = currentSource(); + JavaFileObject file = source.getFile(); if (file != null) printLines(errWriter, JavacFileManager.getJavacFileName(file) + ":" + @@ -408,7 +408,7 @@ public class Log extends AbstractLog { /** report an error: */ public void rawError(int pos, String msg) { - if (nerrors < MaxErrors && shouldReport(currentSource(), pos)) { + if (nerrors < MaxErrors && shouldReport(currentSourceFile(), pos)) { printRawError(pos, msg); prompt(); nerrors++; diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/MandatoryWarningHandler.java b/langtools/src/share/classes/com/sun/tools/javac/util/MandatoryWarningHandler.java index 179955dc071..3e9fbbf203c 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/util/MandatoryWarningHandler.java +++ b/langtools/src/share/classes/com/sun/tools/javac/util/MandatoryWarningHandler.java @@ -118,7 +118,7 @@ public class MandatoryWarningHandler { * Report a mandatory warning. */ public void report(DiagnosticPosition pos, String msg, Object... args) { - JavaFileObject currentSource = log.currentSource(); + JavaFileObject currentSource = log.currentSourceFile(); if (verbose) { if (sourcesWithReportedWarnings == null) diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/RawDiagnosticFormatter.java b/langtools/src/share/classes/com/sun/tools/javac/util/RawDiagnosticFormatter.java index 5aa6ae35af2..433779764b5 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/util/RawDiagnosticFormatter.java +++ b/langtools/src/share/classes/com/sun/tools/javac/util/RawDiagnosticFormatter.java @@ -84,6 +84,20 @@ public class RawDiagnosticFormatter extends AbstractDiagnosticFormatter { return s; } + @Override + protected String formatSubdiagnostics(JCDiagnostic d, Locale l) { + StringBuilder buf = new StringBuilder(); + String sep = ""; + buf.append(",{"); + for (JCDiagnostic d2 : d.getSubdiagnostics()) { + buf.append(sep); + buf.append("(" + format(d2, l) + ")"); + sep = ","; + } + buf.append('}'); + return buf.toString(); + } + @Override protected String localize(Locale l, String s, Object... args) { StringBuffer buf = new StringBuffer(); From e9076296a9028294a8499a170264ab456b36658f Mon Sep 17 00:00:00 2001 From: Chris Hegarty Date: Wed, 12 Nov 2008 16:38:17 +0000 Subject: [PATCH 123/267] 6755625: Add HttpURLConnection.setFixedLengthStreamingMode(long) Reviewed-by: jccollet --- .../https/HttpsURLConnectionOldImpl.java | 4 ++ .../classes/java/net/HttpURLConnection.java | 64 ++++++++++++++++++- .../www/protocol/http/HttpURLConnection.java | 43 ++++++++----- .../https/HttpsURLConnectionImpl.java | 4 ++ .../bugs/FixedLengthInputStream.java | 28 +------- 5 files changed, 101 insertions(+), 42 deletions(-) diff --git a/jdk/src/share/classes/com/sun/net/ssl/internal/www/protocol/https/HttpsURLConnectionOldImpl.java b/jdk/src/share/classes/com/sun/net/ssl/internal/www/protocol/https/HttpsURLConnectionOldImpl.java index 8b34a2c3ceb..0e92d301f2f 100644 --- a/jdk/src/share/classes/com/sun/net/ssl/internal/www/protocol/https/HttpsURLConnectionOldImpl.java +++ b/jdk/src/share/classes/com/sun/net/ssl/internal/www/protocol/https/HttpsURLConnectionOldImpl.java @@ -497,6 +497,10 @@ public class HttpsURLConnectionOldImpl delegate.setFixedLengthStreamingMode(contentLength); } + public void setFixedLengthStreamingMode(long contentLength) { + delegate.setFixedLengthStreamingMode(contentLength); + } + public void setChunkedStreamingMode (int chunklen) { delegate.setChunkedStreamingMode(chunklen); } diff --git a/jdk/src/share/classes/java/net/HttpURLConnection.java b/jdk/src/share/classes/java/net/HttpURLConnection.java index eb21c7f3ba4..f35c3efa795 100644 --- a/jdk/src/share/classes/java/net/HttpURLConnection.java +++ b/jdk/src/share/classes/java/net/HttpURLConnection.java @@ -73,10 +73,23 @@ abstract public class HttpURLConnection extends URLConnection { * The fixed content-length when using fixed-length streaming mode. * A value of -1 means fixed-length streaming mode is disabled * for output. + * + *

      NOTE: {@link #fixedContentLengthLong} is recommended instead + * of this field, as it allows larger content lengths to be set. + * * @since 1.5 */ protected int fixedContentLength = -1; + /** + * The fixed content-length when using fixed-length streaming mode. + * A value of {@code -1} means fixed-length streaming mode is disabled + * for output. + * + * @since 1.7 + */ + protected long fixedContentLengthLong = -1; + /** * Returns the key for the nth header field. * Some implementations may treat the 0th @@ -109,6 +122,9 @@ abstract public class HttpURLConnection extends URLConnection { * This exception can be queried for the details of the error. *

      * This method must be called before the URLConnection is connected. + *

      + * NOTE: {@link #setFixedLengthStreamingMode(long)} is recommended + * instead of this method as it allows larger content lengths to be set. * * @param contentLength The number of bytes which will be written * to the OutputStream. @@ -135,6 +151,52 @@ abstract public class HttpURLConnection extends URLConnection { fixedContentLength = contentLength; } + /** + * This method is used to enable streaming of a HTTP request body + * without internal buffering, when the content length is known in + * advance. + * + *

      An exception will be thrown if the application attempts to write + * more data than the indicated content-length, or if the application + * closes the OutputStream before writing the indicated amount. + * + *

      When output streaming is enabled, authentication and redirection + * cannot be handled automatically. A {@linkplain HttpRetryException} will + * be thrown when reading the response if authentication or redirection + * are required. This exception can be queried for the details of the + * error. + * + *

      This method must be called before the URLConnection is connected. + * + *

      The content length set by invoking this method takes precedence + * over any value set by {@link #setFixedLengthStreamingMode(int)}. + * + * @param contentLength + * The number of bytes which will be written to the OutputStream. + * + * @throws IllegalStateException + * if URLConnection is already connected or if a different + * streaming mode is already enabled. + * + * @throws IllegalArgumentException + * if a content length less than zero is specified. + * + * @since 1.7 + */ + public void setFixedLengthStreamingMode(long contentLength) { + if (connected) { + throw new IllegalStateException("Already connected"); + } + if (chunkLength != -1) { + throw new IllegalStateException( + "Chunked encoding streaming mode set"); + } + if (contentLength < 0) { + throw new IllegalArgumentException("invalid content length"); + } + fixedContentLengthLong = contentLength; + } + /* Default chunk size (including chunk header) if not specified; * we want to keep this in sync with the one defined in * sun.net.www.http.ChunkedOutputStream @@ -170,7 +232,7 @@ abstract public class HttpURLConnection extends URLConnection { if (connected) { throw new IllegalStateException ("Can't set streaming mode: already connected"); } - if (fixedContentLength != -1) { + if (fixedContentLength != -1 || fixedContentLengthLong != -1) { throw new IllegalStateException ("Fixed length streaming mode set"); } chunkLength = chunklen <=0? DEFAULT_CHUNK_SIZE : chunklen; diff --git a/jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java b/jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java index 5aec18973aa..6f3250b30eb 100644 --- a/jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java +++ b/jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java @@ -435,8 +435,14 @@ public class HttpURLConnection extends java.net.HttpURLConnection { if (streaming()) { if (chunkLength != -1) { requests.set ("Transfer-Encoding", "chunked"); - } else { - requests.set ("Content-Length", String.valueOf(fixedContentLength)); + } else { /* fixed content length */ + if (fixedContentLengthLong != -1) { + requests.set ("Content-Length", + String.valueOf(fixedContentLengthLong)); + } else if (fixedContentLength != -1) { + requests.set ("Content-Length", + String.valueOf(fixedContentLength)); + } } } else if (poster != null) { /* add Content-Length & POST/PUT data */ @@ -871,11 +877,17 @@ public class HttpURLConnection extends java.net.HttpURLConnection { ps = (PrintStream)http.getOutputStream(); if (streaming()) { if (strOutputStream == null) { - if (fixedContentLength != -1) { - strOutputStream = new StreamingOutputStream (ps, fixedContentLength); - } else if (chunkLength != -1) { - strOutputStream = - new StreamingOutputStream (new ChunkedOutputStream (ps, chunkLength), -1); + if (chunkLength != -1) { /* chunked */ + strOutputStream = new StreamingOutputStream( + new ChunkedOutputStream(ps, chunkLength), -1L); + } else { /* must be fixed content length */ + long length = 0L; + if (fixedContentLengthLong != -1) { + length = fixedContentLengthLong; + } else if (fixedContentLength != -1) { + length = fixedContentLength; + } + strOutputStream = new StreamingOutputStream(ps, length); } } return strOutputStream; @@ -895,7 +907,8 @@ public class HttpURLConnection extends java.net.HttpURLConnection { } private boolean streaming () { - return (fixedContentLength != -1) || (chunkLength != -1); + return (fixedContentLength != -1) || (fixedContentLengthLong != -1) || + (chunkLength != -1); } /* @@ -2619,8 +2632,8 @@ public class HttpURLConnection extends java.net.HttpURLConnection { class StreamingOutputStream extends FilterOutputStream { - int expected; - int written; + long expected; + long written; boolean closed; boolean error; IOException errorExcp; @@ -2631,10 +2644,10 @@ public class HttpURLConnection extends java.net.HttpURLConnection { * In the 2nd case, we make sure the expected number of * of bytes are actually written */ - StreamingOutputStream (OutputStream os, int expectedLength) { + StreamingOutputStream (OutputStream os, long expectedLength) { super (os); expected = expectedLength; - written = 0; + written = 0L; closed = false; error = false; } @@ -2643,7 +2656,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection { public void write (int b) throws IOException { checkError(); written ++; - if (expected != -1 && written > expected) { + if (expected != -1L && written > expected) { throw new IOException ("too many bytes written"); } out.write (b); @@ -2658,7 +2671,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection { public void write (byte[] b, int off, int len) throws IOException { checkError(); written += len; - if (expected != -1 && written > expected) { + if (expected != -1L && written > expected) { out.close (); throw new IOException ("too many bytes written"); } @@ -2691,7 +2704,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection { return; } closed = true; - if (expected != -1) { + if (expected != -1L) { /* not chunked */ if (written != expected) { error = true; diff --git a/jdk/src/share/classes/sun/net/www/protocol/https/HttpsURLConnectionImpl.java b/jdk/src/share/classes/sun/net/www/protocol/https/HttpsURLConnectionImpl.java index 55b1859ba15..c2a37012822 100644 --- a/jdk/src/share/classes/sun/net/www/protocol/https/HttpsURLConnectionImpl.java +++ b/jdk/src/share/classes/sun/net/www/protocol/https/HttpsURLConnectionImpl.java @@ -527,6 +527,10 @@ public class HttpsURLConnectionImpl delegate.setFixedLengthStreamingMode(contentLength); } + public void setFixedLengthStreamingMode(long contentLength) { + delegate.setFixedLengthStreamingMode(contentLength); + } + public void setChunkedStreamingMode (int chunklen) { delegate.setChunkedStreamingMode(chunklen); } diff --git a/jdk/test/com/sun/net/httpserver/bugs/FixedLengthInputStream.java b/jdk/test/com/sun/net/httpserver/bugs/FixedLengthInputStream.java index 76a71fc120b..d5cdfdf2533 100644 --- a/jdk/test/com/sun/net/httpserver/bugs/FixedLengthInputStream.java +++ b/jdk/test/com/sun/net/httpserver/bugs/FixedLengthInputStream.java @@ -23,7 +23,7 @@ /** * @test - * @bug 6756771 + * @bug 6756771 6755625 * @summary com.sun.net.httpserver.HttpServer should handle POSTs larger than 2Gig */ @@ -44,34 +44,16 @@ public class FixedLengthInputStream { static final long POST_SIZE = 4L * 1024L * 1024L * 1024L; // 4Gig - /* Remove when CR 6755625 is fixed */ - static final String requestHeaders = ((new StringBuilder()) - .append("POST /flis/ HTTP/1.1\r\n") - .append("User-Agent: Java/1.7.0\r\n") - .append("Host: localhost\r\n") - .append("Accept: text/html, image/gif, image/jpeg,") - .append( " *; q=.2, */*; q=.2\r\n") - .append("Content-Length: 4294967296\r\n\r\n")).toString(); - void test(String[] args) throws IOException { HttpServer httpServer = startHttpServer(); int port = httpServer.getAddress().getPort(); try { - /* Uncomment & when CR 6755625 is fixed, remove socket code URL url = new URL("http://localhost:" + port + "/flis/"); HttpURLConnection uc = (HttpURLConnection)url.openConnection(); uc.setDoOutput(true); uc.setRequestMethod("POST"); uc.setFixedLengthStreamingMode(POST_SIZE); OutputStream os = uc.getOutputStream(); - */ - - Socket socket = new Socket("localhost", port); - OutputStream os = socket.getOutputStream(); - PrintStream ps = new PrintStream(os); - debug("Request: " + requestHeaders); - ps.print(requestHeaders); - ps.flush(); /* create a 32K byte array with data to POST */ int thirtyTwoK = 32 * 1024; @@ -84,18 +66,12 @@ public class FixedLengthInputStream os.write(ba); } - /* Uncomment & when CR 6755625 is fixed, remove socket code os.close(); InputStream is = uc.getInputStream(); while(is.read(ba) != -1); is.close(); - */ - InputStream is = socket.getInputStream(); - is.read(); - socket.close(); - - pass(); + pass(); } finally { httpServer.stop(0); } From 015a08b3e8f57df85a004a4db2675d10a28489e2 Mon Sep 17 00:00:00 2001 From: Vladimir Kozlov Date: Wed, 12 Nov 2008 11:01:31 -0800 Subject: [PATCH 124/267] 6769748: Fix solaris makefiles for the case when "CC -V" produces several lines Fix solaris makefiles for 5.10 compilers Reviewed-by: jcoomes --- hotspot/make/solaris/makefiles/debug.make | 2 +- hotspot/make/solaris/makefiles/fastdebug.make | 14 +++--- hotspot/make/solaris/makefiles/i486.make | 6 +-- hotspot/make/solaris/makefiles/jvmg.make | 2 +- hotspot/make/solaris/makefiles/optimized.make | 6 +-- hotspot/make/solaris/makefiles/product.make | 6 +-- hotspot/make/solaris/makefiles/sparc.make | 2 +- .../make/solaris/makefiles/sparcWorks.make | 46 ++++++++++--------- hotspot/make/solaris/makefiles/sparcv9.make | 2 +- hotspot/make/solaris/makefiles/vm.make | 2 +- 10 files changed, 43 insertions(+), 45 deletions(-) diff --git a/hotspot/make/solaris/makefiles/debug.make b/hotspot/make/solaris/makefiles/debug.make index 69eb236ada1..4fdf4a7463e 100644 --- a/hotspot/make/solaris/makefiles/debug.make +++ b/hotspot/make/solaris/makefiles/debug.make @@ -30,7 +30,7 @@ DEBUG_CFLAGS/BYFILE = $(DEBUG_CFLAGS/$@)$(DEBUG_CFLAGS/DEFAULT$(DEBUG_CFLAGS/$@) ifeq ("${Platform_compiler}", "sparcWorks") -ifeq ($(COMPILER_REV),5.8) +ifeq ($(COMPILER_REV_NUMERIC),508) # SS11 SEGV when compiling with -g and -xarch=v8, using different backend DEBUG_CFLAGS/compileBroker.o = $(DEBUG_CFLAGS) -xO0 DEBUG_CFLAGS/jvmtiTagMap.o = $(DEBUG_CFLAGS) -xO0 diff --git a/hotspot/make/solaris/makefiles/fastdebug.make b/hotspot/make/solaris/makefiles/fastdebug.make index 3ac2ae212b1..2abcea4e999 100644 --- a/hotspot/make/solaris/makefiles/fastdebug.make +++ b/hotspot/make/solaris/makefiles/fastdebug.make @@ -37,7 +37,7 @@ ifeq ("${Platform_compiler}", "sparcWorks") OPT_CFLAGS/SLOWER = -xO2 # Problem with SS12 compiler, dtrace doesn't like the .o files (bug 6693876) -ifeq ($(COMPILER_REV), 5.9) +ifeq ($(COMPILER_REV_NUMERIC), 509) # To avoid jvm98 crash OPT_CFLAGS/instanceKlass.o = $(OPT_CFLAGS/SLOWER) # Not clear this workaround could be skipped in some cases. @@ -46,25 +46,25 @@ ifeq ($(COMPILER_REV), 5.9) OPT_CFLAGS/jni.o = $(OPT_CFLAGS/SLOWER) endif -ifeq ($(COMPILER_REV), 5.5) +ifeq ($(COMPILER_REV_NUMERIC), 505) # CC 5.5 has bug 4908364 with -xO4 (Fixed in 5.6) OPT_CFLAGS/library_call.o = $(OPT_CFLAGS/SLOWER) -endif # COMPILER_REV == 5.5 +endif # COMPILER_REV_NUMERIC == 505 -ifeq ($(shell expr $(COMPILER_REV) \<= 5.4), 1) +ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \<= 504), 1) # Compilation of *_.cpp can take an hour or more at O3. Use O2 # See comments at top of sparc.make. OPT_CFLAGS/ad_$(Platform_arch).o = $(OPT_CFLAGS/SLOWER) OPT_CFLAGS/dfa_$(Platform_arch).o = $(OPT_CFLAGS/SLOWER) -endif # COMPILER_REV <= 5.4 +endif # COMPILER_REV_NUMERIC <= 504 -ifeq (${COMPILER_REV}, 5.0) +ifeq (${COMPILER_REV_NUMERIC}, 500) # Avoid a compiler bug caused by using -xO -g # Since the bug also occurs with -xO0, use an innocuous value (must not be null) OPT_CFLAGS/c1_LIROptimizer_i486.o = -c endif -ifeq ($(shell expr $(COMPILER_REV) \< 5.5), 1) +ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \< 505), 1) # Same problem with Solaris/x86 compiler (both 5.0 and 5.2) on ad_i486.cpp. # CC build time is also too long for ad_i486_{gen,misc}.o OPT_CFLAGS/ad_i486.o = -c diff --git a/hotspot/make/solaris/makefiles/i486.make b/hotspot/make/solaris/makefiles/i486.make index a8f92a361bb..bd81b0fcd16 100644 --- a/hotspot/make/solaris/makefiles/i486.make +++ b/hotspot/make/solaris/makefiles/i486.make @@ -36,16 +36,12 @@ ifeq ("${Platform_compiler}", "sparcWorks") # _lwp_create_interpose must have a frame OPT_CFLAGS/os_solaris_i486.o = -xO1 -# force C++ interpreter to be full optimization -OPT_CFLAGS/interpret.o = -fast -O4 else ifeq ("${Platform_compiler}", "gcc") # gcc # _lwp_create_interpose must have a frame OPT_CFLAGS/os_solaris_i486.o = -fno-omit-frame-pointer -# force C++ interpreter to be full optimization -OPT_CFLAGS/interpret.o = -O3 # else # error @@ -57,7 +53,7 @@ endif ifeq ("${Platform_compiler}", "sparcWorks") # ILD is gone as of SS11 (5.8), not supported in SS10 (5.7) -ifeq ($(shell expr $(COMPILER_REV) \< 5.7), 1) +ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \< 507), 1) # # Bug in ild causes it to fail randomly. Until we get a fix we can't # use ild. diff --git a/hotspot/make/solaris/makefiles/jvmg.make b/hotspot/make/solaris/makefiles/jvmg.make index ada307af855..e6603005fdd 100644 --- a/hotspot/make/solaris/makefiles/jvmg.make +++ b/hotspot/make/solaris/makefiles/jvmg.make @@ -30,7 +30,7 @@ DEBUG_CFLAGS/BYFILE = $(DEBUG_CFLAGS/$@)$(DEBUG_CFLAGS/DEFAULT$(DEBUG_CFLAGS/$@) ifeq ("${Platform_compiler}", "sparcWorks") -ifeq ($(COMPILER_REV),5.8) +ifeq ($(COMPILER_REV_NUMERIC),508) # SS11 SEGV when compiling with -g and -xarch=v8, using different backend DEBUG_CFLAGS/compileBroker.o = $(DEBUG_CFLAGS) -xO0 DEBUG_CFLAGS/jvmtiTagMap.o = $(DEBUG_CFLAGS) -xO0 diff --git a/hotspot/make/solaris/makefiles/optimized.make b/hotspot/make/solaris/makefiles/optimized.make index 1f91c3124f2..69848b73661 100644 --- a/hotspot/make/solaris/makefiles/optimized.make +++ b/hotspot/make/solaris/makefiles/optimized.make @@ -33,7 +33,7 @@ OPT_CFLAGS/BYFILE = $(OPT_CFLAGS/$@)$(OPT_CFLAGS/DEFAULT$(OPT_CFLAGS/$@)) ifeq ("${Platform_compiler}", "sparcWorks") # Problem with SS12 compiler, dtrace doesn't like the .o files (bug 6693876) -ifeq ($(COMPILER_REV),5.9) +ifeq ($(COMPILER_REV_NUMERIC),509) # Not clear this workaround could be skipped in some cases. OPT_CFLAGS/vmGCOperations.o = $(OPT_CFLAGS/SLOWER) -g OPT_CFLAGS/java.o = $(OPT_CFLAGS/SLOWER) -g @@ -41,9 +41,9 @@ ifeq ($(COMPILER_REV),5.9) endif # Workaround SS11 bug 6345274 (all platforms) (Fixed in SS11 patch and SS12) -ifeq ($(COMPILER_REV),5.8)) +ifeq ($(COMPILER_REV_NUMERIC),508)) OPT_CFLAGS/ciTypeFlow.o = $(OPT_CFLAGS/O2) -endif # COMPILER_REV == 5.8 +endif # COMPILER_REV_NUMERIC == 508 endif # Platform_compiler == sparcWorks diff --git a/hotspot/make/solaris/makefiles/product.make b/hotspot/make/solaris/makefiles/product.make index 66e53536723..10c6b4568c9 100644 --- a/hotspot/make/solaris/makefiles/product.make +++ b/hotspot/make/solaris/makefiles/product.make @@ -41,7 +41,7 @@ endif ifeq ("${Platform_compiler}", "sparcWorks") # Problem with SS12 compiler, dtrace doesn't like the .o files (bug 6693876) -ifeq ($(COMPILER_REV),5.9) +ifeq ($(COMPILER_REV_NUMERIC),509) # Not clear this workaround could be skipped in some cases. OPT_CFLAGS/vmGCOperations.o = $(OPT_CFLAGS/SLOWER) -g OPT_CFLAGS/java.o = $(OPT_CFLAGS/SLOWER) -g @@ -49,9 +49,9 @@ ifeq ($(COMPILER_REV),5.9) endif # Workaround SS11 bug 6345274 (all platforms) (Fixed in SS11 patch and SS12) -ifeq ($(COMPILER_REV),5.8) +ifeq ($(COMPILER_REV_NUMERIC),508) OPT_CFLAGS/ciTypeFlow.o = $(OPT_CFLAGS/O2) -endif # COMPILER_REV == 5.8 +endif # COMPILER_REV_NUMERIC == 508 endif # Platform_compiler == sparcWorks diff --git a/hotspot/make/solaris/makefiles/sparc.make b/hotspot/make/solaris/makefiles/sparc.make index 6f332cf63bd..6bd01d1fab1 100644 --- a/hotspot/make/solaris/makefiles/sparc.make +++ b/hotspot/make/solaris/makefiles/sparc.make @@ -26,7 +26,7 @@ Obj_Files += solaris_sparc.o ASFLAGS += $(AS_ARCHFLAG) ifeq ("${Platform_compiler}", "sparcWorks") -ifeq ($(shell expr $(COMPILER_REV) \< 5.5), 1) +ifeq ($(shell expr $(COMPILER_REV_NUMARIC) \< 505), 1) # For 5.2 ad_sparc file is compiled with -O2 %%%% remove when adlc is fixed OPT_CFLAGS/ad_sparc.o = $(OPT_CFLAGS/SLOWER) OPT_CFLAGS/dfa_sparc.o = $(OPT_CFLAGS/SLOWER) diff --git a/hotspot/make/solaris/makefiles/sparcWorks.make b/hotspot/make/solaris/makefiles/sparcWorks.make index 5bbe70f9f10..501268e3d25 100644 --- a/hotspot/make/solaris/makefiles/sparcWorks.make +++ b/hotspot/make/solaris/makefiles/sparcWorks.make @@ -41,9 +41,9 @@ REORDER_FLAG = -xF # Get the last thing on the line that looks like x.x+ (x is a digit). COMPILER_REV := \ -$(shell $(CPP) -V 2>&1 | sed -e 's/^.*\([1-9]\.[0-9][0-9]*\).*/\1/') +$(shell $(CPP) -V 2>&1 | sed -n 's/^.*[ ,\t]C++[ ,\t]\([1-9]\.[0-9][0-9]*\).*/\1/p') C_COMPILER_REV := \ -$(shell $(CC) -V 2>&1 | grep -i "cc:" | sed -e 's/^.*\([1-9]\.[0-9][0-9]*\).*/\1/') +$(shell $(CC) -V 2>&1 | sed -n 's/^.*[ ,\t]C[ ,\t]\([1-9]\.[0-9][0-9]*\).*/\1/p') # Pick which compiler is validated ifeq ($(JDK_MINOR_VERSION),6) @@ -60,17 +60,19 @@ endif ENFORCE_COMPILER_REV${ENFORCE_COMPILER_REV} := ${VALIDATED_COMPILER_REV} ifneq (${COMPILER_REV},${ENFORCE_COMPILER_REV}) dummy_target_to_enforce_compiler_rev:=\ -$(info WARNING: You are using CC version ${COMPILER_REV} \ -and should be using version ${ENFORCE_COMPILER_REV}) +$(shell echo >&2 WARNING: You are using CC version ${COMPILER_REV} \ +and should be using version ${ENFORCE_COMPILER_REV}. Set ENFORCE_COMPILER_REV=${COMPILER_REV} to avoid this warning.) endif ENFORCE_C_COMPILER_REV${ENFORCE_C_COMPILER_REV} := ${VALIDATED_C_COMPILER_REV} ifneq (${C_COMPILER_REV},${ENFORCE_C_COMPILER_REV}) dummy_target_to_enforce_c_compiler_rev:=\ -$(info WARNING: You are using cc version ${C_COMPILER_REV} \ -and should be using version ${ENFORCE_C_COMPILER_REV}) +$(shell echo >&2 WARNING: You are using cc version ${C_COMPILER_REV} \ +and should be using version ${ENFORCE_C_COMPILER_REV}. Set ENFORCE_C_COMPILER_REV=${C_COMPILER_REV} to avoid this warning.) endif +COMPILER_REV_NUMERIC := $(shell echo $(COMPILER_REV) | awk -F. '{ print $$1 * 100 + $$2 }') + # Fail the build if __fabsf is used. __fabsf exists only in Solaris 8 2/04 # and newer; objects with a dependency on this symbol will not run on older # Solaris 8. @@ -120,7 +122,7 @@ ARCHFLAG_OLD/amd64 = -xarch=amd64 ARCHFLAG_NEW/amd64 = -m64 # Select the ARCHFLAGs and other SS12 (5.9) options -ifeq ($(shell expr $(COMPILER_REV) \>= 5.9), 1) +ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1) ARCHFLAG/sparc = $(ARCHFLAG_NEW/sparc) ARCHFLAG/sparcv9 = $(ARCHFLAG_NEW/sparcv9) ARCHFLAG/i486 = $(ARCHFLAG_NEW/i486) @@ -150,7 +152,7 @@ OPT_CFLAGS/NOOPT=-xO1 # Begin current (>=5.6) Forte compiler options # ################################################# -ifeq ($(shell expr $(COMPILER_REV) \>= 5.6), 1) +ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 506), 1) ifeq ("${Platform_arch}", "sparc") @@ -167,7 +169,7 @@ endif # Begin current (>=5.5) Forte compiler options # ################################################# -ifeq ($(shell expr $(COMPILER_REV) \>= 5.5), 1) +ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 505), 1) CFLAGS += $(ARCHFLAG) AOUT_FLAGS += $(ARCHFLAG) @@ -255,7 +257,7 @@ LFLAGS += -library=%none LFLAGS += -mt -endif # COMPILER_REV >= 5.5 +endif # COMPILER_REV_NUMERIC >= 505 ###################################### # End 5.5 Forte compiler options # @@ -265,7 +267,7 @@ endif # COMPILER_REV >= 5.5 # Begin 5.2 Forte compiler options # ###################################### -ifeq ($(COMPILER_REV), 5.2) +ifeq ($(COMPILER_REV_NUMERIC), 502) CFLAGS += $(ARCHFLAG) AOUT_FLAGS += $(ARCHFLAG) @@ -324,7 +326,7 @@ PICFLAG/BYFILE = $(PICFLAG/$@)$(PICFLAG/DEFAULT$(PICFLAG/$@)) LFLAGS += -library=Crun LIBS += -library=Crun -lCrun -endif # COMPILER_REV == 5.2 +endif # COMPILER_REV_NUMERIC == 502 ################################## # End 5.2 Forte compiler options # @@ -333,7 +335,7 @@ endif # COMPILER_REV == 5.2 ################################## # Begin old 5.1 compiler options # ################################## -ifeq ($(COMPILER_REV), 5.1) +ifeq ($(COMPILER_REV_NUMERIC), 501) _JUNK_ := $(shell echo >&2 \ "*** ERROR: sparkWorks.make incomplete for 5.1 compiler") @@ -347,7 +349,7 @@ endif # Begin old 5.0 compiler options # ################################## -ifeq (${COMPILER_REV}, 5.0) +ifeq (${COMPILER_REV_NUMERIC}, 500) # Had to hoist this higher apparently because of other changes. Must # come before -xarch specification. @@ -379,7 +381,7 @@ endif # sparc ifeq ("${Platform_arch_model}", "x86_32") OPT_CFLAGS=-xtarget=pentium $(EXTRA_OPT_CFLAGS) -ifeq ("${COMPILER_REV}", "5.0") +ifeq ("${COMPILER_REV_NUMERIC}", "500") # SC5.0 tools on x86 are flakey at -xO4 OPT_CFLAGS+=-xO3 else @@ -405,13 +407,13 @@ PICFLAG/DEFAULT = $(PICFLAG) PICFLAG/BETTER = $(PICFLAG/DEFAULT) PICFLAG/BYFILE = $(PICFLAG/$@)$(PICFLAG/DEFAULT$(PICFLAG/$@)) -endif # COMPILER_REV = 5.0 +endif # COMPILER_REV_NUMERIC = 500 ################################ # End old 5.0 compiler options # ################################ -ifeq ("${COMPILER_REV}", "4.2") +ifeq ("${COMPILER_REV_NUMERIC}", "402") # 4.2 COMPILERS SHOULD NO LONGER BE USED _JUNK_ := $(shell echo >&2 \ "*** ERROR: SC4.2 compilers are not supported by this code base!") @@ -443,7 +445,7 @@ LINK_MODE/debug = LINK_MODE/optimized = -Bsymbolic -znodefs # Have thread local errnos -ifeq ($(shell expr $(COMPILER_REV) \>= 5.5), 1) +ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 505), 1) CFLAGS += -mt else CFLAGS += -D_REENTRANT @@ -460,7 +462,7 @@ FASTDEBUG_CFLAGS = -g0 # The -g0 setting allows the C++ frontend to inline, which is a big win. # Special global options for SS12 -ifeq ($(COMPILER_REV),5.9) +ifeq ($(COMPILER_REV_NUMERIC),509) # There appears to be multiple issues with the new Dwarf2 debug format, so # we tell the compiler to use the older 'stabs' debug format all the time. # Note that this needs to be used in optimized compiles too to be 100%. @@ -479,8 +481,8 @@ endif #DEBUG_CFLAGS += -Qoption ccfe -xglobalstatic #FASTDEBUG_CFLAGS += -Qoption ccfe -xglobalstatic -ifeq (${COMPILER_REV}, 5.2) -COMPILER_DATE := $(shell $(CPP) -V 2>&1 | awk '{ print $$NF; }') +ifeq (${COMPILER_REV_NUMERIC}, 502) +COMPILER_DATE := $(shell $(CPP) -V 2>&1 | sed -n '/^.*[ ]C++[ ]\([1-9]\.[0-9][0-9]*\)/p' | awk '{ print $$NF; }') ifeq (${COMPILER_DATE}, 2001/01/31) # disable -g0 in fastdebug since SC6.1 dated 2001/01/31 seems to be buggy # use an innocuous value because it will get -g if it's empty @@ -493,7 +495,7 @@ endif CFLAGS += $(CFLAGS_BROWSE) # ILD is gone as of SS11 (5.8), not supportted in SS10 (5.7) -ifeq ($(shell expr $(COMPILER_REV) \< 5.7), 1) +ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \< 507), 1) # use ild when debugging (but when optimizing we want reproducible results) ILDFLAG = $(ILDFLAG/$(VERSION)) ILDFLAG/debug = -xildon diff --git a/hotspot/make/solaris/makefiles/sparcv9.make b/hotspot/make/solaris/makefiles/sparcv9.make index c05d04bc18c..9ee08dd1bff 100644 --- a/hotspot/make/solaris/makefiles/sparcv9.make +++ b/hotspot/make/solaris/makefiles/sparcv9.make @@ -26,7 +26,7 @@ Obj_Files += solaris_sparc.o ASFLAGS += $(AS_ARCHFLAG) ifeq ("${Platform_compiler}", "sparcWorks") -ifeq ($(shell expr $(COMPILER_REV) \< 5.5), 1) +ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \< 505), 1) # When optimized fully, stubGenerator_sparc.cpp # has bogus code for the routine # StubGenerator::generate_flush_callers_register_windows() diff --git a/hotspot/make/solaris/makefiles/vm.make b/hotspot/make/solaris/makefiles/vm.make index 70a11975fbc..32850b18bbd 100644 --- a/hotspot/make/solaris/makefiles/vm.make +++ b/hotspot/make/solaris/makefiles/vm.make @@ -101,7 +101,7 @@ LIBM=/usr/lib$(ISA_DIR)/libm.so.1 ifeq ("${Platform_compiler}", "sparcWorks") # The whole megilla: -ifeq ($(shell expr $(COMPILER_REV) \>= 5.5), 1) +ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 505), 1) # Old Comment: List the libraries in the order the compiler was designed for # Not sure what the 'designed for' comment is referring too above. # The order may not be too significant anymore, but I have placed this From 849e0ffb04ae2e04cb0810c9b501657bcf467423 Mon Sep 17 00:00:00 2001 From: John R Rose Date: Wed, 12 Nov 2008 22:33:26 -0800 Subject: [PATCH 125/267] 6653858: dynamic languages need to be able to load anonymous classes Low-level privileged sun.misc.Unsafe.defineAnonymousClass Reviewed-by: kvn --- hotspot/src/share/vm/ci/ciEnv.cpp | 15 +- .../share/vm/classfile/classFileParser.cpp | 177 +++++++++++++++--- .../share/vm/classfile/classFileParser.hpp | 38 ++++ .../share/vm/classfile/systemDictionary.cpp | 28 ++- .../share/vm/classfile/systemDictionary.hpp | 10 + hotspot/src/share/vm/classfile/verifier.cpp | 6 +- hotspot/src/share/vm/includeDB_gc_parallel | 6 + .../src/share/vm/oops/constantPoolKlass.cpp | 42 ++++- hotspot/src/share/vm/oops/constantPoolOop.cpp | 29 ++- hotspot/src/share/vm/oops/constantPoolOop.hpp | 36 ++++ hotspot/src/share/vm/oops/instanceKlass.hpp | 10 + .../src/share/vm/oops/instanceKlassKlass.cpp | 23 ++- hotspot/src/share/vm/oops/klass.cpp | 18 ++ hotspot/src/share/vm/prims/jvm.cpp | 3 +- hotspot/src/share/vm/prims/jvm.h | 8 + hotspot/src/share/vm/prims/unsafe.cpp | 169 +++++++++++++++++ hotspot/src/share/vm/runtime/globals.hpp | 3 + hotspot/src/share/vm/runtime/reflection.cpp | 22 +++ .../src/share/vm/utilities/constantTag.hpp | 1 + 19 files changed, 607 insertions(+), 37 deletions(-) diff --git a/hotspot/src/share/vm/ci/ciEnv.cpp b/hotspot/src/share/vm/ci/ciEnv.cpp index 1d279540e11..cb2be0f5ad9 100644 --- a/hotspot/src/share/vm/ci/ciEnv.cpp +++ b/hotspot/src/share/vm/ci/ciEnv.cpp @@ -484,11 +484,16 @@ ciConstant ciEnv::get_constant_by_index_impl(ciInstanceKlass* accessor, } else if (tag.is_double()) { return ciConstant((jdouble)cpool->double_at(index)); } else if (tag.is_string() || tag.is_unresolved_string()) { - oop string = cpool->string_at(index, THREAD); - if (HAS_PENDING_EXCEPTION) { - CLEAR_PENDING_EXCEPTION; - record_out_of_memory_failure(); - return ciConstant(); + oop string = NULL; + if (cpool->is_pseudo_string_at(index)) { + string = cpool->pseudo_string_at(index); + } else { + string = cpool->string_at(index, THREAD); + if (HAS_PENDING_EXCEPTION) { + CLEAR_PENDING_EXCEPTION; + record_out_of_memory_failure(); + return ciConstant(); + } } ciObject* constant = get_object(string); assert (constant->is_instance(), "must be an instance, or not? "); diff --git a/hotspot/src/share/vm/classfile/classFileParser.cpp b/hotspot/src/share/vm/classfile/classFileParser.cpp index 7ee8ce98403..45d0147fa7d 100644 --- a/hotspot/src/share/vm/classfile/classFileParser.cpp +++ b/hotspot/src/share/vm/classfile/classFileParser.cpp @@ -168,11 +168,23 @@ void ClassFileParser::parse_constant_pool_entries(constantPoolHandle cp, int len // Got utf8 string, guarantee utf8_length+1 bytes, set stream position forward. cfs->guarantee_more(utf8_length+1, CHECK); // utf8 string, tag/access_flags cfs->skip_u1_fast(utf8_length); + // Before storing the symbol, make sure it's legal if (_need_verify) { verify_legal_utf8((unsigned char*)utf8_buffer, utf8_length, CHECK); } + if (AnonymousClasses && has_cp_patch_at(index)) { + Handle patch = clear_cp_patch_at(index); + guarantee_property(java_lang_String::is_instance(patch()), + "Illegal utf8 patch at %d in class file %s", + index, CHECK); + char* str = java_lang_String::as_utf8_string(patch()); + // (could use java_lang_String::as_symbol instead, but might as well batch them) + utf8_buffer = (u1*) str; + utf8_length = (int) strlen(str); + } + unsigned int hash; symbolOop result = SymbolTable::lookup_only((char*)utf8_buffer, utf8_length, hash); if (result == NULL) { @@ -245,7 +257,7 @@ constantPoolHandle ClassFileParser::parse_constant_pool(TRAPS) { int klass_ref_index = cp->klass_ref_index_at(index); int name_and_type_ref_index = cp->name_and_type_ref_index_at(index); check_property(valid_cp_range(klass_ref_index, length) && - cp->tag_at(klass_ref_index).is_klass_reference(), + is_klass_reference(cp, klass_ref_index), "Invalid constant pool index %u in class file %s", klass_ref_index, CHECK_(nullHandle)); @@ -326,16 +338,46 @@ constantPoolHandle ClassFileParser::parse_constant_pool(TRAPS) { } // end of switch } // end of for + if (_cp_patches != NULL) { + // need to treat this_class specially... + assert(AnonymousClasses, ""); + int this_class_index; + { + cfs->guarantee_more(8, CHECK_(nullHandle)); // flags, this_class, super_class, infs_len + u1* mark = cfs->current(); + u2 flags = cfs->get_u2_fast(); + this_class_index = cfs->get_u2_fast(); + cfs->set_current(mark); // revert to mark + } + + for (index = 1; index < length; index++) { // Index 0 is unused + if (has_cp_patch_at(index)) { + guarantee_property(index != this_class_index, + "Illegal constant pool patch to self at %d in class file %s", + index, CHECK_(nullHandle)); + patch_constant_pool(cp, index, cp_patch_at(index), CHECK_(nullHandle)); + } + } + // Ensure that all the patches have been used. + for (index = 0; index < _cp_patches->length(); index++) { + guarantee_property(!has_cp_patch_at(index), + "Unused constant pool patch at %d in class file %s", + index, CHECK_(nullHandle)); + } + } + if (!_need_verify) { return cp; } // second verification pass - checks the strings are of the right format. + // but not yet to the other entries for (index = 1; index < length; index++) { jbyte tag = cp->tag_at(index).value(); switch (tag) { case JVM_CONSTANT_UnresolvedClass: { symbolHandle class_name(THREAD, cp->unresolved_klass_at(index)); + // check the name, even if _cp_patches will overwrite it verify_legal_class_name(class_name, CHECK_(nullHandle)); break; } @@ -378,6 +420,73 @@ constantPoolHandle ClassFileParser::parse_constant_pool(TRAPS) { } +void ClassFileParser::patch_constant_pool(constantPoolHandle cp, int index, Handle patch, TRAPS) { + assert(AnonymousClasses, ""); + BasicType patch_type = T_VOID; + switch (cp->tag_at(index).value()) { + + case JVM_CONSTANT_UnresolvedClass : + // Patching a class means pre-resolving it. + // The name in the constant pool is ignored. + if (patch->klass() == SystemDictionary::class_klass()) { // %%% java_lang_Class::is_instance + guarantee_property(!java_lang_Class::is_primitive(patch()), + "Illegal class patch at %d in class file %s", + index, CHECK); + cp->klass_at_put(index, java_lang_Class::as_klassOop(patch())); + } else { + guarantee_property(java_lang_String::is_instance(patch()), + "Illegal class patch at %d in class file %s", + index, CHECK); + symbolHandle name = java_lang_String::as_symbol(patch(), CHECK); + cp->unresolved_klass_at_put(index, name()); + } + break; + + case JVM_CONSTANT_UnresolvedString : + // Patching a string means pre-resolving it. + // The spelling in the constant pool is ignored. + // The constant reference may be any object whatever. + // If it is not a real interned string, the constant is referred + // to as a "pseudo-string", and must be presented to the CP + // explicitly, because it may require scavenging. + cp->pseudo_string_at_put(index, patch()); + break; + + case JVM_CONSTANT_Integer : patch_type = T_INT; goto patch_prim; + case JVM_CONSTANT_Float : patch_type = T_FLOAT; goto patch_prim; + case JVM_CONSTANT_Long : patch_type = T_LONG; goto patch_prim; + case JVM_CONSTANT_Double : patch_type = T_DOUBLE; goto patch_prim; + patch_prim: + { + jvalue value; + BasicType value_type = java_lang_boxing_object::get_value(patch(), &value); + guarantee_property(value_type == patch_type, + "Illegal primitive patch at %d in class file %s", + index, CHECK); + switch (value_type) { + case T_INT: cp->int_at_put(index, value.i); break; + case T_FLOAT: cp->float_at_put(index, value.f); break; + case T_LONG: cp->long_at_put(index, value.j); break; + case T_DOUBLE: cp->double_at_put(index, value.d); break; + default: assert(false, ""); + } + } + break; + + default: + // %%% TODO: put method handles into CONSTANT_InterfaceMethodref, etc. + guarantee_property(!has_cp_patch_at(index), + "Illegal unexpected patch at %d in class file %s", + index, CHECK); + return; + } + + // On fall-through, mark the patch as used. + clear_cp_patch_at(index); +} + + + class NameSigHash: public ResourceObj { public: symbolOop _name; // name @@ -448,25 +557,32 @@ objArrayHandle ClassFileParser::parse_interfaces(constantPoolHandle cp, int index; for (index = 0; index < length; index++) { u2 interface_index = cfs->get_u2(CHECK_(nullHandle)); + KlassHandle interf; check_property( valid_cp_range(interface_index, cp->length()) && - cp->tag_at(interface_index).is_unresolved_klass(), + is_klass_reference(cp, interface_index), "Interface name has bad constant pool index %u in class file %s", interface_index, CHECK_(nullHandle)); - symbolHandle unresolved_klass (THREAD, cp->klass_name_at(interface_index)); + if (cp->tag_at(interface_index).is_klass()) { + interf = KlassHandle(THREAD, cp->resolved_klass_at(interface_index)); + } else { + symbolHandle unresolved_klass (THREAD, cp->klass_name_at(interface_index)); - // Don't need to check legal name because it's checked when parsing constant pool. - // But need to make sure it's not an array type. - guarantee_property(unresolved_klass->byte_at(0) != JVM_SIGNATURE_ARRAY, - "Bad interface name in class file %s", CHECK_(nullHandle)); + // Don't need to check legal name because it's checked when parsing constant pool. + // But need to make sure it's not an array type. + guarantee_property(unresolved_klass->byte_at(0) != JVM_SIGNATURE_ARRAY, + "Bad interface name in class file %s", CHECK_(nullHandle)); - vmtimer->suspend(); // do not count recursive loading twice - // Call resolve_super so classcircularity is checked - klassOop k = SystemDictionary::resolve_super_or_fail(class_name, - unresolved_klass, class_loader, protection_domain, - false, CHECK_(nullHandle)); - KlassHandle interf (THREAD, k); - vmtimer->resume(); + vmtimer->suspend(); // do not count recursive loading twice + // Call resolve_super so classcircularity is checked + klassOop k = SystemDictionary::resolve_super_or_fail(class_name, + unresolved_klass, class_loader, protection_domain, + false, CHECK_(nullHandle)); + interf = KlassHandle(THREAD, k); + vmtimer->resume(); + + cp->klass_at_put(interface_index, interf()); // eagerly resolve + } if (!Klass::cast(interf())->is_interface()) { THROW_MSG_(vmSymbols::java_lang_IncompatibleClassChangeError(), "Implementing class", nullHandle); @@ -877,8 +993,7 @@ typeArrayHandle ClassFileParser::parse_exception_table(u4 code_length, "Illegal exception table handler in class file %s", CHECK_(nullHandle)); if (catch_type_index != 0) { guarantee_property(valid_cp_range(catch_type_index, cp->length()) && - (cp->tag_at(catch_type_index).is_klass() || - cp->tag_at(catch_type_index).is_unresolved_klass()), + is_klass_reference(cp, catch_type_index), "Catch type in exception table has bad constant type in class file %s", CHECK_(nullHandle)); } } @@ -1117,7 +1232,7 @@ void ClassFileParser::parse_type_array(u2 array_length, u4 code_length, u4* u1_i } else if (tag == ITEM_Object) { u2 class_index = u2_array[i2++] = cfs->get_u2(CHECK); guarantee_property(valid_cp_range(class_index, cp->length()) && - cp->tag_at(class_index).is_unresolved_klass(), + is_klass_reference(cp, class_index), "Bad class index %u in StackMap in class file %s", class_index, CHECK); } else if (tag == ITEM_Uninitialized) { @@ -1183,7 +1298,7 @@ u2* ClassFileParser::parse_checked_exceptions(u2* checked_exceptions_length, checked_exception = cfs->get_u2_fast(); check_property( valid_cp_range(checked_exception, cp->length()) && - cp->tag_at(checked_exception).is_klass_reference(), + is_klass_reference(cp, checked_exception), "Exception name has bad type at constant pool %u in class file %s", checked_exception, CHECK_NULL); } @@ -1918,7 +2033,7 @@ u2 ClassFileParser::parse_classfile_inner_classes_attribute(constantPoolHandle c check_property( inner_class_info_index == 0 || (valid_cp_range(inner_class_info_index, cp_size) && - cp->tag_at(inner_class_info_index).is_klass_reference()), + is_klass_reference(cp, inner_class_info_index)), "inner_class_info_index %u has bad constant type in class file %s", inner_class_info_index, CHECK_0); // Outer class index @@ -1926,7 +2041,7 @@ u2 ClassFileParser::parse_classfile_inner_classes_attribute(constantPoolHandle c check_property( outer_class_info_index == 0 || (valid_cp_range(outer_class_info_index, cp_size) && - cp->tag_at(outer_class_info_index).is_klass_reference()), + is_klass_reference(cp, outer_class_info_index)), "outer_class_info_index %u has bad constant type in class file %s", outer_class_info_index, CHECK_0); // Inner class name @@ -2088,7 +2203,7 @@ void ClassFileParser::parse_classfile_attributes(constantPoolHandle cp, instance } // Validate the constant pool indices and types if (!cp->is_within_bounds(class_index) || - !cp->tag_at(class_index).is_klass_reference()) { + !is_klass_reference(cp, class_index)) { classfile_parse_error("Invalid or out-of-bounds class index in EnclosingMethod attribute in class file %s", CHECK); } if (method_index != 0 && @@ -2349,6 +2464,7 @@ void ClassFileParser::java_lang_Class_fix_post(int* next_nonstatic_oop_offset_pt instanceKlassHandle ClassFileParser::parseClassFile(symbolHandle name, Handle class_loader, Handle protection_domain, + GrowableArray* cp_patches, symbolHandle& parsed_name, TRAPS) { // So that JVMTI can cache class file in the state before retransformable agents @@ -2380,6 +2496,7 @@ instanceKlassHandle ClassFileParser::parseClassFile(symbolHandle name, } } + _cp_patches = cp_patches; instanceKlassHandle nullHandle; @@ -2510,14 +2627,22 @@ instanceKlassHandle ClassFileParser::parseClassFile(symbolHandle name, CHECK_(nullHandle)); } else { check_property(valid_cp_range(super_class_index, cp_size) && - cp->tag_at(super_class_index).is_unresolved_klass(), + is_klass_reference(cp, super_class_index), "Invalid superclass index %u in class file %s", super_class_index, CHECK_(nullHandle)); // The class name should be legal because it is checked when parsing constant pool. // However, make sure it is not an array type. + bool is_array = false; + if (cp->tag_at(super_class_index).is_klass()) { + super_klass = instanceKlassHandle(THREAD, cp->resolved_klass_at(super_class_index)); + if (_need_verify) + is_array = super_klass->oop_is_array(); + } else if (_need_verify) { + is_array = (cp->unresolved_klass_at(super_class_index)->byte_at(0) == JVM_SIGNATURE_ARRAY); + } if (_need_verify) { - guarantee_property(cp->unresolved_klass_at(super_class_index)->byte_at(0) != JVM_SIGNATURE_ARRAY, + guarantee_property(!is_array, "Bad superclass name in class file %s", CHECK_(nullHandle)); } } @@ -2557,7 +2682,7 @@ instanceKlassHandle ClassFileParser::parseClassFile(symbolHandle name, objArrayHandle methods_default_annotations(THREAD, methods_default_annotations_oop); // We check super class after class file is parsed and format is checked - if (super_class_index > 0) { + if (super_class_index > 0 && super_klass.is_null()) { symbolHandle sk (THREAD, cp->klass_name_at(super_class_index)); if (access_flags.is_interface()) { // Before attempting to resolve the superclass, check for class format @@ -2574,6 +2699,9 @@ instanceKlassHandle ClassFileParser::parseClassFile(symbolHandle name, CHECK_(nullHandle)); KlassHandle kh (THREAD, k); super_klass = instanceKlassHandle(THREAD, kh()); + cp->klass_at_put(super_class_index, super_klass()); // eagerly resolve + } + if (super_klass.not_null()) { if (super_klass->is_interface()) { ResourceMark rm(THREAD); Exceptions::fthrow( @@ -3000,6 +3128,7 @@ instanceKlassHandle ClassFileParser::parseClassFile(symbolHandle name, this_klass->set_method_ordering(method_ordering()); this_klass->set_initial_method_idnum(methods->length()); this_klass->set_name(cp->klass_name_at(this_class_index)); + cp->klass_at_put(this_class_index, this_klass()); // eagerly resolve this_klass->set_protection_domain(protection_domain()); this_klass->set_fields_annotations(fields_annotations()); this_klass->set_methods_annotations(methods_annotations()); diff --git a/hotspot/src/share/vm/classfile/classFileParser.hpp b/hotspot/src/share/vm/classfile/classFileParser.hpp index a29905fc4c1..4a58fca558b 100644 --- a/hotspot/src/share/vm/classfile/classFileParser.hpp +++ b/hotspot/src/share/vm/classfile/classFileParser.hpp @@ -33,6 +33,7 @@ class ClassFileParser VALUE_OBJ_CLASS_SPEC { u2 _major_version; u2 _minor_version; symbolHandle _class_name; + GrowableArray* _cp_patches; // overrides for CP entries bool _has_finalizer; bool _has_empty_finalizer; @@ -203,6 +204,35 @@ class ClassFileParser VALUE_OBJ_CLASS_SPEC { char* skip_over_field_name(char* name, bool slash_ok, unsigned int length); char* skip_over_field_signature(char* signature, bool void_ok, unsigned int length, TRAPS); + bool has_cp_patch_at(int index) { + assert(AnonymousClasses, ""); + assert(index >= 0, "oob"); + return (_cp_patches != NULL + && index < _cp_patches->length() + && _cp_patches->adr_at(index)->not_null()); + } + Handle cp_patch_at(int index) { + assert(has_cp_patch_at(index), "oob"); + return _cp_patches->at(index); + } + Handle clear_cp_patch_at(int index) { + Handle patch = cp_patch_at(index); + _cp_patches->at_put(index, Handle()); + assert(!has_cp_patch_at(index), ""); + return patch; + } + void patch_constant_pool(constantPoolHandle cp, int index, Handle patch, TRAPS); + + // Wrapper for constantTag.is_klass_[or_]reference. + // In older versions of the VM, klassOops cannot sneak into early phases of + // constant pool construction, but in later versions they can. + // %%% Let's phase out the old is_klass_reference. + bool is_klass_reference(constantPoolHandle cp, int index) { + return ((LinkWellKnownClasses || AnonymousClasses) + ? cp->tag_at(index).is_klass_or_reference() + : cp->tag_at(index).is_klass_reference()); + } + public: // Constructor ClassFileParser(ClassFileStream* st) { set_stream(st); } @@ -218,6 +248,14 @@ class ClassFileParser VALUE_OBJ_CLASS_SPEC { Handle class_loader, Handle protection_domain, symbolHandle& parsed_name, + TRAPS) { + return parseClassFile(name, class_loader, protection_domain, NULL, parsed_name, THREAD); + } + instanceKlassHandle parseClassFile(symbolHandle name, + Handle class_loader, + Handle protection_domain, + GrowableArray* cp_patches, + symbolHandle& parsed_name, TRAPS); // Verifier checks diff --git a/hotspot/src/share/vm/classfile/systemDictionary.cpp b/hotspot/src/share/vm/classfile/systemDictionary.cpp index 772716311a2..0908e1c8785 100644 --- a/hotspot/src/share/vm/classfile/systemDictionary.cpp +++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp @@ -937,6 +937,8 @@ klassOop SystemDictionary::parse_stream(symbolHandle class_name, Handle class_loader, Handle protection_domain, ClassFileStream* st, + KlassHandle host_klass, + GrowableArray* cp_patches, TRAPS) { symbolHandle parsed_name; @@ -953,10 +955,10 @@ klassOop SystemDictionary::parse_stream(symbolHandle class_name, instanceKlassHandle k = ClassFileParser(st).parseClassFile(class_name, class_loader, protection_domain, + cp_patches, parsed_name, THREAD); - // We don't redefine the class, so we just need to clean up whether there // was an error or not (don't want to modify any system dictionary // data structures). @@ -973,6 +975,30 @@ klassOop SystemDictionary::parse_stream(symbolHandle class_name, } } + if (host_klass.not_null() && k.not_null()) { + assert(AnonymousClasses, ""); + // If it's anonymous, initialize it now, since nobody else will. + k->set_host_klass(host_klass()); + + { + MutexLocker mu_r(Compile_lock, THREAD); + + // Add to class hierarchy, initialize vtables, and do possible + // deoptimizations. + add_to_hierarchy(k, CHECK_NULL); // No exception, but can block + + // But, do not add to system dictionary. + } + + k->eager_initialize(THREAD); + + // notify jvmti + if (JvmtiExport::should_post_class_load()) { + assert(THREAD->is_Java_thread(), "thread->is_Java_thread()"); + JvmtiExport::post_class_load((JavaThread *) THREAD, k()); + } + } + return k(); } diff --git a/hotspot/src/share/vm/classfile/systemDictionary.hpp b/hotspot/src/share/vm/classfile/systemDictionary.hpp index 38d27d84841..beade180fcd 100644 --- a/hotspot/src/share/vm/classfile/systemDictionary.hpp +++ b/hotspot/src/share/vm/classfile/systemDictionary.hpp @@ -228,6 +228,16 @@ public: Handle class_loader, Handle protection_domain, ClassFileStream* st, + TRAPS) { + KlassHandle nullHandle; + return parse_stream(class_name, class_loader, protection_domain, st, nullHandle, NULL, THREAD); + } + static klassOop parse_stream(symbolHandle class_name, + Handle class_loader, + Handle protection_domain, + ClassFileStream* st, + KlassHandle host_klass, + GrowableArray* cp_patches, TRAPS); // Resolve from stream (called by jni_DefineClass and JVM_DefineClass) diff --git a/hotspot/src/share/vm/classfile/verifier.cpp b/hotspot/src/share/vm/classfile/verifier.cpp index 8373f9beaa0..179de12ea77 100644 --- a/hotspot/src/share/vm/classfile/verifier.cpp +++ b/hotspot/src/share/vm/classfile/verifier.cpp @@ -1600,7 +1600,11 @@ void ClassVerifier::verify_ldc( types = (1 << JVM_CONSTANT_Double) | (1 << JVM_CONSTANT_Long); verify_cp_type(index, cp, types, CHECK_VERIFY(this)); } - if (tag.is_string() || tag.is_unresolved_string()) { + if (tag.is_string() && cp->is_pseudo_string_at(index)) { + current_frame->push_stack( + VerificationType::reference_type( + vmSymbols::java_lang_Object()), CHECK_VERIFY(this)); + } else if (tag.is_string() || tag.is_unresolved_string()) { current_frame->push_stack( VerificationType::reference_type( vmSymbols::java_lang_String()), CHECK_VERIFY(this)); diff --git a/hotspot/src/share/vm/includeDB_gc_parallel b/hotspot/src/share/vm/includeDB_gc_parallel index 1120e9b6ce1..a0321854091 100644 --- a/hotspot/src/share/vm/includeDB_gc_parallel +++ b/hotspot/src/share/vm/includeDB_gc_parallel @@ -30,6 +30,12 @@ collectorPolicy.cpp cmsGCAdaptivePolicyCounters.hpp compiledICHolderKlass.cpp oop.pcgc.inline.hpp +constantPoolKlass.cpp cardTableRS.hpp +constantPoolKlass.cpp oop.pcgc.inline.hpp +constantPoolKlass.cpp psPromotionManager.inline.hpp +constantPoolKlass.cpp psScavenge.inline.hpp +constantPoolKlass.cpp parOopClosures.inline.hpp + genCollectedHeap.cpp concurrentMarkSweepThread.hpp genCollectedHeap.cpp vmCMSOperations.hpp diff --git a/hotspot/src/share/vm/oops/constantPoolKlass.cpp b/hotspot/src/share/vm/oops/constantPoolKlass.cpp index c112597ab11..593b74668ff 100644 --- a/hotspot/src/share/vm/oops/constantPoolKlass.cpp +++ b/hotspot/src/share/vm/oops/constantPoolKlass.cpp @@ -35,6 +35,7 @@ constantPoolOop constantPoolKlass::allocate(int length, TRAPS) { c->set_tags(NULL); c->set_cache(NULL); c->set_pool_holder(NULL); + c->set_flags(0); // only set to non-zero if constant pool is merged by RedefineClasses c->set_orig_length(0); // all fields are initialized; needed for GC @@ -261,10 +262,32 @@ constantPoolKlass::oop_update_pointers(ParCompactionManager* cm, oop obj, void constantPoolKlass::oop_copy_contents(PSPromotionManager* pm, oop obj) { assert(obj->is_constantPool(), "should be constant pool"); + constantPoolOop cp = (constantPoolOop) obj; + if (AnonymousClasses && cp->has_pseudo_string() && cp->tags() != NULL) { + oop* base = (oop*)cp->base(); + for (int i = 0; i < cp->length(); ++i, ++base) { + if (cp->tag_at(i).is_string()) { + if (PSScavenge::should_scavenge(base)) { + pm->claim_or_forward_breadth(base); + } + } + } + } } void constantPoolKlass::oop_push_contents(PSPromotionManager* pm, oop obj) { assert(obj->is_constantPool(), "should be constant pool"); + constantPoolOop cp = (constantPoolOop) obj; + if (AnonymousClasses && cp->has_pseudo_string() && cp->tags() != NULL) { + oop* base = (oop*)cp->base(); + for (int i = 0; i < cp->length(); ++i, ++base) { + if (cp->tag_at(i).is_string()) { + if (PSScavenge::should_scavenge(base)) { + pm->claim_or_forward_depth(base); + } + } + } + } } #endif // SERIALGC @@ -278,6 +301,11 @@ void constantPoolKlass::oop_print_on(oop obj, outputStream* st) { assert(obj->is_constantPool(), "must be constantPool"); Klass::oop_print_on(obj, st); constantPoolOop cp = constantPoolOop(obj); + if (cp->flags() != 0) { + st->print(" - flags : 0x%x", cp->flags()); + if (cp->has_pseudo_string()) st->print(" has_pseudo_string"); + st->cr(); + } // Temp. remove cache so we can do lookups with original indicies. constantPoolCacheHandle cache (THREAD, cp->cache()); @@ -302,7 +330,11 @@ void constantPoolKlass::oop_print_on(oop obj, outputStream* st) { break; case JVM_CONSTANT_UnresolvedString : case JVM_CONSTANT_String : - anObj = cp->string_at(index, CATCH); + if (cp->is_pseudo_string_at(index)) { + anObj = cp->pseudo_string_at(index); + } else { + anObj = cp->string_at(index, CATCH); + } anObj->print_value_on(st); st->print(" {0x%lx}", (address)anObj); break; @@ -382,8 +414,12 @@ void constantPoolKlass::oop_verify_on(oop obj, outputStream* st) { "should be symbol or instance"); } if (cp->tag_at(i).is_string()) { - guarantee((*base)->is_perm(), "should be in permspace"); - guarantee((*base)->is_instance(), "should be instance"); + if (!cp->has_pseudo_string()) { + guarantee((*base)->is_perm(), "should be in permspace"); + guarantee((*base)->is_instance(), "should be instance"); + } else { + // can be non-perm, can be non-instance (array) + } } base++; } diff --git a/hotspot/src/share/vm/oops/constantPoolOop.cpp b/hotspot/src/share/vm/oops/constantPoolOop.cpp index cd8a9d16f59..263b7bbe435 100644 --- a/hotspot/src/share/vm/oops/constantPoolOop.cpp +++ b/hotspot/src/share/vm/oops/constantPoolOop.cpp @@ -25,6 +25,18 @@ # include "incls/_precompiled.incl" # include "incls/_constantPoolOop.cpp.incl" +void constantPoolOopDesc::set_flag_at(FlagBit fb) { + const int MAX_STATE_CHANGES = 2; + for (int i = MAX_STATE_CHANGES + 10; i > 0; i--) { + int oflags = _flags; + int nflags = oflags | (1 << (int)fb); + if (Atomic::cmpxchg(nflags, &_flags, oflags) == oflags) + return; + } + assert(false, "failed to cmpxchg flags"); + _flags |= (1 << (int)fb); // better than nothing +} + klassOop constantPoolOopDesc::klass_at_impl(constantPoolHandle this_oop, int which, TRAPS) { // A resolved constantPool entry will contain a klassOop, otherwise a symbolOop. // It is not safe to rely on the tag bit's here, since we don't have a lock, and the entry and @@ -333,8 +345,10 @@ char* constantPoolOopDesc::string_at_noresolve(int which) { oop entry = *(obj_at_addr(which)); if (entry->is_symbol()) { return ((symbolOop)entry)->as_C_string(); - } else { + } else if (java_lang_String::is_instance(entry)) { return java_lang_String::as_utf8_string(entry); + } else { + return (char*)""; } } @@ -385,6 +399,19 @@ oop constantPoolOopDesc::string_at_impl(constantPoolHandle this_oop, int which, } +bool constantPoolOopDesc::is_pseudo_string_at(int which) { + oop entry = *(obj_at_addr(which)); + if (entry->is_symbol()) + // Not yet resolved, but it will resolve to a string. + return false; + else if (java_lang_String::is_instance(entry)) + return false; // actually, it might be a non-interned or non-perm string + else + // truly pseudo + return true; +} + + bool constantPoolOopDesc::klass_name_at_matches(instanceKlassHandle k, int which) { // Names are interned, so we can compare symbolOops directly diff --git a/hotspot/src/share/vm/oops/constantPoolOop.hpp b/hotspot/src/share/vm/oops/constantPoolOop.hpp index 907d71dfd64..5627059091f 100644 --- a/hotspot/src/share/vm/oops/constantPoolOop.hpp +++ b/hotspot/src/share/vm/oops/constantPoolOop.hpp @@ -41,6 +41,7 @@ class constantPoolOopDesc : public oopDesc { typeArrayOop _tags; // the tag array describing the constant pool's contents constantPoolCacheOop _cache; // the cache holding interpreter runtime information klassOop _pool_holder; // the corresponding class + int _flags; // a few header bits to describe contents for GC int _length; // number of elements in the array // only set to non-zero if constant pool is merged by RedefineClasses int _orig_length; @@ -49,6 +50,16 @@ class constantPoolOopDesc : public oopDesc { void tag_at_put(int which, jbyte t) { tags()->byte_at_put(which, t); } void release_tag_at_put(int which, jbyte t) { tags()->release_byte_at_put(which, t); } + enum FlagBit { + FB_has_pseudo_string = 2 + }; + + int flags() const { return _flags; } + void set_flags(int f) { _flags = f; } + bool flag_at(FlagBit fb) const { return (_flags & (1 << (int)fb)) != 0; } + void set_flag_at(FlagBit fb); + // no clear_flag_at function; they only increase + private: intptr_t* base() const { return (intptr_t*) (((char*) this) + sizeof(constantPoolOopDesc)); } oop* tags_addr() { return (oop*)&_tags; } @@ -82,6 +93,9 @@ class constantPoolOopDesc : public oopDesc { public: typeArrayOop tags() const { return _tags; } + bool has_pseudo_string() const { return flag_at(FB_has_pseudo_string); } + void set_pseudo_string() { set_flag_at(FB_has_pseudo_string); } + // Klass holding pool klassOop pool_holder() const { return _pool_holder; } void set_pool_holder(klassOop k) { oop_store_without_check((oop*)&_pool_holder, (oop) k); } @@ -272,6 +286,27 @@ class constantPoolOopDesc : public oopDesc { return string_at_impl(h_this, which, CHECK_NULL); } + // A "pseudo-string" is an non-string oop that has found is way into + // a String entry. + // Under AnonymousClasses this can happen if the user patches a live + // object into a CONSTANT_String entry of an anonymous class. + // Method oops internally created for method handles may also + // use pseudo-strings to link themselves to related metaobjects. + + bool is_pseudo_string_at(int which); + + oop pseudo_string_at(int which) { + assert(tag_at(which).is_string(), "Corrupted constant pool"); + return *obj_at_addr(which); + } + + void pseudo_string_at_put(int which, oop x) { + assert(AnonymousClasses, ""); + set_pseudo_string(); // mark header + assert(tag_at(which).is_string() || tag_at(which).is_unresolved_string(), "Corrupted constant pool"); + string_at_put(which, x); // this works just fine + } + // only called when we are sure a string entry is already resolved (via an // earlier string_at call. oop resolved_string_at(int which) { @@ -293,6 +328,7 @@ class constantPoolOopDesc : public oopDesc { // UTF8 char* representation was chosen to avoid conversion of // java_lang_Strings at resolved entries into symbolOops // or vice versa. + // Caller is responsible for checking for pseudo-strings. char* string_at_noresolve(int which); jint name_and_type_at(int which) { diff --git a/hotspot/src/share/vm/oops/instanceKlass.hpp b/hotspot/src/share/vm/oops/instanceKlass.hpp index e96bd6bb794..8586ecba03b 100644 --- a/hotspot/src/share/vm/oops/instanceKlass.hpp +++ b/hotspot/src/share/vm/oops/instanceKlass.hpp @@ -147,6 +147,10 @@ class instanceKlass: public Klass { oop _class_loader; // Protection domain. oop _protection_domain; + // Host class, which grants its access privileges to this class also. + // This is only non-null for an anonymous class (AnonymousClasses enabled). + // The host class is either named, or a previously loaded anonymous class. + klassOop _host_klass; // Class signers. objArrayOop _signers; // Name of source file containing this klass, NULL if not specified. @@ -375,6 +379,11 @@ class instanceKlass: public Klass { oop protection_domain() { return _protection_domain; } void set_protection_domain(oop pd) { oop_store((oop*) &_protection_domain, pd); } + // host class + oop host_klass() const { return _host_klass; } + void set_host_klass(oop host) { oop_store((oop*) &_host_klass, host); } + bool is_anonymous() const { return _host_klass != NULL; } + // signers objArrayOop signers() const { return _signers; } void set_signers(objArrayOop s) { oop_store((oop*) &_signers, oop(s)); } @@ -709,6 +718,7 @@ private: oop* adr_constants() const { return (oop*)&this->_constants;} oop* adr_class_loader() const { return (oop*)&this->_class_loader;} oop* adr_protection_domain() const { return (oop*)&this->_protection_domain;} + oop* adr_host_klass() const { return (oop*)&this->_host_klass;} oop* adr_signers() const { return (oop*)&this->_signers;} oop* adr_source_file_name() const { return (oop*)&this->_source_file_name;} oop* adr_source_debug_extension() const { return (oop*)&this->_source_debug_extension;} diff --git a/hotspot/src/share/vm/oops/instanceKlassKlass.cpp b/hotspot/src/share/vm/oops/instanceKlassKlass.cpp index 66e884f395a..94a6bee03ec 100644 --- a/hotspot/src/share/vm/oops/instanceKlassKlass.cpp +++ b/hotspot/src/share/vm/oops/instanceKlassKlass.cpp @@ -81,6 +81,7 @@ void instanceKlassKlass::oop_follow_contents(oop obj) { MarkSweep::mark_and_push(ik->adr_source_debug_extension()); MarkSweep::mark_and_push(ik->adr_inner_classes()); MarkSweep::mark_and_push(ik->adr_protection_domain()); + MarkSweep::mark_and_push(ik->adr_host_klass()); MarkSweep::mark_and_push(ik->adr_signers()); MarkSweep::mark_and_push(ik->adr_generic_signature()); MarkSweep::mark_and_push(ik->adr_class_annotations()); @@ -120,6 +121,7 @@ void instanceKlassKlass::oop_follow_contents(ParCompactionManager* cm, PSParallelCompact::mark_and_push(cm, ik->adr_source_debug_extension()); PSParallelCompact::mark_and_push(cm, ik->adr_inner_classes()); PSParallelCompact::mark_and_push(cm, ik->adr_protection_domain()); + PSParallelCompact::mark_and_push(cm, ik->adr_host_klass()); PSParallelCompact::mark_and_push(cm, ik->adr_signers()); PSParallelCompact::mark_and_push(cm, ik->adr_generic_signature()); PSParallelCompact::mark_and_push(cm, ik->adr_class_annotations()); @@ -159,6 +161,7 @@ int instanceKlassKlass::oop_oop_iterate(oop obj, OopClosure* blk) { blk->do_oop(ik->adr_constants()); blk->do_oop(ik->adr_class_loader()); blk->do_oop(ik->adr_protection_domain()); + blk->do_oop(ik->adr_host_klass()); blk->do_oop(ik->adr_signers()); blk->do_oop(ik->adr_source_file_name()); blk->do_oop(ik->adr_source_debug_extension()); @@ -211,6 +214,8 @@ int instanceKlassKlass::oop_oop_iterate_m(oop obj, OopClosure* blk, if (mr.contains(adr)) blk->do_oop(adr); adr = ik->adr_protection_domain(); if (mr.contains(adr)) blk->do_oop(adr); + adr = ik->adr_host_klass(); + if (mr.contains(adr)) blk->do_oop(adr); adr = ik->adr_signers(); if (mr.contains(adr)) blk->do_oop(adr); adr = ik->adr_source_file_name(); @@ -260,6 +265,7 @@ int instanceKlassKlass::oop_adjust_pointers(oop obj) { MarkSweep::adjust_pointer(ik->adr_constants()); MarkSweep::adjust_pointer(ik->adr_class_loader()); MarkSweep::adjust_pointer(ik->adr_protection_domain()); + MarkSweep::adjust_pointer(ik->adr_host_klass()); MarkSweep::adjust_pointer(ik->adr_signers()); MarkSweep::adjust_pointer(ik->adr_source_file_name()); MarkSweep::adjust_pointer(ik->adr_source_debug_extension()); @@ -295,6 +301,11 @@ void instanceKlassKlass::oop_copy_contents(PSPromotionManager* pm, oop obj) { pm->claim_or_forward_breadth(pd_addr); } + oop* hk_addr = ik->adr_host_klass(); + if (PSScavenge::should_scavenge(hk_addr)) { + pm->claim_or_forward_breadth(hk_addr); + } + oop* sg_addr = ik->adr_signers(); if (PSScavenge::should_scavenge(sg_addr)) { pm->claim_or_forward_breadth(sg_addr); @@ -318,6 +329,11 @@ void instanceKlassKlass::oop_push_contents(PSPromotionManager* pm, oop obj) { pm->claim_or_forward_depth(pd_addr); } + oop* hk_addr = ik->adr_host_klass(); + if (PSScavenge::should_scavenge(hk_addr)) { + pm->claim_or_forward_depth(hk_addr); + } + oop* sg_addr = ik->adr_signers(); if (PSScavenge::should_scavenge(sg_addr)) { pm->claim_or_forward_depth(sg_addr); @@ -421,6 +437,7 @@ klassOop instanceKlassKlass::allocate_instance_klass(int vtable_len, int itable_ ik->set_constants(NULL); ik->set_class_loader(NULL); ik->set_protection_domain(NULL); + ik->set_host_klass(NULL); ik->set_signers(NULL); ik->set_source_file_name(NULL); ik->set_source_debug_extension(NULL); @@ -526,6 +543,7 @@ void instanceKlassKlass::oop_print_on(oop obj, outputStream* st) { st->print(" - constants: "); ik->constants()->print_value_on(st); st->cr(); st->print(" - class loader: "); ik->class_loader()->print_value_on(st); st->cr(); st->print(" - protection domain: "); ik->protection_domain()->print_value_on(st); st->cr(); + st->print(" - host class: "); ik->host_klass()->print_value_on(st); st->cr(); st->print(" - signers: "); ik->signers()->print_value_on(st); st->cr(); if (ik->source_file_name() != NULL) { st->print(" - source file: "); @@ -626,7 +644,7 @@ void instanceKlassKlass::oop_verify_on(oop obj, outputStream* st) { ik->_verify_count = Universe::verify_count(); #endif // Verify that klass is present in SystemDictionary - if (ik->is_loaded()) { + if (ik->is_loaded() && !ik->is_anonymous()) { symbolHandle h_name (thread, ik->name()); Handle h_loader (thread, ik->class_loader()); Handle h_obj(thread, obj); @@ -764,6 +782,9 @@ void instanceKlassKlass::oop_verify_on(oop obj, outputStream* st) { if (ik->protection_domain() != NULL) { guarantee(ik->protection_domain()->is_oop(), "should be oop"); } + if (ik->host_klass() != NULL) { + guarantee(ik->host_klass()->is_oop(), "should be oop"); + } if (ik->signers() != NULL) { guarantee(ik->signers()->is_objArray(), "should be obj array"); } diff --git a/hotspot/src/share/vm/oops/klass.cpp b/hotspot/src/share/vm/oops/klass.cpp index 8d1fba0f4e7..a028f65bb4e 100644 --- a/hotspot/src/share/vm/oops/klass.cpp +++ b/hotspot/src/share/vm/oops/klass.cpp @@ -478,6 +478,24 @@ void Klass::with_array_klasses_do(void f(klassOop k)) { const char* Klass::external_name() const { + if (oop_is_instance()) { + instanceKlass* ik = (instanceKlass*) this; + if (ik->is_anonymous()) { + assert(AnonymousClasses, ""); + intptr_t hash = ik->java_mirror()->identity_hash(); + char hash_buf[40]; + sprintf(hash_buf, "/" UINTX_FORMAT, (uintx)hash); + size_t hash_len = strlen(hash_buf); + + size_t result_len = name()->utf8_length(); + char* result = NEW_RESOURCE_ARRAY(char, result_len + hash_len + 1); + name()->as_klass_external_name(result, (int) result_len + 1); + assert(strlen(result) == result_len, ""); + strcpy(result + result_len, hash_buf); + assert(strlen(result) == result_len + hash_len, ""); + return result; + } + } return name()->as_klass_external_name(); } diff --git a/hotspot/src/share/vm/prims/jvm.cpp b/hotspot/src/share/vm/prims/jvm.cpp index 81302b71225..7f832341c6e 100644 --- a/hotspot/src/share/vm/prims/jvm.cpp +++ b/hotspot/src/share/vm/prims/jvm.cpp @@ -744,6 +744,7 @@ static void is_lock_held_by_thread(Handle loader, PerfCounter* counter, TRAPS) { // common code for JVM_DefineClass() and JVM_DefineClassWithSource() static jclass jvm_define_class_common(JNIEnv *env, const char *name, jobject loader, const jbyte *buf, jsize len, jobject pd, const char *source, TRAPS) { + if (source == NULL) source = "__JVM_DefineClass__"; // Since exceptions can be thrown, class initialization can take place // if name is NULL no check for class name in .class stream has to be made. @@ -782,7 +783,7 @@ static jclass jvm_define_class_common(JNIEnv *env, const char *name, jobject loa JVM_ENTRY(jclass, JVM_DefineClass(JNIEnv *env, const char *name, jobject loader, const jbyte *buf, jsize len, jobject pd)) JVMWrapper2("JVM_DefineClass %s", name); - return jvm_define_class_common(env, name, loader, buf, len, pd, "__JVM_DefineClass__", THREAD); + return jvm_define_class_common(env, name, loader, buf, len, pd, NULL, THREAD); JVM_END diff --git a/hotspot/src/share/vm/prims/jvm.h b/hotspot/src/share/vm/prims/jvm.h index 131e0ddc92b..7dbc38d94b6 100644 --- a/hotspot/src/share/vm/prims/jvm.h +++ b/hotspot/src/share/vm/prims/jvm.h @@ -422,6 +422,14 @@ JVM_DefineClassWithSource(JNIEnv *env, const char *name, jobject loader, const jbyte *buf, jsize len, jobject pd, const char *source); +/* Define a class with a source (MLVM) */ +JNIEXPORT jclass JNICALL +JVM_DefineClassWithCP(JNIEnv *env, const char *name, jobject loader, + const jbyte *buf, jsize len, jobject pd, + const char *source, + // same args as JVM_DefineClassWithSource to this point + jobjectArray constants); + /* * Reflection support functions */ diff --git a/hotspot/src/share/vm/prims/unsafe.cpp b/hotspot/src/share/vm/prims/unsafe.cpp index c17e0214841..081f19fefd2 100644 --- a/hotspot/src/share/vm/prims/unsafe.cpp +++ b/hotspot/src/share/vm/prims/unsafe.cpp @@ -837,6 +837,163 @@ UNSAFE_ENTRY(jclass, Unsafe_DefineClass1(JNIEnv *env, jobject unsafe, jstring na } UNSAFE_END +#define DAC_Args CLS"[B["OBJ +// define a class but do not make it known to the class loader or system dictionary +// - host_class: supplies context for linkage, access control, protection domain, and class loader +// - data: bytes of a class file, a raw memory address (length gives the number of bytes) +// - cp_patches: where non-null entries exist, they replace corresponding CP entries in data + +// When you load an anonymous class U, it works as if you changed its name just before loading, +// to a name that you will never use again. Since the name is lost, no other class can directly +// link to any member of U. Just after U is loaded, the only way to use it is reflectively, +// through java.lang.Class methods like Class.newInstance. + +// Access checks for linkage sites within U continue to follow the same rules as for named classes. +// The package of an anonymous class is given by the package qualifier on the name under which it was loaded. +// An anonymous class also has special privileges to access any member of its host class. +// This is the main reason why this loading operation is unsafe. The purpose of this is to +// allow language implementations to simulate "open classes"; a host class in effect gets +// new code when an anonymous class is loaded alongside it. A less convenient but more +// standard way to do this is with reflection, which can also be set to ignore access +// restrictions. + +// Access into an anonymous class is possible only through reflection. Therefore, there +// are no special access rules for calling into an anonymous class. The relaxed access +// rule for the host class is applied in the opposite direction: A host class reflectively +// access one of its anonymous classes. + +// If you load the same bytecodes twice, you get two different classes. You can reload +// the same bytecodes with or without varying CP patches. + +// By using the CP patching array, you can have a new anonymous class U2 refer to an older one U1. +// The bytecodes for U2 should refer to U1 by a symbolic name (doesn't matter what the name is). +// The CONSTANT_Class entry for that name can be patched to refer directly to U1. + +// This allows, for example, U2 to use U1 as a superclass or super-interface, or as +// an outer class (so that U2 is an anonymous inner class of anonymous U1). +// It is not possible for a named class, or an older anonymous class, to refer by +// name (via its CP) to a newer anonymous class. + +// CP patching may also be used to modify (i.e., hack) the names of methods, classes, +// or type descriptors used in the loaded anonymous class. + +// Finally, CP patching may be used to introduce "live" objects into the constant pool, +// instead of "dead" strings. A compiled statement like println((Object)"hello") can +// be changed to println(greeting), where greeting is an arbitrary object created before +// the anonymous class is loaded. This is useful in dynamic languages, in which +// various kinds of metaobjects must be introduced as constants into bytecode. +// Note the cast (Object), which tells the verifier to expect an arbitrary object, +// not just a literal string. For such ldc instructions, the verifier uses the +// type Object instead of String, if the loaded constant is not in fact a String. + +static oop +Unsafe_DefineAnonymousClass_impl(JNIEnv *env, + jclass host_class, jbyteArray data, jobjectArray cp_patches_jh, + HeapWord* *temp_alloc, + TRAPS) { + + if (UsePerfData) { + ClassLoader::unsafe_defineClassCallCounter()->inc(); + } + + if (data == NULL) { + THROW_0(vmSymbols::java_lang_NullPointerException()); + } + + jint length = typeArrayOop(JNIHandles::resolve_non_null(data))->length(); + jint word_length = (length + sizeof(HeapWord)-1) / sizeof(HeapWord); + HeapWord* body = NEW_C_HEAP_ARRAY(HeapWord, word_length); + if (body == NULL) { + THROW_0(vmSymbols::java_lang_OutOfMemoryError()); + } + + // caller responsible to free it: + (*temp_alloc) = body; + + { + jbyte* array_base = typeArrayOop(JNIHandles::resolve_non_null(data))->byte_at_addr(0); + Copy::conjoint_words((HeapWord*) array_base, body, word_length); + } + + u1* class_bytes = (u1*) body; + int class_bytes_length = (int) length; + if (class_bytes_length < 0) class_bytes_length = 0; + if (class_bytes == NULL + || host_class == NULL + || length != class_bytes_length) + THROW_0(vmSymbols::java_lang_IllegalArgumentException()); + + objArrayHandle cp_patches_h; + if (cp_patches_jh != NULL) { + oop p = JNIHandles::resolve_non_null(cp_patches_jh); + if (!p->is_objArray()) + THROW_0(vmSymbols::java_lang_IllegalArgumentException()); + cp_patches_h = objArrayHandle(THREAD, (objArrayOop)p); + } + + KlassHandle host_klass(THREAD, java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(host_class))); + const char* host_source = host_klass->external_name(); + Handle host_loader(THREAD, host_klass->class_loader()); + Handle host_domain(THREAD, host_klass->protection_domain()); + + GrowableArray* cp_patches = NULL; + if (cp_patches_h.not_null()) { + int alen = cp_patches_h->length(); + for (int i = alen-1; i >= 0; i--) { + oop p = cp_patches_h->obj_at(i); + if (p != NULL) { + Handle patch(THREAD, p); + if (cp_patches == NULL) + cp_patches = new GrowableArray(i+1, i+1, Handle()); + cp_patches->at_put(i, patch); + } + } + } + + ClassFileStream st(class_bytes, class_bytes_length, (char*) host_source); + + instanceKlassHandle anon_klass; + { + symbolHandle no_class_name; + klassOop anonk = SystemDictionary::parse_stream(no_class_name, + host_loader, host_domain, + &st, host_klass, cp_patches, + CHECK_NULL); + if (anonk == NULL) return NULL; + anon_klass = instanceKlassHandle(THREAD, anonk); + } + + // let caller initialize it as needed... + + return anon_klass->java_mirror(); +} + +UNSAFE_ENTRY(jclass, Unsafe_DefineAnonymousClass(JNIEnv *env, jobject unsafe, jclass host_class, jbyteArray data, jobjectArray cp_patches_jh)) +{ + UnsafeWrapper("Unsafe_DefineAnonymousClass"); + ResourceMark rm(THREAD); + + HeapWord* temp_alloc = NULL; + + jobject res_jh = NULL; + + { oop res_oop = Unsafe_DefineAnonymousClass_impl(env, + host_class, data, cp_patches_jh, + &temp_alloc, THREAD); + if (res_oop != NULL) + res_jh = JNIHandles::make_local(env, res_oop); + } + + // try/finally clause: + if (temp_alloc != NULL) { + FREE_C_HEAP_ARRAY(HeapWord, temp_alloc); + } + + return (jclass) res_jh; +} +UNSAFE_END + + UNSAFE_ENTRY(void, Unsafe_MonitorEnter(JNIEnv *env, jobject unsafe, jobject jobj)) UnsafeWrapper("Unsafe_MonitorEnter"); @@ -1292,6 +1449,9 @@ JNINativeMethod memcopy_methods_15[] = { {CC"copyMemory", CC"("ADR ADR"J)V", FN_PTR(Unsafe_CopyMemory)} }; +JNINativeMethod anonk_methods[] = { + {CC"defineAnonymousClass", CC"("DAC_Args")"CLS, FN_PTR(Unsafe_DefineAnonymousClass)}, +}; #undef CC #undef FN_PTR @@ -1354,6 +1514,15 @@ JVM_ENTRY(void, JVM_RegisterUnsafeMethods(JNIEnv *env, jclass unsafecls)) } } } + if (AnonymousClasses) { + env->RegisterNatives(unsafecls, anonk_methods, sizeof(anonk_methods)/sizeof(JNINativeMethod)); + if (env->ExceptionOccurred()) { + if (PrintMiscellaneous && (Verbose || WizardMode)) { + tty->print_cr("Warning: SDK 1.7 Unsafe.defineClass (anonymous version) not found."); + } + env->ExceptionClear(); + } + } int status = env->RegisterNatives(unsafecls, methods, sizeof(methods)/sizeof(JNINativeMethod)); if (env->ExceptionOccurred()) { if (PrintMiscellaneous && (Verbose || WizardMode)) { diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index cba2b991403..b32939b3c49 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -3230,6 +3230,9 @@ class CommandLineFlags { "Skip assert() and verify() which page-in unwanted shared " \ "objects. ") \ \ + product(bool, AnonymousClasses, false, \ + "support sun.misc.Unsafe.defineAnonymousClass") \ + \ product(bool, TaggedStackInterpreter, false, \ "Insert tags in interpreter execution stack for oopmap generaion")\ \ diff --git a/hotspot/src/share/vm/runtime/reflection.cpp b/hotspot/src/share/vm/runtime/reflection.cpp index d57b6670df1..3bc1b029d4c 100644 --- a/hotspot/src/share/vm/runtime/reflection.cpp +++ b/hotspot/src/share/vm/runtime/reflection.cpp @@ -456,10 +456,32 @@ bool Reflection::verify_class_access(klassOop current_class, klassOop new_class, return can_relax_access_check_for(current_class, new_class, classloader_only); } +static bool under_host_klass(instanceKlass* ik, klassOop host_klass) { + DEBUG_ONLY(int inf_loop_check = 1000 * 1000 * 1000); + for (;;) { + klassOop hc = (klassOop) ik->host_klass(); + if (hc == NULL) return false; + if (hc == host_klass) return true; + ik = instanceKlass::cast(hc); + + // There's no way to make a host class loop short of patching memory. + // Therefore there cannot be a loop here unles there's another bug. + // Still, let's check for it. + assert(--inf_loop_check > 0, "no host_klass loop"); + } +} + bool Reflection::can_relax_access_check_for( klassOop accessor, klassOop accessee, bool classloader_only) { instanceKlass* accessor_ik = instanceKlass::cast(accessor); instanceKlass* accessee_ik = instanceKlass::cast(accessee); + + // If either is on the other's host_klass chain, access is OK, + // because one is inside the other. + if (under_host_klass(accessor_ik, accessee) || + under_host_klass(accessee_ik, accessor)) + return true; + if (RelaxAccessControlCheck || (accessor_ik->major_version() < JAVA_1_5_VERSION && accessee_ik->major_version() < JAVA_1_5_VERSION)) { diff --git a/hotspot/src/share/vm/utilities/constantTag.hpp b/hotspot/src/share/vm/utilities/constantTag.hpp index b8a213f8b7b..07a8be76d9c 100644 --- a/hotspot/src/share/vm/utilities/constantTag.hpp +++ b/hotspot/src/share/vm/utilities/constantTag.hpp @@ -71,6 +71,7 @@ class constantTag VALUE_OBJ_CLASS_SPEC { bool is_string_index() const { return _tag == JVM_CONSTANT_StringIndex; } bool is_klass_reference() const { return is_klass_index() || is_unresolved_klass(); } + bool is_klass_or_reference() const{ return is_klass() || is_klass_reference(); } bool is_field_or_method() const { return is_field() || is_method() || is_interface_method(); } bool is_symbol() const { return is_utf8(); } From 4e2c4fb4bd73e9f34e4967c6df6713bfd807bb7f Mon Sep 17 00:00:00 2001 From: John R Rose Date: Wed, 12 Nov 2008 23:26:45 -0800 Subject: [PATCH 126/267] 6770949: minor tweaks before 6655638 Minor cleanups & tuning of array.hpp, debug.cpp, growableArray.hpp, hashtable.cpp Reviewed-by: kvn --- hotspot/src/share/vm/utilities/array.hpp | 39 +++++++++++++++---- hotspot/src/share/vm/utilities/debug.cpp | 20 ++++++---- .../src/share/vm/utilities/growableArray.hpp | 17 +++++++- hotspot/src/share/vm/utilities/hashtable.cpp | 7 +++- 4 files changed, 63 insertions(+), 20 deletions(-) diff --git a/hotspot/src/share/vm/utilities/array.hpp b/hotspot/src/share/vm/utilities/array.hpp index 1c229505fe1..7dee671cc58 100644 --- a/hotspot/src/share/vm/utilities/array.hpp +++ b/hotspot/src/share/vm/utilities/array.hpp @@ -40,11 +40,18 @@ class ResourceArray: public ResourceObj { _length = 0; _data = NULL; DEBUG_ONLY(init_nesting();) + // client may call initialize, at most once } ResourceArray(size_t esize, int length) { + DEBUG_ONLY(_data = NULL); + initialize(esize, length); + } + + void initialize(size_t esize, int length) { assert(length >= 0, "illegal length"); + assert(_data == NULL, "must be new object"); _length = length; _data = resource_allocate_bytes(esize * length); DEBUG_ONLY(init_nesting();) @@ -111,7 +118,10 @@ class CHeapArray: public CHeapObj { /* creation */ \ array_name() : base_class() {} \ array_name(const int length) : base_class(esize, length) {} \ - array_name(const int length, const etype fx) : base_class(esize, length) { \ + array_name(const int length, const etype fx) { initialize(length, fx); } \ + void initialize(const int length) { base_class::initialize(esize, length); } \ + void initialize(const int length, const etype fx) { \ + initialize(length); \ for (int i = 0; i < length; i++) ((etype*)_data)[i] = fx; \ } \ \ @@ -157,16 +167,29 @@ class CHeapArray: public CHeapObj { \ public: \ /* creation */ \ - stack_name() : array_name() { _size = 0; } \ - stack_name(const int size) : array_name(size){ _length = 0; _size = size; } \ - stack_name(const int size, const etype fx) : array_name(size, fx) { _size = size; } \ + stack_name() : array_name() { _size = 0; } \ + stack_name(const int size) { initialize(size); } \ + stack_name(const int size, const etype fx) { initialize(size, fx); } \ + void initialize(const int size, const etype fx) { \ + _size = size; \ + array_name::initialize(size, fx); \ + /* _length == size, allocation and size are the same */ \ + } \ + void initialize(const int size) { \ + _size = size; \ + array_name::initialize(size); \ + _length = 0; /* reset length to zero; _size records the allocation */ \ + } \ \ /* standard operations */ \ int size() const { return _size; } \ \ - void push(const etype x) { \ - if (length() >= size()) expand(esize, length(), _size); \ - ((etype*)_data)[_length++] = x; \ + int push(const etype x) { \ + int len = length(); \ + if (len >= size()) expand(esize, len, _size); \ + ((etype*)_data)[len] = x; \ + _length = len+1; \ + return len; \ } \ \ etype pop() { \ @@ -235,7 +258,7 @@ class CHeapArray: public CHeapObj { int capacity() const { return size(); } \ void clear() { truncate(0); } \ void trunc_to(const int length) { truncate(length); } \ - void append(const etype x) { push(x); } \ + int append(const etype x) { return push(x); } \ void appendAll(const stack_name* stack) { push_all(stack); } \ etype last() const { return top(); } \ }; \ diff --git a/hotspot/src/share/vm/utilities/debug.cpp b/hotspot/src/share/vm/utilities/debug.cpp index 10a1b166514..20241e5bd44 100644 --- a/hotspot/src/share/vm/utilities/debug.cpp +++ b/hotspot/src/share/vm/utilities/debug.cpp @@ -567,7 +567,7 @@ static void find(intptr_t x, bool print_pc) { } // the InlineCacheBuffer is using stubs generated into a buffer blob if (InlineCacheBuffer::contains(addr)) { - tty->print_cr(INTPTR_FORMAT "is pointing into InlineCacheBuffer", addr); + tty->print_cr(INTPTR_FORMAT " is pointing into InlineCacheBuffer", addr); return; } VtableStub* v = VtableStubs::stub_containing(addr); @@ -595,7 +595,7 @@ static void find(intptr_t x, bool print_pc) { return; } - if (Universe::heap()->is_in_reserved(addr)) { + if (Universe::heap()->is_in(addr)) { HeapWord* p = Universe::heap()->block_start(addr); bool print = false; // If we couldn't find it it just may mean that heap wasn't parseable @@ -621,24 +621,28 @@ static void find(intptr_t x, bool print_pc) { } return; } + } else if (Universe::heap()->is_in_reserved(addr)) { + tty->print_cr(INTPTR_FORMAT " is an unallocated location in the heap", addr); + return; } + if (JNIHandles::is_global_handle((jobject) addr)) { - tty->print_cr(INTPTR_FORMAT "is a global jni handle", addr); + tty->print_cr(INTPTR_FORMAT " is a global jni handle", addr); return; } if (JNIHandles::is_weak_global_handle((jobject) addr)) { - tty->print_cr(INTPTR_FORMAT "is a weak global jni handle", addr); + tty->print_cr(INTPTR_FORMAT " is a weak global jni handle", addr); return; } if (JNIHandleBlock::any_contains((jobject) addr)) { - tty->print_cr(INTPTR_FORMAT "is a local jni handle", addr); + tty->print_cr(INTPTR_FORMAT " is a local jni handle", addr); return; } for(JavaThread *thread = Threads::first(); thread; thread = thread->next()) { - // Check for priviledge stack + // Check for privilege stack if (thread->privileged_stack_top() != NULL && thread->privileged_stack_top()->contains(addr)) { - tty->print_cr(INTPTR_FORMAT "is pointing into the priviledge stack for thread: " INTPTR_FORMAT, addr, thread); + tty->print_cr(INTPTR_FORMAT " is pointing into the privilege stack for thread: " INTPTR_FORMAT, addr, thread); return; } // If the addr is a java thread print information about that. @@ -659,7 +663,7 @@ static void find(intptr_t x, bool print_pc) { return; } - tty->print_cr(INTPTR_FORMAT "is pointing to unknown location", addr); + tty->print_cr(INTPTR_FORMAT " is pointing to unknown location", addr); } diff --git a/hotspot/src/share/vm/utilities/growableArray.hpp b/hotspot/src/share/vm/utilities/growableArray.hpp index 208b145185f..ab4eeb5411e 100644 --- a/hotspot/src/share/vm/utilities/growableArray.hpp +++ b/hotspot/src/share/vm/utilities/growableArray.hpp @@ -111,6 +111,12 @@ class GenericGrowableArray : public ResourceObj { } void* raw_allocate(int elementSize); + + // some uses pass the Thread explicitly for speed (4990299 tuning) + void* raw_allocate(Thread* thread, int elementSize) { + assert(on_stack(), "fast ResourceObj path only"); + return (void*)resource_allocate_bytes(thread, elementSize * _max); + } }; template class GrowableArray : public GenericGrowableArray { @@ -121,6 +127,11 @@ template class GrowableArray : public GenericGrowableArray { void raw_at_put_grow(int i, const E& p, const E& fill); void clear_and_deallocate(); public: + GrowableArray(Thread* thread, int initial_size) : GenericGrowableArray(initial_size, 0, false) { + _data = (E*)raw_allocate(thread, sizeof(E)); + for (int i = 0; i < _max; i++) ::new ((void*)&_data[i]) E(); + } + GrowableArray(int initial_size, bool C_heap = false) : GenericGrowableArray(initial_size, 0, C_heap) { _data = (E*)raw_allocate(sizeof(E)); for (int i = 0; i < _max; i++) ::new ((void*)&_data[i]) E(); @@ -159,10 +170,12 @@ template class GrowableArray : public GenericGrowableArray { void print(); - void append(const E& elem) { + int append(const E& elem) { check_nesting(); if (_len == _max) grow(_len); - _data[_len++] = elem; + int idx = _len++; + _data[idx] = elem; + return idx; } void append_if_missing(const E& elem) { diff --git a/hotspot/src/share/vm/utilities/hashtable.cpp b/hotspot/src/share/vm/utilities/hashtable.cpp index 58d675d001a..8efa44a203c 100644 --- a/hotspot/src/share/vm/utilities/hashtable.cpp +++ b/hotspot/src/share/vm/utilities/hashtable.cpp @@ -43,9 +43,11 @@ BasicHashtableEntry* BasicHashtable::new_entry(unsigned int hashValue) { entry = _free_list; _free_list = _free_list->next(); } else { - const int block_size = 500; - if (_first_free_entry == _end_block) { + if (_first_free_entry + _entry_size >= _end_block) { + int block_size = MIN2(512, MAX2((int)_table_size / 2, (int)_number_of_entries)); int len = _entry_size * block_size; + len = 1 << log2_intptr(len); // round down to power of 2 + assert(len >= _entry_size, ""); _first_free_entry = NEW_C_HEAP_ARRAY(char, len); _end_block = _first_free_entry + len; } @@ -53,6 +55,7 @@ BasicHashtableEntry* BasicHashtable::new_entry(unsigned int hashValue) { _first_free_entry += _entry_size; } + assert(_entry_size % HeapWordSize == 0, ""); entry->set_hash(hashValue); return entry; } From ce3f3dd8d3063c633fcca64acb7694f2ffa75e2e Mon Sep 17 00:00:00 2001 From: Vladimir Kozlov Date: Thu, 13 Nov 2008 14:50:04 -0800 Subject: [PATCH 127/267] 6767659: Conversion from i486 to x86 missed some entries in makefiles Fixed missed entries. Reviewed-by: never --- hotspot/make/linux/makefiles/top.make | 4 +-- hotspot/make/solaris/makefiles/amd64.make | 1 - hotspot/make/solaris/makefiles/dtrace.make | 5 ++-- hotspot/make/solaris/makefiles/fastdebug.make | 28 ++++++++----------- hotspot/make/solaris/makefiles/i486.make | 4 +-- hotspot/make/solaris/makefiles/sparc.make | 4 +-- hotspot/make/solaris/makefiles/top.make | 4 +-- hotspot/src/share/vm/adlc/archDesc.cpp | 6 ++-- 8 files changed, 24 insertions(+), 32 deletions(-) diff --git a/hotspot/make/linux/makefiles/top.make b/hotspot/make/linux/makefiles/top.make index 46362ca16fa..1c212c6d3b9 100644 --- a/hotspot/make/linux/makefiles/top.make +++ b/hotspot/make/linux/makefiles/top.make @@ -85,9 +85,9 @@ Incremental_Lists = $(Cached_db) AD_Dir = $(GENERATED)/adfiles ADLC = $(AD_Dir)/adlc -AD_Spec = $(GAMMADIR)/src/cpu/$(Platform_arch)/vm/$(Platform_arch).ad +AD_Spec = $(GAMMADIR)/src/cpu/$(Platform_arch)/vm/$(Platform_arch_model).ad AD_Src = $(GAMMADIR)/src/share/vm/adlc -AD_Names = ad_$(Platform_arch).hpp ad_$(Platform_arch).cpp +AD_Names = ad_$(Platform_arch_model).hpp ad_$(Platform_arch_model).cpp AD_Files = $(AD_Names:%=$(AD_Dir)/%) # AD_Files_If_Required/COMPILER1 = ad_stuff diff --git a/hotspot/make/solaris/makefiles/amd64.make b/hotspot/make/solaris/makefiles/amd64.make index 7ce14eae1db..dca51190d55 100644 --- a/hotspot/make/solaris/makefiles/amd64.make +++ b/hotspot/make/solaris/makefiles/amd64.make @@ -26,7 +26,6 @@ CFLAGS += -DVM_LITTLE_ENDIAN # Not included in includeDB because it has no dependencies -# Obj_Files += solaris_amd64.o Obj_Files += solaris_x86_64.o # diff --git a/hotspot/make/solaris/makefiles/dtrace.make b/hotspot/make/solaris/makefiles/dtrace.make index bcc7819aa43..e2ac73e47f2 100644 --- a/hotspot/make/solaris/makefiles/dtrace.make +++ b/hotspot/make/solaris/makefiles/dtrace.make @@ -87,17 +87,16 @@ ifneq ("${ISA}","${BUILDARCH}") XLIBJVM_DB = 64/$(LIBJVM_DB) XLIBJVM_DTRACE = 64/$(LIBJVM_DTRACE) -XARCH = $(subst sparcv9,v9,$(shell echo $(ISA))) $(XLIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE) @echo Making $@ $(QUIETLY) mkdir -p 64/ ; \ - $(CC) $(SYMFLAG) $(ARCHFLAG/$(XARCH)) -D$(TYPE) -I. -I$(GENERATED) \ + $(CC) $(SYMFLAG) $(ARCHFLAG/$(ISA)) -D$(TYPE) -I. -I$(GENERATED) \ $(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -lc $(XLIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE) @echo Making $@ $(QUIETLY) mkdir -p 64/ ; \ - $(CC) $(SYMFLAG) $(ARCHFLAG/$(XARCH)) -D$(TYPE) -I. \ + $(CC) $(SYMFLAG) $(ARCHFLAG/$(ISA)) -D$(TYPE) -I. \ $(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc -lthread -ldoor endif # ifneq ("${ISA}","${BUILDARCH}") diff --git a/hotspot/make/solaris/makefiles/fastdebug.make b/hotspot/make/solaris/makefiles/fastdebug.make index 2abcea4e999..084814d6758 100644 --- a/hotspot/make/solaris/makefiles/fastdebug.make +++ b/hotspot/make/solaris/makefiles/fastdebug.make @@ -54,39 +54,33 @@ endif # COMPILER_REV_NUMERIC == 505 ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \<= 504), 1) # Compilation of *_.cpp can take an hour or more at O3. Use O2 # See comments at top of sparc.make. -OPT_CFLAGS/ad_$(Platform_arch).o = $(OPT_CFLAGS/SLOWER) -OPT_CFLAGS/dfa_$(Platform_arch).o = $(OPT_CFLAGS/SLOWER) +OPT_CFLAGS/ad_$(Platform_arch_model).o = $(OPT_CFLAGS/SLOWER) +OPT_CFLAGS/dfa_$(Platform_arch_model).o = $(OPT_CFLAGS/SLOWER) endif # COMPILER_REV_NUMERIC <= 504 -ifeq (${COMPILER_REV_NUMERIC}, 500) -# Avoid a compiler bug caused by using -xO -g -# Since the bug also occurs with -xO0, use an innocuous value (must not be null) -OPT_CFLAGS/c1_LIROptimizer_i486.o = -c -endif - ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \< 505), 1) -# Same problem with Solaris/x86 compiler (both 5.0 and 5.2) on ad_i486.cpp. -# CC build time is also too long for ad_i486_{gen,misc}.o -OPT_CFLAGS/ad_i486.o = -c -OPT_CFLAGS/ad_i486_gen.o = -c -OPT_CFLAGS/ad_i486_misc.o = -c -ifeq ($(Platform_arch), i486) +# Same problem with Solaris/x86 compiler (both 5.0 and 5.2) on ad_x86_{32,64}.cpp. +# CC build time is also too long for ad_$(Platform_arch_model)_{gen,misc}.o +OPT_CFLAGS/ad_$(Platform_arch_model).o = -c +OPT_CFLAGS/ad_$(Platform_arch_model)_gen.o = -c +OPT_CFLAGS/ad_$(Platform_arch_model)_misc.o = -c +ifeq ($(Platform_arch), x86) # Same problem for the wrapper roosts: jni.o jvm.o OPT_CFLAGS/jni.o = -c OPT_CFLAGS/jvm.o = -c # Same problem in parse2.o (probably the Big Switch over bytecodes) OPT_CFLAGS/parse2.o = -c -endif # Platform_arch == i486 +endif # Platform_arch == x86 endif # Frame size > 100k if we allow inlining via -g0! DEBUG_CFLAGS/bytecodeInterpreter.o = -g DEBUG_CFLAGS/bytecodeInterpreterWithChecks.o = -g -ifeq ($(Platform_arch), i486) +ifeq ($(Platform_arch), x86) # ube explodes on x86 OPT_CFLAGS/bytecodeInterpreter.o = -xO1 OPT_CFLAGS/bytecodeInterpreterWithChecks.o = -xO1 -endif # Platform_arch == i486 +endif # Platform_arch == x86 endif # Platform_compiler == sparcWorks diff --git a/hotspot/make/solaris/makefiles/i486.make b/hotspot/make/solaris/makefiles/i486.make index bd81b0fcd16..320035fd4d1 100644 --- a/hotspot/make/solaris/makefiles/i486.make +++ b/hotspot/make/solaris/makefiles/i486.make @@ -35,13 +35,13 @@ Obj_Files += solaris_x86_32.o ifeq ("${Platform_compiler}", "sparcWorks") # _lwp_create_interpose must have a frame -OPT_CFLAGS/os_solaris_i486.o = -xO1 +OPT_CFLAGS/os_solaris_x86.o = -xO1 else ifeq ("${Platform_compiler}", "gcc") # gcc # _lwp_create_interpose must have a frame -OPT_CFLAGS/os_solaris_i486.o = -fno-omit-frame-pointer +OPT_CFLAGS/os_solaris_x86.o = -fno-omit-frame-pointer # else # error diff --git a/hotspot/make/solaris/makefiles/sparc.make b/hotspot/make/solaris/makefiles/sparc.make index 6bd01d1fab1..e089494964d 100644 --- a/hotspot/make/solaris/makefiles/sparc.make +++ b/hotspot/make/solaris/makefiles/sparc.make @@ -26,7 +26,7 @@ Obj_Files += solaris_sparc.o ASFLAGS += $(AS_ARCHFLAG) ifeq ("${Platform_compiler}", "sparcWorks") -ifeq ($(shell expr $(COMPILER_REV_NUMARIC) \< 505), 1) +ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \< 505), 1) # For 5.2 ad_sparc file is compiled with -O2 %%%% remove when adlc is fixed OPT_CFLAGS/ad_sparc.o = $(OPT_CFLAGS/SLOWER) OPT_CFLAGS/dfa_sparc.o = $(OPT_CFLAGS/SLOWER) @@ -39,7 +39,7 @@ OPT_CFLAGS/carRememberedSet.o = $(OPT_CFLAGS/O2) OPT_CFLAGS/jniHandles.o = $(OPT_CFLAGS/O2) # CC brings an US-II to its knees compiling the vmStructs asserts under -xO4 OPT_CFLAGS/vmStructs.o = $(OPT_CFLAGS/O2) -endif +endif # COMPILER_REV_NUMERIC < 505 else # Options for gcc OPT_CFLAGS/ad_sparc.o = $(OPT_CFLAGS/SLOWER) diff --git a/hotspot/make/solaris/makefiles/top.make b/hotspot/make/solaris/makefiles/top.make index 4b235d40520..6affc873cf6 100644 --- a/hotspot/make/solaris/makefiles/top.make +++ b/hotspot/make/solaris/makefiles/top.make @@ -83,9 +83,9 @@ Incremental_Lists =$(GENERATED)/$(Cached_db) AD_Dir = $(GENERATED)/adfiles ADLC = $(AD_Dir)/adlc -AD_Spec = $(GAMMADIR)/src/cpu/$(Platform_arch)/vm/$(Platform_arch).ad +AD_Spec = $(GAMMADIR)/src/cpu/$(Platform_arch)/vm/$(Platform_arch_model).ad AD_Src = $(GAMMADIR)/src/share/vm/adlc -AD_Names = ad_$(Platform_arch).hpp ad_$(Platform_arch).cpp +AD_Names = ad_$(Platform_arch_model).hpp ad_$(Platform_arch_model).cpp AD_Files = $(AD_Names:%=$(AD_Dir)/%) # AD_Files_If_Required/COMPILER1 = ad_stuff diff --git a/hotspot/src/share/vm/adlc/archDesc.cpp b/hotspot/src/share/vm/adlc/archDesc.cpp index 0aa15064c5b..9702fb47730 100644 --- a/hotspot/src/share/vm/adlc/archDesc.cpp +++ b/hotspot/src/share/vm/adlc/archDesc.cpp @@ -212,9 +212,9 @@ ArchDesc::ArchDesc() // Initialize I/O Files _ADL_file._name = NULL; _ADL_file._fp = NULL; // Machine dependent output files - _DFA_file._name = "dfa_i486.cpp"; _DFA_file._fp = NULL; - _HPP_file._name = "ad_i486.hpp"; _HPP_file._fp = NULL; - _CPP_file._name = "ad_i486.cpp"; _CPP_file._fp = NULL; + _DFA_file._name = NULL; _DFA_file._fp = NULL; + _HPP_file._name = NULL; _HPP_file._fp = NULL; + _CPP_file._name = NULL; _CPP_file._fp = NULL; _bug_file._name = "bugs.out"; _bug_file._fp = NULL; // Initialize Register & Pipeline Form Pointers From 8db7ed98eabd09be95906db2afd2c432ac08a055 Mon Sep 17 00:00:00 2001 From: Xue-Lei Andrew Fan Date: Thu, 13 Nov 2008 23:08:11 -0800 Subject: [PATCH 128/267] 6728126: Parsing Extensions in Client Hello message is done in a wrong way The inputStream.read(byte[], int, 0) is not always return zero. Reviewed-by: wetmore, weijun --- .../sun/security/ssl/HelloExtensions.java | 7 +- .../ssl/SSLEngineImpl/EmptyExtensionData.java | 196 ++++++++++++++++++ 2 files changed, 201 insertions(+), 2 deletions(-) create mode 100644 jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLEngineImpl/EmptyExtensionData.java diff --git a/jdk/src/share/classes/sun/security/ssl/HelloExtensions.java b/jdk/src/share/classes/sun/security/ssl/HelloExtensions.java index 51080b59e47..2a21489b2a6 100644 --- a/jdk/src/share/classes/sun/security/ssl/HelloExtensions.java +++ b/jdk/src/share/classes/sun/security/ssl/HelloExtensions.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2006-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 @@ -218,7 +218,10 @@ final class UnknownExtension extends HelloExtension { throws IOException { super(type); data = new byte[len]; - s.read(data); + // s.read() does not handle 0-length arrays. + if (len != 0) { + s.read(data); + } } int length() { diff --git a/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLEngineImpl/EmptyExtensionData.java b/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLEngineImpl/EmptyExtensionData.java new file mode 100644 index 00000000000..3d86cc90e9d --- /dev/null +++ b/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLEngineImpl/EmptyExtensionData.java @@ -0,0 +1,196 @@ +/* + * 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. + * + * 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 6728126 + * @summary Parsing Extensions in Client Hello message is done in a wrong way + */ + +import javax.net.ssl.*; +import javax.net.ssl.SSLEngineResult.*; +import java.io.*; +import java.security.*; +import java.nio.*; + +public class EmptyExtensionData { + + private static boolean debug = false; + + private static String pathToStores = "../../../../../../../etc"; + private static String keyStoreFile = "keystore"; + private static String trustStoreFile = "truststore"; + private static String passwd = "passphrase"; + + private static String keyFilename = + System.getProperty("test.src", "./") + "/" + pathToStores + + "/" + keyStoreFile; + private static String trustFilename = + System.getProperty("test.src", "./") + "/" + pathToStores + + "/" + trustStoreFile; + + private static void checkDone(SSLEngine ssle) throws Exception { + if (!ssle.isInboundDone()) { + throw new Exception("isInboundDone isn't done"); + } + if (!ssle.isOutboundDone()) { + throw new Exception("isOutboundDone isn't done"); + } + } + + private static void runTest(SSLEngine ssle) throws Exception { + // a client hello message with an empty extension data + byte[] msg_clihello = { + (byte)0x16, (byte)0x03, (byte)0x01, (byte)0x00, + (byte)0x6f, (byte)0x01, (byte)0x00, (byte)0x00, + (byte)0x6b, (byte)0x03, (byte)0x01, (byte)0x48, + (byte)0x90, (byte)0x71, (byte)0xfc, (byte)0xf9, + (byte)0xa2, (byte)0x3a, (byte)0xd7, (byte)0xa8, + (byte)0x0b, (byte)0x25, (byte)0xf1, (byte)0x2b, + (byte)0x88, (byte)0x80, (byte)0x66, (byte)0xca, + (byte)0x07, (byte)0x78, (byte)0x2a, (byte)0x08, + (byte)0x9d, (byte)0x62, (byte)0x1d, (byte)0x89, + (byte)0xc9, (byte)0x1e, (byte)0x1f, (byte)0xe5, + (byte)0x92, (byte)0xfe, (byte)0x8d, (byte)0x00, + (byte)0x00, (byte)0x24, (byte)0x00, (byte)0x88, + (byte)0x00, (byte)0x87, (byte)0x00, (byte)0x39, + (byte)0x00, (byte)0x38, (byte)0x00, (byte)0x84, + (byte)0x00, (byte)0x35, (byte)0x00, (byte)0x45, + (byte)0x00, (byte)0x44, (byte)0x00, (byte)0x33, + (byte)0x00, (byte)0x32, (byte)0x00, (byte)0x41, + (byte)0x00, (byte)0x04, (byte)0x00, (byte)0x05, + (byte)0x00, (byte)0x2f, (byte)0x00, (byte)0x16, + (byte)0x00, (byte)0x13, (byte)0xfe, (byte)0xff, + (byte)0x00, (byte)0x0a, (byte)0x01, (byte)0x00, + (byte)0x00, (byte)0x1e, (byte)0x00, (byte)0x00, + (byte)0x00, (byte)0x16, (byte)0x00, (byte)0x14, + (byte)0x00, (byte)0x00, (byte)0x11, (byte)0x6a, + (byte)0x75, (byte)0x73, (byte)0x74, (byte)0x69, + (byte)0x6e, (byte)0x2e, (byte)0x75, (byte)0x6b, + (byte)0x2e, (byte)0x73, (byte)0x75, (byte)0x6e, + (byte)0x2e, (byte)0x63, (byte)0x6f, (byte)0x6d, + (byte)0x00, (byte)0x23, (byte)0x00, (byte)0x00 + }; + ByteBuffer bf_clihello = ByteBuffer.wrap(msg_clihello); + + SSLSession session = ssle.getSession(); + int appBufferMax = session.getApplicationBufferSize(); + int netBufferMax = session.getPacketBufferSize(); + + ByteBuffer serverIn = ByteBuffer.allocate(appBufferMax + 50); + ByteBuffer serverOut = ByteBuffer.wrap("I'm Server".getBytes()); + ByteBuffer sTOc = ByteBuffer.allocate(netBufferMax); + + ssle.beginHandshake(); + + // unwrap the clientHello message. + SSLEngineResult result = ssle.unwrap(bf_clihello, serverIn); + System.out.println("server unwrap " + result); + runDelegatedTasks(result, ssle); + + // one more step, ensure the clientHello message is parsed. + SSLEngineResult.HandshakeStatus status = ssle.getHandshakeStatus(); + if ( status == HandshakeStatus.NEED_UNWRAP) { + result = ssle.unwrap(bf_clihello, serverIn); + System.out.println("server unwrap " + result); + runDelegatedTasks(result, ssle); + } else if ( status == HandshakeStatus.NEED_WRAP) { + result = ssle.wrap(serverOut, sTOc); + System.out.println("server wrap " + result); + runDelegatedTasks(result, ssle); + } else { + throw new Exception("unexpected handshake status " + status); + } + + // enough, stop + } + + /* + * If the result indicates that we have outstanding tasks to do, + * go ahead and run them in this thread. + */ + private static void runDelegatedTasks(SSLEngineResult result, + SSLEngine engine) throws Exception { + + if (result.getHandshakeStatus() == HandshakeStatus.NEED_TASK) { + Runnable runnable; + while ((runnable = engine.getDelegatedTask()) != null) { + log("\trunning delegated task..."); + runnable.run(); + } + HandshakeStatus hsStatus = engine.getHandshakeStatus(); + if (hsStatus == HandshakeStatus.NEED_TASK) { + throw new Exception( + "handshake shouldn't need additional tasks"); + } + log("\tnew HandshakeStatus: " + hsStatus); + } + } + + public static void main(String args[]) throws Exception { + + SSLEngine ssle = createSSLEngine(keyFilename, trustFilename); + runTest(ssle); + + System.out.println("Test Passed."); + } + + /* + * Create an initialized SSLContext to use for this test. + */ + static private SSLEngine createSSLEngine(String keyFile, String trustFile) + throws Exception { + + SSLEngine ssle; + + KeyStore ks = KeyStore.getInstance("JKS"); + KeyStore ts = KeyStore.getInstance("JKS"); + + char[] passphrase = "passphrase".toCharArray(); + + ks.load(new FileInputStream(keyFile), passphrase); + ts.load(new FileInputStream(trustFile), passphrase); + + KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509"); + kmf.init(ks, passphrase); + + TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509"); + tmf.init(ts); + + SSLContext sslCtx = SSLContext.getInstance("TLS"); + + sslCtx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null); + + ssle = sslCtx.createSSLEngine(); + ssle.setUseClientMode(false); + + return ssle; + } + + + private static void log(String str) { + if (debug) { + System.out.println(str); + } + } +} From f377bd69c3a0604254da220622ae2035f2595a3c Mon Sep 17 00:00:00 2001 From: Xue-Lei Andrew Fan Date: Thu, 13 Nov 2008 23:25:10 -0800 Subject: [PATCH 129/267] 6745052: SLServerSocket file descriptor leak SSLServerSocketImpl.checkEnabledSuites() does not release the temporary socket properly Reviewed-by: wetmore, weijun --- .../sun/security/ssl/BaseSSLSocketImpl.java | 12 +++++++----- .../sun/security/ssl/SSLServerSocketImpl.java | 18 +++++++++++------- .../sun/security/ssl/SSLSocketImpl.java | 19 ++++++++++++++++++- 3 files changed, 36 insertions(+), 13 deletions(-) diff --git a/jdk/src/share/classes/sun/security/ssl/BaseSSLSocketImpl.java b/jdk/src/share/classes/sun/security/ssl/BaseSSLSocketImpl.java index 8ca8e76ac68..a918b147998 100644 --- a/jdk/src/share/classes/sun/security/ssl/BaseSSLSocketImpl.java +++ b/jdk/src/share/classes/sun/security/ssl/BaseSSLSocketImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2002-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 @@ -256,10 +256,12 @@ abstract class BaseSSLSocketImpl extends SSLSocket { // ignore } } finally { - // we call close on the underlying socket anyway, but be - // doubly sure all resources get released. - // note that we don't need to worry about self, the GC - // will finalize that separately + // We called close on the underlying socket above to + // make doubly sure all resources got released. We + // don't finalize self in the case of overlain sockets, + // that's a different object which the GC will finalize + // separately. + super.finalize(); } } diff --git a/jdk/src/share/classes/sun/security/ssl/SSLServerSocketImpl.java b/jdk/src/share/classes/sun/security/ssl/SSLServerSocketImpl.java index 88bab016175..68037ca5d73 100644 --- a/jdk/src/share/classes/sun/security/ssl/SSLServerSocketImpl.java +++ b/jdk/src/share/classes/sun/security/ssl/SSLServerSocketImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 1996-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1996-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 @@ -304,14 +304,18 @@ class SSLServerSocketImpl extends SSLServerSocket enabledCipherSuites, doClientAuth, enableSessionCreation, enabledProtocols); - ServerHandshaker handshaker = tmp.getServerHandshaker(); + try { + ServerHandshaker handshaker = tmp.getServerHandshaker(); - for (Iterator t = enabledCipherSuites.iterator(); t.hasNext(); ) { - CipherSuite suite = (CipherSuite)t.next(); - if (handshaker.trySetCipherSuite(suite)) { - checkedEnabled = true; - return; + for (Iterator t = enabledCipherSuites.iterator(); t.hasNext(); ) { + CipherSuite suite = (CipherSuite)t.next(); + if (handshaker.trySetCipherSuite(suite)) { + checkedEnabled = true; + return; + } } + } finally { + tmp.closeSocket(); } // diff --git a/jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java b/jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java index 66b6e6d112c..a270cdc5fcd 100644 --- a/jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java +++ b/jdk/src/share/classes/sun/security/ssl/SSLSocketImpl.java @@ -1012,6 +1012,22 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { */ ServerHandshaker getServerHandshaker() throws SSLException { initHandshaker(); + + // The connection state would have been set to cs_HANDSHAKE during the + // handshaking initializing, however the caller may not have the + // the low level connection's established, which is not consistent with + // the HANDSHAKE state. As if it is unconnected, we need to reset the + // connection state to cs_START. + if (!isConnected()) { + connectionState = cs_START; + } + + // Make sure that we get a ServerHandshaker. + // This should never happen. + if (!(handshaker instanceof ServerHandshaker)) { + throw new SSLProtocolException("unexpected handshaker instance"); + } + return (ServerHandshaker)handshaker; } @@ -1273,7 +1289,8 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl { } } - private void closeSocket() throws IOException { + protected void closeSocket() throws IOException { + if ((debug != null) && Debug.isOn("ssl")) { System.out.println(threadName() + ", called closeSocket()"); } From 907d90158a0b50c24c8f3994d2580fa834c5cd11 Mon Sep 17 00:00:00 2001 From: Daniel Fuchs Date: Fri, 14 Nov 2008 17:22:10 +0100 Subject: [PATCH 130/267] 6683213: CounterMonitor's derived Gauge badly initialized Reviewed-by: emcmanus --- .../management/monitor/CounterMonitor.java | 3 + .../management/monitor/GaugeMonitor.java | 3 + .../javax/management/monitor/Monitor.java | 3 +- .../monitor/DerivedGaugeMonitorTest.java | 270 ++++++++++++++++++ 4 files changed, 277 insertions(+), 2 deletions(-) create mode 100644 jdk/test/javax/management/monitor/DerivedGaugeMonitorTest.java diff --git a/jdk/src/share/classes/javax/management/monitor/CounterMonitor.java b/jdk/src/share/classes/javax/management/monitor/CounterMonitor.java index b592b171b62..b27e57f6227 100644 --- a/jdk/src/share/classes/javax/management/monitor/CounterMonitor.java +++ b/jdk/src/share/classes/javax/management/monitor/CounterMonitor.java @@ -265,6 +265,7 @@ public class CounterMonitor extends Monitor implements CounterMonitorMBean { * @return The derived gauge of the specified object. * */ + @Override public synchronized Number getDerivedGauge(ObjectName object) { return (Number) super.getDerivedGauge(object); } @@ -280,6 +281,7 @@ public class CounterMonitor extends Monitor implements CounterMonitorMBean { * @return The derived gauge timestamp of the specified object. * */ + @Override public synchronized long getDerivedGaugeTimeStamp(ObjectName object) { return super.getDerivedGaugeTimeStamp(object); } @@ -595,6 +597,7 @@ public class CounterMonitor extends Monitor implements CounterMonitorMBean { * name of the Java class of the notification and the notification * types sent by the counter monitor. */ + @Override public MBeanNotificationInfo[] getNotificationInfo() { return notifsInfo; } diff --git a/jdk/src/share/classes/javax/management/monitor/GaugeMonitor.java b/jdk/src/share/classes/javax/management/monitor/GaugeMonitor.java index 7077f38cee1..ab71f10af4b 100644 --- a/jdk/src/share/classes/javax/management/monitor/GaugeMonitor.java +++ b/jdk/src/share/classes/javax/management/monitor/GaugeMonitor.java @@ -258,6 +258,7 @@ public class GaugeMonitor extends Monitor implements GaugeMonitorMBean { * @return The derived gauge of the specified object. * */ + @Override public synchronized Number getDerivedGauge(ObjectName object) { return (Number) super.getDerivedGauge(object); } @@ -273,6 +274,7 @@ public class GaugeMonitor extends Monitor implements GaugeMonitorMBean { * @return The derived gauge timestamp of the specified object. * */ + @Override public synchronized long getDerivedGaugeTimeStamp(ObjectName object) { return super.getDerivedGaugeTimeStamp(object); } @@ -477,6 +479,7 @@ public class GaugeMonitor extends Monitor implements GaugeMonitorMBean { * name of the Java class of the notification and the notification * types sent by the gauge monitor. */ + @Override public MBeanNotificationInfo[] getNotificationInfo() { return notifsInfo; } diff --git a/jdk/src/share/classes/javax/management/monitor/Monitor.java b/jdk/src/share/classes/javax/management/monitor/Monitor.java index 0329a33b077..fb3e1a476f0 100644 --- a/jdk/src/share/classes/javax/management/monitor/Monitor.java +++ b/jdk/src/share/classes/javax/management/monitor/Monitor.java @@ -34,7 +34,6 @@ import java.security.AccessController; import java.security.PrivilegedAction; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; -import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.LinkedBlockingQueue; @@ -517,7 +516,7 @@ public abstract class Monitor // ObservedObject o = createObservedObject(object); o.setAlreadyNotified(RESET_FLAGS_ALREADY_NOTIFIED); - o.setDerivedGauge(null); + o.setDerivedGauge(INTEGER_ZERO); o.setDerivedGaugeTimeStamp(System.currentTimeMillis()); observedObjects.add(o); diff --git a/jdk/test/javax/management/monitor/DerivedGaugeMonitorTest.java b/jdk/test/javax/management/monitor/DerivedGaugeMonitorTest.java new file mode 100644 index 00000000000..dca66e07472 --- /dev/null +++ b/jdk/test/javax/management/monitor/DerivedGaugeMonitorTest.java @@ -0,0 +1,270 @@ +/* + * 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. + * + * 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 6683213 + * @summary Test that the initial derived gauge is (Integer)0 + * @author Daniel Fuchs + * @run clean DerivedGaugeMonitorTest + * @run build DerivedGaugeMonitorTest + * @run main DerivedGaugeMonitorTest + */ + +import java.io.Serializable; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import javax.management.MBeanServer; +import javax.management.MBeanServerFactory; +import javax.management.ObjectName; +import javax.management.monitor.CounterMonitor; +import javax.management.monitor.GaugeMonitor; + +public class DerivedGaugeMonitorTest { + + public static interface Things { + public long getALong(); + public int getAnInt(); + public double getADouble(); + public short getAShort(); + public byte getAByte(); + public float getAFloat(); + } + public static interface MyMBean extends Things { + public Things getAThing(); + } + + public static class MyThings implements Things, Serializable { + private static final long serialVersionUID = -4333982919572564126L; + + private volatile long along = 0; + private volatile int anint = 0; + private volatile short ashort = 0; + private volatile byte abyte = 0; + private volatile float afloat = 0; + private volatile double adouble = 0; + + private volatile transient boolean mutable; + + public MyThings() { + this(false); + } + + protected MyThings(boolean mutable) { + this.mutable=mutable; + } + + public long getALong() { + return mutable?along++:along; + } + + public int getAnInt() { + return mutable?anint++:anint; + } + + public double getADouble() { + return mutable?adouble++:adouble; + } + + public short getAShort() { + return mutable?ashort++:ashort; + } + + public byte getAByte() { + return mutable?abyte++:abyte; + } + + public float getAFloat() { + return mutable?afloat++:afloat; + } + + @Override + public Object clone() throws CloneNotSupportedException { + final MyThings other = (MyThings)super.clone(); + other.mutable=false; + return other; + } + } + + public static class My implements MyMBean { + + public final CountDownLatch cdl = new CountDownLatch(6); + + private final MyThings things = new MyThings(true); + private volatile int count = 0; + + public Things getAThing() { + count++; + cdl.countDown(); + try { + return (Things) things.clone(); + } catch (CloneNotSupportedException ex) { + return null; + } + } + + public long getALong() { + count++; + cdl.countDown(); + return things.getALong(); + } + + public int getAnInt() { + count++; + cdl.countDown(); + return things.getAnInt(); + } + + public double getADouble() { + count++; + cdl.countDown(); + return things.getADouble(); + } + + public short getAShort() { + count++; + cdl.countDown(); + return things.getAShort(); + } + + public byte getAByte() { + count++; + cdl.countDown(); + return things.getAByte(); + } + + public float getAFloat() { + count++; + cdl.countDown(); + return things.getAFloat(); + } + + } + + + public static String[] attributes = { + "AByte","AShort","AnInt","ALong","AFloat","ADouble" + }; + public static String[] things = { + "AThing.AByte","AThing.AShort","AThing.AnInt","AThing.ALong", + "AThing.AFloat","AThing.ADouble" + }; + + public static void check(String attr, MBeanServer server, ObjectName mon, + ObjectName mbean) throws Exception { + final Object obj = server.getAttribute(mon, "DerivedGauge"); + check(attr,server,mon,mbean,obj); + } + + public static void check(String attr, MBeanServer server, ObjectName mon, + ObjectName mbean, Object obj) throws Exception { + if (obj == null) + throw new Exception("Derived gauge for: " + attr + + " ["+mon+", "+mbean+"] is null!"); + if (!Integer.valueOf(0).equals(obj)) + throw new Exception("Derived gauge for: " + attr + + " ["+mon+", "+mbean+"] is "+obj); + } + + public static void check(String attr, MBeanServer server, ObjectName mon, + ObjectName mbean, long start) throws Exception { + final Object obj = server.getAttribute(mon, "DerivedGauge"); + final long now = System.currentTimeMillis(); + final long gran = (Long)server.getAttribute(mon, "GranularityPeriod"); + if (now > start +2*gran) { + throw new Exception(attr+": Can't verify test case: " + + "granularity period expired!"); + } + check(attr,server,mon,mbean,obj); + } + + public static void test(String attr) throws Exception { + System.err.println("Testing "+ attr); + final MBeanServer server = MBeanServerFactory.createMBeanServer(); + final ObjectName mbean = new ObjectName("ugly:type=cr.p"); + final My my = new My(); + final GaugeMonitor mon2 = new GaugeMonitor(); + final ObjectName mon2n = new ObjectName("mon1:type=GaugeMonitor"); + final CounterMonitor mon1 = new CounterMonitor(); + final ObjectName mon1n = new ObjectName("mon2:type=CounterMonitor"); + + server.registerMBean(my, mbean); + server.registerMBean(mon1, mon1n); + server.registerMBean(mon2, mon2n); + + mon1.addObservedObject(mbean); + mon1.setGranularityPeriod(60000); // 60 sec... + mon1.setObservedAttribute(attr); + mon1.setDifferenceMode(true); + check(attr,server,mon1n,mbean); + + mon2.addObservedObject(mbean); + mon2.setGranularityPeriod(60000); // 60 sec... + mon2.setObservedAttribute(attr); + mon2.setDifferenceMode(true); + check(attr,server,mon2n,mbean); + + final long approxStart = System.currentTimeMillis(); + mon1.start(); + mon2.start(); + + try { + check(attr,server,mon1n,mbean,approxStart); + check(attr,server,mon2n,mbean,approxStart); + check(attr,server,mon1n,mbean,approxStart); + check(attr,server,mon2n,mbean,approxStart); + + + mon1.setGranularityPeriod(5); + mon2.setGranularityPeriod(5); + + my.cdl.await(1000, TimeUnit.MILLISECONDS); + if (my.cdl.getCount() > 0) + throw new Exception(attr+": Count down not reached!"); + + // just check that we don't get an exception now... + System.err.println(attr+": [" + mon1n+ + "] DerivedGauge is now "+ + server.getAttribute(mon1n, "DerivedGauge")); + System.err.println(attr+": [" + mon2n+ + "] DerivedGauge is now "+ + server.getAttribute(mon2n, "DerivedGauge")); + } finally { + try {mon1.stop();} catch (Exception x) {} + try {mon2.stop();} catch (Exception x) {} + } + } + + + + + public static void main(String[] args) throws Exception { + for (String attr:attributes) { + test(attr); + } + for (String attr:things) { + test(attr); + } + } + +} From cbf1c89d6043fa8521b76c9e010480e9ff121aa2 Mon Sep 17 00:00:00 2001 From: Igor Veresov Date: Fri, 14 Nov 2008 14:23:05 -0800 Subject: [PATCH 131/267] 6770608: G1: Mutator thread can flush barrier and satb queues during safepoint 6660573: G1: BigApps Failure : guarantee(satb_mq_set.completed_buffers_num() == 0,"invariant") When exiting a mutator thread is removed from the thread list before it has a chance to flush its SATB and barrier queues. If GC happens at this moment the objects that are refererred from these queues can be moved, which will case a crash. The fix is simply to flush the buffers before removing a thread from the list. Reviewed-by: jcoomes, tonyp --- .../vm/gc_implementation/g1/ptrQueue.cpp | 5 +- .../vm/gc_implementation/g1/ptrQueue.hpp | 4 +- hotspot/src/share/vm/runtime/thread.cpp | 76 ++++++++++++------- hotspot/src/share/vm/runtime/thread.hpp | 2 + 4 files changed, 58 insertions(+), 29 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp b/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp index 7d1092bdc2a..157383237b5 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp @@ -30,7 +30,7 @@ PtrQueue::PtrQueue(PtrQueueSet* qset_, bool perm) : _perm(perm), _lock(NULL) {} -PtrQueue::~PtrQueue() { +void PtrQueue::flush() { if (!_perm && _buf != NULL) { if (_index == _sz) { // No work to do. @@ -41,8 +41,9 @@ PtrQueue::~PtrQueue() { _buf[byte_index_to_index((int)i)] = NULL; } qset()->enqueue_complete_buffer(_buf); - _buf = NULL; } + _buf = NULL; + _index = 0; } } diff --git a/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.hpp b/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.hpp index 3079200615f..899801039d0 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.hpp @@ -62,7 +62,9 @@ public: // given PtrQueueSet. PtrQueue(PtrQueueSet*, bool perm = false); // Release any contained resources. - ~PtrQueue(); + void flush(); + // Calls flush() when destroyed. + ~PtrQueue() { flush(); } // Associate a lock with a ptr queue. void set_lock(Mutex* lock) { _lock = lock; } diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp index 4d97d62c68f..2e4c6360143 100644 --- a/hotspot/src/share/vm/runtime/thread.cpp +++ b/hotspot/src/share/vm/runtime/thread.cpp @@ -1422,6 +1422,7 @@ static void ensure_join(JavaThread* thread) { thread->clear_pending_exception(); } + // For any new cleanup additions, please check to see if they need to be applied to // cleanup_failed_attach_current_thread as well. void JavaThread::exit(bool destroy_vm, ExitType exit_type) { @@ -1592,37 +1593,60 @@ void JavaThread::exit(bool destroy_vm, ExitType exit_type) { JvmtiExport::cleanup_thread(this); } +#ifndef SERIALGC + // We must flush G1-related buffers before removing a thread from + // the list of active threads. + if (UseG1GC) { + flush_barrier_queues(); + } +#endif + // Remove from list of active threads list, and notify VM thread if we are the last non-daemon thread Threads::remove(this); } -void JavaThread::cleanup_failed_attach_current_thread() { - - if (get_thread_profiler() != NULL) { - get_thread_profiler()->disengage(); - ResourceMark rm; - get_thread_profiler()->print(get_thread_name()); - } - - if (active_handles() != NULL) { - JNIHandleBlock* block = active_handles(); - set_active_handles(NULL); - JNIHandleBlock::release_block(block); - } - - if (free_handle_block() != NULL) { - JNIHandleBlock* block = free_handle_block(); - set_free_handle_block(NULL); - JNIHandleBlock::release_block(block); - } - - if (UseTLAB) { - tlab().make_parsable(true); // retire TLAB, if any - } - - Threads::remove(this); - delete this; +#ifndef SERIALGC +// Flush G1-related queues. +void JavaThread::flush_barrier_queues() { + satb_mark_queue().flush(); + dirty_card_queue().flush(); } +#endif + +void JavaThread::cleanup_failed_attach_current_thread() { + if (get_thread_profiler() != NULL) { + get_thread_profiler()->disengage(); + ResourceMark rm; + get_thread_profiler()->print(get_thread_name()); + } + + if (active_handles() != NULL) { + JNIHandleBlock* block = active_handles(); + set_active_handles(NULL); + JNIHandleBlock::release_block(block); + } + + if (free_handle_block() != NULL) { + JNIHandleBlock* block = free_handle_block(); + set_free_handle_block(NULL); + JNIHandleBlock::release_block(block); + } + + if (UseTLAB) { + tlab().make_parsable(true); // retire TLAB, if any + } + +#ifndef SERIALGC + if (UseG1GC) { + flush_barrier_queues(); + } +#endif + + Threads::remove(this); + delete this; +} + + JavaThread* JavaThread::active() { diff --git a/hotspot/src/share/vm/runtime/thread.hpp b/hotspot/src/share/vm/runtime/thread.hpp index 8d05504bb6a..1ee5c72604b 100644 --- a/hotspot/src/share/vm/runtime/thread.hpp +++ b/hotspot/src/share/vm/runtime/thread.hpp @@ -793,6 +793,8 @@ class JavaThread: public Thread { DirtyCardQueue _dirty_card_queue; // Thread-local log for dirty cards. // Set of all such queues. static DirtyCardQueueSet _dirty_card_queue_set; + + void flush_barrier_queues(); #endif // !SERIALGC friend class VMThread; From a7d5fce367fcb024c0a40463618f3c1f9b4028ce Mon Sep 17 00:00:00 2001 From: Erik Trimble Date: Fri, 14 Nov 2008 19:26:03 -0800 Subject: [PATCH 132/267] 6771977: Bump HS14 build number to 07 Update the Hotspot build number to 07 Reviewed-by: jcoomes --- hotspot/make/hotspot_version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hotspot/make/hotspot_version b/hotspot/make/hotspot_version index efc6eb5223d..9673d78aba6 100644 --- a/hotspot/make/hotspot_version +++ b/hotspot/make/hotspot_version @@ -35,7 +35,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2008 HS_MAJOR_VER=14 HS_MINOR_VER=0 -HS_BUILD_NUMBER=06 +HS_BUILD_NUMBER=07 JDK_MAJOR_VER=1 JDK_MINOR_VER=7 From f2c8d25c7340f6431c4d568191a78c1d41194ffa Mon Sep 17 00:00:00 2001 From: Vladimir Kozlov Date: Tue, 18 Nov 2008 12:31:53 -0800 Subject: [PATCH 133/267] 6772413: code cleanup Removed lines in adm64.make with interpret.o and moved few constant strings from header files. Reviewed-by: never --- hotspot/make/solaris/makefiles/amd64.make | 4 ---- hotspot/src/share/vm/opto/c2_globals.hpp | 4 ++-- hotspot/src/share/vm/runtime/globals.hpp | 2 +- hotspot/src/share/vm/runtime/perfMemory.cpp | 8 ++++++++ hotspot/src/share/vm/runtime/perfMemory.hpp | 7 +------ 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/hotspot/make/solaris/makefiles/amd64.make b/hotspot/make/solaris/makefiles/amd64.make index dca51190d55..b05414dbd08 100644 --- a/hotspot/make/solaris/makefiles/amd64.make +++ b/hotspot/make/solaris/makefiles/amd64.make @@ -37,8 +37,6 @@ ifeq ("${Platform_compiler}", "sparcWorks") # _lwp_create_interpose must have a frame OPT_CFLAGS/os_solaris_x86_64.o = -xO1 -# force C++ interpreter to be full optimization -#OPT_CFLAGS/interpret.o = -fast -O4 # Temporary until SS10 C++ compiler is fixed OPT_CFLAGS/generateOptoStub.o = -xO2 @@ -50,8 +48,6 @@ ifeq ("${Platform_compiler}", "gcc") # gcc # The serviceability agent relies on frame pointer (%rbp) to walk thread stack CFLAGS += -fno-omit-frame-pointer -# force C++ interpreter to be full optimization -#OPT_CFLAGS/interpret.o = -O3 else # error diff --git a/hotspot/src/share/vm/opto/c2_globals.hpp b/hotspot/src/share/vm/opto/c2_globals.hpp index 1342091350c..844d637e519 100644 --- a/hotspot/src/share/vm/opto/c2_globals.hpp +++ b/hotspot/src/share/vm/opto/c2_globals.hpp @@ -256,10 +256,10 @@ develop(intx, PrintIdealGraphPort, 4444, \ "Ideal graph printer to network port") \ \ - develop(ccstr, PrintIdealGraphAddress, "127.0.0.1", \ + notproduct(ccstr, PrintIdealGraphAddress, "127.0.0.1", \ "IP address to connect to visualizer") \ \ - develop(ccstr, PrintIdealGraphFile, NULL, \ + notproduct(ccstr, PrintIdealGraphFile, NULL, \ "File to dump ideal graph to. If set overrides the " \ "use of the network") \ \ diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index b32939b3c49..67cbd2c7018 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -493,7 +493,7 @@ class CommandLineFlags { develop(bool, DeoptimizeALot, false, \ "deoptimize at every exit from the runtime system") \ \ - develop(ccstrlist, DeoptimizeOnlyAt, "", \ + notproduct(ccstrlist, DeoptimizeOnlyAt, "", \ "a comma separated list of bcis to deoptimize at") \ \ product(bool, DeoptimizeRandom, false, \ diff --git a/hotspot/src/share/vm/runtime/perfMemory.cpp b/hotspot/src/share/vm/runtime/perfMemory.cpp index 0ae679bdd00..d48d7b508b5 100644 --- a/hotspot/src/share/vm/runtime/perfMemory.cpp +++ b/hotspot/src/share/vm/runtime/perfMemory.cpp @@ -25,6 +25,14 @@ # include "incls/_precompiled.incl" # include "incls/_perfMemory.cpp.incl" +// Prefix of performance data file. +const char PERFDATA_NAME[] = "hsperfdata"; + +// Add 1 for the '_' character between PERFDATA_NAME and pid. The '\0' terminating +// character will be included in the sizeof(PERFDATA_NAME) operation. +static const size_t PERFDATA_FILENAME_LEN = sizeof(PERFDATA_NAME) + + UINT_CHARS + 1; + char* PerfMemory::_start = NULL; char* PerfMemory::_end = NULL; char* PerfMemory::_top = NULL; diff --git a/hotspot/src/share/vm/runtime/perfMemory.hpp b/hotspot/src/share/vm/runtime/perfMemory.hpp index 812ab3bac23..0909bfa0c9e 100644 --- a/hotspot/src/share/vm/runtime/perfMemory.hpp +++ b/hotspot/src/share/vm/runtime/perfMemory.hpp @@ -95,7 +95,7 @@ typedef struct { } PerfDataEntry; // Prefix of performance data file. -static const char PERFDATA_NAME[] = "hsperfdata"; +extern const char PERFDATA_NAME[]; // UINT_CHARS contains the number of characters holding a process id // (i.e. pid). pid is defined as unsigned "int" so the maximum possible pid value @@ -103,11 +103,6 @@ static const char PERFDATA_NAME[] = "hsperfdata"; // string. static const size_t UINT_CHARS = 10; -// Add 1 for the '_' character between PERFDATA_NAME and pid. The '\0' terminating -// character will be included in the sizeof(PERFDATA_NAME) operation. -static const size_t PERFDATA_FILENAME_LEN = sizeof(PERFDATA_NAME) + - UINT_CHARS + 1; - /* the PerfMemory class manages creation, destruction, * and allocation of the PerfData region. */ From 893d1c414888cd8517d6a0ffee85883a534b070d Mon Sep 17 00:00:00 2001 From: Vladimir Kozlov Date: Tue, 18 Nov 2008 12:40:28 -0800 Subject: [PATCH 134/267] 6766316: assert(!nocreate,"Cannot build a phi for a block already parsed.") Don't use the invariant local information if there are irreducible loops. Reviewed-by: never --- hotspot/src/share/vm/opto/parse.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hotspot/src/share/vm/opto/parse.hpp b/hotspot/src/share/vm/opto/parse.hpp index 0a68a35237e..d33acba3e7a 100644 --- a/hotspot/src/share/vm/opto/parse.hpp +++ b/hotspot/src/share/vm/opto/parse.hpp @@ -175,7 +175,7 @@ class Parse : public GraphKit { bool is_SEL_backedge(Block* pred) const{ return is_SEL_head() && pred->rpo() >= rpo(); } bool is_invariant_local(uint i) const { const JVMState* jvms = start_map()->jvms(); - if (!jvms->is_loc(i)) return false; + if (!jvms->is_loc(i) || flow()->outer()->has_irreducible_entry()) return false; return flow()->is_invariant_local(i - jvms->locoff()); } bool can_elide_SEL_phi(uint i) const { assert(is_SEL_head(),""); return is_invariant_local(i); } From 43051c98f31b26bf607d7ad7e80601bcad21c36a Mon Sep 17 00:00:00 2001 From: Vladimir Kozlov Date: Tue, 18 Nov 2008 14:47:36 -0800 Subject: [PATCH 135/267] 6773078: UseCompressedOops: assert(kid == 0L || s->_leaf->in(0) == 0L,"internal operands have no control") Don't set the control edge of a klass load node. Reviewed-by: never --- hotspot/src/share/vm/opto/macro.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/hotspot/src/share/vm/opto/macro.cpp b/hotspot/src/share/vm/opto/macro.cpp index 892f5018310..37cee0697bb 100644 --- a/hotspot/src/share/vm/opto/macro.cpp +++ b/hotspot/src/share/vm/opto/macro.cpp @@ -1673,7 +1673,6 @@ void PhaseMacroExpand::expand_lock_node(LockNode *lock) { if (klass_node == NULL) { Node* k_adr = basic_plus_adr(obj, oopDesc::klass_offset_in_bytes()); klass_node = transform_later( LoadKlassNode::make(_igvn, mem, k_adr, _igvn.type(k_adr)->is_ptr()) ); - klass_node->init_req(0, ctrl); } Node *proto_node = make_load(ctrl, mem, klass_node, Klass::prototype_header_offset_in_bytes() + sizeof(oopDesc), TypeX_X, TypeX_X->basic_type()); From a2078f04e87cb5b6f238536bc9f1d3ca0d1a2c9d Mon Sep 17 00:00:00 2001 From: Jon Masamitsu Date: Tue, 18 Nov 2008 14:52:33 -0800 Subject: [PATCH 136/267] 6771742: Remove duplicate files from G1 merge Remove duplicate files and add includeDB_gc_g1 file in windows Makefile Reviewed-by: jcoomes, ysr --- .../make/windows/projectfiles/common/Makefile | 3 +- .../concurrentGCThread.cpp | 314 ------------------ .../concurrentGCThread.hpp | 167 ---------- 3 files changed, 2 insertions(+), 482 deletions(-) delete mode 100644 hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentGCThread.cpp delete mode 100644 hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentGCThread.hpp diff --git a/hotspot/make/windows/projectfiles/common/Makefile b/hotspot/make/windows/projectfiles/common/Makefile index c6793f96b31..ebc3cd9bef6 100644 --- a/hotspot/make/windows/projectfiles/common/Makefile +++ b/hotspot/make/windows/projectfiles/common/Makefile @@ -56,7 +56,8 @@ IncludeDBs_gc=$(HOTSPOTWORKSPACE)/src/share/vm/includeDB_gc_parallel \ $(HOTSPOTWORKSPACE)/src/share/vm/gc_implementation/includeDB_gc_shared \ $(HOTSPOTWORKSPACE)/src/share/vm/gc_implementation/includeDB_gc_parNew \ $(HOTSPOTWORKSPACE)/src/share/vm/gc_implementation/includeDB_gc_parallelScavenge \ - $(HOTSPOTWORKSPACE)/src/share/vm/gc_implementation/includeDB_gc_concurrentMarkSweep + $(HOTSPOTWORKSPACE)/src/share/vm/gc_implementation/includeDB_gc_concurrentMarkSweep \ + $(HOTSPOTWORKSPACE)/src/share/vm/gc_implementation/includeDB_gc_g1 IncludeDBs_kernel =$(IncludeDBs_base) \ diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentGCThread.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentGCThread.cpp deleted file mode 100644 index 8ed8b809e2a..00000000000 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentGCThread.cpp +++ /dev/null @@ -1,314 +0,0 @@ -/* - * Copyright 2001-2005 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. - * - */ - -// CopyrightVersion 1.2 - -# include "incls/_precompiled.incl" -# include "incls/_concurrentGCThread.cpp.incl" - -bool ConcurrentGCThread::_should_terminate = false; -bool ConcurrentGCThread::_has_terminated = false; -int ConcurrentGCThread::_CGC_flag = CGC_nil; - -SuspendibleThreadSet ConcurrentGCThread::_sts; - -ConcurrentGCThread::ConcurrentGCThread() { - _sts.initialize(); -}; - -void ConcurrentGCThread::stopWorldAndDo(VoidClosure* op) { - MutexLockerEx x(Heap_lock, - Mutex::_no_safepoint_check_flag); - // warning("CGC: about to try stopping world"); - SafepointSynchronize::begin(); - // warning("CGC: successfully stopped world"); - op->do_void(); - SafepointSynchronize::end(); - // warning("CGC: successfully restarted world"); -} - -void ConcurrentGCThread::safepoint_synchronize() { - _sts.suspend_all(); -} - -void ConcurrentGCThread::safepoint_desynchronize() { - _sts.resume_all(); -} - -void ConcurrentGCThread::create_and_start() { - if (os::create_thread(this, os::cgc_thread)) { - // XXX: need to set this to low priority - // unless "agressive mode" set; priority - // should be just less than that of VMThread. - os::set_priority(this, NearMaxPriority); - if (!_should_terminate && !DisableStartThread) { - os::start_thread(this); - } - } -} - -void ConcurrentGCThread::initialize_in_thread() { - this->record_stack_base_and_size(); - this->initialize_thread_local_storage(); - this->set_active_handles(JNIHandleBlock::allocate_block()); - // From this time Thread::current() should be working. - assert(this == Thread::current(), "just checking"); -} - -void ConcurrentGCThread::wait_for_universe_init() { - MutexLockerEx x(CGC_lock, Mutex::_no_safepoint_check_flag); - while (!is_init_completed() && !_should_terminate) { - CGC_lock->wait(Mutex::_no_safepoint_check_flag, 200); - } -} - -void ConcurrentGCThread::terminate() { - // Signal that it is terminated - { - MutexLockerEx mu(Terminator_lock, - Mutex::_no_safepoint_check_flag); - _has_terminated = true; - Terminator_lock->notify(); - } - - // Thread destructor usually does this.. - ThreadLocalStorage::set_thread(NULL); -} - - -void SuspendibleThreadSet::initialize_work() { - MutexLocker x(STS_init_lock); - if (!_initialized) { - _m = new Monitor(Mutex::leaf, - "SuspendibleThreadSetLock", true); - _async = 0; - _async_stop = false; - _async_stopped = 0; - _initialized = true; - } -} - -void SuspendibleThreadSet::join() { - initialize(); - MutexLockerEx x(_m, Mutex::_no_safepoint_check_flag); - while (_async_stop) _m->wait(Mutex::_no_safepoint_check_flag); - _async++; - assert(_async > 0, "Huh."); -} - -void SuspendibleThreadSet::leave() { - assert(_initialized, "Must be initialized."); - MutexLockerEx x(_m, Mutex::_no_safepoint_check_flag); - _async--; - assert(_async >= 0, "Huh."); - if (_async_stop) _m->notify_all(); -} - -void SuspendibleThreadSet::yield(const char* id) { - assert(_initialized, "Must be initialized."); - if (_async_stop) { - MutexLockerEx x(_m, Mutex::_no_safepoint_check_flag); - if (_async_stop) { - _async_stopped++; - assert(_async_stopped > 0, "Huh."); - if (_async_stopped == _async) { - if (ConcGCYieldTimeout > 0) { - double now = os::elapsedTime(); - guarantee((now - _suspend_all_start) * 1000.0 < - (double)ConcGCYieldTimeout, - "Long delay; whodunit?"); - } - } - _m->notify_all(); - while (_async_stop) _m->wait(Mutex::_no_safepoint_check_flag); - _async_stopped--; - assert(_async >= 0, "Huh"); - _m->notify_all(); - } - } -} - -void SuspendibleThreadSet::suspend_all() { - initialize(); // If necessary. - if (ConcGCYieldTimeout > 0) { - _suspend_all_start = os::elapsedTime(); - } - MutexLockerEx x(_m, Mutex::_no_safepoint_check_flag); - assert(!_async_stop, "Only one at a time."); - _async_stop = true; - while (_async_stopped < _async) _m->wait(Mutex::_no_safepoint_check_flag); -} - -void SuspendibleThreadSet::resume_all() { - assert(_initialized, "Must be initialized."); - MutexLockerEx x(_m, Mutex::_no_safepoint_check_flag); - assert(_async_stopped == _async, "Huh."); - _async_stop = false; - _m->notify_all(); -} - -static void _sltLoop(JavaThread* thread, TRAPS) { - SurrogateLockerThread* slt = (SurrogateLockerThread*)thread; - slt->loop(); -} - -SurrogateLockerThread::SurrogateLockerThread() : - JavaThread(&_sltLoop), - _monitor(Mutex::nonleaf, "SLTMonitor"), - _buffer(empty) -{} - -SurrogateLockerThread* SurrogateLockerThread::make(TRAPS) { - klassOop k = - SystemDictionary::resolve_or_fail(vmSymbolHandles::java_lang_Thread(), - true, CHECK_NULL); - instanceKlassHandle klass (THREAD, k); - instanceHandle thread_oop = klass->allocate_instance_handle(CHECK_NULL); - - const char thread_name[] = "Surrogate Locker Thread (CMS)"; - Handle string = java_lang_String::create_from_str(thread_name, CHECK_NULL); - - // Initialize thread_oop to put it into the system threadGroup - Handle thread_group (THREAD, Universe::system_thread_group()); - JavaValue result(T_VOID); - JavaCalls::call_special(&result, thread_oop, - klass, - vmSymbolHandles::object_initializer_name(), - vmSymbolHandles::threadgroup_string_void_signature(), - thread_group, - string, - CHECK_NULL); - - SurrogateLockerThread* res; - { - MutexLocker mu(Threads_lock); - res = new SurrogateLockerThread(); - - // At this point it may be possible that no osthread was created for the - // JavaThread due to lack of memory. We would have to throw an exception - // in that case. However, since this must work and we do not allow - // exceptions anyway, check and abort if this fails. - if (res == NULL || res->osthread() == NULL) { - vm_exit_during_initialization("java.lang.OutOfMemoryError", - "unable to create new native thread"); - } - java_lang_Thread::set_thread(thread_oop(), res); - java_lang_Thread::set_priority(thread_oop(), NearMaxPriority); - java_lang_Thread::set_daemon(thread_oop()); - - res->set_threadObj(thread_oop()); - Threads::add(res); - Thread::start(res); - } - os::yield(); // This seems to help with initial start-up of SLT - return res; -} - -void SurrogateLockerThread::manipulatePLL(SLT_msg_type msg) { - MutexLockerEx x(&_monitor, Mutex::_no_safepoint_check_flag); - assert(_buffer == empty, "Should be empty"); - assert(msg != empty, "empty message"); - _buffer = msg; - while (_buffer != empty) { - _monitor.notify(); - _monitor.wait(Mutex::_no_safepoint_check_flag); - } -} - -// ======= Surrogate Locker Thread ============= - -void SurrogateLockerThread::loop() { - BasicLock pll_basic_lock; - SLT_msg_type msg; - debug_only(unsigned int owned = 0;) - - while (/* !isTerminated() */ 1) { - { - MutexLocker x(&_monitor); - // Since we are a JavaThread, we can't be here at a safepoint. - assert(!SafepointSynchronize::is_at_safepoint(), - "SLT is a JavaThread"); - // wait for msg buffer to become non-empty - while (_buffer == empty) { - _monitor.notify(); - _monitor.wait(); - } - msg = _buffer; - } - switch(msg) { - case acquirePLL: { - instanceRefKlass::acquire_pending_list_lock(&pll_basic_lock); - debug_only(owned++;) - break; - } - case releaseAndNotifyPLL: { - assert(owned > 0, "Don't have PLL"); - instanceRefKlass::release_and_notify_pending_list_lock(&pll_basic_lock); - debug_only(owned--;) - break; - } - case empty: - default: { - guarantee(false,"Unexpected message in _buffer"); - break; - } - } - { - MutexLocker x(&_monitor); - // Since we are a JavaThread, we can't be here at a safepoint. - assert(!SafepointSynchronize::is_at_safepoint(), - "SLT is a JavaThread"); - _buffer = empty; - _monitor.notify(); - } - } - assert(!_monitor.owned_by_self(), "Should unlock before exit."); -} - - -// ===== STS Access From Outside CGCT ===== - -void ConcurrentGCThread::stsYield(const char* id) { - assert( Thread::current()->is_ConcurrentGC_thread(), - "only a conc GC thread can call this" ); - _sts.yield(id); -} - -bool ConcurrentGCThread::stsShouldYield() { - assert( Thread::current()->is_ConcurrentGC_thread(), - "only a conc GC thread can call this" ); - return _sts.should_yield(); -} - -void ConcurrentGCThread::stsJoin() { - assert( Thread::current()->is_ConcurrentGC_thread(), - "only a conc GC thread can call this" ); - _sts.join(); -} - -void ConcurrentGCThread::stsLeave() { - assert( Thread::current()->is_ConcurrentGC_thread(), - "only a conc GC thread can call this" ); - _sts.leave(); -} diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentGCThread.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentGCThread.hpp deleted file mode 100644 index db6cc903ddf..00000000000 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentGCThread.hpp +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright 2001-2005 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. - * - */ - -class VoidClosure; - -// A SuspendibleThreadSet is (obviously) a set of threads that can be -// suspended. A thread can join and later leave the set, and periodically -// yield. If some thread (not in the set) requests, via suspend_all, that -// the threads be suspended, then the requesting thread is blocked until -// all the threads in the set have yielded or left the set. (Threads may -// not enter the set when an attempted suspension is in progress.) The -// suspending thread later calls resume_all, allowing the suspended threads -// to continue. - -class SuspendibleThreadSet { - Monitor* _m; - int _async; - bool _async_stop; - int _async_stopped; - bool _initialized; - double _suspend_all_start; - - void initialize_work(); - - public: - SuspendibleThreadSet() : _initialized(false) {} - - // Add the current thread to the set. May block if a suspension - // is in progress. - void join(); - // Removes the current thread from the set. - void leave(); - // Returns "true" iff an suspension is in progress. - bool should_yield() { return _async_stop; } - // Suspends the current thread if a suspension is in progress (for - // the duration of the suspension.) - void yield(const char* id); - // Return when all threads in the set are suspended. - void suspend_all(); - // Allow suspended threads to resume. - void resume_all(); - // Redundant initializations okay. - void initialize() { - // Double-check dirty read idiom. - if (!_initialized) initialize_work(); - } -}; - - -class ConcurrentGCThread: public NamedThread { - friend class VMStructs; - -protected: - static bool _should_terminate; - static bool _has_terminated; - - enum CGC_flag_type { - CGC_nil = 0x0, - CGC_dont_suspend = 0x1, - CGC_CGC_safepoint = 0x2, - CGC_VM_safepoint = 0x4 - }; - - static int _CGC_flag; - - static bool CGC_flag_is_set(int b) { return (_CGC_flag & b) != 0; } - static int set_CGC_flag(int b) { return _CGC_flag |= b; } - static int reset_CGC_flag(int b) { return _CGC_flag &= ~b; } - - void stopWorldAndDo(VoidClosure* op); - - // All instances share this one set. - static SuspendibleThreadSet _sts; - - // Create and start the thread (setting it's priority high.) - void create_and_start(); - - // Do initialization steps in the thread: record stack base and size, - // init thread local storage, set JNI handle block. - void initialize_in_thread(); - - // Wait until Universe::is_fully_initialized(); - void wait_for_universe_init(); - - // Record that the current thread is terminating, and will do more - // concurrent work. - void terminate(); - -public: - // Constructor - - ConcurrentGCThread(); - ~ConcurrentGCThread() {} // Exists to call NamedThread destructor. - - // Tester - bool is_ConcurrentGC_thread() const { return true; } - - static void safepoint_synchronize(); - static void safepoint_desynchronize(); - - // All overridings should probably do _sts::yield, but we allow - // overriding for distinguished debugging messages. Default is to do - // nothing. - virtual void yield() {} - - bool should_yield() { return _sts.should_yield(); } - - // they are prefixed by sts since there are already yield() and - // should_yield() (non-static) methods in this class and it was an - // easy way to differentiate them. - static void stsYield(const char* id); - static bool stsShouldYield(); - static void stsJoin(); - static void stsLeave(); - -}; - -// The SurrogateLockerThread is used by concurrent GC threads for -// manipulating Java monitors, in particular, currently for -// manipulating the pending_list_lock. XXX -class SurrogateLockerThread: public JavaThread { - friend class VMStructs; - public: - enum SLT_msg_type { - empty = 0, // no message - acquirePLL, // acquire pending list lock - releaseAndNotifyPLL // notify and release pending list lock - }; - private: - // the following are shared with the CMSThread - SLT_msg_type _buffer; // communication buffer - Monitor _monitor; // monitor controlling buffer - BasicLock _basicLock; // used for PLL locking - - public: - static SurrogateLockerThread* make(TRAPS); - - SurrogateLockerThread(); - - bool is_hidden_from_external_view() const { return true; } - - void loop(); // main method - - void manipulatePLL(SLT_msg_type msg); - -}; From df043132210466dc482fd875ff6428de157b6381 Mon Sep 17 00:00:00 2001 From: Xueming Shen Date: Wed, 19 Nov 2008 14:29:12 -0800 Subject: [PATCH 137/267] 6714428: 'os.name' system property shows wrong value on 64-bit Windows XP Update to detect the correct os.name for 64-bit XP Reviewed-by: darcy --- .../windows/native/java/lang/java_props_md.c | 46 ++++++++++++++++++- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/jdk/src/windows/native/java/lang/java_props_md.c b/jdk/src/windows/native/java/lang/java_props_md.c index 3069580da9c..f75721f9f71 100644 --- a/jdk/src/windows/native/java/lang/java_props_md.c +++ b/jdk/src/windows/native/java/lang/java_props_md.c @@ -38,6 +38,12 @@ #define VER_PLATFORM_WIN32_WINDOWS 1 #endif +#ifndef PROCESSOR_ARCHITECTURE_AMD64 +#define PROCESSOR_ARCHITECTURE_AMD64 9 +#endif + +typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO); + #define SHELL_KEY "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders" /* Encodings for Windows language groups. According to @@ -674,9 +680,22 @@ GetJavaProperties(JNIEnv* env) { char buf[100]; OSVERSIONINFOEX ver; + SYSTEM_INFO si; + PGNSI pGNSI; + ver.dwOSVersionInfoSize = sizeof(ver); GetVersionEx((OSVERSIONINFO *) &ver); + ZeroMemory(&si, sizeof(SYSTEM_INFO)); + // Call GetNativeSystemInfo if supported or GetSystemInfo otherwise. + pGNSI = (PGNSI) GetProcAddress( + GetModuleHandle(TEXT("kernel32.dll")), + "GetNativeSystemInfo"); + if(NULL != pGNSI) + pGNSI(&si); + else + GetSystemInfo(&si); + /* * From msdn page on OSVERSIONINFOEX, current as of this * writing, decoding of dwMajorVersion and dwMinorVersion. @@ -690,9 +709,14 @@ GetJavaProperties(JNIEnv* env) * Windows 3.51 3 51 * Windows NT 4.0 4 0 * Windows 2000 5 0 - * Windows XP 5 1 + * Windows XP 32 bit 5 1 * Windows Server 2003 family 5 2 + * Windows XP 64 bit 5 2 + * where ((&ver.wServicePackMinor) + 2) = 1 + * and si.wProcessorArchitecture = 9 * Windows Vista family 6 0 + * Windows 2008 6 0 + * where ((&ver.wServicePackMinor) + 2) = 1 * * This mapping will presumably be augmented as new Windows * versions are released. @@ -720,7 +744,25 @@ GetJavaProperties(JNIEnv* env) switch (ver.dwMinorVersion) { case 0: sprops.os_name = "Windows 2000"; break; case 1: sprops.os_name = "Windows XP"; break; - case 2: sprops.os_name = "Windows 2003"; break; + case 2: + /* + * From MSDN OSVERSIONINFOEX and SYSTEM_INFO documentation: + * + * "Because the version numbers for Windows Server 2003 + * and Windows XP 6u4 bit are identical, you must also test + * whether the wProductType member is VER_NT_WORKSTATION. + * and si.wProcessorArchitecture is + * PROCESSOR_ARCHITECTURE_AMD64 (which is 9) + * If it is, the operating system is Windows XP 64 bit; + * otherwise, it is Windows Server 2003." + */ + if(ver.wProductType == VER_NT_WORKSTATION && + si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) { + sprops.os_name = "Windows XP"; /* 64 bit */ + } else { + sprops.os_name = "Windows 2003"; + } + break; default: sprops.os_name = "Windows NT (unknown)"; break; } } else if (ver.dwMajorVersion == 6) { From 4d6c508c349f6fce0475ab57c80639d9b48a90c5 Mon Sep 17 00:00:00 2001 From: Eamonn McManus Date: Thu, 20 Nov 2008 10:10:48 +0100 Subject: [PATCH 138/267] 6772779: @NotificationInfo does not create MBeanNotificationInfo in the MBean's MBeanInfo 6773593: CompositeDataSupport constructor javadoc is not in sync with the implementation Reviewed-by: sjiang --- .../DefaultMBeanServerInterceptor.java | 5 +- .../jmx/mbeanserver/MBeanIntrospector.java | 30 +++---- .../openmbean/CompositeDataSupport.java | 2 +- .../AnnotatedNotificationInfoTest.java | 79 ++++++++++++++----- 4 files changed, 82 insertions(+), 34 deletions(-) diff --git a/jdk/src/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java b/jdk/src/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java index 3d80a09eccb..6a261994bb4 100644 --- a/jdk/src/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java +++ b/jdk/src/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java @@ -70,6 +70,7 @@ import javax.management.JMRuntimeException; import javax.management.ListenerNotFoundException; import javax.management.MBeanException; import javax.management.MBeanInfo; +import javax.management.MBeanNotificationInfo; import javax.management.MBeanPermission; import javax.management.MBeanRegistration; import javax.management.MBeanRegistrationException; @@ -1045,8 +1046,10 @@ public class DefaultMBeanServerInterceptor Object resource = getResource(mbean); MBeanInjector.inject(resource, mbs, name); if (MBeanInjector.injectsSendNotification(resource)) { + MBeanNotificationInfo[] mbnis = + mbean.getMBeanInfo().getNotifications(); NotificationBroadcasterSupport nbs = - new NotificationBroadcasterSupport(); + new NotificationBroadcasterSupport(mbnis); MBeanInjector.injectSendNotification(resource, nbs); mbean = NotifySupport.wrap(mbean, nbs); } diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanIntrospector.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanIntrospector.java index 99aaa85466d..781320d9b80 100644 --- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanIntrospector.java +++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanIntrospector.java @@ -44,6 +44,7 @@ import javax.management.Descriptor; import javax.management.ImmutableDescriptor; import javax.management.IntrospectionException; import javax.management.InvalidAttributeValueException; +import javax.management.JMX; import javax.management.MBean; import javax.management.MBeanAttributeInfo; import javax.management.MBeanConstructorInfo; @@ -538,21 +539,22 @@ abstract class MBeanIntrospector { } static MBeanNotificationInfo[] findNotifications(Object moi) { - if (!(moi instanceof NotificationBroadcaster)) - return null; - MBeanNotificationInfo[] mbn = - ((NotificationBroadcaster) moi).getNotificationInfo(); - if (mbn == null || mbn.length == 0) - return findNotificationsFromAnnotations(moi.getClass()); - MBeanNotificationInfo[] result = - new MBeanNotificationInfo[mbn.length]; - for (int i = 0; i < mbn.length; i++) { - MBeanNotificationInfo ni = mbn[i]; - if (ni.getClass() != MBeanNotificationInfo.class) - ni = (MBeanNotificationInfo) ni.clone(); - result[i] = ni; + if (moi instanceof NotificationBroadcaster) { + MBeanNotificationInfo[] mbn = + ((NotificationBroadcaster) moi).getNotificationInfo(); + if (mbn != null && mbn.length > 0) { + MBeanNotificationInfo[] result = + new MBeanNotificationInfo[mbn.length]; + for (int i = 0; i < mbn.length; i++) { + MBeanNotificationInfo ni = mbn[i]; + if (ni.getClass() != MBeanNotificationInfo.class) + ni = (MBeanNotificationInfo) ni.clone(); + result[i] = ni; + } + return result; + } } - return result; + return findNotificationsFromAnnotations(moi.getClass()); } private static MBeanNotificationInfo[] findNotificationsFromAnnotations( diff --git a/jdk/src/share/classes/javax/management/openmbean/CompositeDataSupport.java b/jdk/src/share/classes/javax/management/openmbean/CompositeDataSupport.java index bd7c77af9b4..9a2f307fd79 100644 --- a/jdk/src/share/classes/javax/management/openmbean/CompositeDataSupport.java +++ b/jdk/src/share/classes/javax/management/openmbean/CompositeDataSupport.java @@ -101,7 +101,7 @@ public class CompositeDataSupport * the same size as itemNames; must not be null. * * @throws IllegalArgumentException compositeType is null, or - * itemNames[] or itemValues[] is null or empty, or one + * itemNames[] or itemValues[] is null, or one * of the elements in itemNames[] is a null or empty string, or * itemNames[] and itemValues[] are not of the same size. * diff --git a/jdk/test/javax/management/Introspector/AnnotatedNotificationInfoTest.java b/jdk/test/javax/management/Introspector/AnnotatedNotificationInfoTest.java index 3db55b74471..a995ee59b60 100644 --- a/jdk/test/javax/management/Introspector/AnnotatedNotificationInfoTest.java +++ b/jdk/test/javax/management/Introspector/AnnotatedNotificationInfoTest.java @@ -22,8 +22,8 @@ */ /* - * @test %M% %I% - * @bug 6323980 + * @test + * @bug 6323980 6772779 * @summary Test @NotificationInfo annotation * @author Eamonn McManus * @run main/othervm -ea AnnotatedNotificationInfoTest @@ -32,6 +32,7 @@ import java.io.Serializable; import java.lang.management.ManagementFactory; import java.lang.reflect.Field; +import java.util.Arrays; import javax.annotation.Resource; import javax.management.AttributeChangeNotification; import javax.management.Description; @@ -134,6 +135,23 @@ public class AnnotatedNotificationInfoTest { private static Object mbeanIntf5 = new Intf5Impl(); + @NotificationInfo( + types = {"foo", "bar"}, + notificationClass = AttributeChangeNotification.class, + description = @Description( + value = "description", + bundleBaseName = "bundle", + key = "key"), + descriptorFields = {"foo=bar"}) + public static interface Intf6MBean {} + + public static class Intf6 implements Intf6MBean { + @Resource + private volatile SendNotification send; + } + + private static Object mbeanIntf6 = new Intf6(); + public static interface Impl1MBean {} @NotificationInfo( @@ -202,22 +220,21 @@ public class AnnotatedNotificationInfoTest { private static Object mbeanMBean2 = new MBean2(); - // Following disabled until we support it -// @MBean -// @NotificationInfo( -// types = {"foo", "bar"}, -// notificationClass = AttributeChangeNotification.class, -// description = @Description( -// value = "description", -// bundleBaseName = "bundle", -// key = "key"), -// descriptorFields = {"foo=bar"}) -// public static class MBean3 { -// @Resource -// private volatile SendNotification send; -// } -// -// private static Object mbeanMBean3 = new MBean3(); + @MBean + @NotificationInfo( + types = {"foo", "bar"}, + notificationClass = AttributeChangeNotification.class, + description = @Description( + value = "description", + bundleBaseName = "bundle", + key = "key"), + descriptorFields = {"foo=bar"}) + public static class MBean3 { + @Resource + private volatile SendNotification send; + } + + private static Object mbeanMBean3 = new MBean3(); @MXBean @NotificationInfo( @@ -237,6 +254,23 @@ public class AnnotatedNotificationInfoTest { private static Object mbeanMXBean2 = new MXBean2(); + // Classes for the second test. This tests the simplest case, which is + // the first example in the javadoc for @NotificationInfo. Notice that + // this MBean is not a NotificationBroadcaster and does not inject a + // SendNotification! That should possibly be an error, but it's currently + // allowed by the spec. + @NotificationInfo(types={"com.example.notifs.create", + "com.example.notifs.destroy"}) + public static interface CacheMBean { + public int getCachedNum(); + } + + public static class Cache implements CacheMBean { + public int getCachedNum() { + return 0; + } + } + public static void main(String[] args) throws Exception { if (!AnnotatedNotificationInfoTest.class.desiredAssertionStatus()) throw new Exception("Test must be run with -ea"); @@ -267,5 +301,14 @@ public class AnnotatedNotificationInfoTest { assert mbnis[0].equals(expected) : mbnis[0]; mbs.unregisterMBean(on); } + + mbs.registerMBean(new Cache(), on); + MBeanInfo mbi = mbs.getMBeanInfo(on); + MBeanNotificationInfo[] mbnis = mbi.getNotifications(); + assert mbnis.length == 1 : mbnis.length; + String[] types = mbnis[0].getNotifTypes(); + String[] expectedTypes = + CacheMBean.class.getAnnotation(NotificationInfo.class).types(); + assert Arrays.equals(types, expectedTypes) : Arrays.toString(types); } } From abed5710b014265218c910c0f0d5da49155a8fec Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena Date: Thu, 20 Nov 2008 11:39:33 -0800 Subject: [PATCH 139/267] Added tag jdk7-b40 for changeset 4e9ce4796705 --- .hgtags-top-repo | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags-top-repo b/.hgtags-top-repo index c0b9b72f57d..75e4e323fcb 100644 --- a/.hgtags-top-repo +++ b/.hgtags-top-repo @@ -14,3 +14,4 @@ bb1ef4ee3d2c8cbf43a37d372325a7952be590b9 jdk7-b33 744554f5a3290e11c71cd2ddb1aff49e431f9ed0 jdk7-b37 cc47a76899ed33a2c513cb688348244c9b5a1288 jdk7-b38 ab523b49de1fc73fefe6855ce1e0349bdbd7af29 jdk7-b39 +44be42de6693063fb191989bf0e188de2fa51e7c jdk7-b40 From 68703b507d261dd6a3d9c3fe28f37eef3731d200 Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena Date: Thu, 20 Nov 2008 11:39:35 -0800 Subject: [PATCH 140/267] Added tag jdk7-b40 for changeset 14c451a86ec1 --- corba/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/corba/.hgtags b/corba/.hgtags index ae11865afed..73edf0f70c4 100644 --- a/corba/.hgtags +++ b/corba/.hgtags @@ -14,3 +14,4 @@ ef6af34d75a7b44e77083f1d4ee47631fa09d3b4 jdk7-b31 59d5848bdedebe91cc2753acce78911bcb4a66db jdk7-b37 08be802754b0296c91a7713b6d85a015dbcd5349 jdk7-b38 55078b6661e286e90387d1d9950bd865f5cc436e jdk7-b39 +184e21992f47a8d730df1adc5b21a108f3125489 jdk7-b40 From c60ef2ef3b07c89ec08bff466fea5dc3b44da5b6 Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena Date: Thu, 20 Nov 2008 11:39:38 -0800 Subject: [PATCH 141/267] Added tag jdk7-b40 for changeset d9cee294e5e4 --- hotspot/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/hotspot/.hgtags b/hotspot/.hgtags index f7cd42cd696..89714434ad8 100644 --- a/hotspot/.hgtags +++ b/hotspot/.hgtags @@ -14,3 +14,4 @@ e91159f921a58af3698e6479ea1fc5818da66d09 jdk7-b36 9ee9cf798b59e7d51f8c0a686959f313867a55d6 jdk7-b37 d9bc824aa078573829bb66572af847e26e1bd12e jdk7-b38 49ca90d77f34571b0757ebfcb8a7848ef2696b88 jdk7-b39 +81a0cbe3b28460ce836109934ece03db7afaf9cc jdk7-b40 From 323cfc4f2650d1312c5180217282b2afc899732d Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena Date: Thu, 20 Nov 2008 11:39:42 -0800 Subject: [PATCH 142/267] Added tag jdk7-b40 for changeset 116996236e31 --- jaxp/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxp/.hgtags b/jaxp/.hgtags index a0629ba363f..45dc322f9f8 100644 --- a/jaxp/.hgtags +++ b/jaxp/.hgtags @@ -14,3 +14,4 @@ c84ca638db42a8b6b227b4e3b63bca192c5ca634 jdk7-b36 af49591bc486d82aa04b832257de0d18adc9af52 jdk7-b37 e9f750f0a3a00413a7b77028b2ecdabb7129ae32 jdk7-b38 831b80be6cea8e7d7da197ccdac5fd4c701a5033 jdk7-b39 +54946f466e2c047c44c903f1bec400b685c2508e jdk7-b40 From a6c8f28b4eaa9f9a41f80d173593e42e7a99826e Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena Date: Thu, 20 Nov 2008 11:39:44 -0800 Subject: [PATCH 143/267] Added tag jdk7-b40 for changeset a0bb1aca37c4 --- jaxws/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxws/.hgtags b/jaxws/.hgtags index f578d68a15c..e6485b246c2 100644 --- a/jaxws/.hgtags +++ b/jaxws/.hgtags @@ -14,3 +14,4 @@ f60187f44a0d62906a5e2f6bd0989b5b24c1ca1e jdk7-b36 a2a6f9edf761934faf59ea60d7fe7178371302cd jdk7-b37 9ce439969184c753a9ba3caf8ed277b05230f2e5 jdk7-b38 077bc9b1b035a409a76bd5366f73ed9dd9846934 jdk7-b39 +70a6ac6dd737fe45c2fadb57646195b2b4fe269d jdk7-b40 From 5a1a07a54f93dae2c0fe83bbf9a65bf407845fe5 Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena Date: Thu, 20 Nov 2008 11:39:49 -0800 Subject: [PATCH 144/267] Added tag jdk7-b40 for changeset eb261bd963b2 --- jdk/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/.hgtags b/jdk/.hgtags index 8b57d704d5d..66dce59a9b2 100644 --- a/jdk/.hgtags +++ b/jdk/.hgtags @@ -14,3 +14,4 @@ cf4894b78ceb966326e93bf221db0c2d14d59218 jdk7-b35 14f50aee4989b75934d385c56a83da0c23d2f68b jdk7-b37 cc5f810b5af8a3a83b0df5a29d9e24d7a0ff8086 jdk7-b38 4e51997582effa006dde5c6d8b8820b2045b9c7f jdk7-b39 +2201dad60231a3c3e0346e3a0250d69ca3b71fd4 jdk7-b40 From 6683daa8c7fd1615e586cb57dae3b916f429db7e Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena Date: Thu, 20 Nov 2008 11:39:58 -0800 Subject: [PATCH 145/267] Added tag jdk7-b40 for changeset 5db12b3a75ea --- langtools/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/langtools/.hgtags b/langtools/.hgtags index f65d30fbffd..54d520d1a5a 100644 --- a/langtools/.hgtags +++ b/langtools/.hgtags @@ -14,3 +14,4 @@ eaf608c64fecf70f955dc9f29f94c055b183aeec jdk7-b30 24a47c3062fe8869fcfb533ce0ff770c8ceb550d jdk7-b37 3fd42dfa6f27f2767a241fb82bc01a613f0c2096 jdk7-b38 3fb51e47622bb771571680bc6a7b64c6172b482d jdk7-b39 +32e30988324601d08b87989f0821d99aa8534511 jdk7-b40 From db6bef2c706fe2e9ccfc082d3828835f9006485f Mon Sep 17 00:00:00 2001 From: "Y. Srinivas Ramakrishna" Date: Thu, 20 Nov 2008 12:27:41 -0800 Subject: [PATCH 146/267] 6722113: CMS: Incorrect overflow handling during precleaning of Reference lists When we encounter marking stack overflow during precleaning of Reference lists, we were using the overflow list mechanism, which can cause problems on account of mutating the mark word of the header because of conflicts with mutator accesses and updates of that field. Instead we should use the usual mechanism for overflow handling in concurrent phases, namely dirtying of the card on which the overflowed object lies. Since precleaning effectively does a form of discovered list processing, albeit with discovery enabled, we needed to adjust some code to be correct in the face of interleaved processing and discovery. Reviewed-by: apetrusenko, jcoomes --- .../concurrentMarkSweep/cmsOopClosures.hpp | 12 +++- .../concurrentMarkSweepGeneration.cpp | 46 ++++++++++--- .../concurrentMarkSweepGeneration.hpp | 14 +++- .../share/vm/memory/referenceProcessor.cpp | 69 ++++++++++--------- hotspot/src/share/vm/runtime/globals.hpp | 2 +- 5 files changed, 95 insertions(+), 48 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp index 3115b6b1127..de5955d503e 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp @@ -325,24 +325,30 @@ class Par_PushOrMarkClosure: public OopClosure { // For objects in CMS generation, this closure marks // given objects (transitively) as being reachable/live. // This is currently used during the (weak) reference object -// processing phase of the CMS final checkpoint step. +// processing phase of the CMS final checkpoint step, as +// well as during the concurrent precleaning of the discovered +// reference lists. class CMSKeepAliveClosure: public OopClosure { private: CMSCollector* _collector; const MemRegion _span; CMSMarkStack* _mark_stack; CMSBitMap* _bit_map; + bool _concurrent_precleaning; protected: DO_OOP_WORK_DEFN public: CMSKeepAliveClosure(CMSCollector* collector, MemRegion span, - CMSBitMap* bit_map, CMSMarkStack* mark_stack): + CMSBitMap* bit_map, CMSMarkStack* mark_stack, + bool cpc): _collector(collector), _span(span), _bit_map(bit_map), - _mark_stack(mark_stack) { + _mark_stack(mark_stack), + _concurrent_precleaning(cpc) { assert(!_span.is_empty(), "Empty span could spell trouble"); } + bool concurrent_precleaning() const { return _concurrent_precleaning; } virtual void do_oop(oop* p); virtual void do_oop(narrowOop* p); inline void do_oop_nv(oop* p) { CMSKeepAliveClosure::do_oop_work(p); } diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp index db40a525454..cd2ccd10945 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp @@ -538,6 +538,7 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen, _survivor_chunk_capacity(0), // -- ditto -- _survivor_chunk_index(0), // -- ditto -- _ser_pmc_preclean_ovflw(0), + _ser_kac_preclean_ovflw(0), _ser_pmc_remark_ovflw(0), _par_pmc_remark_ovflw(0), _ser_kac_ovflw(0), @@ -4388,10 +4389,10 @@ size_t CMSCollector::preclean_work(bool clean_refs, bool clean_survivor) { CMSPrecleanRefsYieldClosure yield_cl(this); assert(rp->span().equals(_span), "Spans should be equal"); CMSKeepAliveClosure keep_alive(this, _span, &_markBitMap, - &_markStack); + &_markStack, true /* preclean */); CMSDrainMarkingStackClosure complete_trace(this, - _span, &_markBitMap, &_markStack, - &keep_alive); + _span, &_markBitMap, &_markStack, + &keep_alive, true /* preclean */); // We don't want this step to interfere with a young // collection because we don't want to take CPU @@ -4852,17 +4853,19 @@ void CMSCollector::checkpointRootsFinalWork(bool asynch, // recurrence of that condition. assert(_markStack.isEmpty(), "No grey objects"); size_t ser_ovflw = _ser_pmc_remark_ovflw + _ser_pmc_preclean_ovflw + - _ser_kac_ovflw; + _ser_kac_ovflw + _ser_kac_preclean_ovflw; if (ser_ovflw > 0) { if (PrintCMSStatistics != 0) { gclog_or_tty->print_cr("Marking stack overflow (benign) " - "(pmc_pc="SIZE_FORMAT", pmc_rm="SIZE_FORMAT", kac="SIZE_FORMAT")", + "(pmc_pc="SIZE_FORMAT", pmc_rm="SIZE_FORMAT", kac="SIZE_FORMAT + ", kac_preclean="SIZE_FORMAT")", _ser_pmc_preclean_ovflw, _ser_pmc_remark_ovflw, - _ser_kac_ovflw); + _ser_kac_ovflw, _ser_kac_preclean_ovflw); } _markStack.expand(); _ser_pmc_remark_ovflw = 0; _ser_pmc_preclean_ovflw = 0; + _ser_kac_preclean_ovflw = 0; _ser_kac_ovflw = 0; } if (_par_pmc_remark_ovflw > 0 || _par_kac_ovflw > 0) { @@ -5693,10 +5696,10 @@ void CMSCollector::refProcessingWork(bool asynch, bool clear_all_soft_refs) { ReferenceProcessor* rp = ref_processor(); assert(rp->span().equals(_span), "Spans should be equal"); CMSKeepAliveClosure cmsKeepAliveClosure(this, _span, &_markBitMap, - &_markStack); + &_markStack, false /* !preclean */); CMSDrainMarkingStackClosure cmsDrainMarkingStackClosure(this, _span, &_markBitMap, &_markStack, - &cmsKeepAliveClosure); + &cmsKeepAliveClosure, false /* !preclean */); { TraceTime t("weak refs processing", PrintGCDetails, false, gclog_or_tty); if (rp->processing_is_mt()) { @@ -8302,8 +8305,29 @@ void CMSKeepAliveClosure::do_oop(oop obj) { } ) if (simulate_overflow || !_mark_stack->push(obj)) { - _collector->push_on_overflow_list(obj); - _collector->_ser_kac_ovflw++; + if (_concurrent_precleaning) { + // We dirty the overflown object and let the remark + // phase deal with it. + assert(_collector->overflow_list_is_empty(), "Error"); + // In the case of object arrays, we need to dirty all of + // the cards that the object spans. No locking or atomics + // are needed since no one else can be mutating the mod union + // table. + if (obj->is_objArray()) { + size_t sz = obj->size(); + HeapWord* end_card_addr = + (HeapWord*)round_to((intptr_t)(addr+sz), CardTableModRefBS::card_size); + MemRegion redirty_range = MemRegion(addr, end_card_addr); + assert(!redirty_range.is_empty(), "Arithmetical tautology"); + _collector->_modUnionTable.mark_range(redirty_range); + } else { + _collector->_modUnionTable.mark(addr); + } + _collector->_ser_kac_preclean_ovflw++; + } else { + _collector->push_on_overflow_list(obj); + _collector->_ser_kac_ovflw++; + } } } } @@ -8400,6 +8424,8 @@ const char* CMSExpansionCause::to_string(CMSExpansionCause::Cause cause) { void CMSDrainMarkingStackClosure::do_void() { // the max number to take from overflow list at a time const size_t num = _mark_stack->capacity()/4; + assert(!_concurrent_precleaning || _collector->overflow_list_is_empty(), + "Overflow list should be NULL during concurrent phases"); while (!_mark_stack->isEmpty() || // if stack is empty, check the overflow list _collector->take_from_overflow_list(num, _mark_stack)) { diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp index 9abc84c6a31..44ef14e8db3 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp @@ -592,6 +592,7 @@ class CMSCollector: public CHeapObj { size_t _ser_pmc_preclean_ovflw; size_t _ser_pmc_remark_ovflw; size_t _par_pmc_remark_ovflw; + size_t _ser_kac_preclean_ovflw; size_t _ser_kac_ovflw; size_t _par_kac_ovflw; NOT_PRODUCT(size_t _num_par_pushes;) @@ -1749,21 +1750,30 @@ class SweepClosure: public BlkClosureCareful { // work-routine/closure used to complete transitive // marking of objects as live after a certain point // in which an initial set has been completely accumulated. +// This closure is currently used both during the final +// remark stop-world phase, as well as during the concurrent +// precleaning of the discovered reference lists. class CMSDrainMarkingStackClosure: public VoidClosure { CMSCollector* _collector; MemRegion _span; CMSMarkStack* _mark_stack; CMSBitMap* _bit_map; CMSKeepAliveClosure* _keep_alive; + bool _concurrent_precleaning; public: CMSDrainMarkingStackClosure(CMSCollector* collector, MemRegion span, CMSBitMap* bit_map, CMSMarkStack* mark_stack, - CMSKeepAliveClosure* keep_alive): + CMSKeepAliveClosure* keep_alive, + bool cpc): _collector(collector), _span(span), _bit_map(bit_map), _mark_stack(mark_stack), - _keep_alive(keep_alive) { } + _keep_alive(keep_alive), + _concurrent_precleaning(cpc) { + assert(_concurrent_precleaning == _keep_alive->concurrent_precleaning(), + "Mismatch"); + } void do_void(); }; diff --git a/hotspot/src/share/vm/memory/referenceProcessor.cpp b/hotspot/src/share/vm/memory/referenceProcessor.cpp index ba024b91730..98da052b35b 100644 --- a/hotspot/src/share/vm/memory/referenceProcessor.cpp +++ b/hotspot/src/share/vm/memory/referenceProcessor.cpp @@ -47,7 +47,9 @@ public: } bool empty() const { return head() == ReferenceProcessor::sentinel_ref(); } size_t length() { return _len; } - void set_length(size_t len) { _len = len; } + void set_length(size_t len) { _len = len; } + void inc_length(size_t inc) { _len += inc; assert(_len > 0, "Error"); } + void dec_length(size_t dec) { _len -= dec; } private: // Set value depending on UseCompressedOops. This could be a template class // but then we have to fix all the instantiations and declarations that use this class. @@ -436,13 +438,13 @@ public: // The "allow_null_referent" argument tells us to allow for the possibility // of a NULL referent in the discovered Reference object. This typically // happens in the case of concurrent collectors that may have done the - // discovery concurrently or interleaved with mutator execution. + // discovery concurrently, or interleaved, with mutator execution. inline void load_ptrs(DEBUG_ONLY(bool allow_null_referent)); // Move to the next discovered reference. inline void next(); - // Remove the current reference from the list and move to the next. + // Remove the current reference from the list inline void remove(); // Make the Reference object active again. @@ -476,7 +478,6 @@ public: inline size_t removed() const { return _removed; } ) -private: inline void move_to_next(); private: @@ -553,7 +554,7 @@ inline void DiscoveredListIterator::remove() { oopDesc::store_heap_oop((oop*)_prev_next, _next); } NOT_PRODUCT(_removed++); - move_to_next(); + _refs_list.dec_length(1); } inline void DiscoveredListIterator::move_to_next() { @@ -591,12 +592,13 @@ ReferenceProcessor::process_phase1(DiscoveredList& refs_list, gclog_or_tty->print_cr("Dropping reference (" INTPTR_FORMAT ": %s" ") by policy", iter.obj(), iter.obj()->blueprint()->internal_name()); } + // Remove Reference object from list + iter.remove(); // Make the Reference object active again iter.make_active(); // keep the referent around iter.make_referent_alive(); - // Remove Reference object from list - iter.remove(); + iter.move_to_next(); } else { iter.next(); } @@ -629,12 +631,13 @@ ReferenceProcessor::pp2_work(DiscoveredList& refs_list, iter.obj(), iter.obj()->blueprint()->internal_name()); } // The referent is reachable after all. + // Remove Reference object from list. + iter.remove(); // Update the referent pointer as necessary: Note that this // should not entail any recursive marking because the // referent must already have been traversed. iter.make_referent_alive(); - // Remove Reference object from list - iter.remove(); + iter.move_to_next(); } else { iter.next(); } @@ -670,6 +673,7 @@ ReferenceProcessor::pp2_work_concurrent_discovery(DiscoveredList& refs_list, } else { keep_alive->do_oop((oop*)next_addr); } + iter.move_to_next(); } else { iter.next(); } @@ -832,9 +836,9 @@ void ReferenceProcessor::balance_queues(DiscoveredList ref_lists[]) } java_lang_ref_Reference::set_discovered(move_tail, ref_lists[to_idx].head()); ref_lists[to_idx].set_head(move_head); - ref_lists[to_idx].set_length(ref_lists[to_idx].length() + refs_to_move); + ref_lists[to_idx].inc_length(refs_to_move); ref_lists[from_idx].set_head(new_head); - ref_lists[from_idx].set_length(ref_lists[from_idx].length() - refs_to_move); + ref_lists[from_idx].dec_length(refs_to_move); } else { ++to_idx; } @@ -923,7 +927,6 @@ void ReferenceProcessor::clean_up_discovered_references() { void ReferenceProcessor::clean_up_discovered_reflist(DiscoveredList& refs_list) { assert(!discovery_is_atomic(), "Else why call this method?"); DiscoveredListIterator iter(refs_list, NULL, NULL); - size_t length = refs_list.length(); while (iter.has_next()) { iter.load_ptrs(DEBUG_ONLY(true /* allow_null_referent */)); oop next = java_lang_ref_Reference::next(iter.obj()); @@ -941,12 +944,11 @@ void ReferenceProcessor::clean_up_discovered_reflist(DiscoveredList& refs_list) ) // Remove Reference object from list iter.remove(); - --length; + iter.move_to_next(); } else { iter.next(); } } - refs_list.set_length(length); NOT_PRODUCT( if (PrintGCDetails && TraceReferenceGC) { gclog_or_tty->print( @@ -1024,7 +1026,7 @@ ReferenceProcessor::add_to_discovered_list_mt(DiscoveredList& refs_list, // We have separate lists for enqueueing so no synchronization // is necessary. refs_list.set_head(obj); - refs_list.set_length(refs_list.length() + 1); + refs_list.inc_length(1); if (_discovered_list_needs_barrier) { _bs->write_ref_field((void*)discovered_addr, current_head); guarantee(false, "Needs to be fixed: YSR"); } @@ -1168,7 +1170,7 @@ bool ReferenceProcessor::discover_reference(oop obj, ReferenceType rt) { _bs->write_ref_field((oop*)discovered_addr, current_head); } list->set_head(obj); - list->set_length(list->length() + 1); + list->inc_length(1); } // In the MT discovery case, it is currently possible to see @@ -1209,45 +1211,48 @@ void ReferenceProcessor::preclean_discovered_references( TraceTime tt("Preclean SoftReferences", PrintGCDetails && PrintReferenceGC, false, gclog_or_tty); for (int i = 0; i < _num_q; i++) { + if (yield->should_return()) { + return; + } preclean_discovered_reflist(_discoveredSoftRefs[i], is_alive, keep_alive, complete_gc, yield); } } - if (yield->should_return()) { - return; - } // Weak references { TraceTime tt("Preclean WeakReferences", PrintGCDetails && PrintReferenceGC, false, gclog_or_tty); for (int i = 0; i < _num_q; i++) { + if (yield->should_return()) { + return; + } preclean_discovered_reflist(_discoveredWeakRefs[i], is_alive, keep_alive, complete_gc, yield); } } - if (yield->should_return()) { - return; - } // Final references { TraceTime tt("Preclean FinalReferences", PrintGCDetails && PrintReferenceGC, false, gclog_or_tty); for (int i = 0; i < _num_q; i++) { + if (yield->should_return()) { + return; + } preclean_discovered_reflist(_discoveredFinalRefs[i], is_alive, keep_alive, complete_gc, yield); } } - if (yield->should_return()) { - return; - } // Phantom references { TraceTime tt("Preclean PhantomReferences", PrintGCDetails && PrintReferenceGC, false, gclog_or_tty); for (int i = 0; i < _num_q; i++) { + if (yield->should_return()) { + return; + } preclean_discovered_reflist(_discoveredPhantomRefs[i], is_alive, keep_alive, complete_gc, yield); } @@ -1256,9 +1261,12 @@ void ReferenceProcessor::preclean_discovered_references( // Walk the given discovered ref list, and remove all reference objects // whose referents are still alive, whose referents are NULL or which -// are not active (have a non-NULL next field). NOTE: For this to work -// correctly, refs discovery can not be happening concurrently with this -// step. +// are not active (have a non-NULL next field). NOTE: When we are +// thus precleaning the ref lists (which happens single-threaded today), +// we do not disable refs discovery to honour the correct semantics of +// java.lang.Reference. As a result, we need to be careful below +// that ref removal steps interleave safely with ref discovery steps +// (in this thread). void ReferenceProcessor::preclean_discovered_reflist(DiscoveredList& refs_list, BoolObjectClosure* is_alive, @@ -1266,7 +1274,6 @@ ReferenceProcessor::preclean_discovered_reflist(DiscoveredList& refs_list, VoidClosure* complete_gc, YieldClosure* yield) { DiscoveredListIterator iter(refs_list, keep_alive, is_alive); - size_t length = refs_list.length(); while (iter.has_next()) { iter.load_ptrs(DEBUG_ONLY(true /* allow_null_referent */)); oop obj = iter.obj(); @@ -1281,7 +1288,6 @@ ReferenceProcessor::preclean_discovered_reflist(DiscoveredList& refs_list, } // Remove Reference object from list iter.remove(); - --length; // Keep alive its cohort. iter.make_referent_alive(); if (UseCompressedOops) { @@ -1291,12 +1297,11 @@ ReferenceProcessor::preclean_discovered_reflist(DiscoveredList& refs_list, oop* next_addr = (oop*)java_lang_ref_Reference::next_addr(obj); keep_alive->do_oop(next_addr); } + iter.move_to_next(); } else { iter.next(); } } - refs_list.set_length(length); - // Close the reachable set complete_gc->do_void(); diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index a2476f9c707..2766a3e335b 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -1474,7 +1474,7 @@ class CommandLineFlags { "CMSPrecleanNumerator:CMSPrecleanDenominator yields convergence" \ " ratio") \ \ - product(bool, CMSPrecleanRefLists1, false, \ + product(bool, CMSPrecleanRefLists1, true, \ "Preclean ref lists during (initial) preclean phase") \ \ product(bool, CMSPrecleanRefLists2, false, \ From 9f247462f60f66a1a5780a3363e0683ba8cbc207 Mon Sep 17 00:00:00 2001 From: Xueming Shen Date: Thu, 20 Nov 2008 14:06:19 -0800 Subject: [PATCH 147/267] 6745216: missing 4 chraset aliases in sun.nio.cs package Added "834" into x-IBM834's aliase list. Reviewed-by: alanb --- jdk/src/share/classes/sun/nio/cs/ext/ExtendedCharsets.java | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/src/share/classes/sun/nio/cs/ext/ExtendedCharsets.java b/jdk/src/share/classes/sun/nio/cs/ext/ExtendedCharsets.java index 04434f1f563..bb6c16417a8 100644 --- a/jdk/src/share/classes/sun/nio/cs/ext/ExtendedCharsets.java +++ b/jdk/src/share/classes/sun/nio/cs/ext/ExtendedCharsets.java @@ -770,6 +770,7 @@ public class ExtendedCharsets new String[] { "cp834", "ibm834", + "834", "ibm-834" }); From 7d7cf3f8affe1b15d65fc5c8c9399a4e923c7b32 Mon Sep 17 00:00:00 2001 From: "Y. Srinivas Ramakrishna" Date: Thu, 20 Nov 2008 16:56:09 -0800 Subject: [PATCH 148/267] 6684579: SoftReference processing can be made more efficient For current soft-ref clearing policies, we can decide at marking time if a soft-reference will definitely not be cleared, postponing the decision of whether it will definitely be cleared to the final reference processing phase. This can be especially beneficial in the case of concurrent collectors where the marking is usually concurrent but reference processing is usually not. Reviewed-by: jmasa --- .../concurrentMarkSweepGeneration.cpp | 45 +++++++------------ .../gc_implementation/g1/concurrentMark.cpp | 24 +++------- .../gc_implementation/g1/g1CollectedHeap.cpp | 3 +- .../vm/gc_implementation/g1/g1MarkSweep.cpp | 26 ++++------- .../parNew/parNewGeneration.cpp | 34 ++++++-------- .../parallelScavenge/psMarkSweep.cpp | 16 ++----- .../parallelScavenge/psParallelCompact.cpp | 19 ++------ .../parallelScavenge/psScavenge.cpp | 15 ++----- hotspot/src/share/vm/includeDB_core | 1 + .../src/share/vm/memory/defNewGeneration.cpp | 14 ++---- .../src/share/vm/memory/genCollectedHeap.cpp | 3 +- hotspot/src/share/vm/memory/genMarkSweep.cpp | 18 ++------ .../src/share/vm/memory/referencePolicy.cpp | 10 +++++ .../src/share/vm/memory/referencePolicy.hpp | 8 +++- .../share/vm/memory/referenceProcessor.cpp | 42 ++++++++++++----- .../share/vm/memory/referenceProcessor.hpp | 19 ++++++-- hotspot/src/share/vm/memory/universe.cpp | 2 +- hotspot/src/share/vm/utilities/macros.hpp | 2 + 18 files changed, 137 insertions(+), 164 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp index cd2ccd10945..e2e27c0f353 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp @@ -1961,6 +1961,7 @@ void CMSCollector::do_compaction_work(bool clear_all_soft_refs) { ref_processor()->set_enqueuing_is_done(false); ref_processor()->enable_discovery(); + ref_processor()->snap_policy(clear_all_soft_refs); // If an asynchronous collection finishes, the _modUnionTable is // all clear. If we are assuming the collection from an asynchronous // collection, clear the _modUnionTable. @@ -2384,6 +2385,9 @@ void CMSCollector::collect_in_foreground(bool clear_all_soft_refs) { Universe::verify(true); } + // Snapshot the soft reference policy to be used in this collection cycle. + ref_processor()->snap_policy(clear_all_soft_refs); + bool init_mark_was_synchronous = false; // until proven otherwise while (_collectorState != Idling) { if (TraceCMSState) { @@ -4591,11 +4595,11 @@ size_t CMSCollector::preclean_mod_union_table( if (!dirtyRegion.is_empty()) { assert(numDirtyCards > 0, "consistency check"); HeapWord* stop_point = NULL; + stopTimer(); + CMSTokenSyncWithLocks ts(true, gen->freelistLock(), + bitMapLock()); + startTimer(); { - stopTimer(); - CMSTokenSyncWithLocks ts(true, gen->freelistLock(), - bitMapLock()); - startTimer(); verify_work_stacks_empty(); verify_overflow_empty(); sample_eden(); @@ -4612,10 +4616,6 @@ size_t CMSCollector::preclean_mod_union_table( assert((CMSPermGenPrecleaningEnabled && (gen == _permGen)) || (_collectorState == AbortablePreclean && should_abort_preclean()), "Unparsable objects should only be in perm gen."); - - stopTimer(); - CMSTokenSyncWithLocks ts(true, bitMapLock()); - startTimer(); _modUnionTable.mark_range(MemRegion(stop_point, dirtyRegion.end())); if (should_abort_preclean()) { break; // out of preclean loop @@ -5678,23 +5678,14 @@ void CMSCollector::refProcessingWork(bool asynch, bool clear_all_soft_refs) { ResourceMark rm; HandleMark hm; - ReferencePolicy* soft_ref_policy; - - assert(!ref_processor()->enqueuing_is_done(), "Enqueuing should not be complete"); - // Process weak references. - if (clear_all_soft_refs) { - soft_ref_policy = new AlwaysClearPolicy(); - } else { -#ifdef COMPILER2 - soft_ref_policy = new LRUMaxHeapPolicy(); -#else - soft_ref_policy = new LRUCurrentHeapPolicy(); -#endif // COMPILER2 - } - verify_work_stacks_empty(); ReferenceProcessor* rp = ref_processor(); assert(rp->span().equals(_span), "Spans should be equal"); + assert(!rp->enqueuing_is_done(), "Enqueuing should not be complete"); + // Process weak references. + rp->snap_policy(clear_all_soft_refs); + verify_work_stacks_empty(); + CMSKeepAliveClosure cmsKeepAliveClosure(this, _span, &_markBitMap, &_markStack, false /* !preclean */); CMSDrainMarkingStackClosure cmsDrainMarkingStackClosure(this, @@ -5704,14 +5695,12 @@ void CMSCollector::refProcessingWork(bool asynch, bool clear_all_soft_refs) { TraceTime t("weak refs processing", PrintGCDetails, false, gclog_or_tty); if (rp->processing_is_mt()) { CMSRefProcTaskExecutor task_executor(*this); - rp->process_discovered_references(soft_ref_policy, - &_is_alive_closure, + rp->process_discovered_references(&_is_alive_closure, &cmsKeepAliveClosure, &cmsDrainMarkingStackClosure, &task_executor); } else { - rp->process_discovered_references(soft_ref_policy, - &_is_alive_closure, + rp->process_discovered_references(&_is_alive_closure, &cmsKeepAliveClosure, &cmsDrainMarkingStackClosure, NULL); @@ -6166,8 +6155,8 @@ void CMSCollector::verify_ok_to_terminate() const { #endif size_t CMSCollector::block_size_using_printezis_bits(HeapWord* addr) const { - assert(_markBitMap.isMarked(addr) && _markBitMap.isMarked(addr + 1), - "missing Printezis mark?"); + assert(_markBitMap.isMarked(addr) && _markBitMap.isMarked(addr + 1), + "missing Printezis mark?"); HeapWord* nextOneAddr = _markBitMap.getNextMarkedWordAddress(addr + 2); size_t size = pointer_delta(nextOneAddr + 1, addr); assert(size == CompactibleFreeListSpace::adjustObjectSize(size), diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp index 036e0e7fcf3..65f64e2ad16 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp @@ -811,6 +811,7 @@ void ConcurrentMark::checkpointRootsInitialPost() { ReferenceProcessor* rp = g1h->ref_processor(); rp->verify_no_references_recorded(); rp->enable_discovery(); // enable ("weak") refs discovery + rp->snap_policy(false); // snapshot the soft ref policy to be used in this cycle SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set(); satb_mq_set.set_process_completed_threshold(G1SATBProcessCompletedThreshold); @@ -1829,32 +1830,21 @@ class G1CMDrainMarkingStackClosure: public VoidClosure { void ConcurrentMark::weakRefsWork(bool clear_all_soft_refs) { ResourceMark rm; HandleMark hm; - ReferencePolicy* soft_ref_policy; + G1CollectedHeap* g1h = G1CollectedHeap::heap(); + ReferenceProcessor* rp = g1h->ref_processor(); // Process weak references. - if (clear_all_soft_refs) { - soft_ref_policy = new AlwaysClearPolicy(); - } else { -#ifdef COMPILER2 - soft_ref_policy = new LRUMaxHeapPolicy(); -#else - soft_ref_policy = new LRUCurrentHeapPolicy(); -#endif - } + rp->snap_policy(clear_all_soft_refs); assert(_markStack.isEmpty(), "mark stack should be empty"); - G1CollectedHeap* g1 = G1CollectedHeap::heap(); - G1CMIsAliveClosure g1IsAliveClosure(g1); - - G1CMKeepAliveClosure g1KeepAliveClosure(g1, this, nextMarkBitMap()); + G1CMIsAliveClosure g1IsAliveClosure (g1h); + G1CMKeepAliveClosure g1KeepAliveClosure(g1h, this, nextMarkBitMap()); G1CMDrainMarkingStackClosure g1DrainMarkingStackClosure(nextMarkBitMap(), &_markStack, &g1KeepAliveClosure); // XXXYYY Also: copy the parallel ref processing code from CMS. - ReferenceProcessor* rp = g1->ref_processor(); - rp->process_discovered_references(soft_ref_policy, - &g1IsAliveClosure, + rp->process_discovered_references(&g1IsAliveClosure, &g1KeepAliveClosure, &g1DrainMarkingStackClosure, NULL); diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index 370745f36e1..5aaa483b91c 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -891,6 +891,7 @@ void G1CollectedHeap::do_collection(bool full, bool clear_all_soft_refs, ReferenceProcessorIsAliveMutator rp_is_alive_null(ref_processor(), NULL); ref_processor()->enable_discovery(); + ref_processor()->snap_policy(clear_all_soft_refs); // Do collection work { @@ -2463,7 +2464,7 @@ G1CollectedHeap::do_collection_pause_at_safepoint(HeapRegion* popular_region) { COMPILER2_PRESENT(DerivedPointerTable::clear()); - // We want to turn off ref discovere, if necessary, and turn it back on + // We want to turn off ref discovery, if necessary, and turn it back on // on again later if we do. bool was_enabled = ref_processor()->discovery_enabled(); if (was_enabled) ref_processor()->disable_discovery(); diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp index 3c5eccb4a7b..4aa08a2319e 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp @@ -33,8 +33,9 @@ void G1MarkSweep::invoke_at_safepoint(ReferenceProcessor* rp, // hook up weak ref data so it can be used during Mark-Sweep assert(GenMarkSweep::ref_processor() == NULL, "no stomping"); - GenMarkSweep::_ref_processor = rp; assert(rp != NULL, "should be non-NULL"); + GenMarkSweep::_ref_processor = rp; + rp->snap_policy(clear_all_softrefs); // When collecting the permanent generation methodOops may be moving, // so we either have to flush all bcp data or convert it into bci. @@ -121,23 +122,12 @@ void G1MarkSweep::mark_sweep_phase1(bool& marked_for_unloading, &GenMarkSweep::follow_root_closure); // Process reference objects found during marking - ReferencePolicy *soft_ref_policy; - if (clear_all_softrefs) { - soft_ref_policy = new AlwaysClearPolicy(); - } else { -#ifdef COMPILER2 - soft_ref_policy = new LRUMaxHeapPolicy(); -#else - soft_ref_policy = new LRUCurrentHeapPolicy(); -#endif - } - assert(soft_ref_policy != NULL,"No soft reference policy"); - GenMarkSweep::ref_processor()->process_discovered_references( - soft_ref_policy, - &GenMarkSweep::is_alive, - &GenMarkSweep::keep_alive, - &GenMarkSweep::follow_stack_closure, - NULL); + ReferenceProcessor* rp = GenMarkSweep::ref_processor(); + rp->snap_policy(clear_all_softrefs); + rp->process_discovered_references(&GenMarkSweep::is_alive, + &GenMarkSweep::keep_alive, + &GenMarkSweep::follow_stack_closure, + NULL); // Follow system dictionary roots and unload classes bool purged_class = SystemDictionary::do_unloading(&GenMarkSweep::is_alive); diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp index 7803f08b56a..aca77d20634 100644 --- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp +++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp @@ -759,17 +759,12 @@ void ParNewGeneration::collect(bool full, thread_state_set.steals(), thread_state_set.pops()+thread_state_set.steals()); } - assert(thread_state_set.pushes() == thread_state_set.pops() + thread_state_set.steals(), + assert(thread_state_set.pushes() == thread_state_set.pops() + + thread_state_set.steals(), "Or else the queues are leaky."); - // For now, process discovered weak refs sequentially. -#ifdef COMPILER2 - ReferencePolicy *soft_ref_policy = new LRUMaxHeapPolicy(); -#else - ReferencePolicy *soft_ref_policy = new LRUCurrentHeapPolicy(); -#endif // COMPILER2 - // Process (weak) reference objects found during scavenge. + ReferenceProcessor* rp = ref_processor(); IsAliveClosure is_alive(this); ScanWeakRefClosure scan_weak_ref(this); KeepAliveClosure keep_alive(&scan_weak_ref); @@ -778,18 +773,17 @@ void ParNewGeneration::collect(bool full, set_promo_failure_scan_stack_closure(&scan_without_gc_barrier); EvacuateFollowersClosureGeneral evacuate_followers(gch, _level, &scan_without_gc_barrier, &scan_with_gc_barrier); - if (ref_processor()->processing_is_mt()) { + rp->snap_policy(clear_all_soft_refs); + if (rp->processing_is_mt()) { ParNewRefProcTaskExecutor task_executor(*this, thread_state_set); - ref_processor()->process_discovered_references( - soft_ref_policy, &is_alive, &keep_alive, &evacuate_followers, - &task_executor); + rp->process_discovered_references(&is_alive, &keep_alive, + &evacuate_followers, &task_executor); } else { thread_state_set.flush(); gch->set_par_threads(0); // 0 ==> non-parallel. gch->save_marks(); - ref_processor()->process_discovered_references( - soft_ref_policy, &is_alive, &keep_alive, &evacuate_followers, - NULL); + rp->process_discovered_references(&is_alive, &keep_alive, + &evacuate_followers, NULL); } if (!promotion_failed()) { // Swap the survivor spaces. @@ -851,14 +845,14 @@ void ParNewGeneration::collect(bool full, SpecializationStats::print(); - ref_processor()->set_enqueuing_is_done(true); - if (ref_processor()->processing_is_mt()) { + rp->set_enqueuing_is_done(true); + if (rp->processing_is_mt()) { ParNewRefProcTaskExecutor task_executor(*this, thread_state_set); - ref_processor()->enqueue_discovered_references(&task_executor); + rp->enqueue_discovered_references(&task_executor); } else { - ref_processor()->enqueue_discovered_references(NULL); + rp->enqueue_discovered_references(NULL); } - ref_processor()->verify_no_references_recorded(); + rp->verify_no_references_recorded(); } static int sum; diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp index 97d9e31b7e3..5134f47e7a5 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp @@ -172,6 +172,7 @@ void PSMarkSweep::invoke_no_policy(bool clear_all_softrefs) { COMPILER2_PRESENT(DerivedPointerTable::clear()); ref_processor()->enable_discovery(); + ref_processor()->snap_policy(clear_all_softrefs); mark_sweep_phase1(clear_all_softrefs); @@ -517,20 +518,9 @@ void PSMarkSweep::mark_sweep_phase1(bool clear_all_softrefs) { // Process reference objects found during marking { - ReferencePolicy *soft_ref_policy; - if (clear_all_softrefs) { - soft_ref_policy = new AlwaysClearPolicy(); - } else { -#ifdef COMPILER2 - soft_ref_policy = new LRUMaxHeapPolicy(); -#else - soft_ref_policy = new LRUCurrentHeapPolicy(); -#endif // COMPILER2 - } - assert(soft_ref_policy != NULL,"No soft reference policy"); + ref_processor()->snap_policy(clear_all_softrefs); ref_processor()->process_discovered_references( - soft_ref_policy, is_alive_closure(), mark_and_push_closure(), - follow_stack_closure(), NULL); + is_alive_closure(), mark_and_push_closure(), follow_stack_closure(), NULL); } // Follow system dictionary roots and unload classes diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp index a84a955f0d3..9ca6b6c804c 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp @@ -1578,6 +1578,7 @@ void PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) { COMPILER2_PRESENT(DerivedPointerTable::clear()); ref_processor()->enable_discovery(); + ref_processor()->snap_policy(maximum_heap_compaction); bool marked_for_unloading = false; @@ -1894,26 +1895,14 @@ void PSParallelCompact::marking_phase(ParCompactionManager* cm, // Process reference objects found during marking { TraceTime tm_r("reference processing", print_phases(), true, gclog_or_tty); - ReferencePolicy *soft_ref_policy; - if (maximum_heap_compaction) { - soft_ref_policy = new AlwaysClearPolicy(); - } else { -#ifdef COMPILER2 - soft_ref_policy = new LRUMaxHeapPolicy(); -#else - soft_ref_policy = new LRUCurrentHeapPolicy(); -#endif // COMPILER2 - } - assert(soft_ref_policy != NULL, "No soft reference policy"); if (ref_processor()->processing_is_mt()) { RefProcTaskExecutor task_executor; ref_processor()->process_discovered_references( - soft_ref_policy, is_alive_closure(), &mark_and_push_closure, - &follow_stack_closure, &task_executor); + is_alive_closure(), &mark_and_push_closure, &follow_stack_closure, + &task_executor); } else { ref_processor()->process_discovered_references( - soft_ref_policy, is_alive_closure(), &mark_and_push_closure, - &follow_stack_closure, NULL); + is_alive_closure(), &mark_and_push_closure, &follow_stack_closure, NULL); } } diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp index 090b15f64ba..4aa7d5afe38 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp @@ -330,6 +330,7 @@ bool PSScavenge::invoke_no_policy() { COMPILER2_PRESENT(DerivedPointerTable::clear()); reference_processor()->enable_discovery(); + reference_processor()->snap_policy(false); // We track how much was promoted to the next generation for // the AdaptiveSizePolicy. @@ -394,24 +395,16 @@ bool PSScavenge::invoke_no_policy() { // Process reference objects discovered during scavenge { -#ifdef COMPILER2 - ReferencePolicy *soft_ref_policy = new LRUMaxHeapPolicy(); -#else - ReferencePolicy *soft_ref_policy = new LRUCurrentHeapPolicy(); -#endif // COMPILER2 - + reference_processor()->snap_policy(false); // not always_clear PSKeepAliveClosure keep_alive(promotion_manager); PSEvacuateFollowersClosure evac_followers(promotion_manager); - assert(soft_ref_policy != NULL,"No soft reference policy"); if (reference_processor()->processing_is_mt()) { PSRefProcTaskExecutor task_executor; reference_processor()->process_discovered_references( - soft_ref_policy, &_is_alive_closure, &keep_alive, &evac_followers, - &task_executor); + &_is_alive_closure, &keep_alive, &evac_followers, &task_executor); } else { reference_processor()->process_discovered_references( - soft_ref_policy, &_is_alive_closure, &keep_alive, &evac_followers, - NULL); + &_is_alive_closure, &keep_alive, &evac_followers, NULL); } } diff --git a/hotspot/src/share/vm/includeDB_core b/hotspot/src/share/vm/includeDB_core index 3b4dd2e38fe..ed59dfeed1d 100644 --- a/hotspot/src/share/vm/includeDB_core +++ b/hotspot/src/share/vm/includeDB_core @@ -3434,6 +3434,7 @@ referenceProcessor.cpp referenceProcessor.hpp referenceProcessor.cpp systemDictionary.hpp referenceProcessor.hpp instanceRefKlass.hpp +referenceProcessor.hpp referencePolicy.hpp reflection.cpp arguments.hpp reflection.cpp handles.inline.hpp diff --git a/hotspot/src/share/vm/memory/defNewGeneration.cpp b/hotspot/src/share/vm/memory/defNewGeneration.cpp index 63278cee703..e953e7545b5 100644 --- a/hotspot/src/share/vm/memory/defNewGeneration.cpp +++ b/hotspot/src/share/vm/memory/defNewGeneration.cpp @@ -540,14 +540,6 @@ void DefNewGeneration::collect(bool full, assert(gch->no_allocs_since_save_marks(0), "save marks have not been newly set."); - // Weak refs. - // FIXME: Are these storage leaks, or are they resource objects? -#ifdef COMPILER2 - ReferencePolicy *soft_ref_policy = new LRUMaxHeapPolicy(); -#else - ReferencePolicy *soft_ref_policy = new LRUCurrentHeapPolicy(); -#endif // COMPILER2 - // Not very pretty. CollectorPolicy* cp = gch->collector_policy(); @@ -574,8 +566,10 @@ void DefNewGeneration::collect(bool full, evacuate_followers.do_void(); FastKeepAliveClosure keep_alive(this, &scan_weak_ref); - ref_processor()->process_discovered_references( - soft_ref_policy, &is_alive, &keep_alive, &evacuate_followers, NULL); + ReferenceProcessor* rp = ref_processor(); + rp->snap_policy(clear_all_soft_refs); + rp->process_discovered_references(&is_alive, &keep_alive, &evacuate_followers, + NULL); if (!promotion_failed()) { // Swap the survivor spaces. eden()->clear(SpaceDecorator::Mangle); diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.cpp b/hotspot/src/share/vm/memory/genCollectedHeap.cpp index 0cfa60bd2b9..f411d4d7bfa 100644 --- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp +++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp @@ -525,8 +525,9 @@ void GenCollectedHeap::do_collection(bool full, if (rp->discovery_is_atomic()) { rp->verify_no_references_recorded(); rp->enable_discovery(); + rp->snap_policy(clear_all_soft_refs); } else { - // collect() will enable discovery as appropriate + // collect() below will enable discovery as appropriate } _gens[i]->collect(full, clear_all_soft_refs, size, is_tlab); if (!rp->enqueuing_is_done()) { diff --git a/hotspot/src/share/vm/memory/genMarkSweep.cpp b/hotspot/src/share/vm/memory/genMarkSweep.cpp index 50562ab2e99..f0c41d75c00 100644 --- a/hotspot/src/share/vm/memory/genMarkSweep.cpp +++ b/hotspot/src/share/vm/memory/genMarkSweep.cpp @@ -31,8 +31,9 @@ void GenMarkSweep::invoke_at_safepoint(int level, ReferenceProcessor* rp, // hook up weak ref data so it can be used during Mark-Sweep assert(ref_processor() == NULL, "no stomping"); - _ref_processor = rp; assert(rp != NULL, "should be non-NULL"); + _ref_processor = rp; + rp->snap_policy(clear_all_softrefs); TraceTime t1("Full GC", PrintGC && !PrintGCDetails, true, gclog_or_tty); @@ -245,20 +246,9 @@ void GenMarkSweep::mark_sweep_phase1(int level, // Process reference objects found during marking { - ReferencePolicy *soft_ref_policy; - if (clear_all_softrefs) { - soft_ref_policy = new AlwaysClearPolicy(); - } else { -#ifdef COMPILER2 - soft_ref_policy = new LRUMaxHeapPolicy(); -#else - soft_ref_policy = new LRUCurrentHeapPolicy(); -#endif // COMPILER2 - } - assert(soft_ref_policy != NULL,"No soft reference policy"); + ref_processor()->snap_policy(clear_all_softrefs); ref_processor()->process_discovered_references( - soft_ref_policy, &is_alive, &keep_alive, - &follow_stack_closure, NULL); + &is_alive, &keep_alive, &follow_stack_closure, NULL); } // Follow system dictionary roots and unload classes diff --git a/hotspot/src/share/vm/memory/referencePolicy.cpp b/hotspot/src/share/vm/memory/referencePolicy.cpp index 08fa2a15767..0d23d1ddf36 100644 --- a/hotspot/src/share/vm/memory/referencePolicy.cpp +++ b/hotspot/src/share/vm/memory/referencePolicy.cpp @@ -26,6 +26,11 @@ # include "incls/_referencePolicy.cpp.incl" LRUCurrentHeapPolicy::LRUCurrentHeapPolicy() { + snap(); +} + +// Capture state (of-the-VM) information needed to evaluate the policy +void LRUCurrentHeapPolicy::snap() { _max_interval = (Universe::get_heap_free_at_last_gc() / M) * SoftRefLRUPolicyMSPerMB; assert(_max_interval >= 0,"Sanity check"); } @@ -47,6 +52,11 @@ bool LRUCurrentHeapPolicy::should_clear_reference(oop p) { /////////////////////// MaxHeap ////////////////////// LRUMaxHeapPolicy::LRUMaxHeapPolicy() { + snap(); +} + +// Capture state (of-the-VM) information needed to evaluate the policy +void LRUMaxHeapPolicy::snap() { size_t max_heap = MaxHeapSize; max_heap -= Universe::get_heap_used_at_last_gc(); max_heap /= M; diff --git a/hotspot/src/share/vm/memory/referencePolicy.hpp b/hotspot/src/share/vm/memory/referencePolicy.hpp index 5645d060d5f..538ab183a0c 100644 --- a/hotspot/src/share/vm/memory/referencePolicy.hpp +++ b/hotspot/src/share/vm/memory/referencePolicy.hpp @@ -26,9 +26,11 @@ // should be cleared. -class ReferencePolicy : public ResourceObj { +class ReferencePolicy : public CHeapObj { public: virtual bool should_clear_reference(oop p) { ShouldNotReachHere(); return true; } + // Capture state (of-the-VM) information needed to evaluate the policy + virtual void snap() { /* do nothing */ } }; class NeverClearPolicy : public ReferencePolicy { @@ -48,6 +50,8 @@ class LRUCurrentHeapPolicy : public ReferencePolicy { public: LRUCurrentHeapPolicy(); + // Capture state (of-the-VM) information needed to evaluate the policy + void snap(); bool should_clear_reference(oop p); }; @@ -58,5 +62,7 @@ class LRUMaxHeapPolicy : public ReferencePolicy { public: LRUMaxHeapPolicy(); + // Capture state (of-the-VM) information needed to evaluate the policy + void snap(); bool should_clear_reference(oop p); }; diff --git a/hotspot/src/share/vm/memory/referenceProcessor.cpp b/hotspot/src/share/vm/memory/referenceProcessor.cpp index 98da052b35b..648fbbd4736 100644 --- a/hotspot/src/share/vm/memory/referenceProcessor.cpp +++ b/hotspot/src/share/vm/memory/referenceProcessor.cpp @@ -25,6 +25,11 @@ # include "incls/_precompiled.incl" # include "incls/_referenceProcessor.cpp.incl" +ReferencePolicy* ReferenceProcessor::_always_clear_soft_ref_policy = NULL; +ReferencePolicy* ReferenceProcessor::_default_soft_ref_policy = NULL; +oop ReferenceProcessor::_sentinelRef = NULL; +const int subclasses_of_ref = REF_PHANTOM - REF_OTHER; + // List of discovered references. class DiscoveredList { public: @@ -58,10 +63,6 @@ private: size_t _len; }; -oop ReferenceProcessor::_sentinelRef = NULL; - -const int subclasses_of_ref = REF_PHANTOM - REF_OTHER; - void referenceProcessor_init() { ReferenceProcessor::init_statics(); } @@ -82,6 +83,12 @@ void ReferenceProcessor::init_statics() { } assert(_sentinelRef != NULL && _sentinelRef->is_oop(), "Just constructed it!"); + _always_clear_soft_ref_policy = new AlwaysClearPolicy(); + _default_soft_ref_policy = new COMPILER2_PRESENT(LRUMaxHeapPolicy()) + NOT_COMPILER2(LRUCurrentHeapPolicy()); + if (_always_clear_soft_ref_policy == NULL || _default_soft_ref_policy == NULL) { + vm_exit_during_initialization("Could not allocate reference policy object"); + } guarantee(RefDiscoveryPolicy == ReferenceBasedDiscovery || RefDiscoveryPolicy == ReferentBasedDiscovery, "Unrecongnized RefDiscoveryPolicy"); @@ -108,6 +115,7 @@ ReferenceProcessor::create_ref_processor(MemRegion span, vm_exit_during_initialization("Could not allocate ReferenceProcessor object"); } rp->set_is_alive_non_header(is_alive_non_header); + rp->snap_policy(false /* default soft ref policy */); return rp; } @@ -194,7 +202,6 @@ void ReferenceProcessor::update_soft_ref_master_clock() { } void ReferenceProcessor::process_discovered_references( - ReferencePolicy* policy, BoolObjectClosure* is_alive, OopClosure* keep_alive, VoidClosure* complete_gc, @@ -209,7 +216,7 @@ void ReferenceProcessor::process_discovered_references( // Soft references { TraceTime tt("SoftReference", trace_time, false, gclog_or_tty); - process_discovered_reflist(_discoveredSoftRefs, policy, true, + process_discovered_reflist(_discoveredSoftRefs, _current_soft_ref_policy, true, is_alive, keep_alive, complete_gc, task_executor); } @@ -1092,15 +1099,28 @@ bool ReferenceProcessor::discover_reference(oop obj, ReferenceType rt) { // reachable. if (is_alive_non_header() != NULL) { oop referent = java_lang_ref_Reference::referent(obj); - // We'd like to assert the following: - // assert(referent != NULL, "Refs with null referents already filtered"); - // However, since this code may be executed concurrently with - // mutators, which can clear() the referent, it is not - // guaranteed that the referent is non-NULL. + // In the case of non-concurrent discovery, the last + // disjunct below should hold. It may not hold in the + // case of concurrent discovery because mutators may + // concurrently clear() a Reference. + assert(UseConcMarkSweepGC || UseG1GC || referent != NULL, + "Refs with null referents already filtered"); if (is_alive_non_header()->do_object_b(referent)) { return false; // referent is reachable } } + if (rt == REF_SOFT) { + // For soft refs we can decide now if these are not + // current candidates for clearing, in which case we + // can mark through them now, rather than delaying that + // to the reference-processing phase. Since all current + // time-stamp policies advance the soft-ref clock only + // at a major collection cycle, this is always currently + // accurate. + if (!_current_soft_ref_policy->should_clear_reference(obj)) { + return false; + } + } HeapWord* const discovered_addr = java_lang_ref_Reference::discovered_addr(obj); const oop discovered = java_lang_ref_Reference::discovered(obj); diff --git a/hotspot/src/share/vm/memory/referenceProcessor.hpp b/hotspot/src/share/vm/memory/referenceProcessor.hpp index c07c4e34388..d4ebec200fa 100644 --- a/hotspot/src/share/vm/memory/referenceProcessor.hpp +++ b/hotspot/src/share/vm/memory/referenceProcessor.hpp @@ -23,7 +23,7 @@ */ // ReferenceProcessor class encapsulates the per-"collector" processing -// of "weak" references for GC. The interface is useful for supporting +// of java.lang.Reference objects for GC. The interface is useful for supporting // a generational abstraction, in particular when there are multiple // generations that are being independently collected -- possibly // concurrently and/or incrementally. Note, however, that the @@ -75,6 +75,14 @@ class ReferenceProcessor : public CHeapObj { // all collectors but the CMS collector). BoolObjectClosure* _is_alive_non_header; + // Soft ref clearing policies + // . the default policy + static ReferencePolicy* _default_soft_ref_policy; + // . the "clear all" policy + static ReferencePolicy* _always_clear_soft_ref_policy; + // . the current policy below is either one of the above + ReferencePolicy* _current_soft_ref_policy; + // The discovered ref lists themselves // The MT'ness degree of the queues below @@ -90,6 +98,12 @@ class ReferenceProcessor : public CHeapObj { DiscoveredList* discovered_soft_refs() { return _discoveredSoftRefs; } static oop sentinel_ref() { return _sentinelRef; } static oop* adr_sentinel_ref() { return &_sentinelRef; } + ReferencePolicy* snap_policy(bool always_clear) { + _current_soft_ref_policy = always_clear ? + _always_clear_soft_ref_policy : _default_soft_ref_policy; + _current_soft_ref_policy->snap(); // snapshot the policy threshold + return _current_soft_ref_policy; + } public: // Process references with a certain reachability level. @@ -297,8 +311,7 @@ class ReferenceProcessor : public CHeapObj { bool discover_reference(oop obj, ReferenceType rt); // Process references found during GC (called by the garbage collector) - void process_discovered_references(ReferencePolicy* policy, - BoolObjectClosure* is_alive, + void process_discovered_references(BoolObjectClosure* is_alive, OopClosure* keep_alive, VoidClosure* complete_gc, AbstractRefProcTaskExecutor* task_executor); diff --git a/hotspot/src/share/vm/memory/universe.cpp b/hotspot/src/share/vm/memory/universe.cpp index 651e9668041..ffe583ecc16 100644 --- a/hotspot/src/share/vm/memory/universe.cpp +++ b/hotspot/src/share/vm/memory/universe.cpp @@ -96,7 +96,7 @@ bool Universe::_bootstrapping = false; bool Universe::_fully_initialized = false; size_t Universe::_heap_capacity_at_last_gc; -size_t Universe::_heap_used_at_last_gc; +size_t Universe::_heap_used_at_last_gc = 0; CollectedHeap* Universe::_collectedHeap = NULL; address Universe::_heap_base = NULL; diff --git a/hotspot/src/share/vm/utilities/macros.hpp b/hotspot/src/share/vm/utilities/macros.hpp index 770ac0b3876..20b2871c583 100644 --- a/hotspot/src/share/vm/utilities/macros.hpp +++ b/hotspot/src/share/vm/utilities/macros.hpp @@ -65,8 +65,10 @@ // COMPILER2 variant #ifdef COMPILER2 #define COMPILER2_PRESENT(code) code +#define NOT_COMPILER2(code) #else // COMPILER2 #define COMPILER2_PRESENT(code) +#define NOT_COMPILER2(code) code #endif // COMPILER2 From 50a5499c502548175b44bc81fd95c704fd89cd25 Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Fri, 21 Nov 2008 08:09:11 -0800 Subject: [PATCH 149/267] 6676175: BigApps crash JVM Client VM (build 10.0-b22, mixed mode, sharing) with SIGSEGV (0xb) Add test for biased locking epoch before walking own thread stack in case of rare race Reviewed-by: phh, never --- hotspot/src/share/vm/runtime/biasedLocking.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hotspot/src/share/vm/runtime/biasedLocking.cpp b/hotspot/src/share/vm/runtime/biasedLocking.cpp index a16a96dfdb6..21d2ea7da87 100644 --- a/hotspot/src/share/vm/runtime/biasedLocking.cpp +++ b/hotspot/src/share/vm/runtime/biasedLocking.cpp @@ -582,13 +582,19 @@ BiasedLocking::Condition BiasedLocking::revoke_and_rebias(Handle obj, bool attem if (heuristics == HR_NOT_BIASED) { return NOT_BIASED; } else if (heuristics == HR_SINGLE_REVOKE) { - if (mark->biased_locker() == THREAD) { + Klass *k = Klass::cast(obj->klass()); + markOop prototype_header = k->prototype_header(); + if (mark->biased_locker() == THREAD && + prototype_header->bias_epoch() == mark->bias_epoch()) { // A thread is trying to revoke the bias of an object biased // toward it, again likely due to an identity hash code // computation. We can again avoid a safepoint in this case // since we are only going to walk our own stack. There are no // races with revocations occurring in other threads because we // reach no safepoints in the revocation path. + // Also check the epoch because even if threads match, another thread + // can come in with a CAS to steal the bias of an object that has a + // stale epoch. ResourceMark rm; if (TraceBiasedLocking) { tty->print_cr("Revoking bias by walking my own stack:"); From 9f61f3723c508dc647dc114b54d950fe279cd9c3 Mon Sep 17 00:00:00 2001 From: Daniel Fuchs Date: Fri, 21 Nov 2008 18:18:00 +0100 Subject: [PATCH 150/267] 6774170: LocalRMIServerSocketFactory should protect against ServerSocket.accept().getInetAddress() being null Reviewed-by: emcmanus, jfdenise --- .../LocalRMIServerSocketFactory.java | 33 +++- .../LocalRMIServerSocketFactoryTest.java | 145 ++++++++++++++++++ 2 files changed, 172 insertions(+), 6 deletions(-) create mode 100644 jdk/test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java diff --git a/jdk/src/share/classes/sun/management/jmxremote/LocalRMIServerSocketFactory.java b/jdk/src/share/classes/sun/management/jmxremote/LocalRMIServerSocketFactory.java index edb15539b23..0a239201ee7 100644 --- a/jdk/src/share/classes/sun/management/jmxremote/LocalRMIServerSocketFactory.java +++ b/jdk/src/share/classes/sun/management/jmxremote/LocalRMIServerSocketFactory.java @@ -49,13 +49,34 @@ public final class LocalRMIServerSocketFactory implements RMIServerSocketFactory return new ServerSocket(port) { @Override public Socket accept() throws IOException { - Socket socket = super.accept(); - InetAddress remoteAddr = socket.getInetAddress(); + final Socket socket = super.accept(); + final InetAddress remoteAddr = socket.getInetAddress(); final String msg = "The server sockets created using the " + - "LocalRMIServerSocketFactory only accept connections " + - "from clients running on the host where the RMI " + - "remote objects have been exported."; - if (remoteAddr.isAnyLocalAddress()) { + "LocalRMIServerSocketFactory only accept connections " + + "from clients running on the host where the RMI " + + "remote objects have been exported."; + + if (remoteAddr == null) { + // Though unlikeky, the socket could be already + // closed... Send a more detailed message in + // this case. Also avoid throwing NullPointerExceptiion + // + String details = ""; + if (socket.isClosed()) { + details = " Socket is closed."; + } else if (!socket.isConnected()) { + details = " Socket is not connected"; + } + try { + socket.close(); + } catch (Exception ok) { + // ok - this is just cleanup before throwing detailed + // exception. + } + throw new IOException(msg + + " Couldn't determine client address." + + details); + } else if (remoteAddr.isLoopbackAddress()) { // local address: accept the connection. return socket; } diff --git a/jdk/test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java b/jdk/test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java new file mode 100644 index 00000000000..614c68fb14e --- /dev/null +++ b/jdk/test/sun/management/jmxremote/LocalRMIServerSocketFactoryTest.java @@ -0,0 +1,145 @@ +/* + * 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. + * + * 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 LocalRMIServerSocketFactoryTest.java + * @bug 6774170 + * @summary Connect to a server socket returned by the LocalRMIServerSocketFactory. + * + * @author Daniel Fuchs + * + * @run compile -XDignore.symbol.file=true -source 1.6 -g LocalRMIServerSocketFactoryTest.java + * @run main LocalRMIServerSocketFactoryTest + */ + +import sun.management.jmxremote.LocalRMIServerSocketFactory; +import java.io.IOException; +import java.net.InetAddress; +import java.net.NetworkInterface; +import java.net.ServerSocket; +import java.net.Socket; +import java.util.concurrent.SynchronousQueue; + +public class LocalRMIServerSocketFactoryTest { + + private static final SynchronousQueue queue = + new SynchronousQueue(); + + static final class Result extends Exception { + + private Result() { + super("SUCCESS: No exception was thrown"); + } + static final Result SUCCESS = new Result(); + } + + private static void checkError(String message) throws Exception { + + // Wait for the server to set the error field. + final Exception x = queue.take(); + + if (x == Result.SUCCESS) { + return; + } + + + // case of 6674166: this is very unlikely to happen, even if + // both 6674166 and 6774170 aren't fixed. If it happens + // however, it might indicate that neither defects are fixed. + + if (x instanceof NullPointerException) { + throw new Exception(message + " - " + + "Congratulations! it seems you have triggered 6674166. " + + "Neither 6674166 nor 6774170 seem to be fixed: " + x, x); + } else if (x instanceof IOException) { + throw new Exception(message + " - " + + "Unexpected IOException. Maybe you triggered 6674166? " + + x, x); + } else if (x != null) { + throw new Exception(message + " - " + + "Ouch, that's bad. " + + "This is a new kind of unexpected exception " + + x, x); + } + } + + public static void main(String[] args) throws Exception { + final LocalRMIServerSocketFactory f = + new LocalRMIServerSocketFactory(); + final ServerSocket s = f.createServerSocket(0); + final int port = s.getLocalPort(); + Thread t = new Thread() { + + public void run() { + while (true) { + Exception error = Result.SUCCESS; + try { + System.err.println("Accepting: "); + final Socket ss = s.accept(); + System.err.println(ss.getInetAddress() + " accepted"); + } catch (Exception x) { + x.printStackTrace(); + error = x; + } finally { + try { + // wait for the client to get the exception. + queue.put(error); + } catch (Exception x) { + // too bad! + System.err.println("Could't send result to client!"); + x.printStackTrace(); + return; + } + } + } + } + }; + t.setDaemon(true); + t.start(); + + System.err.println("new Socket((String)null, port)"); + final Socket s1 = new Socket((String) null, port); + checkError("new Socket((String)null, port)"); + s1.close(); + System.err.println("new Socket((String)null, port): PASSED"); + + System.err.println("new Socket(InetAddress.getByName(null), port)"); + final Socket s2 = new Socket(InetAddress.getByName(null), port); + checkError("new Socket(InetAddress.getByName(null), port)"); + s2.close(); + System.err.println("new Socket(InetAddress.getByName(null), port): PASSED"); + + System.err.println("new Socket(localhost, port)"); + final Socket s3 = new Socket("localhost", port); + checkError("new Socket(localhost, port)"); + s3.close(); + System.err.println("new Socket(localhost, port): PASSED"); + + System.err.println("new Socket(127.0.0.1, port)"); + final Socket s4 = new Socket("127.0.0.1", port); + checkError("new Socket(127.0.0.1, port)"); + s4.close(); + System.err.println("new Socket(127.0.0.1, port): PASSED"); + + } +} From de0532a7ec5daabb9913e295e020bacf3a731be5 Mon Sep 17 00:00:00 2001 From: Erik Trimble Date: Fri, 21 Nov 2008 16:11:18 -0800 Subject: [PATCH 151/267] 6775176: Bump HS14 build number to 08 Update the Hotspot build number to 08 Reviewed-by: jcoomes --- hotspot/make/hotspot_version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hotspot/make/hotspot_version b/hotspot/make/hotspot_version index 9673d78aba6..fe716dd3731 100644 --- a/hotspot/make/hotspot_version +++ b/hotspot/make/hotspot_version @@ -35,7 +35,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2008 HS_MAJOR_VER=14 HS_MINOR_VER=0 -HS_BUILD_NUMBER=07 +HS_BUILD_NUMBER=08 JDK_MAJOR_VER=1 JDK_MINOR_VER=7 From 85138023c105e8a10c02fabfb9d770813f61fd0d Mon Sep 17 00:00:00 2001 From: Xiaobin Lu Date: Sat, 22 Nov 2008 00:16:09 -0800 Subject: [PATCH 152/267] 6554406: Change switch UseVMInterruptibleIO default to false (sol) The default value of UseVMInterruptibleIO is changed to false for JDK 7, but the default isn't changed for JDK 6 and earlier. Reviewed-by: never, acorn, dholmes, kamg, alanb --- hotspot/src/share/vm/runtime/arguments.cpp | 7 ++++++- hotspot/src/share/vm/runtime/globals.hpp | 5 +++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp index fa2ba23383b..831218796cf 100644 --- a/hotspot/src/share/vm/runtime/arguments.cpp +++ b/hotspot/src/share/vm/runtime/arguments.cpp @@ -2322,7 +2322,12 @@ SOLARIS_ONLY( return JNI_ERR; } } - + // Change the default value for flags which have different default values + // when working with older JDKs. + if (JDK_Version::current().compare_major(6) <= 0 && + FLAG_IS_DEFAULT(UseVMInterruptibleIO)) { + FLAG_SET_DEFAULT(UseVMInterruptibleIO, true); + } return JNI_OK; } diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index a2476f9c707..85689054e3c 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -3262,9 +3262,10 @@ class CommandLineFlags { diagnostic(bool, PrintDTraceDOF, false, \ "Print the DTrace DOF passed to the system for JSDT probes") \ \ - product(bool, UseVMInterruptibleIO, true, \ + product(bool, UseVMInterruptibleIO, false, \ "(Unstable, Solaris-specific) Thread interrupt before or with " \ - "EINTR for I/O operations results in OS_INTRPT") + "EINTR for I/O operations results in OS_INTRPT. The default value"\ + " of this flag is true for JDK 6 and earliers") /* From 8dc49502e35d2d25873ebbb8e48d81ce8aa23980 Mon Sep 17 00:00:00 2001 From: Martin Buchholz Date: Sun, 23 Nov 2008 09:56:39 -0800 Subject: [PATCH 153/267] 6775152: freetype version check program problem main arg order Fix all compiler warnings Reviewed-by: ohair, tbell --- jdk/make/common/shared/Sanity.gmk | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/jdk/make/common/shared/Sanity.gmk b/jdk/make/common/shared/Sanity.gmk index b2cbab12b3f..d0ced74ee33 100644 --- a/jdk/make/common/shared/Sanity.gmk +++ b/jdk/make/common/shared/Sanity.gmk @@ -1350,10 +1350,11 @@ $(ALSA_VERSION_CHECK): $(ALSA_VERSION_CHECK).c $(ALSA_VERSION_CHECK).c: @$(prep-target) @$(ECHO) "#include \n" \ - "int main(char** argv, int argc) {\n" \ - " printf(\"%s\", SND_LIB_VERSION_STR);\n" \ - " return 0;\n" \ - "}\n" \ + "#include \n" \ + "int main(int argc, char** argv) {\n" \ + " printf(\"%s\", SND_LIB_VERSION_STR);\n" \ + " return 0;\n" \ + "}\n" \ > $@ endif From 6c53645a84570eceb23b64ca69ff1b4a35c42c7c Mon Sep 17 00:00:00 2001 From: "Y. Srinivas Ramakrishna" Date: Mon, 24 Nov 2008 09:53:31 -0800 Subject: [PATCH 154/267] 6774607: SIGSEGV or (!is_null(v),"oop value can never be zero") assertion when running with CMS and COOPs Use the more permissive set_klass_or_null() and klass_or_null() interfaces in ParNew's workqueue overflow code that manipulates the klass-word. Reviewed-by: coleenp --- .../src/share/vm/gc_implementation/parNew/parNewGeneration.cpp | 2 +- hotspot/src/share/vm/oops/oop.inline.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp index aca77d20634..0c0196f253d 100644 --- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp +++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp @@ -1205,7 +1205,7 @@ ParNewGeneration::take_from_overflow_list(ParScanThreadState* par_scan_state) { int n = 0; while (cur != NULL) { oop obj_to_push = cur->forwardee(); - oop next = oop(cur->klass()); + oop next = oop(cur->klass_or_null()); cur->set_klass(obj_to_push->klass()); if (par_scan_state->should_be_partially_scanned(obj_to_push, cur)) { obj_to_push = cur; diff --git a/hotspot/src/share/vm/oops/oop.inline.hpp b/hotspot/src/share/vm/oops/oop.inline.hpp index 722a0393003..0c7a3967f48 100644 --- a/hotspot/src/share/vm/oops/oop.inline.hpp +++ b/hotspot/src/share/vm/oops/oop.inline.hpp @@ -92,7 +92,7 @@ inline void oopDesc::set_klass_to_list_ptr(oop k) { // This is only to be used during GC, for from-space objects, so no // barrier is needed. if (UseCompressedOops) { - _metadata._compressed_klass = encode_heap_oop_not_null(k); + _metadata._compressed_klass = encode_heap_oop(k); // may be null (parnew overflow handling) } else { _metadata._klass = (klassOop)k; } From f58e193de06655fb6e31942d8ea1e7a340c75ec1 Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Mon, 24 Nov 2008 14:45:47 -0500 Subject: [PATCH 155/267] 6474243: suspicious jvmti code that uses oop unsafely across GC point Oop stored in unsafely in Lscratch noticed by visual inspection will not be updated by GC. Reviewed-by: kamg, never, kvn --- hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp index 73de2de94f3..6ba85859c2b 100644 --- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp +++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp @@ -2085,7 +2085,7 @@ void TemplateTable::jvmti_post_field_access(Register Rcache, } else { if (has_tos) { // save object pointer before call_VM() clobbers it - __ mov(Otos_i, Lscratch); + __ push_ptr(Otos_i); // put object on tos where GC wants it. } else { // Load top of stack (do not pop the value off the stack); __ ld_ptr(Lesp, Interpreter::expr_offset_in_bytes(0), Otos_i); @@ -2097,7 +2097,7 @@ void TemplateTable::jvmti_post_field_access(Register Rcache, __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::post_field_access), Otos_i, Rcache); if (!is_static && has_tos) { - __ mov(Lscratch, Otos_i); // restore object pointer + __ pop_ptr(Otos_i); // restore object pointer __ verify_oop(Otos_i); } __ get_cache_and_index_at_bcp(Rcache, index, 1); From 93225a0b6085c1ead59207a58e446cc89d1685ee Mon Sep 17 00:00:00 2001 From: Sean Mullan Date: Tue, 25 Nov 2008 10:17:00 -0500 Subject: [PATCH 156/267] 6728890: Add SwissSign root certificates to the JDK 6732157: Add VeriSign TSA Root Cert to the JDK 6754779: Add Camerfirma root certificates to the JDK 6768559: Add t-systems root CA certificate (Deutsche Telekom Root CA 2) to the JRE Reviewed-by: vinnie --- .../lib/security/cacerts/VerifyCACerts.java | 94 +++++++++++++++++-- 1 file changed, 86 insertions(+), 8 deletions(-) diff --git a/jdk/test/lib/security/cacerts/VerifyCACerts.java b/jdk/test/lib/security/cacerts/VerifyCACerts.java index 774908cca54..a5559a0e755 100644 --- a/jdk/test/lib/security/cacerts/VerifyCACerts.java +++ b/jdk/test/lib/security/cacerts/VerifyCACerts.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2002-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 @@ -23,11 +23,12 @@ /** * @test - * @bug 4400624 6321453 + * @bug 4400624 6321453 6728890 6732157 6754779 6768559 * @summary Make sure all self-signed root cert signatures are valid */ import java.io.FileInputStream; import java.security.KeyStore; +import java.security.MessageDigest; import java.security.cert.*; import java.util.*; @@ -39,25 +40,102 @@ public class VerifyCACerts { System.getProperty("file.separator") + "security" + System.getProperty("file.separator") + "cacerts"; - public static void main(String[] args) throws Exception { + private static boolean atLeastOneFailed = false; - // pull all the trusted self-signed CA certs out of the cacerts file - // and verify their signatures + private static MessageDigest md; + + // map of cert alias to SHA1 fingerprint + private static Map fpMap = new HashMap(); + + private static String[][] entries = { + { "swisssignsilverg2ca", "9B:AA:E5:9F:56:EE:21:CB:43:5A:BE:25:93:DF:A7:F0:40:D1:1D:CB"}, + { "swisssigngoldg2ca", "D8:C5:38:8A:B7:30:1B:1B:6E:D4:7A:E6:45:25:3A:6F:9F:1A:27:61"}, + { "swisssignplatinumg2ca", "56:E0:FA:C0:3B:8F:18:23:55:18:E5:D3:11:CA:E8:C2:43:31:AB:66"}, + { "verisigntsaca", "BE:36:A4:56:2F:B2:EE:05:DB:B3:D3:23:23:AD:F4:45:08:4E:D6:56"}, + { "camerfirmachambersignca", "4A:BD:EE:EC:95:0D:35:9C:89:AE:C7:52:A1:2C:5B:29:F6:D6:AA:0C"}, + { "camerfirmachambersca", "78:6A:74:AC:76:AB:14:7F:9C:6A:30:50:BA:9E:A8:7E:FE:9A:CE:3C"}, + { "camerfirmachamberscommerceca", "6E:3A:55:A4:19:0C:19:5C:93:84:3C:C0:DB:72:2E:31:30:61:F0:B1"}, + { "deutschetelekomrootca2", "85:A4:08:C0:9C:19:3E:5D:51:58:7D:CD:D6:13:30:FD:8C:DE:37:BF"}, + }; + + static { + for (String[] entry : entries) { + fpMap.put(entry[0], entry[1]); + } + }; + + public static void main(String[] args) throws Exception { + md = MessageDigest.getInstance("SHA1"); KeyStore ks = KeyStore.getInstance("JKS"); ks.load(new FileInputStream(cacertsFileName), "changeit".toCharArray()); + + // check that all entries in the map are in the keystore + for (String alias : fpMap.keySet()) { + if (!ks.isCertificateEntry(alias)) { + atLeastOneFailed = true; + System.err.println(alias + " is not in cacerts"); + } + } + // pull all the trusted self-signed CA certs out of the cacerts file + // and verify their signatures Enumeration aliases = ks.aliases(); while (aliases.hasMoreElements()) { String alias = aliases.nextElement(); System.out.println("Verifying " + alias); - if (!ks.isCertificateEntry(alias)) - throw new Exception(alias + " is not a trusted cert entry"); + if (!ks.isCertificateEntry(alias)) { + atLeastOneFailed = true; + System.err.println(alias + " is not a trusted cert entry"); + } Certificate cert = ks.getCertificate(alias); // remember the GTE CyberTrust CA cert for further tests if (alias.equals("gtecybertrustca")) { - throw new Exception + atLeastOneFailed = true; + System.err.println ("gtecybertrustca is expired and should be deleted"); } cert.verify(cert.getPublicKey()); + if (!checkFingerprint(alias, cert)) { + atLeastOneFailed = true; + System.err.println + (alias + " SHA1 fingerprint is incorrect"); + } + } + + if (atLeastOneFailed) { + throw new Exception("At least one cacert test failed"); } } + + private static boolean checkFingerprint(String alias, Certificate cert) + throws Exception { + String fingerprint = fpMap.get(alias); + if (fingerprint == null) { + // no entry for alias + return true; + } + System.out.println("Checking fingerprint of " + alias); + byte[] digest = md.digest(cert.getEncoded()); + return fingerprint.equals(toHexString(digest)); + } + + private static String toHexString(byte[] block) { + StringBuffer buf = new StringBuffer(); + int len = block.length; + for (int i = 0; i < len; i++) { + byte2hex(block[i], buf); + if (i < len-1) { + buf.append(":"); + } + } + return buf.toString(); + } + + private static void byte2hex(byte b, StringBuffer buf) { + char[] hexChars = { '0', '1', '2', '3', '4', '5', '6', '7', '8', + '9', 'A', 'B', 'C', 'D', 'E', 'F' }; + int high = ((b & 0xf0) >> 4); + int low = (b & 0x0f); + buf.append(hexChars[high]); + buf.append(hexChars[low]); + } } From b9638d0527ff0f66cd0f209e1f5da1e3ae6b779c Mon Sep 17 00:00:00 2001 From: Xueming Shen Date: Tue, 25 Nov 2008 10:09:26 -0800 Subject: [PATCH 157/267] 6774710: spp.sh used by genBasic.sh/genCopyDirectMemory.sh Update the scripts to use java version of spp Reviewed-by: alanb --- jdk/test/java/nio/Buffer/genBasic.sh | 6 ++++-- jdk/test/java/nio/Buffer/genCopyDirectMemory.sh | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/jdk/test/java/nio/Buffer/genBasic.sh b/jdk/test/java/nio/Buffer/genBasic.sh index b0455670597..4696f05a244 100644 --- a/jdk/test/java/nio/Buffer/genBasic.sh +++ b/jdk/test/java/nio/Buffer/genBasic.sh @@ -23,10 +23,10 @@ # have any questions. # -SPP='sh ../../../../make/java/nio/spp.sh' +javac -d . ../../../../make/tools/src/build/tools/spp/Spp.java > Spp.java gen() { - $SPP -K$1 -Dtype=$1 -DType=$2 -DFulltype=$3 Basic$2.java + java build.tools.spp.Spp -K$1 -Dtype=$1 -DType=$2 -DFulltype=$3 Basic$2.java } gen byte Byte Byte @@ -36,3 +36,5 @@ gen int Int Integer gen long Long Long gen float Float Float gen double Double Double + +rm -rf build diff --git a/jdk/test/java/nio/Buffer/genCopyDirectMemory.sh b/jdk/test/java/nio/Buffer/genCopyDirectMemory.sh index 588a1790c8b..8bdc8409552 100644 --- a/jdk/test/java/nio/Buffer/genCopyDirectMemory.sh +++ b/jdk/test/java/nio/Buffer/genCopyDirectMemory.sh @@ -23,10 +23,10 @@ # have any questions. # -SPP='sh ../../../../make/java/nio/spp.sh' +javac -d . ../../../../make/tools/src/build/tools/spp/Spp.java > Spp.java gen() { - $SPP -K$1 -Dtype=$1 -DType=$2 -DFulltype=$3CopyDirect$2Memory.java + java build.tools.spp.Spp -K$1 -Dtype=$1 -DType=$2 -DFulltype=$3CopyDirect$2Memory.java } gen byte Byte Byte @@ -37,3 +37,4 @@ gen long Long Long gen float Float Float gen double Double Double +rm -rf build From efd62d5c812764a9d390a9a528cc1de8f3fb1293 Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Tue, 25 Nov 2008 19:26:54 +0000 Subject: [PATCH 158/267] 6593946: (bf) X-Buffer.compact() does not discard mark as specified InvalidMarkException now correctly thrown. Thanks to keiths@redhat.com for the bug report and initial fix. Reviewed-by: sherman, darcy --- jdk/src/share/classes/java/nio/Buffer.java | 4 ++ .../java/nio/ByteBufferAs-X-Buffer.java | 1 + .../classes/java/nio/Direct-X-Buffer.java | 1 + .../share/classes/java/nio/Heap-X-Buffer.java | 1 + jdk/test/java/nio/Buffer/Basic-X.java | 42 +++++++++++++++++-- jdk/test/java/nio/Buffer/Basic.java | 2 +- jdk/test/java/nio/Buffer/BasicByte.java | 42 +++++++++++++++++-- jdk/test/java/nio/Buffer/BasicChar.java | 40 +++++++++++++++++- jdk/test/java/nio/Buffer/BasicDouble.java | 40 +++++++++++++++++- jdk/test/java/nio/Buffer/BasicFloat.java | 40 +++++++++++++++++- jdk/test/java/nio/Buffer/BasicInt.java | 40 +++++++++++++++++- jdk/test/java/nio/Buffer/BasicLong.java | 40 +++++++++++++++++- jdk/test/java/nio/Buffer/BasicShort.java | 40 +++++++++++++++++- jdk/test/java/nio/Buffer/genBasic.sh | 2 +- 14 files changed, 315 insertions(+), 20 deletions(-) diff --git a/jdk/src/share/classes/java/nio/Buffer.java b/jdk/src/share/classes/java/nio/Buffer.java index 3804057974f..923f9d75c5c 100644 --- a/jdk/src/share/classes/java/nio/Buffer.java +++ b/jdk/src/share/classes/java/nio/Buffer.java @@ -543,6 +543,10 @@ public abstract class Buffer { return mark; } + final void discardMark() { // package-private + mark = -1; + } + static void checkBounds(int off, int len, int size) { // package-private if ((off | len | (off + len) | (size - (off + len))) < 0) throw new IndexOutOfBoundsException(); diff --git a/jdk/src/share/classes/java/nio/ByteBufferAs-X-Buffer.java b/jdk/src/share/classes/java/nio/ByteBufferAs-X-Buffer.java index 54deb4c8f3e..15626425a0e 100644 --- a/jdk/src/share/classes/java/nio/ByteBufferAs-X-Buffer.java +++ b/jdk/src/share/classes/java/nio/ByteBufferAs-X-Buffer.java @@ -150,6 +150,7 @@ class ByteBufferAs$Type$Buffer$RW$$BO$ // package-private sb.compact(); position(rem); limit(capacity()); + discardMark(); return this; #else[rw] throw new ReadOnlyBufferException(); diff --git a/jdk/src/share/classes/java/nio/Direct-X-Buffer.java b/jdk/src/share/classes/java/nio/Direct-X-Buffer.java index 26b31956a31..5f738b7811e 100644 --- a/jdk/src/share/classes/java/nio/Direct-X-Buffer.java +++ b/jdk/src/share/classes/java/nio/Direct-X-Buffer.java @@ -365,6 +365,7 @@ class Direct$Type$Buffer$RW$$BO$ unsafe.copyMemory(ix(pos), ix(0), rem << $LG_BYTES_PER_VALUE$); position(rem); limit(capacity()); + discardMark(); return this; #else[rw] throw new ReadOnlyBufferException(); diff --git a/jdk/src/share/classes/java/nio/Heap-X-Buffer.java b/jdk/src/share/classes/java/nio/Heap-X-Buffer.java index 28f1ca8abe1..b615ba3c633 100644 --- a/jdk/src/share/classes/java/nio/Heap-X-Buffer.java +++ b/jdk/src/share/classes/java/nio/Heap-X-Buffer.java @@ -222,6 +222,7 @@ class Heap$Type$Buffer$RW$ System.arraycopy(hb, ix(position()), hb, ix(0), remaining()); position(remaining()); limit(capacity()); + discardMark(); return this; #else[rw] throw new ReadOnlyBufferException(); diff --git a/jdk/test/java/nio/Buffer/Basic-X.java b/jdk/test/java/nio/Buffer/Basic-X.java index a28793ce208..7a5957092f8 100644 --- a/jdk/test/java/nio/Buffer/Basic-X.java +++ b/jdk/test/java/nio/Buffer/Basic-X.java @@ -31,6 +31,7 @@ #warn This file is preprocessed before being compiled import java.nio.*; +import java.lang.reflect.Method; public class Basic$Type$ @@ -184,32 +185,57 @@ public class Basic$Type$ b.position(p); } + private static void compact(Buffer b) { + try { + Class cl = b.getClass(); + Method m = cl.getDeclaredMethod("compact"); + m.setAccessible(true); + m.invoke(b); + } catch (Exception e) { + fail(e.getMessage(), b); + } + } + + private static void checkInvalidMarkException(final Buffer b) { + tryCatch(b, InvalidMarkException.class, new Runnable() { + public void run() { + b.mark(); + compact(b); + b.reset(); + }}); + } + private static void testViews(int level, ByteBuffer b, boolean direct) { ShortBuffer sb = b.asShortBuffer(); BasicShort.test(level, sb, direct); checkBytes(b, new byte[] { 0, (byte)ic(0) }); + checkInvalidMarkException(sb); CharBuffer cb = b.asCharBuffer(); BasicChar.test(level, cb, direct); checkBytes(b, new byte[] { 0, (byte)ic(0) }); + checkInvalidMarkException(cb); IntBuffer ib = b.asIntBuffer(); BasicInt.test(level, ib, direct); checkBytes(b, new byte[] { 0, 0, 0, (byte)ic(0) }); + checkInvalidMarkException(ib); LongBuffer lb = b.asLongBuffer(); BasicLong.test(level, lb, direct); checkBytes(b, new byte[] { 0, 0, 0, 0, 0, 0, 0, (byte)ic(0) }); + checkInvalidMarkException(lb); FloatBuffer fb = b.asFloatBuffer(); BasicFloat.test(level, fb, direct); checkBytes(b, new byte[] { 0x42, (byte)0xc2, 0, 0 }); + checkInvalidMarkException(fb); DoubleBuffer db = b.asDoubleBuffer(); BasicDouble.test(level, db, direct); checkBytes(b, new byte[] { 0x40, 0x58, 0x40, 0, 0, 0, 0, 0 }); - + checkInvalidMarkException(db); } private static void testHet(int level, ByteBuffer b) { @@ -288,8 +314,11 @@ public class Basic$Type$ try { thunk.run(); } catch (Throwable x) { - if (ex.isAssignableFrom(x.getClass())) + if (ex.isAssignableFrom(x.getClass())) { caught = true; + } else { + fail(x.getMessage() + " not expected"); + } } if (!caught) fail(ex.getName() + " not thrown", b); @@ -356,7 +385,6 @@ public class Basic$Type$ // Exceptions - boolean caught = false; relPut(b); b.limit(b.capacity() / 2); b.position(b.limit()); @@ -386,6 +414,14 @@ public class Basic$Type$ b.put(b.limit(), ($type$)42); }}); + tryCatch(b, InvalidMarkException.class, new Runnable() { + public void run() { + b.position(0); + b.mark(); + b.compact(); + b.reset(); + }}); + // Values b.clear(); diff --git a/jdk/test/java/nio/Buffer/Basic.java b/jdk/test/java/nio/Buffer/Basic.java index 0716a5b8229..2b37048ff97 100644 --- a/jdk/test/java/nio/Buffer/Basic.java +++ b/jdk/test/java/nio/Buffer/Basic.java @@ -25,7 +25,7 @@ * @summary Unit test for buffers * @bug 4413135 4414911 4416536 4416562 4418782 4471053 4472779 4490253 4523725 * 4526177 4463011 4660660 4661219 4663521 4782970 4804304 4938424 6231529 - * 6221101 6234263 6535542 6591971 + * 6221101 6234263 6535542 6591971 6593946 * @author Mark Reinhold */ diff --git a/jdk/test/java/nio/Buffer/BasicByte.java b/jdk/test/java/nio/Buffer/BasicByte.java index 539af2c62d0..37da213b7f9 100644 --- a/jdk/test/java/nio/Buffer/BasicByte.java +++ b/jdk/test/java/nio/Buffer/BasicByte.java @@ -31,6 +31,7 @@ // -- This file was mechanically generated: Do not edit! -- // import java.nio.*; +import java.lang.reflect.Method; public class BasicByte @@ -184,32 +185,57 @@ public class BasicByte b.position(p); } + private static void compact(Buffer b) { + try { + Class cl = b.getClass(); + Method m = cl.getDeclaredMethod("compact"); + m.setAccessible(true); + m.invoke(b); + } catch (Exception e) { + fail(e.getMessage(), b); + } + } + + private static void checkInvalidMarkException(final Buffer b) { + tryCatch(b, InvalidMarkException.class, new Runnable() { + public void run() { + b.mark(); + compact(b); + b.reset(); + }}); + } + private static void testViews(int level, ByteBuffer b, boolean direct) { ShortBuffer sb = b.asShortBuffer(); BasicShort.test(level, sb, direct); checkBytes(b, new byte[] { 0, (byte)ic(0) }); + checkInvalidMarkException(sb); CharBuffer cb = b.asCharBuffer(); BasicChar.test(level, cb, direct); checkBytes(b, new byte[] { 0, (byte)ic(0) }); + checkInvalidMarkException(cb); IntBuffer ib = b.asIntBuffer(); BasicInt.test(level, ib, direct); checkBytes(b, new byte[] { 0, 0, 0, (byte)ic(0) }); + checkInvalidMarkException(ib); LongBuffer lb = b.asLongBuffer(); BasicLong.test(level, lb, direct); checkBytes(b, new byte[] { 0, 0, 0, 0, 0, 0, 0, (byte)ic(0) }); + checkInvalidMarkException(lb); FloatBuffer fb = b.asFloatBuffer(); BasicFloat.test(level, fb, direct); checkBytes(b, new byte[] { 0x42, (byte)0xc2, 0, 0 }); + checkInvalidMarkException(fb); DoubleBuffer db = b.asDoubleBuffer(); BasicDouble.test(level, db, direct); checkBytes(b, new byte[] { 0x40, 0x58, 0x40, 0, 0, 0, 0, 0 }); - + checkInvalidMarkException(db); } private static void testHet(int level, ByteBuffer b) { @@ -288,8 +314,11 @@ public class BasicByte try { thunk.run(); } catch (Throwable x) { - if (ex.isAssignableFrom(x.getClass())) + if (ex.isAssignableFrom(x.getClass())) { caught = true; + } else { + fail(x.getMessage() + " not expected"); + } } if (!caught) fail(ex.getName() + " not thrown", b); @@ -356,7 +385,6 @@ public class BasicByte // Exceptions - boolean caught = false; relPut(b); b.limit(b.capacity() / 2); b.position(b.limit()); @@ -386,6 +414,14 @@ public class BasicByte b.put(b.limit(), (byte)42); }}); + tryCatch(b, InvalidMarkException.class, new Runnable() { + public void run() { + b.position(0); + b.mark(); + b.compact(); + b.reset(); + }}); + // Values b.clear(); diff --git a/jdk/test/java/nio/Buffer/BasicChar.java b/jdk/test/java/nio/Buffer/BasicChar.java index 10111cc71a3..423a88cb776 100644 --- a/jdk/test/java/nio/Buffer/BasicChar.java +++ b/jdk/test/java/nio/Buffer/BasicChar.java @@ -31,6 +31,7 @@ // -- This file was mechanically generated: Do not edit! -- // import java.nio.*; +import java.lang.reflect.Method; public class BasicChar @@ -262,6 +263,31 @@ public class BasicChar + + + + + + + + + + + + + + + + + + + + + + + + + @@ -288,8 +314,11 @@ public class BasicChar try { thunk.run(); } catch (Throwable x) { - if (ex.isAssignableFrom(x.getClass())) + if (ex.isAssignableFrom(x.getClass())) { caught = true; + } else { + fail(x.getMessage() + " not expected"); + } } if (!caught) fail(ex.getName() + " not thrown", b); @@ -356,7 +385,6 @@ public class BasicChar // Exceptions - boolean caught = false; relPut(b); b.limit(b.capacity() / 2); b.position(b.limit()); @@ -386,6 +414,14 @@ public class BasicChar b.put(b.limit(), (char)42); }}); + tryCatch(b, InvalidMarkException.class, new Runnable() { + public void run() { + b.position(0); + b.mark(); + b.compact(); + b.reset(); + }}); + // Values b.clear(); diff --git a/jdk/test/java/nio/Buffer/BasicDouble.java b/jdk/test/java/nio/Buffer/BasicDouble.java index 3da239652fd..1aef0665f16 100644 --- a/jdk/test/java/nio/Buffer/BasicDouble.java +++ b/jdk/test/java/nio/Buffer/BasicDouble.java @@ -31,6 +31,7 @@ // -- This file was mechanically generated: Do not edit! -- // import java.nio.*; +import java.lang.reflect.Method; public class BasicDouble @@ -262,6 +263,31 @@ public class BasicDouble + + + + + + + + + + + + + + + + + + + + + + + + + @@ -288,8 +314,11 @@ public class BasicDouble try { thunk.run(); } catch (Throwable x) { - if (ex.isAssignableFrom(x.getClass())) + if (ex.isAssignableFrom(x.getClass())) { caught = true; + } else { + fail(x.getMessage() + " not expected"); + } } if (!caught) fail(ex.getName() + " not thrown", b); @@ -356,7 +385,6 @@ public class BasicDouble // Exceptions - boolean caught = false; relPut(b); b.limit(b.capacity() / 2); b.position(b.limit()); @@ -386,6 +414,14 @@ public class BasicDouble b.put(b.limit(), (double)42); }}); + tryCatch(b, InvalidMarkException.class, new Runnable() { + public void run() { + b.position(0); + b.mark(); + b.compact(); + b.reset(); + }}); + // Values b.clear(); diff --git a/jdk/test/java/nio/Buffer/BasicFloat.java b/jdk/test/java/nio/Buffer/BasicFloat.java index 9bd702bc1bf..1a902f6aea1 100644 --- a/jdk/test/java/nio/Buffer/BasicFloat.java +++ b/jdk/test/java/nio/Buffer/BasicFloat.java @@ -31,6 +31,7 @@ // -- This file was mechanically generated: Do not edit! -- // import java.nio.*; +import java.lang.reflect.Method; public class BasicFloat @@ -262,6 +263,31 @@ public class BasicFloat + + + + + + + + + + + + + + + + + + + + + + + + + @@ -288,8 +314,11 @@ public class BasicFloat try { thunk.run(); } catch (Throwable x) { - if (ex.isAssignableFrom(x.getClass())) + if (ex.isAssignableFrom(x.getClass())) { caught = true; + } else { + fail(x.getMessage() + " not expected"); + } } if (!caught) fail(ex.getName() + " not thrown", b); @@ -356,7 +385,6 @@ public class BasicFloat // Exceptions - boolean caught = false; relPut(b); b.limit(b.capacity() / 2); b.position(b.limit()); @@ -386,6 +414,14 @@ public class BasicFloat b.put(b.limit(), (float)42); }}); + tryCatch(b, InvalidMarkException.class, new Runnable() { + public void run() { + b.position(0); + b.mark(); + b.compact(); + b.reset(); + }}); + // Values b.clear(); diff --git a/jdk/test/java/nio/Buffer/BasicInt.java b/jdk/test/java/nio/Buffer/BasicInt.java index 4a5887131b2..d5e9e15550c 100644 --- a/jdk/test/java/nio/Buffer/BasicInt.java +++ b/jdk/test/java/nio/Buffer/BasicInt.java @@ -31,6 +31,7 @@ // -- This file was mechanically generated: Do not edit! -- // import java.nio.*; +import java.lang.reflect.Method; public class BasicInt @@ -262,6 +263,31 @@ public class BasicInt + + + + + + + + + + + + + + + + + + + + + + + + + @@ -288,8 +314,11 @@ public class BasicInt try { thunk.run(); } catch (Throwable x) { - if (ex.isAssignableFrom(x.getClass())) + if (ex.isAssignableFrom(x.getClass())) { caught = true; + } else { + fail(x.getMessage() + " not expected"); + } } if (!caught) fail(ex.getName() + " not thrown", b); @@ -356,7 +385,6 @@ public class BasicInt // Exceptions - boolean caught = false; relPut(b); b.limit(b.capacity() / 2); b.position(b.limit()); @@ -386,6 +414,14 @@ public class BasicInt b.put(b.limit(), (int)42); }}); + tryCatch(b, InvalidMarkException.class, new Runnable() { + public void run() { + b.position(0); + b.mark(); + b.compact(); + b.reset(); + }}); + // Values b.clear(); diff --git a/jdk/test/java/nio/Buffer/BasicLong.java b/jdk/test/java/nio/Buffer/BasicLong.java index 0ef145c8f40..660b3999545 100644 --- a/jdk/test/java/nio/Buffer/BasicLong.java +++ b/jdk/test/java/nio/Buffer/BasicLong.java @@ -31,6 +31,7 @@ // -- This file was mechanically generated: Do not edit! -- // import java.nio.*; +import java.lang.reflect.Method; public class BasicLong @@ -262,6 +263,31 @@ public class BasicLong + + + + + + + + + + + + + + + + + + + + + + + + + @@ -288,8 +314,11 @@ public class BasicLong try { thunk.run(); } catch (Throwable x) { - if (ex.isAssignableFrom(x.getClass())) + if (ex.isAssignableFrom(x.getClass())) { caught = true; + } else { + fail(x.getMessage() + " not expected"); + } } if (!caught) fail(ex.getName() + " not thrown", b); @@ -356,7 +385,6 @@ public class BasicLong // Exceptions - boolean caught = false; relPut(b); b.limit(b.capacity() / 2); b.position(b.limit()); @@ -386,6 +414,14 @@ public class BasicLong b.put(b.limit(), (long)42); }}); + tryCatch(b, InvalidMarkException.class, new Runnable() { + public void run() { + b.position(0); + b.mark(); + b.compact(); + b.reset(); + }}); + // Values b.clear(); diff --git a/jdk/test/java/nio/Buffer/BasicShort.java b/jdk/test/java/nio/Buffer/BasicShort.java index 42fe98b8673..acd4740216d 100644 --- a/jdk/test/java/nio/Buffer/BasicShort.java +++ b/jdk/test/java/nio/Buffer/BasicShort.java @@ -31,6 +31,7 @@ // -- This file was mechanically generated: Do not edit! -- // import java.nio.*; +import java.lang.reflect.Method; public class BasicShort @@ -262,6 +263,31 @@ public class BasicShort + + + + + + + + + + + + + + + + + + + + + + + + + @@ -288,8 +314,11 @@ public class BasicShort try { thunk.run(); } catch (Throwable x) { - if (ex.isAssignableFrom(x.getClass())) + if (ex.isAssignableFrom(x.getClass())) { caught = true; + } else { + fail(x.getMessage() + " not expected"); + } } if (!caught) fail(ex.getName() + " not thrown", b); @@ -356,7 +385,6 @@ public class BasicShort // Exceptions - boolean caught = false; relPut(b); b.limit(b.capacity() / 2); b.position(b.limit()); @@ -386,6 +414,14 @@ public class BasicShort b.put(b.limit(), (short)42); }}); + tryCatch(b, InvalidMarkException.class, new Runnable() { + public void run() { + b.position(0); + b.mark(); + b.compact(); + b.reset(); + }}); + // Values b.clear(); diff --git a/jdk/test/java/nio/Buffer/genBasic.sh b/jdk/test/java/nio/Buffer/genBasic.sh index 4696f05a244..d546cec5d2f 100644 --- a/jdk/test/java/nio/Buffer/genBasic.sh +++ b/jdk/test/java/nio/Buffer/genBasic.sh @@ -23,7 +23,7 @@ # have any questions. # -javac -d . ../../../../make/tools/src/build/tools/spp/Spp.java > Spp.java +javac -d . ../../../../make/tools/src/build/tools/spp/Spp.java gen() { java build.tools.spp.Spp -K$1 -Dtype=$1 -DType=$2 -DFulltype=$3 Basic$2.java From 2bba3afabc1ab7dcf2da350b1dfdee7a8f7780ff Mon Sep 17 00:00:00 2001 From: Tom Rodriguez Date: Tue, 25 Nov 2008 13:14:07 -0800 Subject: [PATCH 159/267] 6756768: C1 generates invalid code Reviewed-by: kvn, jrose --- hotspot/src/share/vm/c1/c1_GraphBuilder.cpp | 31 +---- hotspot/src/share/vm/c1/c1_GraphBuilder.hpp | 2 - hotspot/src/share/vm/c1/c1_ValueMap.hpp | 116 +++++++++++------- .../test/compiler/6756768/Test6756768.java | 55 +++++++++ .../test/compiler/6756768/Test6756768_2.java | 55 +++++++++ 5 files changed, 184 insertions(+), 75 deletions(-) create mode 100644 hotspot/test/compiler/6756768/Test6756768.java create mode 100644 hotspot/test/compiler/6756768/Test6756768_2.java diff --git a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp index efa25e3915f..050823dbde9 100644 --- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp +++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp @@ -676,21 +676,6 @@ GraphBuilder::ScopeData::ScopeData(ScopeData* parent) } -void GraphBuilder::kill_field(ciField* field) { - if (UseLocalValueNumbering) { - vmap()->kill_field(field); - } -} - - -void GraphBuilder::kill_array(Value value) { - if (UseLocalValueNumbering) { - vmap()->kill_array(value->type()); - } - _memory->store_value(value); -} - - void GraphBuilder::kill_all() { if (UseLocalValueNumbering) { vmap()->kill_all(); @@ -987,8 +972,8 @@ void GraphBuilder::store_indexed(BasicType type) { length = append(new ArrayLength(array, lock_stack())); } StoreIndexed* result = new StoreIndexed(array, index, length, type, value, lock_stack()); - kill_array(value); // invalidate all CSEs that are memory accesses of the same type append(result); + _memory->store_value(value); } @@ -1478,9 +1463,6 @@ void GraphBuilder::access_field(Bytecodes::Code code) { case Bytecodes::_putstatic: { Value val = pop(type); append(new StoreField(append(obj), offset, field, val, true, lock_stack(), state_copy, is_loaded, is_initialized)); - if (UseLocalValueNumbering) { - vmap()->kill_field(field); // invalidate all CSEs that are memory accesses - } } break; case Bytecodes::_getfield : @@ -1503,7 +1485,6 @@ void GraphBuilder::access_field(Bytecodes::Code code) { if (is_loaded) store = _memory->store(store); if (store != NULL) { append(store); - kill_field(field); // invalidate all CSEs that are accesses of this field } } break; @@ -1900,6 +1881,8 @@ Instruction* GraphBuilder::append_with_bci(Instruction* instr, int bci) { assert(i2->bci() != -1, "should already be linked"); return i2; } + ValueNumberingEffects vne(vmap()); + i1->visit(&vne); } if (i1->as_Phi() == NULL && i1->as_Local() == NULL) { @@ -1926,14 +1909,8 @@ Instruction* GraphBuilder::append_with_bci(Instruction* instr, int bci) { assert(_last == i1, "adjust code below"); StateSplit* s = i1->as_StateSplit(); if (s != NULL && i1->as_BlockEnd() == NULL) { - // Continue CSE across certain intrinsics - Intrinsic* intrinsic = s->as_Intrinsic(); - if (UseLocalValueNumbering) { - if (intrinsic == NULL || !intrinsic->preserves_state()) { - vmap()->kill_all(); // for now, hopefully we need this only for calls eventually - } - } if (EliminateFieldAccess) { + Intrinsic* intrinsic = s->as_Intrinsic(); if (s->as_Invoke() != NULL || (intrinsic && !intrinsic->preserves_state())) { _memory->kill(); } diff --git a/hotspot/src/share/vm/c1/c1_GraphBuilder.hpp b/hotspot/src/share/vm/c1/c1_GraphBuilder.hpp index 46786748b5e..7f185ef4b96 100644 --- a/hotspot/src/share/vm/c1/c1_GraphBuilder.hpp +++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.hpp @@ -283,8 +283,6 @@ class GraphBuilder VALUE_OBJ_CLASS_SPEC { Dependencies* dependency_recorder() const; // = compilation()->dependencies() bool direct_compare(ciKlass* k); - void kill_field(ciField* field); - void kill_array(Value value); void kill_all(); ValueStack* lock_stack(); diff --git a/hotspot/src/share/vm/c1/c1_ValueMap.hpp b/hotspot/src/share/vm/c1/c1_ValueMap.hpp index efc32200910..94823245875 100644 --- a/hotspot/src/share/vm/c1/c1_ValueMap.hpp +++ b/hotspot/src/share/vm/c1/c1_ValueMap.hpp @@ -133,53 +133,77 @@ class ValueNumberingVisitor: public InstructionVisitor { virtual void kill_array(ValueType* type) = 0; // visitor functions - void do_StoreField (StoreField* x) { kill_field(x->field()); }; - void do_StoreIndexed (StoreIndexed* x) { kill_array(x->type()); }; - void do_MonitorEnter (MonitorEnter* x) { kill_memory(); }; - void do_MonitorExit (MonitorExit* x) { kill_memory(); }; - void do_Invoke (Invoke* x) { kill_memory(); }; - void do_UnsafePutRaw (UnsafePutRaw* x) { kill_memory(); }; - void do_UnsafePutObject(UnsafePutObject* x) { kill_memory(); }; - void do_Intrinsic (Intrinsic* x) { if (!x->preserves_state()) kill_memory(); }; + void do_StoreField (StoreField* x) { + if (!x->is_initialized()) { + kill_memory(); + } else { + kill_field(x->field()); + } + } + void do_StoreIndexed (StoreIndexed* x) { kill_array(x->type()); } + void do_MonitorEnter (MonitorEnter* x) { kill_memory(); } + void do_MonitorExit (MonitorExit* x) { kill_memory(); } + void do_Invoke (Invoke* x) { kill_memory(); } + void do_UnsafePutRaw (UnsafePutRaw* x) { kill_memory(); } + void do_UnsafePutObject(UnsafePutObject* x) { kill_memory(); } + void do_Intrinsic (Intrinsic* x) { if (!x->preserves_state()) kill_memory(); } - void do_Phi (Phi* x) { /* nothing to do */ }; - void do_Local (Local* x) { /* nothing to do */ }; - void do_Constant (Constant* x) { /* nothing to do */ }; - void do_LoadField (LoadField* x) { /* nothing to do */ }; - void do_ArrayLength (ArrayLength* x) { /* nothing to do */ }; - void do_LoadIndexed (LoadIndexed* x) { /* nothing to do */ }; - void do_NegateOp (NegateOp* x) { /* nothing to do */ }; - void do_ArithmeticOp (ArithmeticOp* x) { /* nothing to do */ }; - void do_ShiftOp (ShiftOp* x) { /* nothing to do */ }; - void do_LogicOp (LogicOp* x) { /* nothing to do */ }; - void do_CompareOp (CompareOp* x) { /* nothing to do */ }; - void do_IfOp (IfOp* x) { /* nothing to do */ }; - void do_Convert (Convert* x) { /* nothing to do */ }; - void do_NullCheck (NullCheck* x) { /* nothing to do */ }; - void do_NewInstance (NewInstance* x) { /* nothing to do */ }; - void do_NewTypeArray (NewTypeArray* x) { /* nothing to do */ }; - void do_NewObjectArray (NewObjectArray* x) { /* nothing to do */ }; - void do_NewMultiArray (NewMultiArray* x) { /* nothing to do */ }; - void do_CheckCast (CheckCast* x) { /* nothing to do */ }; - void do_InstanceOf (InstanceOf* x) { /* nothing to do */ }; - void do_BlockBegin (BlockBegin* x) { /* nothing to do */ }; - void do_Goto (Goto* x) { /* nothing to do */ }; - void do_If (If* x) { /* nothing to do */ }; - void do_IfInstanceOf (IfInstanceOf* x) { /* nothing to do */ }; - void do_TableSwitch (TableSwitch* x) { /* nothing to do */ }; - void do_LookupSwitch (LookupSwitch* x) { /* nothing to do */ }; - void do_Return (Return* x) { /* nothing to do */ }; - void do_Throw (Throw* x) { /* nothing to do */ }; - void do_Base (Base* x) { /* nothing to do */ }; - void do_OsrEntry (OsrEntry* x) { /* nothing to do */ }; - void do_ExceptionObject(ExceptionObject* x) { /* nothing to do */ }; - void do_RoundFP (RoundFP* x) { /* nothing to do */ }; - void do_UnsafeGetRaw (UnsafeGetRaw* x) { /* nothing to do */ }; - void do_UnsafeGetObject(UnsafeGetObject* x) { /* nothing to do */ }; - void do_UnsafePrefetchRead (UnsafePrefetchRead* x) { /* nothing to do */ }; - void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) { /* nothing to do */ }; - void do_ProfileCall (ProfileCall* x) { /* nothing to do */ }; - void do_ProfileCounter (ProfileCounter* x) { /* nothing to do */ }; + void do_Phi (Phi* x) { /* nothing to do */ } + void do_Local (Local* x) { /* nothing to do */ } + void do_Constant (Constant* x) { /* nothing to do */ } + void do_LoadField (LoadField* x) { + if (!x->is_initialized()) { + kill_memory(); + } + } + void do_ArrayLength (ArrayLength* x) { /* nothing to do */ } + void do_LoadIndexed (LoadIndexed* x) { /* nothing to do */ } + void do_NegateOp (NegateOp* x) { /* nothing to do */ } + void do_ArithmeticOp (ArithmeticOp* x) { /* nothing to do */ } + void do_ShiftOp (ShiftOp* x) { /* nothing to do */ } + void do_LogicOp (LogicOp* x) { /* nothing to do */ } + void do_CompareOp (CompareOp* x) { /* nothing to do */ } + void do_IfOp (IfOp* x) { /* nothing to do */ } + void do_Convert (Convert* x) { /* nothing to do */ } + void do_NullCheck (NullCheck* x) { /* nothing to do */ } + void do_NewInstance (NewInstance* x) { /* nothing to do */ } + void do_NewTypeArray (NewTypeArray* x) { /* nothing to do */ } + void do_NewObjectArray (NewObjectArray* x) { /* nothing to do */ } + void do_NewMultiArray (NewMultiArray* x) { /* nothing to do */ } + void do_CheckCast (CheckCast* x) { /* nothing to do */ } + void do_InstanceOf (InstanceOf* x) { /* nothing to do */ } + void do_BlockBegin (BlockBegin* x) { /* nothing to do */ } + void do_Goto (Goto* x) { /* nothing to do */ } + void do_If (If* x) { /* nothing to do */ } + void do_IfInstanceOf (IfInstanceOf* x) { /* nothing to do */ } + void do_TableSwitch (TableSwitch* x) { /* nothing to do */ } + void do_LookupSwitch (LookupSwitch* x) { /* nothing to do */ } + void do_Return (Return* x) { /* nothing to do */ } + void do_Throw (Throw* x) { /* nothing to do */ } + void do_Base (Base* x) { /* nothing to do */ } + void do_OsrEntry (OsrEntry* x) { /* nothing to do */ } + void do_ExceptionObject(ExceptionObject* x) { /* nothing to do */ } + void do_RoundFP (RoundFP* x) { /* nothing to do */ } + void do_UnsafeGetRaw (UnsafeGetRaw* x) { /* nothing to do */ } + void do_UnsafeGetObject(UnsafeGetObject* x) { /* nothing to do */ } + void do_UnsafePrefetchRead (UnsafePrefetchRead* x) { /* nothing to do */ } + void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) { /* nothing to do */ } + void do_ProfileCall (ProfileCall* x) { /* nothing to do */ } + void do_ProfileCounter (ProfileCounter* x) { /* nothing to do */ } +}; + + +class ValueNumberingEffects: public ValueNumberingVisitor { + private: + ValueMap* _map; + + public: + // implementation for abstract methods of ValueNumberingVisitor + void kill_memory() { _map->kill_memory(); } + void kill_field(ciField* field) { _map->kill_field(field); } + void kill_array(ValueType* type) { _map->kill_array(type); } + + ValueNumberingEffects(ValueMap* map): _map(map) {} }; diff --git a/hotspot/test/compiler/6756768/Test6756768.java b/hotspot/test/compiler/6756768/Test6756768.java new file mode 100644 index 00000000000..83215381b17 --- /dev/null +++ b/hotspot/test/compiler/6756768/Test6756768.java @@ -0,0 +1,55 @@ +/* + * 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. + * + * 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 6756768 + * @summary C1 generates invalid code + * + * @run main/othervm -Xcomp Test6756768 + */ + +class Test6756768a +{ + static boolean var_1 = true; +} + +final class Test6756768b +{ + static boolean var_24 = false; + static int var_25 = 0; + + static boolean var_temp1 = Test6756768a.var_1 = false; +} + +public final class Test6756768 extends Test6756768a +{ + final static int var = var_1 ^ (Test6756768b.var_24 ? var_1 : var_1) ? Test6756768b.var_25 : 1; + + static public void main(String[] args) { + if (var != 0) { + throw new InternalError("var = " + var); + } + } + +} diff --git a/hotspot/test/compiler/6756768/Test6756768_2.java b/hotspot/test/compiler/6756768/Test6756768_2.java new file mode 100644 index 00000000000..fbf9c0323ea --- /dev/null +++ b/hotspot/test/compiler/6756768/Test6756768_2.java @@ -0,0 +1,55 @@ +/* + * 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. + * + * 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 6756768 + * @summary C1 generates invalid code + * + * @run main/othervm -Xcomp Test6756768_2 + */ + +class Test6756768_2a { + static int var = ++Test6756768_2.var; +} + +public class Test6756768_2 { + static int var = 1; + + static Object d2 = null; + + static void test_static_field() { + int v = var; + int v2 = Test6756768_2a.var; + int v3 = var; + var = v3; + } + + public static void main(String[] args) { + var = 1; + test_static_field(); + if (var != 2) { + throw new InternalError(); + } + } +} From 71eb0166527f5301f2cd8acbbec6f53c46dca336 Mon Sep 17 00:00:00 2001 From: Maurizio Cimadamore Date: Wed, 26 Nov 2008 11:07:07 +0000 Subject: [PATCH 160/267] 6776289: Regression: javac7 doesnt resolve method calls properly Superclass' private methods shouldn't be considered during method resolution Reviewed-by: jjg --- .../com/sun/tools/javac/comp/Resolve.java | 1 + .../javac/generics/6711619/T6711619a.out | 4 +- .../test/tools/javac/overload/T6776289.java | 42 +++++++++++++++++++ 3 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 langtools/test/tools/javac/overload/T6776289.java diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java index 59c2292b12f..1a141aa5400 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java @@ -559,6 +559,7 @@ public class Resolve { boolean useVarargs, boolean operator) { if (sym.kind == ERR) return bestSoFar; + if (!sym.isInheritedIn(site.tsym, types)) return bestSoFar; assert sym.kind < AMBIGUOUS; try { if (rawInstantiate(env, site, sym, argtypes, typeargtypes, diff --git a/langtools/test/tools/javac/generics/6711619/T6711619a.out b/langtools/test/tools/javac/generics/6711619/T6711619a.out index e35eed19137..0dfa28ec74b 100644 --- a/langtools/test/tools/javac/generics/6711619/T6711619a.out +++ b/langtools/test/tools/javac/generics/6711619/T6711619a.out @@ -1,5 +1,5 @@ -T6711619a.java:63:14: compiler.err.report.access: a(), private, T6711619a.A -T6711619a.java:64:14: compiler.err.report.access: b(), private, T6711619a.B +T6711619a.java:63:14: compiler.err.cant.resolve.args: kindname.method, a, , +T6711619a.java:64:14: compiler.err.cant.resolve.args: kindname.method, b, , T6711619a.java:69:19: compiler.err.report.access: a, private, T6711619a.A T6711619a.java:70:19: compiler.err.report.access: b, private, T6711619a.B T6711619a.java:71:19: compiler.err.report.access: a, private, T6711619a.A diff --git a/langtools/test/tools/javac/overload/T6776289.java b/langtools/test/tools/javac/overload/T6776289.java new file mode 100644 index 00000000000..ccca3a9fdde --- /dev/null +++ b/langtools/test/tools/javac/overload/T6776289.java @@ -0,0 +1,42 @@ +/* + * 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. + * + * 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 6776289 + * @summary Regression: javac7 doesnt resolve method calls properly + * @compile T6776289.java + */ + +class A { + private void m(int a, int b) { } +} + +class T6776289 { + static void m(int a, String s) { } + class B extends A { + public void test() { + m(1, ""); + } + } +} From c0500f7d7452b902f98ae73aff1b63bc534538e8 Mon Sep 17 00:00:00 2001 From: Chris Hegarty Date: Wed, 26 Nov 2008 15:37:14 +0000 Subject: [PATCH 161/267] 6720866: Slow performance using HttpURLConnection for upload Reviewed-by: michaelm --- .../sun/net/www/http/ChunkedOutputStream.java | 289 ++++++++++-------- 1 file changed, 166 insertions(+), 123 deletions(-) diff --git a/jdk/src/share/classes/sun/net/www/http/ChunkedOutputStream.java b/jdk/src/share/classes/sun/net/www/http/ChunkedOutputStream.java index ed8d7b3f5ae..ac97667b912 100644 --- a/jdk/src/share/classes/sun/net/www/http/ChunkedOutputStream.java +++ b/jdk/src/share/classes/sun/net/www/http/ChunkedOutputStream.java @@ -29,32 +29,58 @@ import java.io.*; /** * OutputStream that sends the output to the underlying stream using chunked * encoding as specified in RFC 2068. - * - * @author Alan Bateman */ public class ChunkedOutputStream extends PrintStream { /* Default chunk size (including chunk header) if not specified */ static final int DEFAULT_CHUNK_SIZE = 4096; + private static final byte[] CRLF = {'\r', '\n'}; + private static final int CRLF_SIZE = CRLF.length; + private static final byte[] FOOTER = CRLF; + private static final int FOOTER_SIZE = CRLF_SIZE; + private static final byte[] EMPTY_CHUNK_HEADER = getHeader(0); + private static final int EMPTY_CHUNK_HEADER_SIZE = getHeaderSize(0); /* internal buffer */ private byte buf[]; + /* size of data (excluding footers and headers) already stored in buf */ + private int size; + /* current index in buf (i.e. buf[count] */ private int count; + /* number of bytes to be filled up to complete a data chunk + * currently being built */ + private int spaceInCurrentChunk; /* underlying stream */ private PrintStream out; /* the chunk size we use */ - private int preferredChunkSize; - - /* if the users write buffer is bigger than this size, we - * write direct from the users buffer instead of copying - */ - static final int MAX_BUF_SIZE = 10 * 1024; + private int preferredChunkDataSize; + private int preferedHeaderSize; + private int preferredChunkGrossSize; + /* header for a complete Chunk */ + private byte[] completeHeader; /* return the size of the header for a particular chunk size */ - private int headerSize(int size) { - return 2 + (Integer.toHexString(size)).length(); + private static int getHeaderSize(int size) { + return (Integer.toHexString(size)).length() + CRLF_SIZE; + } + + /* return a header for a particular chunk size */ + private static byte[] getHeader(int size){ + try { + String hexStr = Integer.toHexString(size); + byte[] hexBytes = hexStr.getBytes("US-ASCII"); + byte[] header = new byte[getHeaderSize(size)]; + for (int i=0; i 0) { - int adjusted_size = size - headerSize(size); - if (adjusted_size + headerSize(adjusted_size) < size) { + int adjusted_size = size - getHeaderSize(size) - FOOTER_SIZE; + if (getHeaderSize(adjusted_size+1) < getHeaderSize(size)){ adjusted_size++; } size = adjusted_size; } if (size > 0) { - preferredChunkSize = size; + preferredChunkDataSize = size; } else { - preferredChunkSize = DEFAULT_CHUNK_SIZE - headerSize(DEFAULT_CHUNK_SIZE); + preferredChunkDataSize = DEFAULT_CHUNK_SIZE - + getHeaderSize(DEFAULT_CHUNK_SIZE) - FOOTER_SIZE; } + preferedHeaderSize = getHeaderSize(preferredChunkDataSize); + preferredChunkGrossSize = preferedHeaderSize + preferredChunkDataSize + + FOOTER_SIZE; + completeHeader = getHeader(preferredChunkDataSize); + /* start with an initial buffer */ - buf = new byte[preferredChunkSize + 32]; + buf = new byte[preferredChunkDataSize + 32]; + reset(); } /* - * If flushAll is true, then all data is flushed in one chunk. - * - * If false and the size of the buffer data exceeds the preferred - * chunk size then chunks are flushed to the output stream. - * If there isn't enough data to make up a complete chunk, - * then the method returns. + * Flush a buffered, completed chunk to an underlying stream. If the data in + * the buffer is insufficient to build up a chunk of "preferredChunkSize" + * then the data do not get flushed unless flushAll is true. If flushAll is + * true then the remaining data builds up a last chunk which size is smaller + * than preferredChunkSize, and then the last chunk gets flushed to + * underlying stream. If flushAll is true and there is no data in a buffer + * at all then an empty chunk (containing a header only) gets flushed to + * underlying stream. */ - private void flush(byte[] buf, boolean flushAll) { - flush (buf, flushAll, 0); - } - - private void flush(byte[] buf, boolean flushAll, int offset) { - int chunkSize; - - do { - if (count < preferredChunkSize) { - if (!flushAll) { - break; - } - chunkSize = count; - } else { - chunkSize = preferredChunkSize; - } - - byte[] bytes = null; - try { - bytes = (Integer.toHexString(chunkSize)).getBytes("US-ASCII"); - } catch (java.io.UnsupportedEncodingException e) { - //This should never happen. - throw new InternalError(e.getMessage()); - } - - out.write(bytes, 0, bytes.length); - out.write((byte)'\r'); - out.write((byte)'\n'); - if (chunkSize > 0) { - out.write(buf, offset, chunkSize); - out.write((byte)'\r'); - out.write((byte)'\n'); - } + private void flush(boolean flushAll) { + if (spaceInCurrentChunk == 0) { + /* flush a completed chunk to underlying stream */ + out.write(buf, 0, preferredChunkGrossSize); out.flush(); - if (checkError()) { - break; - } - if (chunkSize > 0) { - count -= chunkSize; - offset += chunkSize; - } - } while (count > 0); + reset(); + } else if (flushAll){ + /* complete the last chunk and flush it to underlying stream */ + if (size > 0){ + /* adjust a header start index in case the header of the last + * chunk is shorter then preferedHeaderSize */ - if (!checkError() && count > 0) { - System.arraycopy(buf, offset, this.buf, 0, count); - } + int adjustedHeaderStartIndex = preferedHeaderSize - + getHeaderSize(size); + + /* write header */ + System.arraycopy(getHeader(size), 0, buf, + adjustedHeaderStartIndex, getHeaderSize(size)); + + /* write footer */ + buf[count++] = FOOTER[0]; + buf[count++] = FOOTER[1]; + + //send the last chunk to underlying stream + out.write(buf, adjustedHeaderStartIndex, count - adjustedHeaderStartIndex); + } else { + //send an empty chunk (containing just a header) to underlying stream + out.write(EMPTY_CHUNK_HEADER, 0, EMPTY_CHUNK_HEADER_SIZE); + } + + out.flush(); + reset(); + } } + @Override public boolean checkError() { return out.checkError(); } - /* - * Check if we have enough data for a chunk and if so flush to the - * underlying output stream. - */ - private void checkFlush() { - if (count >= preferredChunkSize) { - flush(buf, false); - } - } - /* Check that the output stream is still open */ private void ensureOpen() { if (out == null) setError(); } + /* + * Writes data from b[] to an internal buffer and stores the data as data + * chunks of a following format: {Data length in Hex}{CRLF}{data}{CRLF} + * The size of the data is preferredChunkSize. As soon as a completed chunk + * is read from b[] a process of reading from b[] suspends, the chunk gets + * flushed to the underlying stream and then the reading process from b[] + * continues. When there is no more sufficient data in b[] to build up a + * chunk of preferredChunkSize size the data get stored as an incomplete + * chunk of a following format: {space for data length}{CRLF}{data} + * The size of the data is of course smaller than preferredChunkSize. + */ + @Override public synchronized void write(byte b[], int off, int len) { ensureOpen(); if ((off < 0) || (off > b.length) || (len < 0) || @@ -177,81 +206,95 @@ public class ChunkedOutputStream extends PrintStream { return; } - int l = preferredChunkSize - count; + /* if b[] contains enough data then one loop cycle creates one complete + * data chunk with a header, body and a footer, and then flushes the + * chunk to the underlying stream. Otherwise, the last loop cycle + * creates incomplete data chunk with empty header and with no footer + * and stores this incomplete chunk in an internal buffer buf[] + */ + int bytesToWrite = len; + int inputIndex = off; /* the index of the byte[] currently being written */ - if ((len > MAX_BUF_SIZE) && (len > l)) { - /* current chunk is empty just write the data */ - if (count == 0) { - count = len; - flush (b, false, off); - return; + do { + /* enough data to complete a chunk */ + if (bytesToWrite >= spaceInCurrentChunk) { + + /* header */ + for (int i=0; i 0) { - System.arraycopy(b, off, buf, count, l); - count = preferredChunkSize; - flush(buf, false); - } + /* not enough data to build a chunk */ + else { + /* header */ + /* do not write header if not enough bytes to build a chunk yet */ - count = len - l; - /* Now write the rest of the data */ - flush (b, false, l+off); - } else { - int newcount = count + len; + /* data */ + System.arraycopy(b, inputIndex, buf, count, bytesToWrite); + count += bytesToWrite; + size += bytesToWrite; + spaceInCurrentChunk -= bytesToWrite; + bytesToWrite = 0; - if (newcount > buf.length) { - byte newbuf[] = new byte[Math.max(buf.length << 1, newcount)]; - System.arraycopy(buf, 0, newbuf, 0, count); - buf = newbuf; + /* footer */ + /* do not write header if not enough bytes to build a chunk yet */ } - System.arraycopy(b, off, buf, count, len); - count = newcount; - checkFlush(); - } + } while (bytesToWrite > 0); } - public synchronized void write(int b) { - ensureOpen(); - int newcount = count + 1; - if (newcount > buf.length) { - byte newbuf[] = new byte[Math.max(buf.length << 1, newcount)]; - System.arraycopy(buf, 0, newbuf, 0, count); - buf = newbuf; - } - buf[count] = (byte)b; - count = newcount; - checkFlush(); + @Override + public synchronized void write(int _b) { + byte b[] = {(byte)_b}; + write(b, 0, 1); } public synchronized void reset() { - count = 0; + count = preferedHeaderSize; + size = 0; + spaceInCurrentChunk = preferredChunkDataSize; } public int size() { - return count; + return size; } + @Override public synchronized void close() { ensureOpen(); /* if we have buffer a chunked send it */ - if (count > 0) { - flush(buf, true); + if (size > 0) { + flush(true); } /* send a zero length chunk */ - flush(buf, true); + flush(true); /* don't close the underlying stream */ out = null; } + @Override public synchronized void flush() { ensureOpen(); - if (count > 0) { - flush(buf, true); + if (size > 0) { + flush(true); } } - } From 70624128b46196c9ed8a04981cae5c9ad9b033b3 Mon Sep 17 00:00:00 2001 From: Eamonn McManus Date: Thu, 27 Nov 2008 15:44:32 +0100 Subject: [PATCH 162/267] 6776225: JMX.isNotificationSource wrong when DynamicWrapperMBean + SendNotification injection Reviewed-by: dfuchs, jfdenise --- .../jmx/mbeanserver/MBeanIntrospector.java | 4 +- .../share/classes/javax/management/JMX.java | 17 +- .../management/StandardEmitterMBean.java | 31 ++- .../javax/management/StandardMBean.java | 6 +- .../MBeanServer/DynamicWrapperMBeanTest.java | 261 +++++++++++++++++- 5 files changed, 289 insertions(+), 30 deletions(-) diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanIntrospector.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanIntrospector.java index 781320d9b80..3f2a9cc91a0 100644 --- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanIntrospector.java +++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanIntrospector.java @@ -80,7 +80,7 @@ import javax.management.ReflectionException; * ancestor with ConvertingMethod. But that would mean an extra object * for every Method in every Standard MBean interface. */ -abstract class MBeanIntrospector { +public abstract class MBeanIntrospector { static final class PerInterfaceMap extends WeakHashMap, WeakReference>> {} @@ -557,7 +557,7 @@ abstract class MBeanIntrospector { return findNotificationsFromAnnotations(moi.getClass()); } - private static MBeanNotificationInfo[] findNotificationsFromAnnotations( + public static MBeanNotificationInfo[] findNotificationsFromAnnotations( Class mbeanClass) { Class c = getAnnotatedNotificationInfoClass(mbeanClass); if (c == null) diff --git a/jdk/src/share/classes/javax/management/JMX.java b/jdk/src/share/classes/javax/management/JMX.java index 60b9605b315..d9329e0c3d4 100644 --- a/jdk/src/share/classes/javax/management/JMX.java +++ b/jdk/src/share/classes/javax/management/JMX.java @@ -51,8 +51,6 @@ public class JMX { * this class. */ static final JMX proof = new JMX(); - private static final ClassLogger logger = - new ClassLogger("javax.management.misc", "JMX"); private JMX() {} @@ -824,11 +822,16 @@ public class JMX { */ public static boolean isNotificationSource(Object mbean) throws NotCompliantMBeanException { - if (mbean instanceof NotificationBroadcaster) - return true; - Object resource = (mbean instanceof DynamicWrapperMBean) ? - ((DynamicWrapperMBean) mbean).getWrappedObject() : mbean; - return (MBeanInjector.injectsSendNotification(resource)); + for (int i = 0; i < 2; i++) { + if (mbean instanceof NotificationBroadcaster || + MBeanInjector.injectsSendNotification(mbean)) + return true; + if (mbean instanceof DynamicWrapperMBean) + mbean = ((DynamicWrapperMBean) mbean).getWrappedObject(); + else + break; + } + return false; } /** diff --git a/jdk/src/share/classes/javax/management/StandardEmitterMBean.java b/jdk/src/share/classes/javax/management/StandardEmitterMBean.java index da5f991f427..abce5b202eb 100644 --- a/jdk/src/share/classes/javax/management/StandardEmitterMBean.java +++ b/jdk/src/share/classes/javax/management/StandardEmitterMBean.java @@ -26,6 +26,7 @@ package javax.management; import com.sun.jmx.mbeanserver.MBeanInjector; +import com.sun.jmx.mbeanserver.MBeanIntrospector; import static javax.management.JMX.MBeanOptions; /** @@ -195,10 +196,12 @@ public class StandardEmitterMBean extends StandardMBean MBeanOptions options, NotificationEmitter emitter) { super(implementation, mbeanInterface, options); + MBeanNotificationInfo[] defaultMBNIs = defaultMBNIs(implementation); if (emitter == null) - emitter = defaultEmitter(); + emitter = defaultEmitter(defaultMBNIs); this.emitter = emitter; - this.notificationInfo = emitter.getNotificationInfo(); + this.notificationInfo = + firstNonEmpty(emitter.getNotificationInfo(), defaultMBNIs); injectEmitter(); } @@ -320,15 +323,23 @@ public class StandardEmitterMBean extends StandardMBean protected StandardEmitterMBean(Class mbeanInterface, MBeanOptions options, NotificationEmitter emitter) { super(mbeanInterface, options); + MBeanNotificationInfo[] defaultMBNIs = defaultMBNIs(this); if (emitter == null) - emitter = defaultEmitter(); + emitter = defaultEmitter(defaultMBNIs); this.emitter = emitter; - this.notificationInfo = emitter.getNotificationInfo(); + this.notificationInfo = + firstNonEmpty(emitter.getNotificationInfo(), defaultMBNIs); injectEmitter(); } - private NotificationEmitter defaultEmitter() { - MBeanNotificationInfo[] mbnis = getNotificationInfo(); + private static MBeanNotificationInfo[] defaultMBNIs(Object mbean) { + return MBeanIntrospector.findNotificationsFromAnnotations( + mbean.getClass()); + } + + private NotificationEmitter defaultEmitter(MBeanNotificationInfo[] defaultMBNIs) { + MBeanNotificationInfo[] mbnis = + firstNonEmpty(getNotificationInfo(), defaultMBNIs); // Will be null unless getNotificationInfo() is overridden, // since the notificationInfo field has not been set at this point. if (mbnis == null) @@ -336,6 +347,14 @@ public class StandardEmitterMBean extends StandardMBean return new NotificationBroadcasterSupport(mbnis); } + private static T[] firstNonEmpty(T[]... items) { + for (T[] t : items) { + if (t != null && t.length != 0) + return t; + } + return null; + } + private void injectEmitter() { if (emitter instanceof SendNotification) { try { diff --git a/jdk/src/share/classes/javax/management/StandardMBean.java b/jdk/src/share/classes/javax/management/StandardMBean.java index 492b259d189..45badeac6c7 100644 --- a/jdk/src/share/classes/javax/management/StandardMBean.java +++ b/jdk/src/share/classes/javax/management/StandardMBean.java @@ -1058,10 +1058,6 @@ public class StandardMBean implements DynamicWrapperMBean, MBeanRegistration { cachedMBeanInfo = info; } - private boolean isMXBean() { - return mbean.isMXBean(); - } - private static boolean identicalArrays(T[] a, T[] b) { if (a == b) return true; @@ -1466,7 +1462,7 @@ public class StandardMBean implements DynamicWrapperMBean, MBeanRegistration { // Check for "MBeanNotificationInfo[] getNotificationInfo()" // method. // - // This method is only taken into account for the MBeanInfo + // This method is taken into account for the MBeanInfo // immutability checks if and only if the given subclass is // StandardEmitterMBean itself or can be assigned to // StandardEmitterMBean. diff --git a/jdk/test/javax/management/MBeanServer/DynamicWrapperMBeanTest.java b/jdk/test/javax/management/MBeanServer/DynamicWrapperMBeanTest.java index 793419abf65..fc52711c7fe 100644 --- a/jdk/test/javax/management/MBeanServer/DynamicWrapperMBeanTest.java +++ b/jdk/test/javax/management/MBeanServer/DynamicWrapperMBeanTest.java @@ -23,14 +23,27 @@ /* * @test DynamicWrapperMBeanTest - * @bug 6624232 + * @bug 6624232 6776225 * @summary Test the DynamicWrapperMBean interface * @author Eamonn McManus */ import java.lang.management.ManagementFactory; +import javax.annotation.Resource; +import javax.management.JMX; +import javax.management.ListenerNotFoundException; +import javax.management.MBeanNotificationInfo; import javax.management.MBeanServer; +import javax.management.Notification; +import javax.management.NotificationBroadcaster; +import javax.management.NotificationBroadcasterSupport; +import javax.management.NotificationEmitter; +import javax.management.NotificationFilter; +import javax.management.NotificationInfo; +import javax.management.NotificationListener; import javax.management.ObjectName; +import javax.management.SendNotification; +import javax.management.StandardEmitterMBean; import javax.management.StandardMBean; import javax.management.modelmbean.ModelMBeanInfo; import javax.management.modelmbean.ModelMBeanInfoSupport; @@ -39,6 +52,25 @@ import javax.management.modelmbean.RequiredModelMBean; import static javax.management.StandardMBean.Options; public class DynamicWrapperMBeanTest { + private static String failure; + + public static void main(String[] args) throws Exception { + wrapTest(); + notifTest(); + + if (failure == null) + System.out.println("TEST PASSED"); + else + throw new Exception("TEST FAILED: " + failure); + } + + private static final Options wrappedVisOpts = new Options(); + private static final Options wrappedInvisOpts = new Options(); + static { + wrappedVisOpts.setWrappedObjectVisible(true); + wrappedInvisOpts.setWrappedObjectVisible(false); + } + public static interface WrappedMBean { public void sayHello(); } @@ -48,19 +80,13 @@ public class DynamicWrapperMBeanTest { } } - private static String failure; - - public static void main(String[] args) throws Exception { + private static void wrapTest() throws Exception { if (Wrapped.class.getClassLoader() == StandardMBean.class.getClassLoader()) { throw new Exception( "TEST ERROR: Resource and StandardMBean have same ClassLoader"); } - Options wrappedVisOpts = new Options(); - wrappedVisOpts.setWrappedObjectVisible(true); - Options wrappedInvisOpts = new Options(); - wrappedInvisOpts.setWrappedObjectVisible(false); assertEquals("Options withWrappedObjectVisible(false)", new Options(), wrappedInvisOpts); @@ -138,8 +164,223 @@ public class DynamicWrapperMBeanTest { assertEquals("isInstanceOf(RequiredModelMBean) for invisible resource", true, mbs.isInstanceOf(invisibleName, RequiredModelMBean.class.getName())); - if (failure != null) - throw new Exception("TEST FAILED: " + failure); + mbs.unregisterMBean(visibleName); + mbs.unregisterMBean(invisibleName); + } + + private static enum WrapType { + NBS("NotificationBroadcasterSupport"), + INJ("@Resource SendNotification"), + STD_MBEAN_NBS("StandardMBean delegating to NotificationBroadcasterSupport"), + STD_MBEAN_INJ("StandardMBean delegating to @Resource SendNotification"), + STD_MBEAN_SUB_NBS("StandardMBean subclass implementing NotificationBroadcaster"), + STD_MBEAN_SUB_INJ("StandardMBean subclass with @Resource SendNotification"), + STD_EMIT_MBEAN_NBS("StandardEmitterMBean delegating to NotificationBroadcasterSupport"), + STD_EMIT_MBEAN_INJ("StandardEmitterMBean delegating to @Resource SendNotification"), + STD_EMIT_MBEAN_SUB("StandardEmitterMBean subclass"), + STD_EMIT_MBEAN_SUB_INJ("StandardEmitterMBean subclass with @Resource SendNotification"); + + WrapType(String s) { + this.s = s; + } + + @Override + public String toString() { + return s; + } + + private final String s; + } + + @NotificationInfo( + types = {"foo", "bar"} + ) + public static interface BroadcasterMBean { + public void send(Notification n); + } + + public static class Broadcaster + extends NotificationBroadcasterSupport implements BroadcasterMBean { + public void send(Notification n) { + super.sendNotification(n); + } + } + + public static interface SendNotifMBean extends BroadcasterMBean { + } + + public static class SendNotif implements SendNotifMBean { + @Resource + private volatile SendNotification sendNotif; + + public void send(Notification n) { + sendNotif.sendNotification(n); + } + } + + public static class StdBroadcaster + extends StandardMBean + implements BroadcasterMBean, NotificationBroadcaster { + private final NotificationBroadcasterSupport nbs = + new NotificationBroadcasterSupport(); + + public StdBroadcaster() throws Exception { + super(BroadcasterMBean.class); + } + + public void send(Notification n) { + nbs.sendNotification(n); + } + + public void addNotificationListener(NotificationListener listener, + NotificationFilter filter, Object handback) { + nbs.addNotificationListener(listener, filter, handback); + } + + public MBeanNotificationInfo[] getNotificationInfo() { + return null; + } + + public void removeNotificationListener(NotificationListener listener) + throws ListenerNotFoundException { + nbs.removeNotificationListener(listener); + } + } + + public static class StdSendNotif + extends StandardMBean implements SendNotifMBean { + @Resource + private volatile SendNotification sendNotif; + + public StdSendNotif() throws Exception { + super(SendNotifMBean.class); + } + + public void send(Notification n) { + sendNotif.sendNotification(n); + } + } + + public static class StdEmitterBroadcaster // :-) + extends StandardEmitterMBean + implements BroadcasterMBean { + + public StdEmitterBroadcaster() throws Exception { + super(BroadcasterMBean.class, null); + } + + public void send(Notification n) { + super.sendNotification(n); + } + } + + // This case is unlikely - if you're using @Resource SendNotification + // then there's no point in using StandardEmitterMBean, since + // StandardMBean would suffice. + public static class StdEmitterSendNotif + extends StandardEmitterMBean implements SendNotifMBean { + @Resource + private volatile SendNotification sendNotif; + + public StdEmitterSendNotif() { + super(SendNotifMBean.class, null); + } + + public void send(Notification n) { + sendNotif.sendNotification(n); + } + } + + // Test that JMX.isNotificationSource and + // mbs.isInstanceOf("NotificationBroadcaster") work correctly even when + // the MBean is a broadcaster by virtue of its wrapped resource. + // Test that we find the MBeanNotificationInfo[] from the @NotificationInfo + // annotation on BroadcasterMBean. We cover a large number of different + // MBean types, but all ultimately implement that interface. + private static void notifTest() throws Exception { + System.out.println("===Testing notification senders==="); + + for (WrapType wrapType : WrapType.values()) { + System.out.println("---" + wrapType); + + final Object mbean; + + switch (wrapType) { + case NBS: + // An MBean that extends NotificationBroadcasterSupport + mbean = new Broadcaster(); + break; + case INJ: + // An MBean that injects SendNotification + mbean = new SendNotif(); + break; + case STD_MBEAN_NBS: + // A StandardMBean that delegates to a NotificationBroadcasterSupport + mbean = new StandardMBean( + new Broadcaster(), BroadcasterMBean.class, wrappedVisOpts); + break; + case STD_MBEAN_INJ: + // A StandardMBean that delegates to an object that injects + // SendNotification + mbean = new StandardMBean( + new SendNotif(), BroadcasterMBean.class, wrappedVisOpts); + break; + case STD_EMIT_MBEAN_NBS: { + // A StandardEmitterMBean that delegates to a NotificationBroadcasterSupport + Broadcaster broadcaster = new Broadcaster(); + mbean = new StandardEmitterMBean( + broadcaster, BroadcasterMBean.class, wrappedVisOpts, + broadcaster); + break; + } + case STD_EMIT_MBEAN_INJ: { + // A StandardEmitterMBean that delegates to an object that injects + // SendNotification + SendNotif sendNotif = new SendNotif(); + mbean = new StandardEmitterMBean( + sendNotif, BroadcasterMBean.class, wrappedVisOpts, + null); + break; + } + case STD_MBEAN_SUB_NBS: + // A subclass of StandardMBean that implements NotificationBroadcaster + mbean = new StdBroadcaster(); + break; + case STD_MBEAN_SUB_INJ: + // A subclass of StandardMBean that injects SendNotification + mbean = new StdSendNotif(); + break; + case STD_EMIT_MBEAN_SUB: + // A subclass of StandardEmitterMBean + mbean = new StdEmitterBroadcaster(); + break; + case STD_EMIT_MBEAN_SUB_INJ: + // A subclass of StandardEmitterMBean that injects SendNotification + // (which is a rather strange thing to do and probably a user + // misunderstanding but we should do the right thing anyway). + mbean = new StdEmitterSendNotif(); + break; + default: + throw new AssertionError(); + } + + MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); + + final ObjectName name = new ObjectName("a:type=Sender"); + mbs.registerMBean(mbean, name); + boolean isBroadcaster = mbs.isInstanceOf( + name, NotificationBroadcaster.class.getName()); + assertEquals("JMX.isNotificationSource(mbean)", + true, JMX.isNotificationSource(mbean)); + assertEquals("isInstanceOf(NotificationBroadcaster)", + true, isBroadcaster); + MBeanNotificationInfo[] mbnis = + mbs.getMBeanInfo(name).getNotifications(); + assertEquals("MBeanNotificationInfo not empty", + true, (mbnis.length > 0)); + + mbs.unregisterMBean(name); + } } private static void assertEquals(String what, Object expect, Object actual) { From 569029da790c1245a2fa4e4f4a7e1853312741b3 Mon Sep 17 00:00:00 2001 From: Poonam Bajaj Date: Thu, 27 Nov 2008 18:19:23 -0800 Subject: [PATCH 163/267] 6743339: Enable building sa-jdi.jar and sawindbg.dll on Windows with hotspot build These changes enable the SA binaries build with hotspot build on Windows Reviewed-by: swamyv --- hotspot/make/windows/build.make | 23 ----------------------- hotspot/make/windows/makefiles/defs.make | 2 +- hotspot/make/windows/makefiles/sa.make | 19 +++++++++++-------- 3 files changed, 12 insertions(+), 32 deletions(-) diff --git a/hotspot/make/windows/build.make b/hotspot/make/windows/build.make index 66ad19289e2..1e8a857f418 100644 --- a/hotspot/make/windows/build.make +++ b/hotspot/make/windows/build.make @@ -200,29 +200,6 @@ BUILD_WIN_SA = 0 checkSA:: @echo Not building SA: ARCH = ia64 -!elseif exist("$(MSVCDIR)\PlatformSDK\Include\dbgeng.h") -# These don't have to be set because the default -# setting of INCLUDE and LIB already contain the needed dirs. -SA_INCLUDE = -SA_LIB = - -!elseif exist("$(SYSTEMROOT)\..\Program Files\Microsoft SDK\include\dbgeng.h") -# These don't have to be set because the default -# setting of INCLUDE and LIB already contain the needed dirs. -SA_INCLUDE = -SA_LIB = - -!else -checkSA:: - @echo . - @echo ERROR: Can't build SA because dbgeng.h does not exist here: - @echo $(MSVCDIR)\PlatformSDK\Include\dbgeng.h - @echo nor here: - @echo $(SYSTEMROOT)\..\Program Files\Microsoft SDK\include\dbgeng.h - @echo You must use Vis. Studio .Net 2003 on Win 32, and you must - @echo have the Microsoft SDK installed on Win amd64. - @echo You can disable building of SA by specifying BUILD_WIN_SA = 0 - @echo . && false !endif # ! "$(BUILD_WIN_SA)" != "1" ######################################################################### diff --git a/hotspot/make/windows/makefiles/defs.make b/hotspot/make/windows/makefiles/defs.make index c264f9fd103..ee6de0c9e03 100644 --- a/hotspot/make/windows/makefiles/defs.make +++ b/hotspot/make/windows/makefiles/defs.make @@ -119,7 +119,7 @@ endif # we want to release it. If we build it here, # the SDK makefiles will copy it over and put it into # the created image. -BUILD_WIN_SA = 0 +BUILD_WIN_SA = 1 ifneq ($(ALT_BUILD_WIN_SA),) BUILD_WIN_SA = $(ALT_BUILD_WIN_SA) endif diff --git a/hotspot/make/windows/makefiles/sa.make b/hotspot/make/windows/makefiles/sa.make index 01886c13804..c1956057188 100644 --- a/hotspot/make/windows/makefiles/sa.make +++ b/hotspot/make/windows/makefiles/sa.make @@ -49,6 +49,9 @@ SA_PROPERTIES = $(SA_CLASSDIR)\sa.properties default:: $(GENERATED)\sa-jdi.jar +# Remove the space between $(SA_BUILD_VERSION_PROP) and > below as it adds a white space +# at the end of SA version string and causes a version mismatch with the target VM version. + $(GENERATED)\sa-jdi.jar: $(AGENT_FILES1:/=\) $(AGENT_FILES2:/=\) @if not exist $(SA_CLASSDIR) mkdir $(SA_CLASSDIR) @echo ...Building sa-jdi.jar @@ -56,15 +59,15 @@ $(GENERATED)\sa-jdi.jar: $(AGENT_FILES1:/=\) $(AGENT_FILES2:/=\) @$(COMPILE_JAVAC) -source 1.4 -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -g -d $(SA_CLASSDIR) $(AGENT_FILES1:/=\) @$(COMPILE_JAVAC) -source 1.4 -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -g -d $(SA_CLASSDIR) $(AGENT_FILES2:/=\) $(COMPILE_RMIC) -classpath $(SA_CLASSDIR) -d $(SA_CLASSDIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer - $(QUIETLY) echo $(SA_BUILD_VERSION_PROP) > $(SA_PROPERTIES) - $(RUN_JAR) cf $@ -C saclasses . - $(RUN_JAR) uf $@ -C $(AGENT_SRC_DIR:/=\) META-INF\services\com.sun.jdi.connect.Connector + $(QUIETLY) echo $(SA_BUILD_VERSION_PROP)> $(SA_PROPERTIES) $(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql/sa.js $(QUIETLY) cp $(AGENT_SRC_DIR)/sun/jvm/hotspot/utilities/soql/sa.js $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql - $(QUIETLY) mkdir -p $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources - $(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources/* - $(QUIETLY) cp $(AGENT_SRC_DIR)/sun/jvm/hotspot/ui/resources/*.png $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources/ - $(QUIETLY) cp -r $(AGENT_SRC_DIR)/images/* $(SA_CLASSDIR)/ + $(QUIETLY) rm -rf $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources + $(QUIETLY) mkdir $(SA_CLASSDIR)\sun\jvm\hotspot\ui\resources + $(QUIETLY) cp $(AGENT_SRC_DIR)/sun/jvm/hotspot/ui/resources/*.png $(SA_CLASSDIR)/sun/jvm/hotspot/ui/resources + $(QUIETLY) cp -r $(AGENT_SRC_DIR)/images/* $(SA_CLASSDIR) + $(RUN_JAR) cf $@ -C saclasses . + $(RUN_JAR) uf $@ -C $(AGENT_SRC_DIR:/=\) META-INF\services\com.sun.jdi.connect.Connector $(RUN_JAVAH) -classpath $(SA_CLASSDIR) -jni sun.jvm.hotspot.debugger.windbg.WindbgDebuggerLocal $(RUN_JAVAH) -classpath $(SA_CLASSDIR) -jni sun.jvm.hotspot.debugger.x86.X86ThreadContext $(RUN_JAVAH) -classpath $(SA_CLASSDIR) -jni sun.jvm.hotspot.debugger.ia64.IA64ThreadContext @@ -93,7 +96,7 @@ SA_LINK_FLAGS = bufferoverflowU.lib SA_CFLAGS = /nologo $(MS_RUNTIME_OPTION) /W3 /Gm $(GX_OPTION) /ZI /Od /D "WIN32" /D "_WINDOWS" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c !endif !if "$(MT)" != "" - SA_LINK_FLAGS = /manifest $(SA_LINK_FLAGS) +SA_LINK_FLAGS = /manifest $(SA_LINK_FLAGS) !endif SASRCFILE = $(AGENT_DIR)/src/os/win32/windbg/sawindbg.cpp SA_LFLAGS = $(SA_LINK_FLAGS) /nologo /subsystem:console /map /debug /machine:$(MACHINE) From b596dd66fa85b63eba932555175fd5b7c04c05ec Mon Sep 17 00:00:00 2001 From: Xueming Shen Date: Sat, 29 Nov 2008 20:55:29 -0800 Subject: [PATCH 164/267] 6725399: (ch) Channels.newInputStream should check for null Update to check null arg for all Channels methods Reviewed-by: alanb --- .../classes/java/nio/channels/Channels.java | 25 +++-- .../java/nio/channels/Channels/Basic.java | 105 ++++++++++++++++-- 2 files changed, 110 insertions(+), 20 deletions(-) diff --git a/jdk/src/share/classes/java/nio/channels/Channels.java b/jdk/src/share/classes/java/nio/channels/Channels.java index b259bd99150..cab96048629 100644 --- a/jdk/src/share/classes/java/nio/channels/Channels.java +++ b/jdk/src/share/classes/java/nio/channels/Channels.java @@ -65,6 +65,10 @@ public final class Channels { private Channels() { } // No instantiation + private static void checkNotNull(Object o, String name) { + if (o == null) + throw new NullPointerException("\"" + name + "\" is null!"); + } /** * Write all remaining bytes in buffer to the given channel. @@ -120,6 +124,7 @@ public final class Channels { * @return A new input stream */ public static InputStream newInputStream(ReadableByteChannel ch) { + checkNotNull(ch, "ch"); return new sun.nio.ch.ChannelInputStream(ch); } @@ -138,6 +143,8 @@ public final class Channels { * @return A new output stream */ public static OutputStream newOutputStream(final WritableByteChannel ch) { + checkNotNull(ch, "ch"); + return new OutputStream() { private ByteBuffer bb = null; @@ -193,9 +200,7 @@ public final class Channels { * @return A new readable byte channel */ public static ReadableByteChannel newChannel(final InputStream in) { - if (in == null) { - throw new NullPointerException(); - } + checkNotNull(in, "in"); if (in instanceof FileInputStream && FileInputStream.class.equals(in.getClass())) { @@ -270,9 +275,7 @@ public final class Channels { * @return A new writable byte channel */ public static WritableByteChannel newChannel(final OutputStream out) { - if (out == null) { - throw new NullPointerException(); - } + checkNotNull(out, "out"); if (out instanceof FileOutputStream && FileOutputStream.class.equals(out.getClass())) { @@ -357,8 +360,8 @@ public final class Channels { CharsetDecoder dec, int minBufferCap) { - dec.reset(); - return StreamDecoder.forDecoder(ch, dec, minBufferCap); + checkNotNull(ch, "ch"); + return StreamDecoder.forDecoder(ch, dec.reset(), minBufferCap); } /** @@ -393,6 +396,7 @@ public final class Channels { public static Reader newReader(ReadableByteChannel ch, String csName) { + checkNotNull(csName, "csName"); return newReader(ch, Charset.forName(csName).newDecoder(), -1); } @@ -425,8 +429,8 @@ public final class Channels { final CharsetEncoder enc, final int minBufferCap) { - enc.reset(); - return StreamEncoder.forEncoder(ch, enc, minBufferCap); + checkNotNull(ch, "ch"); + return StreamEncoder.forEncoder(ch, enc.reset(), minBufferCap); } /** @@ -461,6 +465,7 @@ public final class Channels { public static Writer newWriter(WritableByteChannel ch, String csName) { + checkNotNull(csName, "csName"); return newWriter(ch, Charset.forName(csName).newEncoder(), -1); } diff --git a/jdk/test/java/nio/channels/Channels/Basic.java b/jdk/test/java/nio/channels/Channels/Basic.java index 9d1a5dcd070..b4d3544b477 100644 --- a/jdk/test/java/nio/channels/Channels/Basic.java +++ b/jdk/test/java/nio/channels/Channels/Basic.java @@ -22,12 +22,13 @@ */ /* @test - * @bug 4417152 4481572 6248930 + * @bug 4417152 4481572 6248930 6725399 * @summary Test Channels basic functionality */ import java.io.*; import java.nio.*; +import java.nio.charset.*; import java.nio.channels.*; @@ -50,22 +51,106 @@ public class Basic { test(); } + static void failNpeExpected() { + throw new RuntimeException("Did not get the expected NullPointerException."); + } + private static void test() throws Exception { + //Test if methods of Channels throw NPE with null argument(s) + try { + Channels.newInputStream((ReadableByteChannel)null); + failNpeExpected(); + } catch (NullPointerException npe) {} + + try { + Channels.newOutputStream((WritableByteChannel)null); + failNpeExpected(); + } catch (NullPointerException npe) {} + try { ReadableByteChannel channel = Channels.newChannel((InputStream)null); - - throw new RuntimeException("Did not get the expected NullPointerException."); - } catch (NullPointerException ne) { - // OK. As expected. - } + failNpeExpected(); + } catch (NullPointerException ne) {} // OK. As expected. try { WritableByteChannel channel = Channels.newChannel((OutputStream)null); + failNpeExpected(); + } catch (NullPointerException ne) {} // OK. As expected. + + WritableByteChannel wbc = new WritableByteChannel() { + public int write(ByteBuffer src) { return 0; } + public void close() throws IOException { } + public boolean isOpen() { return true; } + }; + + ReadableByteChannel rbc = new ReadableByteChannel() { + public int read(ByteBuffer dst) { return 0; } + public void close() {} + public boolean isOpen() { return true; } + }; + + try { + Channels.newReader((ReadableByteChannel)null, + Charset.defaultCharset().newDecoder(), + -1); + failNpeExpected(); + } catch (NullPointerException npe) {} + + try { + Channels.newReader(rbc, (CharsetDecoder)null, -1); + failNpeExpected(); + } catch (NullPointerException npe) {} + + try { + Channels.newReader((ReadableByteChannel)null, + Charset.defaultCharset().name()); + failNpeExpected(); + } catch (NullPointerException npe) {} + + try { + Channels.newReader(rbc, null); + failNpeExpected(); + } catch (NullPointerException npe) {} + + + try { + Channels.newReader(null, null); + failNpeExpected(); + } catch (NullPointerException npe) {} + + try { + Channels.newWriter((WritableByteChannel)null, + Charset.defaultCharset().newEncoder(), + -1); + failNpeExpected(); + } catch (NullPointerException npe) {} + + try { + Channels.newWriter(null, null, -1); + failNpeExpected(); + } catch (NullPointerException npe) {} + + try { + Channels.newWriter(wbc, null, -1); + failNpeExpected(); + } catch (NullPointerException npe) {} + + try { + Channels.newWriter((WritableByteChannel)null, + Charset.defaultCharset().name()); + failNpeExpected(); + } catch (NullPointerException npe) {} + + try { + Channels.newWriter(wbc, null); + failNpeExpected(); + } catch (NullPointerException npe) {} + + try { + Channels.newWriter(null, null); + failNpeExpected(); + } catch (NullPointerException npe) {} - throw new RuntimeException("Did not get the expected NullPointerException."); - } catch (NullPointerException ne) { - // OK. As expected. - } try { blah = File.createTempFile("blah", null); From 69e0e018d47d18992375dd4d17fd87f8efd95148 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 1 Dec 2008 12:15:14 -0800 Subject: [PATCH 165/267] 6778493: Fix (langtools) ant build to honor fcs MILESTONE setting Reviewed-by: ohair --- langtools/make/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/langtools/make/Makefile b/langtools/make/Makefile index afb845b1b2e..2f382a12fba 100644 --- a/langtools/make/Makefile +++ b/langtools/make/Makefile @@ -82,7 +82,11 @@ ifdef FULL_VERSION endif ifdef MILESTONE +ifneq ($(MILESTONE),fcs) ANT_OPTIONS += -Dmilestone=$(MILESTONE) +else + ANT_OPTIONS += -Drelease=$(JDK_VERSION) +endif endif ifdef BUILD_NUMBER From d039601207c70da51ba6c72b5298378b84d2b450 Mon Sep 17 00:00:00 2001 From: Kelly O'Hair Date: Mon, 1 Dec 2008 15:28:36 -0800 Subject: [PATCH 166/267] 6750229: Upgrade Recommended Linux and Windows Build OS Reviewed-by: xdono --- README-builds.html | 488 +++++++++++++++++++++------------------------ 1 file changed, 232 insertions(+), 256 deletions(-) diff --git a/README-builds.html b/README-builds.html index 8783bf8bde2..ce77a659f11 100644 --- a/README-builds.html +++ b/README-builds.html @@ -98,7 +98,8 @@

      Minimum Build Environments

      This file often describes specific requirements for what we call the - "minimum build environments" (MBE) for the JDK. + "minimum build environments" (MBE) for this + specific release of the JDK, Building with the MBE will generate the most compatible bits that install on, and run correctly on, the most variations of the same base OS and hardware architecture. @@ -116,22 +117,22 @@ Base OS and Architecture OS - Compiler + C/C++ Compiler - Linux X86 (32bit) - Red Hat Enterprise Linux 4 + Linux X86 (32-bit) + Fedora 9 gcc 4 - Linux X64 (64bit) - Red Hat Enterprise Linux 4 + Linux X64 (64-bit) + Fedora 9 gcc 4 - Solaris SPARC (32bit) + Solaris SPARC (32-bit) Solaris 10 + patches
      See @@ -140,7 +141,7 @@ Sun Studio 12 - Solaris SPARCV9 (64bit) + Solaris SPARCV9 (64-bit) Solaris 10 + patches
      See
      @@ -149,7 +150,7 @@ Sun Studio 12 - Solaris X86 (32bit) + Solaris X86 (32-bit) Solaris 10 + patches
      See
      @@ -158,7 +159,7 @@ Sun Studio 12 - Solaris X64 (64bit) + Solaris X64 (64-bit) Solaris 10 + patches
      See
      @@ -167,17 +168,28 @@ Sun Studio 12 - Windows X86 (32bit) + Windows X86 (32-bit) Windows XP - Microsoft Visual Studio .NET 2003 Professional + Microsoft Visual Studio C++ 2008 Standard Edition - Windows X64 (64bit) + Windows X64 (64-bit) Windows Server 2003 - Enterprise x64 Edition Microsoft Platform SDK - April 2005 +

      + These same sources do indeed build on many more systems than the + above older generation systems, again the above is just a minimum. +

      + Compilation problems with newer or different C/C++ compilers is a + common problem. + Similarly, compilation problems related to changes to the + /usr/include or system header files is also a + common problem with newer or unreleased OS versions. + Please report these types of problems as bugs so that they + can be dealt with accordingly.


      @@ -488,7 +500,7 @@ not work due to a lack of support for MS-DOS drive letter paths like C:/ or C:\. Use a 3.80 version, or find a newer - version that has this problem fixed, like 3.82. + version that has this problem fixed. The older 3.80 version of make.exe can be downloaded with this
      link. @@ -575,8 +587,8 @@
    • Install - Ant, set - ANT_HOME. + Ant, + make sure it is in your PATH.
    • @@ -592,7 +604,7 @@ Approximately 1.4 GB of free disk space is needed for a 32-bit build.

      - If you are building the 64bit version, you should + If you are building the 64-bit version, you should run the command "isainfo -v" to verify that you have a 64-bit installation, it should say sparcv9 or amd64. @@ -640,8 +652,8 @@

    • Install - Ant, set - ANT_HOME. + Ant, + make sure it is in your PATH.
    • @@ -650,11 +662,11 @@

      Basic Windows System Setup

      i586 only: - The minimum recommended hardware for building the 32bit or X86 + The minimum recommended hardware for building the 32-bit or X86 Windows version is an Pentium class processor or better, at least 512 MB of RAM, and approximately 600 MB of free disk space. - NOTE: The Windows 2000 build machines need to use the + NOTE: The Windows build machines need to use the file system NTFS. Build machines formatted to FAT32 will not work because FAT32 doesn't support case-sensitivity in file names. @@ -719,8 +731,11 @@
    • Install the - Microsoft Visual Studio .NET 2003 Professional (32bit) or the - Microsoft Platform SDK (64bit). + Microsoft Visual Studio Compilers (32-bit). +
    • +
    • + Install the + Microsoft Platform SDK.
    • Setup all environment variables for compilers @@ -732,7 +747,8 @@
    • Install - Ant, set + Ant, + make sure it is in your PATH and set ANT_HOME.
    • @@ -787,7 +803,9 @@ you must first download and install the appropriate binary plug bundles for the OpenJDK, go to the OpenJDK site and select - the "Bundles(7)" link and download the binaryplugs for + the + "Bundles(7)" + link and download the binaryplugs for your particular platform. The file downloaded is a jar file that must be extracted by running the jar file with: @@ -823,14 +841,12 @@ The Ant tool is available from the Ant download site. - You should always set + You should always make sure ant is in your PATH, and + on Windows you may also need to set ANT_HOME to point to the location of the Ant installation, this is the directory pathname that contains a bin and lib. - It's also a good idea to also place its bin directory - in the PATH environment variable, although it's - not absolutely required.

      Certificate Authority File (cacert)

      @@ -862,25 +878,9 @@
      Linux gcc/binutils
      - The GNU gcc compiler version should be 3.2.2 or newer. - The binutils package should be 2.11.93.0.2-11 or newer. + The GNU gcc compiler version should be 4 or newer. The compiler used should be the default compiler installed in /usr/bin. -

      - Older Linux systems may require a gcc and bunutils update. - The Redhat Enterprise Advanced Server 2.1 update 2 system - is one of these systems. - RedHat Linux users can obtain this binutils package from - Redhat web site. - You will need to remove the default compiler and binutils - packages and install the required packages - into the default location on the system. - However if you have a new video card driver, like - Geforce 4 it is best to use - the same compiler as the kernel was built with to - build the new video card driver module. - So you should build the modules before making this change.

      Solaris: Sun Studio
      @@ -903,19 +903,20 @@ are also an option, although these compilers have not been extensively used yet.
      - Windows i586: Microsoft Visual Studio .NET 2003 Professional + Windows i586: Microsoft Visual Studio Compilers
      The 32-bit OpenJDK Windows build - requires Microsoft Visual Studio .NET 2003 (VS2003) Professional + requires + Microsoft Visual Studio C++ 2008 (VS2008) Standard Edition compiler. The compiler and other tools are expected to reside - in the location defined by the variable VS71COMNTOOLS which - is set by the Microsoft Visual Studio .NET installer. + in the location defined by the variable + VS90COMNTOOLS which + is set by the Microsoft Visual Studio installer.

      Once the compiler is installed, it is recommended that you run VCVARS32.BAT to set the compiler environment variables - MSVCDIR, INCLUDE, LIB, and PATH @@ -923,16 +924,12 @@ OpenJDK. The above environment variables MUST be set.

      - The Microsoft Visual Studio .NET 2005 (VS2005) compiler - will not work at this time due to the new runtime dll - and the manifest requirements. -

      WARNING: Make sure you check out the CYGWIN link.exe WARNING. The path /usr/bin must be after the path to the Visual Studio product.

      - Windows X64: Microsoft Platform SDK April 2005 + Windows: Microsoft Platform SDK
      On X64, the Microsoft Platform Software Development Kit (SDK), April 2005 Edition compiler, @@ -953,10 +950,9 @@ OpenJDK. The above environment variables MUST be set.

      - Note that this compiler may say it's version is a - Microsoft Visual Studio .NET 2005 (VS2005), but be careful, - it will not match the official VS2005 product. - This Platform SDK compiler is only used on X64 builds. + This Platform SDK compiler is only used on X64 builds + but other parts of the Platform SDK may be used + for the X86 builds.

      @@ -1241,37 +1237,37 @@ MSVCRT.DLL
      i586 only: - The OpenJDK 32bit build requires access to - MSVCRT.DLL version 6.00.8337.0 or newer. + The OpenJDK 32-bit build requires access to a redistributable + MSVCRT.DLL. If the MSVCRT.DLL is not installed in the system32 directory set the ALT_MSVCRT_DLL_PATH - variable to the location. + variable to the location of this file.

      X64 only: - The OpenJDK 64bit build requires access to - MSVCRT.DLL version 7.0.3790.0 or newer, which is + The OpenJDK 64-bit build requires access to a redistributable + MSVCRT.DLL, which is usually supplied by the Platform SDK. If it is not available from the Platform SDK, set the ALT_MSVCRT_DLL_PATH - variable to the location. + variable to the location of this file.

      - MSVCR71.DLL + MSVCR90.DLL
      i586 only: The OpenJDK - build requires access to - MSVCR71.DLL version 7.10.3052.4 or newer which should be + build requires access to a redistributable + MSVCR90.DLL which should be supplied by the - Visual Studio product - If the MSVCR71.DLL is not available from the + Visual Studio product. + If the MSVCR90.DLL is not available from the Visual Studio product set the - ALT_MSVCR71_DLL_PATH - variable to the location. + ALT_MSVCR90_DLL_PATH + variable to the location of this file.
      @@ -1359,13 +1355,38 @@ document) that can impact the build are:
      -
      ALT_BINARY_PLUGS_PATH
      +
      PATH
      +
      Typically you want to set the PATH to include: +
        +
      • The location of the GNU make binary
      • +
      • The location of the Bootstrap JDK java + (see Bootstrap JDK)
      • +
      • The location of the C/C++ compilers + (see compilers)
      • +
      • The location or locations for the Unix command utilities + (e.g. /usr/bin)
      • +
      +
      +
      MILESTONE
      - The location of the binary plugs installation. - See Binary Plugs for more information. - You should always have a local copy of a - recent Binary Plugs install image - and set this variable to that location. + The milestone name for the build (e.g."beta"). + The default value is "internal". +
      +
      BUILD_NUMBER
      +
      + The build number for the build (e.g. "b27"). + The default value is "b00". +
      +
      ARCH_DATA_MODEL
      +
      The ARCH_DATA_MODEL variable + is used to specify whether the build is to generate 32-bit or 64-bit + binaries. + The Solaris build supports either 32-bit or 64-bit builds, but + Windows and Linux will support only one, depending on the specific + OS being used. + Normally, setting this variable is only necessary on Solaris. + Set ARCH_DATA_MODEL to 32 for generating 32-bit binaries, + or to 64 for generating 64-bit binaries.
      ALT_BOOTDIR
      @@ -1374,25 +1395,89 @@ You should always install your own local Bootstrap JDK and always set ALT_BOOTDIR explicitly.
      -
      ALT_BUILD_BINARY_PLUGS_PATH
      +
      ALT_BINARY_PLUGS_PATH
      - These are useful in managing builds on multiple platforms. - The default network location for all of the binary plug images - for all platforms. - If ALT_BINARY_PLUGS_PATH - is not set, this directory will be used and should contain - the following directories: - solaris-sparc, - solaris-i586, - solaris-sparcv9, - solaris-amd64, - linux-i586, - linux-amd64, - windows-i586, - and - windows-amd64. - Where each of these directories contain the binary plugs image - for that platform. + The location of the binary plugs installation. + See Binary Plugs for more information. + You should always have a local copy of a + recent Binary Plugs install image + and set this variable to that location. +
      +
      ALT_JDK_IMPORT_PATH
      +
      + The location of a previously built JDK installation. + See Optional Import JDK for more information. +
      +
      ALT_OUTPUTDIR
      +
      + An override for specifying the (absolute) path of where the + build output is to go. + The default output directory will be build/platform. +
      +
      ALT_COMPILER_PATH
      +
      + The location of the C/C++ compiler. + The default varies depending on the platform. +
      +
      ALT_CACERTS_FILE
      +
      + The location of the cacerts file. + The default will refer to + jdk/src/share/lib/security/cacerts. +
      +
      ALT_CUPS_HEADERS_PATH
      +
      + The location of the CUPS header files. + See CUPS information for more information. + If this path does not exist the fallback path is + /usr/include. +
      +
      ALT_FREETYPE_LIB_PATH
      +
      + The location of the FreeType shared library. + See FreeType information for details. +
      +
      ALT_FREETYPE_HEADERS_PATH
      +
      + The location of the FreeType header files. + See FreeType information for details. +
      +
      ALT_JDK_DEVTOOLS_PATH
      +
      + The default root location of the devtools. + The default value is + $(ALT_SLASH_JAVA)/devtools. +
      +
      ALT_DEVTOOLS_PATH
      +
      + The location of tools like the + zip and unzip + binaries, but might also contain the GNU make utility + (gmake). + So this area is a bit of a grab bag, especially on Windows. + The default value depends on the platform and + Unix Commands being used. + On Linux the default will be + $(ALT_JDK_DEVTOOLS_PATH)/linux/bin, + on Solaris + $(ALT_JDK_DEVTOOLS_PATH)/{sparc,i386}/bin, + and on Windows with CYGWIN + /usr/bin. +
      +
      ALT_UNIXCCS_PATH
      +
      + Solaris only: + An override for specifying where the Unix CCS + command set are located. + The default location is /usr/ccs/bin +
      +
      ALT_SLASH_JAVA
      +
      + The default root location for many of the ALT path locations + of the following ALT variables. + The default value is + "/java" on Solaris and Linux, + "J:" on Windows.
      ALT_BUILD_JDK_IMPORT_PATH
      @@ -1414,166 +1499,57 @@ Where each of these directories contain the import JDK image for that platform.
      -
      ALT_CACERTS_FILE
      +
      ALT_BUILD_BINARY_PLUGS_PATH
      - The location of the cacerts file. - The default will refer to - jdk/src/share/lib/security/cacerts. + These are useful in managing builds on multiple platforms. + The default network location for all of the binary plug images + for all platforms. + If ALT_BINARY_PLUGS_PATH + is not set, this directory will be used and should contain + the following directories: + solaris-sparc, + solaris-i586, + solaris-sparcv9, + solaris-amd64, + linux-i586, + linux-amd64, + windows-i586, + and + windows-amd64. + Where each of these directories contain the binary plugs image + for that platform.
      -
      ALT_COMPILER_PATH
      +
      Windows specific:
      - The location of the C/C++ compiler. - The default varies depending on the platform. -
      -
      ALT_CUPS_HEADERS_PATH
      -
      - The location of the CUPS header files. - See CUPS information for more information. - If this path does not exist the fallback path is - /usr/include. -
      -
      ALT_DEVTOOLS_PATH
      -
      - The location of tools like the - zip and unzip - binaries, but might also contain the GNU make utility - (gmake). - So this area is a bit of a grab bag, especially on Windows. - The default value depends on the platform and - Unix Commands being used. - On Linux the default will be - $(ALT_JDK_DEVTOOLS_PATH)/linux/bin, - on Solaris - $(ALT_JDK_DEVTOOLS_PATH)/{sparc,i386}/bin, - on Windows with MKS - %SYSTEMDRIVE%/UTILS, - and on Windows with CYGWIN - /usr/bin. -
      -
      ALT_DXSDK_PATH
      -
      - Windows Only: - The location of the - Microsoft DirectX 9 SDK. - The default will be to try and use the DirectX environment - variable DXSDK_DIR, - failing that, look in C:/DXSDK. -
      -
      ALT_FREETYPE_HEADERS_PATH
      -
      - The location of the FreeType header files. - See FreeType information for details. -
      -
      ALT_FREETYPE_LIB_PATH
      -
      - The location of the FreeType shared library. - See FreeType information for details. -
      -
      ALT_JDK_DEVTOOLS_PATH
      -
      - The default root location of the devtools. - The default value is - $(ALT_SLASH_JAVA)/devtools. -
      -
      ALT_JDK_IMPORT_PATH
      -
      - The location of a previously built JDK installation. - See Optional Import JDK for more information. -
      -
      ALT_MSDEVTOOLS_PATH
      -
      - Windows Only: - The location of the Microsoft Visual Studio .NET 2003 - tools 'bin' directory. - The default is usually derived from - ALT_COMPILER_PATH. -
      -
      ALT_MSVCR71_DLL_PATH
      -
      - Windows i586 only: - The location of the - MSVCR71.DLL. -
      -
      ALT_MSVCRT_DLL_PATH
      -
      - Windows Only: - The location of the - MSVCRT.DLL. -
      -
      ALT_OUTPUTDIR
      -
      - An override for specifying the (absolute) path of where the - build output is to go. - The default output directory will be build/platform. -
      -
      ALT_SLASH_JAVA
      -
      - The default root location for many of the ALT path locations - of the following ALT variables. - The default value is - "/java" on Solaris and Linux, - "J:" on Windows. -
      -
      ALT_UNIXCCS_PATH
      -
      - Solaris only: - An override for specifying where the Unix CCS - command set are located. - The default location is /usr/ccs/bin -
      -
      ALT_UNIXCOMMAND_PATH
      -
      - An override for specifying where the - Unix command set are located. - The default location varies depending on the platform, - "%SYSTEMDRIVE%/MKSNT" or - $(ROOTDIR) on Windows with MKS, otherwise it's - "/bin" or /usr/bin. -
      -
      ALT_USRBIN_PATH
      -
      - An override for specifying where the - Unix /usr/bin commands are located. You usually do not need - to set this variable: the default location is /usr/bin) -
      -
      ANT_HOME
      -
      - The location of the Ant installation. - See Ant for more information. - You should always set ANT_HOME explicitly. -
      -
      ARCH_DATA_MODEL
      -
      The ARCH_DATA_MODEL variable - is used to specify whether the build is to generate 32-bit or 64-bit - binaries. - The Solaris build supports either 32-bit or 64-bit builds, but - Windows and Linux will support only one, depending on the specific - OS being used. - Normally, setting this variable is only necessary on Solaris. - Set ARCH_DATA_MODEL to 32 for generating 32-bit binaries, - or to 64 for generating 64-bit binaries. -
      -
      BUILD_NUMBER
      -
      - The build number for the build (e.g. "b27"). - The default value is "b00". -
      -
      MILESTONE
      -
      - The milestone name for the build (e.g."beta"). - The default value is "internal". -
      -
      PATH
      -
      Typically you want to set the PATH to include: -
        -
      • The location of the GNU make binary
      • -
      • The location of the Bootstrap JDK java - (see Bootstrap JDK)
      • -
      • The location of the C/C++ compilers - (see compilers)
      • -
      • The location or locations for the Unix command utilities - (e.g. /usr/bin)
      • -
      +
      +
      ALT_MSDEVTOOLS_PATH
      +
      + The location of the + Microsoft Visual Studio + tools 'bin' directory. + The default is usually derived from + ALT_COMPILER_PATH. +
      +
      ALT_DXSDK_PATH
      +
      + The location of the + Microsoft DirectX 9 SDK. + The default will be to try and use the DirectX environment + variable DXSDK_DIR, + failing that, look in C:/DXSDK. +
      +
      ALT_MSVCRT_DLL_PATH
      +
      + The location of the + MSVCRT.DLL. +
      +
      ALT_MSVCR90_DLL_PATH
      +
      + i586 only: + The location of the + MSVCR90.DLL. +
      +
      @@ -1661,8 +1637,8 @@ This is caused by a missing libstdc++.a library. This is installed as part of a specific package (e.g. libstdc++.so.devel.386). - By default some 64bit Linux versions (e.g. Fedora) - only install the 64bit version of the libstdc++ package. + By default some 64-bit Linux versions (e.g. Fedora) + only install the 64-bit version of the libstdc++ package. Various parts of the JDK build require a static link of the C++ runtime libraries to allow for maximum portability of the built images. From 16aa57cb4b28dc63269976c825f7df827688c7ed Mon Sep 17 00:00:00 2001 From: "Y. Srinivas Ramakrishna" Date: Mon, 1 Dec 2008 23:25:24 -0800 Subject: [PATCH 167/267] 6778647: snap(), snap_policy() should be renamed setup(), setup_policy() Renamed Reference{Policy,Pocessor} methods from snap{,_policy}() to setup{,_policy}() Reviewed-by: apetrusenko --- .../concurrentMarkSweep/concurrentMarkSweepGeneration.cpp | 6 +++--- .../src/share/vm/gc_implementation/g1/concurrentMark.cpp | 4 ++-- .../src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp | 2 +- hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp | 4 ++-- .../vm/gc_implementation/parNew/parNewGeneration.cpp | 2 +- .../vm/gc_implementation/parallelScavenge/psMarkSweep.cpp | 4 ++-- .../parallelScavenge/psParallelCompact.cpp | 2 +- .../vm/gc_implementation/parallelScavenge/psScavenge.cpp | 4 ++-- hotspot/src/share/vm/memory/defNewGeneration.cpp | 2 +- hotspot/src/share/vm/memory/genCollectedHeap.cpp | 2 +- hotspot/src/share/vm/memory/genMarkSweep.cpp | 4 ++-- hotspot/src/share/vm/memory/referencePolicy.cpp | 8 ++++---- hotspot/src/share/vm/memory/referencePolicy.hpp | 6 +++--- hotspot/src/share/vm/memory/referenceProcessor.cpp | 2 +- hotspot/src/share/vm/memory/referenceProcessor.hpp | 4 ++-- 15 files changed, 28 insertions(+), 28 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp index e2e27c0f353..e8344107659 100644 --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp @@ -1961,7 +1961,7 @@ void CMSCollector::do_compaction_work(bool clear_all_soft_refs) { ref_processor()->set_enqueuing_is_done(false); ref_processor()->enable_discovery(); - ref_processor()->snap_policy(clear_all_soft_refs); + ref_processor()->setup_policy(clear_all_soft_refs); // If an asynchronous collection finishes, the _modUnionTable is // all clear. If we are assuming the collection from an asynchronous // collection, clear the _modUnionTable. @@ -2386,7 +2386,7 @@ void CMSCollector::collect_in_foreground(bool clear_all_soft_refs) { } // Snapshot the soft reference policy to be used in this collection cycle. - ref_processor()->snap_policy(clear_all_soft_refs); + ref_processor()->setup_policy(clear_all_soft_refs); bool init_mark_was_synchronous = false; // until proven otherwise while (_collectorState != Idling) { @@ -5683,7 +5683,7 @@ void CMSCollector::refProcessingWork(bool asynch, bool clear_all_soft_refs) { assert(rp->span().equals(_span), "Spans should be equal"); assert(!rp->enqueuing_is_done(), "Enqueuing should not be complete"); // Process weak references. - rp->snap_policy(clear_all_soft_refs); + rp->setup_policy(clear_all_soft_refs); verify_work_stacks_empty(); CMSKeepAliveClosure cmsKeepAliveClosure(this, _span, &_markBitMap, diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp index 65f64e2ad16..646804205c7 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp @@ -811,7 +811,7 @@ void ConcurrentMark::checkpointRootsInitialPost() { ReferenceProcessor* rp = g1h->ref_processor(); rp->verify_no_references_recorded(); rp->enable_discovery(); // enable ("weak") refs discovery - rp->snap_policy(false); // snapshot the soft ref policy to be used in this cycle + rp->setup_policy(false); // snapshot the soft ref policy to be used in this cycle SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set(); satb_mq_set.set_process_completed_threshold(G1SATBProcessCompletedThreshold); @@ -1834,7 +1834,7 @@ void ConcurrentMark::weakRefsWork(bool clear_all_soft_refs) { ReferenceProcessor* rp = g1h->ref_processor(); // Process weak references. - rp->snap_policy(clear_all_soft_refs); + rp->setup_policy(clear_all_soft_refs); assert(_markStack.isEmpty(), "mark stack should be empty"); G1CMIsAliveClosure g1IsAliveClosure (g1h); diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index 5aaa483b91c..f0cad8ed231 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -891,7 +891,7 @@ void G1CollectedHeap::do_collection(bool full, bool clear_all_soft_refs, ReferenceProcessorIsAliveMutator rp_is_alive_null(ref_processor(), NULL); ref_processor()->enable_discovery(); - ref_processor()->snap_policy(clear_all_soft_refs); + ref_processor()->setup_policy(clear_all_soft_refs); // Do collection work { diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp index 4aa08a2319e..d94c6f97cc6 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp @@ -35,7 +35,7 @@ void G1MarkSweep::invoke_at_safepoint(ReferenceProcessor* rp, assert(GenMarkSweep::ref_processor() == NULL, "no stomping"); assert(rp != NULL, "should be non-NULL"); GenMarkSweep::_ref_processor = rp; - rp->snap_policy(clear_all_softrefs); + rp->setup_policy(clear_all_softrefs); // When collecting the permanent generation methodOops may be moving, // so we either have to flush all bcp data or convert it into bci. @@ -123,7 +123,7 @@ void G1MarkSweep::mark_sweep_phase1(bool& marked_for_unloading, // Process reference objects found during marking ReferenceProcessor* rp = GenMarkSweep::ref_processor(); - rp->snap_policy(clear_all_softrefs); + rp->setup_policy(clear_all_softrefs); rp->process_discovered_references(&GenMarkSweep::is_alive, &GenMarkSweep::keep_alive, &GenMarkSweep::follow_stack_closure, diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp index 0c0196f253d..72907679905 100644 --- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp +++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp @@ -773,7 +773,7 @@ void ParNewGeneration::collect(bool full, set_promo_failure_scan_stack_closure(&scan_without_gc_barrier); EvacuateFollowersClosureGeneral evacuate_followers(gch, _level, &scan_without_gc_barrier, &scan_with_gc_barrier); - rp->snap_policy(clear_all_soft_refs); + rp->setup_policy(clear_all_soft_refs); if (rp->processing_is_mt()) { ParNewRefProcTaskExecutor task_executor(*this, thread_state_set); rp->process_discovered_references(&is_alive, &keep_alive, diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp index 5134f47e7a5..ea0c20b0148 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp @@ -172,7 +172,7 @@ void PSMarkSweep::invoke_no_policy(bool clear_all_softrefs) { COMPILER2_PRESENT(DerivedPointerTable::clear()); ref_processor()->enable_discovery(); - ref_processor()->snap_policy(clear_all_softrefs); + ref_processor()->setup_policy(clear_all_softrefs); mark_sweep_phase1(clear_all_softrefs); @@ -518,7 +518,7 @@ void PSMarkSweep::mark_sweep_phase1(bool clear_all_softrefs) { // Process reference objects found during marking { - ref_processor()->snap_policy(clear_all_softrefs); + ref_processor()->setup_policy(clear_all_softrefs); ref_processor()->process_discovered_references( is_alive_closure(), mark_and_push_closure(), follow_stack_closure(), NULL); } diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp index 9ca6b6c804c..1ad78f84c56 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp @@ -1578,7 +1578,7 @@ void PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) { COMPILER2_PRESENT(DerivedPointerTable::clear()); ref_processor()->enable_discovery(); - ref_processor()->snap_policy(maximum_heap_compaction); + ref_processor()->setup_policy(maximum_heap_compaction); bool marked_for_unloading = false; diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp index 4aa7d5afe38..6357362b0f7 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp @@ -330,7 +330,7 @@ bool PSScavenge::invoke_no_policy() { COMPILER2_PRESENT(DerivedPointerTable::clear()); reference_processor()->enable_discovery(); - reference_processor()->snap_policy(false); + reference_processor()->setup_policy(false); // We track how much was promoted to the next generation for // the AdaptiveSizePolicy. @@ -395,7 +395,7 @@ bool PSScavenge::invoke_no_policy() { // Process reference objects discovered during scavenge { - reference_processor()->snap_policy(false); // not always_clear + reference_processor()->setup_policy(false); // not always_clear PSKeepAliveClosure keep_alive(promotion_manager); PSEvacuateFollowersClosure evac_followers(promotion_manager); if (reference_processor()->processing_is_mt()) { diff --git a/hotspot/src/share/vm/memory/defNewGeneration.cpp b/hotspot/src/share/vm/memory/defNewGeneration.cpp index e953e7545b5..93a2e57e346 100644 --- a/hotspot/src/share/vm/memory/defNewGeneration.cpp +++ b/hotspot/src/share/vm/memory/defNewGeneration.cpp @@ -567,7 +567,7 @@ void DefNewGeneration::collect(bool full, FastKeepAliveClosure keep_alive(this, &scan_weak_ref); ReferenceProcessor* rp = ref_processor(); - rp->snap_policy(clear_all_soft_refs); + rp->setup_policy(clear_all_soft_refs); rp->process_discovered_references(&is_alive, &keep_alive, &evacuate_followers, NULL); if (!promotion_failed()) { diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.cpp b/hotspot/src/share/vm/memory/genCollectedHeap.cpp index f411d4d7bfa..832a3331e19 100644 --- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp +++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp @@ -525,7 +525,7 @@ void GenCollectedHeap::do_collection(bool full, if (rp->discovery_is_atomic()) { rp->verify_no_references_recorded(); rp->enable_discovery(); - rp->snap_policy(clear_all_soft_refs); + rp->setup_policy(clear_all_soft_refs); } else { // collect() below will enable discovery as appropriate } diff --git a/hotspot/src/share/vm/memory/genMarkSweep.cpp b/hotspot/src/share/vm/memory/genMarkSweep.cpp index f0c41d75c00..ba42d5d2143 100644 --- a/hotspot/src/share/vm/memory/genMarkSweep.cpp +++ b/hotspot/src/share/vm/memory/genMarkSweep.cpp @@ -33,7 +33,7 @@ void GenMarkSweep::invoke_at_safepoint(int level, ReferenceProcessor* rp, assert(ref_processor() == NULL, "no stomping"); assert(rp != NULL, "should be non-NULL"); _ref_processor = rp; - rp->snap_policy(clear_all_softrefs); + rp->setup_policy(clear_all_softrefs); TraceTime t1("Full GC", PrintGC && !PrintGCDetails, true, gclog_or_tty); @@ -246,7 +246,7 @@ void GenMarkSweep::mark_sweep_phase1(int level, // Process reference objects found during marking { - ref_processor()->snap_policy(clear_all_softrefs); + ref_processor()->setup_policy(clear_all_softrefs); ref_processor()->process_discovered_references( &is_alive, &keep_alive, &follow_stack_closure, NULL); } diff --git a/hotspot/src/share/vm/memory/referencePolicy.cpp b/hotspot/src/share/vm/memory/referencePolicy.cpp index 0d23d1ddf36..26aef4a2fd4 100644 --- a/hotspot/src/share/vm/memory/referencePolicy.cpp +++ b/hotspot/src/share/vm/memory/referencePolicy.cpp @@ -26,11 +26,11 @@ # include "incls/_referencePolicy.cpp.incl" LRUCurrentHeapPolicy::LRUCurrentHeapPolicy() { - snap(); + setup(); } // Capture state (of-the-VM) information needed to evaluate the policy -void LRUCurrentHeapPolicy::snap() { +void LRUCurrentHeapPolicy::setup() { _max_interval = (Universe::get_heap_free_at_last_gc() / M) * SoftRefLRUPolicyMSPerMB; assert(_max_interval >= 0,"Sanity check"); } @@ -52,11 +52,11 @@ bool LRUCurrentHeapPolicy::should_clear_reference(oop p) { /////////////////////// MaxHeap ////////////////////// LRUMaxHeapPolicy::LRUMaxHeapPolicy() { - snap(); + setup(); } // Capture state (of-the-VM) information needed to evaluate the policy -void LRUMaxHeapPolicy::snap() { +void LRUMaxHeapPolicy::setup() { size_t max_heap = MaxHeapSize; max_heap -= Universe::get_heap_used_at_last_gc(); max_heap /= M; diff --git a/hotspot/src/share/vm/memory/referencePolicy.hpp b/hotspot/src/share/vm/memory/referencePolicy.hpp index 538ab183a0c..2cf22c825ab 100644 --- a/hotspot/src/share/vm/memory/referencePolicy.hpp +++ b/hotspot/src/share/vm/memory/referencePolicy.hpp @@ -30,7 +30,7 @@ class ReferencePolicy : public CHeapObj { public: virtual bool should_clear_reference(oop p) { ShouldNotReachHere(); return true; } // Capture state (of-the-VM) information needed to evaluate the policy - virtual void snap() { /* do nothing */ } + virtual void setup() { /* do nothing */ } }; class NeverClearPolicy : public ReferencePolicy { @@ -51,7 +51,7 @@ class LRUCurrentHeapPolicy : public ReferencePolicy { LRUCurrentHeapPolicy(); // Capture state (of-the-VM) information needed to evaluate the policy - void snap(); + void setup(); bool should_clear_reference(oop p); }; @@ -63,6 +63,6 @@ class LRUMaxHeapPolicy : public ReferencePolicy { LRUMaxHeapPolicy(); // Capture state (of-the-VM) information needed to evaluate the policy - void snap(); + void setup(); bool should_clear_reference(oop p); }; diff --git a/hotspot/src/share/vm/memory/referenceProcessor.cpp b/hotspot/src/share/vm/memory/referenceProcessor.cpp index 648fbbd4736..073886f2f93 100644 --- a/hotspot/src/share/vm/memory/referenceProcessor.cpp +++ b/hotspot/src/share/vm/memory/referenceProcessor.cpp @@ -115,7 +115,7 @@ ReferenceProcessor::create_ref_processor(MemRegion span, vm_exit_during_initialization("Could not allocate ReferenceProcessor object"); } rp->set_is_alive_non_header(is_alive_non_header); - rp->snap_policy(false /* default soft ref policy */); + rp->setup_policy(false /* default soft ref policy */); return rp; } diff --git a/hotspot/src/share/vm/memory/referenceProcessor.hpp b/hotspot/src/share/vm/memory/referenceProcessor.hpp index d4ebec200fa..6d82e524d8a 100644 --- a/hotspot/src/share/vm/memory/referenceProcessor.hpp +++ b/hotspot/src/share/vm/memory/referenceProcessor.hpp @@ -98,10 +98,10 @@ class ReferenceProcessor : public CHeapObj { DiscoveredList* discovered_soft_refs() { return _discoveredSoftRefs; } static oop sentinel_ref() { return _sentinelRef; } static oop* adr_sentinel_ref() { return &_sentinelRef; } - ReferencePolicy* snap_policy(bool always_clear) { + ReferencePolicy* setup_policy(bool always_clear) { _current_soft_ref_policy = always_clear ? _always_clear_soft_ref_policy : _default_soft_ref_policy; - _current_soft_ref_policy->snap(); // snapshot the policy threshold + _current_soft_ref_policy->setup(); // snapshot the policy threshold return _current_soft_ref_policy; } From 9ed32847660bcd0a09a6f547f8ea6241cc3c7b79 Mon Sep 17 00:00:00 2001 From: Jonathan Gibbons Date: Tue, 2 Dec 2008 14:35:22 -0800 Subject: [PATCH 168/267] 6778638: javadoc regression tests require tabs Reviewed-by: darcy --- .../javadoc/testSourceTab/DoubleTab/C.java | 18 ++--- .../javadoc/testSourceTab/SingleTab/C.java | 18 ++--- .../javadoc/testSourceTab/TestSourceTab.java | 75 +++++++++++++++---- 3 files changed, 77 insertions(+), 34 deletions(-) diff --git a/langtools/test/com/sun/javadoc/testSourceTab/DoubleTab/C.java b/langtools/test/com/sun/javadoc/testSourceTab/DoubleTab/C.java index eb0f2fa312c..ea9d15f132e 100644 --- a/langtools/test/com/sun/javadoc/testSourceTab/DoubleTab/C.java +++ b/langtools/test/com/sun/javadoc/testSourceTab/DoubleTab/C.java @@ -1,4 +1,4 @@ -/* +/* * Copyright 2002-2004 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,15 +23,15 @@ /** *
      - * 		This source
      - * 		is indented
      - * 		with tabs.
      + * \t\tThis source
      + * \t\tis indented
      + * \t\twith tabs.
        * 
      */ public class C { - - //This source - //is indented - //with tabs. - + +\t\t//This source +\t\t//is indented +\t\t//with tabs. + } diff --git a/langtools/test/com/sun/javadoc/testSourceTab/SingleTab/C.java b/langtools/test/com/sun/javadoc/testSourceTab/SingleTab/C.java index 3acafe93fee..990d927185a 100644 --- a/langtools/test/com/sun/javadoc/testSourceTab/SingleTab/C.java +++ b/langtools/test/com/sun/javadoc/testSourceTab/SingleTab/C.java @@ -1,4 +1,4 @@ -/* +/* * Copyright 2002-2004 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -23,15 +23,15 @@ /** *
      - *	This source
      - * 	is indented
      - * 	with tabs.
      + *\tThis source
      + * \tis indented
      + * \twith tabs.
        * 
      */ public class C { - - //This source - //is indented - //with tabs. - + +\t//This source +\t//is indented +\t//with tabs. + } diff --git a/langtools/test/com/sun/javadoc/testSourceTab/TestSourceTab.java b/langtools/test/com/sun/javadoc/testSourceTab/TestSourceTab.java index d94d8f16f24..31ec810e2fe 100644 --- a/langtools/test/com/sun/javadoc/testSourceTab/TestSourceTab.java +++ b/langtools/test/com/sun/javadoc/testSourceTab/TestSourceTab.java @@ -1,5 +1,5 @@ -/* - * Copyright 2002-2004 Sun Microsystems, Inc. All Rights Reserved. +/* + * Copyright 2002-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 @@ -33,59 +33,102 @@ * @run main TestSourceTab */ +import java.io.*; + public class TestSourceTab extends JavadocTester { - + private static final String BUG_ID = "4510979"; + private static final String TMP_SRC_DIR = "tmpSrc"; private static final String OUTPUT_DIR1 = BUG_ID + "-tabLengthEight"; private static final String OUTPUT_DIR2 = BUG_ID + "-tabLengthFour"; private static final String[][] TEST = NO_TEST; private static final String[][] NEGATED_TEST = NO_TEST; - + //Run Javadoc on a source file with that is indented with a single tab per line private static final String[] ARGS1 = new String[] { - "-d", OUTPUT_DIR1, "-sourcepath", SRC_DIR, - "-notimestamp", "-linksource", SRC_DIR + FS + "SingleTab" + FS + "C.java" + "-d", OUTPUT_DIR1, "-sourcepath", TMP_SRC_DIR, + "-notimestamp", "-linksource", TMP_SRC_DIR + FS + "SingleTab" + FS + "C.java" }; - + //Run Javadoc on a source file with that is indented with a two tab per line //If we double the tabs and decrease the tab length by a half, the output should //be the same as the one generated above. private static final String[] ARGS2 = new String[] { - "-d", OUTPUT_DIR2, "-sourcepath", SRC_DIR, - "-notimestamp", "-sourcetab", "4", SRC_DIR + FS + "DoubleTab" + FS + "C.java" + "-d", OUTPUT_DIR2, "-sourcepath", TMP_SRC_DIR, + "-notimestamp", "-sourcetab", "4", TMP_SRC_DIR + FS + "DoubleTab" + FS + "C.java" }; - + //Files to diff private static final String[][] FILES_TO_DIFF = { {OUTPUT_DIR1 + FS + "src-html" + FS + "C.html", OUTPUT_DIR2 + FS + "src-html" + FS + "C.html" - }, + }, {OUTPUT_DIR1 + FS + "C.html", OUTPUT_DIR2 + FS + "C.html" } - + }; - + /** * The entry point of the test. * @param args the array of command line arguments. */ - public static void main(String[] args) { + public static void main(String[] args) throws IOException { TestSourceTab tester = new TestSourceTab(); run(tester, ARGS1, TEST, NEGATED_TEST); run(tester, ARGS2, TEST, NEGATED_TEST); tester.runDiffs(FILES_TO_DIFF); } - + + TestSourceTab() throws IOException { + initTabs(new File(SRC_DIR), new File(TMP_SRC_DIR)); + } + + void initTabs(File from, File to) throws IOException { + for (File f: from.listFiles()) { + File t = new File(to, f.getName()); + if (f.isDirectory()) { + initTabs(f, t); + } else if (f.getName().endsWith(".java")) { + write(t, read(f).replace("\\t", "\t")); + } + } + } + + String read(File f) throws IOException { + StringBuilder sb = new StringBuilder(); + BufferedReader in = new BufferedReader(new FileReader(f)); + try { + String line; + while ((line = in.readLine()) != null) { + sb.append(line); + sb.append("\n"); + } + } finally { + in.close(); + } + return sb.toString(); + } + + void write(File f, String s) throws IOException { + f.getParentFile().mkdirs(); + Writer out = new FileWriter(f); + try { + out.write(s); + } finally { + out.close(); + } + } + /** * {@inheritDoc} */ public String getBugId() { return BUG_ID; } - + /** * {@inheritDoc} */ From e936f852bfd903a2024343a3d63390d4fa1c44ad Mon Sep 17 00:00:00 2001 From: Bradford Wetmore Date: Tue, 2 Dec 2008 14:53:52 -0800 Subject: [PATCH 169/267] 6778613: Update javax.crypto.Cipher.getMaxAllowedKeyLength to point to proper Appendix after doc reorg Reviewed-by: mullan --- jdk/src/share/classes/javax/crypto/Cipher.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/src/share/classes/javax/crypto/Cipher.java b/jdk/src/share/classes/javax/crypto/Cipher.java index f99a43cf511..899b3523312 100644 --- a/jdk/src/share/classes/javax/crypto/Cipher.java +++ b/jdk/src/share/classes/javax/crypto/Cipher.java @@ -2377,7 +2377,7 @@ public class Cipher { * For more information on default key size in JCE jurisdiction * policy files, please see Appendix E in the * + * "{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html#AppC"> * Java Cryptography Architecture Reference Guide. * * @param transformation the cipher transformation. From f2f18a01e514d7a923a7c54d69e8e012afd3f137 Mon Sep 17 00:00:00 2001 From: Vladimir Kozlov Date: Wed, 3 Dec 2008 13:41:37 -0800 Subject: [PATCH 170/267] 6775880: EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now") Create new "eliminated" BoxLock node for monitor debug info when corresponding locks are eliminated. Reviewed-by: never --- hotspot/src/share/vm/opto/callnode.cpp | 18 +++- hotspot/src/share/vm/opto/callnode.hpp | 7 +- hotspot/src/share/vm/opto/compile.cpp | 5 - hotspot/src/share/vm/opto/escape.cpp | 3 +- hotspot/src/share/vm/opto/locknode.cpp | 7 +- hotspot/src/share/vm/opto/locknode.hpp | 2 +- hotspot/src/share/vm/opto/macro.cpp | 116 ++++++++++++++++++------ hotspot/src/share/vm/opto/output.cpp | 7 +- hotspot/test/compiler/6775880/Test.java | 67 ++++++++++++++ 9 files changed, 188 insertions(+), 44 deletions(-) create mode 100644 hotspot/test/compiler/6775880/Test.java diff --git a/hotspot/src/share/vm/opto/callnode.cpp b/hotspot/src/share/vm/opto/callnode.cpp index b9e9cbd5587..7dff291fc1c 100644 --- a/hotspot/src/share/vm/opto/callnode.cpp +++ b/hotspot/src/share/vm/opto/callnode.cpp @@ -395,7 +395,13 @@ void JVMState::format(PhaseRegAlloc *regalloc, const Node *n, outputStream* st) OptoReg::regname(OptoReg::c_frame_pointer), regalloc->reg2offset(box_reg)); } - format_helper( regalloc, st, obj, "MON-OBJ[", i, &scobjs ); + const char* obj_msg = "MON-OBJ["; + if (EliminateLocks) { + while( !box->is_BoxLock() ) box = box->in(1); + if (box->as_BoxLock()->is_eliminated()) + obj_msg = "MON-OBJ(LOCK ELIMINATED)["; + } + format_helper( regalloc, st, obj, obj_msg, i, &scobjs ); } for (i = 0; i < (uint)scobjs.length(); i++) { @@ -908,8 +914,9 @@ void SafePointNode::push_monitor(const FastLockNode *lock) { add_req(lock->box_node()); add_req(lock->obj_node()); } else { - add_req(NULL); - add_req(NULL); + Node* top = Compile::current()->top(); + add_req(top); + add_req(top); } jvms()->set_scloff(nextmon+MonitorEdges); jvms()->set_endoff(req()); @@ -1382,7 +1389,7 @@ Node *LockNode::Ideal(PhaseGVN *phase, bool can_reshape) { // // If we are locking an unescaped object, the lock/unlock is unnecessary // - ConnectionGraph *cgr = Compile::current()->congraph(); + ConnectionGraph *cgr = phase->C->congraph(); PointsToNode::EscapeState es = PointsToNode::GlobalEscape; if (cgr != NULL) es = cgr->escape_state(obj_node(), phase); @@ -1450,6 +1457,7 @@ Node *LockNode::Ideal(PhaseGVN *phase, bool can_reshape) { // Mark it eliminated to update any counters lock->set_eliminated(); + lock->set_coarsened(); } } else if (result != NULL && ctrl->is_Region() && iter->_worklist.member(ctrl)) { @@ -1484,7 +1492,7 @@ Node *UnlockNode::Ideal(PhaseGVN *phase, bool can_reshape) { // // If we are unlocking an unescaped object, the lock/unlock is unnecessary. // - ConnectionGraph *cgr = Compile::current()->congraph(); + ConnectionGraph *cgr = phase->C->congraph(); PointsToNode::EscapeState es = PointsToNode::GlobalEscape; if (cgr != NULL) es = cgr->escape_state(obj_node(), phase); diff --git a/hotspot/src/share/vm/opto/callnode.hpp b/hotspot/src/share/vm/opto/callnode.hpp index 45b6dd2148b..06c783364c0 100644 --- a/hotspot/src/share/vm/opto/callnode.hpp +++ b/hotspot/src/share/vm/opto/callnode.hpp @@ -780,7 +780,8 @@ public: //------------------------------AbstractLockNode----------------------------------- class AbstractLockNode: public CallNode { private: - bool _eliminate; // indicates this lock can be safely eliminated + bool _eliminate; // indicates this lock can be safely eliminated + bool _coarsened; // indicates this lock was coarsened #ifndef PRODUCT NamedCounter* _counter; #endif @@ -801,6 +802,7 @@ protected: public: AbstractLockNode(const TypeFunc *tf) : CallNode(tf, NULL, TypeRawPtr::BOTTOM), + _coarsened(false), _eliminate(false) { #ifndef PRODUCT @@ -819,6 +821,9 @@ public: // mark node as eliminated and update the counter if there is one void set_eliminated(); + bool is_coarsened() { return _coarsened; } + void set_coarsened() { _coarsened = true; } + // locking does not modify its arguments virtual bool may_modify(const TypePtr *addr_t, PhaseTransform *phase){ return false;} diff --git a/hotspot/src/share/vm/opto/compile.cpp b/hotspot/src/share/vm/opto/compile.cpp index 42eae3063d9..f9b3392d0f2 100644 --- a/hotspot/src/share/vm/opto/compile.cpp +++ b/hotspot/src/share/vm/opto/compile.cpp @@ -1532,11 +1532,6 @@ void Compile::Optimize() { if (failing()) return; - // get rid of the connection graph since it's information is not - // updated by optimizations - _congraph = NULL; - - // Loop transforms on the ideal graph. Range Check Elimination, // peeling, unrolling, etc. diff --git a/hotspot/src/share/vm/opto/escape.cpp b/hotspot/src/share/vm/opto/escape.cpp index 1c1d5d8223f..bccfb9c64ba 100644 --- a/hotspot/src/share/vm/opto/escape.cpp +++ b/hotspot/src/share/vm/opto/escape.cpp @@ -199,7 +199,8 @@ PointsToNode::EscapeState ConnectionGraph::escape_state(Node *n, PhaseTransform es = ptnode_adr(idx)->escape_state(); // if we have already computed a value, return it - if (es != PointsToNode::UnknownEscape) + if (es != PointsToNode::UnknownEscape && + ptnode_adr(idx)->node_type() == PointsToNode::JavaObject) return es; // PointsTo() calls n->uncast() which can return a new ideal node. diff --git a/hotspot/src/share/vm/opto/locknode.cpp b/hotspot/src/share/vm/opto/locknode.cpp index 5a74fd09001..0099284a701 100644 --- a/hotspot/src/share/vm/opto/locknode.cpp +++ b/hotspot/src/share/vm/opto/locknode.cpp @@ -44,10 +44,15 @@ BoxLockNode::BoxLockNode( int slot ) : Node( Compile::current()->root() ), _inmask.Insert(reg); } +//-----------------------------hash-------------------------------------------- +uint BoxLockNode::hash() const { + return Node::hash() + _slot + (_is_eliminated ? Compile::current()->fixed_slots() : 0); +} + //------------------------------cmp-------------------------------------------- uint BoxLockNode::cmp( const Node &n ) const { const BoxLockNode &bn = (const BoxLockNode &)n; - return bn._slot == _slot; + return bn._slot == _slot && bn._is_eliminated == _is_eliminated; } OptoReg::Name BoxLockNode::stack_slot(Node* box_node) { diff --git a/hotspot/src/share/vm/opto/locknode.hpp b/hotspot/src/share/vm/opto/locknode.hpp index 113de601538..5361933828a 100644 --- a/hotspot/src/share/vm/opto/locknode.hpp +++ b/hotspot/src/share/vm/opto/locknode.hpp @@ -36,7 +36,7 @@ public: virtual const RegMask &in_RegMask(uint) const; virtual const RegMask &out_RegMask() const; virtual uint size_of() const; - virtual uint hash() const { return Node::hash() + _slot; } + virtual uint hash() const; virtual uint cmp( const Node &n ) const; virtual const class Type *bottom_type() const { return TypeRawPtr::BOTTOM; } virtual uint ideal_reg() const { return Op_RegP; } diff --git a/hotspot/src/share/vm/opto/macro.cpp b/hotspot/src/share/vm/opto/macro.cpp index 37cee0697bb..1152917d907 100644 --- a/hotspot/src/share/vm/opto/macro.cpp +++ b/hotspot/src/share/vm/opto/macro.cpp @@ -59,7 +59,7 @@ void PhaseMacroExpand::copy_call_debug_info(CallNode *oldcall, CallNode * newcal for (uint i = old_dbg_start; i < oldcall->req(); i++) { Node* old_in = oldcall->in(i); // Clone old SafePointScalarObjectNodes, adjusting their field contents. - if (old_in->is_SafePointScalarObject()) { + if (old_in != NULL && old_in->is_SafePointScalarObject()) { SafePointScalarObjectNode* old_sosn = old_in->as_SafePointScalarObject(); uint old_unique = C->unique(); Node* new_in = old_sosn->clone(jvms_adj, sosn_map); @@ -1509,21 +1509,63 @@ bool PhaseMacroExpand::eliminate_locking_node(AbstractLockNode *alock) { if (!alock->is_eliminated()) { return false; } - // Mark the box lock as eliminated if all correspondent locks are eliminated - // to construct correct debug info. - BoxLockNode* box = alock->box_node()->as_BoxLock(); - if (!box->is_eliminated()) { - bool eliminate = true; - for (DUIterator_Fast imax, i = box->fast_outs(imax); i < imax; i++) { - Node *lck = box->fast_out(i); - if (lck->is_Lock() && !lck->as_AbstractLock()->is_eliminated()) { - eliminate = false; - break; - } - } - if (eliminate) - box->set_eliminated(); - } + if (alock->is_Lock() && !alock->is_coarsened()) { + // Create new "eliminated" BoxLock node and use it + // in monitor debug info for the same object. + BoxLockNode* oldbox = alock->box_node()->as_BoxLock(); + Node* obj = alock->obj_node(); + if (!oldbox->is_eliminated()) { + BoxLockNode* newbox = oldbox->clone()->as_BoxLock(); + newbox->set_eliminated(); + transform_later(newbox); + // Replace old box node with new box for all users + // of the same object. + for (uint i = 0; i < oldbox->outcnt();) { + + bool next_edge = true; + Node* u = oldbox->raw_out(i); + if (u == alock) { + i++; + continue; // It will be removed below + } + if (u->is_Lock() && + u->as_Lock()->obj_node() == obj && + // oldbox could be referenced in debug info also + u->as_Lock()->box_node() == oldbox) { + assert(u->as_Lock()->is_eliminated(), "sanity"); + _igvn.hash_delete(u); + u->set_req(TypeFunc::Parms + 1, newbox); + next_edge = false; +#ifdef ASSERT + } else if (u->is_Unlock() && u->as_Unlock()->obj_node() == obj) { + assert(u->as_Unlock()->is_eliminated(), "sanity"); +#endif + } + // Replace old box in monitor debug info. + if (u->is_SafePoint() && u->as_SafePoint()->jvms()) { + SafePointNode* sfn = u->as_SafePoint(); + JVMState* youngest_jvms = sfn->jvms(); + int max_depth = youngest_jvms->depth(); + for (int depth = 1; depth <= max_depth; depth++) { + JVMState* jvms = youngest_jvms->of_depth(depth); + int num_mon = jvms->nof_monitors(); + // Loop over monitors + for (int idx = 0; idx < num_mon; idx++) { + Node* obj_node = sfn->monitor_obj(jvms, idx); + Node* box_node = sfn->monitor_box(jvms, idx); + if (box_node == oldbox && obj_node == obj) { + int j = jvms->monitor_box_offset(idx); + _igvn.hash_delete(u); + u->set_req(j, newbox); + next_edge = false; + } + } // for (int idx = 0; + } // for (int depth = 1; + } // if (u->is_SafePoint() + if (next_edge) i++; + } // for (uint i = 0; i < oldbox->outcnt();) + } // if (!oldbox->is_eliminated()) + } // if (alock->is_Lock() && !lock->is_coarsened()) #ifndef PRODUCT if (PrintEliminateLocks) { @@ -1562,6 +1604,15 @@ bool PhaseMacroExpand::eliminate_locking_node(AbstractLockNode *alock) { _igvn.subsume_node(ctrlproj, fallthroughproj); _igvn.hash_delete(memproj); _igvn.subsume_node(memproj, memproj_fallthrough); + + // Delete FastLock node also if this Lock node is unique user + // (a loop peeling may clone a Lock node). + Node* flock = alock->as_Lock()->fastlock_node(); + if (flock->outcnt() == 1) { + assert(flock->unique_out() == alock, "sanity"); + _igvn.hash_delete(flock); + _igvn.subsume_node(flock, top()); + } } // Seach for MemBarRelease node and delete it also. @@ -1887,8 +1938,28 @@ void PhaseMacroExpand::expand_unlock_node(UnlockNode *unlock) { bool PhaseMacroExpand::expand_macro_nodes() { if (C->macro_count() == 0) return false; - // attempt to eliminate allocations + // First, attempt to eliminate locks bool progress = true; + while (progress) { + progress = false; + for (int i = C->macro_count(); i > 0; i--) { + Node * n = C->macro_node(i-1); + bool success = false; + debug_only(int old_macro_count = C->macro_count();); + if (n->is_AbstractLock()) { + success = eliminate_locking_node(n->as_AbstractLock()); + } else if (n->Opcode() == Op_Opaque1 || n->Opcode() == Op_Opaque2) { + _igvn.add_users_to_worklist(n); + _igvn.hash_delete(n); + _igvn.subsume_node(n, n->in(1)); + success = true; + } + assert(success == (C->macro_count() < old_macro_count), "elimination reduces macro count"); + progress = progress || success; + } + } + // Next, attempt to eliminate allocations + progress = true; while (progress) { progress = false; for (int i = C->macro_count(); i > 0; i--) { @@ -1902,17 +1973,10 @@ bool PhaseMacroExpand::expand_macro_nodes() { break; case Node::Class_Lock: case Node::Class_Unlock: - success = eliminate_locking_node(n->as_AbstractLock()); + assert(!n->as_AbstractLock()->is_eliminated(), "sanity"); break; default: - if (n->Opcode() == Op_Opaque1 || n->Opcode() == Op_Opaque2) { - _igvn.add_users_to_worklist(n); - _igvn.hash_delete(n); - _igvn.subsume_node(n, n->in(1)); - success = true; - } else { - assert(false, "unknown node type in macro list"); - } + assert(false, "unknown node type in macro list"); } assert(success == (C->macro_count() < old_macro_count), "elimination reduces macro count"); progress = progress || success; diff --git a/hotspot/src/share/vm/opto/output.cpp b/hotspot/src/share/vm/opto/output.cpp index 604ab7536ad..7d6482ccd3c 100644 --- a/hotspot/src/share/vm/opto/output.cpp +++ b/hotspot/src/share/vm/opto/output.cpp @@ -849,10 +849,8 @@ void Compile::Process_OopMap_Node(MachNode *mach, int current_offset) { // Loop over monitors and insert into array for(idx = 0; idx < num_mon; idx++) { // Grab the node that defines this monitor - Node* box_node; - Node* obj_node; - box_node = sfn->monitor_box(jvms, idx); - obj_node = sfn->monitor_obj(jvms, idx); + Node* box_node = sfn->monitor_box(jvms, idx); + Node* obj_node = sfn->monitor_obj(jvms, idx); // Create ScopeValue for object ScopeValue *scval = NULL; @@ -890,6 +888,7 @@ void Compile::Process_OopMap_Node(MachNode *mach, int current_offset) { OptoReg::Name box_reg = BoxLockNode::stack_slot(box_node); Location basic_lock = Location::new_stk_loc(Location::normal,_regalloc->reg2offset(box_reg)); + while( !box_node->is_BoxLock() ) box_node = box_node->in(1); monarray->append(new MonitorValue(scval, basic_lock, box_node->as_BoxLock()->is_eliminated())); } diff --git a/hotspot/test/compiler/6775880/Test.java b/hotspot/test/compiler/6775880/Test.java new file mode 100644 index 00000000000..7c952ec4530 --- /dev/null +++ b/hotspot/test/compiler/6775880/Test.java @@ -0,0 +1,67 @@ +/* + * 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. + * + * 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 6775880 + * @summary EA +DeoptimizeALot: assert(mon_info->owner()->is_locked(),"object must be locked now") + * @compile -source 1.4 -target 1.4 Test.java + * @run main/othervm -server -Xbatch -XX:+DoEscapeAnalysis -XX:+DeoptimizeALot -XX:CompileCommand=exclude,java.lang.AbstractStringBuilder::append Test + */ + +public class Test { + + int cnt; + int b[]; + String s; + + String test() { + String res=""; + for (int i=0; i < cnt; i++) { + if (i != 0) { + res = res +"."; + } + res = res + b[i]; + } + return res; + } + + public static void main(String[] args) { + Test t = new Test(); + t.cnt = 3; + t.b = new int[3]; + t.b[0] = 0; + t.b[1] = 1; + t.b[2] = 2; + int j=0; + t.s = ""; + for (int i=0; i<10001; i++) { + t.s = "c"; + t.s = t.test(); + } + System.out.println("After s=" + t.s); + } +} + + From af509dd90da88faf0f6db9907c5a0f42f9f71634 Mon Sep 17 00:00:00 2001 From: Igor Veresov Date: Wed, 3 Dec 2008 14:18:57 -0800 Subject: [PATCH 171/267] 6779436: NUMA allocator: libnuma expects certain size of the buffer in numa_node_to_cpus() In os::Linux::rebuild_cpu_to_node_map() fix the size of the CPU bitmap. Fixed arithmetic in MutableNUMASpace::adaptive_chunk_size() that could cause overflows and underflows of the chunk_size variable. Reviewed-by: apetrusenko --- hotspot/src/os/linux/vm/os_linux.cpp | 55 +++++++++++++++---- hotspot/src/os/linux/vm/os_linux.hpp | 14 ++++- hotspot/src/os/solaris/vm/os_solaris.cpp | 24 ++++++-- hotspot/src/os/solaris/vm/os_solaris.hpp | 2 +- hotspot/src/os/windows/vm/os_windows.cpp | 4 ++ .../shared/mutableNUMASpace.cpp | 15 ++++- hotspot/src/share/vm/runtime/globals.hpp | 3 + 7 files changed, 96 insertions(+), 21 deletions(-) diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp index 3e93e6d5983..6331bf4aca5 100644 --- a/hotspot/src/os/linux/vm/os_linux.cpp +++ b/hotspot/src/os/linux/vm/os_linux.cpp @@ -2272,7 +2272,9 @@ void os::free_memory(char *addr, size_t bytes) { uncommit_memory(addr, bytes); } -void os::numa_make_global(char *addr, size_t bytes) { } +void os::numa_make_global(char *addr, size_t bytes) { + Linux::numa_interleave_memory(addr, bytes); +} void os::numa_make_local(char *addr, size_t bytes, int lgrp_hint) { Linux::numa_tonode_memory(addr, bytes, lgrp_hint); @@ -2314,7 +2316,7 @@ char *os::scan_pages(char *start, char* end, page_info* page_expected, page_info extern "C" void numa_warn(int number, char *where, ...) { } extern "C" void numa_error(char *where) { } -void os::Linux::libnuma_init() { +bool os::Linux::libnuma_init() { // sched_getcpu() should be in libc. set_sched_getcpu(CAST_TO_FN_PTR(sched_getcpu_func_t, dlsym(RTLD_DEFAULT, "sched_getcpu"))); @@ -2330,31 +2332,51 @@ void os::Linux::libnuma_init() { dlsym(handle, "numa_available"))); set_numa_tonode_memory(CAST_TO_FN_PTR(numa_tonode_memory_func_t, dlsym(handle, "numa_tonode_memory"))); + set_numa_interleave_memory(CAST_TO_FN_PTR(numa_interleave_memory_func_t, + dlsym(handle, "numa_interleave_memory"))); + + if (numa_available() != -1) { + set_numa_all_nodes((unsigned long*)dlsym(handle, "numa_all_nodes")); // Create a cpu -> node mapping _cpu_to_node = new (ResourceObj::C_HEAP) GrowableArray(0, true); rebuild_cpu_to_node_map(); + return true; } } } + return false; } // rebuild_cpu_to_node_map() constructs a table mapping cpud id to node id. // The table is later used in get_node_by_cpu(). void os::Linux::rebuild_cpu_to_node_map() { - int cpu_num = os::active_processor_count(); + const size_t NCPUS = 32768; // Since the buffer size computation is very obscure + // in libnuma (possible values are starting from 16, + // and continuing up with every other power of 2, but less + // than the maximum number of CPUs supported by kernel), and + // is a subject to change (in libnuma version 2 the requirements + // are more reasonable) we'll just hardcode the number they use + // in the library. + const size_t BitsPerCLong = sizeof(long) * CHAR_BIT; + + size_t cpu_num = os::active_processor_count(); + size_t cpu_map_size = NCPUS / BitsPerCLong; + size_t cpu_map_valid_size = + MIN2((cpu_num + BitsPerCLong - 1) / BitsPerCLong, cpu_map_size); + cpu_to_node()->clear(); cpu_to_node()->at_grow(cpu_num - 1); - int node_num = numa_get_groups_num(); - int cpu_map_size = (cpu_num + BitsPerLong - 1) / BitsPerLong; + size_t node_num = numa_get_groups_num(); + unsigned long *cpu_map = NEW_C_HEAP_ARRAY(unsigned long, cpu_map_size); - for (int i = 0; i < node_num; i++) { + for (size_t i = 0; i < node_num; i++) { if (numa_node_to_cpus(i, cpu_map, cpu_map_size * sizeof(unsigned long)) != -1) { - for (int j = 0; j < cpu_map_size; j++) { + for (size_t j = 0; j < cpu_map_valid_size; j++) { if (cpu_map[j] != 0) { - for (int k = 0; k < BitsPerLong; k++) { + for (size_t k = 0; k < BitsPerCLong; k++) { if (cpu_map[j] & (1UL << k)) { - cpu_to_node()->at_put(j * BitsPerLong + k, i); + cpu_to_node()->at_put(j * BitsPerCLong + k, i); } } } @@ -2377,7 +2399,8 @@ os::Linux::numa_node_to_cpus_func_t os::Linux::_numa_node_to_cpus; os::Linux::numa_max_node_func_t os::Linux::_numa_max_node; os::Linux::numa_available_func_t os::Linux::_numa_available; os::Linux::numa_tonode_memory_func_t os::Linux::_numa_tonode_memory; - +os::Linux::numa_interleave_memory_func_t os::Linux::_numa_interleave_memory; +unsigned long* os::Linux::_numa_all_nodes; bool os::uncommit_memory(char* addr, size_t size) { return ::mmap(addr, size, @@ -3695,7 +3718,17 @@ jint os::init_2(void) } if (UseNUMA) { - Linux::libnuma_init(); + if (!Linux::libnuma_init()) { + UseNUMA = false; + } else { + if ((Linux::numa_max_node() < 1)) { + // There's only one node(they start from 0), disable NUMA. + UseNUMA = false; + } + } + if (!UseNUMA && ForceNUMA) { + UseNUMA = true; + } } if (MaxFDLimit) { diff --git a/hotspot/src/os/linux/vm/os_linux.hpp b/hotspot/src/os/linux/vm/os_linux.hpp index baa412501f3..ebd8c931b2b 100644 --- a/hotspot/src/os/linux/vm/os_linux.hpp +++ b/hotspot/src/os/linux/vm/os_linux.hpp @@ -146,7 +146,7 @@ class Linux { static bool is_floating_stack() { return _is_floating_stack; } static void libpthread_init(); - static void libnuma_init(); + static bool libnuma_init(); // Minimum stack size a thread can be created with (allowing // the VM to completely create the thread and enter user code) @@ -240,20 +240,23 @@ private: typedef int (*numa_max_node_func_t)(void); typedef int (*numa_available_func_t)(void); typedef int (*numa_tonode_memory_func_t)(void *start, size_t size, int node); - + typedef void (*numa_interleave_memory_func_t)(void *start, size_t size, unsigned long *nodemask); static sched_getcpu_func_t _sched_getcpu; static numa_node_to_cpus_func_t _numa_node_to_cpus; static numa_max_node_func_t _numa_max_node; static numa_available_func_t _numa_available; static numa_tonode_memory_func_t _numa_tonode_memory; + static numa_interleave_memory_func_t _numa_interleave_memory; + static unsigned long* _numa_all_nodes; static void set_sched_getcpu(sched_getcpu_func_t func) { _sched_getcpu = func; } static void set_numa_node_to_cpus(numa_node_to_cpus_func_t func) { _numa_node_to_cpus = func; } static void set_numa_max_node(numa_max_node_func_t func) { _numa_max_node = func; } static void set_numa_available(numa_available_func_t func) { _numa_available = func; } static void set_numa_tonode_memory(numa_tonode_memory_func_t func) { _numa_tonode_memory = func; } - + static void set_numa_interleave_memory(numa_interleave_memory_func_t func) { _numa_interleave_memory = func; } + static void set_numa_all_nodes(unsigned long* ptr) { _numa_all_nodes = ptr; } public: static int sched_getcpu() { return _sched_getcpu != NULL ? _sched_getcpu() : -1; } static int numa_node_to_cpus(int node, unsigned long *buffer, int bufferlen) { @@ -264,6 +267,11 @@ public: static int numa_tonode_memory(void *start, size_t size, int node) { return _numa_tonode_memory != NULL ? _numa_tonode_memory(start, size, node) : -1; } + static void numa_interleave_memory(void *start, size_t size) { + if (_numa_interleave_memory != NULL && _numa_all_nodes != NULL) { + _numa_interleave_memory(start, size, _numa_all_nodes); + } + } static int get_node_by_cpu(int cpu_id); }; diff --git a/hotspot/src/os/solaris/vm/os_solaris.cpp b/hotspot/src/os/solaris/vm/os_solaris.cpp index 05940869e48..7225f3be425 100644 --- a/hotspot/src/os/solaris/vm/os_solaris.cpp +++ b/hotspot/src/os/solaris/vm/os_solaris.cpp @@ -4638,7 +4638,7 @@ void os::Solaris::synchronization_init() { } } -void os::Solaris::liblgrp_init() { +bool os::Solaris::liblgrp_init() { void *handle = dlopen("liblgrp.so.1", RTLD_LAZY); if (handle != NULL) { os::Solaris::set_lgrp_home(CAST_TO_FN_PTR(lgrp_home_func_t, dlsym(handle, "lgrp_home"))); @@ -4653,9 +4653,9 @@ void os::Solaris::liblgrp_init() { lgrp_cookie_t c = lgrp_init(LGRP_VIEW_CALLER); set_lgrp_cookie(c); - } else { - warning("your OS does not support NUMA"); + return true; } + return false; } void os::Solaris::misc_sym_init() { @@ -4824,9 +4824,25 @@ jint os::init_2(void) { vm_page_size())); Solaris::libthread_init(); + if (UseNUMA) { - Solaris::liblgrp_init(); + if (!Solaris::liblgrp_init()) { + UseNUMA = false; + } else { + size_t lgrp_limit = os::numa_get_groups_num(); + int *lgrp_ids = NEW_C_HEAP_ARRAY(int, lgrp_limit); + size_t lgrp_num = os::numa_get_leaf_groups(lgrp_ids, lgrp_limit); + FREE_C_HEAP_ARRAY(int, lgrp_ids); + if (lgrp_num < 2) { + // There's only one locality group, disable NUMA. + UseNUMA = false; + } + } + if (!UseNUMA && ForceNUMA) { + UseNUMA = true; + } } + Solaris::misc_sym_init(); Solaris::signal_sets_init(); Solaris::init_signal_mem(); diff --git a/hotspot/src/os/solaris/vm/os_solaris.hpp b/hotspot/src/os/solaris/vm/os_solaris.hpp index cffe4ee80ac..8e322456d89 100644 --- a/hotspot/src/os/solaris/vm/os_solaris.hpp +++ b/hotspot/src/os/solaris/vm/os_solaris.hpp @@ -176,7 +176,7 @@ class Solaris { public: static void libthread_init(); static void synchronization_init(); - static void liblgrp_init(); + static bool liblgrp_init(); // Load miscellaneous symbols. static void misc_sym_init(); // This boolean allows users to forward their own non-matching signals diff --git a/hotspot/src/os/windows/vm/os_windows.cpp b/hotspot/src/os/windows/vm/os_windows.cpp index bc86280bd87..5de68d07ce7 100644 --- a/hotspot/src/os/windows/vm/os_windows.cpp +++ b/hotspot/src/os/windows/vm/os_windows.cpp @@ -3353,6 +3353,10 @@ jint os::init_2(void) { // initialize thread priority policy prio_init(); + if (UseNUMA && !ForceNUMA) { + UseNUMA = false; // Currently unsupported. + } + return JNI_OK; } diff --git a/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp b/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp index 697e00de0ab..0f38b70ee69 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp +++ b/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp @@ -414,9 +414,20 @@ size_t MutableNUMASpace::adaptive_chunk_size(int i, size_t limit) { if (limit > 0) { limit = round_down(limit, page_size()); if (chunk_size > current_chunk_size(i)) { - chunk_size = MIN2((off_t)chunk_size, (off_t)current_chunk_size(i) + (off_t)limit); + size_t upper_bound = pages_available * page_size(); + if (upper_bound > limit && + current_chunk_size(i) < upper_bound - limit) { + // The resulting upper bound should not exceed the available + // amount of memory (pages_available * page_size()). + upper_bound = current_chunk_size(i) + limit; + } + chunk_size = MIN2(chunk_size, upper_bound); } else { - chunk_size = MAX2((off_t)chunk_size, (off_t)current_chunk_size(i) - (off_t)limit); + size_t lower_bound = page_size(); + if (current_chunk_size(i) > limit) { // lower_bound shouldn't underflow. + lower_bound = current_chunk_size(i) - limit; + } + chunk_size = MAX2(chunk_size, lower_bound); } } assert(chunk_size <= pages_available * page_size(), "Chunk size out of range"); diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index c4272a56aa9..5d08a653bd5 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -342,6 +342,9 @@ class CommandLineFlags { product(bool, UseNUMA, false, \ "Use NUMA if available") \ \ + product(bool, ForceNUMA, false, \ + "Force NUMA optimizations on single-node/UMA systems") \ + \ product(intx, NUMAChunkResizeWeight, 20, \ "Percentage (0-100) used to weight the current sample when " \ "computing exponentially decaying average for " \ From 3123299828eb739e5a4d87418d1cd81ef780094f Mon Sep 17 00:00:00 2001 From: Daniel Fuchs Date: Thu, 4 Dec 2008 17:58:10 +0100 Subject: [PATCH 172/267] 6319823: new mbean register/unregister notification for groups of mbeans 6779698: Merge error caused duplicate example code in MBeanServerNotification Reviewed-by: emcmanus --- .../management/MBeanServerNotification.java | 68 +++++++++++++++++-- 1 file changed, 61 insertions(+), 7 deletions(-) diff --git a/jdk/src/share/classes/javax/management/MBeanServerNotification.java b/jdk/src/share/classes/javax/management/MBeanServerNotification.java index d19c73a555a..e9fe12ad9d6 100644 --- a/jdk/src/share/classes/javax/management/MBeanServerNotification.java +++ b/jdk/src/share/classes/javax/management/MBeanServerNotification.java @@ -57,15 +57,55 @@ package javax.management; * what = "Unknown type " + n.getType(); * System.out.println("Received MBean Server notification: " + what + ": " + * mbsn.getMBeanName()); + * } * }; * * ... * mbeanServer.addNotificationListener( * MBeanServerDelegate.DELEGATE_NAME, printListener, null, null); * - * - *

      The following code prints a message every time an MBean is registered - * or unregistered in the MBean Server {@code mbeanServer}:

      + *

      + * An MBean which is not an {@link MBeanServerDelegate} may also emit + * MBeanServerNotifications. In particular, a custom subclass of the + * {@link javax.management.namespace.JMXDomain JMXDomain} MBean or a custom + * subclass of the {@link javax.management.namespace.JMXNamespace JMXNamespace} + * MBean may emit an MBeanServerNotification for a group of MBeans.
      + * An MBeanServerNotification emitted to denote the registration or + * unregistration of a group of MBeans has the following characteristics: + *

      • Its {@linkplain Notification#getType() notification type} is + * {@code "JMX.mbean.registered.group"} or + * {@code "JMX.mbean.unregistered.group"}, which can also be written {@link + * MBeanServerNotification#REGISTRATION_NOTIFICATION}{@code + ".group"} or + * {@link + * MBeanServerNotification#UNREGISTRATION_NOTIFICATION}{@code + ".group"}. + *
      • + *
      • Its {@linkplain #getMBeanName() MBean name} is an ObjectName pattern + * that selects the set (or a superset) of the MBeans being registered + * or unregistered
      • + *
      • Its {@linkplain Notification#getUserData() user data} can optionally + * be set to an array of ObjectNames containing the names of all MBeans + * being registered or unregistered.
      • + *
      + *

      + *

      + * MBeans which emit these group registration/unregistration notifications will + * declare them in their {@link MBeanInfo#getNotifications() + * MBeanNotificationInfo}. + *

      + *

      + * To receive a group MBeanServerNotification, you need to register a listener + * with the MBean that emits it. For instance, assuming that the {@link + * javax.management.namespace.JMXNamespace JMXNamespace} MBean handling + * namespace {@code "foo"} has declared that it emits such a notification, + * you will need to register your notification listener with that MBean, which + * will be named {@link + * javax.management.namespace.JMXNamespaces#getNamespaceObjectName(java.lang.String) + * foo//:type=JMXNamespace}. + *

      + *

      The following code prints a message every time a group of MBean is + * registered or unregistered in the namespace {@code "foo"}, assumimg its + * {@link javax.management.namespace.JMXNamespace handler} supports + * group MBeanServerNotifications:

      * *
        * private static final NotificationListener printListener = new NotificationListener() {
      @@ -76,19 +116,33 @@ package javax.management;
        *         }
        *         MBeanServerNotification mbsn = (MBeanServerNotification) n;
        *         String what;
      - *         if (n.getType().equals(MBeanServerNotification.REGISTRATION_NOTIFICATION))
      + *         ObjectName[] names = null;
      + *         if (n.getType().equals(MBeanServerNotification.REGISTRATION_NOTIFICATION)) {
        *             what = "MBean registered";
      - *         else if (n.getType().equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION))
      + *         } else if (n.getType().equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION)) {
        *             what = "MBean unregistered";
      - *         else
      + *         } else if (n.getType().equals(MBeanServerNotification.REGISTRATION_NOTIFICATION+".group")) {
      + *             what = "Group of MBeans registered matching";
      + *             if (mbsn.getUserData() instanceof ObjectName[])
      + *                names =  (ObjectName[]) mbsn.getUserData();
      + *         } else if (n.getType().equals(MBeanServerNotification.UNREGISTRATION_NOTIFICATION+".group")) {
      + *             what = "Group of MBeans unregistered matching";
      + *             if (mbsn.getUserData() instanceof ObjectName[])
      + *                names = (ObjectName[]) mbsn.getUserData();
      + *         } else
        *             what = "Unknown type " + n.getType();
        *         System.out.println("Received MBean Server notification: " + what + ": " +
        *                 mbsn.getMBeanName());
      + *         if (names != null) {
      + *              for (ObjectName mb : names)
      + *                  System.out.println("\t"+mb);
      + *         }
      + *     }
        * };
        *
        * ...
        *     mbeanServer.addNotificationListener(
      - *             MBeanServerDelegate.DELEGATE_NAME, printListener, null, null);
      + *             JMXNamespaces.getNamespaceObjectName("foo"), printListener, null, null);
        * 
      * * @since 1.5 From 59ae4174f020d577c18ad17d9a369ee63bafa1ee Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena Date: Thu, 4 Dec 2008 11:10:08 -0800 Subject: [PATCH 173/267] Added tag jdk7-b41 for changeset 9d3c7a336f93 --- .hgtags-top-repo | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags-top-repo b/.hgtags-top-repo index 75e4e323fcb..db14d6be8bb 100644 --- a/.hgtags-top-repo +++ b/.hgtags-top-repo @@ -15,3 +15,4 @@ bb1ef4ee3d2c8cbf43a37d372325a7952be590b9 jdk7-b33 cc47a76899ed33a2c513cb688348244c9b5a1288 jdk7-b38 ab523b49de1fc73fefe6855ce1e0349bdbd7af29 jdk7-b39 44be42de6693063fb191989bf0e188de2fa51e7c jdk7-b40 +541bdc5ad32fc33255944d0a044ad992f3d915e8 jdk7-b41 From 03b38c0c8ddade03920ae1d30d240bf36b2528b7 Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena Date: Thu, 4 Dec 2008 11:10:09 -0800 Subject: [PATCH 174/267] Added tag jdk7-b41 for changeset fc8a80d3e672 --- corba/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/corba/.hgtags b/corba/.hgtags index 73edf0f70c4..ef73173d9d2 100644 --- a/corba/.hgtags +++ b/corba/.hgtags @@ -15,3 +15,4 @@ ef6af34d75a7b44e77083f1d4ee47631fa09d3b4 jdk7-b31 08be802754b0296c91a7713b6d85a015dbcd5349 jdk7-b38 55078b6661e286e90387d1d9950bd865f5cc436e jdk7-b39 184e21992f47a8d730df1adc5b21a108f3125489 jdk7-b40 +c90eeda9594ed2983403e2049aed8d503126c62e jdk7-b41 From 868fd3b0439e9e039a9c6a1d9ef9a27c4bcdfbe4 Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena Date: Thu, 4 Dec 2008 11:10:13 -0800 Subject: [PATCH 175/267] Added tag jdk7-b41 for changeset 49f1a8464e11 --- hotspot/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/hotspot/.hgtags b/hotspot/.hgtags index 89714434ad8..90191ff65d0 100644 --- a/hotspot/.hgtags +++ b/hotspot/.hgtags @@ -15,3 +15,4 @@ e91159f921a58af3698e6479ea1fc5818da66d09 jdk7-b36 d9bc824aa078573829bb66572af847e26e1bd12e jdk7-b38 49ca90d77f34571b0757ebfcb8a7848ef2696b88 jdk7-b39 81a0cbe3b28460ce836109934ece03db7afaf9cc jdk7-b40 +f9d938ede1960d18cb7cf23c645b026519c1a678 jdk7-b41 From 62267e3f0277200880a118dfc8071d9ea143c360 Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena Date: Thu, 4 Dec 2008 11:10:17 -0800 Subject: [PATCH 176/267] Added tag jdk7-b41 for changeset ff9b7f94082a --- jaxp/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxp/.hgtags b/jaxp/.hgtags index 45dc322f9f8..21d9f6758e4 100644 --- a/jaxp/.hgtags +++ b/jaxp/.hgtags @@ -15,3 +15,4 @@ af49591bc486d82aa04b832257de0d18adc9af52 jdk7-b37 e9f750f0a3a00413a7b77028b2ecdabb7129ae32 jdk7-b38 831b80be6cea8e7d7da197ccdac5fd4c701a5033 jdk7-b39 54946f466e2c047c44c903f1bec400b685c2508e jdk7-b40 +0758bd3e2852e4f931ba211cc4d48f589450eeb4 jdk7-b41 From 211621e750de68b378d948e9f0a6a270c24f1d0a Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena Date: Thu, 4 Dec 2008 11:10:19 -0800 Subject: [PATCH 177/267] Added tag jdk7-b41 for changeset c2c85c9ad771 --- jaxws/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxws/.hgtags b/jaxws/.hgtags index e6485b246c2..22c78532543 100644 --- a/jaxws/.hgtags +++ b/jaxws/.hgtags @@ -15,3 +15,4 @@ a2a6f9edf761934faf59ea60d7fe7178371302cd jdk7-b37 9ce439969184c753a9ba3caf8ed277b05230f2e5 jdk7-b38 077bc9b1b035a409a76bd5366f73ed9dd9846934 jdk7-b39 70a6ac6dd737fe45c2fadb57646195b2b4fe269d jdk7-b40 +a8379d24aa03386610169cb0f4e4b8ed266a2e8d jdk7-b41 From 606d3d6cd104a25c9902e96b892bed5ba120a38d Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena Date: Thu, 4 Dec 2008 11:10:25 -0800 Subject: [PATCH 178/267] Added tag jdk7-b41 for changeset d255ae63f83c --- jdk/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/.hgtags b/jdk/.hgtags index 66dce59a9b2..37ed278825a 100644 --- a/jdk/.hgtags +++ b/jdk/.hgtags @@ -15,3 +15,4 @@ cf4894b78ceb966326e93bf221db0c2d14d59218 jdk7-b35 cc5f810b5af8a3a83b0df5a29d9e24d7a0ff8086 jdk7-b38 4e51997582effa006dde5c6d8b8820b2045b9c7f jdk7-b39 2201dad60231a3c3e0346e3a0250d69ca3b71fd4 jdk7-b40 +44941f893cea95ecdd5987b12e548069bd803849 jdk7-b41 From 8ffbb1eee13fb895e1864735c5c55713711447a5 Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena Date: Thu, 4 Dec 2008 11:10:35 -0800 Subject: [PATCH 179/267] Added tag jdk7-b41 for changeset 6471e8a4578f --- langtools/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/langtools/.hgtags b/langtools/.hgtags index 54d520d1a5a..8e794f05e1b 100644 --- a/langtools/.hgtags +++ b/langtools/.hgtags @@ -15,3 +15,4 @@ eaf608c64fecf70f955dc9f29f94c055b183aeec jdk7-b30 3fd42dfa6f27f2767a241fb82bc01a613f0c2096 jdk7-b38 3fb51e47622bb771571680bc6a7b64c6172b482d jdk7-b39 32e30988324601d08b87989f0821d99aa8534511 jdk7-b40 +ded6b40f558e8d19b3c17715b3d67ee001606645 jdk7-b41 From eddda26255a72fb327c353661e84c068f810b999 Mon Sep 17 00:00:00 2001 From: Poonam Bajaj Date: Thu, 4 Dec 2008 17:29:56 -0800 Subject: [PATCH 180/267] 6739363: Xcheck jni doesn't check native function arguments Fix adds support for verifying arguments with -Xcheck:jni. Reviewed-by: coleenp --- hotspot/src/os/windows/vm/os_windows.cpp | 18 +++------ hotspot/src/share/vm/includeDB_core | 1 + hotspot/src/share/vm/includeDB_features | 2 + hotspot/src/share/vm/prims/jniCheck.cpp | 12 ------ hotspot/src/share/vm/prims/jniCheck.hpp | 13 ++++++ hotspot/src/share/vm/runtime/javaCalls.cpp | 40 +++++++++++++++---- hotspot/src/share/vm/runtime/javaCalls.hpp | 2 +- .../src/share/vm/runtime/sharedRuntime.cpp | 11 +++-- 8 files changed, 63 insertions(+), 36 deletions(-) diff --git a/hotspot/src/os/windows/vm/os_windows.cpp b/hotspot/src/os/windows/vm/os_windows.cpp index bc86280bd87..be46a68e87a 100644 --- a/hotspot/src/os/windows/vm/os_windows.cpp +++ b/hotspot/src/os/windows/vm/os_windows.cpp @@ -2217,15 +2217,10 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) { // We only expect null pointers in the stubs (vtable) // the rest are checked explicitly now. // - CodeBlob* cb = CodeCache::find_blob(pc); - if (cb != NULL) { - if (VtableStubs::stub_containing(pc) != NULL) { - if (((uintptr_t)addr) < os::vm_page_size() ) { - // an access to the first page of VM--assume it is a null pointer - return Handle_Exception(exceptionInfo, - SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL)); - } - } + if (((uintptr_t)addr) < os::vm_page_size() ) { + // an access to the first page of VM--assume it is a null pointer + address stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL); + if (stub != NULL) return Handle_Exception(exceptionInfo, stub); } } } // in_java @@ -2241,9 +2236,8 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) { // Windows 98 reports faulting addresses incorrectly if (!MacroAssembler::needs_explicit_null_check((intptr_t)addr) || !os::win32::is_nt()) { - - return Handle_Exception(exceptionInfo, - SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL)); + address stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL); + if (stub != NULL) return Handle_Exception(exceptionInfo, stub); } report_error(t, exception_code, pc, exceptionInfo->ExceptionRecord, exceptionInfo->ContextRecord); diff --git a/hotspot/src/share/vm/includeDB_core b/hotspot/src/share/vm/includeDB_core index 3b4dd2e38fe..169176dbd78 100644 --- a/hotspot/src/share/vm/includeDB_core +++ b/hotspot/src/share/vm/includeDB_core @@ -2303,6 +2303,7 @@ javaCalls.cpp handles.inline.hpp javaCalls.cpp interfaceSupport.hpp javaCalls.cpp interpreter.hpp javaCalls.cpp javaCalls.hpp +javaCalls.cpp jniCheck.hpp javaCalls.cpp linkResolver.hpp javaCalls.cpp mutexLocker.hpp javaCalls.cpp nmethod.hpp diff --git a/hotspot/src/share/vm/includeDB_features b/hotspot/src/share/vm/includeDB_features index ddf2389a453..d783a04e55b 100644 --- a/hotspot/src/share/vm/includeDB_features +++ b/hotspot/src/share/vm/includeDB_features @@ -115,6 +115,8 @@ heapInspection.cpp klassOop.hpp heapInspection.cpp os.hpp heapInspection.cpp resourceArea.hpp +javaCalls.cpp jniCheck.hpp + jniCheck.cpp fieldDescriptor.hpp jniCheck.cpp handles.hpp jniCheck.cpp instanceKlass.hpp diff --git a/hotspot/src/share/vm/prims/jniCheck.cpp b/hotspot/src/share/vm/prims/jniCheck.cpp index ed26eabe642..5a905843103 100644 --- a/hotspot/src/share/vm/prims/jniCheck.cpp +++ b/hotspot/src/share/vm/prims/jniCheck.cpp @@ -112,18 +112,6 @@ static const char * fatal_instance_field_mismatch = "Field type (instance) misma static const char * fatal_non_string = "JNI string operation received a non-string"; - -// Report a JNI failure caught by -Xcheck:jni. Perform a core dump. -// Note: two variations -- one to be called when in VM state (e.g. when -// within IN_VM macro), one to be called when in NATIVE state. - -// When in VM state: -static void ReportJNIFatalError(JavaThread* thr, const char *msg) { - tty->print_cr("FATAL ERROR in native method: %s", msg); - thr->print_stack(); - os::abort(true); -} - // When in VM state: static void ReportJNIWarning(JavaThread* thr, const char *msg) { tty->print_cr("WARNING in native method: %s", msg); diff --git a/hotspot/src/share/vm/prims/jniCheck.hpp b/hotspot/src/share/vm/prims/jniCheck.hpp index c682d0908b8..f78ace017bd 100644 --- a/hotspot/src/share/vm/prims/jniCheck.hpp +++ b/hotspot/src/share/vm/prims/jniCheck.hpp @@ -22,6 +22,19 @@ * */ +extern "C" { + // Report a JNI failure caught by -Xcheck:jni. Perform a core dump. + // Note: two variations -- one to be called when in VM state (e.g. when + // within IN_VM macro), one to be called when in NATIVE state. + + // When in VM state: + static void ReportJNIFatalError(JavaThread* thr, const char *msg) { + tty->print_cr("FATAL ERROR in native method: %s", msg); + thr->print_stack(); + os::abort(true); + } +} + // // Checked JNI routines that are useful for outside of checked JNI // diff --git a/hotspot/src/share/vm/runtime/javaCalls.cpp b/hotspot/src/share/vm/runtime/javaCalls.cpp index 444bc7f77c7..38ad6973feb 100644 --- a/hotspot/src/share/vm/runtime/javaCalls.cpp +++ b/hotspot/src/share/vm/runtime/javaCalls.cpp @@ -309,8 +309,12 @@ void JavaCalls::call_helper(JavaValue* result, methodHandle* m, JavaCallArgument CHECK_UNHANDLED_OOPS_ONLY(thread->clear_unhandled_oops();) - // Make sure that the arguments have the right type - debug_only(args->verify(method, result->get_type(), thread)); + // Verify the arguments + + if (CheckJNICalls) { + args->verify(method, result->get_type(), thread); + } + else debug_only(args->verify(method, result->get_type(), thread)); // Ignore call if method is empty if (method->is_empty_method()) { @@ -431,24 +435,26 @@ intptr_t* JavaCallArguments::parameters() { return TaggedStackInterpreter ? _parameters : _value; } -//-------------------------------------------------------------------------------------- -// Non-Product code -#ifndef PRODUCT class SignatureChekker : public SignatureIterator { private: bool *_is_oop; int _pos; BasicType _return_type; + intptr_t* _value; + Thread* _thread; public: bool _is_return; - SignatureChekker(symbolHandle signature, BasicType return_type, bool is_static, bool* is_oop) : SignatureIterator(signature) { + SignatureChekker(symbolHandle signature, BasicType return_type, bool is_static, bool* is_oop, intptr_t* value, Thread* thread) : SignatureIterator(signature) { _is_oop = is_oop; _is_return = false; _return_type = return_type; _pos = 0; + _value = value; + _thread = thread; + if (!is_static) { check_value(true); // Receiver must be an oop } @@ -489,6 +495,24 @@ class SignatureChekker : public SignatureIterator { check_return_type(t); return; } + + // verify handle and the oop pointed to by handle + int p = _pos; + bool bad = false; + // If argument is oop + if (_is_oop[p]) { + intptr_t v = _value[p]; + if (v != 0 ) { + size_t t = (size_t)v; + bad = (t < (size_t)os::vm_page_size() ) || !(*(oop*)v)->is_oop_or_null(true); + if (CheckJNICalls && bad) { + ReportJNIFatalError((JavaThread*)_thread, "Bad JNI oop argument"); + } + } + // for the regular debug case. + assert(!bad, "Bad JNI oop argument"); + } + check_value(true); } @@ -505,6 +529,7 @@ class SignatureChekker : public SignatureIterator { void do_array(int begin, int end) { check_obj(T_OBJECT); } }; + void JavaCallArguments::verify(methodHandle method, BasicType return_type, Thread *thread) { guarantee(method->size_of_parameters() == size_of_parameters(), "wrong no. of arguments pushed"); @@ -515,10 +540,9 @@ void JavaCallArguments::verify(methodHandle method, BasicType return_type, // Check that oop information is correct symbolHandle signature (thread, method->signature()); - SignatureChekker sc(signature, return_type, method->is_static(),_is_oop); + SignatureChekker sc(signature, return_type, method->is_static(),_is_oop, _value, thread); sc.iterate_parameters(); sc.check_doing_return(true); sc.iterate_returntype(); } -#endif // PRODUCT diff --git a/hotspot/src/share/vm/runtime/javaCalls.hpp b/hotspot/src/share/vm/runtime/javaCalls.hpp index 5923430a533..60648c64866 100644 --- a/hotspot/src/share/vm/runtime/javaCalls.hpp +++ b/hotspot/src/share/vm/runtime/javaCalls.hpp @@ -150,7 +150,7 @@ class JavaCallArguments : public StackObj { int size_of_parameters() const { return _size; } // Verify that pushed arguments fits a given method - void verify(methodHandle method, BasicType return_type, Thread *thread) PRODUCT_RETURN; + void verify(methodHandle method, BasicType return_type, Thread *thread); }; // All calls to Java have to go via JavaCalls. Sets up the stack frame diff --git a/hotspot/src/share/vm/runtime/sharedRuntime.cpp b/hotspot/src/share/vm/runtime/sharedRuntime.cpp index ff4fe2a4f8e..76067dc8ee1 100644 --- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp +++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp @@ -556,7 +556,10 @@ address SharedRuntime::continuation_for_implicit_exception(JavaThread* thread, // the caller was at a call site, it's safe to destroy all // caller-saved registers, as these entry points do. VtableStub* vt_stub = VtableStubs::stub_containing(pc); - guarantee(vt_stub != NULL, "unable to find SEGVing vtable stub"); + + // If vt_stub is NULL, then return NULL to signal handler to report the SEGV error. + if (vt_stub == NULL) return NULL; + if (vt_stub->is_abstract_method_error(pc)) { assert(!vt_stub->is_vtable_stub(), "should never see AbstractMethodErrors from vtable-type VtableStubs"); return StubRoutines::throw_AbstractMethodError_entry(); @@ -565,7 +568,9 @@ address SharedRuntime::continuation_for_implicit_exception(JavaThread* thread, } } else { CodeBlob* cb = CodeCache::find_blob(pc); - guarantee(cb != NULL, "exception happened outside interpreter, nmethods and vtable stubs (1)"); + + // If code blob is NULL, then return NULL to signal handler to report the SEGV error. + if (cb == NULL) return NULL; // Exception happened in CodeCache. Must be either: // 1. Inline-cache check in C2I handler blob, @@ -574,7 +579,7 @@ address SharedRuntime::continuation_for_implicit_exception(JavaThread* thread, if (!cb->is_nmethod()) { guarantee(cb->is_adapter_blob(), - "exception happened outside interpreter, nmethods and vtable stubs (2)"); + "exception happened outside interpreter, nmethods and vtable stubs (1)"); // There is no handler here, so we will simply unwind. return StubRoutines::throw_NullPointerException_at_call_entry(); } From 745c0e32485e7f71f26a4372e8ca55f3b40789a6 Mon Sep 17 00:00:00 2001 From: Mandy Chung Date: Fri, 5 Dec 2008 10:28:15 -0800 Subject: [PATCH 181/267] 6764062: Revise usage of java.io.*.close Handle closing multiple open I/O streams in case close() throws IOException Reviewed-by: ksrini --- .../classes/com/sun/servicetag/Installer.java | 53 ++++++++++--------- .../com/sun/servicetag/SunConnection.java | 14 +++-- .../classes/com/sun/servicetag/Util.java | 13 +++-- .../servicetag/WindowsSystemEnvironment.java | 16 ++++-- 4 files changed, 58 insertions(+), 38 deletions(-) diff --git a/jdk/src/share/classes/com/sun/servicetag/Installer.java b/jdk/src/share/classes/com/sun/servicetag/Installer.java index 0cda7afe3d6..17555b913e9 100644 --- a/jdk/src/share/classes/com/sun/servicetag/Installer.java +++ b/jdk/src/share/classes/com/sun/servicetag/Installer.java @@ -475,7 +475,7 @@ public class Installer { String filename = "/com/sun/servicetag/resources/javase_" + version + "_swordfish.properties"; - InputStream in = Installer.class.getClass().getResourceAsStream(filename); + InputStream in = Installer.class.getResourceAsStream(filename); if (in == null) { return null; } @@ -813,7 +813,7 @@ public class Installer { locale, String.valueOf(version)).toString(); try { - in = Installer.class.getClass().getResourceAsStream(resource + ".html"); + in = Installer.class.getResourceAsStream(resource + ".html"); if (in == null) { // if the resource file is missing if (isVerbose()) { @@ -825,34 +825,39 @@ public class Installer { System.out.println("Generating " + f + " from " + resource + ".html"); } - br = new BufferedReader(new InputStreamReader(in, "UTF-8")); - pw = new PrintWriter(f, "UTF-8"); - String line = null; - while ((line = br.readLine()) != null) { - String output = line; - if (line.contains(JDK_VERSION_KEY)) { - output = line.replace(JDK_VERSION_KEY, jdkVersion); - } else if (line.contains(JDK_HEADER_PNG_KEY)) { - output = line.replace(JDK_HEADER_PNG_KEY, headerImageSrc); - } else if (line.contains(REGISTRATION_URL_KEY)) { - output = line.replace(REGISTRATION_URL_KEY, registerURL); - } else if (line.contains(REGISTRATION_PAYLOAD_KEY)) { - output = line.replace(REGISTRATION_PAYLOAD_KEY, payload.toString()); + try { + br = new BufferedReader(new InputStreamReader(in, "UTF-8")); + pw = new PrintWriter(f, "UTF-8"); + String line = null; + while ((line = br.readLine()) != null) { + String output = line; + if (line.contains(JDK_VERSION_KEY)) { + output = line.replace(JDK_VERSION_KEY, jdkVersion); + } else if (line.contains(JDK_HEADER_PNG_KEY)) { + output = line.replace(JDK_HEADER_PNG_KEY, headerImageSrc); + } else if (line.contains(REGISTRATION_URL_KEY)) { + output = line.replace(REGISTRATION_URL_KEY, registerURL); + } else if (line.contains(REGISTRATION_PAYLOAD_KEY)) { + output = line.replace(REGISTRATION_PAYLOAD_KEY, payload.toString()); + } + pw.println(output); + } + f.setReadOnly(); + pw.flush(); + } finally { + // It's safe for this finally block to have two close statements + // consecutively as PrintWriter.close doesn't throw IOException. + if (pw != null) { + pw.close(); + } + if (br!= null) { + br.close(); } - pw.println(output); } - f.setReadOnly(); - pw.flush(); } finally { - if (pw != null) { - pw.close(); - } if (in != null) { in.close(); } - if (br!= null) { - br.close(); - } } } } diff --git a/jdk/src/share/classes/com/sun/servicetag/SunConnection.java b/jdk/src/share/classes/com/sun/servicetag/SunConnection.java index 8bcddbe9714..b05657866a5 100644 --- a/jdk/src/share/classes/com/sun/servicetag/SunConnection.java +++ b/jdk/src/share/classes/com/sun/servicetag/SunConnection.java @@ -213,10 +213,16 @@ class SunConnection { con.setRequestProperty("Content-Type", "text/xml;charset=\"utf-8\""); con.connect(); - OutputStream out = con.getOutputStream(); - registration.storeToXML(out); - out.flush(); - out.close(); + OutputStream out = null; + try { + out = con.getOutputStream(); + registration.storeToXML(out); + out.flush(); + } finally { + if (out != null) { + out.close(); + } + } int returnCode = con.getResponseCode(); if (Util.isVerbose()) { diff --git a/jdk/src/share/classes/com/sun/servicetag/Util.java b/jdk/src/share/classes/com/sun/servicetag/Util.java index 9e32111a2fc..7d58d116e44 100644 --- a/jdk/src/share/classes/com/sun/servicetag/Util.java +++ b/jdk/src/share/classes/com/sun/servicetag/Util.java @@ -140,11 +140,14 @@ class Util { } return e.getMessage(); } finally { - if (r != null) { - r.close(); - } - if (err != null) { - err.close(); + try { + if (r != null) { + r.close(); + } + } finally { + if (err != null) { + err.close(); + } } } } diff --git a/jdk/src/share/classes/com/sun/servicetag/WindowsSystemEnvironment.java b/jdk/src/share/classes/com/sun/servicetag/WindowsSystemEnvironment.java index 1fff0ea7df7..aa9b83cdb6c 100644 --- a/jdk/src/share/classes/com/sun/servicetag/WindowsSystemEnvironment.java +++ b/jdk/src/share/classes/com/sun/servicetag/WindowsSystemEnvironment.java @@ -107,11 +107,17 @@ class WindowsSystemEnvironment extends SystemEnvironment { Process p = pb.start(); // need this for executing windows commands (at least // needed for executing wmic command) - BufferedWriter bw = new BufferedWriter( - new OutputStreamWriter(p.getOutputStream())); - bw.write(13); - bw.flush(); - bw.close(); + BufferedWriter bw = null; + try { + bw = new BufferedWriter( + new OutputStreamWriter(p.getOutputStream())); + bw.write(13); + bw.flush(); + } finally { + if (bw != null) { + bw.close(); + } + } p.waitFor(); if (p.exitValue() == 0) { From ee0229874300d86a03ecfc39da4714b386013455 Mon Sep 17 00:00:00 2001 From: Mandy Chung Date: Fri, 5 Dec 2008 10:30:29 -0800 Subject: [PATCH 182/267] 6750389: The cpuManufactorer does not correctly recognized for Solaris 10 Fix the correct SMBIOS type (4) to obtain CPU manufacturer Reviewed-by: ksrini --- .../classes/com/sun/servicetag/SolarisSystemEnvironment.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jdk/src/share/classes/com/sun/servicetag/SolarisSystemEnvironment.java b/jdk/src/share/classes/com/sun/servicetag/SolarisSystemEnvironment.java index f9f10684fdd..877fe039349 100644 --- a/jdk/src/share/classes/com/sun/servicetag/SolarisSystemEnvironment.java +++ b/jdk/src/share/classes/com/sun/servicetag/SolarisSystemEnvironment.java @@ -62,8 +62,8 @@ class SolarisSystemEnvironment extends SystemEnvironment { return "Sun Microsystems, Inc"; } - // if we're here, then we'll try smbios (type 3) - return getSmbiosData("3", "Manufacturer: "); + // if we're here, then we'll try smbios (type 4) + return getSmbiosData("4", "Manufacturer: "); } /** From ec343fa4bc0483a6184a4ee79f74f77d5ae8b754 Mon Sep 17 00:00:00 2001 From: Erik Trimble Date: Fri, 5 Dec 2008 15:45:24 -0800 Subject: [PATCH 183/267] 6781742: Bump HS14 build number to 09 Update Hotspot 14 build number to b09 Reviewed-by: jcoomes --- hotspot/make/hotspot_version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hotspot/make/hotspot_version b/hotspot/make/hotspot_version index fe716dd3731..a932f652954 100644 --- a/hotspot/make/hotspot_version +++ b/hotspot/make/hotspot_version @@ -35,7 +35,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2008 HS_MAJOR_VER=14 HS_MINOR_VER=0 -HS_BUILD_NUMBER=08 +HS_BUILD_NUMBER=09 JDK_MAJOR_VER=1 JDK_MINOR_VER=7 From d90b02d794371b75d8127184ccac40feb2353a90 Mon Sep 17 00:00:00 2001 From: Kelly O'Hair Date: Fri, 5 Dec 2008 17:18:04 -0800 Subject: [PATCH 184/267] 6781784: Fix ant link in build readme Reviewed-by: michaelm --- README-builds.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README-builds.html b/README-builds.html index ce77a659f11..1f4a498958b 100644 --- a/README-builds.html +++ b/README-builds.html @@ -839,7 +839,7 @@
      All OpenJDK builds require access to least Ant 1.6.5. The Ant tool is available from the - + Ant download site. You should always make sure ant is in your PATH, and on Windows you may also need to set From c07de94ae310df04fdde2f7ee158e22bed411c5f Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Mon, 8 Dec 2008 15:50:55 -0500 Subject: [PATCH 185/267] 6773838: There is no calling stack for Compiler thread in hs_err file on x86 On solaris, the inline assembly wasn't being processed. Added volatile to il file fixed it. Reviewed-by: phh, kvn --- hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp | 4 ++-- hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_32.il | 6 +++--- hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_64.il | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp b/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp index b21206dd227..011b671e850 100644 --- a/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp +++ b/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp @@ -203,10 +203,10 @@ frame os::get_sender_for_C_frame(frame* fr) { return frame(fr->sender_sp(), fr->link(), fr->sender_pc()); } -extern "C" intptr_t *_get_previous_fp(); // in .il file. +extern "C" intptr_t *_get_current_fp(); // in .il file frame os::current_frame() { - intptr_t* fp = _get_previous_fp(); + intptr_t* fp = _get_current_fp(); // it's inlined so want current fp frame myframe((intptr_t*)os::current_stack_pointer(), (intptr_t*)fp, CAST_FROM_FN_PTR(address, os::current_frame)); diff --git a/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_32.il b/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_32.il index 49ae97729fe..9e1d6ce8ed3 100644 --- a/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_32.il +++ b/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_32.il @@ -37,10 +37,10 @@ movl %gs:0, %eax .end - // Get callers fp - .inline _get_previous_fp,0 + // Get current fp + .inline _get_current_fp,0 + .volatile movl %ebp, %eax - movl %eax, %eax .end // Support for jint Atomic::add(jint inc, volatile jint* dest) diff --git a/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_64.il b/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_64.il index 89ed2c87b68..169bebc9984 100644 --- a/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_64.il +++ b/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_64.il @@ -30,10 +30,10 @@ movq %fs:0, %rax .end - // Get the frame pointer from previous frame. - .inline _get_previous_fp,0 + // Get the frame pointer from current frame. + .inline _get_current_fp,0 + .volatile movq %rbp, %rax - movq %rax, %rax .end // Support for jint Atomic::add(jint add_value, volatile jint* dest) From e50f766540eefd04aa43ae9e7d67e51f11acd6cd Mon Sep 17 00:00:00 2001 From: John R Rose Date: Mon, 8 Dec 2008 17:15:02 -0800 Subject: [PATCH 186/267] 6779339: turn off LinkWellKnownClasses by default pending further testing Temporarily turn off LinkWellKnownClasses optimization Reviewed-by: never, kvn --- hotspot/src/share/vm/classfile/classFileParser.cpp | 9 ++++++--- hotspot/src/share/vm/runtime/globals.hpp | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/hotspot/src/share/vm/classfile/classFileParser.cpp b/hotspot/src/share/vm/classfile/classFileParser.cpp index 45d0147fa7d..703217f9255 100644 --- a/hotspot/src/share/vm/classfile/classFileParser.cpp +++ b/hotspot/src/share/vm/classfile/classFileParser.cpp @@ -581,7 +581,8 @@ objArrayHandle ClassFileParser::parse_interfaces(constantPoolHandle cp, interf = KlassHandle(THREAD, k); vmtimer->resume(); - cp->klass_at_put(interface_index, interf()); // eagerly resolve + if (LinkWellKnownClasses) // my super type is well known to me + cp->klass_at_put(interface_index, interf()); // eagerly resolve } if (!Klass::cast(interf())->is_interface()) { @@ -2699,7 +2700,8 @@ instanceKlassHandle ClassFileParser::parseClassFile(symbolHandle name, CHECK_(nullHandle)); KlassHandle kh (THREAD, k); super_klass = instanceKlassHandle(THREAD, kh()); - cp->klass_at_put(super_class_index, super_klass()); // eagerly resolve + if (LinkWellKnownClasses) // my super class is well known to me + cp->klass_at_put(super_class_index, super_klass()); // eagerly resolve } if (super_klass.not_null()) { if (super_klass->is_interface()) { @@ -3128,7 +3130,8 @@ instanceKlassHandle ClassFileParser::parseClassFile(symbolHandle name, this_klass->set_method_ordering(method_ordering()); this_klass->set_initial_method_idnum(methods->length()); this_klass->set_name(cp->klass_name_at(this_class_index)); - cp->klass_at_put(this_class_index, this_klass()); // eagerly resolve + if (LinkWellKnownClasses) // I am well known to myself + cp->klass_at_put(this_class_index, this_klass()); // eagerly resolve this_klass->set_protection_domain(protection_domain()); this_klass->set_fields_annotations(fields_annotations()); this_klass->set_methods_annotations(methods_annotations()); diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index c4272a56aa9..a6a48be196d 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -815,7 +815,7 @@ class CommandLineFlags { product(bool, ClassUnloading, true, \ "Do unloading of classes") \ \ - diagnostic(bool, LinkWellKnownClasses, true, \ + diagnostic(bool, LinkWellKnownClasses, false, \ "Resolve a well known class as soon as its name is seen") \ \ develop(bool, DisableStartThread, false, \ From 5588717cc48fdb82e2f6c23f4ff61d7553e5be51 Mon Sep 17 00:00:00 2001 From: Eamonn McManus Date: Tue, 9 Dec 2008 12:01:07 +0100 Subject: [PATCH 187/267] 6774918: @NotificationInfo is ineffective on MBeans that cannot send notifications Reviewed-by: jfdenise --- .../sun/jmx/mbeanserver/MBeanInjector.java | 4 + .../jmx/mbeanserver/MBeanIntrospector.java | 16 +- .../javax/management/NotificationInfo.java | 24 ++- .../AnnotatedNotificationInfoTest.java | 180 +++++++++++++++--- 4 files changed, 194 insertions(+), 30 deletions(-) diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanInjector.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanInjector.java index 8ef296a1a4c..4917d089e8d 100644 --- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanInjector.java +++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanInjector.java @@ -47,6 +47,10 @@ import java.util.List; import javax.management.SendNotification; public class MBeanInjector { + // There are no instances of this class + private MBeanInjector() { + } + private static Class[] injectedClasses = { MBeanServer.class, ObjectName.class, SendNotification.class, }; diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanIntrospector.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanIntrospector.java index 3f2a9cc91a0..d1968b514ee 100644 --- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanIntrospector.java +++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanIntrospector.java @@ -44,7 +44,6 @@ import javax.management.Descriptor; import javax.management.ImmutableDescriptor; import javax.management.IntrospectionException; import javax.management.InvalidAttributeValueException; -import javax.management.JMX; import javax.management.MBean; import javax.management.MBeanAttributeInfo; import javax.management.MBeanConstructorInfo; @@ -538,6 +537,14 @@ public abstract class MBeanIntrospector { } } + /* + * Return the array of MBeanNotificationInfo for the given MBean object. + * If the object implements NotificationBroadcaster and its + * getNotificationInfo() method returns a non-empty array, then that + * is the result. Otherwise, if the object has a @NotificationInfo + * or @NotificationInfos annotation, then its contents form the result. + * Otherwise, the result is null. + */ static MBeanNotificationInfo[] findNotifications(Object moi) { if (moi instanceof NotificationBroadcaster) { MBeanNotificationInfo[] mbn = @@ -553,6 +560,13 @@ public abstract class MBeanIntrospector { } return result; } + } else { + try { + if (!MBeanInjector.injectsSendNotification(moi)) + return null; + } catch (NotCompliantMBeanException e) { + throw new RuntimeException(e); + } } return findNotificationsFromAnnotations(moi.getClass()); } diff --git a/jdk/src/share/classes/javax/management/NotificationInfo.java b/jdk/src/share/classes/javax/management/NotificationInfo.java index 29712c5b2d3..a5c2f46ac03 100644 --- a/jdk/src/share/classes/javax/management/NotificationInfo.java +++ b/jdk/src/share/classes/javax/management/NotificationInfo.java @@ -44,7 +44,13 @@ import java.lang.annotation.Target; * "com.example.notifs.destroy"}) * public interface CacheMBean {...} * - * public class Cache implements CacheMBean {...} + * public class Cache + * extends NotificationBroadcasterSupport implements CacheMBean { + * public Cache() { + * super(); // do not supply any MBeanNotificationInfo[] + * } + * ... + * } * * *
      @@ -52,7 +58,11 @@ import java.lang.annotation.Target;
        * {@link MBean @MBean}
        * {@code @NotificationInfo}(types={"com.example.notifs.create",
        *                          "com.example.notifs.destroy"})
      - * public class Cache {...}
      + * public class Cache {
      + *     {@code @Resource}
      + *     private volatile SendNotification sendNotification;
      + *     ...
      + * }
        * 
      * *

      Each {@code @NotificationInfo} produces an {@link @@ -64,6 +74,13 @@ import java.lang.annotation.Target; * several {@code @NotificationInfo} annotations into a containing * {@link NotificationInfos @NotificationInfos} annotation. * + *

      The {@code @NotificationInfo} and {@code @NotificationInfos} annotations + * are ignored on an MBean that is not a {@linkplain JMX#isNotificationSource + * notification source} or that implements {@link NotificationBroadcaster} and + * returns a non-empty array from its {@link + * NotificationBroadcaster#getNotificationInfo() getNotificationInfo()} + * method.

      + * *

      The {@code NotificationInfo} and {@code NotificationInfos} * annotations can be applied to the MBean implementation class, or to * any parent class or interface. These annotations on a class take @@ -71,7 +88,8 @@ import java.lang.annotation.Target; * If an MBean does not have these annotations on its class or any * superclass, then superinterfaces are examined. It is an error for * more than one superinterface to have these annotations, unless one - * of them is a child of all the others.

      + * of them is a descendant of all the others; registering such an erroneous + * MBean will cause a {@link NotCompliantMBeanException}.

      */ @Documented @Inherited diff --git a/jdk/test/javax/management/Introspector/AnnotatedNotificationInfoTest.java b/jdk/test/javax/management/Introspector/AnnotatedNotificationInfoTest.java index a995ee59b60..aa9b34b3cdb 100644 --- a/jdk/test/javax/management/Introspector/AnnotatedNotificationInfoTest.java +++ b/jdk/test/javax/management/Introspector/AnnotatedNotificationInfoTest.java @@ -38,19 +38,34 @@ import javax.management.AttributeChangeNotification; import javax.management.Description; import javax.management.Descriptor; import javax.management.ImmutableDescriptor; +import javax.management.ListenerNotFoundException; import javax.management.MBean; import javax.management.MBeanInfo; import javax.management.MBeanNotificationInfo; import javax.management.MBeanServer; import javax.management.MXBean; +import javax.management.Notification; +import javax.management.NotificationBroadcaster; import javax.management.NotificationBroadcasterSupport; +import javax.management.NotificationFilter; import javax.management.NotificationInfo; import javax.management.NotificationInfos; +import javax.management.NotificationListener; import javax.management.ObjectName; import javax.management.SendNotification; public class AnnotatedNotificationInfoTest { - // Data for the first test. This tests that MBeanNotificationInfo + + static final Descriptor expectedDescriptor = new ImmutableDescriptor( + "foo=bar", "descriptionResourceBundleBaseName=bundle", + "descriptionResourceKey=key"); + static final MBeanNotificationInfo expected = new MBeanNotificationInfo( + new String[] {"foo", "bar"}, + AttributeChangeNotification.class.getName(), + "description", + expectedDescriptor); + + // Data for the first kind of test. This tests that MBeanNotificationInfo // is correctly derived from @NotificationInfo. // Every static field called mbean* is expected to be an MBean // with a single MBeanNotificationInfo that has the same value @@ -254,11 +269,48 @@ public class AnnotatedNotificationInfoTest { private static Object mbeanMXBean2 = new MXBean2(); - // Classes for the second test. This tests the simplest case, which is - // the first example in the javadoc for @NotificationInfo. Notice that - // this MBean is not a NotificationBroadcaster and does not inject a - // SendNotification! That should possibly be an error, but it's currently - // allowed by the spec. + // Test that @NotificationInfo and @NotificationInfos are ignored if + // the MBean returns a non-empty MBeanNotificationInfo[] from its + // NotificationBroadcaster.getNotifications() implementation. + + @NotificationInfo(types={"blim", "blam"}) + public static interface Explicit1MBean {} + + public static class Explicit1 + extends NotificationBroadcasterSupport implements Explicit1MBean { + public Explicit1() { + super(expected); + } + } + + private static Object mbeanExplicit1 = new Explicit1(); + + @NotificationInfos( + { + @NotificationInfo(types="blim"), @NotificationInfo(types="blam") + } + ) + public static interface Explicit2MXBean {} + + public static class Explicit2 + implements NotificationBroadcaster, Explicit2MXBean { + public void addNotificationListener(NotificationListener listener, + NotificationFilter filter, Object handback) {} + + public void removeNotificationListener(NotificationListener listener) + throws ListenerNotFoundException {} + + public MBeanNotificationInfo[] getNotificationInfo() { + return new MBeanNotificationInfo[] {expected}; + } + } + + // Data for the second kind of test. This tests that @NotificationInfo is + // ignored if the MBean is not a notification source. Every static + // field called ignoredMBean* is expected to be an MBean on which + // isInstanceOf(NotificationBroadcaster.class.getName() is false, + // addNotificationListener produces an exception, and the + // MBeanNotificationInfo array is empty. @NotificationInfo(types={"com.example.notifs.create", "com.example.notifs.destroy"}) public static interface CacheMBean { @@ -271,6 +323,73 @@ public class AnnotatedNotificationInfoTest { } } + private static Object ignoredMBean1 = new Cache(); + + @NotificationInfos( + @NotificationInfo(types={"foo", "bar"}) + ) + public static interface Cache2MBean { + public int getCachedNum(); + } + + public static class Cache2 implements Cache2MBean { + public int getCachedNum() { + return 0; + } + } + + private static Object ignoredMBean2 = new Cache2(); + + private static final NotificationListener nullListener = + new NotificationListener() { + public void handleNotification( + Notification notification, Object handback) {} + }; + + // Test that inheriting inconsistent @NotificationInfo annotations is + // an error, but not if they are overridden by a non-empty getNotifications() + + @NotificationInfo(types={"blim"}) + public static interface Inconsistent1 {} + + @NotificationInfo(types={"blam"}) + public static interface Inconsistent2 {} + + public static interface InconsistentMBean extends Inconsistent1, Inconsistent2 {} + + public static class Inconsistent + extends NotificationBroadcasterSupport implements InconsistentMBean {} + + public static class Consistent + extends Inconsistent implements NotificationBroadcaster { + public void addNotificationListener(NotificationListener listener, + NotificationFilter filter, Object handback) {} + + public void removeNotificationListener(NotificationListener listener) + throws ListenerNotFoundException {} + + public MBeanNotificationInfo[] getNotificationInfo() { + return new MBeanNotificationInfo[] {expected}; + } + } + + private static Object mbeanConsistent = new Consistent(); + + @NotificationInfo( + types = {"foo", "bar"}, + notificationClass = AttributeChangeNotification.class, + description = @Description( + value = "description", + bundleBaseName = "bundle", + key = "key"), + descriptorFields = {"foo=bar"}) + public static interface Consistent2MBean extends Inconsistent1, Inconsistent2 {} + + public static class Consistent2 + extends NotificationBroadcasterSupport implements Consistent2MBean {} + + private static Object mbeanConsistent2 = new Consistent2(); + public static void main(String[] args) throws Exception { if (!AnnotatedNotificationInfoTest.class.desiredAssertionStatus()) throw new Exception("Test must be run with -ea"); @@ -278,37 +397,46 @@ public class AnnotatedNotificationInfoTest { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); ObjectName on = new ObjectName("a:b=c"); - Descriptor expectedDescriptor = new ImmutableDescriptor( - "foo=bar", "descriptionResourceBundleBaseName=bundle", - "descriptionResourceKey=key"); - MBeanNotificationInfo expected = new MBeanNotificationInfo( - new String[] {"foo", "bar"}, - AttributeChangeNotification.class.getName(), - "description", - expectedDescriptor); - System.out.println("Testing MBeans..."); for (Field mbeanField : AnnotatedNotificationInfoTest.class.getDeclaredFields()) { - if (!mbeanField.getName().startsWith("mbean")) + boolean notifier; + if (mbeanField.getName().startsWith("mbean")) + notifier = true; + else if (mbeanField.getName().startsWith("ignoredMBean")) + notifier = false; + else continue; System.out.println("..." + mbeanField.getName()); Object mbean = mbeanField.get(null); mbs.registerMBean(mbean, on); MBeanInfo mbi = mbs.getMBeanInfo(on); MBeanNotificationInfo[] mbnis = mbi.getNotifications(); - assert mbnis.length == 1 : mbnis.length; - assert mbnis[0].equals(expected) : mbnis[0]; + if (notifier) { + assert mbnis.length == 1 : mbnis.length; + assert mbnis[0].equals(expected) : mbnis[0]; + } else { + assert mbnis.length == 0 : mbnis.length; + assert !mbs.isInstanceOf(on, NotificationBroadcaster.class.getName()); + try { + mbs.addNotificationListener(on, nullListener, null, null); + assert false : "addNotificationListener works"; + } catch (Exception e) { + // OK: addNL correctly refused + } + } mbs.unregisterMBean(on); } - mbs.registerMBean(new Cache(), on); - MBeanInfo mbi = mbs.getMBeanInfo(on); - MBeanNotificationInfo[] mbnis = mbi.getNotifications(); - assert mbnis.length == 1 : mbnis.length; - String[] types = mbnis[0].getNotifTypes(); - String[] expectedTypes = - CacheMBean.class.getAnnotation(NotificationInfo.class).types(); - assert Arrays.equals(types, expectedTypes) : Arrays.toString(types); + // Test that inconsistent @NotificationInfo annotations produce an + // error. + try { + mbs.registerMBean(new Inconsistent(), on); + System.out.println(mbs.getMBeanInfo(on)); + assert false : "Inconsistent @NotificationInfo not detected"; + } catch (Exception e) { + System.out.println( + "Inconsistent @NotificationInfo correctly produced " + e); + } } } From 049436370fd35ebb2b294c37b5d28cc005ff456b Mon Sep 17 00:00:00 2001 From: Jean-Francois Denise Date: Tue, 9 Dec 2008 14:44:42 +0100 Subject: [PATCH 188/267] 6501362: DescriptorSupport(String) could recognize "name=value" as well as XML format Reviewed-by: emcmanus --- .../modelmbean/DescriptorSupport.java | 50 +++++++++++++------ .../descriptor/DescriptorConstructorTest.java | 46 +++++++++++++++++ 2 files changed, 82 insertions(+), 14 deletions(-) create mode 100644 jdk/test/javax/management/descriptor/DescriptorConstructorTest.java diff --git a/jdk/src/share/classes/javax/management/modelmbean/DescriptorSupport.java b/jdk/src/share/classes/javax/management/modelmbean/DescriptorSupport.java index ee8e3030e54..aa364c226dd 100644 --- a/jdk/src/share/classes/javax/management/modelmbean/DescriptorSupport.java +++ b/jdk/src/share/classes/javax/management/modelmbean/DescriptorSupport.java @@ -229,9 +229,10 @@ public class DescriptorSupport init(inDescr.descriptorMap); } - /** - *

      Descriptor constructor taking an XML String.

      + *

      Descriptor constructor taking an XML String or a + * fieldName=fieldValue format String. The String parameter is + * parsed as XML if it begins with a '<' character.

      * *

      The format of the XML string is not defined, but an * implementation must ensure that the string returned by @@ -244,17 +245,20 @@ public class DescriptorSupport * programmer will have to reset or convert these fields * correctly.

      * - * @param inStr An XML-formatted string used to populate this - * Descriptor. The format is not defined, but any + * @param inStr An XML-format or a fieldName=fieldValue formatted string + * used to populate this Descriptor. The XML format is not defined, but any * implementation must ensure that the string returned by * method {@link #toXMLString toXMLString} on an existing * descriptor can be used to instantiate an equivalent * descriptor when instantiated using this constructor. * - * @exception RuntimeOperationsException If the String inStr - * passed in parameter is null + * @exception RuntimeOperationsException If the String inStr passed in + * parameter is null or, when it is not an XML string, if the field name or + * field value is illegal. If inStr is not an XML string then it must + * contain an "=". "fieldValue", "fieldName", and "fieldValue" are illegal. + * FieldName cannot be empty. "fieldName=" will cause the value to be empty. * @exception XMLParseException XML parsing problem while parsing - * the input String + * the XML-format input String * @exception MBeanException Wraps a distributed communication Exception. */ /* At some stage we should rewrite this code to be cleverer. Using @@ -283,14 +287,27 @@ public class DescriptorSupport throw new RuntimeOperationsException(iae, msg); } + // parse parameter string into structures + + init(null); + + if(!inStr.startsWith("<")) { + parseNamesValues(inStr); + if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { + MODELMBEAN_LOGGER.logp(Level.FINEST, + DescriptorSupport.class.getName(), + "Descriptor(name=value)", "Exit"); + } + return; + } + final String lowerInStr = inStr.toLowerCase(); if (!lowerInStr.startsWith("") || !lowerInStr.endsWith("")) { throw new XMLParseException("No , pair"); } - // parse xmlstring into structures - init(null); + // create dummy descriptor: should have same size // as number of fields in xmlstring // loop through structures and put them in descriptor @@ -454,6 +471,16 @@ public class DescriptorSupport init(null); + parseNamesValues(fields); + + if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { + MODELMBEAN_LOGGER.logp(Level.FINEST, + DescriptorSupport.class.getName(), + "Descriptor(String... fields)", "Exit"); + } + } + + private void parseNamesValues(String... fields) { for (int i=0; i < fields.length; i++) { if ((fields[i] == null) || (fields[i].equals(""))) { continue; @@ -495,11 +522,6 @@ public class DescriptorSupport setField(fieldName,fieldValue); } - if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) { - MODELMBEAN_LOGGER.logp(Level.FINEST, - DescriptorSupport.class.getName(), - "Descriptor(String... fields)", "Exit"); - } } private void init(Map initMap) { diff --git a/jdk/test/javax/management/descriptor/DescriptorConstructorTest.java b/jdk/test/javax/management/descriptor/DescriptorConstructorTest.java new file mode 100644 index 00000000000..0906cead4a5 --- /dev/null +++ b/jdk/test/javax/management/descriptor/DescriptorConstructorTest.java @@ -0,0 +1,46 @@ +/* + * Copyright 2004-2005 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 6501362 + * @summary DescriptorSupport(String) could recognize "name=value" as well as XML format + * @author Jean-Francois Denise + * @run clean DescriptorConstructorTest + * @run build DescriptorConstructorTest + * @run main DescriptorConstructorTest + */ + +import javax.management.modelmbean.DescriptorSupport; + +public class DescriptorConstructorTest { + public static void main(String[] args) throws Exception { + DescriptorSupport d1 = new DescriptorSupport("MyName1=MyValue1"); + if(!d1.getFieldValue("MyName1").equals("MyValue1")) + throw new Exception("Invalid parsing"); + DescriptorSupport d2 = new DescriptorSupport("" + + ""); + if(!d2.getFieldValue("MyName2").equals("MyValue2")) + throw new Exception("Invalid parsing"); + } +} From 04950cd8463f130e211e26ddd573ce9d11565263 Mon Sep 17 00:00:00 2001 From: Jean-Francois Denise Date: Tue, 9 Dec 2008 15:36:14 +0100 Subject: [PATCH 189/267] 6250014: MBeanOperationInfo Descriptor field for exceptions Reviewed-by: emcmanus --- .../sun/jmx/mbeanserver/ConvertingMethod.java | 2 +- .../com/sun/jmx/mbeanserver/Introspector.java | 41 ++- .../jmx/mbeanserver/MBeanIntrospector.java | 2 +- .../jmx/mbeanserver/MXBeanIntrospector.java | 2 +- .../classes/javax/management/Descriptor.java | 15 ++ .../share/classes/javax/management/JMX.java | 12 + .../javax/management/MBeanAttributeInfo.java | 6 +- .../management/MBeanConstructorInfo.java | 2 +- .../javax/management/MBeanOperationInfo.java | 2 +- .../ExceptionsDescriptorTest.java | 245 ++++++++++++++++++ 10 files changed, 320 insertions(+), 9 deletions(-) create mode 100644 jdk/test/javax/management/Introspector/ExceptionsDescriptorTest.java diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/ConvertingMethod.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/ConvertingMethod.java index 1f802ca76d0..62239b5a984 100644 --- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/ConvertingMethod.java +++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/ConvertingMethod.java @@ -53,7 +53,7 @@ final class ConvertingMethod { } Descriptor getDescriptor() { - return Introspector.descriptorForElement(method); + return Introspector.descriptorForElement(method, false); } Type getGenericReturnType() { diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java index da4209cd2b3..dbf45b9997a 100644 --- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java +++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java @@ -63,7 +63,10 @@ import java.beans.BeanInfo; import java.beans.PropertyDescriptor; import java.lang.reflect.Array; import java.lang.reflect.InvocationTargetException; +import java.util.LinkedHashSet; +import java.util.Set; import javax.management.AttributeNotFoundException; +import javax.management.JMX; import javax.management.openmbean.CompositeData; import javax.management.openmbean.MXBeanMappingFactory; @@ -462,11 +465,31 @@ public class Introspector { return null; } - public static Descriptor descriptorForElement(final AnnotatedElement elmt) { + public static Descriptor descriptorForElement(final AnnotatedElement elmt, + boolean isSetter) { if (elmt == null) return ImmutableDescriptor.EMPTY_DESCRIPTOR; final Annotation[] annots = elmt.getAnnotations(); - return descriptorForAnnotations(annots); + Descriptor descr = descriptorForAnnotations(annots); + String[] exceptions = {}; + if(elmt instanceof Method) + exceptions = getAllExceptions(((Method) elmt).getExceptionTypes()); + else + if(elmt instanceof Constructor) + exceptions = getAllExceptions(((Constructor) elmt). + getExceptionTypes()); + + if(exceptions.length > 0 ) { + String fieldName = isSetter ? JMX.SET_EXCEPTIONS_FIELD : + JMX.EXCEPTIONS_FIELD; + + String[] fieldNames = {fieldName}; + Object[] fieldValues = {exceptions}; + descr = ImmutableDescriptor.union(descr, + new ImmutableDescriptor(fieldNames, fieldValues)); + } + + return descr; } public static Descriptor descriptorForAnnotation(Annotation annot) { @@ -489,6 +512,20 @@ public class Introspector { return new ImmutableDescriptor(descriptorMap); } + /** + * Array of thrown excepions. + * @param exceptions can be null; + * @return An Array of Exception class names. Size is 0 if method is null. + */ + private static String[] getAllExceptions(Class[] exceptions) { + Set set = new LinkedHashSet(); + for(Classex : exceptions) + set.add(ex.getName()); + + String[] arr = new String[set.size()]; + return set.toArray(arr); + } + private static void addDescriptorFieldsToMap( Map descriptorMap, DescriptorFields df) { for (String field : df.value()) { diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanIntrospector.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanIntrospector.java index d1968b514ee..50ce702e871 100644 --- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanIntrospector.java +++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanIntrospector.java @@ -403,7 +403,7 @@ public abstract class MBeanIntrospector { new ImmutableDescriptor(interfaceClassName); final Descriptor mbeanDescriptor = getBasicMBeanDescriptor(); final Descriptor annotatedDescriptor = - Introspector.descriptorForElement(mbeanInterface); + Introspector.descriptorForElement(mbeanInterface, false); final Descriptor descriptor = DescriptorCache.getInstance().union( classNameDescriptor, diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/MXBeanIntrospector.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/MXBeanIntrospector.java index af5420c38f3..fb9b3ccb093 100644 --- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/MXBeanIntrospector.java +++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/MXBeanIntrospector.java @@ -292,7 +292,7 @@ class MXBeanIntrospector extends MBeanIntrospector { Descriptor descriptor = typeDescriptor(returnType, originalReturnType); descriptor = ImmutableDescriptor.union(descriptor, - Introspector.descriptorForElement(method)); + Introspector.descriptorForElement(method, false)); final MBeanOperationInfo oi; if (openReturnType && openParameterTypes) { /* If the return value and all the parameters can be faithfully diff --git a/jdk/src/share/classes/javax/management/Descriptor.java b/jdk/src/share/classes/javax/management/Descriptor.java index b9c98f4068b..a9161903c64 100644 --- a/jdk/src/share/classes/javax/management/Descriptor.java +++ b/jdk/src/share/classes/javax/management/Descriptor.java @@ -147,6 +147,14 @@ import javax.management.openmbean.OpenType; * might be disabled if it cannot currently be emitted but could be in * other circumstances. * + * exceptionsString[] + * MBeanAttributeInfo, MBeanConstructorInfo, MBeanOperationInfo + * + * The class names of the exceptions that can be thrown when invoking a + * constructor or operation, or getting an attribute. Exceptions thrown when + * setting an attribute are specified by the field + * {@code setExceptions}. + * * immutableInfoString * MBeanInfo * @@ -270,6 +278,13 @@ import javax.management.openmbean.OpenType; * href="MXBean.html#type-names">Type Names of the MXBean * specification.

      * + * setExceptionsString[] + * MBeanAttributeInfo + * + * The class names of the exceptions that can be thrown when setting + * an attribute. Exceptions thrown when getting an attribute are specified + * by the field {@code exceptions}. + * * severityString
      Integer * MBeanNotificationInfo * diff --git a/jdk/src/share/classes/javax/management/JMX.java b/jdk/src/share/classes/javax/management/JMX.java index d9329e0c3d4..3e551f3902f 100644 --- a/jdk/src/share/classes/javax/management/JMX.java +++ b/jdk/src/share/classes/javax/management/JMX.java @@ -75,6 +75,12 @@ public class JMX { public static final String DESCRIPTION_RESOURCE_KEY_FIELD = "descriptionResourceKey"; + /** + * The name of the {@code + * exceptions} field. + */ + public static final String EXCEPTIONS_FIELD = "exceptions"; + /** * The name of the {@code * immutableInfo} field. @@ -137,6 +143,12 @@ public class JMX { */ public static final String ORIGINAL_TYPE_FIELD = "originalType"; + /** + * The name of the {@code + * setExceptions} field. + */ + public static final String SET_EXCEPTIONS_FIELD = "setExceptions"; + /** *

      Options to apply to an MBean proxy or to an instance of {@link * StandardMBean}.

      diff --git a/jdk/src/share/classes/javax/management/MBeanAttributeInfo.java b/jdk/src/share/classes/javax/management/MBeanAttributeInfo.java index 2566c3e48a2..b4bcfaf4585 100644 --- a/jdk/src/share/classes/javax/management/MBeanAttributeInfo.java +++ b/jdk/src/share/classes/javax/management/MBeanAttributeInfo.java @@ -186,8 +186,10 @@ public class MBeanAttributeInfo extends MBeanFeatureInfo implements Cloneable { (getter != null), (setter != null), isIs(getter), - ImmutableDescriptor.union(Introspector.descriptorForElement(getter), - Introspector.descriptorForElement(setter))); + ImmutableDescriptor.union(Introspector. + descriptorForElement(getter, false), + Introspector.descriptorForElement(setter, + true))); } /** diff --git a/jdk/src/share/classes/javax/management/MBeanConstructorInfo.java b/jdk/src/share/classes/javax/management/MBeanConstructorInfo.java index 872c723e3af..e3e210318d8 100644 --- a/jdk/src/share/classes/javax/management/MBeanConstructorInfo.java +++ b/jdk/src/share/classes/javax/management/MBeanConstructorInfo.java @@ -67,7 +67,7 @@ public class MBeanConstructorInfo extends MBeanFeatureInfo implements Cloneable public MBeanConstructorInfo(String description, Constructor constructor) { this(constructor.getName(), description, constructorSignature(constructor), - Introspector.descriptorForElement(constructor)); + Introspector.descriptorForElement(constructor, false)); } /** diff --git a/jdk/src/share/classes/javax/management/MBeanOperationInfo.java b/jdk/src/share/classes/javax/management/MBeanOperationInfo.java index 006fc345d93..c3ee5382612 100644 --- a/jdk/src/share/classes/javax/management/MBeanOperationInfo.java +++ b/jdk/src/share/classes/javax/management/MBeanOperationInfo.java @@ -113,7 +113,7 @@ public class MBeanOperationInfo extends MBeanFeatureInfo implements Cloneable { methodSignature(method), method.getReturnType().getName(), UNKNOWN, - Introspector.descriptorForElement(method)); + Introspector.descriptorForElement(method, false)); } /** diff --git a/jdk/test/javax/management/Introspector/ExceptionsDescriptorTest.java b/jdk/test/javax/management/Introspector/ExceptionsDescriptorTest.java new file mode 100644 index 00000000000..5b931ba7294 --- /dev/null +++ b/jdk/test/javax/management/Introspector/ExceptionsDescriptorTest.java @@ -0,0 +1,245 @@ +/* + * 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. + * + * 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 %M% %I% + * @bug 6250014 + * @summary Test that Exceptions are added to the MbeanInfo + * @author Jean-Francois Denise + * @run main/othervm ExceptionsDescriptorTest + */ +import java.lang.management.ManagementFactory; +import java.util.HashSet; +import java.util.Set; +import javax.management.Descriptor; +import javax.management.JMX; +import javax.management.MBeanAttributeInfo; +import javax.management.MBeanConstructorInfo; +import javax.management.MBeanInfo; +import javax.management.MBeanOperationInfo; +import javax.management.ObjectName; + +public class ExceptionsDescriptorTest { + + private static final ObjectName OBJECT_NAME = ObjectName.valueOf(":type=Foo"); + final static String EXCEPTION_NAME = Exception.class.getName(); + final static String ILLEGAL_ARGUMENT_EXCEPTION_NAME = + IllegalArgumentException.class.getName(); + final static Set ONE_EXCEPTION = new HashSet(); + final static Set TWO_EXCEPTION = new HashSet(); + static { + ONE_EXCEPTION.add(EXCEPTION_NAME); + TWO_EXCEPTION.add(EXCEPTION_NAME); + TWO_EXCEPTION.add(ILLEGAL_ARGUMENT_EXCEPTION_NAME); + } + public interface TestMBean { + + public void doIt(); + + public void doIt(String str) throws Exception; + + public void doIt(String str, boolean b) throws Exception, + IllegalArgumentException; + + public String getThat(); + + public void setThat(String that); + + public String getThe() throws Exception; + + public void setThe(String the); + + public String getThese(); + + public void setThese(String the) throws Exception; + + public String getIt() throws Exception; + + public void setIt(String str) throws Exception; + + public String getThis() throws Exception, IllegalArgumentException; + + public void setThose(String str) throws Exception, + IllegalArgumentException; + } + + public static class Test implements TestMBean { + + public Test() { + } + + public Test(int i) throws Exception { + } + + public Test(int i, int j) throws Exception, IllegalArgumentException { + } + + public void doIt() { + throw new UnsupportedOperationException("Not supported yet."); + } + + public void doIt(String str) throws Exception { + throw new UnsupportedOperationException("Not supported yet."); + } + + public void doIt(String str, boolean b) throws Exception, IllegalArgumentException { + throw new UnsupportedOperationException("Not supported yet."); + } + + public String getThat() { + throw new UnsupportedOperationException("Not supported yet."); + } + + public void setThat(String that) { + throw new UnsupportedOperationException("Not supported yet."); + } + + public String getThe() throws Exception { + throw new UnsupportedOperationException("Not supported yet."); + } + + public void setThe(String the) { + throw new UnsupportedOperationException("Not supported yet."); + } + + public String getThese() { + throw new UnsupportedOperationException("Not supported yet."); + } + + public void setThese(String the) throws Exception { + throw new UnsupportedOperationException("Not supported yet."); + } + + public String getIt() throws Exception { + throw new UnsupportedOperationException("Not supported yet."); + } + + public void setIt(String str) throws Exception { + throw new UnsupportedOperationException("Not supported yet."); + } + + public String getThis() throws Exception, IllegalArgumentException { + throw new UnsupportedOperationException("Not supported yet."); + } + + public void setThose(String str) throws Exception, IllegalArgumentException { + throw new UnsupportedOperationException("Not supported yet."); + } + } + + private static void check(Descriptor d, + Set exceptionsExpectedValue, + boolean exceptionsExpected, + Set setExceptionsExpectedValue, + boolean setExceptionsExpected) throws Exception { + String[] exceptionsValues = (String[]) d.getFieldValue(JMX.EXCEPTIONS_FIELD); + String[] setExceptionsValues = (String[]) d.getFieldValue(JMX.SET_EXCEPTIONS_FIELD); + + if (exceptionsExpected && exceptionsValues == null) { + throw new Exception("exceptions is expected but null value"); + } + if (!exceptionsExpected && exceptionsValues != null) { + throw new Exception("exceptions is not expected but non null value"); + } + if (setExceptionsExpected && setExceptionsValues == null) { + throw new Exception("setExceptions is expected but null value"); + } + if (!setExceptionsExpected && setExceptionsValues != null) { + throw new Exception("setExceptions is not expected but non null value"); + } + + if (exceptionsExpected) { + checkValues(exceptionsExpectedValue, exceptionsValues); + } + if (setExceptionsExpected) { + checkValues(setExceptionsExpectedValue, setExceptionsValues); + } + } + + private static void checkValues(Set expectedValuesSet, + String[] realValues) throws Exception { + + Set realValuesSet = new HashSet(); + for (String ex : realValues) { + realValuesSet.add(ex); + } + if (!realValuesSet.equals(expectedValuesSet)) { + throw new Exception("Invalid content for exceptions. Was expecting " + + expectedValuesSet + ". Found " + realValuesSet); + } + } + + public static void main(String[] args) throws Exception { + Test t = new Test(); + ManagementFactory.getPlatformMBeanServer().registerMBean(t, OBJECT_NAME); + MBeanInfo info = ManagementFactory.getPlatformMBeanServer(). + getMBeanInfo(OBJECT_NAME); + //Constructors + for (MBeanConstructorInfo ctr : info.getConstructors()) { + if (ctr.getSignature().length == 0) { + check(ctr.getDescriptor(), null, false, null, false); + } + if (ctr.getSignature().length == 1) { + check(ctr.getDescriptor(), ONE_EXCEPTION, true, null, false); + } + if (ctr.getSignature().length == 2) { + check(ctr.getDescriptor(),TWO_EXCEPTION,true, null, false); + } + } + //Attributes + for (MBeanAttributeInfo attr : info.getAttributes()) { + if (attr.getName().equals("That")) { + check(attr.getDescriptor(), null, false, null, false); + } + if (attr.getName().equals("The")) { + check(attr.getDescriptor(), ONE_EXCEPTION,true,null, false); + } + if (attr.getName().equals("These")) { + check(attr.getDescriptor(), null, false, ONE_EXCEPTION,true); + } + if (attr.getName().equals("It")) { + check(attr.getDescriptor(), ONE_EXCEPTION,true,ONE_EXCEPTION, + true); + } + if (attr.getName().equals("This")) { + check(attr.getDescriptor(), TWO_EXCEPTION,true,null,false); + } + if (attr.getName().equals("Those")) { + check(attr.getDescriptor(), null,false,TWO_EXCEPTION,true); + } + } + //Operations + for (MBeanOperationInfo oper : info.getOperations()) { + if (oper.getSignature().length == 0) { + check(oper.getDescriptor(), null, false, null, false); + } + if (oper.getSignature().length == 1) { + check(oper.getDescriptor(), ONE_EXCEPTION, true, null, false); + } + if (oper.getSignature().length == 2) { + check(oper.getDescriptor(), TWO_EXCEPTION,true, null, false); + } + } + System.out.println("Test passed"); + } +} From 36f5b8dd54c8678f3d7ce460bd405f4ac085d80f Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Tue, 9 Dec 2008 09:55:39 -0500 Subject: [PATCH 190/267] 6689685: Hotspot crash error message should include libraries version Print out JDK/JRE version that hotspot knows about. Reviewed-by: kamg, blacklion, acorn, alanb --- hotspot/src/share/vm/utilities/vmError.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hotspot/src/share/vm/utilities/vmError.cpp b/hotspot/src/share/vm/utilities/vmError.cpp index a9d7a72f1cd..d2a0161a7cc 100644 --- a/hotspot/src/share/vm/utilities/vmError.cpp +++ b/hotspot/src/share/vm/utilities/vmError.cpp @@ -332,6 +332,8 @@ void VMError::report(outputStream* st) { // VM version st->print_cr("#"); + JDK_Version::current().to_string(buf, sizeof(buf)); + st->print_cr("# JRE version: %s", buf); st->print_cr("# Java VM: %s (%s %s %s %s)", Abstract_VM_Version::vm_name(), Abstract_VM_Version::vm_release(), From b14fec697346025192512a64e1b3d5ffa8452335 Mon Sep 17 00:00:00 2001 From: Jean-Francois Denise Date: Tue, 9 Dec 2008 15:57:09 +0100 Subject: [PATCH 191/267] 6675526: Define an Annotation to name registered MBeans Reviewed-by: emcmanus --- .../DefaultMBeanServerInterceptor.java | 6 + .../com/sun/jmx/mbeanserver/Introspector.java | 48 ++- .../classes/javax/management/Descriptor.java | 7 + .../share/classes/javax/management/JMX.java | 6 + .../classes/javax/management/MBeanServer.java | 9 +- .../management/MBeanServerConnection.java | 46 ++- .../javax/management/ObjectNameTemplate.java | 131 +++++++ .../Introspector/ObjectNameTemplateTest.java | 343 ++++++++++++++++++ 8 files changed, 575 insertions(+), 21 deletions(-) create mode 100644 jdk/src/share/classes/javax/management/ObjectNameTemplate.java create mode 100644 jdk/test/javax/management/Introspector/ObjectNameTemplateTest.java diff --git a/jdk/src/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java b/jdk/src/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java index 6a261994bb4..faa39e7656f 100644 --- a/jdk/src/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java +++ b/jdk/src/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java @@ -919,6 +919,12 @@ public class DefaultMBeanServerInterceptor DynamicMBean mbean = Introspector.makeDynamicMBean(object); + //Access the ObjectName template value only if the provided name is null + if(name == null) { + name = Introspector.templateToObjectName(mbean.getMBeanInfo(). + getDescriptor(), mbean); + } + return registerDynamicMBean(classname, mbean, name); } diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java index dbf45b9997a..ba27f6e8398 100644 --- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java +++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java @@ -65,8 +65,12 @@ import java.lang.reflect.Array; import java.lang.reflect.InvocationTargetException; import java.util.LinkedHashSet; import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import javax.management.AttributeNotFoundException; import javax.management.JMX; +import javax.management.ObjectName; +import javax.management.ObjectNameTemplate; import javax.management.openmbean.CompositeData; import javax.management.openmbean.MXBeanMappingFactory; @@ -78,7 +82,13 @@ import javax.management.openmbean.MXBeanMappingFactory; */ public class Introspector { - + /** + * Pattern used to extract Attribute Names from ObjectNameTemplate Annotation + * For example, in the following example, the Name attribute value is + * retrieved : ":type=MyType, name={Name}" + */ + private static Pattern OBJECT_NAME_PATTERN_TEMPLATE = + Pattern.compile("(\\{[^\\}]+\\})|(=\"\\{[^\\}]+\\}\")"); /* * ------------------------------------------ * PRIVATE CONSTRUCTORS @@ -392,6 +402,42 @@ public class Introspector { return getStandardMBeanInterface(baseClass); } + public static ObjectName templateToObjectName(Descriptor descriptor, + DynamicMBean mbean) + throws NotCompliantMBeanException { + String template = (String) + descriptor.getFieldValue(JMX.OBJECT_NAME_TEMPLATE); + if(template == null) return null; + try { + Matcher m = OBJECT_NAME_PATTERN_TEMPLATE.matcher(template); + while (m.find()){ + String grp = m.group(); + System.out.println("GROUP " + grp); + String attributeName = null; + boolean quote = false; + if(grp.startsWith("=\"{")) { + attributeName = grp.substring(3, grp.length() - 2); + quote = true; + } else + attributeName = grp.substring(1, grp.length() - 1); + + Object attributeValue = mbean.getAttribute(attributeName); + String validValue = quote ? + "=" + ObjectName.quote(attributeValue.toString()) : + attributeValue.toString(); + template = template.replace(grp, validValue); + } + return new ObjectName(template); + }catch(Exception ex) { + NotCompliantMBeanException ncex = new + NotCompliantMBeanException(ObjectNameTemplate.class. + getSimpleName() + " annotation value [" + template + "] " + + "is invalid. " + ex); + ncex.initCause(ex); + throw ncex; + } + } + /* * ------------------------------------------ * PRIVATE METHODS diff --git a/jdk/src/share/classes/javax/management/Descriptor.java b/jdk/src/share/classes/javax/management/Descriptor.java index a9161903c64..30c6a5f5264 100644 --- a/jdk/src/share/classes/javax/management/Descriptor.java +++ b/jdk/src/share/classes/javax/management/Descriptor.java @@ -245,6 +245,13 @@ import javax.management.openmbean.OpenType; * MXBean, if it was not the {@linkplain MXBeanMappingFactory#DEFAULT default} * one. * + * objectNameTemplate + * String + * MBeanInfo + * + * The template to use to name this MBean. Its value must be compliant with + * the specification of the {@link ObjectNameTemplate} annotation. + * * openType{@link OpenType} * MBeanAttributeInfo
      MBeanOperationInfo
      MBeanParameterInfo * diff --git a/jdk/src/share/classes/javax/management/JMX.java b/jdk/src/share/classes/javax/management/JMX.java index 3e551f3902f..297b5a74cc4 100644 --- a/jdk/src/share/classes/javax/management/JMX.java +++ b/jdk/src/share/classes/javax/management/JMX.java @@ -149,6 +149,12 @@ public class JMX { */ public static final String SET_EXCEPTIONS_FIELD = "setExceptions"; + /** + * The name of the {@code + * objectNameTemplate} field. + */ + public static final String OBJECT_NAME_TEMPLATE = "objectNameTemplate"; + /** *

      Options to apply to an MBean proxy or to an instance of {@link * StandardMBean}.

      diff --git a/jdk/src/share/classes/javax/management/MBeanServer.java b/jdk/src/share/classes/javax/management/MBeanServer.java index e6d79e5bd94..e82650288bb 100644 --- a/jdk/src/share/classes/javax/management/MBeanServer.java +++ b/jdk/src/share/classes/javax/management/MBeanServer.java @@ -351,11 +351,14 @@ public interface MBeanServer extends MBeanServerConnection { /** *

      Registers a pre-existing object as an MBean with the MBean - * server. If the object name given is null, the MBean must - * provide its own name by implementing the {@link + * server. If the object name given is null, the + * MBean must provide its own name in one or both of two ways: by implementing the {@link * javax.management.MBeanRegistration MBeanRegistration} interface * and returning the name from the {@link - * MBeanRegistration#preRegister preRegister} method.

      + * MBeanRegistration#preRegister preRegister} method; or by defining + * an {@code objectNameTemplate} field in its {@link Descriptor}, + * typically using the {@link ObjectNameTemplate @ObjectNameTemplate} + * annotation.

      * *

      If this method successfully registers an MBean, a notification * is sent as described above.

      diff --git a/jdk/src/share/classes/javax/management/MBeanServerConnection.java b/jdk/src/share/classes/javax/management/MBeanServerConnection.java index fadebc10730..add96cfcb94 100644 --- a/jdk/src/share/classes/javax/management/MBeanServerConnection.java +++ b/jdk/src/share/classes/javax/management/MBeanServerConnection.java @@ -46,11 +46,14 @@ public interface MBeanServerConnection extends NotificationManager { * MBean server will use its {@link * javax.management.loading.ClassLoaderRepository Default Loader * Repository} to load the class of the MBean. An object name is - * associated to the MBean. If the object name given is null, the - * MBean must provide its own name by implementing the {@link + * associated with the MBean. If the object name given is null, the + * MBean must provide its own name in one or both of two ways: by implementing the {@link * javax.management.MBeanRegistration MBeanRegistration} interface * and returning the name from the {@link - * MBeanRegistration#preRegister preRegister} method.

      + * MBeanRegistration#preRegister preRegister} method; or by defining + * an {@code objectNameTemplate} field in its {@link Descriptor}, + * typically using the {@link ObjectNameTemplate @ObjectNameTemplate} + * annotation.

      * *

      This method is equivalent to {@link * #createMBean(String,ObjectName,Object[],String[]) @@ -117,13 +120,16 @@ public interface MBeanServerConnection extends NotificationManager { /** *

      Instantiates and registers an MBean in the MBean server. The * class loader to be used is identified by its object name. An - * object name is associated to the MBean. If the object name of + * object name is associated with the MBean. If the object name of * the loader is null, the ClassLoader that loaded the MBean - * server will be used. If the MBean's object name given is null, - * the MBean must provide its own name by implementing the {@link + * server will be used. If the object name given is null, the + * MBean must provide its own name in one or both of two ways: by implementing the {@link * javax.management.MBeanRegistration MBeanRegistration} interface * and returning the name from the {@link - * MBeanRegistration#preRegister preRegister} method.

      + * MBeanRegistration#preRegister preRegister} method; or by defining + * an {@code objectNameTemplate} field in its {@link Descriptor}, + * typically using the {@link ObjectNameTemplate @ObjectNameTemplate} + * annotation.

      * *

      This method is equivalent to {@link * #createMBean(String,ObjectName,ObjectName,Object[],String[]) @@ -198,11 +204,14 @@ public interface MBeanServerConnection extends NotificationManager { * MBean server will use its {@link * javax.management.loading.ClassLoaderRepository Default Loader * Repository} to load the class of the MBean. An object name is - * associated to the MBean. If the object name given is null, the - * MBean must provide its own name by implementing the {@link + * associated with the MBean. If the object name given is null, the + * MBean must provide its own name in one or both of two ways: by implementing the {@link * javax.management.MBeanRegistration MBeanRegistration} interface * and returning the name from the {@link - * MBeanRegistration#preRegister preRegister} method. + * MBeanRegistration#preRegister preRegister} method; or by defining + * an {@code objectNameTemplate} field in its {@link Descriptor}, + * typically using the {@link ObjectNameTemplate @ObjectNameTemplate} + * annotation.

      * * @param className The class name of the MBean to be instantiated. * @param name The object name of the MBean. May be null. @@ -267,15 +276,18 @@ public interface MBeanServerConnection extends NotificationManager { NotCompliantMBeanException, IOException; /** - * Instantiates and registers an MBean in the MBean server. The + *

      Instantiates and registers an MBean in the MBean server. The * class loader to be used is identified by its object name. An - * object name is associated to the MBean. If the object name of + * object name is associated with the MBean. If the object name of * the loader is not specified, the ClassLoader that loaded the - * MBean server will be used. If the MBean object name given is - * null, the MBean must provide its own name by implementing the - * {@link javax.management.MBeanRegistration MBeanRegistration} - * interface and returning the name from the {@link - * MBeanRegistration#preRegister preRegister} method. + * MBean server will be used. If the object name given is null, the + * MBean must provide its own name in one or both of two ways: by implementing the {@link + * javax.management.MBeanRegistration MBeanRegistration} interface + * and returning the name from the {@link + * MBeanRegistration#preRegister preRegister} method; or by defining + * an {@code objectNameTemplate} field in its {@link Descriptor}, + * typically using the {@link ObjectNameTemplate @ObjectNameTemplate} + * annotation.

      * * @param className The class name of the MBean to be instantiated. * @param name The object name of the MBean. May be null. diff --git a/jdk/src/share/classes/javax/management/ObjectNameTemplate.java b/jdk/src/share/classes/javax/management/ObjectNameTemplate.java new file mode 100644 index 00000000000..97e0c900fb3 --- /dev/null +++ b/jdk/src/share/classes/javax/management/ObjectNameTemplate.java @@ -0,0 +1,131 @@ +/* + * 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 javax.management; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Annotation to allow an MBean to provide its name. + * This annotation can be used on the following types: + *
        + *
      • MBean or MXBean Java interface.
      • + *
      • Java class annotated with {@link javax.management.MBean @MBean} + * annotation.
      • + *
      • Java class annotated with {@link javax.management.MXBean @MXBean} + * annotation.
      • + *
      + * + *

      The value of this annotation is used to build the ObjectName + * when instances of the annotated type are registered in + * an MBeanServer and no explicit name is given to the + * {@code createMBean} or {@code registerMBean} method (the {@code ObjectName} + * is {@code null}).

      + * + *

      For Dynamic MBeans, which define their own {@code MBeanInfo}, you can + * produce the same effect as this annotation by including a field + * {@code objectNameTemplate} + * in the {@link Descriptor} for the {@code MBeanInfo} returned by + * {@link DynamicMBean#getMBeanInfo()}.

      + * + *

      For Standard MBeans and MXBeans, this annotation automatically produces + * an {@code objectNameTemplate} field in the {@code Descriptor}.

      + * + *

      The template can contain variables so that the name of the MBean + * depends on the value of one or more of its attributes. + * A variable that identifies an MBean attribute is of the form + * {attribute name}. For example, to make an MBean name + * depend on the Name attribute, use the variable + * {Name}. Attribute names are case sensitive. + * Naming attributes can be of any type. The String returned by + * toString() is included in the constructed name.

      + * + *

      If you need the attribute value to be quoted + * by a call to {@link ObjectName#quote(String) ObjectName.quote}, + * surround the variable with quotes. Quoting only applies to key values. + * For example, @ObjectNameTemplate("java.lang:type=MemoryPool,name=\"{Name}\""), + * quotes the Name attribute value. You can notice the "\" + * character needed to escape a quote within a String. A name + * produced by this template might look like + * {@code java.lang:type=MemoryPool,name="Code Cache"}.

      + * + *

      Variables can be used anywhere in the String. + * Be sure to make the template derived name comply with + * {@link ObjectName ObjectName} syntax.

      + * + *

      If an MBean is registered with a null name and it implements + * {@link javax.management.MBeanRegistration MBeanRegistration}, then + * the computed name is provided to the preRegister method. + * Similarly, + * if the MBean uses resource + * injection to discover its name, it is the computed name that will + * be injected.

      + *

      All of the above can be used with the {@link StandardMBean} class and + * the annotation is effective in that case too.

      + *

      If any exception occurs (such as unknown attribute, invalid syntax or + * exception + * thrown by the MBean) when the name is computed it is wrapped in a + * NotCompliantMBeanException.

      + *

      Some ObjectName template examples: + *

      • "com.example:type=Memory". Fixed ObjectName. Used to name a + * singleton MBean.
      • + *
      • "com.example:type=MemoryPool,name={Name}". Variable ObjectName. + * Name attribute is retrieved to compose the name + * key value.
      • + *
      • "com.example:type=SomeType,name={InstanceName},id={InstanceId}". + * Variable ObjectName. + * InstanceName and InstanceId attributes are + * retrieved to compose respectively + * the name and id key values.
      • + *
      • "com.example:type=OtherType,name=\"{ComplexName}\"". Variable ObjectName. + * ComplexName attribute is retrieved to compose the + * name key quoted value.
      • + *
      • "com.example:{TypeKey}=SomeOtherType". Variable ObjectName. + * TypeKey attribute is retrieved to compose the + * first key name.
      • + * *
      • "{Domain}:type=YetAnotherType". Variable ObjectName. + * Domain attribute is retrieved to compose the + * management domain.
      • + *
      • "{Naming}". Variable ObjectName. + * Naming attribute is retrieved to compose the + * complete name.
      • + *
      + *

      + */ +@Documented +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +public @interface ObjectNameTemplate { + + /** + * The MBean name template. + * @return The MBean name template. + */ + @DescriptorKey("objectNameTemplate") + public String value(); +} diff --git a/jdk/test/javax/management/Introspector/ObjectNameTemplateTest.java b/jdk/test/javax/management/Introspector/ObjectNameTemplateTest.java new file mode 100644 index 00000000000..2abcaf08585 --- /dev/null +++ b/jdk/test/javax/management/Introspector/ObjectNameTemplateTest.java @@ -0,0 +1,343 @@ +/* + * 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. + * + * 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 %M% %I% + * @bug 6675526 + * @summary Test MBeans named with @ObjectNameTemplate + * @author Jean-Francois Denise + * @run main/othervm ObjectNameTemplateTest + */ +import java.lang.management.ManagementFactory; +import java.lang.reflect.Constructor; +import java.util.ArrayList; +import java.util.List; +import javax.management.Attribute; +import javax.management.AttributeList; +import javax.management.AttributeNotFoundException; +import javax.management.DynamicMBean; +import javax.management.ImmutableDescriptor; +import javax.management.InvalidAttributeValueException; +import javax.management.JMX; +import javax.management.MBeanException; +import javax.management.MBeanInfo; +import javax.management.MBeanServer; +import javax.management.MXBean; +import javax.management.MBean; +import javax.management.ManagedAttribute; +import javax.management.NotCompliantMBeanException; +import javax.management.ObjectName; +import javax.management.ObjectNameTemplate; +import javax.management.ReflectionException; +import javax.management.StandardMBean; + +public class ObjectNameTemplateTest { + + private static MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); + private static final String NAME_TEMPLATE_MULTI = + "com.example:type=MultiStdCache,name={Name}"; + private static final String NAME_TEMPLATE_MONO = + "com.example:{Type}={TypeValue}"; + private static final String NAME_TEMPLATE_QUOTED = + "com.example:type=Quotted,name=\"{Name}\""; + private static final String NAME_TEMPLATE_WRAPPED = + "com.example:type=MgtInterface,id={Id}"; + private static final String NAME_TEMPLATE_FULL = + "{Naming}"; + private static final String FULL_NAME = "com.example:type=NotAdvised"; + private static final String NAME1 = "toto1"; + private static final String NAME2 = "toto2"; + private static final String TYPE_KEY = "thisIsTheType"; + private static final String TYPE_VALUE = "aTypeValue"; + private static final String INVALID_NAME = "?,=*,\n, "; + private static final int ID = 999; + private static Object[] EMPTY_PARAMS = {}; + private static String[] EMPTY_SIGNATURE = {}; + private static final ObjectName OBJECTNAME_CACHE = + ObjectName.valueOf("com.example:type=Cache"); + private static final ObjectName OBJECTNAME_SUBCACHE = + ObjectName.valueOf("com.example:type=SubCache"); + private static final ObjectName OBJECTNAME_CACHEMX = + ObjectName.valueOf("com.example:type=CacheMX"); + private static final ObjectName OBJECTNAME_SUBCACHEMX = + ObjectName.valueOf("com.example:type=SubCacheMX"); + private static final ObjectName OBJECTNAME_DYNACACHE = + ObjectName.valueOf("com.example:type=DynaCache"); + private static final ObjectName OBJECTNAME_STDCACHE = + ObjectName.valueOf("com.example:type=StdCache"); + private static final ObjectName OBJECTNAME_STDCACHEMX = + ObjectName.valueOf("com.example:type=StdCacheMX"); + private static final ObjectName OBJECTNAME_MULTI_1 = + ObjectName.valueOf("com.example:" + + "type=MultiStdCache,name=" + NAME1); + private static final ObjectName OBJECTNAME_MULTI_2 = + ObjectName.valueOf("com.example:" + + "type=MultiStdCache,name=" + NAME2); + private static final ObjectName OBJECTNAME_MONO = + ObjectName.valueOf("com.example:" + TYPE_KEY + "=" + + TYPE_VALUE); + private static final ObjectName OBJECTNAME_QUOTED = + ObjectName.valueOf("com.example:type=Quotted," + + "name="+ObjectName.quote(INVALID_NAME)); + private static final ObjectName OBJECTNAME_WRAPPED_RESOURCE = + ObjectName.valueOf("com.example:type=MgtInterface,id=" + ID); + private static final ObjectName OBJECTNAME_FULL = + ObjectName.valueOf(FULL_NAME); + + private static void test(Class mbean, Object[] params, + String[] signature, ObjectName name, String template) + throws Exception { + mbs.createMBean(mbean.getName(), null, params, signature); + test(name, template); + List> parameters = new ArrayList>(); + for (String sig : signature) { + parameters.add(Class.forName(sig)); + } + Class classes[] = new Class[parameters.size()]; + Constructor ctr = mbean.getConstructor(parameters.toArray(classes)); + Object inst = ctr.newInstance(params); + test(inst, name, template); + } + + private static void test(Object obj, ObjectName name, String template) + throws Exception { + mbs.registerMBean(obj, null); + test(name, template); + } + + private static void test(ObjectName name, String template) + throws Exception { + if (!mbs.isRegistered(name)) { + throw new Exception("Wrong " + name + " name"); + } + if (template != null && !mbs.getMBeanInfo(name).getDescriptor(). + getFieldValue("objectNameTemplate").equals(template)) { + throw new Exception("Invalid Derscriptor"); + } + mbs.unregisterMBean(name); + } + + public static void main(String[] args) throws Exception { + test(Cache.class, EMPTY_PARAMS, EMPTY_SIGNATURE, OBJECTNAME_CACHE, + OBJECTNAME_CACHE.toString()); + + test(CacheMX.class, EMPTY_PARAMS, EMPTY_SIGNATURE, OBJECTNAME_CACHEMX, + OBJECTNAME_CACHEMX.toString()); + + test(SubCache.class, EMPTY_PARAMS, EMPTY_SIGNATURE, OBJECTNAME_SUBCACHE, + OBJECTNAME_SUBCACHE.toString()); + + test(SubCacheMX.class, EMPTY_PARAMS, EMPTY_SIGNATURE, OBJECTNAME_SUBCACHEMX, + OBJECTNAME_SUBCACHEMX.toString()); + + test(DynaCache.class, EMPTY_PARAMS, EMPTY_SIGNATURE, OBJECTNAME_DYNACACHE, + null); + + test(StdCacheMX.class, EMPTY_PARAMS, EMPTY_SIGNATURE, OBJECTNAME_STDCACHEMX, + OBJECTNAME_STDCACHEMX.toString()); + + test(StdCache.class, EMPTY_PARAMS, EMPTY_SIGNATURE, OBJECTNAME_STDCACHE, + OBJECTNAME_STDCACHE.toString()); + String[] sig = {String.class.getName()}; + Object[] params = {NAME1}; + test(MultiStdCache.class, params, sig, OBJECTNAME_MULTI_1, + NAME_TEMPLATE_MULTI); + Object[] params2 = {NAME2}; + test(MultiStdCache.class, params2, sig, OBJECTNAME_MULTI_2, + NAME_TEMPLATE_MULTI); + + test(MonoStdCache.class, EMPTY_PARAMS, EMPTY_SIGNATURE, OBJECTNAME_MONO, + NAME_TEMPLATE_MONO); + + test(Quoted.class, EMPTY_PARAMS, EMPTY_SIGNATURE, OBJECTNAME_QUOTED, + NAME_TEMPLATE_QUOTED); + + test(new StandardMBean(new WrappedResource(), MgtInterface.class), + OBJECTNAME_WRAPPED_RESOURCE, NAME_TEMPLATE_WRAPPED); + + test(FullName.class, EMPTY_PARAMS, EMPTY_SIGNATURE, OBJECTNAME_FULL, + NAME_TEMPLATE_FULL); + try { + test(Wrong.class, EMPTY_PARAMS, EMPTY_SIGNATURE, null, null); + throw new Exception("No treceived expected Exception"); + } catch (NotCompliantMBeanException ncex) { + if (!(ncex.getCause() instanceof AttributeNotFoundException)) { + throw new Exception("Invalid initCause"); + } + } + } + + @MBean + @ObjectNameTemplate("{Naming}") + public static class FullName { + + @ManagedAttribute + public String getNaming() { + return FULL_NAME; + } + } + + @ObjectNameTemplate("com.example:type=MgtInterface,id={Id}") + public interface MgtInterface { + + public int getId(); + } + + public static class WrappedResource implements MgtInterface { + + public int getId() { + return ID; + } + } + + @MBean + @ObjectNameTemplate("com.example:type=Cache") + public static class Cache { + } + + @ObjectNameTemplate("com.example:type=SubCache") + public static class SubCache extends Cache { + } + + @MXBean + @ObjectNameTemplate("com.example:type=CacheMX") + public static class CacheMX { + } + + @ObjectNameTemplate("com.example:type=SubCacheMX") + public static class SubCacheMX extends CacheMX { + } + + @ObjectNameTemplate("com.example:type=StdCache") + public interface StdCacheMBean { + } + + public static class StdCache implements StdCacheMBean { + } + + @ObjectNameTemplate("com.example:type=StdCacheMX") + public interface StdCacheMXBean { + } + + public static class StdCacheMX implements StdCacheMXBean { + } + + public static class DynaCache implements DynamicMBean { + + public Object getAttribute(String attribute) throws AttributeNotFoundException, MBeanException, ReflectionException { + throw new UnsupportedOperationException("Not supported yet."); + } + + public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException { + throw new UnsupportedOperationException("Not supported yet."); + } + + public AttributeList getAttributes(String[] attributes) { + throw new UnsupportedOperationException("Not supported yet."); + } + + public AttributeList setAttributes(AttributeList attributes) { + throw new UnsupportedOperationException("Not supported yet."); + } + + public Object invoke(String actionName, Object[] params, String[] signature) throws MBeanException, ReflectionException { + throw new UnsupportedOperationException("Not supported yet."); + } + + public MBeanInfo getMBeanInfo() { + ImmutableDescriptor d = new ImmutableDescriptor(JMX.OBJECT_NAME_TEMPLATE + "=com.example:type=DynaCache"); + + return new MBeanInfo("DynaCache", "Description", null, null, null, null, d); + } + } + + @ObjectNameTemplate("com.example:type=MultiStdCache,name={Name}") + public interface MultiStdCacheMXBean { + + public String getName(); + } + + public static class MultiStdCache implements MultiStdCacheMXBean { + + private String name; + + public MultiStdCache(String name) { + this.name = name; + } + + public String getName() { + return name; + } + } + + @ObjectNameTemplate("com.example:{Type}={TypeValue}") + public interface MonoStdCacheMXBean { + + public String getTypeValue(); + + public String getType(); + } + + public static class MonoStdCache implements MonoStdCacheMXBean { + + public String getTypeValue() { + return TYPE_VALUE; + } + + public String getType() { + return TYPE_KEY; + } + } + + @ObjectNameTemplate("com.example:type=Quotted,name=\"{Name}\"") + public interface QuottedMXBean { + + public String getName(); + } + + public static class Quoted implements QuottedMXBean { + + public String getName() { + return INVALID_NAME; + } + } + + @ObjectNameTemplate("com.example:{Type}={TypeValue}, name={Name}") + public interface WrongMXBean { + + public String getTypeValue(); + + public String getType(); + } + + public static class Wrong implements WrongMXBean { + + public String getTypeValue() { + return TYPE_VALUE; + } + + public String getType() { + return TYPE_KEY; + } + } +} From ef7000f82e4d6e885def2b2c4698157fc5896e45 Mon Sep 17 00:00:00 2001 From: Jean-Francois Denise Date: Tue, 9 Dec 2008 16:14:53 +0100 Subject: [PATCH 192/267] 6450834: RFE: allow StandardMBean to call MBeanRegistration methods on its wrapped resource 6373143: MonitorNotification should have a public constructor Reviewed-by: emcmanus --- .../javax/management/StandardMBean.java | 107 ++++++++++++++++-- .../monitor/MonitorNotification.java | 2 +- .../InstantiateMonitorNotificationTest.java | 52 +++++++++ .../standardmbean/RegistrationTest.java | 91 +++++++++++++++ 4 files changed, 240 insertions(+), 12 deletions(-) create mode 100644 jdk/test/javax/management/monitor/InstantiateMonitorNotificationTest.java create mode 100644 jdk/test/javax/management/standardmbean/RegistrationTest.java diff --git a/jdk/src/share/classes/javax/management/StandardMBean.java b/jdk/src/share/classes/javax/management/StandardMBean.java index 45badeac6c7..f3edc95d742 100644 --- a/jdk/src/share/classes/javax/management/StandardMBean.java +++ b/jdk/src/share/classes/javax/management/StandardMBean.java @@ -135,6 +135,7 @@ public class StandardMBean implements DynamicWrapperMBean, MBeanRegistration { private static final long serialVersionUID = 5107355471177517164L; private boolean wrappedVisible; + private boolean forwardRegistration; /** *

      Construct an {@code Options} object where all options have @@ -177,15 +178,56 @@ public class StandardMBean implements DynamicWrapperMBean, MBeanRegistration { this.wrappedVisible = visible; } - // Canonical objects for each of (MXBean,!MXBean) x (WVisible,!WVisible) + /** + *

      Defines whether the {@link MBeanRegistration MBeanRegistration} + * callbacks are forwarded to the wrapped object.

      + * + *

      If this option is true, then + * {@link #preRegister(MBeanServer, ObjectName) preRegister}, + * {@link #postRegister(Boolean) postRegister}, + * {@link #preDeregister preDeregister} and + * {@link #postDeregister postDeregister} methods are forwarded + * to the wrapped object, in addition to the behaviour specified + * for the StandardMBean instance itself. + * The default value is false for compatibility reasons, but true + * is a better value for most new code.

      + * + * @return true if the MBeanRegistration callbacks + * are forwarded to the wrapped object. + */ + public boolean isMBeanRegistrationForwarded() { + return this.forwardRegistration; + } + + /** + *

      Set the + * {@link #isMBeanRegistrationForwarded MBeanRegistrationForwarded} + * option to the given value.

      + * @param forward the new value. + */ + public void setMBeanRegistrationForwarded(boolean forward) { + this.forwardRegistration = forward; + } + + // Canonical objects for each of + // (MXBean,!MXBean) x (WVisible,!WVisible) x (Forward,!Forward) private static final Options[] CANONICALS = { new Options(), new Options(), new Options(), new Options(), + new Options(), new Options(), new Options(), new Options(), }; static { CANONICALS[1].setMXBeanMappingFactory(MXBeanMappingFactory.DEFAULT); CANONICALS[2].setWrappedObjectVisible(true); CANONICALS[3].setMXBeanMappingFactory(MXBeanMappingFactory.DEFAULT); CANONICALS[3].setWrappedObjectVisible(true); + CANONICALS[4].setMBeanRegistrationForwarded(true); + CANONICALS[5].setMXBeanMappingFactory(MXBeanMappingFactory.DEFAULT); + CANONICALS[5].setMBeanRegistrationForwarded(true); + CANONICALS[6].setWrappedObjectVisible(true); + CANONICALS[6].setMBeanRegistrationForwarded(true); + CANONICALS[7].setMXBeanMappingFactory(MXBeanMappingFactory.DEFAULT); + CANONICALS[7].setWrappedObjectVisible(true); + CANONICALS[7].setMBeanRegistrationForwarded(true); } @Override MBeanOptions[] canonicals() { @@ -195,7 +237,8 @@ public class StandardMBean implements DynamicWrapperMBean, MBeanRegistration { @Override boolean same(MBeanOptions opts) { return (super.same(opts) && opts instanceof Options && - ((Options) opts).wrappedVisible == wrappedVisible); + ((Options) opts).wrappedVisible == wrappedVisible && + ((Options) opts).forwardRegistration ==forwardRegistration); } } @@ -477,7 +520,9 @@ public class StandardMBean implements DynamicWrapperMBean, MBeanRegistration { * * @exception IllegalArgumentException if the given * implementation is null. - * + * @exception IllegalStateException if the + * {@link Options#isMBeanRegistrationForwarded MBeanRegistrationForwarded} + * option is true. * @exception NotCompliantMBeanException if the given * implementation does not implement the * Standard MBean (or MXBean) interface that was @@ -490,6 +535,12 @@ public class StandardMBean implements DynamicWrapperMBean, MBeanRegistration { if (implementation == null) throw new IllegalArgumentException("implementation is null"); + + if(options instanceof Options && + ((Options) options).isMBeanRegistrationForwarded()) + throw new IllegalStateException("Implementation can't be changed " + + "because MBeanRegistrationForwarded option is true"); + setImplementation2(implementation); } @@ -1273,10 +1324,14 @@ public class StandardMBean implements DynamicWrapperMBean, MBeanRegistration { * registered in the MBean server.

      * *

      The default implementation of this method returns the {@code name} - * parameter. It does nothing else for - * Standard MBeans. For MXBeans, it records the {@code MBeanServer} - * and {@code ObjectName} parameters so they can be used to translate - * inter-MXBean references.

      + * parameter. If the + * {@link Options#isMBeanRegistrationForwarded MBeanRegistrationForwarded} + * option is set to true, then this method is forwarded to the object + * returned by the {@link #getImplementation getImplementation()} method. + * The name returned by this call is then returned by this method. + * It does nothing else for Standard MBeans. For MXBeans, it records + * the {@code MBeanServer} and {@code ObjectName} parameters so they can + * be used to translate inter-MXBean references.

      * *

      It is good practice for a subclass that overrides this method * to call the overridden method via {@code super.preRegister(...)}. @@ -1311,6 +1366,11 @@ public class StandardMBean implements DynamicWrapperMBean, MBeanRegistration { */ public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception { + // Forward preRegister before to call register and + // inject parameters. + if(shouldForwardMBeanRegistration()) + name = ((MBeanRegistration)getImplementation()). + preRegister(server, name); mbean.register(server, name); MBeanInjector.inject(mbean.getWrappedObject(), server, name); return name; @@ -1320,7 +1380,11 @@ public class StandardMBean implements DynamicWrapperMBean, MBeanRegistration { *

      Allows the MBean to perform any operations needed after having been * registered in the MBean server or after the registration has failed.

      * - *

      The default implementation of this method does nothing for + *

      If the + * {@link Options#isMBeanRegistrationForwarded MBeanRegistrationForwarded} + * option is set to true, then this method is forwarded to the object + * returned by the {@link #getImplementation getImplementation()} method. + * The default implementation of this method does nothing else for * Standard MBeans. For MXBeans, it undoes any work done by * {@link #preRegister preRegister} if registration fails.

      * @@ -1338,16 +1402,24 @@ public class StandardMBean implements DynamicWrapperMBean, MBeanRegistration { public void postRegister(Boolean registrationDone) { if (!registrationDone) mbean.unregister(); + if(shouldForwardMBeanRegistration()) + ((MBeanRegistration)getImplementation()). + postRegister(registrationDone); } /** *

      Allows the MBean to perform any operations it needs before * being unregistered by the MBean server.

      * - *

      The default implementation of this method does nothing.

      + *

      If the + * {@link Options#isMBeanRegistrationForwarded MBeanRegistrationForwarded} + * option is set to true, then this method is forwarded to the object + * returned by the {@link #getImplementation getImplementation()} method. + * Other than that, the default implementation of this method does nothing. + *

      * *

      It is good practice for a subclass that overrides this method - * to call the overridden method via {@code super.preDeegister(...)}.

      + * to call the overridden method via {@code super.preDeregister(...)}.

      * * @throws Exception no checked exceptions are throw by this method * but {@code Exception} is declared so that subclasses can override @@ -1356,13 +1428,19 @@ public class StandardMBean implements DynamicWrapperMBean, MBeanRegistration { * @since 1.6 */ public void preDeregister() throws Exception { + if(shouldForwardMBeanRegistration()) + ((MBeanRegistration)getImplementation()).preDeregister(); } /** *

      Allows the MBean to perform any operations needed after having been * unregistered in the MBean server.

      * - *

      The default implementation of this method does nothing for + *

      If the + * {@link Options#isMBeanRegistrationForwarded MBeanRegistrationForwarded} + * option is set to true, then this method is forwarded to the object + * returned by the {@link #getImplementation getImplementation()} method. + * The default implementation of this method does nothing else for * Standard MBeans. For MXBeans, it removes any information that * was recorded by the {@link #preRegister preRegister} method.

      * @@ -1375,8 +1453,15 @@ public class StandardMBean implements DynamicWrapperMBean, MBeanRegistration { */ public void postDeregister() { mbean.unregister(); + if(shouldForwardMBeanRegistration()) + ((MBeanRegistration)getImplementation()).postDeregister(); } + private boolean shouldForwardMBeanRegistration() { + return (getImplementation() instanceof MBeanRegistration) && + (options instanceof Options && + ((Options) options).isMBeanRegistrationForwarded()); + } // // MBeanInfo immutability // diff --git a/jdk/src/share/classes/javax/management/monitor/MonitorNotification.java b/jdk/src/share/classes/javax/management/monitor/MonitorNotification.java index 744d7434f1f..f0d65c6da17 100644 --- a/jdk/src/share/classes/javax/management/monitor/MonitorNotification.java +++ b/jdk/src/share/classes/javax/management/monitor/MonitorNotification.java @@ -201,7 +201,7 @@ public class MonitorNotification extends javax.management.Notification { * @param derGauge The derived gauge. * @param trigger The threshold/string (depending on the monitor type) that triggered the notification. */ - MonitorNotification(String type, Object source, long sequenceNumber, long timeStamp, String msg, + public MonitorNotification(String type, Object source, long sequenceNumber, long timeStamp, String msg, ObjectName obsObj, String obsAtt, Object derGauge, Object trigger) { super(type, source, sequenceNumber, timeStamp, msg); diff --git a/jdk/test/javax/management/monitor/InstantiateMonitorNotificationTest.java b/jdk/test/javax/management/monitor/InstantiateMonitorNotificationTest.java new file mode 100644 index 00000000000..ae16858d241 --- /dev/null +++ b/jdk/test/javax/management/monitor/InstantiateMonitorNotificationTest.java @@ -0,0 +1,52 @@ + +import javax.management.ObjectName; +import javax.management.monitor.MonitorNotification; + +/* + * 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. + * + * 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 6373143 + * @summary Test MonitorNotification public constructor + * @author JFDenise + * @run clean InstantiateMonitorNotificationTest + * @run build InstantiateMonitorNotificationTest + * @run main InstantiateMonitorNotificationTest + */ + +public class InstantiateMonitorNotificationTest { + + public static void main(String[] args) throws Exception { + MonitorNotification notif = new MonitorNotification("com.foo.test", + ObjectName.valueOf(":type=Monitor"), + 999, + 999, + "A message", + ObjectName.valueOf(":type=Observed"), + "MyAttribute", + Integer.valueOf(14), + Integer.valueOf(15)); + System.out.println("Test passed"); + } +} diff --git a/jdk/test/javax/management/standardmbean/RegistrationTest.java b/jdk/test/javax/management/standardmbean/RegistrationTest.java new file mode 100644 index 00000000000..9ca0c464f00 --- /dev/null +++ b/jdk/test/javax/management/standardmbean/RegistrationTest.java @@ -0,0 +1,91 @@ +/* + * 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. + * + * 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 6450834 + * @summary Forward MBeanRegistration calls + * @author JF Denise + * @run main RegistrationTest + */ + +import java.io.Serializable; +import java.lang.management.ManagementFactory; +import javax.management.*; + +public class RegistrationTest { + static boolean preRegisterCalled; + static boolean postRegisterCalled; + static boolean preDeregisterCalled; + static boolean postDeregisterCalled; + + static void checkResult(boolean expected) throws Exception { + if((preRegisterCalled != expected || + postRegisterCalled != expected || + preDeregisterCalled != expected || + postDeregisterCalled != expected)) + throw new Exception("Mismatch preRegisterCalled = " + + preRegisterCalled + ", postRegisterCalled = " + + postRegisterCalled + ", preDeregisterCalled = " + + preDeregisterCalled + ", postDeregisterCalled = " + + postDeregisterCalled); + } + static class Wrapped implements MBeanRegistration,Serializable { + + public ObjectName preRegister(MBeanServer server, ObjectName name) + throws Exception { + preRegisterCalled = true; + return name; + } + + public void postRegister(Boolean registrationDone) { + postRegisterCalled = true; + } + + public void preDeregister() throws Exception { + preDeregisterCalled = true; + } + + public void postDeregister() { + postDeregisterCalled = true; + } + + } + + public static void main(String[] args) throws Exception { + StandardMBean std = new StandardMBean(new Wrapped(), + Serializable.class); + ObjectName name = ObjectName.valueOf(":type=Test"); + ManagementFactory.getPlatformMBeanServer().registerMBean(std,name); + ManagementFactory.getPlatformMBeanServer().unregisterMBean(name); + checkResult(false); + StandardMBean.Options opt = new StandardMBean.Options(); + opt.setMBeanRegistrationForwarded(true); + std = new StandardMBean(new Wrapped(), + Serializable.class, opt ); + ManagementFactory.getPlatformMBeanServer().registerMBean(std,name); + ManagementFactory.getPlatformMBeanServer().unregisterMBean(name); + checkResult(true); + System.out.println("Test OK"); + } +} From 85e1e1e290ef9d63bc05988e8796cce21826d7f3 Mon Sep 17 00:00:00 2001 From: Jean-Francois Denise Date: Tue, 9 Dec 2008 16:26:30 +0100 Subject: [PATCH 193/267] 6287328: Add methods to StandardMBean to retrieve a method based on MBean{Attribute|Operation}Info Reviewed-by: emcmanus --- .../jmx/mbeanserver/MBeanInstantiator.java | 9 + .../jmx/mbeanserver/MBeanIntrospector.java | 2 +- .../javax/management/StandardMBean.java | 146 +++++++ .../standardmbean/FindMethodTest.java | 384 ++++++++++++++++++ 4 files changed, 540 insertions(+), 1 deletion(-) create mode 100644 jdk/test/javax/management/standardmbean/FindMethodTest.java diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java index 789fd661aa9..4a6949dc868 100644 --- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java +++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java @@ -613,6 +613,15 @@ public class MBeanInstantiator { return clr; } + /** + * Returns the class of a primitive type. + * @param name The type for which we the associated class. + * @return the class, or null if name is not primitive. + */ + public static Class primitiveType(String name) { + return primitiveClasses.get(name); + } + /** * Load a class with the specified loader, or with this object * class loader if the specified loader is null. diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanIntrospector.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanIntrospector.java index 50ce702e871..e98b41bbaa9 100644 --- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanIntrospector.java +++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanIntrospector.java @@ -518,7 +518,7 @@ public abstract class MBeanIntrospector { * see the version of the @ManagedAttribute (or ...Operation) annotation * from that method, which might have a different description or whatever. */ - private static void getAnnotatedMethods(Class c, List methods) + public static void getAnnotatedMethods(Class c, List methods) throws Exception { Class sup = c.getSuperclass(); if (sup != null) diff --git a/jdk/src/share/classes/javax/management/StandardMBean.java b/jdk/src/share/classes/javax/management/StandardMBean.java index f3edc95d742..0d015ec19f8 100644 --- a/jdk/src/share/classes/javax/management/StandardMBean.java +++ b/jdk/src/share/classes/javax/management/StandardMBean.java @@ -28,14 +28,21 @@ package javax.management; import com.sun.jmx.mbeanserver.DescriptorCache; import com.sun.jmx.mbeanserver.Introspector; import com.sun.jmx.mbeanserver.MBeanInjector; +import com.sun.jmx.mbeanserver.MBeanInstantiator; +import com.sun.jmx.mbeanserver.MBeanIntrospector; import com.sun.jmx.mbeanserver.MBeanSupport; import com.sun.jmx.mbeanserver.MXBeanSupport; import com.sun.jmx.mbeanserver.StandardMBeanSupport; import com.sun.jmx.mbeanserver.Util; +import java.lang.reflect.Method; import java.security.AccessController; import java.security.PrivilegedAction; +import java.util.ArrayList; import java.util.HashMap; +import java.util.HashSet; +import java.util.List; import java.util.Map; +import java.util.Set; import java.util.WeakHashMap; import java.util.logging.Level; import javax.management.openmbean.MXBeanMappingFactory; @@ -1316,6 +1323,145 @@ public class StandardMBean implements DynamicWrapperMBean, MBeanRegistration { return natts; } + // ------------------------------------------------------------------ + // Resolve from a type name to a Class. + // ------------------------------------------------------------------ + private static Class resolveClass(MBeanFeatureInfo info, String type, + Class mbeanItf) + throws ClassNotFoundException { + String t = (String) info.getDescriptor(). + getFieldValue(JMX.ORIGINAL_TYPE_FIELD); + if (t == null) { + t = type; + } + Class clazz = MBeanInstantiator.primitiveType(t); + if(clazz == null) + clazz = Class.forName(t, false, mbeanItf.getClassLoader()); + return clazz; + } + + // ------------------------------------------------------------------ + // Return the subset of valid Management methods + // ------------------------------------------------------------------ + private static Method getManagementMethod(final Class mbeanType, + String opName, Class... parameters) throws NoSuchMethodException, + SecurityException { + Method m = mbeanType.getMethod(opName, parameters); + if (mbeanType.isInterface()) { + return m; + } + final List methods = new ArrayList(); + try { + MBeanIntrospector.getAnnotatedMethods(mbeanType, methods); + }catch (SecurityException ex) { + throw ex; + }catch (NoSuchMethodException ex) { + throw ex; + }catch (Exception ex) { + NoSuchMethodException nsme = + new NoSuchMethodException(ex.toString()); + nsme.initCause(ex); + throw nsme; + } + + if(methods.contains(m)) return m; + + throw new NoSuchMethodException("Operation " + opName + + " not found in management interface " + mbeanType.getName()); + } + /** + * Retrieve the set of MBean attribute accessor Methods + * located in the mbeanInterface MBean interface that + * correspond to the attr MBeanAttributeInfo + * parameter. + * @param mbeanInterface the management interface. + * Can be a standard MBean or MXBean interface, or a Java class + * annotated with {@link MBean @MBean} or {@link MXBean @MXBean}. + * @param attr The attribute we want the accessors for. + * @return The set of accessors. + * @throws java.lang.NoSuchMethodException if no accessor exists + * for the given {@link MBeanAttributeInfo MBeanAttributeInfo}. + * @throws java.lang.IllegalArgumentException if at least one + * of the two parameters is null. + * @throws java.lang.ClassNotFoundException if the class named in the + * attribute type is not found. + * @throws java.lang.SecurityException if this exception is + * encountered while introspecting the MBean interface. + */ + public static Set findAttributeAccessors(Class mbeanInterface, + MBeanAttributeInfo attr) + throws NoSuchMethodException, + ClassNotFoundException { + if (mbeanInterface == null || attr == null) { + throw new IllegalArgumentException("mbeanInterface or attr " + + "parameter is null"); + } + String attributeName = attr.getName(); + Set methods = new HashSet(); + Class clazz = resolveClass(attr, attr.getType(), mbeanInterface); + if (attr.isReadable()) { + String radical = "get"; + if(attr.isIs()) radical = "is"; + Method getter = getManagementMethod(mbeanInterface, radical + + attributeName); + if (getter.getReturnType().equals(clazz)) { + methods.add(getter); + } else { + throw new NoSuchMethodException("Invalid getter return type, " + + "should be " + clazz + ", found " + + getter.getReturnType()); + } + } + if (attr.isWritable()) { + Method setter = getManagementMethod(mbeanInterface, "set" + + attributeName, + clazz); + if (setter.getReturnType().equals(Void.TYPE)) { + methods.add(setter); + } else { + throw new NoSuchMethodException("Invalid setter return type, " + + "should be void, found " + setter.getReturnType()); + } + } + return methods; + } + + /** + * Retrieve the MBean operation Method + * located in the mbeanInterface MBean interface that + * corresponds to the provided op + * MBeanOperationInfo parameter. + * @param mbeanInterface the management interface. + * Can be a standard MBean or MXBean interface, or a Java class + * annotated with {@link MBean @MBean} or {@link MXBean @MXBean}. + * @param op The operation we want the method for. + * @return the method corresponding to the provided MBeanOperationInfo. + * @throws java.lang.NoSuchMethodException if no method exists + * for the given {@link MBeanOperationInfo MBeanOperationInfo}. + * @throws java.lang.IllegalArgumentException if at least one + * of the two parameters is null. + * @throws java.lang.ClassNotFoundException if one of the + * classes named in the operation signature array is not found. + * @throws java.lang.SecurityException if this exception is + * encountered while introspecting the MBean interface. + */ + public static Method findOperationMethod(Class mbeanInterface, + MBeanOperationInfo op) + throws ClassNotFoundException, NoSuchMethodException { + if (mbeanInterface == null || op == null) { + throw new IllegalArgumentException("mbeanInterface or op " + + "parameter is null"); + } + List> classes = new ArrayList>(); + for (MBeanParameterInfo info : op.getSignature()) { + Class clazz = resolveClass(info, info.getType(), mbeanInterface); + classes.add(clazz); + } + Class[] signature = new Class[classes.size()]; + classes.toArray(signature); + return getManagementMethod(mbeanInterface, op.getName(), signature); + } + /** *

      Allows the MBean to perform any operations it needs before * being registered in the MBean server. If the name of the MBean diff --git a/jdk/test/javax/management/standardmbean/FindMethodTest.java b/jdk/test/javax/management/standardmbean/FindMethodTest.java new file mode 100644 index 00000000000..b568d70ac88 --- /dev/null +++ b/jdk/test/javax/management/standardmbean/FindMethodTest.java @@ -0,0 +1,384 @@ +/* + * 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. + * + * 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 6287328 + * @summary Add methods to StandardMBean to retrieve a method based on + * MBean{Attribute|Operation}Info + * @author Jean-Francois Denise + * @run main FindMethodTest + */ + +import java.lang.management.ManagementFactory; +import java.lang.management.MemoryMXBean; +import java.lang.management.ThreadMXBean; +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import javax.management.MBean; +import javax.management.MBeanAttributeInfo; +import javax.management.MBeanInfo; +import javax.management.MBeanOperationInfo; +import javax.management.MBeanParameterInfo; +import javax.management.MBeanServer; +import javax.management.ManagedAttribute; +import javax.management.ManagedOperation; +import javax.management.ObjectName; +import javax.management.StandardMBean; + +public class FindMethodTest { + + private static MBeanServer server = + ManagementFactory.getPlatformMBeanServer(); + + private static Map> expectedMapping = + new HashMap>(); + private static Set STATE_SET = new HashSet(); + private static Set ENABLED_SET = new HashSet(); + private static Set DOIT_SET = new HashSet(); + private static Set STATUS_SET = new HashSet(); + private static Set HEAPMEMORYUSAGE_SET = new HashSet(); + private static Set THREADINFO_SET = new HashSet(); + private static Set DOIT_ANNOTATED_SET = new HashSet(); + private static Set IT_ANNOTATED_SET = new HashSet(); + private static HashSet> TEST_MBEAN_SET = + new HashSet>(); + private static HashSet> ANNOTATED_MBEAN_SET = + new HashSet>(); + private static HashSet> MEMORY_MBEAN_SET = + new HashSet>(); + private static HashSet> THREAD_MBEAN_SET = + new HashSet>(); + + public interface TestMBean { + + public void doIt(); + + public void setState(String str); + + public String getState(); + + public boolean isEnabled(); + + public void setStatus(int i); + } + + public interface FaultyTestMBean { + + public void doIt(String doIt); + + public long getState(); + + public void setEnabled(boolean b); + + public int getStatus(); + + public String setWrong(int i); + } + + @MBean + public static class AnnotatedTest { + @ManagedOperation + public void doItAnnotated() { + + } + + public void dontDoIt() { + + } + + @ManagedAttribute + public String getItAnnotated() { + return null; + } + @ManagedAttribute + public void setItAnnotated(String str) { + + } + + public String getItNot() { + return null; + } + + } + + static class Test implements TestMBean { + + public void doIt() { + throw new UnsupportedOperationException("Not supported yet."); + } + + public void setState(String str) { + throw new UnsupportedOperationException("Not supported yet."); + } + + public String getState() { + throw new UnsupportedOperationException("Not supported yet."); + } + + public boolean isEnabled() { + throw new UnsupportedOperationException("Not supported yet."); + } + + public void setStatus(int i) { + throw new UnsupportedOperationException("Not supported yet."); + } + } + + + static { + try { + ENABLED_SET.add(TestMBean.class.getDeclaredMethod("isEnabled")); + + STATE_SET.add(TestMBean.class.getDeclaredMethod("getState")); + STATE_SET.add(TestMBean.class.getDeclaredMethod("setState", + String.class)); + STATUS_SET.add(TestMBean.class.getDeclaredMethod("setStatus", + int.class)); + + DOIT_SET.add(TestMBean.class.getDeclaredMethod("doIt")); + + DOIT_ANNOTATED_SET.add(AnnotatedTest.class.getDeclaredMethod("doItAnnotated")); + + IT_ANNOTATED_SET.add(AnnotatedTest.class.getDeclaredMethod("getItAnnotated")); + IT_ANNOTATED_SET.add(AnnotatedTest.class.getDeclaredMethod("setItAnnotated", String.class)); + + THREADINFO_SET.add(ThreadMXBean.class.getDeclaredMethod("dumpAllThreads", boolean.class, + boolean.class)); + + HEAPMEMORYUSAGE_SET.add(MemoryMXBean.class.getDeclaredMethod("getHeapMemoryUsage")); + + TEST_MBEAN_SET.add(ENABLED_SET); + TEST_MBEAN_SET.add(STATE_SET); + TEST_MBEAN_SET.add(STATUS_SET); + TEST_MBEAN_SET.add(DOIT_SET); + + ANNOTATED_MBEAN_SET.add(DOIT_ANNOTATED_SET); + ANNOTATED_MBEAN_SET.add(IT_ANNOTATED_SET); + + MEMORY_MBEAN_SET.add(HEAPMEMORYUSAGE_SET); + + THREAD_MBEAN_SET.add(THREADINFO_SET); + + expectedMapping.put("State", STATE_SET); + expectedMapping.put("Enabled", ENABLED_SET); + expectedMapping.put("Status", STATUS_SET); + expectedMapping.put("doIt", DOIT_SET); + expectedMapping.put("HeapMemoryUsage", HEAPMEMORYUSAGE_SET); + expectedMapping.put("dumpAllThreads", THREADINFO_SET); + expectedMapping.put("doItAnnotated", DOIT_ANNOTATED_SET); + expectedMapping.put("ItAnnotated", IT_ANNOTATED_SET); + + } catch (Exception ex) { + ex.printStackTrace(); + throw new RuntimeException("Initialization failed"); + } + } + + private static void testMBean(ObjectName name, Class itf, + HashSet> expectMappings) + throws Exception { + + Set> expectedMappings = + (Set>) expectMappings.clone(); + + MBeanInfo info = server.getMBeanInfo(name); + for (MBeanAttributeInfo attr : info.getAttributes()) { + Set expected = expectedMapping.get(attr.getName()); + if (expected == null) { + continue; + } + if (!expectedMappings.remove(expected)) { + throw new Exception("The mapping to use is not the expected " + + "one for " + attr); + } + System.out.println("Expected : " + expected); + Set found = + StandardMBean.findAttributeAccessors(itf, attr); + System.out.println("Found : " + found); + if (!found.equals(expected)) { + throw new Exception("Mapping error."); + } + } + for (MBeanOperationInfo op : info.getOperations()) { + Set expected = expectedMapping.get(op.getName()); + if (expected == null) { + continue; + } + if (!expectedMappings.remove(expected)) { + throw new Exception("The mapping to use is not the expected " + + "one for " + op); + } + System.out.println("Expected : " + expected); + Method method = + StandardMBean.findOperationMethod(itf, op); + Set found = new HashSet(); + found.add(method); + System.out.println("Found : " + found); + if (!found.equals(expected)) { + throw new Exception("Mapping error."); + } + } + + if (expectedMappings.size() != 0) { + throw new Exception("Some mapping have not been found " + + expectedMappings); + } else { + System.out.println("All mappings have been found"); + } + } + + public static void main(String[] args) throws Exception { + // Positive tests + Test t = new Test(); + ObjectName name = ObjectName.valueOf(":type=Test"); + server.registerMBean(t, name); + AnnotatedTest at = new AnnotatedTest(); + ObjectName annotatedName = ObjectName.valueOf(":type=AnnotatedTest"); + server.registerMBean(at, annotatedName); + + testMBean(name, TestMBean.class, TEST_MBEAN_SET); + + testMBean(annotatedName, AnnotatedTest.class, ANNOTATED_MBEAN_SET); + + ObjectName memoryName = + ObjectName.valueOf(ManagementFactory.MEMORY_MXBEAN_NAME); + testMBean(memoryName, MemoryMXBean.class, MEMORY_MBEAN_SET); + + ObjectName threadName = + ObjectName.valueOf(ManagementFactory.THREAD_MXBEAN_NAME); + testMBean(threadName, ThreadMXBean.class, THREAD_MBEAN_SET); + + // Negative tests + try { + StandardMBean.findOperationMethod(null, + new MBeanOperationInfo("Test", + TestMBean.class.getDeclaredMethod("doIt"))); + throw new Exception("Expected exception not found"); + } catch (IllegalArgumentException ex) { + System.out.println("OK received expected exception " + ex); + } + try { + StandardMBean.findOperationMethod(TestMBean.class, null); + throw new Exception("Expected exception not found"); + } catch (IllegalArgumentException ex) { + System.out.println("OK received expected exception " + ex); + } + try { + StandardMBean.findAttributeAccessors(null, + new MBeanAttributeInfo("Test", "Test", + TestMBean.class.getDeclaredMethod("getState"), + TestMBean.class.getDeclaredMethod("setState", + String.class))); + throw new Exception("Expected exception not found"); + } catch (IllegalArgumentException ex) { + System.out.println("OK received expected exception " + ex); + } + try { + StandardMBean.findAttributeAccessors(TestMBean.class, null); + throw new Exception("Expected exception not found"); + } catch (IllegalArgumentException ex) { + System.out.println("OK received expected exception " + ex); + } + //Wrong operation signature + try { + StandardMBean.findOperationMethod(TestMBean.class, + new MBeanOperationInfo("FaultyTest", + FaultyTestMBean.class.getDeclaredMethod("doIt", + String.class))); + throw new Exception("Expected exception not found"); + } catch (NoSuchMethodException ex) { + System.out.println("OK received expected exception " + ex); + } + //Wrong attribute accessor + try { + StandardMBean.findAttributeAccessors(TestMBean.class, + new MBeanAttributeInfo("FaultyTest", "FaultyTest", null, + FaultyTestMBean.class.getDeclaredMethod("setEnabled", + String.class))); + throw new Exception("Expected exception not found"); + } catch (NoSuchMethodException ex) { + System.out.println("OK received expected exception " + ex); + } + //Wrong attribute type + try { + StandardMBean.findAttributeAccessors(TestMBean.class, + new MBeanAttributeInfo("State", "toto.FaultType", + "FaultyTest", true, true, false)); + throw new Exception("Expected exception not found"); + } catch (ClassNotFoundException ex) { + System.out.println("OK received expected exception " + ex); + } + //Wrong operation parameter type + try { + MBeanParameterInfo[] p = {new MBeanParameterInfo("p1", + "toto.FaultType2", "FaultyParameter") + }; + StandardMBean.findOperationMethod(TestMBean.class, + new MBeanOperationInfo("doIt", "FaultyMethod", p, "void", + 0)); + throw new Exception("Expected exception not found"); + } catch (ClassNotFoundException ex) { + System.out.println("OK received expected exception " + ex); + } + // Check that not annotated attributes are not found + try { + StandardMBean.findAttributeAccessors(AnnotatedTest.class, + new MBeanAttributeInfo("ItNot", String.class.getName(), + "FaultyTest", true, false, false)); + throw new Exception("Expected exception not found"); + } catch (NoSuchMethodException ex) { + System.out.println("OK received expected exception " + ex); + } + // Check that not annotated operations are not found + try { + StandardMBean.findOperationMethod(AnnotatedTest.class, + new MBeanOperationInfo("dontDoIt","dontDoIt",null, + Void.TYPE.getName(),0)); + throw new Exception("Expected exception not found"); + } catch (NoSuchMethodException ex) { + System.out.println("OK received expected exception " + ex); + } + // Check that wrong getter return type throws Exception + try { + StandardMBean.findAttributeAccessors(AnnotatedTest.class, + new MBeanAttributeInfo("ItAnnotated", Long.class.getName(), + "FaultyTest", true, false, false)); + throw new Exception("Expected exception not found"); + } catch (NoSuchMethodException ex) { + System.out.println("OK received expected exception " + ex); + } + // Check that wrong setter return type throws Exception + try { + StandardMBean.findAttributeAccessors(FaultyTestMBean.class, + new MBeanAttributeInfo("Wrong", String.class.getName(), + "FaultyTest", true, true, false)); + throw new Exception("Expected exception not found"); + } catch (NoSuchMethodException ex) { + System.out.println("OK received expected exception " + ex); + } + } +} From 34982c7509f8793a94f33ab7284204c412c832b1 Mon Sep 17 00:00:00 2001 From: Shanliang Jiang Date: Tue, 9 Dec 2008 17:41:04 +0100 Subject: [PATCH 194/267] 6405891: MLet: could be improved to load a native lib Reviewed-by: emcmanus --- jdk/src/share/classes/javax/management/loading/MLet.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/jdk/src/share/classes/javax/management/loading/MLet.java b/jdk/src/share/classes/javax/management/loading/MLet.java index c006dc09b11..ffc5ce0afa1 100644 --- a/jdk/src/share/classes/javax/management/loading/MLet.java +++ b/jdk/src/share/classes/javax/management/loading/MLet.java @@ -1165,9 +1165,10 @@ public class MLet extends java.net.URLClassLoader file.deleteOnExit(); FileOutputStream fileOutput = new FileOutputStream(file); try { - int c; - while ((c = is.read()) != -1) { - fileOutput.write(c); + byte[] buf = new byte[4096]; + int n; + while ((n = is.read(buf)) >= 0) { + fileOutput.write(buf, 0, n); } } finally { fileOutput.close(); From ccf03a6e2c100092c38a049811530402551809b9 Mon Sep 17 00:00:00 2001 From: Eamonn McManus Date: Tue, 9 Dec 2008 18:30:27 +0100 Subject: [PATCH 195/267] 6780803: Wrong parameter name in description of EventClient::addListeners() 6470295: Misleading exception message says context classloader when it isn't 6714954: Description of MBeanPermission checking in MBeanServer javadoc is inaccurate 6732037: Event Service spec needs more detail about Executor use 6740900: Specify that listeners invoked via SendNotification should not block 6778436: Typo in @NotificationInfos spec Reviewed-by: dfuchs --- .../com/sun/jmx/mbeanserver/MBeanInstantiator.java | 2 +- .../classes/javax/management/MBeanRegistration.java | 3 +++ .../share/classes/javax/management/MBeanServer.java | 6 +++--- .../classes/javax/management/event/EventClient.java | 9 +++++---- .../javax/management/event/FetchingEventRelay.java | 12 ++++++++++-- 5 files changed, 22 insertions(+), 10 deletions(-) diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java index 4a6949dc868..f3bd67e2f23 100644 --- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java +++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java @@ -645,7 +645,7 @@ public class MBeanInstantiator { } } catch (ClassNotFoundException e) { throw new ReflectionException(e, - "The MBean class could not be loaded by the context classloader"); + "The MBean class could not be loaded"); } return theClass; } diff --git a/jdk/src/share/classes/javax/management/MBeanRegistration.java b/jdk/src/share/classes/javax/management/MBeanRegistration.java index 723045acc93..93d391d7f17 100644 --- a/jdk/src/share/classes/javax/management/MBeanRegistration.java +++ b/jdk/src/share/classes/javax/management/MBeanRegistration.java @@ -79,6 +79,9 @@ package javax.management; * } * * + *

      (Listeners may be invoked in the same thread as the caller of + * {@code sender.sendNotification}.)

      + * *

      A field to be injected must not be static. It is recommended that * such fields be declared {@code volatile}.

      * diff --git a/jdk/src/share/classes/javax/management/MBeanServer.java b/jdk/src/share/classes/javax/management/MBeanServer.java index e82650288bb..6e4ee0a69c3 100644 --- a/jdk/src/share/classes/javax/management/MBeanServer.java +++ b/jdk/src/share/classes/javax/management/MBeanServer.java @@ -186,11 +186,11 @@ import javax.management.loading.ClassLoaderRepository; * caller's permissions must imply {@link * MBeanPermission#MBeanPermission(String,String,String,ObjectName,String) * MBeanPermission(mbeanServerName, null, null, null, "queryMBeans")}. - * Additionally, for each MBean that matches name, + * Additionally, for each MBean n that matches name, * if the caller's permissions do not imply {@link * MBeanPermission#MBeanPermission(String,String,String,ObjectName,String) - * MBeanPermission(mbeanServerName, className, null, name, "queryMBeans")}, the - * MBean server will behave as if that MBean did not exist.

      + * MBeanPermission(mbeanServerName, className, null, n, "queryMBeans")}, + * the MBean server will behave as if that MBean did not exist.

      * *

      Certain query elements perform operations on the MBean server. * If the caller does not have the required permissions for a given diff --git a/jdk/src/share/classes/javax/management/event/EventClient.java b/jdk/src/share/classes/javax/management/event/EventClient.java index a2f6bc617fe..2688b94937f 100644 --- a/jdk/src/share/classes/javax/management/event/EventClient.java +++ b/jdk/src/share/classes/javax/management/event/EventClient.java @@ -187,9 +187,10 @@ public class EventClient implements EventConsumer, NotificationManager { * forwarded by the {@link EventClientDelegateMBean}. If {@code null}, a * {@link FetchingEventRelay} object will be used. * @param distributingExecutor Used to distribute notifications to local - * listeners. If {@code null}, the thread that calls {@link - * EventReceiver#receive EventReceiver.receive} from the {@link EventRelay} - * object is used. + * listeners. Only one job at a time will be submitted to this Executor. + * If {@code distributingExecutor} is {@code null}, the thread that calls + * {@link EventReceiver#receive EventReceiver.receive} from the {@link + * EventRelay} object is used. * @param leaseScheduler An object that will be used to schedule the * periodic {@linkplain EventClientDelegateMBean#lease lease updates}. * If {@code null}, a default scheduler will be used. @@ -545,7 +546,7 @@ public class EventClient implements EventConsumer, NotificationManager { * *

      The method returns the listeners which were added successfully. The * elements in the returned collection are a subset of the elements in - * {@code infoList}. If all listeners were added successfully, the two + * {@code listeners}. If all listeners were added successfully, the two * collections are the same. If no listener was added successfully, the * returned collection is empty.

      * diff --git a/jdk/src/share/classes/javax/management/event/FetchingEventRelay.java b/jdk/src/share/classes/javax/management/event/FetchingEventRelay.java index e4c8d81d87b..cbec8aa82be 100644 --- a/jdk/src/share/classes/javax/management/event/FetchingEventRelay.java +++ b/jdk/src/share/classes/javax/management/event/FetchingEventRelay.java @@ -39,10 +39,18 @@ import javax.management.MBeanException; import javax.management.remote.NotificationResult; /** - * This class is an implementation of the {@link EventRelay} interface. It calls + *

      This class is an implementation of the {@link EventRelay} interface. It calls * {@link EventClientDelegateMBean#fetchNotifications * fetchNotifications(String, long, int, long)} to get - * notifications and then forwards them to an {@link EventReceiver} object. + * notifications and then forwards them to an {@link EventReceiver} object.

      + * + *

      A {@code fetchExecutor} parameter can be specified when creating a + * {@code FetchingEventRelay}. That is then the {@code Executor} that will + * be used to perform the {@code fetchNotifications} operation. Only one + * job at a time will be submitted to this {@code Executor}. The behavior + * is unspecified if {@link Executor#execute} throws an exception, including + * {@link java.util.concurrent.RejectedExecutionException + * RejectedExecutionException}. * * @since JMX 2.0 */ From d2c931b22261ed13315609cffba52c8861d75044 Mon Sep 17 00:00:00 2001 From: Shanliang Jiang Date: Tue, 9 Dec 2008 18:42:13 +0100 Subject: [PATCH 196/267] 6760712: Provide a connector server option that causes it not to prevent the VM from exiting Reviewed-by: emcmanus --- .../com/sun/jmx/remote/util/EnvHelp.java | 19 +++ .../remote/rmi/RMIJRMPServerImpl.java | 26 +++- .../connection/DaemonRMIExporterTest.java | 123 ++++++++++++++++++ 3 files changed, 164 insertions(+), 4 deletions(-) create mode 100644 jdk/test/javax/management/remote/mandatory/connection/DaemonRMIExporterTest.java diff --git a/jdk/src/share/classes/com/sun/jmx/remote/util/EnvHelp.java b/jdk/src/share/classes/com/sun/jmx/remote/util/EnvHelp.java index c86df1c88ee..683359ba950 100644 --- a/jdk/src/share/classes/com/sun/jmx/remote/util/EnvHelp.java +++ b/jdk/src/share/classes/com/sun/jmx/remote/util/EnvHelp.java @@ -1,3 +1,4 @@ + /* * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -798,6 +799,24 @@ public class EnvHelp { JMXConnectorServer.DELEGATE_TO_EVENT_SERVICE, true, true); } + /** + *

      Name of the attribute that specifies whether a connector server + * should not prevent the VM from exiting + */ + public static final String JMX_SERVER_DAEMON = "jmx.remote.x.daemon"; + + /** + * Returns true if {@value SERVER_DAEMON} is specified in the {@code env} + * as a key and its value is a String and it is equal to true ignoring case. + * + * @param env + * @return + */ + public static boolean isServerDaemon(Map env) { + return (env != null) && + ("true".equalsIgnoreCase((String)env.get(JMX_SERVER_DAEMON))); + } + // /** // *

      Name of the attribute that specifies an EventRelay object to use. // */ diff --git a/jdk/src/share/classes/javax/management/remote/rmi/RMIJRMPServerImpl.java b/jdk/src/share/classes/javax/management/remote/rmi/RMIJRMPServerImpl.java index bf8c5ca4fae..ef4f5e988a9 100644 --- a/jdk/src/share/classes/javax/management/remote/rmi/RMIJRMPServerImpl.java +++ b/jdk/src/share/classes/javax/management/remote/rmi/RMIJRMPServerImpl.java @@ -38,6 +38,9 @@ import java.util.Collections; import javax.security.auth.Subject; import com.sun.jmx.remote.internal.RMIExporter; +import com.sun.jmx.remote.util.EnvHelp; +import sun.rmi.server.UnicastServerRef; +import sun.rmi.server.UnicastServerRef2; /** *

      An {@link RMIServer} object that is exported through JRMP and that @@ -93,12 +96,27 @@ public class RMIJRMPServerImpl extends RMIServerImpl { } private void export(Remote obj) throws RemoteException { - RMIExporter exporter = + final RMIExporter exporter = (RMIExporter) env.get(RMIExporter.EXPORTER_ATTRIBUTE); - if (exporter == null) - UnicastRemoteObject.exportObject(obj, port, csf, ssf); - else + final boolean daemon = EnvHelp.isServerDaemon(env); + + if (daemon && exporter != null) { + throw new IllegalArgumentException("If "+EnvHelp.JMX_SERVER_DAEMON+ + " is specified as true, "+RMIExporter.EXPORTER_ATTRIBUTE+ + " cannot be used to specify an exporter!"); + } + + if (daemon) { + if (csf == null && ssf == null) { + new UnicastServerRef(port).exportObject(obj, null, true); + } else { + new UnicastServerRef2(port, csf, ssf).exportObject(obj, null, true); + } + } else if (exporter != null) { exporter.exportObject(obj, port, csf, ssf); + } else { + UnicastRemoteObject.exportObject(obj, port, csf, ssf); + } } private void unexport(Remote obj, boolean force) diff --git a/jdk/test/javax/management/remote/mandatory/connection/DaemonRMIExporterTest.java b/jdk/test/javax/management/remote/mandatory/connection/DaemonRMIExporterTest.java new file mode 100644 index 00000000000..3ee6066b0e5 --- /dev/null +++ b/jdk/test/javax/management/remote/mandatory/connection/DaemonRMIExporterTest.java @@ -0,0 +1,123 @@ +/* + * Copyright 2003-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. + * + * 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 6760712 + * @summary test the connector server option that causes it not to prevent the + * VM from exiting + * @author Shanliang JIANG, Eamonn McManus + * @run main/othervm DaemonRMIExporterTest + */ +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import javax.management.MBeanServerFactory; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXServiceURL; +import javax.management.remote.JMXConnectorServer; +import javax.management.remote.JMXConnectorServerFactory; + +// Test the connector server option that causes it not to prevent the VM +// from exiting. It's tricky to test exactly that, though possible. If +// we're being run from within jtreg, then jtreg has threads of its own +// that will prevent the VM from exiting. What's more it will kill all +// threads that the test created as soon as the main method returns, +// including the ones that would prevent the VM from exiting without the +// special option. +// Here we check that the test code does not create +// any permanent non-daemon threads, by recording the initial set of +// non-daemon threads (including at least one from jtreg), doing our stuff, +// then waiting for there to be no non-daemon threads that were not in +// the initial set. +public class DaemonRMIExporterTest { + public static void main(String[] args) throws Exception { + Set initialNonDaemonThreads = getNonDaemonThreads(); + + JMXServiceURL addr = new JMXServiceURL("rmi", null, 0); + System.out.println("DaemonRMIExporterTest: Creating a RMIConnectorServer on " + addr); + Map env = + Collections.singletonMap("jmx.remote.x.daemon", "true"); + JMXConnectorServer server = + JMXConnectorServerFactory.newJMXConnectorServer(addr, + env, + MBeanServerFactory.createMBeanServer()); + server.start(); + System.out.println("DaemonRMIExporterTest: Started the server on " + server.getAddress()); + + System.out.println("DaemonRMIExporterTest: Connecting a client to the server ..."); + final JMXConnector conn = JMXConnectorFactory.connect(server.getAddress()); + conn.getMBeanServerConnection().getDefaultDomain(); + + System.out.println("DaemonRMIExporterTest: Closing the client ..."); + conn.close(); + + System.out.println("DaemonRMIExporterTest No more user code to execute, the VM should " + + "exit normally, otherwise will be blocked forever if the bug is not fixed."); + + long deadline = System.currentTimeMillis() + 10000; + ok: { + while (System.currentTimeMillis() < deadline) { + Set nonDaemonThreads = getNonDaemonThreads(); + nonDaemonThreads.removeAll(initialNonDaemonThreads); + if (nonDaemonThreads.isEmpty()) + break ok; + System.out.println("Non-daemon threads: " + nonDaemonThreads); + try { + Thread.sleep(500); + } catch (InterruptedException e) { + throw new AssertionError(e); + } + } + throw new Exception("TEST FAILED: non-daemon threads remain"); + } + + System.out.println("TEST PASSED"); + } + + private static Set getNonDaemonThreads() { + ThreadGroup tg = Thread.currentThread().getThreadGroup(); + while (tg.getParent() != null) + tg = tg.getParent(); + Thread[] threads = null; + for (int size = 10; size < 10000; size *= 2) { + threads = new Thread[size]; + int n = tg.enumerate(threads, true); + if (n < size) { + threads = Arrays.copyOf(threads, n); + break; + } + } + Set ndThreads = new HashSet(); + for (Thread t : threads) { + if (!t.isDaemon()) + ndThreads.add(t); + } + return ndThreads; + } +} From 6a4903d458653cca4ff277993952f6c5363233c1 Mon Sep 17 00:00:00 2001 From: Shanliang Jiang Date: Tue, 9 Dec 2008 19:44:22 +0100 Subject: [PATCH 197/267] 6332907: Add ability for connector server to close individual connections Reviewed-by: emcmanus --- .../com/sun/jmx/remote/util/EnvHelp.java | 2 +- .../management/remote/JMXConnectorServer.java | 28 +++ .../remote/rmi/RMIConnectorServer.java | 20 ++ .../management/remote/rmi/RMIServerImpl.java | 57 ++++- .../connectorServer/CloseConnectionTest.java | 217 ++++++++++++++++++ 5 files changed, 321 insertions(+), 3 deletions(-) create mode 100644 jdk/test/javax/management/remote/mandatory/connectorServer/CloseConnectionTest.java diff --git a/jdk/src/share/classes/com/sun/jmx/remote/util/EnvHelp.java b/jdk/src/share/classes/com/sun/jmx/remote/util/EnvHelp.java index 683359ba950..e95c1e049df 100644 --- a/jdk/src/share/classes/com/sun/jmx/remote/util/EnvHelp.java +++ b/jdk/src/share/classes/com/sun/jmx/remote/util/EnvHelp.java @@ -812,7 +812,7 @@ public class EnvHelp { * @param env * @return */ - public static boolean isServerDaemon(Map env) { + public static boolean isServerDaemon(Map env) { return (env != null) && ("true".equalsIgnoreCase((String)env.get(JMX_SERVER_DAEMON))); } diff --git a/jdk/src/share/classes/javax/management/remote/JMXConnectorServer.java b/jdk/src/share/classes/javax/management/remote/JMXConnectorServer.java index c9b4721911b..056114cfc76 100644 --- a/jdk/src/share/classes/javax/management/remote/JMXConnectorServer.java +++ b/jdk/src/share/classes/javax/management/remote/JMXConnectorServer.java @@ -386,6 +386,34 @@ public abstract class JMXConnectorServer return false; } + /** + * Closes a client connection. If the connection is successfully closed, + * the method {@link #connectionClosed} is called to notify interested parties. + *

      Not all connector servers support this method. For those that do, it + * should be possible to cause a new client connection to fail before it + * can be used, by calling this method from within a + * {@link javax.management.NotificationListener} + * when it receives a {@link JMXConnectionNotification#OPENED} notification. + * This allows the owner of a connector server to deny certain connections, + * typically based on the information in the connection id. + *

      The implementation of this method in {@code JMXConnectorServer} throws + * {@code UnsupportedOperationException}. Subclasses can override this + * method to support closing a specified client connection. + * + * @param connectionId the id of the client connection to be closed. + * @throws IllegalStateException if the server is not started or is closed. + * @throws IllegalArgumentException if {@code connectionId} is null or is + * not the id of any open connection. + * @throws java.io.IOException if an I/O error appears when closing the + * connection. + * + * @since 1.7 + */ + public void closeConnection(String connectionId) + throws IOException { + throw new UnsupportedOperationException(); + } + /** *

      Install {@link MBeanServerForwarder}s in the system chain * based on the attributes in the given {@code Map}. A connector diff --git a/jdk/src/share/classes/javax/management/remote/rmi/RMIConnectorServer.java b/jdk/src/share/classes/javax/management/remote/rmi/RMIConnectorServer.java index 9d38c7e8944..7acc02adbd5 100644 --- a/jdk/src/share/classes/javax/management/remote/rmi/RMIConnectorServer.java +++ b/jdk/src/share/classes/javax/management/remote/rmi/RMIConnectorServer.java @@ -602,6 +602,26 @@ public class RMIConnectorServer extends JMXConnectorServer { return true; } + /** + * {@inheritDoc} + *

      The {@code RMIConnectorServer} class does support closing a specified + * client connection. + * @throws IllegalStateException if the server is not started or is closed. + * @throws IllegalArgumentException if {@code connectionId} is null or is + * not the id of any open connection. + * @since 1.7 + */ + @Override + public void closeConnection(String connectionId) + throws IOException { + if (isActive()) { + rmiServerImpl.closeConnection(connectionId); + } else { + throw new IllegalStateException( + "The server is not started or is closed."); + } + } + /* We repeat the definitions of connection{Opened,Closed,Failed} here so that they are accessible to other classes in this package even though they have protected access. */ diff --git a/jdk/src/share/classes/javax/management/remote/rmi/RMIServerImpl.java b/jdk/src/share/classes/javax/management/remote/rmi/RMIServerImpl.java index d87b1d0544b..6fbc9a2b120 100644 --- a/jdk/src/share/classes/javax/management/remote/rmi/RMIServerImpl.java +++ b/jdk/src/share/classes/javax/management/remote/rmi/RMIServerImpl.java @@ -249,20 +249,73 @@ public abstract class RMIServerImpl implements Closeable, RMIServer { RMIConnection client = makeClient(connectionId, subject); - connServer.connectionOpened(connectionId, "Connection opened", null); - dropDeadReferences(); WeakReference wr = new WeakReference(client); synchronized (clientList) { clientList.add(wr); } + connServer.connectionOpened(connectionId, "Connection opened", null); + + synchronized (clientList) { + if (!clientList.contains(wr)) { + // can be removed only by a JMXConnectionNotification listener + throw new IOException("The connection is refused."); + } + } + if (tracing) logger.trace("newClient","new connection done: " + connectionId ); return client; } + /** + * Closes a client connection. + * @param connectionId the id of the client connection to be closed. + * @throws IllegalArgumentException if {@code connectionId} is null or is + * not the id of any open connection. + * @throws java.io.IOException if an I/O error appears when closing the + * connection. + * + * @since 1.7 + */ + public void closeConnection(String connectionId) + throws IOException { + final boolean debug = logger.debugOn(); + + if (debug) logger.trace("closeConnection","cconnectionId="+connectionId); + + if (connectionId == null) + throw new IllegalArgumentException("Null connectionId."); + + RMIConnection client = null; + synchronized (clientList) { + dropDeadReferences(); + for (Iterator> it = clientList.iterator(); + it.hasNext(); ) { + client = it.next().get(); + if (client != null && connectionId.equals(client.getConnectionId())) { + it.remove(); + break; + } + } + } + + if (client == null) { + throw new IllegalArgumentException("Unknown id: "+connectionId); + } + + if (debug) logger.trace("closeConnection", "closing client connection."); + closeClient(client); + + if (debug) logger.trace("closeConnection", "sending notif"); + connServer.connectionClosed(connectionId, + "Client connection closed", null); + + if (debug) logger.trace("closeConnection","done"); + } + /** *

      Creates a new client connection. This method is called by * the public method {@link #newClient(Object)}.

      diff --git a/jdk/test/javax/management/remote/mandatory/connectorServer/CloseConnectionTest.java b/jdk/test/javax/management/remote/mandatory/connectorServer/CloseConnectionTest.java new file mode 100644 index 00000000000..54d05f84273 --- /dev/null +++ b/jdk/test/javax/management/remote/mandatory/connectorServer/CloseConnectionTest.java @@ -0,0 +1,217 @@ +/* + * Copyright 2003-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. + * + * 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 6332907 + * @summary test the ability for connector server to close individual connections + * @author Shanliang JIANG + * @run clean CloseConnectionTest + * @run build CloseConnectionTest + * @run main CloseConnectionTest + */ +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import javax.management.MBeanServerFactory; + +import javax.management.Notification; +import javax.management.NotificationListener; +import javax.management.remote.JMXConnectionNotification; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXServiceURL; +import javax.management.remote.JMXConnectorServer; +import javax.management.remote.JMXConnectorServerFactory; + +public class CloseConnectionTest { + + public static void main(String[] args) throws Exception { + System.out.println(">>> Test the ability for connector server to close " + + "individual connections."); + + final String[] protos = new String[]{"rmi", "iiop", "jmxmp"}; + for (String p : protos) { + System.out.println("\n>>> Testing the protocol " + p); + JMXServiceURL addr = new JMXServiceURL(p, null, 0); + System.out.println(">>> Creating a JMXConnectorServer on " + addr); + JMXConnectorServer server = null; + try { + server = JMXConnectorServerFactory.newJMXConnectorServer(addr, + null, + MBeanServerFactory.createMBeanServer()); + } catch (Exception e) { + System.out.println(">>> Skip the protocol: " + p); + continue; + } + + test1(server); + test2(server); + + server.stop(); + } + + System.out.println(">>> Bye bye!"); + } + + private static void test1(JMXConnectorServer server) throws Exception { + try { + server.closeConnection("toto"); + // not started, known id + throw new RuntimeException("An IllegalArgumentException is not thrown."); + } catch (IllegalStateException e) { + System.out.println(">>> Test1: Got expected IllegalStateException: " + e); + } + + server.start(); + System.out.println(">>>Test1 Started the server on " + server.getAddress()); + + try { + server.closeConnection("toto"); + throw new RuntimeException("An IllegalArgumentException is not thrown."); + } catch (IllegalArgumentException e) { + System.out.println(">> Test1: Got expected IllegalArgumentException: " + e); + } + + MyListener listener = new MyListener(); + server.addNotificationListener(listener, null, null); + + System.out.println(">>> Test1: Connecting a client to the server ..."); + final JMXConnector conn = JMXConnectorFactory.connect(server.getAddress()); + conn.getMBeanServerConnection().getDefaultDomain(); + final String id1 = conn.getConnectionId(); + + listener.wait(JMXConnectionNotification.OPENED, timeout); + + System.out.println(">>> Test1: Closing the connection: " + conn.getConnectionId()); + server.closeConnection(id1); + listener.wait(JMXConnectionNotification.CLOSED, timeout); + + System.out.println(">>> Test1: Using again the connector whose connection " + + "should be closed by the server, it should reconnect " + + "automatically to the server and get a new connection id."); + conn.getMBeanServerConnection().getDefaultDomain(); + final String id2 = conn.getConnectionId(); + listener.wait(JMXConnectionNotification.OPENED, timeout); + + if (id1.equals(id2)) { + throw new RuntimeException("Failed, the first client connection is not closed."); + } + + System.out.println(">>> Test1: Greate, we get a new connection id " + id2 + + ", the first one is closed as expected."); + + System.out.println(">>> Test1: Closing the client."); + conn.close(); + System.out.println(">>> Test1: Stopping the server."); + server.removeNotificationListener(listener); + } + + private static void test2(JMXConnectorServer server) throws Exception { + System.out.println(">>> Test2 close a connection before " + + "the client can use it..."); + final Killer killer = new Killer(server); + server.addNotificationListener(killer, null, null); + + System.out.println(">>> Test2 Connecting a client to the server ..."); + final JMXConnector conn; + try { + conn = JMXConnectorFactory.connect(server.getAddress()); + throw new RuntimeException(">>> Failed, do not receive an " + + "IOException telling the connection is refused."); + } catch (IOException ioe) { + System.out.println(">>> Test2 got expected IOException: "+ioe); + } + } + + private static class MyListener implements NotificationListener { + public void handleNotification(Notification n, Object hb) { + if (n instanceof JMXConnectionNotification) { + synchronized (received) { + received.add((JMXConnectionNotification) n); + received.notify(); + } + } + } + + public JMXConnectionNotification wait(String type, long timeout) + throws Exception { + JMXConnectionNotification waited = null; + long toWait = timeout; + long deadline = System.currentTimeMillis() + timeout; + synchronized (received) { + while (waited == null && toWait > 0) { + received.wait(toWait); + for (JMXConnectionNotification n : received) { + if (type.equals(n.getType())) { + waited = n; + break; + } + } + received.clear(); + toWait = deadline - System.currentTimeMillis(); + } + } + + if (waited == null) { + throw new RuntimeException("Do not receive expected notification " + type); + } else { + System.out.println(">>> Received expected notif: "+type+ + " "+waited.getConnectionId()); + } + + return waited; + } + + final List received = + new ArrayList(); + } + + private static class Killer implements NotificationListener { + public Killer(JMXConnectorServer server) { + this.server = server; + } + public void handleNotification(Notification n, Object hb) { + if (n instanceof JMXConnectionNotification) { + if (JMXConnectionNotification.OPENED.equals(n.getType())) { + final JMXConnectionNotification cn = + (JMXConnectionNotification)n; + try { + System.out.println(">>> Killer: close the connection "+ + cn.getConnectionId()); + server.closeConnection(cn.getConnectionId()); + } catch (Exception e) { + // impossible? + e.printStackTrace(); + System.exit(1); + } + } + } + } + + private final JMXConnectorServer server; + } + + private static final long timeout = 6000; +} From 2064095b24f9d3460a33404471bcbecf08b52f9d Mon Sep 17 00:00:00 2001 From: Daniel Fuchs Date: Tue, 9 Dec 2008 20:20:48 +0100 Subject: [PATCH 198/267] 6768935: Clarify the behaviour of ObjectName pattern matching with regards to namespaces Reviewed-by: emcmanus --- .../jmx/interceptor/DispatchInterceptor.java | 16 +-- .../DomainDispatchInterceptor.java | 30 ++--- .../NamespaceDispatchInterceptor.java | 125 +++++++++++++----- .../com/sun/jmx/mbeanserver/MXBeanLookup.java | 11 +- .../classes/com/sun/jmx/mbeanserver/Util.java | 1 - .../sun/jmx/namespace/DomainInterceptor.java | 11 +- .../jmx/namespace/NamespaceInterceptor.java | 9 +- .../sun/jmx/namespace/ObjectNameRouter.java | 13 +- .../RoutingMBeanServerConnection.java | 31 ++--- .../com/sun/jmx/namespace/RoutingProxy.java | 6 +- .../classes/javax/management/MBeanServer.java | 10 +- .../management/MBeanServerConnection.java | 34 ++++- .../classes/javax/management/ObjectName.java | 106 ++++++++++++--- .../javax/management/namespace/JMXDomain.java | 10 +- .../namespace/JMXNamespacePermission.java | 38 +----- .../management/namespace/JMXNamespaces.java | 12 +- .../management/namespace/package-info.java | 36 ++++- .../namespace/LeadingSeparatorsTest.java | 23 +++- .../namespace/NullDomainObjectNameTest.java | 35 ++++- .../namespace/NullObjectNameTest.java | 29 +++- .../management/namespace/QueryNamesTest.java | 66 ++++++++- 21 files changed, 441 insertions(+), 211 deletions(-) diff --git a/jdk/src/share/classes/com/sun/jmx/interceptor/DispatchInterceptor.java b/jdk/src/share/classes/com/sun/jmx/interceptor/DispatchInterceptor.java index 4a79567fed1..f68e539d2fc 100644 --- a/jdk/src/share/classes/com/sun/jmx/interceptor/DispatchInterceptor.java +++ b/jdk/src/share/classes/com/sun/jmx/interceptor/DispatchInterceptor.java @@ -44,7 +44,6 @@ import javax.management.MBeanException; import javax.management.MBeanInfo; import javax.management.MBeanRegistrationException; import javax.management.MBeanServer; -import javax.management.MalformedObjectNameException; import javax.management.NotCompliantMBeanException; import javax.management.NotificationFilter; import javax.management.NotificationListener; @@ -205,8 +204,7 @@ public abstract class DispatchInterceptor // Returns the ObjectName of the JMXNamespace (or JMXDomain) for that // key (a namespace or a domain name). - abstract ObjectName getHandlerNameFor(String key) - throws MalformedObjectNameException; + abstract ObjectName getHandlerNameFor(String key); // Creates an interceptor for the given key, name, JMXNamespace (or // JMXDomain). Note: this will be either a NamespaceInterceptor @@ -263,14 +261,10 @@ public abstract class DispatchInterceptor void validateHandlerNameFor(String key, ObjectName name) { if (key == null || key.equals("")) throw new IllegalArgumentException("invalid key for "+name+": "+key); - try { - final ObjectName handlerName = getHandlerNameFor(key); - if (!name.equals(handlerName)) - throw new IllegalArgumentException("bad handler name: "+name+ - ". Should be: "+handlerName); - } catch (MalformedObjectNameException x) { - throw new IllegalArgumentException(name.toString(),x); - } + final ObjectName handlerName = getHandlerNameFor(key); + if (!name.equals(handlerName)) + throw new IllegalArgumentException("bad handler name: "+name+ + ". Should be: "+handlerName); } // Called by the DefaultMBeanServerInterceptor when an instance diff --git a/jdk/src/share/classes/com/sun/jmx/interceptor/DomainDispatchInterceptor.java b/jdk/src/share/classes/com/sun/jmx/interceptor/DomainDispatchInterceptor.java index 9b9b1d6b19c..388af6b21dd 100644 --- a/jdk/src/share/classes/com/sun/jmx/interceptor/DomainDispatchInterceptor.java +++ b/jdk/src/share/classes/com/sun/jmx/interceptor/DomainDispatchInterceptor.java @@ -38,7 +38,6 @@ import java.util.logging.Logger; import javax.management.MBeanServer; import javax.management.MBeanServerDelegate; -import javax.management.MalformedObjectNameException; import javax.management.ObjectName; import javax.management.QueryExp; import javax.management.namespace.JMXDomain; @@ -248,21 +247,17 @@ class DomainDispatchInterceptor if (pattern == null) return true; if (pattern.isDomainPattern()) return true; - try { - // case b) above. - // - // This is a bit of a hack. If there's any chance that a JMXDomain - // MBean name is selected by the given pattern then we must include - // the local namespace in our search. - // - // Returning true will have this effect. see 2. above. - // - if (pattern.apply(ALL_DOMAINS.withDomain(pattern.getDomain()))) - return true; - } catch (MalformedObjectNameException x) { - // should not happen - throw new IllegalArgumentException(String.valueOf(pattern), x); - } + // case b) above. + // + // This is a bit of a hack. If there's any chance that a JMXDomain + // MBean name is selected by the given pattern then we must include + // the local namespace in our search. + // + // Returning true will have this effect. see 2. above. + // + if (pattern.apply(ALL_DOMAINS.withDomain(pattern.getDomain()))) + return true; + return false; } @@ -291,8 +286,7 @@ class DomainDispatchInterceptor } @Override - final ObjectName getHandlerNameFor(String key) - throws MalformedObjectNameException { + final ObjectName getHandlerNameFor(String key) { return JMXDomain.getDomainObjectName(key); } diff --git a/jdk/src/share/classes/com/sun/jmx/interceptor/NamespaceDispatchInterceptor.java b/jdk/src/share/classes/com/sun/jmx/interceptor/NamespaceDispatchInterceptor.java index d86c787b898..5ab61f8933a 100644 --- a/jdk/src/share/classes/com/sun/jmx/interceptor/NamespaceDispatchInterceptor.java +++ b/jdk/src/share/classes/com/sun/jmx/interceptor/NamespaceDispatchInterceptor.java @@ -37,8 +37,8 @@ import java.util.logging.Logger; import javax.management.MBeanServer; import javax.management.MBeanServerDelegate; -import javax.management.MalformedObjectNameException; import javax.management.ObjectName; +import javax.management.RuntimeOperationsException; import javax.management.namespace.JMXDomain; import javax.management.namespace.JMXNamespace; import static javax.management.namespace.JMXNamespaces.NAMESPACE_SEPARATOR; @@ -60,6 +60,7 @@ public class NamespaceDispatchInterceptor private static final int NAMESPACE_SEPARATOR_LENGTH = NAMESPACE_SEPARATOR.length(); + private static final ObjectName X3 = ObjectName.valueOf("x:x=x"); private final DomainDispatchInterceptor nextInterceptor; private final String serverName; @@ -89,27 +90,38 @@ public class NamespaceDispatchInterceptor serverName = Util.getMBeanServerSecurityName(delegate); } - // TODO: Should move that to JMXNamespace? or to ObjectName? /** * Get first name space in ObjectName path. Ignore leading namespace - * separators. + * separators. Includes the trailing //. + * + * Examples: + *
      +     *  For ObjectName:                   Returns:
      +     *  foo//bar//baz:x=x         ->      "foo//"
      +     *  foo//:type=JMXNamespace   ->      "foo//"
      +     *  foo//:x=x                 ->      "foo//"
      +     *  foo////:x=x               ->      "foo//"
      +     *  //foo//bar//baz:x=x       ->      "//"
      +     *  ////foo//bar//baz:x=x     ->      "//"
      +     *  //:x=x                    ->      "//"
      +     *  foo:x=x                   ->      ""
      +     *  (null)                    ->      ""
      +     *  :x=x                      ->      ""
      +     *
      +     * 
      **/ - static String getFirstNamespace(ObjectName name) { + static String getFirstNamespaceWithSlash(ObjectName name) { if (name == null) return ""; final String domain = name.getDomain(); if (domain.equals("")) return ""; - // skip leading separators - int first = 0; - while (domain.startsWith(NAMESPACE_SEPARATOR,first)) - first += NAMESPACE_SEPARATOR_LENGTH; - // go to next separator - final int end = domain.indexOf(NAMESPACE_SEPARATOR,first); + final int end = domain.indexOf(NAMESPACE_SEPARATOR); if (end == -1) return ""; // no namespace // This is the first element in the namespace path. - final String namespace = domain.substring(first,end); + final String namespace = + domain.substring(0,end+NAMESPACE_SEPARATOR_LENGTH); return namespace; } @@ -130,27 +142,49 @@ public class NamespaceDispatchInterceptor resource.getClass().getName()); } - final boolean isLocalHandlerNameFor(String namespace, - ObjectName handlerName) { - return handlerName.getDomain().equals(namespace+NAMESPACE_SEPARATOR) && - JMXNamespace.TYPE_ASSIGNMENT.equals( - handlerName.getKeyPropertyListString()); + // Removes the trailing //. namespaceWithSlash should be either + // "" or a namespace path ending with //. + // + private final String getKeyFor(String namespaceWithSlash) { + final int end = namespaceWithSlash.length() - + NAMESPACE_SEPARATOR_LENGTH; + if (end <= 0) return ""; + final String key = namespaceWithSlash.substring(0,end); + return key; } @Override final MBeanServer getInterceptorOrNullFor(ObjectName name) { - final String namespace = getFirstNamespace(name); - if (namespace.equals("") || isLocalHandlerNameFor(namespace,name) || - name.getDomain().equals(namespace+NAMESPACE_SEPARATOR)) { + final String namespace = getFirstNamespaceWithSlash(name); + + // Leading separators should trigger instance not found exception. + // returning null here has this effect. + // + if (namespace.equals(NAMESPACE_SEPARATOR)) { + LOG.finer("ObjectName starts with: "+namespace); + return null; + } + + // namespace="" means that there was no namespace path in the + // ObjectName. => delegate to the next interceptor (local MBS) + // name.getDomain()=namespace means that we have an ObjectName of + // the form blah//:x=x. This is either a JMXNamespace or a non + // existent MBean. => delegate to the next interceptor (local MBS) + if (namespace.equals("") || name.getDomain().equals(namespace)) { LOG.finer("dispatching to local name space"); return nextInterceptor; } - final NamespaceInterceptor ns = getInterceptor(namespace); + + // There was a namespace path in the ObjectName. Returns the + // interceptor that handles it, or null if there is no such + // interceptor. + final String key = getKeyFor(namespace); + final NamespaceInterceptor ns = getInterceptor(key); if (LOG.isLoggable(Level.FINER)) { if (ns != null) { - LOG.finer("dispatching to name space: " + namespace); + LOG.finer("dispatching to name space: " + key); } else { - LOG.finer("no handler for: " + namespace); + LOG.finer("no handler for: " + key); } } return ns; @@ -158,18 +192,44 @@ public class NamespaceDispatchInterceptor @Override final QueryInterceptor getInterceptorForQuery(ObjectName pattern) { - final String namespace = getFirstNamespace(pattern); - if (namespace.equals("") || isLocalHandlerNameFor(namespace,pattern) || - pattern.getDomain().equals(namespace+NAMESPACE_SEPARATOR)) { + final String namespace = getFirstNamespaceWithSlash(pattern); + + // Leading separators should trigger instance not found exception. + // returning null here has this effect. + // + if (namespace.equals(NAMESPACE_SEPARATOR)) { + LOG.finer("ObjectName starts with: "+namespace); + return null; + } + + // namespace="" means that there was no namespace path in the + // ObjectName. => delegate to the next interceptor (local MBS) + // name.getDomain()=namespace means that we have an ObjectName of + // the form blah//:x=x. This is either a JMXNamespace or a non + // existent MBean. => delegate to the next interceptor (local MBS) + if (namespace.equals("") || pattern.getDomain().equals(namespace)) { LOG.finer("dispatching to local name space"); return new QueryInterceptor(nextInterceptor); } - final NamespaceInterceptor ns = getInterceptor(namespace); + + // This is a 'hack' to check whether the first namespace is a pattern. + // We wan to throw RTOE wrapping IAE in that case + if (X3.withDomain(namespace).isDomainPattern()) { + throw new RuntimeOperationsException( + new IllegalArgumentException("Pattern not allowed in namespace path")); + } + + // There was a namespace path in the ObjectName. Returns the + // interceptor that handles it, or null if there is no such + // interceptor. + // + final String key = getKeyFor(namespace); + final NamespaceInterceptor ns = getInterceptor(key); if (LOG.isLoggable(Level.FINER)) { if (ns != null) { - LOG.finer("dispatching to name space: " + namespace); + LOG.finer("dispatching to name space: " + key); } else { - LOG.finer("no handler for: " + namespace); + LOG.finer("no handler for: " + key); } } if (ns == null) return null; @@ -177,15 +237,16 @@ public class NamespaceDispatchInterceptor } @Override - final ObjectName getHandlerNameFor(String key) - throws MalformedObjectNameException { - return ObjectName.getInstance(key+NAMESPACE_SEPARATOR, + final ObjectName getHandlerNameFor(String key) { + return ObjectName.valueOf(key+NAMESPACE_SEPARATOR, "type", JMXNamespace.TYPE); } @Override final public String getHandlerKey(ObjectName name) { - return getFirstNamespace(name); + final String namespace = getFirstNamespaceWithSlash(name); + // namespace is either "" or a namespace ending with // + return getKeyFor(namespace); } @Override diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/MXBeanLookup.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/MXBeanLookup.java index 227c1eec990..605c67f16b4 100644 --- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/MXBeanLookup.java +++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/MXBeanLookup.java @@ -37,7 +37,6 @@ import javax.management.InstanceAlreadyExistsException; import javax.management.JMX; import javax.management.MBeanServerConnection; import javax.management.MBeanServerInvocationHandler; -import javax.management.MalformedObjectNameException; import javax.management.ObjectName; import javax.management.openmbean.OpenDataException; @@ -225,7 +224,7 @@ public abstract class MXBeanLookup { String domain = prefix + name.getDomain(); try { name = name.withDomain(domain); - } catch (MalformedObjectNameException e) { + } catch (IllegalArgumentException e) { throw EnvHelp.initCause( new InvalidObjectException(e.getMessage()), e); } @@ -239,12 +238,14 @@ public abstract class MXBeanLookup { String domain = name.getDomain(); if (!domain.startsWith(prefix)) { throw new OpenDataException( - "Proxy's name does not start with " + prefix + ": " + name); + "Proxy's name does not start with " + + prefix + ": " + name); } try { name = name.withDomain(domain.substring(prefix.length())); - } catch (MalformedObjectNameException e) { - throw EnvHelp.initCause(new OpenDataException(e.getMessage()), e); + } catch (IllegalArgumentException e) { + throw EnvHelp.initCause( + new OpenDataException(e.getMessage()), e); } return name; } diff --git a/jdk/src/share/classes/com/sun/jmx/mbeanserver/Util.java b/jdk/src/share/classes/com/sun/jmx/mbeanserver/Util.java index 5fe4d1542cc..1e575e419d2 100644 --- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/Util.java +++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/Util.java @@ -48,7 +48,6 @@ import java.util.logging.Level; import javax.management.MBeanServer; import javax.management.MBeanServerDelegate; import javax.management.MBeanServerFactory; -import javax.management.MalformedObjectNameException; import javax.management.ObjectInstance; import javax.management.ObjectName; import javax.management.loading.ClassLoaderRepository; diff --git a/jdk/src/share/classes/com/sun/jmx/namespace/DomainInterceptor.java b/jdk/src/share/classes/com/sun/jmx/namespace/DomainInterceptor.java index 7b88087a81c..6e56c8385e8 100644 --- a/jdk/src/share/classes/com/sun/jmx/namespace/DomainInterceptor.java +++ b/jdk/src/share/classes/com/sun/jmx/namespace/DomainInterceptor.java @@ -42,7 +42,6 @@ import javax.management.ListenerNotFoundException; import javax.management.MBeanPermission; import javax.management.MBeanServerDelegate; import javax.management.MBeanServerNotification; -import javax.management.MalformedObjectNameException; import javax.management.Notification; import javax.management.NotificationFilter; import javax.management.NotificationListener; @@ -268,13 +267,9 @@ public class DomainInterceptor extends HandlerInterceptor { // When we reach here, it has been verified that 'name' matches our domain // name (done by DomainDispatchInterceptor) private ObjectName getPatternFor(final ObjectName name) { - try { - if (name == null) return ALL; - if (name.getDomain().equals(domainName)) return name; - return name.withDomain(domainName); - } catch (MalformedObjectNameException x) { - throw new IllegalArgumentException(String.valueOf(name),x); - } + if (name == null) return ALL; + if (name.getDomain().equals(domainName)) return name; + return name.withDomain(domainName); } @Override diff --git a/jdk/src/share/classes/com/sun/jmx/namespace/NamespaceInterceptor.java b/jdk/src/share/classes/com/sun/jmx/namespace/NamespaceInterceptor.java index 6862066d2bc..df03ed5ecba 100644 --- a/jdk/src/share/classes/com/sun/jmx/namespace/NamespaceInterceptor.java +++ b/jdk/src/share/classes/com/sun/jmx/namespace/NamespaceInterceptor.java @@ -24,15 +24,12 @@ */ package com.sun.jmx.namespace; -import com.sun.jmx.defaults.JmxProperties; import java.util.ArrayList; import java.util.List; -import java.util.logging.Logger; import javax.management.Attribute; import javax.management.AttributeList; import javax.management.MBeanServer; -import javax.management.MalformedObjectNameException; import javax.management.ObjectName; import javax.management.namespace.JMXNamespace; import javax.management.namespace.JMXNamespacePermission; @@ -114,14 +111,12 @@ public class NamespaceInterceptor extends HandlerInterceptor { } @Override - protected ObjectName toSource(ObjectName targetName) - throws MalformedObjectNameException { + protected ObjectName toSource(ObjectName targetName) { return proc.toSourceContext(targetName, true); } @Override - protected ObjectName toTarget(ObjectName sourceName) - throws MalformedObjectNameException { + protected ObjectName toTarget(ObjectName sourceName) { return proc.toTargetContext(sourceName, false); } diff --git a/jdk/src/share/classes/com/sun/jmx/namespace/ObjectNameRouter.java b/jdk/src/share/classes/com/sun/jmx/namespace/ObjectNameRouter.java index 7d668169fc7..55a6465407c 100644 --- a/jdk/src/share/classes/com/sun/jmx/namespace/ObjectNameRouter.java +++ b/jdk/src/share/classes/com/sun/jmx/namespace/ObjectNameRouter.java @@ -27,7 +27,6 @@ package com.sun.jmx.namespace; import static javax.management.namespace.JMXNamespaces.NAMESPACE_SEPARATOR; -import javax.management.MalformedObjectNameException; import javax.management.ObjectInstance; import javax.management.ObjectName; @@ -83,11 +82,7 @@ public class ObjectNameRouter { } final String targetDomain = (tlen>0?targetPrefix+NAMESPACE_SEPARATOR+srcDomain:srcDomain); - try { - return sourceName.withDomain(targetDomain); - } catch (MalformedObjectNameException x) { - throw new IllegalArgumentException(String.valueOf(sourceName),x); - } + return sourceName.withDomain(targetDomain); } public final ObjectName toSourceContext(ObjectName targetName, @@ -113,11 +108,7 @@ public class ObjectNameRouter { final String sourceDomain = (slen>0?sourcePrefix+NAMESPACE_SEPARATOR+targetDomain: targetDomain); - try { - return targetName.withDomain(sourceDomain); - } catch (MalformedObjectNameException x) { - throw new IllegalArgumentException(String.valueOf(targetName),x); - } + return targetName.withDomain(sourceDomain); } public final ObjectInstance toTargetContext(ObjectInstance sourceMoi, diff --git a/jdk/src/share/classes/com/sun/jmx/namespace/RoutingMBeanServerConnection.java b/jdk/src/share/classes/com/sun/jmx/namespace/RoutingMBeanServerConnection.java index 7022e7e2973..49b8290046b 100644 --- a/jdk/src/share/classes/com/sun/jmx/namespace/RoutingMBeanServerConnection.java +++ b/jdk/src/share/classes/com/sun/jmx/namespace/RoutingMBeanServerConnection.java @@ -46,7 +46,6 @@ import javax.management.MBeanException; import javax.management.MBeanInfo; import javax.management.MBeanRegistrationException; import javax.management.MBeanServerConnection; -import javax.management.MalformedObjectNameException; import javax.management.NotCompliantMBeanException; import javax.management.NotificationFilter; import javax.management.NotificationListener; @@ -100,18 +99,17 @@ public abstract class RoutingMBeanServerConnection public T source() { return source; } @Override - public ObjectName toSource(ObjectName targetName) - throws MalformedObjectNameException { + public ObjectName toSource(ObjectName targetName) { if (targetName == null) return null; if (targetName.getDomain().equals("") && targetNs.equals("")) { try { @@ -229,8 +228,7 @@ public abstract class RoutingProxy } @Override - public ObjectName toTarget(ObjectName sourceName) - throws MalformedObjectNameException { + public ObjectName toTarget(ObjectName sourceName) { if (sourceName == null) return null; return router.toTargetContext(sourceName,false); } diff --git a/jdk/src/share/classes/javax/management/MBeanServer.java b/jdk/src/share/classes/javax/management/MBeanServer.java index 6e4ee0a69c3..d602eadbcc5 100644 --- a/jdk/src/share/classes/javax/management/MBeanServer.java +++ b/jdk/src/share/classes/javax/management/MBeanServer.java @@ -424,10 +424,16 @@ public interface MBeanServer extends MBeanServerConnection { public ObjectInstance getObjectInstance(ObjectName name) throws InstanceNotFoundException; - // doc comment inherited from MBeanServerConnection + /** + * {@inheritDoc} + * @throws RuntimeOperationsException {@inheritDoc} + */ public Set queryMBeans(ObjectName name, QueryExp query); - // doc comment inherited from MBeanServerConnection + /** + * {@inheritDoc} + * @throws RuntimeOperationsException {@inheritDoc} + */ public Set queryNames(ObjectName name, QueryExp query); // doc comment inherited from MBeanServerConnection diff --git a/jdk/src/share/classes/javax/management/MBeanServerConnection.java b/jdk/src/share/classes/javax/management/MBeanServerConnection.java index add96cfcb94..11509df53c3 100644 --- a/jdk/src/share/classes/javax/management/MBeanServerConnection.java +++ b/jdk/src/share/classes/javax/management/MBeanServerConnection.java @@ -436,7 +436,17 @@ public interface MBeanServerConnection extends NotificationManager { * specified, all the MBeans registered will be retrieved. * @param query The query expression to be applied for selecting * MBeans. If null no query expression will be applied for - * selecting MBeans. + * selecting MBeans. ObjectName patterns that may be contained in the + * query expression will be + * evaluated in the context of the + * {@link javax.management.namespace namespace} + * in which the MBeans selected by {@code name} are registered. + * Thus, in the {@code query} parameter, no ObjectName pattern containing a + * namespace path can match any of the MBean names selected by {@code name}. + * See the + * namespaces documentation for more details. * * @return A set containing the ObjectInstance * objects for the selected MBeans. If no MBean satisfies the @@ -444,6 +454,11 @@ public interface MBeanServerConnection extends NotificationManager { * * @exception IOException A communication problem occurred when * talking to the MBean server. + * @exception RuntimeOperationsException Wraps a + * java.lang.IllegalArgumentException: The name + * parameter contains an invalid pattern. See the + * namespaces documentation for more details. */ public Set queryMBeans(ObjectName name, QueryExp query) throws IOException; @@ -464,7 +479,17 @@ public interface MBeanServerConnection extends NotificationManager { * specified, the name of all registered MBeans will be retrieved. * @param query The query expression to be applied for selecting * MBeans. If null no query expression will be applied for - * selecting MBeans. + * selecting MBeans. ObjectName patterns that may be contained in the + * query expression will be + * evaluated in the context of the + * {@link javax.management.namespace namespace} + * in which the MBeans slected by {@code name} are registered. + * Thus, in the {@code query} parameter, no ObjectName pattern containing a + * namespace path can match any of the MBean names selected by {@code name}. + * See the + * namespaces documentation for more details. * * @return A set containing the ObjectNames for the MBeans * selected. If no MBean satisfies the query, an empty list is @@ -472,6 +497,11 @@ public interface MBeanServerConnection extends NotificationManager { * * @exception IOException A communication problem occurred when * talking to the MBean server. + * @exception RuntimeOperationsException Wraps a + * java.lang.IllegalArgumentException: The name + * parameter contains an invalid pattern. See the + * namespaces documentation for more details. */ public Set queryNames(ObjectName name, QueryExp query) throws IOException; diff --git a/jdk/src/share/classes/javax/management/ObjectName.java b/jdk/src/share/classes/javax/management/ObjectName.java index 8185edc2742..41025a7688a 100644 --- a/jdk/src/share/classes/javax/management/ObjectName.java +++ b/jdk/src/share/classes/javax/management/ObjectName.java @@ -56,14 +56,38 @@ import java.util.Map; * properties.

      * *

      The domain is a string of characters not including - * the character colon (:). It is recommended that the domain - * should not contain the string "{@code //}", which is reserved for future use. + * the character colon (:).

      + *

      Starting with the version 2.0 of the JMX specification, the + * domain can also start with a {@linkplain + * javax.management.namespace#NamespacePrefix namespace prefix} identifying + * the {@linkplain javax.management.namespace namespace} in which the + * MBean is registered. A namespace prefix is a path string where + * elements are separated by a double slash (//). + * It identifies the {@linkplain javax.management.namespace namespace} in + * which the MBean so named is registered.

      + * + *

      For instance the ObjectName bar//baz:k=v identifiies an MBean + * named baz:k=v in the namespace bar. Similarly the + * ObjectName foo//bar//baz:k=v identifiies an MBean named + * baz:k=v in the namespace foo//bar. See the {@linkplain + * javax.management.namespace namespace} documentation for more details.

      * *

      If the domain includes at least one occurrence of the wildcard * characters asterisk (*) or question mark * (?), then the object name is a pattern. The asterisk * matches any sequence of zero or more characters, while the question - * mark matches any single character.

      + * mark matches any single character.
      + * A namespace separator // does not match wildcard + * characters unless it is at the very end of the domain string. + * So foo*bar*:* does not match foo//bar:k=v but it + * does match fooxbar//:k=v. + *

      + * + *

      When included in a namespace path the special path element + * ** matches any number of sub namespaces + * recursively, but only if used as a complete namespace path element, + * as in **//b//c//D:k=v or a//**//c//D:k=v + * - see below. * *

      If the domain is empty, it will be replaced in certain contexts * by the default domain of the MBean server in which the @@ -171,6 +195,51 @@ import java.util.Map; * with {@code \}. * * + *

      Pattern and namespaces:

      + *

      In an object name pattern, a path element + * of exactly ** corresponds to a meta + * wildcard that will match any number of sub namespaces.
      Hence:

      + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
      patternmatchesdoesn't match
      • **//D:k=v
      a//D:k=v
      + * a//b//D:k=v
      + * a//b//c//D:k=v
      D:k=v
      • a//**//D:k=v
      a//b//D:k=v
      + * a//b//c//D:k=v
      b//b//c//D:k=v
      + * a//D:k=v
      + * D:k=v
      • a//**//e//D:k=v
      a//b//e//D:k=v
      + * a//b//c//e//D:k=v
      a//b//c//c//D:k=v
      + * b//b//c//e//D:k=v
      + * a//e//D:k=v
      + * e//D:k=v
      • a//b**//e//D:k=v
      a//b//e//D:k=va//b//c//e//D:k=v
      + * because in that case b**
      + * is not a meta-wildcard - and b**
      + * is thus equivalent to b*.
      + * + *

      + *

      + * Note: Although ObjectName patterns where the characters + * * and ? appear in the namespace path are legal, + * they are not valid in the {@code name} parameter of the MBean Server's + * {@link MBeanServer#queryNames queryNames} and {@link MBeanServer#queryMBeans + * queryMBeans} methods. See the + * namespaces documentation for more details. + *

      + * *

      An ObjectName can be written as a String with the following * elements in order:

      * @@ -439,11 +508,6 @@ public class ObjectName implements Comparable, QueryExp { _propertyList = aname._propertyList; _property_list_pattern = aname._property_list_pattern; _property_value_pattern = aname._property_value_pattern; - // TODO remove this hack - // if (toString().endsWith("//javax.management.service:type1=event_client_delegeate_mbean,type2=default")) { - // Thread.currentThread().dumpStack(); - // throw new Error("************************ Gotcha!"); - //} } // Instance private fields <======================================= @@ -1096,11 +1160,10 @@ public class ObjectName implements Comparable, QueryExp { */ private boolean isDomain(String domain) { if (domain == null) return true; - final char[] d=domain.toCharArray(); - final int len = d.length; + final int len = domain.length(); int next = 0; while (next < len) { - final char c = d[next++]; + final char c = domain.charAt(next++); switch (c) { case ':' : case '\n' : @@ -1234,12 +1297,6 @@ public class ObjectName implements Comparable, QueryExp { if (!nw.equals("")) { nameString = nw + NAMESPACE_SEPARATOR + nameString; } - // TODO remove this hack - // if (nameString.endsWith("//javax.management.service:type1=event_client_delegeate_mbean,type2=default")) { - // System.err.println("old="+old+", nw="+nw); - // Thread.currentThread().dumpStack(); - // throw new Error("************************ Gotcha!"); - // } return nameString; } @@ -1584,13 +1641,18 @@ public class ObjectName implements Comparable, QueryExp { * @return A new {@code ObjectName} that is the same as {@code this} * except the domain is {@code newDomain}. * @throws NullPointerException if {@code newDomain} is null. - * @throws MalformedObjectNameException if the new domain is syntactically - * illegal. + * @exception IllegalArgumentException The {@code newDomain} passed as a + * parameter does not have the right format. The {@linkplain + * Throwable#getCause() cause} of this exception will be a + * {@link MalformedObjectNameException}. * @since 1.7 **/ - public final ObjectName withDomain(String newDomain) - throws MalformedObjectNameException { - return new ObjectName(newDomain, this); + public final ObjectName withDomain(String newDomain) { + try { + return new ObjectName(newDomain, this); + } catch (MalformedObjectNameException x) { + throw new IllegalArgumentException(x.getMessage(),x); + } } /** diff --git a/jdk/src/share/classes/javax/management/namespace/JMXDomain.java b/jdk/src/share/classes/javax/management/namespace/JMXDomain.java index bff3c137062..ca108bf126b 100644 --- a/jdk/src/share/classes/javax/management/namespace/JMXDomain.java +++ b/jdk/src/share/classes/javax/management/namespace/JMXDomain.java @@ -35,7 +35,6 @@ import static javax.management.namespace.JMXNamespaces.NAMESPACE_SEPARATOR; import javax.management.InstanceNotFoundException; import javax.management.MBeanServer; import javax.management.MBeanServerDelegate; -import javax.management.MalformedObjectNameException; import javax.management.ObjectName; /** @@ -291,12 +290,9 @@ public class JMXDomain extends JMXNamespace { public static ObjectName getDomainObjectName(String domain) { if (domain == null) return null; if (domain.contains(NAMESPACE_SEPARATOR)) - throw new IllegalArgumentException(domain); - try { - return ObjectName.getInstance(domain, "type", TYPE); - } catch (MalformedObjectNameException x) { - throw new IllegalArgumentException(domain,x); - } + throw new IllegalArgumentException("domain contains " + + NAMESPACE_SEPARATOR+": "+domain); + return ObjectName.valueOf(domain, "type", TYPE); } diff --git a/jdk/src/share/classes/javax/management/namespace/JMXNamespacePermission.java b/jdk/src/share/classes/javax/management/namespace/JMXNamespacePermission.java index 5dd012672b3..62608cb0610 100644 --- a/jdk/src/share/classes/javax/management/namespace/JMXNamespacePermission.java +++ b/jdk/src/share/classes/javax/management/namespace/JMXNamespacePermission.java @@ -136,7 +136,8 @@ import java.security.Permission; * ** matches any number of sub namespaces * recursively, but only if used as a complete namespace path element, * as in **//b//c//D:k=v or a//**//c//D:k=v - * - see below. + * - see ObjectName documentation + * for more details. *

      * * @@ -270,38 +271,9 @@ import java.security.Permission; * *

      Note on wildcards: In an object name pattern, a path element * of exactly ** corresponds to a meta - * wildcard that will match any number of sub namespaces. Hence:

      - *
        - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
        patternmatchesdoesn't match
        **//D:k=va//D:k=v
        - * a//b//D:k=v
        - * a//b//c//D:k=v
        D:k=v
        a//**//D:k=va//b//D:k=v
        - * a//b//c//D:k=v
        b//b//c//D:k=v
        - * a//D:k=v
        - * D:k=v
        a//**//e//D:k=va//b//e//D:k=v
        - * a//b//c//e//D:k=v
        a//b//c//c//D:k=v
        - * b//b//c//e//D:k=v
        - * a//e//D:k=v
        - * e//D:k=v
        a//b**//e//D:k=va//b//e//D:k=va//b//c//e//D:k=v
        - * because in that case b**
        - * is not a meta-wildcard - and b**
        - * is thus equivalent to b*.
        - *
      + * wildcard that will match any number of sub namespaces. + * See ObjectName documentation + * for more details.

      * *

      If {@code ::} is omitted, then one of * member or object name may be omitted. diff --git a/jdk/src/share/classes/javax/management/namespace/JMXNamespaces.java b/jdk/src/share/classes/javax/management/namespace/JMXNamespaces.java index f19dfa570e4..ca7244abd28 100644 --- a/jdk/src/share/classes/javax/management/namespace/JMXNamespaces.java +++ b/jdk/src/share/classes/javax/management/namespace/JMXNamespaces.java @@ -292,17 +292,13 @@ public class JMXNamespaces { if (path == null || to == null) throw new IllegalArgumentException("Null argument"); checkTrailingSlashes(path); - try { - String prefix = path; - if (!prefix.equals("")) prefix = - ObjectNameRouter.normalizeNamespacePath( + String prefix = path; + if (!prefix.equals("")) + prefix = ObjectNameRouter.normalizeNamespacePath( prefix + NAMESPACE_SEPARATOR,false,false,false); - return to.withDomain( + return to.withDomain( ObjectNameRouter.normalizeDomain( prefix+to.getDomain(),false)); - } catch (MalformedObjectNameException x) { - throw new IllegalArgumentException(path+": "+x,x); - } } /** diff --git a/jdk/src/share/classes/javax/management/namespace/package-info.java b/jdk/src/share/classes/javax/management/namespace/package-info.java index df8354bab63..5c014286d4d 100644 --- a/jdk/src/share/classes/javax/management/namespace/package-info.java +++ b/jdk/src/share/classes/javax/management/namespace/package-info.java @@ -204,7 +204,38 @@ * * An easier way to access MBeans contained in a name space is to * cd inside the name space, as shown in the following paragraph. - *

      + *

      + * Although ObjectName patterns where the characters + * * and ? appear in the namespace path are + * legal, they are not valid in the {@code name} parameter of the + * MBean Server {@link + * javax.management.MBeanServer#queryNames queryNames} and {@link + * javax.management.MBeanServer#queryMBeans queryMBeans} methods.
      + * When invoking queryNames or queryMBeans, + * only ObjectNames of the form:
      + * [namespace-without-pattern//]*[pattern-without-namespace]:key-properties-with-or-without-pattern + * are valid.
      + * In other words: in the case of {@link + * javax.management.MBeanServer#queryNames queryNames} and {@link + * javax.management.MBeanServer#queryMBeans queryMBeans}, if a + * namespace path is present, it must not contain any pattern. + *

      + * There is no such restriction for the {@code query} parameter of these + * methods. However, it must be noted that the {@code query} parameter + * will be evaluated in the context of the namespace where the MBeans + * selected by the pattern specified in {@code name} are located. + * This means that if {@code query} parameter is an ObjectName pattern that + * contains a namespace path, no MBean name will match and the result of + * the query will be empty.
      + * In other words:

      + *
      • {@code queryNames("foo//bar//?a?:*","b?z:type=Monitor,*")} will select + * all MBeans in namespace foo//bar whose names match both + * ?a?:* and b?z:type=Monitor,*, but
      • + *
      • {@code queryNames("foo//bar//?a?:*","foo//bar//b?z:type=Monitor,*")} + * will select nothing because no name matching ?a?:* will + * also match foo//bar//b?z:type=Monitor,*. + *
      • + *
      * *

      Narrowing Down Into a Name Spaces

      *

      @@ -228,7 +259,8 @@ * to name space {@code "foo"} behaves just like a regular MBean server. * However, it may sometimes throw an {@link * java.lang.UnsupportedOperationException UnsupportedOperationException} - * wrapped in a JMX exception if you try to call an operation which is not + * wrapped in a {@link javax.management.RuntimeOperationsException + * RuntimeOperationsException} if you try to call an operation which is not * supported by the underlying name space handler. *
      For instance, {@link javax.management.MBeanServer#registerMBean * registerMBean} is not supported for name spaces mounted from remote diff --git a/jdk/test/javax/management/namespace/LeadingSeparatorsTest.java b/jdk/test/javax/management/namespace/LeadingSeparatorsTest.java index 5660b275317..6f931ffd46d 100644 --- a/jdk/test/javax/management/namespace/LeadingSeparatorsTest.java +++ b/jdk/test/javax/management/namespace/LeadingSeparatorsTest.java @@ -24,7 +24,7 @@ * @test LeadingSeparatorsTest.java * @summary Test that the semantics of a leading // in ObjectName is respected. * @author Daniel Fuchs - * @bug 5072476 + * @bug 5072476 6768935 * @run clean LeadingSeparatorsTest Wombat WombatMBean * @compile -XDignore.symbol.file=true LeadingSeparatorsTest.java * @run build LeadingSeparatorsTest Wombat WombatMBean @@ -36,6 +36,7 @@ import java.util.Arrays; import java.util.Set; import java.util.HashSet; import java.util.logging.Logger; +import javax.management.InstanceNotFoundException; import javax.management.MBeanServer; import javax.management.MBeanServerFactory; import javax.management.NotCompliantMBeanException; @@ -121,19 +122,29 @@ public class LeadingSeparatorsTest { // register wombat using an object name with a leading // final Object obj = new MyWombat(); // check that returned object name doesn't have the leading // - assertEquals(n2,top.registerMBean(obj, n1).getObjectName()); + assertEquals(n2,top.registerMBean(obj, n2).getObjectName()); System.out.println(n1+" registered"); // check that the registered Wombat can be accessed with all its // names. System.out.println(n2+" mood is: "+top.getAttribute(n2, "Mood")); - System.out.println(n1+" mood is: "+top.getAttribute(n1, "Mood")); + try { + System.out.println(n1+" mood is: "+top.getAttribute(n1, "Mood")); + throw new Exception("Excepected exception not thrown for "+n1); + } catch (InstanceNotFoundException x) { + System.out.println("OK: "+x); + } System.out.println(n4+" mood is: "+top.getAttribute(n4, "Mood")); - System.out.println(n3+" mood is: "+top.getAttribute(n3, "Mood")); + try { + System.out.println(n3+" mood is: "+top.getAttribute(n3, "Mood")); + throw new Exception("Excepected exception not thrown for "+n3); + } catch (InstanceNotFoundException x) { + System.out.println("OK: "+x); + } // call listMatching. The result should not contain any prefix. final Set res = (Set) - top.invoke(n3, "listMatching", + top.invoke(n4, "listMatching", // remove rmi// from rmi//*:* JMXNamespaces.deepReplaceHeadNamespace( new Object[] {ObjectName.WILDCARD.withDomain("rmi//*")}, @@ -158,7 +169,7 @@ public class LeadingSeparatorsTest { // //niark//niark// // final Set res4 = (Set) - top.invoke(n3, "untrue", + top.invoke(n4, "untrue", // remove niark//niark : should remove nothing since // our ObjectName begins with a leading // JMXNamespaces.deepReplaceHeadNamespace( diff --git a/jdk/test/javax/management/namespace/NullDomainObjectNameTest.java b/jdk/test/javax/management/namespace/NullDomainObjectNameTest.java index 6b1ad51c252..fa8455e2a15 100644 --- a/jdk/test/javax/management/namespace/NullDomainObjectNameTest.java +++ b/jdk/test/javax/management/namespace/NullDomainObjectNameTest.java @@ -40,6 +40,7 @@ import javax.management.MBeanServerFactory; import javax.management.NotCompliantMBeanException; import javax.management.ObjectInstance; import javax.management.ObjectName; +import javax.management.RuntimeOperationsException; import javax.management.namespace.JMXNamespaces; import javax.management.namespace.JMXRemoteNamespace; import javax.management.namespace.JMXNamespace; @@ -215,9 +216,20 @@ public class NullDomainObjectNameTest { assertEquals(proxy.queryNames( new ObjectName(":*"),null). contains(moi3.getObjectName()),true); - failed("queryNames(null,null) should have failed for faked//"); - } catch (IllegalArgumentException x) { - System.out.println("Received expected exception for faked//: "+x); + failed("queryNames(new ObjectName(\":*\"),null) " + + "should have failed for faked//"); + } catch (RuntimeOperationsException x) { + if (x.getCause() instanceof IllegalArgumentException) + System.out.println( + "Received expected exception for faked//: "+x); + else { + System.err.println( + "Expected exception has unexpected cause " + + "for faked//: "+x.getCause()); + x.printStackTrace(); + failed("queryNames(new ObjectName(\":*\"),null)" + + " failed with unexpected cause for faked//"); + } } // These should fail because the ObjectName doesn't start // with "faked//" @@ -226,9 +238,20 @@ public class NullDomainObjectNameTest { "new ObjectName(\":*\"),null) with faked//"); assertEquals(proxy.queryMBeans( new ObjectName(":*"),null).contains(moi3),true); - failed("queryMBeans(null,null) should have failed for faked//"); - } catch (IllegalArgumentException x) { - System.out.println("Received expected exception for faked//: "+x); + failed("queryMBeans(new ObjectName(\":*\"),null)" + + " should have failed for faked//"); + } catch (RuntimeOperationsException x) { + if (x.getCause() instanceof IllegalArgumentException) + System.out.println( + "Received expected exception for faked//: "+x); + else { + System.err.println( + "Expected exception has unexpected cause " + + "for faked//: "+x.getCause()); + x.printStackTrace(); + failed("queryMBeans(new ObjectName(\":*\"),null) " + + "failed with unexpected cause for faked//"); + } } System.out.println("Checking queryNames(faked//*:*,null)"); diff --git a/jdk/test/javax/management/namespace/NullObjectNameTest.java b/jdk/test/javax/management/namespace/NullObjectNameTest.java index 0e645dc1e3c..5cf99a230e5 100644 --- a/jdk/test/javax/management/namespace/NullObjectNameTest.java +++ b/jdk/test/javax/management/namespace/NullObjectNameTest.java @@ -41,6 +41,7 @@ import javax.management.MBeanServerFactory; import javax.management.NotCompliantMBeanException; import javax.management.ObjectInstance; import javax.management.ObjectName; +import javax.management.RuntimeOperationsException; import javax.management.namespace.JMXNamespaces; import javax.management.namespace.JMXRemoteNamespace; import javax.management.namespace.JMXNamespace; @@ -189,15 +190,35 @@ public class NullObjectNameTest { assertEquals(proxy.queryNames(null,null). contains(moi3.getObjectName()),true); failed("queryNames(null,null) should have failed for faked//"); - } catch (IllegalArgumentException x) { - System.out.println("Received expected exception for faked//: "+x); + } catch (RuntimeOperationsException x) { + if (x.getCause() instanceof IllegalArgumentException) + System.out.println( + "Received expected exception for faked//: "+x); + else { + System.err.println( + "Expected exception has unexpected cause " + + "for faked//: "+x.getCause()); + x.printStackTrace(); + failed("queryNames(null,null) failed with unexpected " + + "cause for faked//"); + } } try { System.out.println("Checking queryMBeans(null,null) with faked//"); assertEquals(proxy.queryMBeans(null,null).contains(moi3),true); failed("queryMBeans(null,null) should have failed for faked//"); - } catch (IllegalArgumentException x) { - System.out.println("Received expected exception for faked//: "+x); + } catch (RuntimeOperationsException x) { + if (x.getCause() instanceof IllegalArgumentException) + System.out.println( + "Received expected exception for faked//: "+x); + else { + System.err.println( + "Expected exception has unexpected cause " + + "for faked//: "+x.getCause()); + x.printStackTrace(); + failed("queryMBeans(null,null) failed with unexpected " + + "cause for faked//"); + } } System.out.println("Checking queryNames(faked//*:*,null)"); assertEquals(proxy.queryNames(new ObjectName("faked//*:*"),null). diff --git a/jdk/test/javax/management/namespace/QueryNamesTest.java b/jdk/test/javax/management/namespace/QueryNamesTest.java index 1af597aceb9..5b507644600 100644 --- a/jdk/test/javax/management/namespace/QueryNamesTest.java +++ b/jdk/test/javax/management/namespace/QueryNamesTest.java @@ -25,7 +25,7 @@ * @test QueryNamesTest.java 1.4 * @summary Test how queryNames works with Namespaces. * @author Daniel Fuchs - * @bug 5072476 + * @bug 5072476 6768935 * @run clean QueryNamesTest Wombat WombatMBean * @run build QueryNamesTest Wombat WombatMBean * @run main QueryNamesTest @@ -34,6 +34,7 @@ import java.io.IOException; import java.lang.management.ManagementFactory; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; @@ -52,7 +53,9 @@ import javax.management.MBeanServer; import javax.management.MBeanServerConnection; import javax.management.MBeanServerFactory; import javax.management.MalformedObjectNameException; +import javax.management.ObjectInstance; import javax.management.ObjectName; +import javax.management.RuntimeOperationsException; import javax.management.namespace.JMXNamespace; import javax.management.namespace.JMXNamespaces; @@ -366,6 +369,66 @@ public class QueryNamesTest { return res; } + private static void checkNsPattern(MBeanServer server) throws Exception { + final List list = new ArrayList(); + for (String s : namespaces) { + final String[] cmpnt = s.split("//"); + for (int i=0;i res = new HashSet(); + + try { + res.addAll(server.queryNames(ObjectName.valueOf(s),null)); + } catch (RuntimeOperationsException x) { + if (x.getCause() instanceof IllegalArgumentException) { + System.out.println("queryNames("+s+"): OK - received "+x.getCause()); + continue; + } + System.err.println("queryNames("+s+"): Bad cause: "+x.getCause()); + throw x; + } catch (Exception x) { + System.err.println("queryNames("+s+"): Bad exception: "+x); + throw x; + } + System.err.println("queryNames("+s+"): Bad result: "+res); + System.err.println("queryNames("+s+"): Excpected exception not thrown."); + throw new Exception("queryNames("+s+"): Excpected exception not thrown."); + } + for (String s : list) { + final Set res = new HashSet(); + + try { + res.addAll(server.queryMBeans(ObjectName.valueOf(s),null)); + } catch (RuntimeOperationsException x) { + if (x.getCause() instanceof IllegalArgumentException) { + System.out.println("queryMBeans("+s+"): OK - received "+x.getCause()); + continue; + } + System.err.println("queryMBeans("+s+"): Bad cause: "+x.getCause()); + throw x; + } catch (Exception x) { + System.err.println("queryMBeans("+s+"): Bad exception: "+x); + throw x; + } + System.err.println("queryMBeans("+s+"): Bad result: "+res); + System.err.println("queryMBeans("+s+"): Excpected exception not thrown."); + throw new Exception("queryMBeans("+s+"): Excpected exception not thrown."); + } + } + public static void main(String[] args) throws Exception { final MBeanServer server = ManagementFactory.getPlatformMBeanServer(); @@ -378,6 +441,7 @@ public class QueryNamesTest { System.out.println("Domains: " +Arrays.asList(server.getDomains())); checkRegistration(server); checkNsQuery(server); + checkNsPattern(server); } finally { boolean res = true; res = res && removeWombats(server, wombats); From 16870a77673599f36fb9d40d10d0cf4a48ed0089 Mon Sep 17 00:00:00 2001 From: Shanliang Jiang Date: Tue, 9 Dec 2008 20:50:45 +0100 Subject: [PATCH 199/267] 6336980: NotificationBroadcasterSupport: to tell whether there are listeners and to do clear Reviewed-by: emcmanus --- .../NotificationBroadcasterSupport.java | 20 +++++ .../notification/SupportClearTest.java | 80 +++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 jdk/test/javax/management/notification/SupportClearTest.java diff --git a/jdk/src/share/classes/javax/management/NotificationBroadcasterSupport.java b/jdk/src/share/classes/javax/management/NotificationBroadcasterSupport.java index 33df9606450..44f5a506477 100644 --- a/jdk/src/share/classes/javax/management/NotificationBroadcasterSupport.java +++ b/jdk/src/share/classes/javax/management/NotificationBroadcasterSupport.java @@ -249,6 +249,26 @@ public class NotificationBroadcasterSupport } } } + /** + * Returns true if there are any listeners. + * + * @return true if there is at least one listener that has been added with + * {@code addNotificationListener} and not subsequently removed with + * {@code removeNotificationListener} or {@code removeAllNotificationListeners}. + * @since 1.7 + */ + public boolean isListenedTo() { + return listenerList.size() > 0; + } + + /** + * Removes all listeners. + * + * @since 1.7 + */ + public void removeAllNotificationListeners() { + listenerList.clear(); + } /** *

      This method is called by {@link #sendNotification diff --git a/jdk/test/javax/management/notification/SupportClearTest.java b/jdk/test/javax/management/notification/SupportClearTest.java new file mode 100644 index 00000000000..56712cf482b --- /dev/null +++ b/jdk/test/javax/management/notification/SupportClearTest.java @@ -0,0 +1,80 @@ +/* + * Copyright 2005 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 6336980 + * @summary test 2 new methods: isListenedTo() and clear() + * @author Shanliang JIANG + * @run clean SupportClearTest + * @run build SupportClearTest + * @run main SupportClearTest + */ + +import javax.management.*; + +public class SupportClearTest { + private static boolean received = false; + + public static void main(String[] args) throws Exception { + System.out.println(">>> test 2 new methods: isListenedTo() and clear()."); + + final NotificationListener listener = new NotificationListener() { + public void handleNotification(Notification n, Object hb) { + received = true; + } + }; + + final NotificationBroadcasterSupport broadcaster = + new NotificationBroadcasterSupport(); + + System.out.println(">>> testing the method \"isListenedTo\"..."); + if (broadcaster.isListenedTo()) { + throw new RuntimeException( + "Bad implementation of the method \"isListenedTo\"!"); + } + + broadcaster.addNotificationListener(listener, null, null); + + if (!broadcaster.isListenedTo()) { + throw new RuntimeException( + "Bad implementation of the method \"isListenedTo\"!"); + } + + System.out.println(">>> testing the method \"clear\"..."); + broadcaster.removeAllNotificationListeners(); + if (broadcaster.isListenedTo()) { + throw new RuntimeException( + "Bad implementation of the method \"clear\"!"); + } + + broadcaster.sendNotification(new Notification("", "", 1L)); + + if (received) { + throw new RuntimeException( + "Bad implementation of the method \"clear\"!"); + } + + System.out.println(">>> PASSED!"); + } +} From 67464baa7a21b0c91570316f181b1350906c27d5 Mon Sep 17 00:00:00 2001 From: John R Rose Date: Tue, 9 Dec 2008 12:41:26 -0800 Subject: [PATCH 200/267] 6771309: debugging AD files is difficult without #line directives in generated code More and better #line and #define directives in the generated code; ADLC itself accepts #line directives Reviewed-by: never, kvn --- hotspot/make/linux/adlc_updater | 12 +- hotspot/make/linux/makefiles/adlc.make | 31 +++- hotspot/make/solaris/adlc_updater | 12 +- hotspot/make/solaris/makefiles/adlc.make | 31 +++- hotspot/src/share/vm/adlc/adlparse.cpp | 189 +++++++++++++++++++---- hotspot/src/share/vm/adlc/adlparse.hpp | 9 +- hotspot/src/share/vm/adlc/archDesc.cpp | 2 +- hotspot/src/share/vm/adlc/dfa.cpp | 17 +- hotspot/src/share/vm/adlc/filebuff.hpp | 1 + hotspot/src/share/vm/adlc/formssel.cpp | 5 +- 10 files changed, 255 insertions(+), 54 deletions(-) diff --git a/hotspot/make/linux/adlc_updater b/hotspot/make/linux/adlc_updater index 6a97b79931d..b54f783d6ee 100644 --- a/hotspot/make/linux/adlc_updater +++ b/hotspot/make/linux/adlc_updater @@ -7,5 +7,13 @@ # # adlc-updater # -[ -f $3/$1 ] && cmp -s $2/$1 $3/$1 || \ -( [ -f $3/$1 ]; echo Updating $3/$1 ; touch $2/made-change ; mv $2/$1 $3/$1 ) +fix_lines() { + # repair bare #line directives in $1 to refer to $2 + awk < $1 > $1+ ' + /^#line 999999$/ {print "#line " (NR+1) " \"" F2 "\""; next} + {print} + ' F2=$2 + mv $1+ $1 +} +[ -f $3/$1 ] && (fix_lines $2/$1 $3/$1; cmp -s $2/$1 $3/$1) || \ +( [ -f $3/$1 ] && echo Updating $3/$1 ; touch $2/made-change ; mv $2/$1 $3/$1 ) diff --git a/hotspot/make/linux/makefiles/adlc.make b/hotspot/make/linux/makefiles/adlc.make index 5349f5bd323..5e48fed1567 100644 --- a/hotspot/make/linux/makefiles/adlc.make +++ b/hotspot/make/linux/makefiles/adlc.make @@ -54,10 +54,12 @@ VPATH += $(Src_Dirs_V:%=%:) Src_Dirs_I = ${Src_Dirs} $(GENERATED) INCLUDES += $(Src_Dirs_I:%=-I%) -# Force assertions on. -SYSDEFS += -DASSERT +# set flags for adlc compilation CPPFLAGS = $(SYSDEFS) $(INCLUDES) +# Force assertions on. +CPPFLAGS += -DASSERT + # CFLAGS_WARN holds compiler options to suppress/enable warnings. # Suppress warnings (for now) CFLAGS_WARN = -w @@ -125,7 +127,15 @@ $(GENERATEDFILES): refresh_adfiles # Note that product files are updated via "mv", which is atomic. TEMPDIR := $(OUTDIR)/mktmp$(shell echo $$$$) -ADLCFLAGS = -q -T +# Pass -D flags into ADLC. +ADLCFLAGS += $(SYSDEFS) + +# Note "+="; it is a hook so flags.make can add more flags, like -g or -DFOO. +ADLCFLAGS += -q -T + +# Normally, debugging is done directly on the ad_*.cpp files. +# But -g will put #line directives in those files pointing back to .ad. +#ADLCFLAGS += -g ifdef LP64 ADLCFLAGS += -D_LP64 @@ -140,6 +150,8 @@ endif # ADLC_UPDATER_DIRECTORY = $(GAMMADIR)/make/$(OS) ADLC_UPDATER = adlc_updater +$(ADLC_UPDATER): $(ADLC_UPDATER_DIRECTORY)/$(ADLC_UPDATER) + $(QUIETLY) cp $< $@; chmod +x $@ # This action refreshes all generated adlc files simultaneously. # The way it works is this: @@ -149,9 +161,8 @@ ADLC_UPDATER = adlc_updater # 4) call $(ADLC_UPDATER) on each generated adlc file. It will selectively update changed or missing files. # 5) If we actually updated any files, echo a notice. # -refresh_adfiles: $(EXEC) $(SOURCE.AD) +refresh_adfiles: $(EXEC) $(SOURCE.AD) $(ADLC_UPDATER) @rm -rf $(TEMPDIR); mkdir $(TEMPDIR) - $(QUIETLY) [ -f $(ADLC_UPDATER) ] || ( cp $(ADLC_UPDATER_DIRECTORY)/$(ADLC_UPDATER) . ; chmod +x $(ADLC_UPDATER) ) $(QUIETLY) $(EXEC) $(ADLCFLAGS) $(SOURCE.AD) \ -c$(TEMPDIR)/ad_$(Platform_arch_model).cpp -h$(TEMPDIR)/ad_$(Platform_arch_model).hpp -a$(TEMPDIR)/dfa_$(Platform_arch_model).cpp -v$(TEMPDIR)/adGlobals_$(Platform_arch_model).hpp \ || { rm -rf $(TEMPDIR); exit 1; } @@ -174,7 +185,15 @@ refresh_adfiles: $(EXEC) $(SOURCE.AD) # ######################################################################### $(SOURCE.AD): $(SOURCES.AD) - $(QUIETLY) cat $(SOURCES.AD) > $(SOURCE.AD) + $(QUIETLY) $(PROCESS_AD_FILES) $(SOURCES.AD) > $(SOURCE.AD) + +#PROCESS_AD_FILES = cat +# Pass through #line directives, in case user enables -g option above: +PROCESS_AD_FILES = awk '{ \ + if (CUR_FN != FILENAME) { CUR_FN=FILENAME; NR_BASE=NR-1; need_lineno=1 } \ + if (need_lineno && $$0 !~ /\/\//) \ + { print "\n\n\#line " (NR-NR_BASE) " \"" FILENAME "\""; need_lineno=0 }; \ + print }' $(OUTDIR)/%.o: %.cpp @echo Compiling $< diff --git a/hotspot/make/solaris/adlc_updater b/hotspot/make/solaris/adlc_updater index 6a97b79931d..b54f783d6ee 100644 --- a/hotspot/make/solaris/adlc_updater +++ b/hotspot/make/solaris/adlc_updater @@ -7,5 +7,13 @@ # # adlc-updater # -[ -f $3/$1 ] && cmp -s $2/$1 $3/$1 || \ -( [ -f $3/$1 ]; echo Updating $3/$1 ; touch $2/made-change ; mv $2/$1 $3/$1 ) +fix_lines() { + # repair bare #line directives in $1 to refer to $2 + awk < $1 > $1+ ' + /^#line 999999$/ {print "#line " (NR+1) " \"" F2 "\""; next} + {print} + ' F2=$2 + mv $1+ $1 +} +[ -f $3/$1 ] && (fix_lines $2/$1 $3/$1; cmp -s $2/$1 $3/$1) || \ +( [ -f $3/$1 ] && echo Updating $3/$1 ; touch $2/made-change ; mv $2/$1 $3/$1 ) diff --git a/hotspot/make/solaris/makefiles/adlc.make b/hotspot/make/solaris/makefiles/adlc.make index f746d77494d..2d1a87a20b4 100644 --- a/hotspot/make/solaris/makefiles/adlc.make +++ b/hotspot/make/solaris/makefiles/adlc.make @@ -54,10 +54,12 @@ VPATH += $(Src_Dirs_V:%=%:) Src_Dirs_I = ${Src_Dirs} $(GENERATED) INCLUDES += $(Src_Dirs_I:%=-I%) -# Force assertions on. -SYSDEFS += -DASSERT +# set flags for adlc compilation CPPFLAGS = $(SYSDEFS) $(INCLUDES) +# Force assertions on. +CPPFLAGS += -DASSERT + ifndef USE_GCC # We need libCstd.so for adlc CFLAGS += -library=Cstd -g @@ -141,7 +143,15 @@ $(GENERATEDFILES): refresh_adfiles # Note that product files are updated via "mv", which is atomic. TEMPDIR := $(OUTDIR)/mktmp$(shell echo $$$$) -ADLCFLAGS = -q -T +# Pass -D flags into ADLC. +ADLCFLAGS += $(SYSDEFS) + +# Note "+="; it is a hook so flags.make can add more flags, like -g or -DFOO. +ADLCFLAGS += -q -T + +# Normally, debugging is done directly on the ad_*.cpp files. +# But -g will put #line directives in those files pointing back to .ad. +#ADLCFLAGS += -g ifdef LP64 ADLCFLAGS += -D_LP64 @@ -156,6 +166,8 @@ endif # ADLC_UPDATER_DIRECTORY = $(GAMMADIR)/make/$(OS) ADLC_UPDATER = adlc_updater +$(ADLC_UPDATER): $(ADLC_UPDATER_DIRECTORY)/$(ADLC_UPDATER) + $(QUIETLY) cp $< $@; chmod +x $@ # This action refreshes all generated adlc files simultaneously. # The way it works is this: @@ -165,9 +177,8 @@ ADLC_UPDATER = adlc_updater # 4) call $(ADLC_UPDATER) on each generated adlc file. It will selectively update changed or missing files. # 5) If we actually updated any files, echo a notice. # -refresh_adfiles: $(EXEC) $(SOURCE.AD) +refresh_adfiles: $(EXEC) $(SOURCE.AD) $(ADLC_UPDATER) @rm -rf $(TEMPDIR); mkdir $(TEMPDIR) - $(QUIETLY) [ -f $(ADLC_UPDATER) ] || ( cp $(ADLC_UPDATER_DIRECTORY)/$(ADLC_UPDATER) . ; chmod +x $(ADLC_UPDATER) ) $(QUIETLY) $(EXEC) $(ADLCFLAGS) $(SOURCE.AD) \ -c$(TEMPDIR)/ad_$(Platform_arch_model).cpp -h$(TEMPDIR)/ad_$(Platform_arch_model).hpp -a$(TEMPDIR)/dfa_$(Platform_arch_model).cpp -v$(TEMPDIR)/adGlobals_$(Platform_arch_model).hpp \ || { rm -rf $(TEMPDIR); exit 1; } @@ -190,7 +201,15 @@ refresh_adfiles: $(EXEC) $(SOURCE.AD) # ######################################################################### $(SOURCE.AD): $(SOURCES.AD) - $(QUIETLY) cat $(SOURCES.AD) > $(SOURCE.AD) + $(QUIETLY) $(PROCESS_AD_FILES) $(SOURCES.AD) > $(SOURCE.AD) + +#PROCESS_AD_FILES = cat +# Pass through #line directives, in case user enables -g option above: +PROCESS_AD_FILES = awk '{ \ + if (CUR_FN != FILENAME) { CUR_FN=FILENAME; NR_BASE=NR-1; need_lineno=1 } \ + if (need_lineno && $$0 !~ /\/\//) \ + { print "\n\n\#line " (NR-NR_BASE) " \"" FILENAME "\""; need_lineno=0 }; \ + print }' $(OUTDIR)/%.o: %.cpp @echo Compiling $< diff --git a/hotspot/src/share/vm/adlc/adlparse.cpp b/hotspot/src/share/vm/adlc/adlparse.cpp index c266df104c8..cc02b5d3177 100644 --- a/hotspot/src/share/vm/adlc/adlparse.cpp +++ b/hotspot/src/share/vm/adlc/adlparse.cpp @@ -108,6 +108,7 @@ void ADLParser::parse() { else if (!strcmp(ident, "pipeline")) pipe_parse(); else if (!strcmp(ident, "definitions")) definitions_parse(); else if (!strcmp(ident, "peephole")) peep_parse(); + else if (!strcmp(ident, "#line")) preproc_line(); else if (!strcmp(ident, "#define")) preproc_define(); else if (!strcmp(ident, "#undef")) preproc_undef(); else { @@ -786,9 +787,11 @@ void ADLParser::reg_parse(void) { parse_err(SYNERR, "missing identifier inside register block.\n"); return; } - if (strcmp(token,"reg_def")==0) { reg_def_parse(); } - if (strcmp(token,"reg_class")==0) { reg_class_parse(); } - if (strcmp(token,"alloc_class")==0) { alloc_class_parse(); } + if (strcmp(token,"reg_def")==0) { reg_def_parse(); } + else if (strcmp(token,"reg_class")==0) { reg_class_parse(); } + else if (strcmp(token,"alloc_class")==0) { alloc_class_parse(); } + else if (strcmp(token,"#define")==0) { preproc_define(); } + else { parse_err(SYNERR, "bad token %s inside register block.\n", token); break; } skipws(); } } @@ -903,11 +906,7 @@ void ADLParser::enc_class_parse_block(EncClass* encoding, char* ec_name) { skipws_no_preproc(); // Skip leading whitespace // Prepend location descriptor, for debugging; cf. ADLParser::find_cpp_block if (_AD._adlocation_debug) { - const char* file = _AD._ADL_file._name; - int line = linenum(); - char* location = (char *)malloc(strlen(file) + 100); - sprintf(location, "#line %d \"%s\"\n", line, file); - encoding->add_code(location); + encoding->add_code(get_line_string()); } // Collect the parts of the encode description @@ -948,6 +947,10 @@ void ADLParser::enc_class_parse_block(EncClass* encoding, char* ec_name) { skipws(); + if (_AD._adlocation_debug) { + encoding->add_code(end_line_marker()); + } + // Debug Stuff if (_AD._adl_debug > 1) fprintf(stderr,"EncodingClass Form: %s\n", ec_name); } @@ -2349,7 +2352,11 @@ void ADLParser::reg_class_parse(void) { return; } RegDef *regDef = _AD._register->getRegDef(rname); - reg_class->addReg(regDef); // add regDef to regClass + if (!regDef) { + parse_err(SEMERR, "unknown identifier %s inside reg_class list.\n", rname); + } else { + reg_class->addReg(regDef); // add regDef to regClass + } // Check for ',' and position to next token. skipws(); @@ -2746,7 +2753,8 @@ Predicate *ADLParser::pred_parse(void) { char *rule = NULL; // String representation of predicate skipws(); // Skip leading whitespace - if ( (rule = get_paren_expr("pred expression")) == NULL ) { + int line = linenum(); + if ( (rule = get_paren_expr("pred expression", true)) == NULL ) { parse_err(SYNERR, "incorrect or missing expression for 'predicate'\n"); return NULL; } @@ -3407,7 +3415,12 @@ FormatRule* ADLParser::format_parse(void) { // Check if there is a string to pass through to output char *start = _ptr; // Record start of the next string while ((_curchar != '$') && (_curchar != '"') && (_curchar != '%') && (_curchar != '\n')) { - if (_curchar == '\\') next_char(); // superquote + if (_curchar == '\\') { + next_char(); // superquote + if ((_curchar == '$') || (_curchar == '%')) + // hack to avoid % escapes and warnings about undefined \ escapes + *(_ptr-1) = _curchar; + } if (_curchar == '\n') parse_err(SYNERR, "newline in string"); // unimplemented! next_char(); } @@ -3942,8 +3955,7 @@ char* ADLParser::find_cpp_block(const char* description) { next_char(); // Skip block delimiter skipws_no_preproc(); // Skip leading whitespace cppBlock = _ptr; // Point to start of expression - const char* file = _AD._ADL_file._name; - int line = linenum(); + int line = linenum(); next = _ptr + 1; while(((_curchar != '%') || (*next != '}')) && (_curchar != '\0')) { next_char_or_line(); @@ -3958,15 +3970,16 @@ char* ADLParser::find_cpp_block(const char* description) { _curchar = *_ptr; // Maintain invariant // Prepend location descriptor, for debugging. - char* location = (char *)malloc(strlen(file) + 100); - *location = '\0'; - if (_AD._adlocation_debug) - sprintf(location, "#line %d \"%s\"\n", line, file); - char* result = (char *)malloc(strlen(location) + strlen(cppBlock) + 1); - strcpy(result, location); - strcat(result, cppBlock); - cppBlock = result; - free(location); + if (_AD._adlocation_debug) { + char* location = get_line_string(line); + char* end_loc = end_line_marker(); + char* result = (char *)malloc(strlen(location) + strlen(cppBlock) + strlen(end_loc) + 1); + strcpy(result, location); + strcat(result, cppBlock); + strcat(result, end_loc); + cppBlock = result; + free(location); + } } return cppBlock; @@ -4036,13 +4049,26 @@ char* ADLParser::get_expr(const char *desc, const char *stop_chars) { // Helper function around get_expr // Sets _curchar to '(' so that get_paren_expr will search for a matching ')' -char *ADLParser::get_paren_expr(const char *description) { +char *ADLParser::get_paren_expr(const char *description, bool include_location) { + int line = linenum(); if (_curchar != '(') // Escape if not valid starting position return NULL; next_char(); // Skip the required initial paren. char *token2 = get_expr(description, ")"); if (_curchar == ')') next_char(); // Skip required final paren. + int junk = 0; + if (include_location && _AD._adlocation_debug && !is_int_token(token2, junk)) { + // Prepend location descriptor, for debugging. + char* location = get_line_string(line); + char* end_loc = end_line_marker(); + char* result = (char *)malloc(strlen(location) + strlen(token2) + strlen(end_loc) + 1); + strcpy(result, location); + strcat(result, token2); + strcat(result, end_loc); + token2 = result; + free(location); + } return token2; } @@ -4082,10 +4108,16 @@ char *ADLParser::get_ident_common(bool do_preproc) { if (do_preproc && start != NULL) { const char* def = _AD.get_preproc_def(start); if (def != NULL && strcmp(def, start)) { - const char* def2 = _AD.get_preproc_def(def); - if (def2 != NULL && strcmp(def2, def)) { - parse_err(SYNERR, "unimplemented: using %s defined as %s => %s", - start, def, def2); + const char* def1 = def; + const char* def2 = _AD.get_preproc_def(def1); + // implement up to 2 levels of #define + if (def2 != NULL && strcmp(def2, def1)) { + def = def2; + const char* def3 = _AD.get_preproc_def(def2); + if (def3 != NULL && strcmp(def3, def2) && strcmp(def3, def1)) { + parse_err(SYNERR, "unimplemented: using %s defined as %s => %s => %s", + start, def1, def2, def3); + } } start = strdup(def); } @@ -4431,6 +4463,35 @@ void ADLParser::get_effectlist(FormDict &effects, FormDict &operands) { } +//-------------------------------preproc_line---------------------------------- +// A "#line" keyword has been seen, so parse the rest of the line. +void ADLParser::preproc_line(void) { + int line = get_int(); + skipws_no_preproc(); + const char* file = NULL; + if (_curchar == '"') { + next_char(); // Move past the initial '"' + file = _ptr; + while (true) { + if (_curchar == '\n') { + parse_err(SYNERR, "missing '\"' at end of #line directive"); + return; + } + if (_curchar == '"') { + *_ptr = '\0'; // Terminate the string + next_char(); + skipws_no_preproc(); + break; + } + next_char(); + } + } + ensure_end_of_line(); + if (file != NULL) + _AD._ADL_file._name = file; + _buf.set_linenum(line); +} + //------------------------------preproc_define--------------------------------- // A "#define" keyword has been seen, so parse the rest of the line. void ADLParser::preproc_define(void) { @@ -4494,6 +4555,7 @@ void ADLParser::parse_err(int flag, const char *fmt, ...) { // A preprocessor directive has been encountered. Be sure it has fallen at // the begining of a line, or else report an error. void ADLParser::ensure_start_of_line(void) { + if (_curchar == '\n') { next_line(); return; } assert( _ptr >= _curline && _ptr < _curline+strlen(_curline), "Must be able to find which line we are in" ); @@ -4662,6 +4724,7 @@ char ADLParser::cur_char() { //---------------------------next_char----------------------------------------- void ADLParser::next_char() { + if (_curchar == '\n') parse_err(WARN, "must call next_line!"); _curchar = *++_ptr; // if ( _curchar == '\n' ) { // next_line(); @@ -4682,6 +4745,18 @@ void ADLParser::next_char_or_line() { //---------------------------next_line----------------------------------------- void ADLParser::next_line() { _curline = _buf.get_line(); + _curchar = ' '; +} + +//------------------------get_line_string-------------------------------------- +// Prepended location descriptor, for debugging. +// Must return a malloced string (that can be freed if desired). +char* ADLParser::get_line_string(int linenum) { + const char* file = _AD._ADL_file._name; + int line = linenum ? linenum : this->linenum(); + char* location = (char *)malloc(strlen(file) + 100); + sprintf(location, "\n#line %d \"%s\"\n", line, file); + return location; } //-------------------------is_literal_constant--------------------------------- @@ -4722,6 +4797,66 @@ bool ADLParser::is_int_token(const char* token, int& intval) { return true; } +static const char* skip_expr_ws(const char* str) { + const char * cp = str; + while (cp[0]) { + if (cp[0] <= ' ') { + ++cp; + } else if (cp[0] == '#') { + ++cp; + while (cp[0] == ' ') ++cp; + assert(0 == strncmp(cp, "line", 4), "must be a #line directive"); + const char* eol = strchr(cp, '\n'); + assert(eol != NULL, "must find end of line"); + if (eol == NULL) eol = cp + strlen(cp); + cp = eol; + } else { + break; + } + } + return cp; +} + +//-----------------------equivalent_expressions-------------------------------- +bool ADLParser::equivalent_expressions(const char* str1, const char* str2) { + if (str1 == str2) + return true; + else if (str1 == NULL || str2 == NULL) + return false; + const char* cp1 = str1; + const char* cp2 = str2; + char in_quote = '\0'; + while (cp1[0] && cp2[0]) { + if (!in_quote) { + // skip spaces and/or cpp directives + const char* cp1a = skip_expr_ws(cp1); + const char* cp2a = skip_expr_ws(cp2); + if (cp1a > cp1 && cp2a > cp2) { + cp1 = cp1a; cp2 = cp2a; + continue; + } + if (cp1a > cp1 || cp2a > cp2) break; // fail + } + // match one non-space char + if (cp1[0] != cp2[0]) break; // fail + char ch = cp1[0]; + cp1++; cp2++; + // watch for quotes + if (in_quote && ch == '\\') { + if (cp1[0] != cp2[0]) break; // fail + if (!cp1[0]) break; + cp1++; cp2++; + } + if (in_quote && ch == in_quote) { + in_quote = '\0'; + } else if (!in_quote && (ch == '"' || ch == '\'')) { + in_quote = ch; + } + } + return (!cp1[0] && !cp2[0]); +} + + //-------------------------------trim------------------------------------------ void ADLParser::trim(char* &token) { while (*token <= ' ') token++; diff --git a/hotspot/src/share/vm/adlc/adlparse.hpp b/hotspot/src/share/vm/adlc/adlparse.hpp index 42329ac279e..22aa772d0e9 100644 --- a/hotspot/src/share/vm/adlc/adlparse.hpp +++ b/hotspot/src/share/vm/adlc/adlparse.hpp @@ -93,6 +93,7 @@ protected: void pipe_parse(void); // Parse pipeline section void definitions_parse(void); // Parse definitions section void peep_parse(void); // Parse peephole rule definitions + void preproc_line(void); // Parse a #line statement void preproc_define(void); // Parse a #define statement void preproc_undef(void); // Parse an #undef statement @@ -226,7 +227,7 @@ protected: void get_effectlist(FormDict &effects, FormDict &operands); // Parse effect-operand pairs // Return the contents of a parenthesized expression. // Requires initial '(' and consumes final ')', which is replaced by '\0'. - char *get_paren_expr(const char *description); + char *get_paren_expr(const char *description, bool include_location = false); // Return expression up to next stop-char, which terminator replaces. // Does not require initial '('. Does not consume final stop-char. // Final stop-char is left in _curchar, but is also is replaced by '\0'. @@ -234,6 +235,11 @@ protected: char *find_cpp_block(const char *description); // Parse a C++ code block // Issue parser error message & go to EOL void parse_err(int flag, const char *fmt, ...); + // Create a location marker for this file and line. + char *get_line_string(int linenum = 0); + // Return a location marker which tells the C preprocessor to + // forget the previous location marker. (Requires awk postprocessing.) + char *end_line_marker() { return (char*)"\n#line 999999\n"; } // Return pointer to current character inline char cur_char(void); @@ -268,5 +274,6 @@ public: static bool is_literal_constant(const char *hex_string); static bool is_hex_digit(char digit); static bool is_int_token(const char* token, int& intval); + static bool equivalent_expressions(const char* str1, const char* str2); static void trim(char* &token); // trim leading & trailing spaces }; diff --git a/hotspot/src/share/vm/adlc/archDesc.cpp b/hotspot/src/share/vm/adlc/archDesc.cpp index 9702fb47730..a73ad76da23 100644 --- a/hotspot/src/share/vm/adlc/archDesc.cpp +++ b/hotspot/src/share/vm/adlc/archDesc.cpp @@ -140,7 +140,7 @@ bool MatchList::search(const char *opc, const char *res, const char *lch, if ((rch == _rchild) || (rch && _rchild && !strcmp(rch, _rchild))) { char * predStr = get_pred(); char * prStr = pr?pr->_pred:NULL; - if ((prStr == predStr) || (prStr && predStr && !strcmp(prStr, predStr))) { + if (ADLParser::equivalent_expressions(prStr, predStr)) { return true; } } diff --git a/hotspot/src/share/vm/adlc/dfa.cpp b/hotspot/src/share/vm/adlc/dfa.cpp index 36d56062cfd..1075c9da774 100644 --- a/hotspot/src/share/vm/adlc/dfa.cpp +++ b/hotspot/src/share/vm/adlc/dfa.cpp @@ -458,7 +458,7 @@ void ArchDesc::buildDFA(FILE* fp) { class dfa_shared_preds { - enum { count = 2 }; + enum { count = 4 }; static bool _found[count]; static const char* _type [count]; @@ -479,12 +479,15 @@ class dfa_shared_preds { char c = *prev; switch( c ) { case ' ': + case '\n': return dfa_shared_preds::valid_loc(pred, prev); case '!': case '(': case '<': case '=': return true; + case '"': // such as: #line 10 "myfile.ad"\n mypredicate + return true; case '|': if( prev != pred && *(prev-1) == '|' ) return true; case '&': @@ -564,10 +567,14 @@ public: } }; // shared predicates, _var and _pred entry should be the same length -bool dfa_shared_preds::_found[dfa_shared_preds::count] = { false, false }; -const char* dfa_shared_preds::_type[dfa_shared_preds::count] = { "int", "bool" }; -const char* dfa_shared_preds::_var [dfa_shared_preds::count] = { "_n_get_int__", "Compile__current____select_24_bit_instr__" }; -const char* dfa_shared_preds::_pred[dfa_shared_preds::count] = { "n->get_int()", "Compile::current()->select_24_bit_instr()" }; +bool dfa_shared_preds::_found[dfa_shared_preds::count] + = { false, false, false, false }; +const char* dfa_shared_preds::_type[dfa_shared_preds::count] + = { "int", "jlong", "intptr_t", "bool" }; +const char* dfa_shared_preds::_var [dfa_shared_preds::count] + = { "_n_get_int__", "_n_get_long__", "_n_get_intptr_t__", "Compile__current____select_24_bit_instr__" }; +const char* dfa_shared_preds::_pred[dfa_shared_preds::count] + = { "n->get_int()", "n->get_long()", "n->get_intptr_t()", "Compile::current()->select_24_bit_instr()" }; void ArchDesc::gen_dfa_state_body(FILE* fp, Dict &minimize, ProductionState &status, Dict &operands_chained_from, int i) { diff --git a/hotspot/src/share/vm/adlc/filebuff.hpp b/hotspot/src/share/vm/adlc/filebuff.hpp index c36fdbaf3fa..4c69bacee39 100644 --- a/hotspot/src/share/vm/adlc/filebuff.hpp +++ b/hotspot/src/share/vm/adlc/filebuff.hpp @@ -68,6 +68,7 @@ class FileBuff { // and increments bufeol and filepos to point at the end of that line. char *get_line(void); int linenum() const { return _linenum; } + void set_linenum(int line) { _linenum = line; } // This converts a pointer into the buffer to a file offset. It only works // when the pointer is valid (i.e. just obtained from getline()). diff --git a/hotspot/src/share/vm/adlc/formssel.cpp b/hotspot/src/share/vm/adlc/formssel.cpp index fb91d83d2f6..65b511bcdb1 100644 --- a/hotspot/src/share/vm/adlc/formssel.cpp +++ b/hotspot/src/share/vm/adlc/formssel.cpp @@ -1102,10 +1102,7 @@ bool equivalent_predicates( const InstructForm *instr1, const InstructForm *inst } if( pred1 != NULL && pred2 != NULL ) { // compare the predicates - const char *str1 = pred1->_pred; - const char *str2 = pred2->_pred; - if( (str1 == NULL && str2 == NULL) - || (str1 != NULL && str2 != NULL && strcmp(str1,str2) == 0) ) { + if (ADLParser::equivalent_expressions(pred1->_pred, pred2->_pred)) { return true; } } From 871bbff9cecc4319eeaf267ca072a83a6c473e81 Mon Sep 17 00:00:00 2001 From: Eamonn McManus Date: Wed, 10 Dec 2008 11:59:32 +0100 Subject: [PATCH 201/267] 6456269: Add a GenericMBeanException so clients don't have to have server's exception classes present Reviewed-by: jfdenise, dfuchs --- .../classes/javax/management/Descriptor.java | 34 +++ .../management/GenericMBeanException.java | 276 +++++++++++++++++ .../javax/management/MBeanException.java | 64 +++- .../interop/MBeanExceptionInteropTest.java | 166 +++++++++++ .../openmbean/GenericMBeanExceptionTest.java | 278 ++++++++++++++++++ 5 files changed, 807 insertions(+), 11 deletions(-) create mode 100644 jdk/src/share/classes/javax/management/GenericMBeanException.java create mode 100644 jdk/test/javax/management/interop/MBeanExceptionInteropTest.java create mode 100644 jdk/test/javax/management/openmbean/GenericMBeanExceptionTest.java diff --git a/jdk/src/share/classes/javax/management/Descriptor.java b/jdk/src/share/classes/javax/management/Descriptor.java index 30c6a5f5264..573f8fdbed9 100644 --- a/jdk/src/share/classes/javax/management/Descriptor.java +++ b/jdk/src/share/classes/javax/management/Descriptor.java @@ -155,6 +155,23 @@ import javax.management.openmbean.OpenType; * setting an attribute are specified by the field * {@code setExceptions}. * + * exceptionErrorCodesString[] + * MBeanAttributeInfo
      MBeanConstructorInfo
      MBeanOperationInfo + * + * The {@linkplain GenericMBeanException#getErrorCode() error codes} + * that can appear in a {@link GenericMBeanException} thrown when getting + * this attribute or invoking this operation or constructor. See also + * {@code setExceptionErrorCodes}. + * + * exceptionUserDataTypes + * {@link javax.management.openmbean.CompositeType}[] + * MBeanAttributeInfo
      MBeanConstructorInfo
      MBeanOperationInfo + * + * The types of {@linkplain GenericMBeanException#getUserData() userData} + * that can appear in a {@link GenericMBeanException} thrown when getting + * this attribute or invoking this operation or constructor. See also + * {@code setExceptionUserDataTypes}. + * * immutableInfoString * MBeanInfo * @@ -292,6 +309,23 @@ import javax.management.openmbean.OpenType; * an attribute. Exceptions thrown when getting an attribute are specified * by the field {@code exceptions}. * + * setExceptionErrorCodes + * String[]MBeanAttributeInfo + * + * The {@linkplain GenericMBeanException#getErrorCode() error codes} + * that can appear in a {@link GenericMBeanException} thrown when setting + * this attribute. See also + * {@code exceptionErrorCodes}. + * + * setExceptionUserDataTypes + * {@link javax.management.openmbean.CompositeType}[] + * MBeanAttributeInfo + * + * The types of {@linkplain GenericMBeanException#getUserData() userData} + * that can appear in a {@link GenericMBeanException} thrown when setting + * this attribute. See also + * {@code exceptionUserDataTypes}. + * * severityString
      Integer * MBeanNotificationInfo * diff --git a/jdk/src/share/classes/javax/management/GenericMBeanException.java b/jdk/src/share/classes/javax/management/GenericMBeanException.java new file mode 100644 index 00000000000..dd0f96e78b1 --- /dev/null +++ b/jdk/src/share/classes/javax/management/GenericMBeanException.java @@ -0,0 +1,276 @@ +/* + * 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 javax.management; + +import javax.management.openmbean.CompositeData; + +/** + *

      A customizable exception that has an optional error code string and + * payload. By using this exception in an MBean, you can avoid requiring + * clients of the MBean to have custom exception classes.

      + * + *

      An instance of this class has an optional {@linkplain #getErrorCode() + * error code}, and an optional {@linkplain #getUserData() payload} known as + * {@code userData}. This allows you to distinguish between different + * sorts of exception while still using this class for all of them.

      + * + *

      To produce a suitable {@code userData}, it is often simplest to use + * the MXBean framework. For example, suppose you want to convey a severity + * and a subsystem with your exception, which are respectively an int and a + * String. You could define a class like this:

      + * + *
      + * public class ExceptionDetails {
      + *     private final int severity;
      + *     private final String subsystem;
      + *
      + *     {@link java.beans.ConstructorProperties @ConstructorProperties}({"severity", "subsystem"})
      + *     public ExceptionDetails(int severity, String subsystem) {
      + *         this.severity = severity;
      + *         this.subsystem = subsystem;
      + *     }
      + *
      + *     public int getSeverity() {
      + *         return severity;
      + *     }
      + *
      + *     public String getSubsystem() {
      + *         return subsystem;
      + *     }
      + * }
      + * 
      + * + *

      Then you can get the MXBean framework to transform {@code ExceptionDetails} + * into {@link CompositeData} like this:

      + * + *
      + * static final {@link javax.management.openmbean.MXBeanMapping MXBeanMapping} exceptionDetailsMapping = {@link javax.management.openmbean.MXBeanMappingFactory#DEFAULT
      + *     MXBeanMappingFactory.DEFAULT}.mappingForType(
      + *         ExceptionDetails.class, MXBeanMappingFactory.DEFAULT);
      + *
      + * public static GenericMBeanException newGenericMBeanException(
      + *         String message, String errorCode, int severity, String subsystem) {
      + *     ExceptionDetails details = new ExceptionDetails(severity, subsystem);
      + *     CompositeData userData = (CompositeData)
      + *             exceptionDetailsMapping.toOpenValue(details);
      + *     return new GenericMBeanException(
      + *             message, errorCode, userData, (Throwable) null);
      + * }
      + *
      + * ...
      + *     throw newGenericMBeanException(message, errorCode, 25, "foosystem");
      + * 
      + * + *

      A client that knows the {@code ExceptionDetails} class can convert + * back from the {@code userData} of a {@code GenericMBeanException} + * that was generated as above:

      + * + *
      + * ...
      + *     try {
      + *         mbeanProxy.foo();
      + *     } catch (GenericMBeanException e) {
      + *         CompositeData userData = e.getUserData();
      + *         ExceptionDetails details = (ExceptionDetails)
      + *                 exceptionDetailsMapping.fromOpenValue(userData);
      + *         System.out.println("Exception Severity: " + details.getSeverity());
      + *     }
      + * ...
      + * 
      + * + *

      The Descriptor field exceptionErrorCodes can be used to specify in the + * {@link MBeanOperationInfo} for an operation what the possible + * {@linkplain #getErrorCode() error codes} are when that operation throws + * {@code GenericMBeanException}. It can also be used in an {@link + * MBeanConstructorInfo} or {@link MBeanAttributeInfo} to specify what the + * possible error codes are for {@code GenericMBeanException} when invoking + * that constructor or getting that attribute, respectively. The field + * setExceptionErrorCodes can be used to specify what the possible + * error codes are when setting an attribute.

      + * + *

      You may want to use the {@link DescriptorKey @DescriptorKey} facility + * to define annotations that allow you to specify the error codes. If you + * define...

      + * + *
      + * {@link java.lang.annotation.Documented @Documented}
      + * {@link java.lang.annotation.Target @Target}(ElementType.METHOD)
      + * {@link java.lang.annotation.Retention @Retention}(RetentionPolicy.RUNTIME)
      + * public @interface ErrorCodes {
      + *     @DescriptorKey("exceptionErrorCodes")
      + *     String[] value();
      + * }
      + * 
      + * + *

      ...then you can write MBean interfaces like this...

      + * + *
      + * public interface FooMBean {  // or FooMXBean
      + *     @ErrorCodes({"com.example.bad", "com.example.worse"})
      + *     public void foo() throws GenericMBeanException;
      + * }
      + * 
      + * + *

      The Descriptor field exceptionUserDataTypes can be used to specify in the + * {@link MBeanOperationInfo} for an operation what the possible types of + * {@linkplain #getUserData() userData} are when that operation throws + * {@code GenericMBeanException}. It is an array of + * {@link javax.management.openmbean.CompositeType CompositeType} values + * describing the possible {@link CompositeData} formats. This field can also be used + * in an {@link MBeanConstructorInfo} or {@link MBeanAttributeInfo} to specify + * the possible types of user data for {@code GenericMBeanException} when + * invoking that constructor or getting that attribute, respectively. The + * field + * setExceptionUserDataTypes + * can be used to specify the possible types of user data for exceptions when + * setting an attribute. If a Descriptor has both {@code exceptionErrorCodes} + * and {@code exceptionUserDataTypes} then the two arrays should be the + * same size; each pair of corresponding elements describes one kind + * of exception. Similarly for {@code setExceptionErrorCodes} and {@code + * setExceptionUserDataTypes}. + * + * + *

      Serialization

      + * + *

      For compatibility reasons, instances of this class are serialized as + * instances of {@link MBeanException}. Special logic in that class converts + * them back to instances of this class at deserialization time. If the + * serialized object is deserialized in an earlier version of the JMX API + * that does not include this class, then it will appear as just an {@code + * MBeanException} and the error code or userData will not be available.

      + * + * @since 1.7 + */ +public class GenericMBeanException extends MBeanException { + private static final long serialVersionUID = -1560202003985932823L; + + /** + *

      Constructs a new {@code GenericMBeanException} with the given + * detail message. This constructor is + * equivalent to {@link #GenericMBeanException(String, String, + * CompositeData, Throwable) GenericMBeanException(message, "", + * null, null)}.

      + * + * @param message the exception detail message. + */ + public GenericMBeanException(String message) { + this(message, "", null, null); + } + + /** + *

      Constructs a new {@code GenericMBeanException} with the given + * detail message and cause. This constructor is + * equivalent to {@link #GenericMBeanException(String, String, + * CompositeData, Throwable) GenericMBeanException(message, "", + * null, cause)}.

      + * + * @param message the exception detail message. + * @param cause the cause of this exception. Can be null. + */ + public GenericMBeanException(String message, Throwable cause) { + this(message, "", null, cause); + } + + /** + *

      Constructs a new {@code GenericMBeanException} with the given + * detail message, error code, and user data. This constructor is + * equivalent to {@link #GenericMBeanException(String, String, + * CompositeData, Throwable) GenericMBeanException(message, errorCode, + * userData, null)}.

      + * + * @param message the exception detail message. + * @param errorCode the exception error code. Specifying a null value + * is equivalent to specifying an empty string. It is recommended to use + * the same reverse domain name convention as package names, for example + * "com.example.foo.UnexpectedFailure". There is no requirement that the + * error code be a syntactically valid Java identifier. + * @param userData extra information about the exception. Can be null. + */ + public GenericMBeanException( + String message, String errorCode, CompositeData userData) { + this(message, errorCode, userData, null); + } + + /** + *

      Constructs a new {@code GenericMBeanException} with the given + * detail message, error code, user data, and cause.

      + * + * @param message the exception detail message. + * @param errorCode the exception error code. Specifying a null value + * is equivalent to specifying an empty string. It is recommended to use + * the same reverse domain name convention as package names, for example + * "com.example.foo.UnexpectedFailure". There is no requirement that the + * error code be a syntactically valid Java identifier. + * @param userData extra information about the exception. Can be null. + * @param cause the cause of this exception. Can be null. + */ + public GenericMBeanException( + String message, String errorCode, CompositeData userData, + Throwable cause) { + super(message, (errorCode == null) ? "" : errorCode, userData, cause); + } + + /** + *

      Returns the error code of this exception.

      + * + * @return the error code. This value is never null. + */ + public String getErrorCode() { + return errorCode; + } + + /** + *

      Returns the userData of this exception.

      + * + * @return the userData. Can be null. + */ + public CompositeData getUserData() { + return userData; + } + + /** + *

      Instances of this class are serialized as instances of + * {@link MBeanException}. {@code MBeanException} has private fields that can + * not be set by its public constructors. They can only be set in objects + * returned by this method. When an {@code MBeanException} instance is + * deserialized, if those fields are present then its {@code readResolve} + * method will substitute a {@code GenericMBeanException} equivalent to + * this one.

      + */ + Object writeReplace() { + MBeanException x = new MBeanException( + getMessage(), errorCode, userData, getCause()); + x.setStackTrace(this.getStackTrace()); + return x; + } +} diff --git a/jdk/src/share/classes/javax/management/MBeanException.java b/jdk/src/share/classes/javax/management/MBeanException.java index 839daa5dd31..7edc6639a6b 100644 --- a/jdk/src/share/classes/javax/management/MBeanException.java +++ b/jdk/src/share/classes/javax/management/MBeanException.java @@ -25,6 +25,8 @@ package javax.management; +import javax.management.openmbean.CompositeData; + /** * Represents "user defined" exceptions thrown by MBean methods @@ -40,6 +42,26 @@ public class MBeanException extends JMException { /* Serial version */ private static final long serialVersionUID = 4066342430588744142L; + /** + * @serial This field is null for instances of this class that were + * produced by its public constructors. It is non-null for instances + * of this class that represent serialized instances of {@link + * GenericMBeanException}. + * + * @see GenericMBeanException#getErrorCode() + */ + final String errorCode; + + /** + * @serial This field is null for instances of this class that were + * produced by its public constructors. It may be non-null for instances + * of this class that represent serialized instances of {@link + * GenericMBeanException}. + * + * @see GenericMBeanException#getUserData() + */ + final CompositeData userData; + /** * @serial Encapsulated {@link Exception} */ @@ -51,9 +73,8 @@ public class MBeanException extends JMException { * * @param e the wrapped exception. */ - public MBeanException(java.lang.Exception e) { - super() ; - exception = e ; + public MBeanException(Exception e) { + this(null, null, null, e); } /** @@ -63,11 +84,19 @@ public class MBeanException extends JMException { * @param e the wrapped exception. * @param message the detail message. */ - public MBeanException(java.lang.Exception e, String message) { - super(message) ; - exception = e ; + public MBeanException(Exception e, String message) { + this(message, null, null, e); } + MBeanException( + String message, String errorCode, CompositeData userData, Throwable cause) { + super(message); + initCause(cause); + if (cause instanceof Exception) + this.exception = (Exception) cause; + this.errorCode = errorCode; + this.userData = userData; + } /** * Return the actual {@link Exception} thrown. @@ -79,11 +108,24 @@ public class MBeanException extends JMException { } /** - * Return the actual {@link Exception} thrown. - * - * @return the wrapped exception. + * This method is invoked when deserializing instances of this class. + * If the {@code errorCode} field of the deserialized instance is not + * null, this method returns an instance of {@link GenericMBeanException} + * instead. Otherwise it returns {@code this}. + * @return {@code this}, or a {@code GenericMBeanException}. */ - public Throwable getCause() { - return exception; + Object readResolve() { + if (errorCode == null) { + // serial compatibility: earlier versions did not set + // Throwable.cause because they overrode getCause(). + if (getCause() == null && exception != null) + initCause(exception); + return this; + } else { + Throwable t = new GenericMBeanException( + getMessage(), errorCode, userData, getCause()); + t.setStackTrace(this.getStackTrace()); + return t; + } } } diff --git a/jdk/test/javax/management/interop/MBeanExceptionInteropTest.java b/jdk/test/javax/management/interop/MBeanExceptionInteropTest.java new file mode 100644 index 00000000000..dff6d9639d3 --- /dev/null +++ b/jdk/test/javax/management/interop/MBeanExceptionInteropTest.java @@ -0,0 +1,166 @@ +/* + * 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. + * + * 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 6456269 + * @summary Test that an MBeanException serialized on JDK 6 deserializes + * correctly on JDK 7. + * @author Eamonn McManus + */ + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import javax.management.MBeanException; + +// In JDK 6, the Throwable.cause field was always null for an MBeanException, +// but it didn't matter because we overrode getCause() to return +// MBeanException.exception instead. In JDK 7, we no longer override getCause() +// because MBeanException doubles as the serial form of GenericMBeanException. +// So we need some care to make sure that objects deserialized from JDK 6 +// have the right getCause() behaviour. +public class MBeanExceptionInteropTest { + private static final byte[] SERIALIZED_MBEAN_EXCEPTION = { + -84,-19,0,5,115,114,0,31,106,97,118,97,120,46,109,97, + 110,97,103,101,109,101,110,116,46,77,66,101,97,110,69,120, + 99,101,112,116,105,111,110,56,110,-116,-27,110,87,49,-50,2, + 0,1,76,0,9,101,120,99,101,112,116,105,111,110,116,0, + 21,76,106,97,118,97,47,108,97,110,103,47,69,120,99,101, + 112,116,105,111,110,59,120,114,0,28,106,97,118,97,120,46, + 109,97,110,97,103,101,109,101,110,116,46,74,77,69,120,99, + 101,112,116,105,111,110,4,-35,76,-20,-109,-99,126,113,2,0, + 0,120,114,0,19,106,97,118,97,46,108,97,110,103,46,69, + 120,99,101,112,116,105,111,110,-48,-3,31,62,26,59,28,-60, + 2,0,0,120,114,0,19,106,97,118,97,46,108,97,110,103, + 46,84,104,114,111,119,97,98,108,101,-43,-58,53,39,57,119, + -72,-53,3,0,3,76,0,5,99,97,117,115,101,116,0,21, + 76,106,97,118,97,47,108,97,110,103,47,84,104,114,111,119, + 97,98,108,101,59,76,0,13,100,101,116,97,105,108,77,101, + 115,115,97,103,101,116,0,18,76,106,97,118,97,47,108,97, + 110,103,47,83,116,114,105,110,103,59,91,0,10,115,116,97, + 99,107,84,114,97,99,101,116,0,30,91,76,106,97,118,97, + 47,108,97,110,103,47,83,116,97,99,107,84,114,97,99,101, + 69,108,101,109,101,110,116,59,120,112,113,0,126,0,8,116, + 0,7,79,104,32,100,101,97,114,117,114,0,30,91,76,106, + 97,118,97,46,108,97,110,103,46,83,116,97,99,107,84,114, + 97,99,101,69,108,101,109,101,110,116,59,2,70,42,60,60, + -3,34,57,2,0,0,120,112,0,0,0,2,115,114,0,27, + 106,97,118,97,46,108,97,110,103,46,83,116,97,99,107,84, + 114,97,99,101,69,108,101,109,101,110,116,97,9,-59,-102,38, + 54,-35,-123,2,0,4,73,0,10,108,105,110,101,78,117,109, + 98,101,114,76,0,14,100,101,99,108,97,114,105,110,103,67, + 108,97,115,115,113,0,126,0,6,76,0,8,102,105,108,101, + 78,97,109,101,113,0,126,0,6,76,0,10,109,101,116,104, + 111,100,78,97,109,101,113,0,126,0,6,120,112,0,0,0, + 63,116,0,25,77,66,101,97,110,69,120,99,101,112,116,105, + 111,110,73,110,116,101,114,111,112,84,101,115,116,116,0,30, + 77,66,101,97,110,69,120,99,101,112,116,105,111,110,73,110, + 116,101,114,111,112,84,101,115,116,46,106,97,118,97,116,0, + 5,119,114,105,116,101,115,113,0,126,0,12,0,0,0,46, + 113,0,126,0,14,113,0,126,0,15,116,0,4,109,97,105, + 110,120,115,114,0,34,106,97,118,97,46,108,97,110,103,46, + 73,108,108,101,103,97,108,65,114,103,117,109,101,110,116,69, + 120,99,101,112,116,105,111,110,-75,-119,115,-45,125,102,-113,-68, + 2,0,0,120,114,0,26,106,97,118,97,46,108,97,110,103, + 46,82,117,110,116,105,109,101,69,120,99,101,112,116,105,111, + 110,-98,95,6,71,10,52,-125,-27,2,0,0,120,113,0,126, + 0,3,113,0,126,0,21,116,0,3,66,97,100,117,113,0, + 126,0,10,0,0,0,2,115,113,0,126,0,12,0,0,0, + 62,113,0,126,0,14,113,0,126,0,15,113,0,126,0,16, + 115,113,0,126,0,12,0,0,0,46,113,0,126,0,14,113, + 0,126,0,15,113,0,126,0,18,120, + }; + + private static volatile String failure; + + public static void main(String[] args) throws Exception { + if (args.length > 0) { + if (args[0].equals("write") && args.length == 1) { + write(); + return; + } else { + System.err.println( + "Usage: java MBeanExceptionInteropTest"); + System.err.println( + "or: java MBeanExceptionInteropTest write"); + System.exit(1); + } + } + + // Read the serialized object and check it is correct. + ByteArrayInputStream bin = + new ByteArrayInputStream(SERIALIZED_MBEAN_EXCEPTION); + ObjectInputStream oin = new ObjectInputStream(bin); + MBeanException mbeanEx = (MBeanException) oin.readObject(); + assertEquals("MBeanException message", "Oh dear", mbeanEx.getMessage()); + System.out.println("getCause(): " + mbeanEx.getCause() + "; " + + "getTargetException(): " + mbeanEx.getTargetException()); + for (Throwable t : + new Throwable[] {mbeanEx.getCause(), mbeanEx.getTargetException()}) { + if (!(t instanceof IllegalArgumentException)) + fail("Nested exception not an IllegalArgumentException: " + t); + else + assertEquals("Nested exception message", "Bad", t.getMessage()); + } + + if (failure == null) + System.out.println("TEST PASSED"); + else + throw new Exception("TEST FAILED: " + failure); + } + + // Write a file that can be inserted into this source file as the + // contents of the SERIALIZED_MBEAN_EXCEPTION array. Run this program + // on JDK 6 to generate the array, then test on JDK 7. + private static void write() throws Exception { + Exception wrapped = new IllegalArgumentException("Bad"); + MBeanException mbeanEx = new MBeanException(wrapped, "Oh dear"); + ByteArrayOutputStream bout = new ByteArrayOutputStream(); + ObjectOutputStream oout = new ObjectOutputStream(bout); + oout.writeObject(mbeanEx); + oout.close(); + byte[] bytes = bout.toByteArray(); + for (int i = 0; i < bytes.length; i++) { + System.out.printf("%d,", bytes[i]); + if (i % 16 == 15) + System.out.println(); + } + if (bytes.length % 16 != 0) + System.out.println(); + } + + private static void assertEquals(String what, Object expect, Object actual) { + boolean equal = (expect == null) ? (actual == null) : expect.equals(actual); + if (equal) + System.out.println("OK: " + what + ": " + expect); + else + fail(what + ": expected " + expect + ", got " + actual); + } + + private static void fail(String why) { + System.out.println("FAIL: " + why); + failure = why; + } +} diff --git a/jdk/test/javax/management/openmbean/GenericMBeanExceptionTest.java b/jdk/test/javax/management/openmbean/GenericMBeanExceptionTest.java new file mode 100644 index 00000000000..fa682d0d0d7 --- /dev/null +++ b/jdk/test/javax/management/openmbean/GenericMBeanExceptionTest.java @@ -0,0 +1,278 @@ +/* + * 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. + * + * 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 6456269 + * @summary Test GenericMBeanException + * @author Eamonn McManus + */ + +import java.beans.ConstructorProperties; +import java.lang.management.ManagementFactory; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import javax.management.GenericMBeanException; +import javax.management.JMX; +import javax.management.MBeanServer; +import javax.management.MBeanServerConnection; +import javax.management.ObjectName; +import javax.management.openmbean.CompositeData; +import javax.management.openmbean.CompositeType; +import javax.management.openmbean.MXBeanMapping; +import javax.management.openmbean.MXBeanMappingFactory; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXConnectorServer; +import javax.management.remote.JMXConnectorServerFactory; +import javax.management.remote.JMXServiceURL; + +public class GenericMBeanExceptionTest { + private static volatile String failure = null; + + public static interface ThrowerMBean { + public void throwGeneric() throws GenericMBeanException; + public void throwGeneric(Throwable cause) throws GenericMBeanException; + public void throwGeneric(String errorCode) throws GenericMBeanException; + public void throwGeneric(CompositeData userData) throws GenericMBeanException; + public void throwGeneric(String errorCode, CompositeData userData) + throws GenericMBeanException; + public void throwGeneric(String errorCode, CompositeData userData, Throwable cause) + throws GenericMBeanException; + } + + public static class Thrower implements ThrowerMBean { + + public void throwGeneric() throws GenericMBeanException { + throw new GenericMBeanException("Message"); + } + + public void throwGeneric(Throwable cause) throws GenericMBeanException { + throw new GenericMBeanException("Message", cause); + } + + public void throwGeneric(String errorCode) throws GenericMBeanException { + throw new GenericMBeanException("Message", errorCode, null); + } + + public void throwGeneric(CompositeData userData) throws GenericMBeanException { + throw new GenericMBeanException("Message", null, userData); + } + + public void throwGeneric(String errorCode, CompositeData userData) + throws GenericMBeanException { + throw new GenericMBeanException("Message", errorCode, userData); + } + + public void throwGeneric(String errorCode, CompositeData userData, + Throwable cause) throws GenericMBeanException { + throw new GenericMBeanException("Message", errorCode, userData, cause); + } + } + + public static class Payload { + private final int severity; + private final String subsystem; + + @ConstructorProperties({"severity", "subsystem"}) + public Payload(int severity, String subsystem) { + this.severity = severity; + this.subsystem = subsystem; + } + + public int getSeverity() { + return severity; + } + + public String getSubsystem() { + return subsystem; + } + + @Override + public boolean equals(Object x) { + if (!(x instanceof Payload)) + return false; + Payload p = (Payload) x; + return (severity == p.severity && + (subsystem == null) ? + p.subsystem == null : subsystem.equals(p.subsystem)); + } + + @Override + public int hashCode() { + return severity + subsystem.hashCode(); + } + + @Override + public String toString() { + return "Payload{severity: " + severity + ", subsystem: " + subsystem + "}"; + } + } + + public static void main(String[] args) throws Exception { + MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); + ObjectName name = new ObjectName("test:type=Thrower"); + Thrower thrower = new Thrower(); + mbs.registerMBean(thrower, name); + + if (args.length > 0) { + System.out.println("Attach client now, hit return to exit"); + System.in.read(); + return; + } + + JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://"); + JMXConnectorServer cs = JMXConnectorServerFactory.newJMXConnectorServer( + url, null, mbs); + cs.start(); + JMXServiceURL addr = cs.getAddress(); + + JMXConnector cc = JMXConnectorFactory.connect(addr); + MBeanServerConnection mbsc = cc.getMBeanServerConnection(); + + ThrowerMBean throwerProxy = JMX.newMBeanProxy(mbsc, name, ThrowerMBean.class); + + Payload payload = new Payload(5, "modular modulizer"); + MXBeanMapping payloadMapping = MXBeanMappingFactory.DEFAULT.mappingForType( + Payload.class, MXBeanMappingFactory.DEFAULT); + CompositeData userData = (CompositeData) + payloadMapping.toOpenValue(payload); + Throwable cause = new IllegalArgumentException("Badness"); + + Object[][] testCases = { + {}, + {"code1"}, + {userData}, + {"code2", userData}, + {(String) null, userData}, + {"code99", userData, cause}, + {(String) null, userData, cause}, + }; + + for (Object[] testCase : testCases) { + System.out.println("Test case: " + testCaseString(testCase)); + + // Find which ThrowerMBean method it corresponds to + Method testMethod = null; +search: + for (Method m : ThrowerMBean.class.getMethods()) { + Class[] paramTypes = m.getParameterTypes(); + if (paramTypes.length != testCase.length) + continue; + for (int i = 0; i < paramTypes.length; i++) { + if (testCase[i] != null && !paramTypes[i].isInstance(testCase[i])) + continue search; + } + testMethod = m; + } + + if (testMethod == null) { + throw new Exception("TEST ERROR: no method corresponds: " + + testCaseString(testCase)); + } + + try { + testMethod.invoke(throwerProxy, testCase); + fail("Did not throw exception", testCase); + continue; + } catch (InvocationTargetException e) { + Throwable iteCause = e.getCause(); + if (!(iteCause instanceof GenericMBeanException)) { + iteCause.printStackTrace(System.out); + fail("Threw wrong exception " + iteCause, testCase); + continue; + } + GenericMBeanException ge = (GenericMBeanException) iteCause; + if (!ge.getMessage().equals("Message")) + fail("Wrong message: " + ge.getMessage(), testCase); + + Class[] paramTypes = testMethod.getParameterTypes(); + for (int i = 0; i < paramTypes.length; i++) { + Class paramType = paramTypes[i]; + + if (paramType == Throwable.class) { // cause + Throwable geCause = ge.getCause(); + if (!(geCause instanceof IllegalArgumentException)) + fail("Wrong cause: " + geCause, testCase); + else if (!geCause.getMessage().equals("Badness")) + fail("Wrong cause message: " + geCause.getMessage(), testCase); + } else if (paramType == String.class) { // errorCode + String errorCode = ge.getErrorCode(); + String expectedErrorCode = + (testCase[i] == null) ? "" : (String) testCase[i]; + if (!expectedErrorCode.equals(errorCode)) + fail("Wrong error code: " + ge.getErrorCode(), testCase); + } else if (paramType == CompositeData.class) { // userData + CompositeData userData2 = ge.getUserData(); + if (!userData.equals(userData2)) + fail("Wrong userData: " + userData2, testCase); + Payload payload2 = (Payload) payloadMapping.fromOpenValue(userData2); + if (!payload.equals(payload2)) + fail("Wrong payload: " + payload2, testCase); + } else + throw new Exception("TEST ERROR: unknown parameter type: " + paramType); + } + } + } + + if (failure == null) + System.out.println("TEST PASSED"); + else + throw new Exception("TEST FAILED: " + failure); + } + + private static String testCaseString(Object[] testCase) { + StringBuilder sb = new StringBuilder("["); + String sep = ""; + for (Object x : testCase) { + sb.append(sep); + String xs = (x instanceof CompositeData) ? + compositeDataString((CompositeData) x) : String.valueOf(x); + sb.append(xs); + sep = ", "; + } + sb.append("]"); + return sb.toString(); + } + + private static String compositeDataString(CompositeData cd) { + StringBuilder sb = new StringBuilder("CompositeData{"); + CompositeType ct = cd.getCompositeType(); + String sep = ""; + for (String key : ct.keySet()) { + sb.append(sep).append(key).append(": ").append(cd.get(key)); + sep = ", "; + } + sb.append("}"); + return sb.toString(); + } + + private static void fail(String why, Object[] testCase) { + fail(testCaseString(testCase) + ": " + why); + } + + private static void fail(String why) { + failure = why; + System.out.println("FAIL: " + why); + } +} From 89fa477ecf236750aed9e017e21f535462ef06f0 Mon Sep 17 00:00:00 2001 From: Xueming Shen Date: Wed, 10 Dec 2008 14:03:15 -0800 Subject: [PATCH 202/267] 6642323: Speeding up Single Byte Decoders 6642328: Speeding up Single Byte Encoders Re-implementation of mapping based sbcs charts Reviewed-by: alanb --- jdk/make/java/nio/FILES_java.gmk | 33 +- jdk/make/java/nio/Makefile | 15 +- jdk/make/sun/nio/FILES_java.gmk | 76 ++- jdk/make/sun/nio/Makefile | 16 +- jdk/make/tools/CharsetMapping/IBM037.c2b | 1 + jdk/make/tools/CharsetMapping/IBM037.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM037.nr | 1 + jdk/make/tools/CharsetMapping/IBM1006.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM1025.c2b | 1 + jdk/make/tools/CharsetMapping/IBM1025.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM1025.nr | 1 + jdk/make/tools/CharsetMapping/IBM1026.c2b | 1 + jdk/make/tools/CharsetMapping/IBM1026.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM1026.nr | 1 + jdk/make/tools/CharsetMapping/IBM1046.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM1047.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM1097.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM1098.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM1112.c2b | 1 + jdk/make/tools/CharsetMapping/IBM1112.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM1112.nr | 1 + jdk/make/tools/CharsetMapping/IBM1122.c2b | 1 + jdk/make/tools/CharsetMapping/IBM1122.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM1122.nr | 1 + jdk/make/tools/CharsetMapping/IBM1123.c2b | 1 + jdk/make/tools/CharsetMapping/IBM1123.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM1123.nr | 1 + jdk/make/tools/CharsetMapping/IBM1124.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM1140.c2b | 1 + jdk/make/tools/CharsetMapping/IBM1140.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM1141.c2b | 1 + jdk/make/tools/CharsetMapping/IBM1141.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM1142.c2b | 1 + jdk/make/tools/CharsetMapping/IBM1142.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM1143.c2b | 1 + jdk/make/tools/CharsetMapping/IBM1143.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM1144.c2b | 1 + jdk/make/tools/CharsetMapping/IBM1144.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM1145.c2b | 1 + jdk/make/tools/CharsetMapping/IBM1145.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM1146.c2b | 1 + jdk/make/tools/CharsetMapping/IBM1146.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM1147.c2b | 1 + jdk/make/tools/CharsetMapping/IBM1147.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM1148.c2b | 1 + jdk/make/tools/CharsetMapping/IBM1148.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM1149.c2b | 1 + jdk/make/tools/CharsetMapping/IBM1149.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM273.c2b | 1 + jdk/make/tools/CharsetMapping/IBM273.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM273.nr | 1 + jdk/make/tools/CharsetMapping/IBM277.c2b | 1 + jdk/make/tools/CharsetMapping/IBM277.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM277.nr | 1 + jdk/make/tools/CharsetMapping/IBM278.c2b | 1 + jdk/make/tools/CharsetMapping/IBM278.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM278.nr | 1 + jdk/make/tools/CharsetMapping/IBM280.c2b | 1 + jdk/make/tools/CharsetMapping/IBM280.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM280.nr | 1 + jdk/make/tools/CharsetMapping/IBM284.c2b | 1 + jdk/make/tools/CharsetMapping/IBM284.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM284.nr | 1 + jdk/make/tools/CharsetMapping/IBM285.c2b | 1 + jdk/make/tools/CharsetMapping/IBM285.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM285.nr | 1 + jdk/make/tools/CharsetMapping/IBM297.c2b | 1 + jdk/make/tools/CharsetMapping/IBM297.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM297.nr | 1 + jdk/make/tools/CharsetMapping/IBM420.c2b | 1 + jdk/make/tools/CharsetMapping/IBM420.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM420.nr | 1 + jdk/make/tools/CharsetMapping/IBM424.c2b | 1 + jdk/make/tools/CharsetMapping/IBM424.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM424.nr | 1 + jdk/make/tools/CharsetMapping/IBM437.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM500.c2b | 1 + jdk/make/tools/CharsetMapping/IBM500.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM500.nr | 1 + jdk/make/tools/CharsetMapping/IBM737.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM775.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM838.c2b | 1 + jdk/make/tools/CharsetMapping/IBM838.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM838.nr | 6 + jdk/make/tools/CharsetMapping/IBM850.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM852.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM855.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM856.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM857.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM858.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM860.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM861.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM862.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM863.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM864.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM865.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM866.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM868.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM869.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM870.c2b | 1 + jdk/make/tools/CharsetMapping/IBM870.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM870.nr | 1 + jdk/make/tools/CharsetMapping/IBM871.c2b | 1 + jdk/make/tools/CharsetMapping/IBM871.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM871.nr | 1 + jdk/make/tools/CharsetMapping/IBM874.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM874.nr | 5 + jdk/make/tools/CharsetMapping/IBM875.c2b | 1 + jdk/make/tools/CharsetMapping/IBM875.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM875.nr | 1 + jdk/make/tools/CharsetMapping/IBM918.c2b | 1 + jdk/make/tools/CharsetMapping/IBM918.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM918.nr | 1 + jdk/make/tools/CharsetMapping/IBM921.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/IBM922.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/ISO_8859_11.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/ISO_8859_13.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/ISO_8859_15.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/ISO_8859_2.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/ISO_8859_3.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/ISO_8859_4.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/ISO_8859_5.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/ISO_8859_6.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/ISO_8859_7.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/ISO_8859_8.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/ISO_8859_9.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/JIS_X_0201.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/KOI8_R.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/KOI8_U.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/MS1250.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/MS1251.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/MS1252.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/MS1253.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/MS1254.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/MS1255.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/MS1256.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/MS1257.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/MS1258.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/MS874.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/MacArabic.map | 257 +++++++++++ .../tools/CharsetMapping/MacCentralEurope.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/MacCroatian.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/MacCyrillic.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/MacDingbat.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/MacGreek.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/MacHebrew.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/MacIceland.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/MacRoman.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/MacRomania.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/MacSymbol.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/MacThai.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/MacTurkish.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/MacUkraine.map | 257 +++++++++++ .../tools/CharsetMapping/SingleByte-X.java | 83 ++++ jdk/make/tools/CharsetMapping/TIS_620.map | 257 +++++++++++ jdk/make/tools/CharsetMapping/extsbcs | 74 +++ jdk/make/tools/CharsetMapping/sbcs | 28 ++ .../tools/charsetmapping/GenerateMapping.java | 3 +- .../tools/charsetmapping/GenerateSBCS.java | 262 +++++++++++ .../share/classes/sun/io/ByteToCharCp850.java | 6 +- .../classes/sun/io/CharToByteJIS0201.java | 16 +- .../classes/sun/io/CharToByteSingleByte.java | 33 +- jdk/src/share/classes/sun/nio/cs/IBM437.java | 368 --------------- jdk/src/share/classes/sun/nio/cs/IBM737.java | 321 ------------- jdk/src/share/classes/sun/nio/cs/IBM775.java | 326 ------------- jdk/src/share/classes/sun/nio/cs/IBM850.java | 299 ------------ jdk/src/share/classes/sun/nio/cs/IBM852.java | 274 ----------- jdk/src/share/classes/sun/nio/cs/IBM855.java | 304 ------------ jdk/src/share/classes/sun/nio/cs/IBM857.java | 263 ----------- jdk/src/share/classes/sun/nio/cs/IBM858.java | 264 ----------- jdk/src/share/classes/sun/nio/cs/IBM862.java | 396 ---------------- jdk/src/share/classes/sun/nio/cs/IBM866.java | 332 -------------- jdk/src/share/classes/sun/nio/cs/IBM874.java | 252 ---------- .../share/classes/sun/nio/cs/ISO_8859_13.java | 266 ----------- .../share/classes/sun/nio/cs/ISO_8859_15.java | 249 ---------- .../share/classes/sun/nio/cs/ISO_8859_2.java | 246 ---------- .../share/classes/sun/nio/cs/ISO_8859_4.java | 244 ---------- .../share/classes/sun/nio/cs/ISO_8859_5.java | 271 ----------- .../share/classes/sun/nio/cs/ISO_8859_7.java | 255 ---------- .../share/classes/sun/nio/cs/ISO_8859_9.java | 233 ---------- jdk/src/share/classes/sun/nio/cs/KOI8_R.java | 344 -------------- jdk/src/share/classes/sun/nio/cs/KOI8_U.java | 323 ------------- jdk/src/share/classes/sun/nio/cs/MS1250.java | 304 ------------ jdk/src/share/classes/sun/nio/cs/MS1251.java | 306 ------------ jdk/src/share/classes/sun/nio/cs/MS1252.java | 304 ------------ jdk/src/share/classes/sun/nio/cs/MS1253.java | 303 ------------ jdk/src/share/classes/sun/nio/cs/MS1254.java | 305 ------------ jdk/src/share/classes/sun/nio/cs/MS1257.java | 304 ------------ .../share/classes/sun/nio/cs/SingleByte.java | 241 ++++++++++ .../share/classes/sun/nio/cs/ext/IBM037.java | 221 --------- .../share/classes/sun/nio/cs/ext/IBM1006.java | 336 -------------- .../share/classes/sun/nio/cs/ext/IBM1025.java | 272 ----------- .../share/classes/sun/nio/cs/ext/IBM1026.java | 233 ---------- .../share/classes/sun/nio/cs/ext/IBM1046.java | 335 -------------- .../share/classes/sun/nio/cs/ext/IBM1047.java | 221 --------- .../share/classes/sun/nio/cs/ext/IBM1097.java | 342 -------------- .../share/classes/sun/nio/cs/ext/IBM1098.java | 362 --------------- .../share/classes/sun/nio/cs/ext/IBM1112.java | 266 ----------- .../share/classes/sun/nio/cs/ext/IBM1122.java | 262 ----------- .../share/classes/sun/nio/cs/ext/IBM1123.java | 272 ----------- .../share/classes/sun/nio/cs/ext/IBM1124.java | 272 ----------- .../share/classes/sun/nio/cs/ext/IBM1140.java | 191 -------- .../share/classes/sun/nio/cs/ext/IBM1141.java | 189 -------- .../share/classes/sun/nio/cs/ext/IBM1142.java | 190 -------- .../share/classes/sun/nio/cs/ext/IBM1143.java | 190 -------- .../share/classes/sun/nio/cs/ext/IBM1144.java | 190 -------- .../share/classes/sun/nio/cs/ext/IBM1145.java | 190 -------- .../share/classes/sun/nio/cs/ext/IBM1146.java | 190 -------- .../share/classes/sun/nio/cs/ext/IBM1147.java | 190 -------- .../share/classes/sun/nio/cs/ext/IBM1148.java | 190 -------- .../share/classes/sun/nio/cs/ext/IBM1149.java | 190 -------- .../share/classes/sun/nio/cs/ext/IBM273.java | 221 --------- .../share/classes/sun/nio/cs/ext/IBM277.java | 221 --------- .../share/classes/sun/nio/cs/ext/IBM278.java | 221 --------- .../share/classes/sun/nio/cs/ext/IBM280.java | 221 --------- .../share/classes/sun/nio/cs/ext/IBM284.java | 221 --------- .../share/classes/sun/nio/cs/ext/IBM285.java | 221 --------- .../share/classes/sun/nio/cs/ext/IBM297.java | 221 --------- .../share/classes/sun/nio/cs/ext/IBM420.java | 315 ------------- .../share/classes/sun/nio/cs/ext/IBM424.java | 256 ----------- .../share/classes/sun/nio/cs/ext/IBM500.java | 221 --------- .../share/classes/sun/nio/cs/ext/IBM838.java | 243 ---------- .../share/classes/sun/nio/cs/ext/IBM856.java | 288 ------------ .../share/classes/sun/nio/cs/ext/IBM860.java | 348 -------------- .../share/classes/sun/nio/cs/ext/IBM861.java | 369 --------------- .../share/classes/sun/nio/cs/ext/IBM863.java | 373 --------------- .../share/classes/sun/nio/cs/ext/IBM864.java | 342 -------------- .../share/classes/sun/nio/cs/ext/IBM865.java | 369 --------------- .../share/classes/sun/nio/cs/ext/IBM868.java | 359 --------------- .../share/classes/sun/nio/cs/ext/IBM869.java | 290 ------------ .../share/classes/sun/nio/cs/ext/IBM870.java | 244 ---------- .../share/classes/sun/nio/cs/ext/IBM871.java | 221 --------- .../share/classes/sun/nio/cs/ext/IBM875.java | 258 ----------- .../share/classes/sun/nio/cs/ext/IBM918.java | 336 -------------- .../share/classes/sun/nio/cs/ext/IBM921.java | 266 ----------- .../share/classes/sun/nio/cs/ext/IBM922.java | 262 ----------- .../classes/sun/nio/cs/ext/ISO_8859_11.java | 215 --------- .../classes/sun/nio/cs/ext/ISO_8859_3.java | 243 ---------- .../classes/sun/nio/cs/ext/ISO_8859_6.java | 246 ---------- .../classes/sun/nio/cs/ext/ISO_8859_8.java | 259 ----------- .../share/classes/sun/nio/cs/ext/MS1255.java | 333 -------------- .../share/classes/sun/nio/cs/ext/MS1256.java | 334 -------------- .../share/classes/sun/nio/cs/ext/MS1258.java | 340 -------------- .../share/classes/sun/nio/cs/ext/MS874.java | 267 ----------- .../classes/sun/nio/cs/ext/MacArabic.java | 279 ----------- .../sun/nio/cs/ext/MacCentralEurope.java | 346 -------------- .../classes/sun/nio/cs/ext/MacCroatian.java | 402 ---------------- .../classes/sun/nio/cs/ext/MacCyrillic.java | 361 --------------- .../classes/sun/nio/cs/ext/MacDingbat.java | 316 ------------- .../classes/sun/nio/cs/ext/MacGreek.java | 327 ------------- .../classes/sun/nio/cs/ext/MacHebrew.java | 289 ------------ .../classes/sun/nio/cs/ext/MacIceland.java | 402 ---------------- .../classes/sun/nio/cs/ext/MacRoman.java | 434 ------------------ .../classes/sun/nio/cs/ext/MacRomania.java | 402 ---------------- .../classes/sun/nio/cs/ext/MacSymbol.java | 425 ----------------- .../share/classes/sun/nio/cs/ext/MacThai.java | 338 -------------- .../classes/sun/nio/cs/ext/MacTurkish.java | 402 ---------------- .../classes/sun/nio/cs/ext/MacUkraine.java | 361 --------------- .../share/classes/sun/nio/cs/ext/TIS_620.java | 244 ---------- 259 files changed, 25853 insertions(+), 27446 deletions(-) create mode 100644 jdk/make/tools/CharsetMapping/IBM037.c2b create mode 100644 jdk/make/tools/CharsetMapping/IBM037.map create mode 100644 jdk/make/tools/CharsetMapping/IBM037.nr create mode 100644 jdk/make/tools/CharsetMapping/IBM1006.map create mode 100644 jdk/make/tools/CharsetMapping/IBM1025.c2b create mode 100644 jdk/make/tools/CharsetMapping/IBM1025.map create mode 100644 jdk/make/tools/CharsetMapping/IBM1025.nr create mode 100644 jdk/make/tools/CharsetMapping/IBM1026.c2b create mode 100644 jdk/make/tools/CharsetMapping/IBM1026.map create mode 100644 jdk/make/tools/CharsetMapping/IBM1026.nr create mode 100644 jdk/make/tools/CharsetMapping/IBM1046.map create mode 100644 jdk/make/tools/CharsetMapping/IBM1047.map create mode 100644 jdk/make/tools/CharsetMapping/IBM1097.map create mode 100644 jdk/make/tools/CharsetMapping/IBM1098.map create mode 100644 jdk/make/tools/CharsetMapping/IBM1112.c2b create mode 100644 jdk/make/tools/CharsetMapping/IBM1112.map create mode 100644 jdk/make/tools/CharsetMapping/IBM1112.nr create mode 100644 jdk/make/tools/CharsetMapping/IBM1122.c2b create mode 100644 jdk/make/tools/CharsetMapping/IBM1122.map create mode 100644 jdk/make/tools/CharsetMapping/IBM1122.nr create mode 100644 jdk/make/tools/CharsetMapping/IBM1123.c2b create mode 100644 jdk/make/tools/CharsetMapping/IBM1123.map create mode 100644 jdk/make/tools/CharsetMapping/IBM1123.nr create mode 100644 jdk/make/tools/CharsetMapping/IBM1124.map create mode 100644 jdk/make/tools/CharsetMapping/IBM1140.c2b create mode 100644 jdk/make/tools/CharsetMapping/IBM1140.map create mode 100644 jdk/make/tools/CharsetMapping/IBM1141.c2b create mode 100644 jdk/make/tools/CharsetMapping/IBM1141.map create mode 100644 jdk/make/tools/CharsetMapping/IBM1142.c2b create mode 100644 jdk/make/tools/CharsetMapping/IBM1142.map create mode 100644 jdk/make/tools/CharsetMapping/IBM1143.c2b create mode 100644 jdk/make/tools/CharsetMapping/IBM1143.map create mode 100644 jdk/make/tools/CharsetMapping/IBM1144.c2b create mode 100644 jdk/make/tools/CharsetMapping/IBM1144.map create mode 100644 jdk/make/tools/CharsetMapping/IBM1145.c2b create mode 100644 jdk/make/tools/CharsetMapping/IBM1145.map create mode 100644 jdk/make/tools/CharsetMapping/IBM1146.c2b create mode 100644 jdk/make/tools/CharsetMapping/IBM1146.map create mode 100644 jdk/make/tools/CharsetMapping/IBM1147.c2b create mode 100644 jdk/make/tools/CharsetMapping/IBM1147.map create mode 100644 jdk/make/tools/CharsetMapping/IBM1148.c2b create mode 100644 jdk/make/tools/CharsetMapping/IBM1148.map create mode 100644 jdk/make/tools/CharsetMapping/IBM1149.c2b create mode 100644 jdk/make/tools/CharsetMapping/IBM1149.map create mode 100644 jdk/make/tools/CharsetMapping/IBM273.c2b create mode 100644 jdk/make/tools/CharsetMapping/IBM273.map create mode 100644 jdk/make/tools/CharsetMapping/IBM273.nr create mode 100644 jdk/make/tools/CharsetMapping/IBM277.c2b create mode 100644 jdk/make/tools/CharsetMapping/IBM277.map create mode 100644 jdk/make/tools/CharsetMapping/IBM277.nr create mode 100644 jdk/make/tools/CharsetMapping/IBM278.c2b create mode 100644 jdk/make/tools/CharsetMapping/IBM278.map create mode 100644 jdk/make/tools/CharsetMapping/IBM278.nr create mode 100644 jdk/make/tools/CharsetMapping/IBM280.c2b create mode 100644 jdk/make/tools/CharsetMapping/IBM280.map create mode 100644 jdk/make/tools/CharsetMapping/IBM280.nr create mode 100644 jdk/make/tools/CharsetMapping/IBM284.c2b create mode 100644 jdk/make/tools/CharsetMapping/IBM284.map create mode 100644 jdk/make/tools/CharsetMapping/IBM284.nr create mode 100644 jdk/make/tools/CharsetMapping/IBM285.c2b create mode 100644 jdk/make/tools/CharsetMapping/IBM285.map create mode 100644 jdk/make/tools/CharsetMapping/IBM285.nr create mode 100644 jdk/make/tools/CharsetMapping/IBM297.c2b create mode 100644 jdk/make/tools/CharsetMapping/IBM297.map create mode 100644 jdk/make/tools/CharsetMapping/IBM297.nr create mode 100644 jdk/make/tools/CharsetMapping/IBM420.c2b create mode 100644 jdk/make/tools/CharsetMapping/IBM420.map create mode 100644 jdk/make/tools/CharsetMapping/IBM420.nr create mode 100644 jdk/make/tools/CharsetMapping/IBM424.c2b create mode 100644 jdk/make/tools/CharsetMapping/IBM424.map create mode 100644 jdk/make/tools/CharsetMapping/IBM424.nr create mode 100644 jdk/make/tools/CharsetMapping/IBM437.map create mode 100644 jdk/make/tools/CharsetMapping/IBM500.c2b create mode 100644 jdk/make/tools/CharsetMapping/IBM500.map create mode 100644 jdk/make/tools/CharsetMapping/IBM500.nr create mode 100644 jdk/make/tools/CharsetMapping/IBM737.map create mode 100644 jdk/make/tools/CharsetMapping/IBM775.map create mode 100644 jdk/make/tools/CharsetMapping/IBM838.c2b create mode 100644 jdk/make/tools/CharsetMapping/IBM838.map create mode 100644 jdk/make/tools/CharsetMapping/IBM838.nr create mode 100644 jdk/make/tools/CharsetMapping/IBM850.map create mode 100644 jdk/make/tools/CharsetMapping/IBM852.map create mode 100644 jdk/make/tools/CharsetMapping/IBM855.map create mode 100644 jdk/make/tools/CharsetMapping/IBM856.map create mode 100644 jdk/make/tools/CharsetMapping/IBM857.map create mode 100644 jdk/make/tools/CharsetMapping/IBM858.map create mode 100644 jdk/make/tools/CharsetMapping/IBM860.map create mode 100644 jdk/make/tools/CharsetMapping/IBM861.map create mode 100644 jdk/make/tools/CharsetMapping/IBM862.map create mode 100644 jdk/make/tools/CharsetMapping/IBM863.map create mode 100644 jdk/make/tools/CharsetMapping/IBM864.map create mode 100644 jdk/make/tools/CharsetMapping/IBM865.map create mode 100644 jdk/make/tools/CharsetMapping/IBM866.map create mode 100644 jdk/make/tools/CharsetMapping/IBM868.map create mode 100644 jdk/make/tools/CharsetMapping/IBM869.map create mode 100644 jdk/make/tools/CharsetMapping/IBM870.c2b create mode 100644 jdk/make/tools/CharsetMapping/IBM870.map create mode 100644 jdk/make/tools/CharsetMapping/IBM870.nr create mode 100644 jdk/make/tools/CharsetMapping/IBM871.c2b create mode 100644 jdk/make/tools/CharsetMapping/IBM871.map create mode 100644 jdk/make/tools/CharsetMapping/IBM871.nr create mode 100644 jdk/make/tools/CharsetMapping/IBM874.map create mode 100644 jdk/make/tools/CharsetMapping/IBM874.nr create mode 100644 jdk/make/tools/CharsetMapping/IBM875.c2b create mode 100644 jdk/make/tools/CharsetMapping/IBM875.map create mode 100644 jdk/make/tools/CharsetMapping/IBM875.nr create mode 100644 jdk/make/tools/CharsetMapping/IBM918.c2b create mode 100644 jdk/make/tools/CharsetMapping/IBM918.map create mode 100644 jdk/make/tools/CharsetMapping/IBM918.nr create mode 100644 jdk/make/tools/CharsetMapping/IBM921.map create mode 100644 jdk/make/tools/CharsetMapping/IBM922.map create mode 100644 jdk/make/tools/CharsetMapping/ISO_8859_11.map create mode 100644 jdk/make/tools/CharsetMapping/ISO_8859_13.map create mode 100644 jdk/make/tools/CharsetMapping/ISO_8859_15.map create mode 100644 jdk/make/tools/CharsetMapping/ISO_8859_2.map create mode 100644 jdk/make/tools/CharsetMapping/ISO_8859_3.map create mode 100644 jdk/make/tools/CharsetMapping/ISO_8859_4.map create mode 100644 jdk/make/tools/CharsetMapping/ISO_8859_5.map create mode 100644 jdk/make/tools/CharsetMapping/ISO_8859_6.map create mode 100644 jdk/make/tools/CharsetMapping/ISO_8859_7.map create mode 100644 jdk/make/tools/CharsetMapping/ISO_8859_8.map create mode 100644 jdk/make/tools/CharsetMapping/ISO_8859_9.map create mode 100644 jdk/make/tools/CharsetMapping/JIS_X_0201.map create mode 100644 jdk/make/tools/CharsetMapping/KOI8_R.map create mode 100644 jdk/make/tools/CharsetMapping/KOI8_U.map create mode 100644 jdk/make/tools/CharsetMapping/MS1250.map create mode 100644 jdk/make/tools/CharsetMapping/MS1251.map create mode 100644 jdk/make/tools/CharsetMapping/MS1252.map create mode 100644 jdk/make/tools/CharsetMapping/MS1253.map create mode 100644 jdk/make/tools/CharsetMapping/MS1254.map create mode 100644 jdk/make/tools/CharsetMapping/MS1255.map create mode 100644 jdk/make/tools/CharsetMapping/MS1256.map create mode 100644 jdk/make/tools/CharsetMapping/MS1257.map create mode 100644 jdk/make/tools/CharsetMapping/MS1258.map create mode 100644 jdk/make/tools/CharsetMapping/MS874.map create mode 100644 jdk/make/tools/CharsetMapping/MacArabic.map create mode 100644 jdk/make/tools/CharsetMapping/MacCentralEurope.map create mode 100644 jdk/make/tools/CharsetMapping/MacCroatian.map create mode 100644 jdk/make/tools/CharsetMapping/MacCyrillic.map create mode 100644 jdk/make/tools/CharsetMapping/MacDingbat.map create mode 100644 jdk/make/tools/CharsetMapping/MacGreek.map create mode 100644 jdk/make/tools/CharsetMapping/MacHebrew.map create mode 100644 jdk/make/tools/CharsetMapping/MacIceland.map create mode 100644 jdk/make/tools/CharsetMapping/MacRoman.map create mode 100644 jdk/make/tools/CharsetMapping/MacRomania.map create mode 100644 jdk/make/tools/CharsetMapping/MacSymbol.map create mode 100644 jdk/make/tools/CharsetMapping/MacThai.map create mode 100644 jdk/make/tools/CharsetMapping/MacTurkish.map create mode 100644 jdk/make/tools/CharsetMapping/MacUkraine.map create mode 100644 jdk/make/tools/CharsetMapping/SingleByte-X.java create mode 100644 jdk/make/tools/CharsetMapping/TIS_620.map create mode 100644 jdk/make/tools/CharsetMapping/extsbcs create mode 100644 jdk/make/tools/CharsetMapping/sbcs create mode 100644 jdk/make/tools/src/build/tools/charsetmapping/GenerateSBCS.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/IBM437.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/IBM737.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/IBM775.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/IBM850.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/IBM852.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/IBM855.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/IBM857.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/IBM858.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/IBM862.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/IBM866.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/IBM874.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ISO_8859_13.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ISO_8859_15.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ISO_8859_2.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ISO_8859_4.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ISO_8859_5.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ISO_8859_7.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ISO_8859_9.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/KOI8_R.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/KOI8_U.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/MS1250.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/MS1251.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/MS1252.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/MS1253.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/MS1254.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/MS1257.java create mode 100644 jdk/src/share/classes/sun/nio/cs/SingleByte.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM037.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM1006.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM1025.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM1026.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM1046.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM1047.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM1097.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM1098.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM1112.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM1122.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM1123.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM1124.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM1140.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM1141.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM1142.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM1143.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM1144.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM1145.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM1146.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM1147.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM1148.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM1149.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM273.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM277.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM278.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM280.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM284.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM285.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM297.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM420.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM424.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM500.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM838.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM856.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM860.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM861.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM863.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM864.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM865.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM868.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM869.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM870.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM871.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM875.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM918.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM921.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/IBM922.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/ISO_8859_11.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/ISO_8859_3.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/ISO_8859_6.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/ISO_8859_8.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/MS1255.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/MS1256.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/MS1258.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/MS874.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/MacArabic.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/MacCentralEurope.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/MacCroatian.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/MacCyrillic.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/MacDingbat.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/MacGreek.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/MacHebrew.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/MacIceland.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/MacRoman.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/MacRomania.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/MacSymbol.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/MacThai.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/MacTurkish.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/MacUkraine.java delete mode 100644 jdk/src/share/classes/sun/nio/cs/ext/TIS_620.java diff --git a/jdk/make/java/nio/FILES_java.gmk b/jdk/make/java/nio/FILES_java.gmk index 0e8c70906aa..29f1f8f42c4 100644 --- a/jdk/make/java/nio/FILES_java.gmk +++ b/jdk/make/java/nio/FILES_java.gmk @@ -113,8 +113,7 @@ FILES_src = \ sun/nio/cs/FastCharsetProvider.java \ sun/nio/cs/HistoricallyNamedCharset.java \ sun/nio/cs/ISO_8859_1.java \ - sun/nio/cs/ISO_8859_15.java \ - sun/nio/cs/MS1252.java \ + sun/nio/cs/SingleByte.java \ sun/nio/cs/SingleByteDecoder.java \ sun/nio/cs/SingleByteEncoder.java \ sun/nio/cs/StreamEncoder.java \ @@ -268,6 +267,34 @@ FILES_gen_ex = \ java/nio/charset/IllegalCharsetNameException.java \ java/nio/charset/UnsupportedCharsetException.java +FILES_gen_sbcs = \ + sun/nio/cs/ISO_8859_2.java \ + sun/nio/cs/ISO_8859_4.java \ + sun/nio/cs/ISO_8859_5.java \ + sun/nio/cs/ISO_8859_7.java \ + sun/nio/cs/ISO_8859_9.java \ + sun/nio/cs/ISO_8859_13.java \ + sun/nio/cs/ISO_8859_15.java \ + sun/nio/cs/IBM437.java \ + sun/nio/cs/IBM737.java \ + sun/nio/cs/IBM775.java \ + sun/nio/cs/IBM850.java \ + sun/nio/cs/IBM852.java \ + sun/nio/cs/IBM855.java \ + sun/nio/cs/IBM857.java \ + sun/nio/cs/IBM858.java \ + sun/nio/cs/IBM862.java \ + sun/nio/cs/IBM866.java \ + sun/nio/cs/IBM874.java \ + sun/nio/cs/KOI8_R.java \ + sun/nio/cs/KOI8_U.java \ + sun/nio/cs/MS1250.java \ + sun/nio/cs/MS1251.java \ + sun/nio/cs/MS1252.java \ + sun/nio/cs/MS1253.java \ + sun/nio/cs/MS1254.java \ + sun/nio/cs/MS1257.java + FILES_gen_csp = sun/nio/cs/StandardCharsets.java FILES_gen_sor = sun/nio/ch/SocketOptionRegistry.java @@ -275,4 +302,4 @@ FILES_gen_sor = sun/nio/ch/SocketOptionRegistry.java FILES_gen = $(FILES_gen_coder) $(FILES_gen_buffer) $(FILES_gen_ex) \ $(FILES_gen_csp) $(FILES_gen_sor) -FILES_java = $(FILES_src) $(FILES_gen) +FILES_java = $(FILES_src) $(FILES_gen) $(FILES_gen_sbcs) diff --git a/jdk/make/java/nio/Makefile b/jdk/make/java/nio/Makefile index 26c2f2fc68d..bf7bc2e0236 100644 --- a/jdk/make/java/nio/Makefile +++ b/jdk/make/java/nio/Makefile @@ -182,7 +182,9 @@ CS_GEN=$(NIO_GEN)/charset SCH_GEN=$(SNIO_GEN)/ch SCS_GEN=$(SNIO_GEN)/cs -sources: $(SPP_JARFILE) $(FILES_genout) +FILES_gensbcs_out = $(FILES_gen_sbcs:%.java=$(GENSRCDIR)/%.java) + +sources: $(SPP_JARFILE) $(FILES_genout) $(FILES_gensbcs_out) # # Generated buffer classes @@ -657,4 +659,15 @@ $(SCH_GEN)/SocketOptionRegistry.java: $(GENSOR_EXE) NAWK="$(NAWK)" SH="$(SH)" $(SH) -e addNotices.sh $(SOR_COPYRIGHT_YEARS) > $@ $(GENSOR_EXE) >> $@ +# +# Generated sun.nio.cs SingleByte classes +# +GENCSSRC = $(BUILDDIR)/tools/CharsetMapping +CHARSETMAPPING_JARFILE = $(BUILDTOOLJARDIR)/charsetmapping.jar + +$(FILES_gensbcs_out): $(GENCSSRC)/SingleByte-X.java $(GENCSSRC)/sbcs + @$(prep-target) + $(BOOT_JAVA_CMD) -cp $(CHARSETMAPPING_JARFILE) build.tools.charsetmapping.GenerateSBCS \ + $(GENCSSRC) $(SCS_GEN) sbcs + .PHONY: sources diff --git a/jdk/make/sun/nio/FILES_java.gmk b/jdk/make/sun/nio/FILES_java.gmk index 21a95a8cffd..250c8a812fe 100644 --- a/jdk/make/sun/nio/FILES_java.gmk +++ b/jdk/make/sun/nio/FILES_java.gmk @@ -29,7 +29,7 @@ # Core character converters are built from make/java/java. # -FILES_java = \ +FILES_src = \ sun/io/ByteToCharDoubleByte.java \ sun/io/ByteToCharDBCS_ASCII.java \ sun/io/ByteToCharDBCS_EBCDIC.java \ @@ -303,3 +303,77 @@ FILES_java = \ sun/io/CharToByteMacTurkish.java \ sun/io/CharToByteMacUkraine.java \ sun/io/CharToByteTIS620.java + +FILES_gen_extsbcs = \ + sun/nio/cs/ext/IBM037.java \ + sun/nio/cs/ext/IBM1006.java \ + sun/nio/cs/ext/IBM1025.java \ + sun/nio/cs/ext/IBM1026.java \ + sun/nio/cs/ext/IBM1046.java \ + sun/nio/cs/ext/IBM1047.java \ + sun/nio/cs/ext/IBM1097.java \ + sun/nio/cs/ext/IBM1098.java \ + sun/nio/cs/ext/IBM1112.java \ + sun/nio/cs/ext/IBM1122.java \ + sun/nio/cs/ext/IBM1123.java \ + sun/nio/cs/ext/IBM1124.java \ + sun/nio/cs/ext/IBM1140.java \ + sun/nio/cs/ext/IBM1141.java \ + sun/nio/cs/ext/IBM1142.java \ + sun/nio/cs/ext/IBM1143.java \ + sun/nio/cs/ext/IBM1144.java \ + sun/nio/cs/ext/IBM1145.java \ + sun/nio/cs/ext/IBM1146.java \ + sun/nio/cs/ext/IBM1147.java \ + sun/nio/cs/ext/IBM1148.java \ + sun/nio/cs/ext/IBM1149.java \ + sun/nio/cs/ext/IBM273.java \ + sun/nio/cs/ext/IBM277.java \ + sun/nio/cs/ext/IBM278.java \ + sun/nio/cs/ext/IBM280.java \ + sun/nio/cs/ext/IBM284.java \ + sun/nio/cs/ext/IBM285.java \ + sun/nio/cs/ext/IBM297.java \ + sun/nio/cs/ext/IBM420.java \ + sun/nio/cs/ext/IBM424.java \ + sun/nio/cs/ext/IBM500.java \ + sun/nio/cs/ext/IBM838.java \ + sun/nio/cs/ext/IBM856.java \ + sun/nio/cs/ext/IBM860.java \ + sun/nio/cs/ext/IBM861.java \ + sun/nio/cs/ext/IBM863.java \ + sun/nio/cs/ext/IBM864.java \ + sun/nio/cs/ext/IBM865.java \ + sun/nio/cs/ext/IBM868.java \ + sun/nio/cs/ext/IBM869.java \ + sun/nio/cs/ext/IBM870.java \ + sun/nio/cs/ext/IBM871.java \ + sun/nio/cs/ext/IBM875.java \ + sun/nio/cs/ext/IBM918.java \ + sun/nio/cs/ext/IBM921.java \ + sun/nio/cs/ext/IBM922.java \ + sun/nio/cs/ext/ISO_8859_11.java \ + sun/nio/cs/ext/ISO_8859_3.java \ + sun/nio/cs/ext/ISO_8859_6.java \ + sun/nio/cs/ext/ISO_8859_8.java \ + sun/nio/cs/ext/MS1255.java \ + sun/nio/cs/ext/MS1256.java \ + sun/nio/cs/ext/MS1258.java \ + sun/nio/cs/ext/MS874.java \ + sun/nio/cs/ext/MacArabic.java \ + sun/nio/cs/ext/MacCentralEurope.java \ + sun/nio/cs/ext/MacCroatian.java \ + sun/nio/cs/ext/MacCyrillic.java \ + sun/nio/cs/ext/MacDingbat.java \ + sun/nio/cs/ext/MacGreek.java \ + sun/nio/cs/ext/MacHebrew.java \ + sun/nio/cs/ext/MacIceland.java \ + sun/nio/cs/ext/MacRoman.java \ + sun/nio/cs/ext/MacRomania.java \ + sun/nio/cs/ext/MacSymbol.java \ + sun/nio/cs/ext/MacThai.java \ + sun/nio/cs/ext/MacTurkish.java \ + sun/nio/cs/ext/MacUkraine.java \ + sun/nio/cs/ext/TIS_620.java + +FILES_java = $(FILES_src) $(FILES_gen_extsbcs) \ No newline at end of file diff --git a/jdk/make/sun/nio/Makefile b/jdk/make/sun/nio/Makefile index 8dd1f98ccfb..f149b8510ce 100644 --- a/jdk/make/sun/nio/Makefile +++ b/jdk/make/sun/nio/Makefile @@ -60,12 +60,15 @@ endif # PLATFORM # this define is for the rule: CHARSETS_JAR = $(LIBDIR)/charsets.jar +# extsbcs +FILES_genout_extsbcs = $(FILES_gen_extsbcs:%.java=$(GENSRCDIR)/%.java) + # # Rules # include $(BUILDDIR)/common/Classes.gmk -build: $(CHARSETS_JAR) +build: $(FILES_genout_extsbcs) $(CHARSETS_JAR) # # Extra rules to build character converters. @@ -74,6 +77,8 @@ SERVICE_DESCRIPTION = java.nio.charset.spi.CharsetProvider SERVICE_DESCRIPTION_PATH = META-INF/services/$(SERVICE_DESCRIPTION) GENCSDATASRC = $(BUILDDIR)/tools/CharsetMapping +GENCSEXT = $(GENSRCDIR)/sun/nio/cs/ext + FILES_MAP = $(GENCSDATASRC)/sjis0213.map FILES_DAT = $(CLASSDESTDIR)/sun/nio/cs/ext/sjis0213.dat CHARSETMAPPING_JARFILE = $(BUILDTOOLJARDIR)/charsetmapping.jar @@ -83,6 +88,15 @@ $(FILES_DAT): $(FILES_MAP) $(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) \ $(FILES_MAP) $(FILES_DAT) + +$(FILES_genout_extsbcs): $(GENCSDATASRC)/SingleByte-X.java $(GENCSDATASRC)/extsbcs + @$(prep-target) + $(RM) -r $(GENCSEXT) + $(MKDIR) -p $(GENCSEXT) + $(BOOT_JAVA_CMD) -cp $(CHARSETMAPPING_JARFILE) build.tools.charsetmapping.GenerateSBCS \ + $(GENCSDATASRC) $(GENCSEXT) extsbcs + + $(CLASSDESTDIR)/$(SERVICE_DESCRIPTION_PATH): \ $(SHARE_SRC)/classes/sun/nio/cs/ext/$(SERVICE_DESCRIPTION_PATH) $(install-file) diff --git a/jdk/make/tools/CharsetMapping/IBM037.c2b b/jdk/make/tools/CharsetMapping/IBM037.c2b new file mode 100644 index 00000000000..6cb38028124 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM037.c2b @@ -0,0 +1 @@ +0x15 U+0085 diff --git a/jdk/make/tools/CharsetMapping/IBM037.map b/jdk/make/tools/CharsetMapping/IBM037.map new file mode 100644 index 00000000000..f542aa42d29 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM037.map @@ -0,0 +1,257 @@ +#Generated from IBM037.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+009c +0x05 U+0009 +0x06 U+0086 +0x07 U+007f +0x08 U+0097 +0x09 U+008d +0x0a U+008e +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+009d +0x15 U+000a +0x16 U+0008 +0x17 U+0087 +0x18 U+0018 +0x19 U+0019 +0x1a U+0092 +0x1b U+008f +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0080 +0x21 U+0081 +0x22 U+0082 +0x23 U+0083 +0x24 U+0084 +0x25 U+000a +0x26 U+0017 +0x27 U+001b +0x28 U+0088 +0x29 U+0089 +0x2a U+008a +0x2b U+008b +0x2c U+008c +0x2d U+0005 +0x2e U+0006 +0x2f U+0007 +0x30 U+0090 +0x31 U+0091 +0x32 U+0016 +0x33 U+0093 +0x34 U+0094 +0x35 U+0095 +0x36 U+0096 +0x37 U+0004 +0x38 U+0098 +0x39 U+0099 +0x3a U+009a +0x3b U+009b +0x3c U+0014 +0x3d U+0015 +0x3e U+009e +0x3f U+001a +0x40 U+0020 +0x41 U+00a0 +0x42 U+00e2 +0x43 U+00e4 +0x44 U+00e0 +0x45 U+00e1 +0x46 U+00e3 +0x47 U+00e5 +0x48 U+00e7 +0x49 U+00f1 +0x4a U+00a2 +0x4b U+002e +0x4c U+003c +0x4d U+0028 +0x4e U+002b +0x4f U+007c +0x50 U+0026 +0x51 U+00e9 +0x52 U+00ea +0x53 U+00eb +0x54 U+00e8 +0x55 U+00ed +0x56 U+00ee +0x57 U+00ef +0x58 U+00ec +0x59 U+00df +0x5a U+0021 +0x5b U+0024 +0x5c U+002a +0x5d U+0029 +0x5e U+003b +0x5f U+00ac +0x60 U+002d +0x61 U+002f +0x62 U+00c2 +0x63 U+00c4 +0x64 U+00c0 +0x65 U+00c1 +0x66 U+00c3 +0x67 U+00c5 +0x68 U+00c7 +0x69 U+00d1 +0x6a U+00a6 +0x6b U+002c +0x6c U+0025 +0x6d U+005f +0x6e U+003e +0x6f U+003f +0x70 U+00f8 +0x71 U+00c9 +0x72 U+00ca +0x73 U+00cb +0x74 U+00c8 +0x75 U+00cd +0x76 U+00ce +0x77 U+00cf +0x78 U+00cc +0x79 U+0060 +0x7a U+003a +0x7b U+0023 +0x7c U+0040 +0x7d U+0027 +0x7e U+003d +0x7f U+0022 +0x80 U+00d8 +0x81 U+0061 +0x82 U+0062 +0x83 U+0063 +0x84 U+0064 +0x85 U+0065 +0x86 U+0066 +0x87 U+0067 +0x88 U+0068 +0x89 U+0069 +0x8a U+00ab +0x8b U+00bb +0x8c U+00f0 +0x8d U+00fd +0x8e U+00fe +0x8f U+00b1 +0x90 U+00b0 +0x91 U+006a +0x92 U+006b +0x93 U+006c +0x94 U+006d +0x95 U+006e +0x96 U+006f +0x97 U+0070 +0x98 U+0071 +0x99 U+0072 +0x9a U+00aa +0x9b U+00ba +0x9c U+00e6 +0x9d U+00b8 +0x9e U+00c6 +0x9f U+00a4 +0xa0 U+00b5 +0xa1 U+007e +0xa2 U+0073 +0xa3 U+0074 +0xa4 U+0075 +0xa5 U+0076 +0xa6 U+0077 +0xa7 U+0078 +0xa8 U+0079 +0xa9 U+007a +0xaa U+00a1 +0xab U+00bf +0xac U+00d0 +0xad U+00dd +0xae U+00de +0xaf U+00ae +0xb0 U+005e +0xb1 U+00a3 +0xb2 U+00a5 +0xb3 U+00b7 +0xb4 U+00a9 +0xb5 U+00a7 +0xb6 U+00b6 +0xb7 U+00bc +0xb8 U+00bd +0xb9 U+00be +0xba U+005b +0xbb U+005d +0xbc U+00af +0xbd U+00a8 +0xbe U+00b4 +0xbf U+00d7 +0xc0 U+007b +0xc1 U+0041 +0xc2 U+0042 +0xc3 U+0043 +0xc4 U+0044 +0xc5 U+0045 +0xc6 U+0046 +0xc7 U+0047 +0xc8 U+0048 +0xc9 U+0049 +0xca U+00ad +0xcb U+00f4 +0xcc U+00f6 +0xcd U+00f2 +0xce U+00f3 +0xcf U+00f5 +0xd0 U+007d +0xd1 U+004a +0xd2 U+004b +0xd3 U+004c +0xd4 U+004d +0xd5 U+004e +0xd6 U+004f +0xd7 U+0050 +0xd8 U+0051 +0xd9 U+0052 +0xda U+00b9 +0xdb U+00fb +0xdc U+00fc +0xdd U+00f9 +0xde U+00fa +0xdf U+00ff +0xe0 U+005c +0xe1 U+00f7 +0xe2 U+0053 +0xe3 U+0054 +0xe4 U+0055 +0xe5 U+0056 +0xe6 U+0057 +0xe7 U+0058 +0xe8 U+0059 +0xe9 U+005a +0xea U+00b2 +0xeb U+00d4 +0xec U+00d6 +0xed U+00d2 +0xee U+00d3 +0xef U+00d5 +0xf0 U+0030 +0xf1 U+0031 +0xf2 U+0032 +0xf3 U+0033 +0xf4 U+0034 +0xf5 U+0035 +0xf6 U+0036 +0xf7 U+0037 +0xf8 U+0038 +0xf9 U+0039 +0xfa U+00b3 +0xfb U+00db +0xfc U+00dc +0xfd U+00d9 +0xfe U+00da +0xff U+009f diff --git a/jdk/make/tools/CharsetMapping/IBM037.nr b/jdk/make/tools/CharsetMapping/IBM037.nr new file mode 100644 index 00000000000..675451906d4 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM037.nr @@ -0,0 +1 @@ +0x25 U+000a diff --git a/jdk/make/tools/CharsetMapping/IBM1006.map b/jdk/make/tools/CharsetMapping/IBM1006.map new file mode 100644 index 00000000000..9ae5537d4b3 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1006.map @@ -0,0 +1,257 @@ +#Generated from IBM1006.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+0080 +0x81 U+0081 +0x82 U+0082 +0x83 U+0083 +0x84 U+0084 +0x85 U+0085 +0x86 U+0086 +0x87 U+0087 +0x88 U+0088 +0x89 U+0089 +0x8a U+008a +0x8b U+008b +0x8c U+008c +0x8d U+008d +0x8e U+008e +0x8f U+008f +0x90 U+0090 +0x91 U+0091 +0x92 U+0092 +0x93 U+0093 +0x94 U+0094 +0x95 U+0095 +0x96 U+0096 +0x97 U+0097 +0x98 U+0098 +0x99 U+0099 +0x9a U+009a +0x9b U+009b +0x9c U+009c +0x9d U+009d +0x9e U+009e +0x9f U+009f +0xa0 U+00a0 +0xa1 U+06f0 +0xa2 U+06f1 +0xa3 U+06f2 +0xa4 U+06f3 +0xa5 U+06f4 +0xa6 U+06f5 +0xa7 U+06f6 +0xa8 U+06f7 +0xa9 U+06f8 +0xaa U+06f9 +0xab U+060c +0xac U+061b +0xad U+00ad +0xae U+061f +0xaf U+fe81 +0xb0 U+fe8d +0xb1 U+fe8e +0xb2 U+f8fb +0xb3 U+fe8f +0xb4 U+fe91 +0xb5 U+fb56 +0xb6 U+fb58 +0xb7 U+fe93 +0xb8 U+fe95 +0xb9 U+fe97 +0xba U+fb66 +0xbb U+fb68 +0xbc U+fe99 +0xbd U+fe9b +0xbe U+fe9d +0xbf U+fe9f +0xc0 U+fb7a +0xc1 U+fb7c +0xc2 U+fea1 +0xc3 U+fea3 +0xc4 U+fea5 +0xc5 U+fea7 +0xc6 U+fea9 +0xc7 U+fb88 +0xc8 U+feab +0xc9 U+fead +0xca U+fb8c +0xcb U+feaf +0xcc U+fb8a +0xcd U+feb1 +0xce U+feb3 +0xcf U+feb5 +0xd0 U+feb7 +0xd1 U+feb9 +0xd2 U+febb +0xd3 U+febd +0xd4 U+febf +0xd5 U+fec3 +0xd6 U+fec7 +0xd7 U+fec9 +0xd8 U+feca +0xd9 U+fecb +0xda U+fecc +0xdb U+fecd +0xdc U+fece +0xdd U+fecf +0xde U+fed0 +0xdf U+fed1 +0xe0 U+fed3 +0xe1 U+fed5 +0xe2 U+fed7 +0xe3 U+fb8e +0xe4 U+fedb +0xe5 U+fb92 +0xe6 U+fb94 +0xe7 U+fedd +0xe8 U+fedf +0xe9 U+fee0 +0xea U+fee1 +0xeb U+fee3 +0xec U+fb9e +0xed U+fee5 +0xee U+fee7 +0xef U+fe85 +0xf0 U+feed +0xf1 U+fba6 +0xf2 U+fba8 +0xf3 U+fba9 +0xf4 U+fbaa +0xf5 U+fe80 +0xf6 U+fe89 +0xf7 U+fe8a +0xf8 U+fe8b +0xf9 U+fbfc +0xfa U+fbfd +0xfb U+fbfe +0xfc U+fbb0 +0xfd U+fbae +0xfe U+fe7c +0xff U+fe7d diff --git a/jdk/make/tools/CharsetMapping/IBM1025.c2b b/jdk/make/tools/CharsetMapping/IBM1025.c2b new file mode 100644 index 00000000000..6cb38028124 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1025.c2b @@ -0,0 +1 @@ +0x15 U+0085 diff --git a/jdk/make/tools/CharsetMapping/IBM1025.map b/jdk/make/tools/CharsetMapping/IBM1025.map new file mode 100644 index 00000000000..e56dbe08107 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1025.map @@ -0,0 +1,257 @@ +#Generated from IBM1025.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+009c +0x05 U+0009 +0x06 U+0086 +0x07 U+007f +0x08 U+0097 +0x09 U+008d +0x0a U+008e +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+009d +0x15 U+000a +0x16 U+0008 +0x17 U+0087 +0x18 U+0018 +0x19 U+0019 +0x1a U+0092 +0x1b U+008f +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0080 +0x21 U+0081 +0x22 U+0082 +0x23 U+0083 +0x24 U+0084 +0x25 U+000a +0x26 U+0017 +0x27 U+001b +0x28 U+0088 +0x29 U+0089 +0x2a U+008a +0x2b U+008b +0x2c U+008c +0x2d U+0005 +0x2e U+0006 +0x2f U+0007 +0x30 U+0090 +0x31 U+0091 +0x32 U+0016 +0x33 U+0093 +0x34 U+0094 +0x35 U+0095 +0x36 U+0096 +0x37 U+0004 +0x38 U+0098 +0x39 U+0099 +0x3a U+009a +0x3b U+009b +0x3c U+0014 +0x3d U+0015 +0x3e U+009e +0x3f U+001a +0x40 U+0020 +0x41 U+00a0 +0x42 U+0452 +0x43 U+0453 +0x44 U+0451 +0x45 U+0454 +0x46 U+0455 +0x47 U+0456 +0x48 U+0457 +0x49 U+0458 +0x4a U+005b +0x4b U+002e +0x4c U+003c +0x4d U+0028 +0x4e U+002b +0x4f U+0021 +0x50 U+0026 +0x51 U+0459 +0x52 U+045a +0x53 U+045b +0x54 U+045c +0x55 U+045e +0x56 U+045f +0x57 U+042a +0x58 U+2116 +0x59 U+0402 +0x5a U+005d +0x5b U+0024 +0x5c U+002a +0x5d U+0029 +0x5e U+003b +0x5f U+005e +0x60 U+002d +0x61 U+002f +0x62 U+0403 +0x63 U+0401 +0x64 U+0404 +0x65 U+0405 +0x66 U+0406 +0x67 U+0407 +0x68 U+0408 +0x69 U+0409 +0x6a U+007c +0x6b U+002c +0x6c U+0025 +0x6d U+005f +0x6e U+003e +0x6f U+003f +0x70 U+040a +0x71 U+040b +0x72 U+040c +0x73 U+00ad +0x74 U+040e +0x75 U+040f +0x76 U+044e +0x77 U+0430 +0x78 U+0431 +0x79 U+0060 +0x7a U+003a +0x7b U+0023 +0x7c U+0040 +0x7d U+0027 +0x7e U+003d +0x7f U+0022 +0x80 U+0446 +0x81 U+0061 +0x82 U+0062 +0x83 U+0063 +0x84 U+0064 +0x85 U+0065 +0x86 U+0066 +0x87 U+0067 +0x88 U+0068 +0x89 U+0069 +0x8a U+0434 +0x8b U+0435 +0x8c U+0444 +0x8d U+0433 +0x8e U+0445 +0x8f U+0438 +0x90 U+0439 +0x91 U+006a +0x92 U+006b +0x93 U+006c +0x94 U+006d +0x95 U+006e +0x96 U+006f +0x97 U+0070 +0x98 U+0071 +0x99 U+0072 +0x9a U+043a +0x9b U+043b +0x9c U+043c +0x9d U+043d +0x9e U+043e +0x9f U+043f +0xa0 U+044f +0xa1 U+007e +0xa2 U+0073 +0xa3 U+0074 +0xa4 U+0075 +0xa5 U+0076 +0xa6 U+0077 +0xa7 U+0078 +0xa8 U+0079 +0xa9 U+007a +0xaa U+0440 +0xab U+0441 +0xac U+0442 +0xad U+0443 +0xae U+0436 +0xaf U+0432 +0xb0 U+044c +0xb1 U+044b +0xb2 U+0437 +0xb3 U+0448 +0xb4 U+044d +0xb5 U+0449 +0xb6 U+0447 +0xb7 U+044a +0xb8 U+042e +0xb9 U+0410 +0xba U+0411 +0xbb U+0426 +0xbc U+0414 +0xbd U+0415 +0xbe U+0424 +0xbf U+0413 +0xc0 U+007b +0xc1 U+0041 +0xc2 U+0042 +0xc3 U+0043 +0xc4 U+0044 +0xc5 U+0045 +0xc6 U+0046 +0xc7 U+0047 +0xc8 U+0048 +0xc9 U+0049 +0xca U+0425 +0xcb U+0418 +0xcc U+0419 +0xcd U+041a +0xce U+041b +0xcf U+041c +0xd0 U+007d +0xd1 U+004a +0xd2 U+004b +0xd3 U+004c +0xd4 U+004d +0xd5 U+004e +0xd6 U+004f +0xd7 U+0050 +0xd8 U+0051 +0xd9 U+0052 +0xda U+041d +0xdb U+041e +0xdc U+041f +0xdd U+042f +0xde U+0420 +0xdf U+0421 +0xe0 U+005c +0xe1 U+00a7 +0xe2 U+0053 +0xe3 U+0054 +0xe4 U+0055 +0xe5 U+0056 +0xe6 U+0057 +0xe7 U+0058 +0xe8 U+0059 +0xe9 U+005a +0xea U+0422 +0xeb U+0423 +0xec U+0416 +0xed U+0412 +0xee U+042c +0xef U+042b +0xf0 U+0030 +0xf1 U+0031 +0xf2 U+0032 +0xf3 U+0033 +0xf4 U+0034 +0xf5 U+0035 +0xf6 U+0036 +0xf7 U+0037 +0xf8 U+0038 +0xf9 U+0039 +0xfa U+0417 +0xfb U+0428 +0xfc U+042d +0xfd U+0429 +0xfe U+0427 +0xff U+009f diff --git a/jdk/make/tools/CharsetMapping/IBM1025.nr b/jdk/make/tools/CharsetMapping/IBM1025.nr new file mode 100644 index 00000000000..675451906d4 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1025.nr @@ -0,0 +1 @@ +0x25 U+000a diff --git a/jdk/make/tools/CharsetMapping/IBM1026.c2b b/jdk/make/tools/CharsetMapping/IBM1026.c2b new file mode 100644 index 00000000000..6cb38028124 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1026.c2b @@ -0,0 +1 @@ +0x15 U+0085 diff --git a/jdk/make/tools/CharsetMapping/IBM1026.map b/jdk/make/tools/CharsetMapping/IBM1026.map new file mode 100644 index 00000000000..56fa74a05b3 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1026.map @@ -0,0 +1,257 @@ +#Generated from IBM1026.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+009c +0x05 U+0009 +0x06 U+0086 +0x07 U+007f +0x08 U+0097 +0x09 U+008d +0x0a U+008e +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+009d +0x15 U+000a +0x16 U+0008 +0x17 U+0087 +0x18 U+0018 +0x19 U+0019 +0x1a U+0092 +0x1b U+008f +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0080 +0x21 U+0081 +0x22 U+0082 +0x23 U+0083 +0x24 U+0084 +0x25 U+000a +0x26 U+0017 +0x27 U+001b +0x28 U+0088 +0x29 U+0089 +0x2a U+008a +0x2b U+008b +0x2c U+008c +0x2d U+0005 +0x2e U+0006 +0x2f U+0007 +0x30 U+0090 +0x31 U+0091 +0x32 U+0016 +0x33 U+0093 +0x34 U+0094 +0x35 U+0095 +0x36 U+0096 +0x37 U+0004 +0x38 U+0098 +0x39 U+0099 +0x3a U+009a +0x3b U+009b +0x3c U+0014 +0x3d U+0015 +0x3e U+009e +0x3f U+001a +0x40 U+0020 +0x41 U+00a0 +0x42 U+00e2 +0x43 U+00e4 +0x44 U+00e0 +0x45 U+00e1 +0x46 U+00e3 +0x47 U+00e5 +0x48 U+007b +0x49 U+00f1 +0x4a U+00c7 +0x4b U+002e +0x4c U+003c +0x4d U+0028 +0x4e U+002b +0x4f U+0021 +0x50 U+0026 +0x51 U+00e9 +0x52 U+00ea +0x53 U+00eb +0x54 U+00e8 +0x55 U+00ed +0x56 U+00ee +0x57 U+00ef +0x58 U+00ec +0x59 U+00df +0x5a U+011e +0x5b U+0130 +0x5c U+002a +0x5d U+0029 +0x5e U+003b +0x5f U+005e +0x60 U+002d +0x61 U+002f +0x62 U+00c2 +0x63 U+00c4 +0x64 U+00c0 +0x65 U+00c1 +0x66 U+00c3 +0x67 U+00c5 +0x68 U+005b +0x69 U+00d1 +0x6a U+015f +0x6b U+002c +0x6c U+0025 +0x6d U+005f +0x6e U+003e +0x6f U+003f +0x70 U+00f8 +0x71 U+00c9 +0x72 U+00ca +0x73 U+00cb +0x74 U+00c8 +0x75 U+00cd +0x76 U+00ce +0x77 U+00cf +0x78 U+00cc +0x79 U+0131 +0x7a U+003a +0x7b U+00d6 +0x7c U+015e +0x7d U+0027 +0x7e U+003d +0x7f U+00dc +0x80 U+00d8 +0x81 U+0061 +0x82 U+0062 +0x83 U+0063 +0x84 U+0064 +0x85 U+0065 +0x86 U+0066 +0x87 U+0067 +0x88 U+0068 +0x89 U+0069 +0x8a U+00ab +0x8b U+00bb +0x8c U+007d +0x8d U+0060 +0x8e U+00a6 +0x8f U+00b1 +0x90 U+00b0 +0x91 U+006a +0x92 U+006b +0x93 U+006c +0x94 U+006d +0x95 U+006e +0x96 U+006f +0x97 U+0070 +0x98 U+0071 +0x99 U+0072 +0x9a U+00aa +0x9b U+00ba +0x9c U+00e6 +0x9d U+00b8 +0x9e U+00c6 +0x9f U+00a4 +0xa0 U+00b5 +0xa1 U+00f6 +0xa2 U+0073 +0xa3 U+0074 +0xa4 U+0075 +0xa5 U+0076 +0xa6 U+0077 +0xa7 U+0078 +0xa8 U+0079 +0xa9 U+007a +0xaa U+00a1 +0xab U+00bf +0xac U+005d +0xad U+0024 +0xae U+0040 +0xaf U+00ae +0xb0 U+00a2 +0xb1 U+00a3 +0xb2 U+00a5 +0xb3 U+00b7 +0xb4 U+00a9 +0xb5 U+00a7 +0xb6 U+00b6 +0xb7 U+00bc +0xb8 U+00bd +0xb9 U+00be +0xba U+00ac +0xbb U+007c +0xbc U+00af +0xbd U+00a8 +0xbe U+00b4 +0xbf U+00d7 +0xc0 U+00e7 +0xc1 U+0041 +0xc2 U+0042 +0xc3 U+0043 +0xc4 U+0044 +0xc5 U+0045 +0xc6 U+0046 +0xc7 U+0047 +0xc8 U+0048 +0xc9 U+0049 +0xca U+00ad +0xcb U+00f4 +0xcc U+007e +0xcd U+00f2 +0xce U+00f3 +0xcf U+00f5 +0xd0 U+011f +0xd1 U+004a +0xd2 U+004b +0xd3 U+004c +0xd4 U+004d +0xd5 U+004e +0xd6 U+004f +0xd7 U+0050 +0xd8 U+0051 +0xd9 U+0052 +0xda U+00b9 +0xdb U+00fb +0xdc U+005c +0xdd U+00f9 +0xde U+00fa +0xdf U+00ff +0xe0 U+00fc +0xe1 U+00f7 +0xe2 U+0053 +0xe3 U+0054 +0xe4 U+0055 +0xe5 U+0056 +0xe6 U+0057 +0xe7 U+0058 +0xe8 U+0059 +0xe9 U+005a +0xea U+00b2 +0xeb U+00d4 +0xec U+0023 +0xed U+00d2 +0xee U+00d3 +0xef U+00d5 +0xf0 U+0030 +0xf1 U+0031 +0xf2 U+0032 +0xf3 U+0033 +0xf4 U+0034 +0xf5 U+0035 +0xf6 U+0036 +0xf7 U+0037 +0xf8 U+0038 +0xf9 U+0039 +0xfa U+00b3 +0xfb U+00db +0xfc U+0022 +0xfd U+00d9 +0xfe U+00da +0xff U+009f diff --git a/jdk/make/tools/CharsetMapping/IBM1026.nr b/jdk/make/tools/CharsetMapping/IBM1026.nr new file mode 100644 index 00000000000..675451906d4 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1026.nr @@ -0,0 +1 @@ +0x25 U+000a diff --git a/jdk/make/tools/CharsetMapping/IBM1046.map b/jdk/make/tools/CharsetMapping/IBM1046.map new file mode 100644 index 00000000000..28a25d772d0 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1046.map @@ -0,0 +1,257 @@ +#Generated from IBM1046.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+fe88 +0x81 U+00d7 +0x82 U+00f7 +0x83 U+f8f6 +0x84 U+f8f5 +0x85 U+f8f4 +0x86 U+f8f7 +0x87 U+fe71 +0x88 U+0088 +0x89 U+25a0 +0x8a U+2502 +0x8b U+2500 +0x8c U+2510 +0x8d U+250c +0x8e U+2514 +0x8f U+2518 +0x90 U+fe79 +0x91 U+fe7b +0x92 U+fe7d +0x93 U+fe7f +0x94 U+fe77 +0x95 U+fe8a +0x96 U+fef0 +0x97 U+fef3 +0x98 U+fef2 +0x99 U+fece +0x9a U+fecf +0x9b U+fed0 +0x9c U+fef6 +0x9d U+fef8 +0x9e U+fefa +0x9f U+fefc +0xa0 U+00a0 +0xa1 U+f8fa +0xa2 U+f8f9 +0xa3 U+f8f8 +0xa4 U+00a4 +0xa5 U+f8fb +0xa6 U+fe8b +0xa7 U+fe91 +0xa8 U+fe97 +0xa9 U+fe9b +0xaa U+fe9f +0xab U+fea3 +0xac U+060c +0xad U+00ad +0xae U+fea7 +0xaf U+feb3 +0xb0 U+0660 +0xb1 U+0661 +0xb2 U+0662 +0xb3 U+0663 +0xb4 U+0664 +0xb5 U+0665 +0xb6 U+0666 +0xb7 U+0667 +0xb8 U+0668 +0xb9 U+0669 +0xba U+feb7 +0xbb U+061b +0xbc U+febb +0xbd U+febf +0xbe U+feca +0xbf U+061f +0xc0 U+fecb +0xc1 U+fe80 +0xc2 U+fe81 +0xc3 U+fe83 +0xc4 U+fe85 +0xc5 U+fe87 +0xc6 U+fe89 +0xc7 U+fe8d +0xc8 U+fe8f +0xc9 U+fe93 +0xca U+fe95 +0xcb U+fe99 +0xcc U+fe9d +0xcd U+fea1 +0xce U+fea5 +0xcf U+fea9 +0xd0 U+feab +0xd1 U+fead +0xd2 U+feaf +0xd3 U+feb1 +0xd4 U+feb5 +0xd5 U+feb9 +0xd6 U+febd +0xd7 U+fec3 +0xd8 U+fec7 +0xd9 U+fec9 +0xda U+fecd +0xdb U+fecc +0xdc U+fe82 +0xdd U+fe84 +0xde U+fe8e +0xdf U+fed3 +0xe0 U+0640 +0xe1 U+fed1 +0xe2 U+fed5 +0xe3 U+fed9 +0xe4 U+fedd +0xe5 U+fee1 +0xe6 U+fee5 +0xe7 U+feeb +0xe8 U+feed +0xe9 U+feef +0xea U+fef1 +0xeb U+fe70 +0xec U+fe72 +0xed U+fe74 +0xee U+fe76 +0xef U+fe78 +0xf0 U+fe7a +0xf1 U+fe7c +0xf2 U+fe7e +0xf3 U+fed7 +0xf4 U+fedb +0xf5 U+fedf +0xf6 U+f8fc +0xf7 U+fef5 +0xf8 U+fef7 +0xf9 U+fef9 +0xfa U+fefb +0xfb U+fee3 +0xfc U+fee7 +0xfd U+feec +0xfe U+fee9 +0xff U+fffd diff --git a/jdk/make/tools/CharsetMapping/IBM1047.map b/jdk/make/tools/CharsetMapping/IBM1047.map new file mode 100644 index 00000000000..fcbae725c89 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1047.map @@ -0,0 +1,257 @@ +#Generated from IBM1047.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+009c +0x05 U+0009 +0x06 U+0086 +0x07 U+007f +0x08 U+0097 +0x09 U+008d +0x0a U+008e +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+009d +0x15 U+000a +0x16 U+0008 +0x17 U+0087 +0x18 U+0018 +0x19 U+0019 +0x1a U+0092 +0x1b U+008f +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0080 +0x21 U+0081 +0x22 U+0082 +0x23 U+0083 +0x24 U+0084 +0x25 U+0085 +0x26 U+0017 +0x27 U+001b +0x28 U+0088 +0x29 U+0089 +0x2a U+008a +0x2b U+008b +0x2c U+008c +0x2d U+0005 +0x2e U+0006 +0x2f U+0007 +0x30 U+0090 +0x31 U+0091 +0x32 U+0016 +0x33 U+0093 +0x34 U+0094 +0x35 U+0095 +0x36 U+0096 +0x37 U+0004 +0x38 U+0098 +0x39 U+0099 +0x3a U+009a +0x3b U+009b +0x3c U+0014 +0x3d U+0015 +0x3e U+009e +0x3f U+001a +0x40 U+0020 +0x41 U+00a0 +0x42 U+00e2 +0x43 U+00e4 +0x44 U+00e0 +0x45 U+00e1 +0x46 U+00e3 +0x47 U+00e5 +0x48 U+00e7 +0x49 U+00f1 +0x4a U+00a2 +0x4b U+002e +0x4c U+003c +0x4d U+0028 +0x4e U+002b +0x4f U+007c +0x50 U+0026 +0x51 U+00e9 +0x52 U+00ea +0x53 U+00eb +0x54 U+00e8 +0x55 U+00ed +0x56 U+00ee +0x57 U+00ef +0x58 U+00ec +0x59 U+00df +0x5a U+0021 +0x5b U+0024 +0x5c U+002a +0x5d U+0029 +0x5e U+003b +0x5f U+005e +0x60 U+002d +0x61 U+002f +0x62 U+00c2 +0x63 U+00c4 +0x64 U+00c0 +0x65 U+00c1 +0x66 U+00c3 +0x67 U+00c5 +0x68 U+00c7 +0x69 U+00d1 +0x6a U+00a6 +0x6b U+002c +0x6c U+0025 +0x6d U+005f +0x6e U+003e +0x6f U+003f +0x70 U+00f8 +0x71 U+00c9 +0x72 U+00ca +0x73 U+00cb +0x74 U+00c8 +0x75 U+00cd +0x76 U+00ce +0x77 U+00cf +0x78 U+00cc +0x79 U+0060 +0x7a U+003a +0x7b U+0023 +0x7c U+0040 +0x7d U+0027 +0x7e U+003d +0x7f U+0022 +0x80 U+00d8 +0x81 U+0061 +0x82 U+0062 +0x83 U+0063 +0x84 U+0064 +0x85 U+0065 +0x86 U+0066 +0x87 U+0067 +0x88 U+0068 +0x89 U+0069 +0x8a U+00ab +0x8b U+00bb +0x8c U+00f0 +0x8d U+00fd +0x8e U+00fe +0x8f U+00b1 +0x90 U+00b0 +0x91 U+006a +0x92 U+006b +0x93 U+006c +0x94 U+006d +0x95 U+006e +0x96 U+006f +0x97 U+0070 +0x98 U+0071 +0x99 U+0072 +0x9a U+00aa +0x9b U+00ba +0x9c U+00e6 +0x9d U+00b8 +0x9e U+00c6 +0x9f U+00a4 +0xa0 U+00b5 +0xa1 U+007e +0xa2 U+0073 +0xa3 U+0074 +0xa4 U+0075 +0xa5 U+0076 +0xa6 U+0077 +0xa7 U+0078 +0xa8 U+0079 +0xa9 U+007a +0xaa U+00a1 +0xab U+00bf +0xac U+00d0 +0xad U+005b +0xae U+00de +0xaf U+00ae +0xb0 U+00ac +0xb1 U+00a3 +0xb2 U+00a5 +0xb3 U+00b7 +0xb4 U+00a9 +0xb5 U+00a7 +0xb6 U+00b6 +0xb7 U+00bc +0xb8 U+00bd +0xb9 U+00be +0xba U+00dd +0xbb U+00a8 +0xbc U+00af +0xbd U+005d +0xbe U+00b4 +0xbf U+00d7 +0xc0 U+007b +0xc1 U+0041 +0xc2 U+0042 +0xc3 U+0043 +0xc4 U+0044 +0xc5 U+0045 +0xc6 U+0046 +0xc7 U+0047 +0xc8 U+0048 +0xc9 U+0049 +0xca U+00ad +0xcb U+00f4 +0xcc U+00f6 +0xcd U+00f2 +0xce U+00f3 +0xcf U+00f5 +0xd0 U+007d +0xd1 U+004a +0xd2 U+004b +0xd3 U+004c +0xd4 U+004d +0xd5 U+004e +0xd6 U+004f +0xd7 U+0050 +0xd8 U+0051 +0xd9 U+0052 +0xda U+00b9 +0xdb U+00fb +0xdc U+00fc +0xdd U+00f9 +0xde U+00fa +0xdf U+00ff +0xe0 U+005c +0xe1 U+00f7 +0xe2 U+0053 +0xe3 U+0054 +0xe4 U+0055 +0xe5 U+0056 +0xe6 U+0057 +0xe7 U+0058 +0xe8 U+0059 +0xe9 U+005a +0xea U+00b2 +0xeb U+00d4 +0xec U+00d6 +0xed U+00d2 +0xee U+00d3 +0xef U+00d5 +0xf0 U+0030 +0xf1 U+0031 +0xf2 U+0032 +0xf3 U+0033 +0xf4 U+0034 +0xf5 U+0035 +0xf6 U+0036 +0xf7 U+0037 +0xf8 U+0038 +0xf9 U+0039 +0xfa U+00b3 +0xfb U+00db +0xfc U+00dc +0xfd U+00d9 +0xfe U+00da +0xff U+009f diff --git a/jdk/make/tools/CharsetMapping/IBM1097.map b/jdk/make/tools/CharsetMapping/IBM1097.map new file mode 100644 index 00000000000..4bffa824c92 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1097.map @@ -0,0 +1,257 @@ +#Generated from IBM1097.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+009c +0x05 U+0009 +0x06 U+0086 +0x07 U+007f +0x08 U+0097 +0x09 U+008d +0x0a U+008e +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+009d +0x15 U+0085 +0x16 U+0008 +0x17 U+0087 +0x18 U+0018 +0x19 U+0019 +0x1a U+0092 +0x1b U+008f +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0080 +0x21 U+0081 +0x22 U+0082 +0x23 U+0083 +0x24 U+0084 +0x25 U+000a +0x26 U+0017 +0x27 U+001b +0x28 U+0088 +0x29 U+0089 +0x2a U+008a +0x2b U+008b +0x2c U+008c +0x2d U+0005 +0x2e U+0006 +0x2f U+0007 +0x30 U+0090 +0x31 U+0091 +0x32 U+0016 +0x33 U+0093 +0x34 U+0094 +0x35 U+0095 +0x36 U+0096 +0x37 U+0004 +0x38 U+0098 +0x39 U+0099 +0x3a U+009a +0x3b U+009b +0x3c U+0014 +0x3d U+0015 +0x3e U+009e +0x3f U+001a +0x40 U+0020 +0x41 U+00a0 +0x42 U+060c +0x43 U+064b +0x44 U+fe81 +0x45 U+fe82 +0x46 U+f8fa +0x47 U+fe8d +0x48 U+fe8e +0x49 U+f8fb +0x4a U+00a4 +0x4b U+002e +0x4c U+003c +0x4d U+0028 +0x4e U+002b +0x4f U+007c +0x50 U+0026 +0x51 U+fe80 +0x52 U+fe83 +0x53 U+fe84 +0x54 U+f8f9 +0x55 U+fe85 +0x56 U+fe8b +0x57 U+fe8f +0x58 U+fe91 +0x59 U+fb56 +0x5a U+0021 +0x5b U+0024 +0x5c U+002a +0x5d U+0029 +0x5e U+003b +0x5f U+00ac +0x60 U+002d +0x61 U+002f +0x62 U+fb58 +0x63 U+fe95 +0x64 U+fe97 +0x65 U+fe99 +0x66 U+fe9b +0x67 U+fe9d +0x68 U+fe9f +0x69 U+fb7a +0x6a U+061b +0x6b U+002c +0x6c U+0025 +0x6d U+005f +0x6e U+003e +0x6f U+003f +0x70 U+fb7c +0x71 U+fea1 +0x72 U+fea3 +0x73 U+fea5 +0x74 U+fea7 +0x75 U+fea9 +0x76 U+feab +0x77 U+fead +0x78 U+feaf +0x79 U+0060 +0x7a U+003a +0x7b U+0023 +0x7c U+0040 +0x7d U+0027 +0x7e U+003d +0x7f U+0022 +0x80 U+fb8a +0x81 U+0061 +0x82 U+0062 +0x83 U+0063 +0x84 U+0064 +0x85 U+0065 +0x86 U+0066 +0x87 U+0067 +0x88 U+0068 +0x89 U+0069 +0x8a U+00ab +0x8b U+00bb +0x8c U+feb1 +0x8d U+feb3 +0x8e U+feb5 +0x8f U+feb7 +0x90 U+feb9 +0x91 U+006a +0x92 U+006b +0x93 U+006c +0x94 U+006d +0x95 U+006e +0x96 U+006f +0x97 U+0070 +0x98 U+0071 +0x99 U+0072 +0x9a U+febb +0x9b U+febd +0x9c U+febf +0x9d U+fec1 +0x9e U+fec3 +0x9f U+fec5 +0xa0 U+fec7 +0xa1 U+007e +0xa2 U+0073 +0xa3 U+0074 +0xa4 U+0075 +0xa5 U+0076 +0xa6 U+0077 +0xa7 U+0078 +0xa8 U+0079 +0xa9 U+007a +0xaa U+fec9 +0xab U+feca +0xac U+fecb +0xad U+fecc +0xae U+fecd +0xaf U+fece +0xb0 U+fecf +0xb1 U+fed0 +0xb2 U+fed1 +0xb3 U+fed3 +0xb4 U+fed5 +0xb5 U+fed7 +0xb6 U+fb8e +0xb7 U+fedb +0xb8 U+fb92 +0xb9 U+fb94 +0xba U+005b +0xbb U+005d +0xbc U+fedd +0xbd U+fedf +0xbe U+fee1 +0xbf U+00d7 +0xc0 U+007b +0xc1 U+0041 +0xc2 U+0042 +0xc3 U+0043 +0xc4 U+0044 +0xc5 U+0045 +0xc6 U+0046 +0xc7 U+0047 +0xc8 U+0048 +0xc9 U+0049 +0xca U+00ad +0xcb U+fee3 +0xcc U+fee5 +0xcd U+fee7 +0xce U+feed +0xcf U+fee9 +0xd0 U+007d +0xd1 U+004a +0xd2 U+004b +0xd3 U+004c +0xd4 U+004d +0xd5 U+004e +0xd6 U+004f +0xd7 U+0050 +0xd8 U+0051 +0xd9 U+0052 +0xda U+feeb +0xdb U+feec +0xdc U+fba4 +0xdd U+fbfc +0xde U+fbfd +0xdf U+fbfe +0xe0 U+005c +0xe1 U+061f +0xe2 U+0053 +0xe3 U+0054 +0xe4 U+0055 +0xe5 U+0056 +0xe6 U+0057 +0xe7 U+0058 +0xe8 U+0059 +0xe9 U+005a +0xea U+0640 +0xeb U+06f0 +0xec U+06f1 +0xed U+06f2 +0xee U+06f3 +0xef U+06f4 +0xf0 U+0030 +0xf1 U+0031 +0xf2 U+0032 +0xf3 U+0033 +0xf4 U+0034 +0xf5 U+0035 +0xf6 U+0036 +0xf7 U+0037 +0xf8 U+0038 +0xf9 U+0039 +0xfa U+06f5 +0xfb U+06f6 +0xfc U+06f7 +0xfd U+06f8 +0xfe U+06f9 +0xff U+009f diff --git a/jdk/make/tools/CharsetMapping/IBM1098.map b/jdk/make/tools/CharsetMapping/IBM1098.map new file mode 100644 index 00000000000..6996d6ab250 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1098.map @@ -0,0 +1,257 @@ +#Generated from IBM1098.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+fffd +0x81 U+fffd +0x82 U+060c +0x83 U+061b +0x84 U+061f +0x85 U+064b +0x86 U+fe81 +0x87 U+fe82 +0x88 U+f8fa +0x89 U+fe8d +0x8a U+fe8e +0x8b U+f8fb +0x8c U+fe80 +0x8d U+fe83 +0x8e U+fe84 +0x8f U+f8f9 +0x90 U+fe85 +0x91 U+fe8b +0x92 U+fe8f +0x93 U+fe91 +0x94 U+fb56 +0x95 U+fb58 +0x96 U+fe95 +0x97 U+fe97 +0x98 U+fe99 +0x99 U+fe9b +0x9a U+fe9d +0x9b U+fe9f +0x9c U+fb7a +0x9d U+fb7c +0x9e U+00d7 +0x9f U+fea1 +0xa0 U+fea3 +0xa1 U+fea5 +0xa2 U+fea7 +0xa3 U+fea9 +0xa4 U+feab +0xa5 U+fead +0xa6 U+feaf +0xa7 U+fb8a +0xa8 U+feb1 +0xa9 U+feb3 +0xaa U+feb5 +0xab U+feb7 +0xac U+feb9 +0xad U+febb +0xae U+00ab +0xaf U+00bb +0xb0 U+2591 +0xb1 U+2592 +0xb2 U+2593 +0xb3 U+2502 +0xb4 U+2524 +0xb5 U+febd +0xb6 U+febf +0xb7 U+fec1 +0xb8 U+fec3 +0xb9 U+2563 +0xba U+2551 +0xbb U+2557 +0xbc U+255d +0xbd U+00a4 +0xbe U+fec5 +0xbf U+2510 +0xc0 U+2514 +0xc1 U+2534 +0xc2 U+252c +0xc3 U+251c +0xc4 U+2500 +0xc5 U+253c +0xc6 U+fec7 +0xc7 U+fec9 +0xc8 U+255a +0xc9 U+2554 +0xca U+2569 +0xcb U+2566 +0xcc U+2560 +0xcd U+2550 +0xce U+256c +0xcf U+fffd +0xd0 U+feca +0xd1 U+fecb +0xd2 U+fecc +0xd3 U+fecd +0xd4 U+fece +0xd5 U+fecf +0xd6 U+fed0 +0xd7 U+fed1 +0xd8 U+fed3 +0xd9 U+2518 +0xda U+250c +0xdb U+2588 +0xdc U+2584 +0xdd U+fed5 +0xde U+fed7 +0xdf U+2580 +0xe0 U+fb8e +0xe1 U+fedb +0xe2 U+fb92 +0xe3 U+fb94 +0xe4 U+fedd +0xe5 U+fedf +0xe6 U+fee1 +0xe7 U+fee3 +0xe8 U+fee5 +0xe9 U+fee7 +0xea U+feed +0xeb U+fee9 +0xec U+feeb +0xed U+feec +0xee U+fba4 +0xef U+fbfc +0xf0 U+00ad +0xf1 U+fbfd +0xf2 U+fbfe +0xf3 U+0640 +0xf4 U+06f0 +0xf5 U+06f1 +0xf6 U+06f2 +0xf7 U+06f3 +0xf8 U+06f4 +0xf9 U+06f5 +0xfa U+06f6 +0xfb U+06f7 +0xfc U+06f8 +0xfd U+06f9 +0xfe U+25a0 +0xff U+00a0 diff --git a/jdk/make/tools/CharsetMapping/IBM1112.c2b b/jdk/make/tools/CharsetMapping/IBM1112.c2b new file mode 100644 index 00000000000..6cb38028124 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1112.c2b @@ -0,0 +1 @@ +0x15 U+0085 diff --git a/jdk/make/tools/CharsetMapping/IBM1112.map b/jdk/make/tools/CharsetMapping/IBM1112.map new file mode 100644 index 00000000000..2439ea21c92 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1112.map @@ -0,0 +1,257 @@ +#Generated from IBM1112.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+009c +0x05 U+0009 +0x06 U+0086 +0x07 U+007f +0x08 U+0097 +0x09 U+008d +0x0a U+008e +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+009d +0x15 U+000a +0x16 U+0008 +0x17 U+0087 +0x18 U+0018 +0x19 U+0019 +0x1a U+0092 +0x1b U+008f +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0080 +0x21 U+0081 +0x22 U+0082 +0x23 U+0083 +0x24 U+0084 +0x25 U+000a +0x26 U+0017 +0x27 U+001b +0x28 U+0088 +0x29 U+0089 +0x2a U+008a +0x2b U+008b +0x2c U+008c +0x2d U+0005 +0x2e U+0006 +0x2f U+0007 +0x30 U+0090 +0x31 U+0091 +0x32 U+0016 +0x33 U+0093 +0x34 U+0094 +0x35 U+0095 +0x36 U+0096 +0x37 U+0004 +0x38 U+0098 +0x39 U+0099 +0x3a U+009a +0x3b U+009b +0x3c U+0014 +0x3d U+0015 +0x3e U+009e +0x3f U+001a +0x40 U+0020 +0x41 U+00a0 +0x42 U+0161 +0x43 U+00e4 +0x44 U+0105 +0x45 U+012f +0x46 U+016b +0x47 U+00e5 +0x48 U+0113 +0x49 U+017e +0x4a U+00a2 +0x4b U+002e +0x4c U+003c +0x4d U+0028 +0x4e U+002b +0x4f U+007c +0x50 U+0026 +0x51 U+00e9 +0x52 U+0119 +0x53 U+0117 +0x54 U+010d +0x55 U+0173 +0x56 U+201e +0x57 U+201c +0x58 U+0123 +0x59 U+00df +0x5a U+0021 +0x5b U+0024 +0x5c U+002a +0x5d U+0029 +0x5e U+003b +0x5f U+00ac +0x60 U+002d +0x61 U+002f +0x62 U+0160 +0x63 U+00c4 +0x64 U+0104 +0x65 U+012e +0x66 U+016a +0x67 U+00c5 +0x68 U+0112 +0x69 U+017d +0x6a U+00a6 +0x6b U+002c +0x6c U+0025 +0x6d U+005f +0x6e U+003e +0x6f U+003f +0x70 U+00f8 +0x71 U+00c9 +0x72 U+0118 +0x73 U+0116 +0x74 U+010c +0x75 U+0172 +0x76 U+012a +0x77 U+013b +0x78 U+0122 +0x79 U+0060 +0x7a U+003a +0x7b U+0023 +0x7c U+0040 +0x7d U+0027 +0x7e U+003d +0x7f U+0022 +0x80 U+00d8 +0x81 U+0061 +0x82 U+0062 +0x83 U+0063 +0x84 U+0064 +0x85 U+0065 +0x86 U+0066 +0x87 U+0067 +0x88 U+0068 +0x89 U+0069 +0x8a U+00ab +0x8b U+00bb +0x8c U+0101 +0x8d U+017c +0x8e U+0144 +0x8f U+00b1 +0x90 U+00b0 +0x91 U+006a +0x92 U+006b +0x93 U+006c +0x94 U+006d +0x95 U+006e +0x96 U+006f +0x97 U+0070 +0x98 U+0071 +0x99 U+0072 +0x9a U+0156 +0x9b U+0157 +0x9c U+00e6 +0x9d U+0137 +0x9e U+00c6 +0x9f U+00a4 +0xa0 U+00b5 +0xa1 U+007e +0xa2 U+0073 +0xa3 U+0074 +0xa4 U+0075 +0xa5 U+0076 +0xa6 U+0077 +0xa7 U+0078 +0xa8 U+0079 +0xa9 U+007a +0xaa U+201d +0xab U+017a +0xac U+0100 +0xad U+017b +0xae U+0143 +0xaf U+00ae +0xb0 U+005e +0xb1 U+00a3 +0xb2 U+012b +0xb3 U+00b7 +0xb4 U+00a9 +0xb5 U+00a7 +0xb6 U+00b6 +0xb7 U+00bc +0xb8 U+00bd +0xb9 U+00be +0xba U+005b +0xbb U+005d +0xbc U+0179 +0xbd U+0136 +0xbe U+013c +0xbf U+00d7 +0xc0 U+007b +0xc1 U+0041 +0xc2 U+0042 +0xc3 U+0043 +0xc4 U+0044 +0xc5 U+0045 +0xc6 U+0046 +0xc7 U+0047 +0xc8 U+0048 +0xc9 U+0049 +0xca U+00ad +0xcb U+014d +0xcc U+00f6 +0xcd U+0146 +0xce U+00f3 +0xcf U+00f5 +0xd0 U+007d +0xd1 U+004a +0xd2 U+004b +0xd3 U+004c +0xd4 U+004d +0xd5 U+004e +0xd6 U+004f +0xd7 U+0050 +0xd8 U+0051 +0xd9 U+0052 +0xda U+00b9 +0xdb U+0107 +0xdc U+00fc +0xdd U+0142 +0xde U+015b +0xdf U+2019 +0xe0 U+005c +0xe1 U+00f7 +0xe2 U+0053 +0xe3 U+0054 +0xe4 U+0055 +0xe5 U+0056 +0xe6 U+0057 +0xe7 U+0058 +0xe8 U+0059 +0xe9 U+005a +0xea U+00b2 +0xeb U+014c +0xec U+00d6 +0xed U+0145 +0xee U+00d3 +0xef U+00d5 +0xf0 U+0030 +0xf1 U+0031 +0xf2 U+0032 +0xf3 U+0033 +0xf4 U+0034 +0xf5 U+0035 +0xf6 U+0036 +0xf7 U+0037 +0xf8 U+0038 +0xf9 U+0039 +0xfa U+00b3 +0xfb U+0106 +0xfc U+00dc +0xfd U+0141 +0xfe U+015a +0xff U+009f diff --git a/jdk/make/tools/CharsetMapping/IBM1112.nr b/jdk/make/tools/CharsetMapping/IBM1112.nr new file mode 100644 index 00000000000..675451906d4 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1112.nr @@ -0,0 +1 @@ +0x25 U+000a diff --git a/jdk/make/tools/CharsetMapping/IBM1122.c2b b/jdk/make/tools/CharsetMapping/IBM1122.c2b new file mode 100644 index 00000000000..6cb38028124 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1122.c2b @@ -0,0 +1 @@ +0x15 U+0085 diff --git a/jdk/make/tools/CharsetMapping/IBM1122.map b/jdk/make/tools/CharsetMapping/IBM1122.map new file mode 100644 index 00000000000..3dfb45f0de5 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1122.map @@ -0,0 +1,257 @@ +#Generated from IBM1122.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+009c +0x05 U+0009 +0x06 U+0086 +0x07 U+007f +0x08 U+0097 +0x09 U+008d +0x0a U+008e +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+009d +0x15 U+000a +0x16 U+0008 +0x17 U+0087 +0x18 U+0018 +0x19 U+0019 +0x1a U+0092 +0x1b U+008f +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0080 +0x21 U+0081 +0x22 U+0082 +0x23 U+0083 +0x24 U+0084 +0x25 U+000a +0x26 U+0017 +0x27 U+001b +0x28 U+0088 +0x29 U+0089 +0x2a U+008a +0x2b U+008b +0x2c U+008c +0x2d U+0005 +0x2e U+0006 +0x2f U+0007 +0x30 U+0090 +0x31 U+0091 +0x32 U+0016 +0x33 U+0093 +0x34 U+0094 +0x35 U+0095 +0x36 U+0096 +0x37 U+0004 +0x38 U+0098 +0x39 U+0099 +0x3a U+009a +0x3b U+009b +0x3c U+0014 +0x3d U+0015 +0x3e U+009e +0x3f U+001a +0x40 U+0020 +0x41 U+00a0 +0x42 U+00e2 +0x43 U+007b +0x44 U+00e0 +0x45 U+00e1 +0x46 U+00e3 +0x47 U+007d +0x48 U+00e7 +0x49 U+00f1 +0x4a U+00a7 +0x4b U+002e +0x4c U+003c +0x4d U+0028 +0x4e U+002b +0x4f U+0021 +0x50 U+0026 +0x51 U+0060 +0x52 U+00ea +0x53 U+00eb +0x54 U+00e8 +0x55 U+00ed +0x56 U+00ee +0x57 U+00ef +0x58 U+00ec +0x59 U+00df +0x5a U+00a4 +0x5b U+00c5 +0x5c U+002a +0x5d U+0029 +0x5e U+003b +0x5f U+005e +0x60 U+002d +0x61 U+002f +0x62 U+00c2 +0x63 U+0023 +0x64 U+00c0 +0x65 U+00c1 +0x66 U+00c3 +0x67 U+0024 +0x68 U+00c7 +0x69 U+00d1 +0x6a U+00f6 +0x6b U+002c +0x6c U+0025 +0x6d U+005f +0x6e U+003e +0x6f U+003f +0x70 U+00f8 +0x71 U+005c +0x72 U+00ca +0x73 U+00cb +0x74 U+00c8 +0x75 U+00cd +0x76 U+00ce +0x77 U+00cf +0x78 U+00cc +0x79 U+00e9 +0x7a U+003a +0x7b U+00c4 +0x7c U+00d6 +0x7d U+0027 +0x7e U+003d +0x7f U+0022 +0x80 U+00d8 +0x81 U+0061 +0x82 U+0062 +0x83 U+0063 +0x84 U+0064 +0x85 U+0065 +0x86 U+0066 +0x87 U+0067 +0x88 U+0068 +0x89 U+0069 +0x8a U+00ab +0x8b U+00bb +0x8c U+0161 +0x8d U+00fd +0x8e U+017e +0x8f U+00b1 +0x90 U+00b0 +0x91 U+006a +0x92 U+006b +0x93 U+006c +0x94 U+006d +0x95 U+006e +0x96 U+006f +0x97 U+0070 +0x98 U+0071 +0x99 U+0072 +0x9a U+00aa +0x9b U+00ba +0x9c U+00e6 +0x9d U+00b8 +0x9e U+00c6 +0x9f U+005d +0xa0 U+00b5 +0xa1 U+00fc +0xa2 U+0073 +0xa3 U+0074 +0xa4 U+0075 +0xa5 U+0076 +0xa6 U+0077 +0xa7 U+0078 +0xa8 U+0079 +0xa9 U+007a +0xaa U+00a1 +0xab U+00bf +0xac U+0160 +0xad U+00dd +0xae U+017d +0xaf U+00ae +0xb0 U+00a2 +0xb1 U+00a3 +0xb2 U+00a5 +0xb3 U+00b7 +0xb4 U+00a9 +0xb5 U+005b +0xb6 U+00b6 +0xb7 U+00bc +0xb8 U+00bd +0xb9 U+00be +0xba U+00ac +0xbb U+007c +0xbc U+203e +0xbd U+00a8 +0xbe U+00b4 +0xbf U+00d7 +0xc0 U+00e4 +0xc1 U+0041 +0xc2 U+0042 +0xc3 U+0043 +0xc4 U+0044 +0xc5 U+0045 +0xc6 U+0046 +0xc7 U+0047 +0xc8 U+0048 +0xc9 U+0049 +0xca U+00ad +0xcb U+00f4 +0xcc U+00a6 +0xcd U+00f2 +0xce U+00f3 +0xcf U+00f5 +0xd0 U+00e5 +0xd1 U+004a +0xd2 U+004b +0xd3 U+004c +0xd4 U+004d +0xd5 U+004e +0xd6 U+004f +0xd7 U+0050 +0xd8 U+0051 +0xd9 U+0052 +0xda U+00b9 +0xdb U+00fb +0xdc U+007e +0xdd U+00f9 +0xde U+00fa +0xdf U+00ff +0xe0 U+00c9 +0xe1 U+00f7 +0xe2 U+0053 +0xe3 U+0054 +0xe4 U+0055 +0xe5 U+0056 +0xe6 U+0057 +0xe7 U+0058 +0xe8 U+0059 +0xe9 U+005a +0xea U+00b2 +0xeb U+00d4 +0xec U+0040 +0xed U+00d2 +0xee U+00d3 +0xef U+00d5 +0xf0 U+0030 +0xf1 U+0031 +0xf2 U+0032 +0xf3 U+0033 +0xf4 U+0034 +0xf5 U+0035 +0xf6 U+0036 +0xf7 U+0037 +0xf8 U+0038 +0xf9 U+0039 +0xfa U+00b3 +0xfb U+00db +0xfc U+00dc +0xfd U+00d9 +0xfe U+00da +0xff U+009f diff --git a/jdk/make/tools/CharsetMapping/IBM1122.nr b/jdk/make/tools/CharsetMapping/IBM1122.nr new file mode 100644 index 00000000000..675451906d4 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1122.nr @@ -0,0 +1 @@ +0x25 U+000a diff --git a/jdk/make/tools/CharsetMapping/IBM1123.c2b b/jdk/make/tools/CharsetMapping/IBM1123.c2b new file mode 100644 index 00000000000..6cb38028124 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1123.c2b @@ -0,0 +1 @@ +0x15 U+0085 diff --git a/jdk/make/tools/CharsetMapping/IBM1123.map b/jdk/make/tools/CharsetMapping/IBM1123.map new file mode 100644 index 00000000000..16857071ab8 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1123.map @@ -0,0 +1,257 @@ +#Generated from IBM1123.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+009c +0x05 U+0009 +0x06 U+0086 +0x07 U+007f +0x08 U+0097 +0x09 U+008d +0x0a U+008e +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+009d +0x15 U+000a +0x16 U+0008 +0x17 U+0087 +0x18 U+0018 +0x19 U+0019 +0x1a U+0092 +0x1b U+008f +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0080 +0x21 U+0081 +0x22 U+0082 +0x23 U+0083 +0x24 U+0084 +0x25 U+000a +0x26 U+0017 +0x27 U+001b +0x28 U+0088 +0x29 U+0089 +0x2a U+008a +0x2b U+008b +0x2c U+008c +0x2d U+0005 +0x2e U+0006 +0x2f U+0007 +0x30 U+0090 +0x31 U+0091 +0x32 U+0016 +0x33 U+0093 +0x34 U+0094 +0x35 U+0095 +0x36 U+0096 +0x37 U+0004 +0x38 U+0098 +0x39 U+0099 +0x3a U+009a +0x3b U+009b +0x3c U+0014 +0x3d U+0015 +0x3e U+009e +0x3f U+001a +0x40 U+0020 +0x41 U+00a0 +0x42 U+0452 +0x43 U+0491 +0x44 U+0451 +0x45 U+0454 +0x46 U+0455 +0x47 U+0456 +0x48 U+0457 +0x49 U+0458 +0x4a U+005b +0x4b U+002e +0x4c U+003c +0x4d U+0028 +0x4e U+002b +0x4f U+0021 +0x50 U+0026 +0x51 U+0459 +0x52 U+045a +0x53 U+045b +0x54 U+045c +0x55 U+045e +0x56 U+045f +0x57 U+042a +0x58 U+2116 +0x59 U+0402 +0x5a U+005d +0x5b U+0024 +0x5c U+002a +0x5d U+0029 +0x5e U+003b +0x5f U+005e +0x60 U+002d +0x61 U+002f +0x62 U+0490 +0x63 U+0401 +0x64 U+0404 +0x65 U+0405 +0x66 U+0406 +0x67 U+0407 +0x68 U+0408 +0x69 U+0409 +0x6a U+007c +0x6b U+002c +0x6c U+0025 +0x6d U+005f +0x6e U+003e +0x6f U+003f +0x70 U+040a +0x71 U+040b +0x72 U+040c +0x73 U+00ad +0x74 U+040e +0x75 U+040f +0x76 U+044e +0x77 U+0430 +0x78 U+0431 +0x79 U+0060 +0x7a U+003a +0x7b U+0023 +0x7c U+0040 +0x7d U+0027 +0x7e U+003d +0x7f U+0022 +0x80 U+0446 +0x81 U+0061 +0x82 U+0062 +0x83 U+0063 +0x84 U+0064 +0x85 U+0065 +0x86 U+0066 +0x87 U+0067 +0x88 U+0068 +0x89 U+0069 +0x8a U+0434 +0x8b U+0435 +0x8c U+0444 +0x8d U+0433 +0x8e U+0445 +0x8f U+0438 +0x90 U+0439 +0x91 U+006a +0x92 U+006b +0x93 U+006c +0x94 U+006d +0x95 U+006e +0x96 U+006f +0x97 U+0070 +0x98 U+0071 +0x99 U+0072 +0x9a U+043a +0x9b U+043b +0x9c U+043c +0x9d U+043d +0x9e U+043e +0x9f U+043f +0xa0 U+044f +0xa1 U+007e +0xa2 U+0073 +0xa3 U+0074 +0xa4 U+0075 +0xa5 U+0076 +0xa6 U+0077 +0xa7 U+0078 +0xa8 U+0079 +0xa9 U+007a +0xaa U+0440 +0xab U+0441 +0xac U+0442 +0xad U+0443 +0xae U+0436 +0xaf U+0432 +0xb0 U+044c +0xb1 U+044b +0xb2 U+0437 +0xb3 U+0448 +0xb4 U+044d +0xb5 U+0449 +0xb6 U+0447 +0xb7 U+044a +0xb8 U+042e +0xb9 U+0410 +0xba U+0411 +0xbb U+0426 +0xbc U+0414 +0xbd U+0415 +0xbe U+0424 +0xbf U+0413 +0xc0 U+007b +0xc1 U+0041 +0xc2 U+0042 +0xc3 U+0043 +0xc4 U+0044 +0xc5 U+0045 +0xc6 U+0046 +0xc7 U+0047 +0xc8 U+0048 +0xc9 U+0049 +0xca U+0425 +0xcb U+0418 +0xcc U+0419 +0xcd U+041a +0xce U+041b +0xcf U+041c +0xd0 U+007d +0xd1 U+004a +0xd2 U+004b +0xd3 U+004c +0xd4 U+004d +0xd5 U+004e +0xd6 U+004f +0xd7 U+0050 +0xd8 U+0051 +0xd9 U+0052 +0xda U+041d +0xdb U+041e +0xdc U+041f +0xdd U+042f +0xde U+0420 +0xdf U+0421 +0xe0 U+005c +0xe1 U+00a7 +0xe2 U+0053 +0xe3 U+0054 +0xe4 U+0055 +0xe5 U+0056 +0xe6 U+0057 +0xe7 U+0058 +0xe8 U+0059 +0xe9 U+005a +0xea U+0422 +0xeb U+0423 +0xec U+0416 +0xed U+0412 +0xee U+042c +0xef U+042b +0xf0 U+0030 +0xf1 U+0031 +0xf2 U+0032 +0xf3 U+0033 +0xf4 U+0034 +0xf5 U+0035 +0xf6 U+0036 +0xf7 U+0037 +0xf8 U+0038 +0xf9 U+0039 +0xfa U+0417 +0xfb U+0428 +0xfc U+042d +0xfd U+0429 +0xfe U+0427 +0xff U+009f diff --git a/jdk/make/tools/CharsetMapping/IBM1123.nr b/jdk/make/tools/CharsetMapping/IBM1123.nr new file mode 100644 index 00000000000..675451906d4 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1123.nr @@ -0,0 +1 @@ +0x25 U+000a diff --git a/jdk/make/tools/CharsetMapping/IBM1124.map b/jdk/make/tools/CharsetMapping/IBM1124.map new file mode 100644 index 00000000000..4cca8021b11 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1124.map @@ -0,0 +1,257 @@ +#Generated from IBM1124.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+0080 +0x81 U+0081 +0x82 U+0082 +0x83 U+0083 +0x84 U+0084 +0x85 U+0085 +0x86 U+0086 +0x87 U+0087 +0x88 U+0088 +0x89 U+0089 +0x8a U+008a +0x8b U+008b +0x8c U+008c +0x8d U+008d +0x8e U+008e +0x8f U+008f +0x90 U+0090 +0x91 U+0091 +0x92 U+0092 +0x93 U+0093 +0x94 U+0094 +0x95 U+0095 +0x96 U+0096 +0x97 U+0097 +0x98 U+0098 +0x99 U+0099 +0x9a U+009a +0x9b U+009b +0x9c U+009c +0x9d U+009d +0x9e U+009e +0x9f U+009f +0xa0 U+00a0 +0xa1 U+0401 +0xa2 U+0402 +0xa3 U+0490 +0xa4 U+0404 +0xa5 U+0405 +0xa6 U+0406 +0xa7 U+0407 +0xa8 U+0408 +0xa9 U+0409 +0xaa U+040a +0xab U+040b +0xac U+040c +0xad U+00ad +0xae U+040e +0xaf U+040f +0xb0 U+0410 +0xb1 U+0411 +0xb2 U+0412 +0xb3 U+0413 +0xb4 U+0414 +0xb5 U+0415 +0xb6 U+0416 +0xb7 U+0417 +0xb8 U+0418 +0xb9 U+0419 +0xba U+041a +0xbb U+041b +0xbc U+041c +0xbd U+041d +0xbe U+041e +0xbf U+041f +0xc0 U+0420 +0xc1 U+0421 +0xc2 U+0422 +0xc3 U+0423 +0xc4 U+0424 +0xc5 U+0425 +0xc6 U+0426 +0xc7 U+0427 +0xc8 U+0428 +0xc9 U+0429 +0xca U+042a +0xcb U+042b +0xcc U+042c +0xcd U+042d +0xce U+042e +0xcf U+042f +0xd0 U+0430 +0xd1 U+0431 +0xd2 U+0432 +0xd3 U+0433 +0xd4 U+0434 +0xd5 U+0435 +0xd6 U+0436 +0xd7 U+0437 +0xd8 U+0438 +0xd9 U+0439 +0xda U+043a +0xdb U+043b +0xdc U+043c +0xdd U+043d +0xde U+043e +0xdf U+043f +0xe0 U+0440 +0xe1 U+0441 +0xe2 U+0442 +0xe3 U+0443 +0xe4 U+0444 +0xe5 U+0445 +0xe6 U+0446 +0xe7 U+0447 +0xe8 U+0448 +0xe9 U+0449 +0xea U+044a +0xeb U+044b +0xec U+044c +0xed U+044d +0xee U+044e +0xef U+044f +0xf0 U+2116 +0xf1 U+0451 +0xf2 U+0452 +0xf3 U+0491 +0xf4 U+0454 +0xf5 U+0455 +0xf6 U+0456 +0xf7 U+0457 +0xf8 U+0458 +0xf9 U+0459 +0xfa U+045a +0xfb U+045b +0xfc U+045c +0xfd U+00a7 +0xfe U+045e +0xff U+045f diff --git a/jdk/make/tools/CharsetMapping/IBM1140.c2b b/jdk/make/tools/CharsetMapping/IBM1140.c2b new file mode 100644 index 00000000000..6cb38028124 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1140.c2b @@ -0,0 +1 @@ +0x15 U+0085 diff --git a/jdk/make/tools/CharsetMapping/IBM1140.map b/jdk/make/tools/CharsetMapping/IBM1140.map new file mode 100644 index 00000000000..6a79f6cba5a --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1140.map @@ -0,0 +1,257 @@ +#Generated from IBM037.java with 0x9f <-> u+20ac +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+009c +0x05 U+0009 +0x06 U+0086 +0x07 U+007f +0x08 U+0097 +0x09 U+008d +0x0a U+008e +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+009d +0x15 U+000a +0x16 U+0008 +0x17 U+0087 +0x18 U+0018 +0x19 U+0019 +0x1a U+0092 +0x1b U+008f +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0080 +0x21 U+0081 +0x22 U+0082 +0x23 U+0083 +0x24 U+0084 +0x25 U+000a +0x26 U+0017 +0x27 U+001b +0x28 U+0088 +0x29 U+0089 +0x2a U+008a +0x2b U+008b +0x2c U+008c +0x2d U+0005 +0x2e U+0006 +0x2f U+0007 +0x30 U+0090 +0x31 U+0091 +0x32 U+0016 +0x33 U+0093 +0x34 U+0094 +0x35 U+0095 +0x36 U+0096 +0x37 U+0004 +0x38 U+0098 +0x39 U+0099 +0x3a U+009a +0x3b U+009b +0x3c U+0014 +0x3d U+0015 +0x3e U+009e +0x3f U+001a +0x40 U+0020 +0x41 U+00a0 +0x42 U+00e2 +0x43 U+00e4 +0x44 U+00e0 +0x45 U+00e1 +0x46 U+00e3 +0x47 U+00e5 +0x48 U+00e7 +0x49 U+00f1 +0x4a U+00a2 +0x4b U+002e +0x4c U+003c +0x4d U+0028 +0x4e U+002b +0x4f U+007c +0x50 U+0026 +0x51 U+00e9 +0x52 U+00ea +0x53 U+00eb +0x54 U+00e8 +0x55 U+00ed +0x56 U+00ee +0x57 U+00ef +0x58 U+00ec +0x59 U+00df +0x5a U+0021 +0x5b U+0024 +0x5c U+002a +0x5d U+0029 +0x5e U+003b +0x5f U+00ac +0x60 U+002d +0x61 U+002f +0x62 U+00c2 +0x63 U+00c4 +0x64 U+00c0 +0x65 U+00c1 +0x66 U+00c3 +0x67 U+00c5 +0x68 U+00c7 +0x69 U+00d1 +0x6a U+00a6 +0x6b U+002c +0x6c U+0025 +0x6d U+005f +0x6e U+003e +0x6f U+003f +0x70 U+00f8 +0x71 U+00c9 +0x72 U+00ca +0x73 U+00cb +0x74 U+00c8 +0x75 U+00cd +0x76 U+00ce +0x77 U+00cf +0x78 U+00cc +0x79 U+0060 +0x7a U+003a +0x7b U+0023 +0x7c U+0040 +0x7d U+0027 +0x7e U+003d +0x7f U+0022 +0x80 U+00d8 +0x81 U+0061 +0x82 U+0062 +0x83 U+0063 +0x84 U+0064 +0x85 U+0065 +0x86 U+0066 +0x87 U+0067 +0x88 U+0068 +0x89 U+0069 +0x8a U+00ab +0x8b U+00bb +0x8c U+00f0 +0x8d U+00fd +0x8e U+00fe +0x8f U+00b1 +0x90 U+00b0 +0x91 U+006a +0x92 U+006b +0x93 U+006c +0x94 U+006d +0x95 U+006e +0x96 U+006f +0x97 U+0070 +0x98 U+0071 +0x99 U+0072 +0x9a U+00aa +0x9b U+00ba +0x9c U+00e6 +0x9d U+00b8 +0x9e U+00c6 +0x9f U+20ac +0xa0 U+00b5 +0xa1 U+007e +0xa2 U+0073 +0xa3 U+0074 +0xa4 U+0075 +0xa5 U+0076 +0xa6 U+0077 +0xa7 U+0078 +0xa8 U+0079 +0xa9 U+007a +0xaa U+00a1 +0xab U+00bf +0xac U+00d0 +0xad U+00dd +0xae U+00de +0xaf U+00ae +0xb0 U+005e +0xb1 U+00a3 +0xb2 U+00a5 +0xb3 U+00b7 +0xb4 U+00a9 +0xb5 U+00a7 +0xb6 U+00b6 +0xb7 U+00bc +0xb8 U+00bd +0xb9 U+00be +0xba U+005b +0xbb U+005d +0xbc U+00af +0xbd U+00a8 +0xbe U+00b4 +0xbf U+00d7 +0xc0 U+007b +0xc1 U+0041 +0xc2 U+0042 +0xc3 U+0043 +0xc4 U+0044 +0xc5 U+0045 +0xc6 U+0046 +0xc7 U+0047 +0xc8 U+0048 +0xc9 U+0049 +0xca U+00ad +0xcb U+00f4 +0xcc U+00f6 +0xcd U+00f2 +0xce U+00f3 +0xcf U+00f5 +0xd0 U+007d +0xd1 U+004a +0xd2 U+004b +0xd3 U+004c +0xd4 U+004d +0xd5 U+004e +0xd6 U+004f +0xd7 U+0050 +0xd8 U+0051 +0xd9 U+0052 +0xda U+00b9 +0xdb U+00fb +0xdc U+00fc +0xdd U+00f9 +0xde U+00fa +0xdf U+00ff +0xe0 U+005c +0xe1 U+00f7 +0xe2 U+0053 +0xe3 U+0054 +0xe4 U+0055 +0xe5 U+0056 +0xe6 U+0057 +0xe7 U+0058 +0xe8 U+0059 +0xe9 U+005a +0xea U+00b2 +0xeb U+00d4 +0xec U+00d6 +0xed U+00d2 +0xee U+00d3 +0xef U+00d5 +0xf0 U+0030 +0xf1 U+0031 +0xf2 U+0032 +0xf3 U+0033 +0xf4 U+0034 +0xf5 U+0035 +0xf6 U+0036 +0xf7 U+0037 +0xf8 U+0038 +0xf9 U+0039 +0xfa U+00b3 +0xfb U+00db +0xfc U+00dc +0xfd U+00d9 +0xfe U+00da +0xff U+009f diff --git a/jdk/make/tools/CharsetMapping/IBM1141.c2b b/jdk/make/tools/CharsetMapping/IBM1141.c2b new file mode 100644 index 00000000000..6cb38028124 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1141.c2b @@ -0,0 +1 @@ +0x15 U+0085 diff --git a/jdk/make/tools/CharsetMapping/IBM1141.map b/jdk/make/tools/CharsetMapping/IBM1141.map new file mode 100644 index 00000000000..b524b109f2b --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1141.map @@ -0,0 +1,257 @@ +#Generated from IBM273.java with 0x9f <-> u+20ac +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+009c +0x05 U+0009 +0x06 U+0086 +0x07 U+007f +0x08 U+0097 +0x09 U+008d +0x0a U+008e +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+009d +0x15 U+000a +0x16 U+0008 +0x17 U+0087 +0x18 U+0018 +0x19 U+0019 +0x1a U+0092 +0x1b U+008f +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0080 +0x21 U+0081 +0x22 U+0082 +0x23 U+0083 +0x24 U+0084 +0x25 U+000a +0x26 U+0017 +0x27 U+001b +0x28 U+0088 +0x29 U+0089 +0x2a U+008a +0x2b U+008b +0x2c U+008c +0x2d U+0005 +0x2e U+0006 +0x2f U+0007 +0x30 U+0090 +0x31 U+0091 +0x32 U+0016 +0x33 U+0093 +0x34 U+0094 +0x35 U+0095 +0x36 U+0096 +0x37 U+0004 +0x38 U+0098 +0x39 U+0099 +0x3a U+009a +0x3b U+009b +0x3c U+0014 +0x3d U+0015 +0x3e U+009e +0x3f U+001a +0x40 U+0020 +0x41 U+00a0 +0x42 U+00e2 +0x43 U+007b +0x44 U+00e0 +0x45 U+00e1 +0x46 U+00e3 +0x47 U+00e5 +0x48 U+00e7 +0x49 U+00f1 +0x4a U+00c4 +0x4b U+002e +0x4c U+003c +0x4d U+0028 +0x4e U+002b +0x4f U+0021 +0x50 U+0026 +0x51 U+00e9 +0x52 U+00ea +0x53 U+00eb +0x54 U+00e8 +0x55 U+00ed +0x56 U+00ee +0x57 U+00ef +0x58 U+00ec +0x59 U+007e +0x5a U+00dc +0x5b U+0024 +0x5c U+002a +0x5d U+0029 +0x5e U+003b +0x5f U+005e +0x60 U+002d +0x61 U+002f +0x62 U+00c2 +0x63 U+005b +0x64 U+00c0 +0x65 U+00c1 +0x66 U+00c3 +0x67 U+00c5 +0x68 U+00c7 +0x69 U+00d1 +0x6a U+00f6 +0x6b U+002c +0x6c U+0025 +0x6d U+005f +0x6e U+003e +0x6f U+003f +0x70 U+00f8 +0x71 U+00c9 +0x72 U+00ca +0x73 U+00cb +0x74 U+00c8 +0x75 U+00cd +0x76 U+00ce +0x77 U+00cf +0x78 U+00cc +0x79 U+0060 +0x7a U+003a +0x7b U+0023 +0x7c U+00a7 +0x7d U+0027 +0x7e U+003d +0x7f U+0022 +0x80 U+00d8 +0x81 U+0061 +0x82 U+0062 +0x83 U+0063 +0x84 U+0064 +0x85 U+0065 +0x86 U+0066 +0x87 U+0067 +0x88 U+0068 +0x89 U+0069 +0x8a U+00ab +0x8b U+00bb +0x8c U+00f0 +0x8d U+00fd +0x8e U+00fe +0x8f U+00b1 +0x90 U+00b0 +0x91 U+006a +0x92 U+006b +0x93 U+006c +0x94 U+006d +0x95 U+006e +0x96 U+006f +0x97 U+0070 +0x98 U+0071 +0x99 U+0072 +0x9a U+00aa +0x9b U+00ba +0x9c U+00e6 +0x9d U+00b8 +0x9e U+00c6 +0x9f U+20ac +0xa0 U+00b5 +0xa1 U+00df +0xa2 U+0073 +0xa3 U+0074 +0xa4 U+0075 +0xa5 U+0076 +0xa6 U+0077 +0xa7 U+0078 +0xa8 U+0079 +0xa9 U+007a +0xaa U+00a1 +0xab U+00bf +0xac U+00d0 +0xad U+00dd +0xae U+00de +0xaf U+00ae +0xb0 U+00a2 +0xb1 U+00a3 +0xb2 U+00a5 +0xb3 U+00b7 +0xb4 U+00a9 +0xb5 U+0040 +0xb6 U+00b6 +0xb7 U+00bc +0xb8 U+00bd +0xb9 U+00be +0xba U+00ac +0xbb U+007c +0xbc U+00af +0xbd U+00a8 +0xbe U+00b4 +0xbf U+00d7 +0xc0 U+00e4 +0xc1 U+0041 +0xc2 U+0042 +0xc3 U+0043 +0xc4 U+0044 +0xc5 U+0045 +0xc6 U+0046 +0xc7 U+0047 +0xc8 U+0048 +0xc9 U+0049 +0xca U+00ad +0xcb U+00f4 +0xcc U+00a6 +0xcd U+00f2 +0xce U+00f3 +0xcf U+00f5 +0xd0 U+00fc +0xd1 U+004a +0xd2 U+004b +0xd3 U+004c +0xd4 U+004d +0xd5 U+004e +0xd6 U+004f +0xd7 U+0050 +0xd8 U+0051 +0xd9 U+0052 +0xda U+00b9 +0xdb U+00fb +0xdc U+007d +0xdd U+00f9 +0xde U+00fa +0xdf U+00ff +0xe0 U+00d6 +0xe1 U+00f7 +0xe2 U+0053 +0xe3 U+0054 +0xe4 U+0055 +0xe5 U+0056 +0xe6 U+0057 +0xe7 U+0058 +0xe8 U+0059 +0xe9 U+005a +0xea U+00b2 +0xeb U+00d4 +0xec U+005c +0xed U+00d2 +0xee U+00d3 +0xef U+00d5 +0xf0 U+0030 +0xf1 U+0031 +0xf2 U+0032 +0xf3 U+0033 +0xf4 U+0034 +0xf5 U+0035 +0xf6 U+0036 +0xf7 U+0037 +0xf8 U+0038 +0xf9 U+0039 +0xfa U+00b3 +0xfb U+00db +0xfc U+005d +0xfd U+00d9 +0xfe U+00da +0xff U+009f diff --git a/jdk/make/tools/CharsetMapping/IBM1142.c2b b/jdk/make/tools/CharsetMapping/IBM1142.c2b new file mode 100644 index 00000000000..6cb38028124 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1142.c2b @@ -0,0 +1 @@ +0x15 U+0085 diff --git a/jdk/make/tools/CharsetMapping/IBM1142.map b/jdk/make/tools/CharsetMapping/IBM1142.map new file mode 100644 index 00000000000..8ebdb3b5d6a --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1142.map @@ -0,0 +1,257 @@ +#Generated from IBM277.java with 0x5a <-> u+20ac +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+009c +0x05 U+0009 +0x06 U+0086 +0x07 U+007f +0x08 U+0097 +0x09 U+008d +0x0a U+008e +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+009d +0x15 U+000a +0x16 U+0008 +0x17 U+0087 +0x18 U+0018 +0x19 U+0019 +0x1a U+0092 +0x1b U+008f +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0080 +0x21 U+0081 +0x22 U+0082 +0x23 U+0083 +0x24 U+0084 +0x25 U+000a +0x26 U+0017 +0x27 U+001b +0x28 U+0088 +0x29 U+0089 +0x2a U+008a +0x2b U+008b +0x2c U+008c +0x2d U+0005 +0x2e U+0006 +0x2f U+0007 +0x30 U+0090 +0x31 U+0091 +0x32 U+0016 +0x33 U+0093 +0x34 U+0094 +0x35 U+0095 +0x36 U+0096 +0x37 U+0004 +0x38 U+0098 +0x39 U+0099 +0x3a U+009a +0x3b U+009b +0x3c U+0014 +0x3d U+0015 +0x3e U+009e +0x3f U+001a +0x40 U+0020 +0x41 U+00a0 +0x42 U+00e2 +0x43 U+00e4 +0x44 U+00e0 +0x45 U+00e1 +0x46 U+00e3 +0x47 U+007d +0x48 U+00e7 +0x49 U+00f1 +0x4a U+0023 +0x4b U+002e +0x4c U+003c +0x4d U+0028 +0x4e U+002b +0x4f U+0021 +0x50 U+0026 +0x51 U+00e9 +0x52 U+00ea +0x53 U+00eb +0x54 U+00e8 +0x55 U+00ed +0x56 U+00ee +0x57 U+00ef +0x58 U+00ec +0x59 U+00df +0x5a U+20ac +0x5b U+00c5 +0x5c U+002a +0x5d U+0029 +0x5e U+003b +0x5f U+005e +0x60 U+002d +0x61 U+002f +0x62 U+00c2 +0x63 U+00c4 +0x64 U+00c0 +0x65 U+00c1 +0x66 U+00c3 +0x67 U+0024 +0x68 U+00c7 +0x69 U+00d1 +0x6a U+00f8 +0x6b U+002c +0x6c U+0025 +0x6d U+005f +0x6e U+003e +0x6f U+003f +0x70 U+00a6 +0x71 U+00c9 +0x72 U+00ca +0x73 U+00cb +0x74 U+00c8 +0x75 U+00cd +0x76 U+00ce +0x77 U+00cf +0x78 U+00cc +0x79 U+0060 +0x7a U+003a +0x7b U+00c6 +0x7c U+00d8 +0x7d U+0027 +0x7e U+003d +0x7f U+0022 +0x80 U+0040 +0x81 U+0061 +0x82 U+0062 +0x83 U+0063 +0x84 U+0064 +0x85 U+0065 +0x86 U+0066 +0x87 U+0067 +0x88 U+0068 +0x89 U+0069 +0x8a U+00ab +0x8b U+00bb +0x8c U+00f0 +0x8d U+00fd +0x8e U+00fe +0x8f U+00b1 +0x90 U+00b0 +0x91 U+006a +0x92 U+006b +0x93 U+006c +0x94 U+006d +0x95 U+006e +0x96 U+006f +0x97 U+0070 +0x98 U+0071 +0x99 U+0072 +0x9a U+00aa +0x9b U+00ba +0x9c U+007b +0x9d U+00b8 +0x9e U+005b +0x9f U+005d +0xa0 U+00b5 +0xa1 U+00fc +0xa2 U+0073 +0xa3 U+0074 +0xa4 U+0075 +0xa5 U+0076 +0xa6 U+0077 +0xa7 U+0078 +0xa8 U+0079 +0xa9 U+007a +0xaa U+00a1 +0xab U+00bf +0xac U+00d0 +0xad U+00dd +0xae U+00de +0xaf U+00ae +0xb0 U+00a2 +0xb1 U+00a3 +0xb2 U+00a5 +0xb3 U+00b7 +0xb4 U+00a9 +0xb5 U+00a7 +0xb6 U+00b6 +0xb7 U+00bc +0xb8 U+00bd +0xb9 U+00be +0xba U+00ac +0xbb U+007c +0xbc U+00af +0xbd U+00a8 +0xbe U+00b4 +0xbf U+00d7 +0xc0 U+00e6 +0xc1 U+0041 +0xc2 U+0042 +0xc3 U+0043 +0xc4 U+0044 +0xc5 U+0045 +0xc6 U+0046 +0xc7 U+0047 +0xc8 U+0048 +0xc9 U+0049 +0xca U+00ad +0xcb U+00f4 +0xcc U+00f6 +0xcd U+00f2 +0xce U+00f3 +0xcf U+00f5 +0xd0 U+00e5 +0xd1 U+004a +0xd2 U+004b +0xd3 U+004c +0xd4 U+004d +0xd5 U+004e +0xd6 U+004f +0xd7 U+0050 +0xd8 U+0051 +0xd9 U+0052 +0xda U+00b9 +0xdb U+00fb +0xdc U+007e +0xdd U+00f9 +0xde U+00fa +0xdf U+00ff +0xe0 U+005c +0xe1 U+00f7 +0xe2 U+0053 +0xe3 U+0054 +0xe4 U+0055 +0xe5 U+0056 +0xe6 U+0057 +0xe7 U+0058 +0xe8 U+0059 +0xe9 U+005a +0xea U+00b2 +0xeb U+00d4 +0xec U+00d6 +0xed U+00d2 +0xee U+00d3 +0xef U+00d5 +0xf0 U+0030 +0xf1 U+0031 +0xf2 U+0032 +0xf3 U+0033 +0xf4 U+0034 +0xf5 U+0035 +0xf6 U+0036 +0xf7 U+0037 +0xf8 U+0038 +0xf9 U+0039 +0xfa U+00b3 +0xfb U+00db +0xfc U+00dc +0xfd U+00d9 +0xfe U+00da +0xff U+009f diff --git a/jdk/make/tools/CharsetMapping/IBM1143.c2b b/jdk/make/tools/CharsetMapping/IBM1143.c2b new file mode 100644 index 00000000000..6cb38028124 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1143.c2b @@ -0,0 +1 @@ +0x15 U+0085 diff --git a/jdk/make/tools/CharsetMapping/IBM1143.map b/jdk/make/tools/CharsetMapping/IBM1143.map new file mode 100644 index 00000000000..3bac32ae83e --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1143.map @@ -0,0 +1,257 @@ +#Generated from IBM278.java with 0x5a <-> u+20ac +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+009c +0x05 U+0009 +0x06 U+0086 +0x07 U+007f +0x08 U+0097 +0x09 U+008d +0x0a U+008e +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+009d +0x15 U+000a +0x16 U+0008 +0x17 U+0087 +0x18 U+0018 +0x19 U+0019 +0x1a U+0092 +0x1b U+008f +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0080 +0x21 U+0081 +0x22 U+0082 +0x23 U+0083 +0x24 U+0084 +0x25 U+000a +0x26 U+0017 +0x27 U+001b +0x28 U+0088 +0x29 U+0089 +0x2a U+008a +0x2b U+008b +0x2c U+008c +0x2d U+0005 +0x2e U+0006 +0x2f U+0007 +0x30 U+0090 +0x31 U+0091 +0x32 U+0016 +0x33 U+0093 +0x34 U+0094 +0x35 U+0095 +0x36 U+0096 +0x37 U+0004 +0x38 U+0098 +0x39 U+0099 +0x3a U+009a +0x3b U+009b +0x3c U+0014 +0x3d U+0015 +0x3e U+009e +0x3f U+001a +0x40 U+0020 +0x41 U+00a0 +0x42 U+00e2 +0x43 U+007b +0x44 U+00e0 +0x45 U+00e1 +0x46 U+00e3 +0x47 U+007d +0x48 U+00e7 +0x49 U+00f1 +0x4a U+00a7 +0x4b U+002e +0x4c U+003c +0x4d U+0028 +0x4e U+002b +0x4f U+0021 +0x50 U+0026 +0x51 U+0060 +0x52 U+00ea +0x53 U+00eb +0x54 U+00e8 +0x55 U+00ed +0x56 U+00ee +0x57 U+00ef +0x58 U+00ec +0x59 U+00df +0x5a U+20ac +0x5b U+00c5 +0x5c U+002a +0x5d U+0029 +0x5e U+003b +0x5f U+005e +0x60 U+002d +0x61 U+002f +0x62 U+00c2 +0x63 U+0023 +0x64 U+00c0 +0x65 U+00c1 +0x66 U+00c3 +0x67 U+0024 +0x68 U+00c7 +0x69 U+00d1 +0x6a U+00f6 +0x6b U+002c +0x6c U+0025 +0x6d U+005f +0x6e U+003e +0x6f U+003f +0x70 U+00f8 +0x71 U+005c +0x72 U+00ca +0x73 U+00cb +0x74 U+00c8 +0x75 U+00cd +0x76 U+00ce +0x77 U+00cf +0x78 U+00cc +0x79 U+00e9 +0x7a U+003a +0x7b U+00c4 +0x7c U+00d6 +0x7d U+0027 +0x7e U+003d +0x7f U+0022 +0x80 U+00d8 +0x81 U+0061 +0x82 U+0062 +0x83 U+0063 +0x84 U+0064 +0x85 U+0065 +0x86 U+0066 +0x87 U+0067 +0x88 U+0068 +0x89 U+0069 +0x8a U+00ab +0x8b U+00bb +0x8c U+00f0 +0x8d U+00fd +0x8e U+00fe +0x8f U+00b1 +0x90 U+00b0 +0x91 U+006a +0x92 U+006b +0x93 U+006c +0x94 U+006d +0x95 U+006e +0x96 U+006f +0x97 U+0070 +0x98 U+0071 +0x99 U+0072 +0x9a U+00aa +0x9b U+00ba +0x9c U+00e6 +0x9d U+00b8 +0x9e U+00c6 +0x9f U+005d +0xa0 U+00b5 +0xa1 U+00fc +0xa2 U+0073 +0xa3 U+0074 +0xa4 U+0075 +0xa5 U+0076 +0xa6 U+0077 +0xa7 U+0078 +0xa8 U+0079 +0xa9 U+007a +0xaa U+00a1 +0xab U+00bf +0xac U+00d0 +0xad U+00dd +0xae U+00de +0xaf U+00ae +0xb0 U+00a2 +0xb1 U+00a3 +0xb2 U+00a5 +0xb3 U+00b7 +0xb4 U+00a9 +0xb5 U+005b +0xb6 U+00b6 +0xb7 U+00bc +0xb8 U+00bd +0xb9 U+00be +0xba U+00ac +0xbb U+007c +0xbc U+00af +0xbd U+00a8 +0xbe U+00b4 +0xbf U+00d7 +0xc0 U+00e4 +0xc1 U+0041 +0xc2 U+0042 +0xc3 U+0043 +0xc4 U+0044 +0xc5 U+0045 +0xc6 U+0046 +0xc7 U+0047 +0xc8 U+0048 +0xc9 U+0049 +0xca U+00ad +0xcb U+00f4 +0xcc U+00a6 +0xcd U+00f2 +0xce U+00f3 +0xcf U+00f5 +0xd0 U+00e5 +0xd1 U+004a +0xd2 U+004b +0xd3 U+004c +0xd4 U+004d +0xd5 U+004e +0xd6 U+004f +0xd7 U+0050 +0xd8 U+0051 +0xd9 U+0052 +0xda U+00b9 +0xdb U+00fb +0xdc U+007e +0xdd U+00f9 +0xde U+00fa +0xdf U+00ff +0xe0 U+00c9 +0xe1 U+00f7 +0xe2 U+0053 +0xe3 U+0054 +0xe4 U+0055 +0xe5 U+0056 +0xe6 U+0057 +0xe7 U+0058 +0xe8 U+0059 +0xe9 U+005a +0xea U+00b2 +0xeb U+00d4 +0xec U+0040 +0xed U+00d2 +0xee U+00d3 +0xef U+00d5 +0xf0 U+0030 +0xf1 U+0031 +0xf2 U+0032 +0xf3 U+0033 +0xf4 U+0034 +0xf5 U+0035 +0xf6 U+0036 +0xf7 U+0037 +0xf8 U+0038 +0xf9 U+0039 +0xfa U+00b3 +0xfb U+00db +0xfc U+00dc +0xfd U+00d9 +0xfe U+00da +0xff U+009f diff --git a/jdk/make/tools/CharsetMapping/IBM1144.c2b b/jdk/make/tools/CharsetMapping/IBM1144.c2b new file mode 100644 index 00000000000..6cb38028124 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1144.c2b @@ -0,0 +1 @@ +0x15 U+0085 diff --git a/jdk/make/tools/CharsetMapping/IBM1144.map b/jdk/make/tools/CharsetMapping/IBM1144.map new file mode 100644 index 00000000000..6c1ea6e5776 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1144.map @@ -0,0 +1,257 @@ +#Generated from IBM280.java with 0x9f <-> u+20ac +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+009c +0x05 U+0009 +0x06 U+0086 +0x07 U+007f +0x08 U+0097 +0x09 U+008d +0x0a U+008e +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+009d +0x15 U+000a +0x16 U+0008 +0x17 U+0087 +0x18 U+0018 +0x19 U+0019 +0x1a U+0092 +0x1b U+008f +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0080 +0x21 U+0081 +0x22 U+0082 +0x23 U+0083 +0x24 U+0084 +0x25 U+000a +0x26 U+0017 +0x27 U+001b +0x28 U+0088 +0x29 U+0089 +0x2a U+008a +0x2b U+008b +0x2c U+008c +0x2d U+0005 +0x2e U+0006 +0x2f U+0007 +0x30 U+0090 +0x31 U+0091 +0x32 U+0016 +0x33 U+0093 +0x34 U+0094 +0x35 U+0095 +0x36 U+0096 +0x37 U+0004 +0x38 U+0098 +0x39 U+0099 +0x3a U+009a +0x3b U+009b +0x3c U+0014 +0x3d U+0015 +0x3e U+009e +0x3f U+001a +0x40 U+0020 +0x41 U+00a0 +0x42 U+00e2 +0x43 U+00e4 +0x44 U+007b +0x45 U+00e1 +0x46 U+00e3 +0x47 U+00e5 +0x48 U+005c +0x49 U+00f1 +0x4a U+00b0 +0x4b U+002e +0x4c U+003c +0x4d U+0028 +0x4e U+002b +0x4f U+0021 +0x50 U+0026 +0x51 U+005d +0x52 U+00ea +0x53 U+00eb +0x54 U+007d +0x55 U+00ed +0x56 U+00ee +0x57 U+00ef +0x58 U+007e +0x59 U+00df +0x5a U+00e9 +0x5b U+0024 +0x5c U+002a +0x5d U+0029 +0x5e U+003b +0x5f U+005e +0x60 U+002d +0x61 U+002f +0x62 U+00c2 +0x63 U+00c4 +0x64 U+00c0 +0x65 U+00c1 +0x66 U+00c3 +0x67 U+00c5 +0x68 U+00c7 +0x69 U+00d1 +0x6a U+00f2 +0x6b U+002c +0x6c U+0025 +0x6d U+005f +0x6e U+003e +0x6f U+003f +0x70 U+00f8 +0x71 U+00c9 +0x72 U+00ca +0x73 U+00cb +0x74 U+00c8 +0x75 U+00cd +0x76 U+00ce +0x77 U+00cf +0x78 U+00cc +0x79 U+00f9 +0x7a U+003a +0x7b U+00a3 +0x7c U+00a7 +0x7d U+0027 +0x7e U+003d +0x7f U+0022 +0x80 U+00d8 +0x81 U+0061 +0x82 U+0062 +0x83 U+0063 +0x84 U+0064 +0x85 U+0065 +0x86 U+0066 +0x87 U+0067 +0x88 U+0068 +0x89 U+0069 +0x8a U+00ab +0x8b U+00bb +0x8c U+00f0 +0x8d U+00fd +0x8e U+00fe +0x8f U+00b1 +0x90 U+005b +0x91 U+006a +0x92 U+006b +0x93 U+006c +0x94 U+006d +0x95 U+006e +0x96 U+006f +0x97 U+0070 +0x98 U+0071 +0x99 U+0072 +0x9a U+00aa +0x9b U+00ba +0x9c U+00e6 +0x9d U+00b8 +0x9e U+00c6 +0x9f U+20ac +0xa0 U+00b5 +0xa1 U+00ec +0xa2 U+0073 +0xa3 U+0074 +0xa4 U+0075 +0xa5 U+0076 +0xa6 U+0077 +0xa7 U+0078 +0xa8 U+0079 +0xa9 U+007a +0xaa U+00a1 +0xab U+00bf +0xac U+00d0 +0xad U+00dd +0xae U+00de +0xaf U+00ae +0xb0 U+00a2 +0xb1 U+0023 +0xb2 U+00a5 +0xb3 U+00b7 +0xb4 U+00a9 +0xb5 U+0040 +0xb6 U+00b6 +0xb7 U+00bc +0xb8 U+00bd +0xb9 U+00be +0xba U+00ac +0xbb U+007c +0xbc U+00af +0xbd U+00a8 +0xbe U+00b4 +0xbf U+00d7 +0xc0 U+00e0 +0xc1 U+0041 +0xc2 U+0042 +0xc3 U+0043 +0xc4 U+0044 +0xc5 U+0045 +0xc6 U+0046 +0xc7 U+0047 +0xc8 U+0048 +0xc9 U+0049 +0xca U+00ad +0xcb U+00f4 +0xcc U+00f6 +0xcd U+00a6 +0xce U+00f3 +0xcf U+00f5 +0xd0 U+00e8 +0xd1 U+004a +0xd2 U+004b +0xd3 U+004c +0xd4 U+004d +0xd5 U+004e +0xd6 U+004f +0xd7 U+0050 +0xd8 U+0051 +0xd9 U+0052 +0xda U+00b9 +0xdb U+00fb +0xdc U+00fc +0xdd U+0060 +0xde U+00fa +0xdf U+00ff +0xe0 U+00e7 +0xe1 U+00f7 +0xe2 U+0053 +0xe3 U+0054 +0xe4 U+0055 +0xe5 U+0056 +0xe6 U+0057 +0xe7 U+0058 +0xe8 U+0059 +0xe9 U+005a +0xea U+00b2 +0xeb U+00d4 +0xec U+00d6 +0xed U+00d2 +0xee U+00d3 +0xef U+00d5 +0xf0 U+0030 +0xf1 U+0031 +0xf2 U+0032 +0xf3 U+0033 +0xf4 U+0034 +0xf5 U+0035 +0xf6 U+0036 +0xf7 U+0037 +0xf8 U+0038 +0xf9 U+0039 +0xfa U+00b3 +0xfb U+00db +0xfc U+00dc +0xfd U+00d9 +0xfe U+00da +0xff U+009f diff --git a/jdk/make/tools/CharsetMapping/IBM1145.c2b b/jdk/make/tools/CharsetMapping/IBM1145.c2b new file mode 100644 index 00000000000..6cb38028124 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1145.c2b @@ -0,0 +1 @@ +0x15 U+0085 diff --git a/jdk/make/tools/CharsetMapping/IBM1145.map b/jdk/make/tools/CharsetMapping/IBM1145.map new file mode 100644 index 00000000000..e009383b3d0 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1145.map @@ -0,0 +1,257 @@ +#Generated from IBM284.java with 0x9f <-> u+20ac +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+009c +0x05 U+0009 +0x06 U+0086 +0x07 U+007f +0x08 U+0097 +0x09 U+008d +0x0a U+008e +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+009d +0x15 U+000a +0x16 U+0008 +0x17 U+0087 +0x18 U+0018 +0x19 U+0019 +0x1a U+0092 +0x1b U+008f +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0080 +0x21 U+0081 +0x22 U+0082 +0x23 U+0083 +0x24 U+0084 +0x25 U+000a +0x26 U+0017 +0x27 U+001b +0x28 U+0088 +0x29 U+0089 +0x2a U+008a +0x2b U+008b +0x2c U+008c +0x2d U+0005 +0x2e U+0006 +0x2f U+0007 +0x30 U+0090 +0x31 U+0091 +0x32 U+0016 +0x33 U+0093 +0x34 U+0094 +0x35 U+0095 +0x36 U+0096 +0x37 U+0004 +0x38 U+0098 +0x39 U+0099 +0x3a U+009a +0x3b U+009b +0x3c U+0014 +0x3d U+0015 +0x3e U+009e +0x3f U+001a +0x40 U+0020 +0x41 U+00a0 +0x42 U+00e2 +0x43 U+00e4 +0x44 U+00e0 +0x45 U+00e1 +0x46 U+00e3 +0x47 U+00e5 +0x48 U+00e7 +0x49 U+00a6 +0x4a U+005b +0x4b U+002e +0x4c U+003c +0x4d U+0028 +0x4e U+002b +0x4f U+007c +0x50 U+0026 +0x51 U+00e9 +0x52 U+00ea +0x53 U+00eb +0x54 U+00e8 +0x55 U+00ed +0x56 U+00ee +0x57 U+00ef +0x58 U+00ec +0x59 U+00df +0x5a U+005d +0x5b U+0024 +0x5c U+002a +0x5d U+0029 +0x5e U+003b +0x5f U+00ac +0x60 U+002d +0x61 U+002f +0x62 U+00c2 +0x63 U+00c4 +0x64 U+00c0 +0x65 U+00c1 +0x66 U+00c3 +0x67 U+00c5 +0x68 U+00c7 +0x69 U+0023 +0x6a U+00f1 +0x6b U+002c +0x6c U+0025 +0x6d U+005f +0x6e U+003e +0x6f U+003f +0x70 U+00f8 +0x71 U+00c9 +0x72 U+00ca +0x73 U+00cb +0x74 U+00c8 +0x75 U+00cd +0x76 U+00ce +0x77 U+00cf +0x78 U+00cc +0x79 U+0060 +0x7a U+003a +0x7b U+00d1 +0x7c U+0040 +0x7d U+0027 +0x7e U+003d +0x7f U+0022 +0x80 U+00d8 +0x81 U+0061 +0x82 U+0062 +0x83 U+0063 +0x84 U+0064 +0x85 U+0065 +0x86 U+0066 +0x87 U+0067 +0x88 U+0068 +0x89 U+0069 +0x8a U+00ab +0x8b U+00bb +0x8c U+00f0 +0x8d U+00fd +0x8e U+00fe +0x8f U+00b1 +0x90 U+00b0 +0x91 U+006a +0x92 U+006b +0x93 U+006c +0x94 U+006d +0x95 U+006e +0x96 U+006f +0x97 U+0070 +0x98 U+0071 +0x99 U+0072 +0x9a U+00aa +0x9b U+00ba +0x9c U+00e6 +0x9d U+00b8 +0x9e U+00c6 +0x9f U+20ac +0xa0 U+00b5 +0xa1 U+00a8 +0xa2 U+0073 +0xa3 U+0074 +0xa4 U+0075 +0xa5 U+0076 +0xa6 U+0077 +0xa7 U+0078 +0xa8 U+0079 +0xa9 U+007a +0xaa U+00a1 +0xab U+00bf +0xac U+00d0 +0xad U+00dd +0xae U+00de +0xaf U+00ae +0xb0 U+00a2 +0xb1 U+00a3 +0xb2 U+00a5 +0xb3 U+00b7 +0xb4 U+00a9 +0xb5 U+00a7 +0xb6 U+00b6 +0xb7 U+00bc +0xb8 U+00bd +0xb9 U+00be +0xba U+005e +0xbb U+0021 +0xbc U+00af +0xbd U+007e +0xbe U+00b4 +0xbf U+00d7 +0xc0 U+007b +0xc1 U+0041 +0xc2 U+0042 +0xc3 U+0043 +0xc4 U+0044 +0xc5 U+0045 +0xc6 U+0046 +0xc7 U+0047 +0xc8 U+0048 +0xc9 U+0049 +0xca U+00ad +0xcb U+00f4 +0xcc U+00f6 +0xcd U+00f2 +0xce U+00f3 +0xcf U+00f5 +0xd0 U+007d +0xd1 U+004a +0xd2 U+004b +0xd3 U+004c +0xd4 U+004d +0xd5 U+004e +0xd6 U+004f +0xd7 U+0050 +0xd8 U+0051 +0xd9 U+0052 +0xda U+00b9 +0xdb U+00fb +0xdc U+00fc +0xdd U+00f9 +0xde U+00fa +0xdf U+00ff +0xe0 U+005c +0xe1 U+00f7 +0xe2 U+0053 +0xe3 U+0054 +0xe4 U+0055 +0xe5 U+0056 +0xe6 U+0057 +0xe7 U+0058 +0xe8 U+0059 +0xe9 U+005a +0xea U+00b2 +0xeb U+00d4 +0xec U+00d6 +0xed U+00d2 +0xee U+00d3 +0xef U+00d5 +0xf0 U+0030 +0xf1 U+0031 +0xf2 U+0032 +0xf3 U+0033 +0xf4 U+0034 +0xf5 U+0035 +0xf6 U+0036 +0xf7 U+0037 +0xf8 U+0038 +0xf9 U+0039 +0xfa U+00b3 +0xfb U+00db +0xfc U+00dc +0xfd U+00d9 +0xfe U+00da +0xff U+009f diff --git a/jdk/make/tools/CharsetMapping/IBM1146.c2b b/jdk/make/tools/CharsetMapping/IBM1146.c2b new file mode 100644 index 00000000000..6cb38028124 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1146.c2b @@ -0,0 +1 @@ +0x15 U+0085 diff --git a/jdk/make/tools/CharsetMapping/IBM1146.map b/jdk/make/tools/CharsetMapping/IBM1146.map new file mode 100644 index 00000000000..8ce57843f40 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1146.map @@ -0,0 +1,257 @@ +#Generated from IBM285.java with 0x9f <-> u+20ac +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+009c +0x05 U+0009 +0x06 U+0086 +0x07 U+007f +0x08 U+0097 +0x09 U+008d +0x0a U+008e +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+009d +0x15 U+000a +0x16 U+0008 +0x17 U+0087 +0x18 U+0018 +0x19 U+0019 +0x1a U+0092 +0x1b U+008f +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0080 +0x21 U+0081 +0x22 U+0082 +0x23 U+0083 +0x24 U+0084 +0x25 U+000a +0x26 U+0017 +0x27 U+001b +0x28 U+0088 +0x29 U+0089 +0x2a U+008a +0x2b U+008b +0x2c U+008c +0x2d U+0005 +0x2e U+0006 +0x2f U+0007 +0x30 U+0090 +0x31 U+0091 +0x32 U+0016 +0x33 U+0093 +0x34 U+0094 +0x35 U+0095 +0x36 U+0096 +0x37 U+0004 +0x38 U+0098 +0x39 U+0099 +0x3a U+009a +0x3b U+009b +0x3c U+0014 +0x3d U+0015 +0x3e U+009e +0x3f U+001a +0x40 U+0020 +0x41 U+00a0 +0x42 U+00e2 +0x43 U+00e4 +0x44 U+00e0 +0x45 U+00e1 +0x46 U+00e3 +0x47 U+00e5 +0x48 U+00e7 +0x49 U+00f1 +0x4a U+0024 +0x4b U+002e +0x4c U+003c +0x4d U+0028 +0x4e U+002b +0x4f U+007c +0x50 U+0026 +0x51 U+00e9 +0x52 U+00ea +0x53 U+00eb +0x54 U+00e8 +0x55 U+00ed +0x56 U+00ee +0x57 U+00ef +0x58 U+00ec +0x59 U+00df +0x5a U+0021 +0x5b U+00a3 +0x5c U+002a +0x5d U+0029 +0x5e U+003b +0x5f U+00ac +0x60 U+002d +0x61 U+002f +0x62 U+00c2 +0x63 U+00c4 +0x64 U+00c0 +0x65 U+00c1 +0x66 U+00c3 +0x67 U+00c5 +0x68 U+00c7 +0x69 U+00d1 +0x6a U+00a6 +0x6b U+002c +0x6c U+0025 +0x6d U+005f +0x6e U+003e +0x6f U+003f +0x70 U+00f8 +0x71 U+00c9 +0x72 U+00ca +0x73 U+00cb +0x74 U+00c8 +0x75 U+00cd +0x76 U+00ce +0x77 U+00cf +0x78 U+00cc +0x79 U+0060 +0x7a U+003a +0x7b U+0023 +0x7c U+0040 +0x7d U+0027 +0x7e U+003d +0x7f U+0022 +0x80 U+00d8 +0x81 U+0061 +0x82 U+0062 +0x83 U+0063 +0x84 U+0064 +0x85 U+0065 +0x86 U+0066 +0x87 U+0067 +0x88 U+0068 +0x89 U+0069 +0x8a U+00ab +0x8b U+00bb +0x8c U+00f0 +0x8d U+00fd +0x8e U+00fe +0x8f U+00b1 +0x90 U+00b0 +0x91 U+006a +0x92 U+006b +0x93 U+006c +0x94 U+006d +0x95 U+006e +0x96 U+006f +0x97 U+0070 +0x98 U+0071 +0x99 U+0072 +0x9a U+00aa +0x9b U+00ba +0x9c U+00e6 +0x9d U+00b8 +0x9e U+00c6 +0x9f U+20ac +0xa0 U+00b5 +0xa1 U+00af +0xa2 U+0073 +0xa3 U+0074 +0xa4 U+0075 +0xa5 U+0076 +0xa6 U+0077 +0xa7 U+0078 +0xa8 U+0079 +0xa9 U+007a +0xaa U+00a1 +0xab U+00bf +0xac U+00d0 +0xad U+00dd +0xae U+00de +0xaf U+00ae +0xb0 U+00a2 +0xb1 U+005b +0xb2 U+00a5 +0xb3 U+00b7 +0xb4 U+00a9 +0xb5 U+00a7 +0xb6 U+00b6 +0xb7 U+00bc +0xb8 U+00bd +0xb9 U+00be +0xba U+005e +0xbb U+005d +0xbc U+007e +0xbd U+00a8 +0xbe U+00b4 +0xbf U+00d7 +0xc0 U+007b +0xc1 U+0041 +0xc2 U+0042 +0xc3 U+0043 +0xc4 U+0044 +0xc5 U+0045 +0xc6 U+0046 +0xc7 U+0047 +0xc8 U+0048 +0xc9 U+0049 +0xca U+00ad +0xcb U+00f4 +0xcc U+00f6 +0xcd U+00f2 +0xce U+00f3 +0xcf U+00f5 +0xd0 U+007d +0xd1 U+004a +0xd2 U+004b +0xd3 U+004c +0xd4 U+004d +0xd5 U+004e +0xd6 U+004f +0xd7 U+0050 +0xd8 U+0051 +0xd9 U+0052 +0xda U+00b9 +0xdb U+00fb +0xdc U+00fc +0xdd U+00f9 +0xde U+00fa +0xdf U+00ff +0xe0 U+005c +0xe1 U+00f7 +0xe2 U+0053 +0xe3 U+0054 +0xe4 U+0055 +0xe5 U+0056 +0xe6 U+0057 +0xe7 U+0058 +0xe8 U+0059 +0xe9 U+005a +0xea U+00b2 +0xeb U+00d4 +0xec U+00d6 +0xed U+00d2 +0xee U+00d3 +0xef U+00d5 +0xf0 U+0030 +0xf1 U+0031 +0xf2 U+0032 +0xf3 U+0033 +0xf4 U+0034 +0xf5 U+0035 +0xf6 U+0036 +0xf7 U+0037 +0xf8 U+0038 +0xf9 U+0039 +0xfa U+00b3 +0xfb U+00db +0xfc U+00dc +0xfd U+00d9 +0xfe U+00da +0xff U+009f diff --git a/jdk/make/tools/CharsetMapping/IBM1147.c2b b/jdk/make/tools/CharsetMapping/IBM1147.c2b new file mode 100644 index 00000000000..6cb38028124 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1147.c2b @@ -0,0 +1 @@ +0x15 U+0085 diff --git a/jdk/make/tools/CharsetMapping/IBM1147.map b/jdk/make/tools/CharsetMapping/IBM1147.map new file mode 100644 index 00000000000..415628a435b --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1147.map @@ -0,0 +1,257 @@ +#Generated from IBM297.java 0x9f <-> u+20ac +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+009c +0x05 U+0009 +0x06 U+0086 +0x07 U+007f +0x08 U+0097 +0x09 U+008d +0x0a U+008e +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+009d +0x15 U+000a +0x16 U+0008 +0x17 U+0087 +0x18 U+0018 +0x19 U+0019 +0x1a U+0092 +0x1b U+008f +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0080 +0x21 U+0081 +0x22 U+0082 +0x23 U+0083 +0x24 U+0084 +0x25 U+000a +0x26 U+0017 +0x27 U+001b +0x28 U+0088 +0x29 U+0089 +0x2a U+008a +0x2b U+008b +0x2c U+008c +0x2d U+0005 +0x2e U+0006 +0x2f U+0007 +0x30 U+0090 +0x31 U+0091 +0x32 U+0016 +0x33 U+0093 +0x34 U+0094 +0x35 U+0095 +0x36 U+0096 +0x37 U+0004 +0x38 U+0098 +0x39 U+0099 +0x3a U+009a +0x3b U+009b +0x3c U+0014 +0x3d U+0015 +0x3e U+009e +0x3f U+001a +0x40 U+0020 +0x41 U+00a0 +0x42 U+00e2 +0x43 U+00e4 +0x44 U+0040 +0x45 U+00e1 +0x46 U+00e3 +0x47 U+00e5 +0x48 U+005c +0x49 U+00f1 +0x4a U+00b0 +0x4b U+002e +0x4c U+003c +0x4d U+0028 +0x4e U+002b +0x4f U+0021 +0x50 U+0026 +0x51 U+007b +0x52 U+00ea +0x53 U+00eb +0x54 U+007d +0x55 U+00ed +0x56 U+00ee +0x57 U+00ef +0x58 U+00ec +0x59 U+00df +0x5a U+00a7 +0x5b U+0024 +0x5c U+002a +0x5d U+0029 +0x5e U+003b +0x5f U+005e +0x60 U+002d +0x61 U+002f +0x62 U+00c2 +0x63 U+00c4 +0x64 U+00c0 +0x65 U+00c1 +0x66 U+00c3 +0x67 U+00c5 +0x68 U+00c7 +0x69 U+00d1 +0x6a U+00f9 +0x6b U+002c +0x6c U+0025 +0x6d U+005f +0x6e U+003e +0x6f U+003f +0x70 U+00f8 +0x71 U+00c9 +0x72 U+00ca +0x73 U+00cb +0x74 U+00c8 +0x75 U+00cd +0x76 U+00ce +0x77 U+00cf +0x78 U+00cc +0x79 U+00b5 +0x7a U+003a +0x7b U+00a3 +0x7c U+00e0 +0x7d U+0027 +0x7e U+003d +0x7f U+0022 +0x80 U+00d8 +0x81 U+0061 +0x82 U+0062 +0x83 U+0063 +0x84 U+0064 +0x85 U+0065 +0x86 U+0066 +0x87 U+0067 +0x88 U+0068 +0x89 U+0069 +0x8a U+00ab +0x8b U+00bb +0x8c U+00f0 +0x8d U+00fd +0x8e U+00fe +0x8f U+00b1 +0x90 U+005b +0x91 U+006a +0x92 U+006b +0x93 U+006c +0x94 U+006d +0x95 U+006e +0x96 U+006f +0x97 U+0070 +0x98 U+0071 +0x99 U+0072 +0x9a U+00aa +0x9b U+00ba +0x9c U+00e6 +0x9d U+00b8 +0x9e U+00c6 +0x9f U+20ac +0xa0 U+0060 +0xa1 U+00a8 +0xa2 U+0073 +0xa3 U+0074 +0xa4 U+0075 +0xa5 U+0076 +0xa6 U+0077 +0xa7 U+0078 +0xa8 U+0079 +0xa9 U+007a +0xaa U+00a1 +0xab U+00bf +0xac U+00d0 +0xad U+00dd +0xae U+00de +0xaf U+00ae +0xb0 U+00a2 +0xb1 U+0023 +0xb2 U+00a5 +0xb3 U+00b7 +0xb4 U+00a9 +0xb5 U+005d +0xb6 U+00b6 +0xb7 U+00bc +0xb8 U+00bd +0xb9 U+00be +0xba U+00ac +0xbb U+007c +0xbc U+00af +0xbd U+007e +0xbe U+00b4 +0xbf U+00d7 +0xc0 U+00e9 +0xc1 U+0041 +0xc2 U+0042 +0xc3 U+0043 +0xc4 U+0044 +0xc5 U+0045 +0xc6 U+0046 +0xc7 U+0047 +0xc8 U+0048 +0xc9 U+0049 +0xca U+00ad +0xcb U+00f4 +0xcc U+00f6 +0xcd U+00f2 +0xce U+00f3 +0xcf U+00f5 +0xd0 U+00e8 +0xd1 U+004a +0xd2 U+004b +0xd3 U+004c +0xd4 U+004d +0xd5 U+004e +0xd6 U+004f +0xd7 U+0050 +0xd8 U+0051 +0xd9 U+0052 +0xda U+00b9 +0xdb U+00fb +0xdc U+00fc +0xdd U+00a6 +0xde U+00fa +0xdf U+00ff +0xe0 U+00e7 +0xe1 U+00f7 +0xe2 U+0053 +0xe3 U+0054 +0xe4 U+0055 +0xe5 U+0056 +0xe6 U+0057 +0xe7 U+0058 +0xe8 U+0059 +0xe9 U+005a +0xea U+00b2 +0xeb U+00d4 +0xec U+00d6 +0xed U+00d2 +0xee U+00d3 +0xef U+00d5 +0xf0 U+0030 +0xf1 U+0031 +0xf2 U+0032 +0xf3 U+0033 +0xf4 U+0034 +0xf5 U+0035 +0xf6 U+0036 +0xf7 U+0037 +0xf8 U+0038 +0xf9 U+0039 +0xfa U+00b3 +0xfb U+00db +0xfc U+00dc +0xfd U+00d9 +0xfe U+00da +0xff U+009f diff --git a/jdk/make/tools/CharsetMapping/IBM1148.c2b b/jdk/make/tools/CharsetMapping/IBM1148.c2b new file mode 100644 index 00000000000..6cb38028124 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1148.c2b @@ -0,0 +1 @@ +0x15 U+0085 diff --git a/jdk/make/tools/CharsetMapping/IBM1148.map b/jdk/make/tools/CharsetMapping/IBM1148.map new file mode 100644 index 00000000000..3f58284847c --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1148.map @@ -0,0 +1,257 @@ +#Generated from IBM500.java 0x9f <-> u+20ac +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+009c +0x05 U+0009 +0x06 U+0086 +0x07 U+007f +0x08 U+0097 +0x09 U+008d +0x0a U+008e +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+009d +0x15 U+000a +0x16 U+0008 +0x17 U+0087 +0x18 U+0018 +0x19 U+0019 +0x1a U+0092 +0x1b U+008f +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0080 +0x21 U+0081 +0x22 U+0082 +0x23 U+0083 +0x24 U+0084 +0x25 U+000a +0x26 U+0017 +0x27 U+001b +0x28 U+0088 +0x29 U+0089 +0x2a U+008a +0x2b U+008b +0x2c U+008c +0x2d U+0005 +0x2e U+0006 +0x2f U+0007 +0x30 U+0090 +0x31 U+0091 +0x32 U+0016 +0x33 U+0093 +0x34 U+0094 +0x35 U+0095 +0x36 U+0096 +0x37 U+0004 +0x38 U+0098 +0x39 U+0099 +0x3a U+009a +0x3b U+009b +0x3c U+0014 +0x3d U+0015 +0x3e U+009e +0x3f U+001a +0x40 U+0020 +0x41 U+00a0 +0x42 U+00e2 +0x43 U+00e4 +0x44 U+00e0 +0x45 U+00e1 +0x46 U+00e3 +0x47 U+00e5 +0x48 U+00e7 +0x49 U+00f1 +0x4a U+005b +0x4b U+002e +0x4c U+003c +0x4d U+0028 +0x4e U+002b +0x4f U+0021 +0x50 U+0026 +0x51 U+00e9 +0x52 U+00ea +0x53 U+00eb +0x54 U+00e8 +0x55 U+00ed +0x56 U+00ee +0x57 U+00ef +0x58 U+00ec +0x59 U+00df +0x5a U+005d +0x5b U+0024 +0x5c U+002a +0x5d U+0029 +0x5e U+003b +0x5f U+005e +0x60 U+002d +0x61 U+002f +0x62 U+00c2 +0x63 U+00c4 +0x64 U+00c0 +0x65 U+00c1 +0x66 U+00c3 +0x67 U+00c5 +0x68 U+00c7 +0x69 U+00d1 +0x6a U+00a6 +0x6b U+002c +0x6c U+0025 +0x6d U+005f +0x6e U+003e +0x6f U+003f +0x70 U+00f8 +0x71 U+00c9 +0x72 U+00ca +0x73 U+00cb +0x74 U+00c8 +0x75 U+00cd +0x76 U+00ce +0x77 U+00cf +0x78 U+00cc +0x79 U+0060 +0x7a U+003a +0x7b U+0023 +0x7c U+0040 +0x7d U+0027 +0x7e U+003d +0x7f U+0022 +0x80 U+00d8 +0x81 U+0061 +0x82 U+0062 +0x83 U+0063 +0x84 U+0064 +0x85 U+0065 +0x86 U+0066 +0x87 U+0067 +0x88 U+0068 +0x89 U+0069 +0x8a U+00ab +0x8b U+00bb +0x8c U+00f0 +0x8d U+00fd +0x8e U+00fe +0x8f U+00b1 +0x90 U+00b0 +0x91 U+006a +0x92 U+006b +0x93 U+006c +0x94 U+006d +0x95 U+006e +0x96 U+006f +0x97 U+0070 +0x98 U+0071 +0x99 U+0072 +0x9a U+00aa +0x9b U+00ba +0x9c U+00e6 +0x9d U+00b8 +0x9e U+00c6 +0x9f U+20ac +0xa0 U+00b5 +0xa1 U+007e +0xa2 U+0073 +0xa3 U+0074 +0xa4 U+0075 +0xa5 U+0076 +0xa6 U+0077 +0xa7 U+0078 +0xa8 U+0079 +0xa9 U+007a +0xaa U+00a1 +0xab U+00bf +0xac U+00d0 +0xad U+00dd +0xae U+00de +0xaf U+00ae +0xb0 U+00a2 +0xb1 U+00a3 +0xb2 U+00a5 +0xb3 U+00b7 +0xb4 U+00a9 +0xb5 U+00a7 +0xb6 U+00b6 +0xb7 U+00bc +0xb8 U+00bd +0xb9 U+00be +0xba U+00ac +0xbb U+007c +0xbc U+00af +0xbd U+00a8 +0xbe U+00b4 +0xbf U+00d7 +0xc0 U+007b +0xc1 U+0041 +0xc2 U+0042 +0xc3 U+0043 +0xc4 U+0044 +0xc5 U+0045 +0xc6 U+0046 +0xc7 U+0047 +0xc8 U+0048 +0xc9 U+0049 +0xca U+00ad +0xcb U+00f4 +0xcc U+00f6 +0xcd U+00f2 +0xce U+00f3 +0xcf U+00f5 +0xd0 U+007d +0xd1 U+004a +0xd2 U+004b +0xd3 U+004c +0xd4 U+004d +0xd5 U+004e +0xd6 U+004f +0xd7 U+0050 +0xd8 U+0051 +0xd9 U+0052 +0xda U+00b9 +0xdb U+00fb +0xdc U+00fc +0xdd U+00f9 +0xde U+00fa +0xdf U+00ff +0xe0 U+005c +0xe1 U+00f7 +0xe2 U+0053 +0xe3 U+0054 +0xe4 U+0055 +0xe5 U+0056 +0xe6 U+0057 +0xe7 U+0058 +0xe8 U+0059 +0xe9 U+005a +0xea U+00b2 +0xeb U+00d4 +0xec U+00d6 +0xed U+00d2 +0xee U+00d3 +0xef U+00d5 +0xf0 U+0030 +0xf1 U+0031 +0xf2 U+0032 +0xf3 U+0033 +0xf4 U+0034 +0xf5 U+0035 +0xf6 U+0036 +0xf7 U+0037 +0xf8 U+0038 +0xf9 U+0039 +0xfa U+00b3 +0xfb U+00db +0xfc U+00dc +0xfd U+00d9 +0xfe U+00da +0xff U+009f diff --git a/jdk/make/tools/CharsetMapping/IBM1149.c2b b/jdk/make/tools/CharsetMapping/IBM1149.c2b new file mode 100644 index 00000000000..6cb38028124 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1149.c2b @@ -0,0 +1 @@ +0x15 U+0085 diff --git a/jdk/make/tools/CharsetMapping/IBM1149.map b/jdk/make/tools/CharsetMapping/IBM1149.map new file mode 100644 index 00000000000..8d452004860 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM1149.map @@ -0,0 +1,257 @@ +#Generated from IBM871.java 0x9f <-> u+20ac +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+009c +0x05 U+0009 +0x06 U+0086 +0x07 U+007f +0x08 U+0097 +0x09 U+008d +0x0a U+008e +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+009d +0x15 U+000a +0x16 U+0008 +0x17 U+0087 +0x18 U+0018 +0x19 U+0019 +0x1a U+0092 +0x1b U+008f +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0080 +0x21 U+0081 +0x22 U+0082 +0x23 U+0083 +0x24 U+0084 +0x25 U+000a +0x26 U+0017 +0x27 U+001b +0x28 U+0088 +0x29 U+0089 +0x2a U+008a +0x2b U+008b +0x2c U+008c +0x2d U+0005 +0x2e U+0006 +0x2f U+0007 +0x30 U+0090 +0x31 U+0091 +0x32 U+0016 +0x33 U+0093 +0x34 U+0094 +0x35 U+0095 +0x36 U+0096 +0x37 U+0004 +0x38 U+0098 +0x39 U+0099 +0x3a U+009a +0x3b U+009b +0x3c U+0014 +0x3d U+0015 +0x3e U+009e +0x3f U+001a +0x40 U+0020 +0x41 U+00a0 +0x42 U+00e2 +0x43 U+00e4 +0x44 U+00e0 +0x45 U+00e1 +0x46 U+00e3 +0x47 U+00e5 +0x48 U+00e7 +0x49 U+00f1 +0x4a U+00de +0x4b U+002e +0x4c U+003c +0x4d U+0028 +0x4e U+002b +0x4f U+0021 +0x50 U+0026 +0x51 U+00e9 +0x52 U+00ea +0x53 U+00eb +0x54 U+00e8 +0x55 U+00ed +0x56 U+00ee +0x57 U+00ef +0x58 U+00ec +0x59 U+00df +0x5a U+00c6 +0x5b U+0024 +0x5c U+002a +0x5d U+0029 +0x5e U+003b +0x5f U+00d6 +0x60 U+002d +0x61 U+002f +0x62 U+00c2 +0x63 U+00c4 +0x64 U+00c0 +0x65 U+00c1 +0x66 U+00c3 +0x67 U+00c5 +0x68 U+00c7 +0x69 U+00d1 +0x6a U+00a6 +0x6b U+002c +0x6c U+0025 +0x6d U+005f +0x6e U+003e +0x6f U+003f +0x70 U+00f8 +0x71 U+00c9 +0x72 U+00ca +0x73 U+00cb +0x74 U+00c8 +0x75 U+00cd +0x76 U+00ce +0x77 U+00cf +0x78 U+00cc +0x79 U+00f0 +0x7a U+003a +0x7b U+0023 +0x7c U+00d0 +0x7d U+0027 +0x7e U+003d +0x7f U+0022 +0x80 U+00d8 +0x81 U+0061 +0x82 U+0062 +0x83 U+0063 +0x84 U+0064 +0x85 U+0065 +0x86 U+0066 +0x87 U+0067 +0x88 U+0068 +0x89 U+0069 +0x8a U+00ab +0x8b U+00bb +0x8c U+0060 +0x8d U+00fd +0x8e U+007b +0x8f U+00b1 +0x90 U+00b0 +0x91 U+006a +0x92 U+006b +0x93 U+006c +0x94 U+006d +0x95 U+006e +0x96 U+006f +0x97 U+0070 +0x98 U+0071 +0x99 U+0072 +0x9a U+00aa +0x9b U+00ba +0x9c U+007d +0x9d U+00b8 +0x9e U+005d +0x9f U+20ac +0xa0 U+00b5 +0xa1 U+00f6 +0xa2 U+0073 +0xa3 U+0074 +0xa4 U+0075 +0xa5 U+0076 +0xa6 U+0077 +0xa7 U+0078 +0xa8 U+0079 +0xa9 U+007a +0xaa U+00a1 +0xab U+00bf +0xac U+0040 +0xad U+00dd +0xae U+005b +0xaf U+00ae +0xb0 U+00a2 +0xb1 U+00a3 +0xb2 U+00a5 +0xb3 U+00b7 +0xb4 U+00a9 +0xb5 U+00a7 +0xb6 U+00b6 +0xb7 U+00bc +0xb8 U+00bd +0xb9 U+00be +0xba U+00ac +0xbb U+007c +0xbc U+00af +0xbd U+00a8 +0xbe U+005c +0xbf U+00d7 +0xc0 U+00fe +0xc1 U+0041 +0xc2 U+0042 +0xc3 U+0043 +0xc4 U+0044 +0xc5 U+0045 +0xc6 U+0046 +0xc7 U+0047 +0xc8 U+0048 +0xc9 U+0049 +0xca U+00ad +0xcb U+00f4 +0xcc U+007e +0xcd U+00f2 +0xce U+00f3 +0xcf U+00f5 +0xd0 U+00e6 +0xd1 U+004a +0xd2 U+004b +0xd3 U+004c +0xd4 U+004d +0xd5 U+004e +0xd6 U+004f +0xd7 U+0050 +0xd8 U+0051 +0xd9 U+0052 +0xda U+00b9 +0xdb U+00fb +0xdc U+00fc +0xdd U+00f9 +0xde U+00fa +0xdf U+00ff +0xe0 U+00b4 +0xe1 U+00f7 +0xe2 U+0053 +0xe3 U+0054 +0xe4 U+0055 +0xe5 U+0056 +0xe6 U+0057 +0xe7 U+0058 +0xe8 U+0059 +0xe9 U+005a +0xea U+00b2 +0xeb U+00d4 +0xec U+005e +0xed U+00d2 +0xee U+00d3 +0xef U+00d5 +0xf0 U+0030 +0xf1 U+0031 +0xf2 U+0032 +0xf3 U+0033 +0xf4 U+0034 +0xf5 U+0035 +0xf6 U+0036 +0xf7 U+0037 +0xf8 U+0038 +0xf9 U+0039 +0xfa U+00b3 +0xfb U+00db +0xfc U+00dc +0xfd U+00d9 +0xfe U+00da +0xff U+009f diff --git a/jdk/make/tools/CharsetMapping/IBM273.c2b b/jdk/make/tools/CharsetMapping/IBM273.c2b new file mode 100644 index 00000000000..6cb38028124 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM273.c2b @@ -0,0 +1 @@ +0x15 U+0085 diff --git a/jdk/make/tools/CharsetMapping/IBM273.map b/jdk/make/tools/CharsetMapping/IBM273.map new file mode 100644 index 00000000000..690858d0263 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM273.map @@ -0,0 +1,257 @@ +#Generated from IBM273.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+009c +0x05 U+0009 +0x06 U+0086 +0x07 U+007f +0x08 U+0097 +0x09 U+008d +0x0a U+008e +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+009d +0x15 U+000a +0x16 U+0008 +0x17 U+0087 +0x18 U+0018 +0x19 U+0019 +0x1a U+0092 +0x1b U+008f +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0080 +0x21 U+0081 +0x22 U+0082 +0x23 U+0083 +0x24 U+0084 +0x25 U+000a +0x26 U+0017 +0x27 U+001b +0x28 U+0088 +0x29 U+0089 +0x2a U+008a +0x2b U+008b +0x2c U+008c +0x2d U+0005 +0x2e U+0006 +0x2f U+0007 +0x30 U+0090 +0x31 U+0091 +0x32 U+0016 +0x33 U+0093 +0x34 U+0094 +0x35 U+0095 +0x36 U+0096 +0x37 U+0004 +0x38 U+0098 +0x39 U+0099 +0x3a U+009a +0x3b U+009b +0x3c U+0014 +0x3d U+0015 +0x3e U+009e +0x3f U+001a +0x40 U+0020 +0x41 U+00a0 +0x42 U+00e2 +0x43 U+007b +0x44 U+00e0 +0x45 U+00e1 +0x46 U+00e3 +0x47 U+00e5 +0x48 U+00e7 +0x49 U+00f1 +0x4a U+00c4 +0x4b U+002e +0x4c U+003c +0x4d U+0028 +0x4e U+002b +0x4f U+0021 +0x50 U+0026 +0x51 U+00e9 +0x52 U+00ea +0x53 U+00eb +0x54 U+00e8 +0x55 U+00ed +0x56 U+00ee +0x57 U+00ef +0x58 U+00ec +0x59 U+007e +0x5a U+00dc +0x5b U+0024 +0x5c U+002a +0x5d U+0029 +0x5e U+003b +0x5f U+005e +0x60 U+002d +0x61 U+002f +0x62 U+00c2 +0x63 U+005b +0x64 U+00c0 +0x65 U+00c1 +0x66 U+00c3 +0x67 U+00c5 +0x68 U+00c7 +0x69 U+00d1 +0x6a U+00f6 +0x6b U+002c +0x6c U+0025 +0x6d U+005f +0x6e U+003e +0x6f U+003f +0x70 U+00f8 +0x71 U+00c9 +0x72 U+00ca +0x73 U+00cb +0x74 U+00c8 +0x75 U+00cd +0x76 U+00ce +0x77 U+00cf +0x78 U+00cc +0x79 U+0060 +0x7a U+003a +0x7b U+0023 +0x7c U+00a7 +0x7d U+0027 +0x7e U+003d +0x7f U+0022 +0x80 U+00d8 +0x81 U+0061 +0x82 U+0062 +0x83 U+0063 +0x84 U+0064 +0x85 U+0065 +0x86 U+0066 +0x87 U+0067 +0x88 U+0068 +0x89 U+0069 +0x8a U+00ab +0x8b U+00bb +0x8c U+00f0 +0x8d U+00fd +0x8e U+00fe +0x8f U+00b1 +0x90 U+00b0 +0x91 U+006a +0x92 U+006b +0x93 U+006c +0x94 U+006d +0x95 U+006e +0x96 U+006f +0x97 U+0070 +0x98 U+0071 +0x99 U+0072 +0x9a U+00aa +0x9b U+00ba +0x9c U+00e6 +0x9d U+00b8 +0x9e U+00c6 +0x9f U+00a4 +0xa0 U+00b5 +0xa1 U+00df +0xa2 U+0073 +0xa3 U+0074 +0xa4 U+0075 +0xa5 U+0076 +0xa6 U+0077 +0xa7 U+0078 +0xa8 U+0079 +0xa9 U+007a +0xaa U+00a1 +0xab U+00bf +0xac U+00d0 +0xad U+00dd +0xae U+00de +0xaf U+00ae +0xb0 U+00a2 +0xb1 U+00a3 +0xb2 U+00a5 +0xb3 U+00b7 +0xb4 U+00a9 +0xb5 U+0040 +0xb6 U+00b6 +0xb7 U+00bc +0xb8 U+00bd +0xb9 U+00be +0xba U+00ac +0xbb U+007c +0xbc U+00af +0xbd U+00a8 +0xbe U+00b4 +0xbf U+00d7 +0xc0 U+00e4 +0xc1 U+0041 +0xc2 U+0042 +0xc3 U+0043 +0xc4 U+0044 +0xc5 U+0045 +0xc6 U+0046 +0xc7 U+0047 +0xc8 U+0048 +0xc9 U+0049 +0xca U+00ad +0xcb U+00f4 +0xcc U+00a6 +0xcd U+00f2 +0xce U+00f3 +0xcf U+00f5 +0xd0 U+00fc +0xd1 U+004a +0xd2 U+004b +0xd3 U+004c +0xd4 U+004d +0xd5 U+004e +0xd6 U+004f +0xd7 U+0050 +0xd8 U+0051 +0xd9 U+0052 +0xda U+00b9 +0xdb U+00fb +0xdc U+007d +0xdd U+00f9 +0xde U+00fa +0xdf U+00ff +0xe0 U+00d6 +0xe1 U+00f7 +0xe2 U+0053 +0xe3 U+0054 +0xe4 U+0055 +0xe5 U+0056 +0xe6 U+0057 +0xe7 U+0058 +0xe8 U+0059 +0xe9 U+005a +0xea U+00b2 +0xeb U+00d4 +0xec U+005c +0xed U+00d2 +0xee U+00d3 +0xef U+00d5 +0xf0 U+0030 +0xf1 U+0031 +0xf2 U+0032 +0xf3 U+0033 +0xf4 U+0034 +0xf5 U+0035 +0xf6 U+0036 +0xf7 U+0037 +0xf8 U+0038 +0xf9 U+0039 +0xfa U+00b3 +0xfb U+00db +0xfc U+005d +0xfd U+00d9 +0xfe U+00da +0xff U+009f diff --git a/jdk/make/tools/CharsetMapping/IBM273.nr b/jdk/make/tools/CharsetMapping/IBM273.nr new file mode 100644 index 00000000000..675451906d4 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM273.nr @@ -0,0 +1 @@ +0x25 U+000a diff --git a/jdk/make/tools/CharsetMapping/IBM277.c2b b/jdk/make/tools/CharsetMapping/IBM277.c2b new file mode 100644 index 00000000000..6cb38028124 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM277.c2b @@ -0,0 +1 @@ +0x15 U+0085 diff --git a/jdk/make/tools/CharsetMapping/IBM277.map b/jdk/make/tools/CharsetMapping/IBM277.map new file mode 100644 index 00000000000..957f516c3a5 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM277.map @@ -0,0 +1,257 @@ +#Generated from IBM277.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+009c +0x05 U+0009 +0x06 U+0086 +0x07 U+007f +0x08 U+0097 +0x09 U+008d +0x0a U+008e +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+009d +0x15 U+000a +0x16 U+0008 +0x17 U+0087 +0x18 U+0018 +0x19 U+0019 +0x1a U+0092 +0x1b U+008f +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0080 +0x21 U+0081 +0x22 U+0082 +0x23 U+0083 +0x24 U+0084 +0x25 U+000a +0x26 U+0017 +0x27 U+001b +0x28 U+0088 +0x29 U+0089 +0x2a U+008a +0x2b U+008b +0x2c U+008c +0x2d U+0005 +0x2e U+0006 +0x2f U+0007 +0x30 U+0090 +0x31 U+0091 +0x32 U+0016 +0x33 U+0093 +0x34 U+0094 +0x35 U+0095 +0x36 U+0096 +0x37 U+0004 +0x38 U+0098 +0x39 U+0099 +0x3a U+009a +0x3b U+009b +0x3c U+0014 +0x3d U+0015 +0x3e U+009e +0x3f U+001a +0x40 U+0020 +0x41 U+00a0 +0x42 U+00e2 +0x43 U+00e4 +0x44 U+00e0 +0x45 U+00e1 +0x46 U+00e3 +0x47 U+007d +0x48 U+00e7 +0x49 U+00f1 +0x4a U+0023 +0x4b U+002e +0x4c U+003c +0x4d U+0028 +0x4e U+002b +0x4f U+0021 +0x50 U+0026 +0x51 U+00e9 +0x52 U+00ea +0x53 U+00eb +0x54 U+00e8 +0x55 U+00ed +0x56 U+00ee +0x57 U+00ef +0x58 U+00ec +0x59 U+00df +0x5a U+00a4 +0x5b U+00c5 +0x5c U+002a +0x5d U+0029 +0x5e U+003b +0x5f U+005e +0x60 U+002d +0x61 U+002f +0x62 U+00c2 +0x63 U+00c4 +0x64 U+00c0 +0x65 U+00c1 +0x66 U+00c3 +0x67 U+0024 +0x68 U+00c7 +0x69 U+00d1 +0x6a U+00f8 +0x6b U+002c +0x6c U+0025 +0x6d U+005f +0x6e U+003e +0x6f U+003f +0x70 U+00a6 +0x71 U+00c9 +0x72 U+00ca +0x73 U+00cb +0x74 U+00c8 +0x75 U+00cd +0x76 U+00ce +0x77 U+00cf +0x78 U+00cc +0x79 U+0060 +0x7a U+003a +0x7b U+00c6 +0x7c U+00d8 +0x7d U+0027 +0x7e U+003d +0x7f U+0022 +0x80 U+0040 +0x81 U+0061 +0x82 U+0062 +0x83 U+0063 +0x84 U+0064 +0x85 U+0065 +0x86 U+0066 +0x87 U+0067 +0x88 U+0068 +0x89 U+0069 +0x8a U+00ab +0x8b U+00bb +0x8c U+00f0 +0x8d U+00fd +0x8e U+00fe +0x8f U+00b1 +0x90 U+00b0 +0x91 U+006a +0x92 U+006b +0x93 U+006c +0x94 U+006d +0x95 U+006e +0x96 U+006f +0x97 U+0070 +0x98 U+0071 +0x99 U+0072 +0x9a U+00aa +0x9b U+00ba +0x9c U+007b +0x9d U+00b8 +0x9e U+005b +0x9f U+005d +0xa0 U+00b5 +0xa1 U+00fc +0xa2 U+0073 +0xa3 U+0074 +0xa4 U+0075 +0xa5 U+0076 +0xa6 U+0077 +0xa7 U+0078 +0xa8 U+0079 +0xa9 U+007a +0xaa U+00a1 +0xab U+00bf +0xac U+00d0 +0xad U+00dd +0xae U+00de +0xaf U+00ae +0xb0 U+00a2 +0xb1 U+00a3 +0xb2 U+00a5 +0xb3 U+00b7 +0xb4 U+00a9 +0xb5 U+00a7 +0xb6 U+00b6 +0xb7 U+00bc +0xb8 U+00bd +0xb9 U+00be +0xba U+00ac +0xbb U+007c +0xbc U+00af +0xbd U+00a8 +0xbe U+00b4 +0xbf U+00d7 +0xc0 U+00e6 +0xc1 U+0041 +0xc2 U+0042 +0xc3 U+0043 +0xc4 U+0044 +0xc5 U+0045 +0xc6 U+0046 +0xc7 U+0047 +0xc8 U+0048 +0xc9 U+0049 +0xca U+00ad +0xcb U+00f4 +0xcc U+00f6 +0xcd U+00f2 +0xce U+00f3 +0xcf U+00f5 +0xd0 U+00e5 +0xd1 U+004a +0xd2 U+004b +0xd3 U+004c +0xd4 U+004d +0xd5 U+004e +0xd6 U+004f +0xd7 U+0050 +0xd8 U+0051 +0xd9 U+0052 +0xda U+00b9 +0xdb U+00fb +0xdc U+007e +0xdd U+00f9 +0xde U+00fa +0xdf U+00ff +0xe0 U+005c +0xe1 U+00f7 +0xe2 U+0053 +0xe3 U+0054 +0xe4 U+0055 +0xe5 U+0056 +0xe6 U+0057 +0xe7 U+0058 +0xe8 U+0059 +0xe9 U+005a +0xea U+00b2 +0xeb U+00d4 +0xec U+00d6 +0xed U+00d2 +0xee U+00d3 +0xef U+00d5 +0xf0 U+0030 +0xf1 U+0031 +0xf2 U+0032 +0xf3 U+0033 +0xf4 U+0034 +0xf5 U+0035 +0xf6 U+0036 +0xf7 U+0037 +0xf8 U+0038 +0xf9 U+0039 +0xfa U+00b3 +0xfb U+00db +0xfc U+00dc +0xfd U+00d9 +0xfe U+00da +0xff U+009f diff --git a/jdk/make/tools/CharsetMapping/IBM277.nr b/jdk/make/tools/CharsetMapping/IBM277.nr new file mode 100644 index 00000000000..675451906d4 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM277.nr @@ -0,0 +1 @@ +0x25 U+000a diff --git a/jdk/make/tools/CharsetMapping/IBM278.c2b b/jdk/make/tools/CharsetMapping/IBM278.c2b new file mode 100644 index 00000000000..6cb38028124 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM278.c2b @@ -0,0 +1 @@ +0x15 U+0085 diff --git a/jdk/make/tools/CharsetMapping/IBM278.map b/jdk/make/tools/CharsetMapping/IBM278.map new file mode 100644 index 00000000000..51eac1ffa4d --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM278.map @@ -0,0 +1,257 @@ +#Generated from IBM278.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+009c +0x05 U+0009 +0x06 U+0086 +0x07 U+007f +0x08 U+0097 +0x09 U+008d +0x0a U+008e +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+009d +0x15 U+000a +0x16 U+0008 +0x17 U+0087 +0x18 U+0018 +0x19 U+0019 +0x1a U+0092 +0x1b U+008f +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0080 +0x21 U+0081 +0x22 U+0082 +0x23 U+0083 +0x24 U+0084 +0x25 U+000a +0x26 U+0017 +0x27 U+001b +0x28 U+0088 +0x29 U+0089 +0x2a U+008a +0x2b U+008b +0x2c U+008c +0x2d U+0005 +0x2e U+0006 +0x2f U+0007 +0x30 U+0090 +0x31 U+0091 +0x32 U+0016 +0x33 U+0093 +0x34 U+0094 +0x35 U+0095 +0x36 U+0096 +0x37 U+0004 +0x38 U+0098 +0x39 U+0099 +0x3a U+009a +0x3b U+009b +0x3c U+0014 +0x3d U+0015 +0x3e U+009e +0x3f U+001a +0x40 U+0020 +0x41 U+00a0 +0x42 U+00e2 +0x43 U+007b +0x44 U+00e0 +0x45 U+00e1 +0x46 U+00e3 +0x47 U+007d +0x48 U+00e7 +0x49 U+00f1 +0x4a U+00a7 +0x4b U+002e +0x4c U+003c +0x4d U+0028 +0x4e U+002b +0x4f U+0021 +0x50 U+0026 +0x51 U+0060 +0x52 U+00ea +0x53 U+00eb +0x54 U+00e8 +0x55 U+00ed +0x56 U+00ee +0x57 U+00ef +0x58 U+00ec +0x59 U+00df +0x5a U+00a4 +0x5b U+00c5 +0x5c U+002a +0x5d U+0029 +0x5e U+003b +0x5f U+005e +0x60 U+002d +0x61 U+002f +0x62 U+00c2 +0x63 U+0023 +0x64 U+00c0 +0x65 U+00c1 +0x66 U+00c3 +0x67 U+0024 +0x68 U+00c7 +0x69 U+00d1 +0x6a U+00f6 +0x6b U+002c +0x6c U+0025 +0x6d U+005f +0x6e U+003e +0x6f U+003f +0x70 U+00f8 +0x71 U+005c +0x72 U+00ca +0x73 U+00cb +0x74 U+00c8 +0x75 U+00cd +0x76 U+00ce +0x77 U+00cf +0x78 U+00cc +0x79 U+00e9 +0x7a U+003a +0x7b U+00c4 +0x7c U+00d6 +0x7d U+0027 +0x7e U+003d +0x7f U+0022 +0x80 U+00d8 +0x81 U+0061 +0x82 U+0062 +0x83 U+0063 +0x84 U+0064 +0x85 U+0065 +0x86 U+0066 +0x87 U+0067 +0x88 U+0068 +0x89 U+0069 +0x8a U+00ab +0x8b U+00bb +0x8c U+00f0 +0x8d U+00fd +0x8e U+00fe +0x8f U+00b1 +0x90 U+00b0 +0x91 U+006a +0x92 U+006b +0x93 U+006c +0x94 U+006d +0x95 U+006e +0x96 U+006f +0x97 U+0070 +0x98 U+0071 +0x99 U+0072 +0x9a U+00aa +0x9b U+00ba +0x9c U+00e6 +0x9d U+00b8 +0x9e U+00c6 +0x9f U+005d +0xa0 U+00b5 +0xa1 U+00fc +0xa2 U+0073 +0xa3 U+0074 +0xa4 U+0075 +0xa5 U+0076 +0xa6 U+0077 +0xa7 U+0078 +0xa8 U+0079 +0xa9 U+007a +0xaa U+00a1 +0xab U+00bf +0xac U+00d0 +0xad U+00dd +0xae U+00de +0xaf U+00ae +0xb0 U+00a2 +0xb1 U+00a3 +0xb2 U+00a5 +0xb3 U+00b7 +0xb4 U+00a9 +0xb5 U+005b +0xb6 U+00b6 +0xb7 U+00bc +0xb8 U+00bd +0xb9 U+00be +0xba U+00ac +0xbb U+007c +0xbc U+00af +0xbd U+00a8 +0xbe U+00b4 +0xbf U+00d7 +0xc0 U+00e4 +0xc1 U+0041 +0xc2 U+0042 +0xc3 U+0043 +0xc4 U+0044 +0xc5 U+0045 +0xc6 U+0046 +0xc7 U+0047 +0xc8 U+0048 +0xc9 U+0049 +0xca U+00ad +0xcb U+00f4 +0xcc U+00a6 +0xcd U+00f2 +0xce U+00f3 +0xcf U+00f5 +0xd0 U+00e5 +0xd1 U+004a +0xd2 U+004b +0xd3 U+004c +0xd4 U+004d +0xd5 U+004e +0xd6 U+004f +0xd7 U+0050 +0xd8 U+0051 +0xd9 U+0052 +0xda U+00b9 +0xdb U+00fb +0xdc U+007e +0xdd U+00f9 +0xde U+00fa +0xdf U+00ff +0xe0 U+00c9 +0xe1 U+00f7 +0xe2 U+0053 +0xe3 U+0054 +0xe4 U+0055 +0xe5 U+0056 +0xe6 U+0057 +0xe7 U+0058 +0xe8 U+0059 +0xe9 U+005a +0xea U+00b2 +0xeb U+00d4 +0xec U+0040 +0xed U+00d2 +0xee U+00d3 +0xef U+00d5 +0xf0 U+0030 +0xf1 U+0031 +0xf2 U+0032 +0xf3 U+0033 +0xf4 U+0034 +0xf5 U+0035 +0xf6 U+0036 +0xf7 U+0037 +0xf8 U+0038 +0xf9 U+0039 +0xfa U+00b3 +0xfb U+00db +0xfc U+00dc +0xfd U+00d9 +0xfe U+00da +0xff U+009f diff --git a/jdk/make/tools/CharsetMapping/IBM278.nr b/jdk/make/tools/CharsetMapping/IBM278.nr new file mode 100644 index 00000000000..675451906d4 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM278.nr @@ -0,0 +1 @@ +0x25 U+000a diff --git a/jdk/make/tools/CharsetMapping/IBM280.c2b b/jdk/make/tools/CharsetMapping/IBM280.c2b new file mode 100644 index 00000000000..6cb38028124 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM280.c2b @@ -0,0 +1 @@ +0x15 U+0085 diff --git a/jdk/make/tools/CharsetMapping/IBM280.map b/jdk/make/tools/CharsetMapping/IBM280.map new file mode 100644 index 00000000000..77fe94f5e8c --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM280.map @@ -0,0 +1,257 @@ +#Generated from IBM280.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+009c +0x05 U+0009 +0x06 U+0086 +0x07 U+007f +0x08 U+0097 +0x09 U+008d +0x0a U+008e +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+009d +0x15 U+000a +0x16 U+0008 +0x17 U+0087 +0x18 U+0018 +0x19 U+0019 +0x1a U+0092 +0x1b U+008f +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0080 +0x21 U+0081 +0x22 U+0082 +0x23 U+0083 +0x24 U+0084 +0x25 U+000a +0x26 U+0017 +0x27 U+001b +0x28 U+0088 +0x29 U+0089 +0x2a U+008a +0x2b U+008b +0x2c U+008c +0x2d U+0005 +0x2e U+0006 +0x2f U+0007 +0x30 U+0090 +0x31 U+0091 +0x32 U+0016 +0x33 U+0093 +0x34 U+0094 +0x35 U+0095 +0x36 U+0096 +0x37 U+0004 +0x38 U+0098 +0x39 U+0099 +0x3a U+009a +0x3b U+009b +0x3c U+0014 +0x3d U+0015 +0x3e U+009e +0x3f U+001a +0x40 U+0020 +0x41 U+00a0 +0x42 U+00e2 +0x43 U+00e4 +0x44 U+007b +0x45 U+00e1 +0x46 U+00e3 +0x47 U+00e5 +0x48 U+005c +0x49 U+00f1 +0x4a U+00b0 +0x4b U+002e +0x4c U+003c +0x4d U+0028 +0x4e U+002b +0x4f U+0021 +0x50 U+0026 +0x51 U+005d +0x52 U+00ea +0x53 U+00eb +0x54 U+007d +0x55 U+00ed +0x56 U+00ee +0x57 U+00ef +0x58 U+007e +0x59 U+00df +0x5a U+00e9 +0x5b U+0024 +0x5c U+002a +0x5d U+0029 +0x5e U+003b +0x5f U+005e +0x60 U+002d +0x61 U+002f +0x62 U+00c2 +0x63 U+00c4 +0x64 U+00c0 +0x65 U+00c1 +0x66 U+00c3 +0x67 U+00c5 +0x68 U+00c7 +0x69 U+00d1 +0x6a U+00f2 +0x6b U+002c +0x6c U+0025 +0x6d U+005f +0x6e U+003e +0x6f U+003f +0x70 U+00f8 +0x71 U+00c9 +0x72 U+00ca +0x73 U+00cb +0x74 U+00c8 +0x75 U+00cd +0x76 U+00ce +0x77 U+00cf +0x78 U+00cc +0x79 U+00f9 +0x7a U+003a +0x7b U+00a3 +0x7c U+00a7 +0x7d U+0027 +0x7e U+003d +0x7f U+0022 +0x80 U+00d8 +0x81 U+0061 +0x82 U+0062 +0x83 U+0063 +0x84 U+0064 +0x85 U+0065 +0x86 U+0066 +0x87 U+0067 +0x88 U+0068 +0x89 U+0069 +0x8a U+00ab +0x8b U+00bb +0x8c U+00f0 +0x8d U+00fd +0x8e U+00fe +0x8f U+00b1 +0x90 U+005b +0x91 U+006a +0x92 U+006b +0x93 U+006c +0x94 U+006d +0x95 U+006e +0x96 U+006f +0x97 U+0070 +0x98 U+0071 +0x99 U+0072 +0x9a U+00aa +0x9b U+00ba +0x9c U+00e6 +0x9d U+00b8 +0x9e U+00c6 +0x9f U+00a4 +0xa0 U+00b5 +0xa1 U+00ec +0xa2 U+0073 +0xa3 U+0074 +0xa4 U+0075 +0xa5 U+0076 +0xa6 U+0077 +0xa7 U+0078 +0xa8 U+0079 +0xa9 U+007a +0xaa U+00a1 +0xab U+00bf +0xac U+00d0 +0xad U+00dd +0xae U+00de +0xaf U+00ae +0xb0 U+00a2 +0xb1 U+0023 +0xb2 U+00a5 +0xb3 U+00b7 +0xb4 U+00a9 +0xb5 U+0040 +0xb6 U+00b6 +0xb7 U+00bc +0xb8 U+00bd +0xb9 U+00be +0xba U+00ac +0xbb U+007c +0xbc U+00af +0xbd U+00a8 +0xbe U+00b4 +0xbf U+00d7 +0xc0 U+00e0 +0xc1 U+0041 +0xc2 U+0042 +0xc3 U+0043 +0xc4 U+0044 +0xc5 U+0045 +0xc6 U+0046 +0xc7 U+0047 +0xc8 U+0048 +0xc9 U+0049 +0xca U+00ad +0xcb U+00f4 +0xcc U+00f6 +0xcd U+00a6 +0xce U+00f3 +0xcf U+00f5 +0xd0 U+00e8 +0xd1 U+004a +0xd2 U+004b +0xd3 U+004c +0xd4 U+004d +0xd5 U+004e +0xd6 U+004f +0xd7 U+0050 +0xd8 U+0051 +0xd9 U+0052 +0xda U+00b9 +0xdb U+00fb +0xdc U+00fc +0xdd U+0060 +0xde U+00fa +0xdf U+00ff +0xe0 U+00e7 +0xe1 U+00f7 +0xe2 U+0053 +0xe3 U+0054 +0xe4 U+0055 +0xe5 U+0056 +0xe6 U+0057 +0xe7 U+0058 +0xe8 U+0059 +0xe9 U+005a +0xea U+00b2 +0xeb U+00d4 +0xec U+00d6 +0xed U+00d2 +0xee U+00d3 +0xef U+00d5 +0xf0 U+0030 +0xf1 U+0031 +0xf2 U+0032 +0xf3 U+0033 +0xf4 U+0034 +0xf5 U+0035 +0xf6 U+0036 +0xf7 U+0037 +0xf8 U+0038 +0xf9 U+0039 +0xfa U+00b3 +0xfb U+00db +0xfc U+00dc +0xfd U+00d9 +0xfe U+00da +0xff U+009f diff --git a/jdk/make/tools/CharsetMapping/IBM280.nr b/jdk/make/tools/CharsetMapping/IBM280.nr new file mode 100644 index 00000000000..675451906d4 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM280.nr @@ -0,0 +1 @@ +0x25 U+000a diff --git a/jdk/make/tools/CharsetMapping/IBM284.c2b b/jdk/make/tools/CharsetMapping/IBM284.c2b new file mode 100644 index 00000000000..6cb38028124 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM284.c2b @@ -0,0 +1 @@ +0x15 U+0085 diff --git a/jdk/make/tools/CharsetMapping/IBM284.map b/jdk/make/tools/CharsetMapping/IBM284.map new file mode 100644 index 00000000000..c3be08c8475 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM284.map @@ -0,0 +1,257 @@ +#Generated from IBM284.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+009c +0x05 U+0009 +0x06 U+0086 +0x07 U+007f +0x08 U+0097 +0x09 U+008d +0x0a U+008e +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+009d +0x15 U+000a +0x16 U+0008 +0x17 U+0087 +0x18 U+0018 +0x19 U+0019 +0x1a U+0092 +0x1b U+008f +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0080 +0x21 U+0081 +0x22 U+0082 +0x23 U+0083 +0x24 U+0084 +0x25 U+000a +0x26 U+0017 +0x27 U+001b +0x28 U+0088 +0x29 U+0089 +0x2a U+008a +0x2b U+008b +0x2c U+008c +0x2d U+0005 +0x2e U+0006 +0x2f U+0007 +0x30 U+0090 +0x31 U+0091 +0x32 U+0016 +0x33 U+0093 +0x34 U+0094 +0x35 U+0095 +0x36 U+0096 +0x37 U+0004 +0x38 U+0098 +0x39 U+0099 +0x3a U+009a +0x3b U+009b +0x3c U+0014 +0x3d U+0015 +0x3e U+009e +0x3f U+001a +0x40 U+0020 +0x41 U+00a0 +0x42 U+00e2 +0x43 U+00e4 +0x44 U+00e0 +0x45 U+00e1 +0x46 U+00e3 +0x47 U+00e5 +0x48 U+00e7 +0x49 U+00a6 +0x4a U+005b +0x4b U+002e +0x4c U+003c +0x4d U+0028 +0x4e U+002b +0x4f U+007c +0x50 U+0026 +0x51 U+00e9 +0x52 U+00ea +0x53 U+00eb +0x54 U+00e8 +0x55 U+00ed +0x56 U+00ee +0x57 U+00ef +0x58 U+00ec +0x59 U+00df +0x5a U+005d +0x5b U+0024 +0x5c U+002a +0x5d U+0029 +0x5e U+003b +0x5f U+00ac +0x60 U+002d +0x61 U+002f +0x62 U+00c2 +0x63 U+00c4 +0x64 U+00c0 +0x65 U+00c1 +0x66 U+00c3 +0x67 U+00c5 +0x68 U+00c7 +0x69 U+0023 +0x6a U+00f1 +0x6b U+002c +0x6c U+0025 +0x6d U+005f +0x6e U+003e +0x6f U+003f +0x70 U+00f8 +0x71 U+00c9 +0x72 U+00ca +0x73 U+00cb +0x74 U+00c8 +0x75 U+00cd +0x76 U+00ce +0x77 U+00cf +0x78 U+00cc +0x79 U+0060 +0x7a U+003a +0x7b U+00d1 +0x7c U+0040 +0x7d U+0027 +0x7e U+003d +0x7f U+0022 +0x80 U+00d8 +0x81 U+0061 +0x82 U+0062 +0x83 U+0063 +0x84 U+0064 +0x85 U+0065 +0x86 U+0066 +0x87 U+0067 +0x88 U+0068 +0x89 U+0069 +0x8a U+00ab +0x8b U+00bb +0x8c U+00f0 +0x8d U+00fd +0x8e U+00fe +0x8f U+00b1 +0x90 U+00b0 +0x91 U+006a +0x92 U+006b +0x93 U+006c +0x94 U+006d +0x95 U+006e +0x96 U+006f +0x97 U+0070 +0x98 U+0071 +0x99 U+0072 +0x9a U+00aa +0x9b U+00ba +0x9c U+00e6 +0x9d U+00b8 +0x9e U+00c6 +0x9f U+00a4 +0xa0 U+00b5 +0xa1 U+00a8 +0xa2 U+0073 +0xa3 U+0074 +0xa4 U+0075 +0xa5 U+0076 +0xa6 U+0077 +0xa7 U+0078 +0xa8 U+0079 +0xa9 U+007a +0xaa U+00a1 +0xab U+00bf +0xac U+00d0 +0xad U+00dd +0xae U+00de +0xaf U+00ae +0xb0 U+00a2 +0xb1 U+00a3 +0xb2 U+00a5 +0xb3 U+00b7 +0xb4 U+00a9 +0xb5 U+00a7 +0xb6 U+00b6 +0xb7 U+00bc +0xb8 U+00bd +0xb9 U+00be +0xba U+005e +0xbb U+0021 +0xbc U+00af +0xbd U+007e +0xbe U+00b4 +0xbf U+00d7 +0xc0 U+007b +0xc1 U+0041 +0xc2 U+0042 +0xc3 U+0043 +0xc4 U+0044 +0xc5 U+0045 +0xc6 U+0046 +0xc7 U+0047 +0xc8 U+0048 +0xc9 U+0049 +0xca U+00ad +0xcb U+00f4 +0xcc U+00f6 +0xcd U+00f2 +0xce U+00f3 +0xcf U+00f5 +0xd0 U+007d +0xd1 U+004a +0xd2 U+004b +0xd3 U+004c +0xd4 U+004d +0xd5 U+004e +0xd6 U+004f +0xd7 U+0050 +0xd8 U+0051 +0xd9 U+0052 +0xda U+00b9 +0xdb U+00fb +0xdc U+00fc +0xdd U+00f9 +0xde U+00fa +0xdf U+00ff +0xe0 U+005c +0xe1 U+00f7 +0xe2 U+0053 +0xe3 U+0054 +0xe4 U+0055 +0xe5 U+0056 +0xe6 U+0057 +0xe7 U+0058 +0xe8 U+0059 +0xe9 U+005a +0xea U+00b2 +0xeb U+00d4 +0xec U+00d6 +0xed U+00d2 +0xee U+00d3 +0xef U+00d5 +0xf0 U+0030 +0xf1 U+0031 +0xf2 U+0032 +0xf3 U+0033 +0xf4 U+0034 +0xf5 U+0035 +0xf6 U+0036 +0xf7 U+0037 +0xf8 U+0038 +0xf9 U+0039 +0xfa U+00b3 +0xfb U+00db +0xfc U+00dc +0xfd U+00d9 +0xfe U+00da +0xff U+009f diff --git a/jdk/make/tools/CharsetMapping/IBM284.nr b/jdk/make/tools/CharsetMapping/IBM284.nr new file mode 100644 index 00000000000..675451906d4 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM284.nr @@ -0,0 +1 @@ +0x25 U+000a diff --git a/jdk/make/tools/CharsetMapping/IBM285.c2b b/jdk/make/tools/CharsetMapping/IBM285.c2b new file mode 100644 index 00000000000..6cb38028124 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM285.c2b @@ -0,0 +1 @@ +0x15 U+0085 diff --git a/jdk/make/tools/CharsetMapping/IBM285.map b/jdk/make/tools/CharsetMapping/IBM285.map new file mode 100644 index 00000000000..3fca86cd558 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM285.map @@ -0,0 +1,257 @@ +#Generated from IBM285.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+009c +0x05 U+0009 +0x06 U+0086 +0x07 U+007f +0x08 U+0097 +0x09 U+008d +0x0a U+008e +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+009d +0x15 U+000a +0x16 U+0008 +0x17 U+0087 +0x18 U+0018 +0x19 U+0019 +0x1a U+0092 +0x1b U+008f +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0080 +0x21 U+0081 +0x22 U+0082 +0x23 U+0083 +0x24 U+0084 +0x25 U+000a +0x26 U+0017 +0x27 U+001b +0x28 U+0088 +0x29 U+0089 +0x2a U+008a +0x2b U+008b +0x2c U+008c +0x2d U+0005 +0x2e U+0006 +0x2f U+0007 +0x30 U+0090 +0x31 U+0091 +0x32 U+0016 +0x33 U+0093 +0x34 U+0094 +0x35 U+0095 +0x36 U+0096 +0x37 U+0004 +0x38 U+0098 +0x39 U+0099 +0x3a U+009a +0x3b U+009b +0x3c U+0014 +0x3d U+0015 +0x3e U+009e +0x3f U+001a +0x40 U+0020 +0x41 U+00a0 +0x42 U+00e2 +0x43 U+00e4 +0x44 U+00e0 +0x45 U+00e1 +0x46 U+00e3 +0x47 U+00e5 +0x48 U+00e7 +0x49 U+00f1 +0x4a U+0024 +0x4b U+002e +0x4c U+003c +0x4d U+0028 +0x4e U+002b +0x4f U+007c +0x50 U+0026 +0x51 U+00e9 +0x52 U+00ea +0x53 U+00eb +0x54 U+00e8 +0x55 U+00ed +0x56 U+00ee +0x57 U+00ef +0x58 U+00ec +0x59 U+00df +0x5a U+0021 +0x5b U+00a3 +0x5c U+002a +0x5d U+0029 +0x5e U+003b +0x5f U+00ac +0x60 U+002d +0x61 U+002f +0x62 U+00c2 +0x63 U+00c4 +0x64 U+00c0 +0x65 U+00c1 +0x66 U+00c3 +0x67 U+00c5 +0x68 U+00c7 +0x69 U+00d1 +0x6a U+00a6 +0x6b U+002c +0x6c U+0025 +0x6d U+005f +0x6e U+003e +0x6f U+003f +0x70 U+00f8 +0x71 U+00c9 +0x72 U+00ca +0x73 U+00cb +0x74 U+00c8 +0x75 U+00cd +0x76 U+00ce +0x77 U+00cf +0x78 U+00cc +0x79 U+0060 +0x7a U+003a +0x7b U+0023 +0x7c U+0040 +0x7d U+0027 +0x7e U+003d +0x7f U+0022 +0x80 U+00d8 +0x81 U+0061 +0x82 U+0062 +0x83 U+0063 +0x84 U+0064 +0x85 U+0065 +0x86 U+0066 +0x87 U+0067 +0x88 U+0068 +0x89 U+0069 +0x8a U+00ab +0x8b U+00bb +0x8c U+00f0 +0x8d U+00fd +0x8e U+00fe +0x8f U+00b1 +0x90 U+00b0 +0x91 U+006a +0x92 U+006b +0x93 U+006c +0x94 U+006d +0x95 U+006e +0x96 U+006f +0x97 U+0070 +0x98 U+0071 +0x99 U+0072 +0x9a U+00aa +0x9b U+00ba +0x9c U+00e6 +0x9d U+00b8 +0x9e U+00c6 +0x9f U+00a4 +0xa0 U+00b5 +0xa1 U+00af +0xa2 U+0073 +0xa3 U+0074 +0xa4 U+0075 +0xa5 U+0076 +0xa6 U+0077 +0xa7 U+0078 +0xa8 U+0079 +0xa9 U+007a +0xaa U+00a1 +0xab U+00bf +0xac U+00d0 +0xad U+00dd +0xae U+00de +0xaf U+00ae +0xb0 U+00a2 +0xb1 U+005b +0xb2 U+00a5 +0xb3 U+00b7 +0xb4 U+00a9 +0xb5 U+00a7 +0xb6 U+00b6 +0xb7 U+00bc +0xb8 U+00bd +0xb9 U+00be +0xba U+005e +0xbb U+005d +0xbc U+007e +0xbd U+00a8 +0xbe U+00b4 +0xbf U+00d7 +0xc0 U+007b +0xc1 U+0041 +0xc2 U+0042 +0xc3 U+0043 +0xc4 U+0044 +0xc5 U+0045 +0xc6 U+0046 +0xc7 U+0047 +0xc8 U+0048 +0xc9 U+0049 +0xca U+00ad +0xcb U+00f4 +0xcc U+00f6 +0xcd U+00f2 +0xce U+00f3 +0xcf U+00f5 +0xd0 U+007d +0xd1 U+004a +0xd2 U+004b +0xd3 U+004c +0xd4 U+004d +0xd5 U+004e +0xd6 U+004f +0xd7 U+0050 +0xd8 U+0051 +0xd9 U+0052 +0xda U+00b9 +0xdb U+00fb +0xdc U+00fc +0xdd U+00f9 +0xde U+00fa +0xdf U+00ff +0xe0 U+005c +0xe1 U+00f7 +0xe2 U+0053 +0xe3 U+0054 +0xe4 U+0055 +0xe5 U+0056 +0xe6 U+0057 +0xe7 U+0058 +0xe8 U+0059 +0xe9 U+005a +0xea U+00b2 +0xeb U+00d4 +0xec U+00d6 +0xed U+00d2 +0xee U+00d3 +0xef U+00d5 +0xf0 U+0030 +0xf1 U+0031 +0xf2 U+0032 +0xf3 U+0033 +0xf4 U+0034 +0xf5 U+0035 +0xf6 U+0036 +0xf7 U+0037 +0xf8 U+0038 +0xf9 U+0039 +0xfa U+00b3 +0xfb U+00db +0xfc U+00dc +0xfd U+00d9 +0xfe U+00da +0xff U+009f diff --git a/jdk/make/tools/CharsetMapping/IBM285.nr b/jdk/make/tools/CharsetMapping/IBM285.nr new file mode 100644 index 00000000000..675451906d4 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM285.nr @@ -0,0 +1 @@ +0x25 U+000a diff --git a/jdk/make/tools/CharsetMapping/IBM297.c2b b/jdk/make/tools/CharsetMapping/IBM297.c2b new file mode 100644 index 00000000000..6cb38028124 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM297.c2b @@ -0,0 +1 @@ +0x15 U+0085 diff --git a/jdk/make/tools/CharsetMapping/IBM297.map b/jdk/make/tools/CharsetMapping/IBM297.map new file mode 100644 index 00000000000..148087df03b --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM297.map @@ -0,0 +1,257 @@ +#Generated from IBM297.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+009c +0x05 U+0009 +0x06 U+0086 +0x07 U+007f +0x08 U+0097 +0x09 U+008d +0x0a U+008e +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+009d +0x15 U+000a +0x16 U+0008 +0x17 U+0087 +0x18 U+0018 +0x19 U+0019 +0x1a U+0092 +0x1b U+008f +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0080 +0x21 U+0081 +0x22 U+0082 +0x23 U+0083 +0x24 U+0084 +0x25 U+000a +0x26 U+0017 +0x27 U+001b +0x28 U+0088 +0x29 U+0089 +0x2a U+008a +0x2b U+008b +0x2c U+008c +0x2d U+0005 +0x2e U+0006 +0x2f U+0007 +0x30 U+0090 +0x31 U+0091 +0x32 U+0016 +0x33 U+0093 +0x34 U+0094 +0x35 U+0095 +0x36 U+0096 +0x37 U+0004 +0x38 U+0098 +0x39 U+0099 +0x3a U+009a +0x3b U+009b +0x3c U+0014 +0x3d U+0015 +0x3e U+009e +0x3f U+001a +0x40 U+0020 +0x41 U+00a0 +0x42 U+00e2 +0x43 U+00e4 +0x44 U+0040 +0x45 U+00e1 +0x46 U+00e3 +0x47 U+00e5 +0x48 U+005c +0x49 U+00f1 +0x4a U+00b0 +0x4b U+002e +0x4c U+003c +0x4d U+0028 +0x4e U+002b +0x4f U+0021 +0x50 U+0026 +0x51 U+007b +0x52 U+00ea +0x53 U+00eb +0x54 U+007d +0x55 U+00ed +0x56 U+00ee +0x57 U+00ef +0x58 U+00ec +0x59 U+00df +0x5a U+00a7 +0x5b U+0024 +0x5c U+002a +0x5d U+0029 +0x5e U+003b +0x5f U+005e +0x60 U+002d +0x61 U+002f +0x62 U+00c2 +0x63 U+00c4 +0x64 U+00c0 +0x65 U+00c1 +0x66 U+00c3 +0x67 U+00c5 +0x68 U+00c7 +0x69 U+00d1 +0x6a U+00f9 +0x6b U+002c +0x6c U+0025 +0x6d U+005f +0x6e U+003e +0x6f U+003f +0x70 U+00f8 +0x71 U+00c9 +0x72 U+00ca +0x73 U+00cb +0x74 U+00c8 +0x75 U+00cd +0x76 U+00ce +0x77 U+00cf +0x78 U+00cc +0x79 U+00b5 +0x7a U+003a +0x7b U+00a3 +0x7c U+00e0 +0x7d U+0027 +0x7e U+003d +0x7f U+0022 +0x80 U+00d8 +0x81 U+0061 +0x82 U+0062 +0x83 U+0063 +0x84 U+0064 +0x85 U+0065 +0x86 U+0066 +0x87 U+0067 +0x88 U+0068 +0x89 U+0069 +0x8a U+00ab +0x8b U+00bb +0x8c U+00f0 +0x8d U+00fd +0x8e U+00fe +0x8f U+00b1 +0x90 U+005b +0x91 U+006a +0x92 U+006b +0x93 U+006c +0x94 U+006d +0x95 U+006e +0x96 U+006f +0x97 U+0070 +0x98 U+0071 +0x99 U+0072 +0x9a U+00aa +0x9b U+00ba +0x9c U+00e6 +0x9d U+00b8 +0x9e U+00c6 +0x9f U+00a4 +0xa0 U+0060 +0xa1 U+00a8 +0xa2 U+0073 +0xa3 U+0074 +0xa4 U+0075 +0xa5 U+0076 +0xa6 U+0077 +0xa7 U+0078 +0xa8 U+0079 +0xa9 U+007a +0xaa U+00a1 +0xab U+00bf +0xac U+00d0 +0xad U+00dd +0xae U+00de +0xaf U+00ae +0xb0 U+00a2 +0xb1 U+0023 +0xb2 U+00a5 +0xb3 U+00b7 +0xb4 U+00a9 +0xb5 U+005d +0xb6 U+00b6 +0xb7 U+00bc +0xb8 U+00bd +0xb9 U+00be +0xba U+00ac +0xbb U+007c +0xbc U+00af +0xbd U+007e +0xbe U+00b4 +0xbf U+00d7 +0xc0 U+00e9 +0xc1 U+0041 +0xc2 U+0042 +0xc3 U+0043 +0xc4 U+0044 +0xc5 U+0045 +0xc6 U+0046 +0xc7 U+0047 +0xc8 U+0048 +0xc9 U+0049 +0xca U+00ad +0xcb U+00f4 +0xcc U+00f6 +0xcd U+00f2 +0xce U+00f3 +0xcf U+00f5 +0xd0 U+00e8 +0xd1 U+004a +0xd2 U+004b +0xd3 U+004c +0xd4 U+004d +0xd5 U+004e +0xd6 U+004f +0xd7 U+0050 +0xd8 U+0051 +0xd9 U+0052 +0xda U+00b9 +0xdb U+00fb +0xdc U+00fc +0xdd U+00a6 +0xde U+00fa +0xdf U+00ff +0xe0 U+00e7 +0xe1 U+00f7 +0xe2 U+0053 +0xe3 U+0054 +0xe4 U+0055 +0xe5 U+0056 +0xe6 U+0057 +0xe7 U+0058 +0xe8 U+0059 +0xe9 U+005a +0xea U+00b2 +0xeb U+00d4 +0xec U+00d6 +0xed U+00d2 +0xee U+00d3 +0xef U+00d5 +0xf0 U+0030 +0xf1 U+0031 +0xf2 U+0032 +0xf3 U+0033 +0xf4 U+0034 +0xf5 U+0035 +0xf6 U+0036 +0xf7 U+0037 +0xf8 U+0038 +0xf9 U+0039 +0xfa U+00b3 +0xfb U+00db +0xfc U+00dc +0xfd U+00d9 +0xfe U+00da +0xff U+009f diff --git a/jdk/make/tools/CharsetMapping/IBM297.nr b/jdk/make/tools/CharsetMapping/IBM297.nr new file mode 100644 index 00000000000..675451906d4 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM297.nr @@ -0,0 +1 @@ +0x25 U+000a diff --git a/jdk/make/tools/CharsetMapping/IBM420.c2b b/jdk/make/tools/CharsetMapping/IBM420.c2b new file mode 100644 index 00000000000..6cb38028124 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM420.c2b @@ -0,0 +1 @@ +0x15 U+0085 diff --git a/jdk/make/tools/CharsetMapping/IBM420.map b/jdk/make/tools/CharsetMapping/IBM420.map new file mode 100644 index 00000000000..d4ce19249b3 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM420.map @@ -0,0 +1,257 @@ +#Generated from IBM420.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+009c +0x05 U+0009 +0x06 U+0086 +0x07 U+007f +0x08 U+0097 +0x09 U+008d +0x0a U+008e +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+009d +0x15 U+000a +0x16 U+0008 +0x17 U+0087 +0x18 U+0018 +0x19 U+0019 +0x1a U+0092 +0x1b U+008f +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0080 +0x21 U+0081 +0x22 U+0082 +0x23 U+0083 +0x24 U+0084 +0x25 U+000a +0x26 U+0017 +0x27 U+001b +0x28 U+0088 +0x29 U+0089 +0x2a U+008a +0x2b U+008b +0x2c U+008c +0x2d U+0005 +0x2e U+0006 +0x2f U+0007 +0x30 U+0090 +0x31 U+0091 +0x32 U+0016 +0x33 U+0093 +0x34 U+0094 +0x35 U+0095 +0x36 U+0096 +0x37 U+0004 +0x38 U+0098 +0x39 U+0099 +0x3a U+009a +0x3b U+009b +0x3c U+0014 +0x3d U+0015 +0x3e U+009e +0x3f U+001a +0x40 U+0020 +0x41 U+00a0 +0x42 U+fe7c +0x43 U+fe7d +0x44 U+0640 +0x45 U+f8fc +0x46 U+fe80 +0x47 U+fe81 +0x48 U+fe82 +0x49 U+fe83 +0x4a U+00a2 +0x4b U+002e +0x4c U+003c +0x4d U+0028 +0x4e U+002b +0x4f U+007c +0x50 U+0026 +0x51 U+fe84 +0x52 U+fe85 +0x53 U+fffd +0x54 U+fffd +0x55 U+fe8b +0x56 U+fe8d +0x57 U+fe8e +0x58 U+fe8f +0x59 U+fe91 +0x5a U+0021 +0x5b U+0024 +0x5c U+002a +0x5d U+0029 +0x5e U+003b +0x5f U+00ac +0x60 U+002d +0x61 U+002f +0x62 U+fe93 +0x63 U+fe95 +0x64 U+fe97 +0x65 U+fe99 +0x66 U+fe9b +0x67 U+fe9d +0x68 U+fe9f +0x69 U+fea1 +0x6a U+00a6 +0x6b U+002c +0x6c U+0025 +0x6d U+005f +0x6e U+003e +0x6f U+003f +0x70 U+fea3 +0x71 U+fea5 +0x72 U+fea7 +0x73 U+fea9 +0x74 U+feab +0x75 U+fead +0x76 U+feaf +0x77 U+f8f6 +0x78 U+feb3 +0x79 U+060c +0x7a U+003a +0x7b U+0023 +0x7c U+0040 +0x7d U+0027 +0x7e U+003d +0x7f U+0022 +0x80 U+f8f5 +0x81 U+0061 +0x82 U+0062 +0x83 U+0063 +0x84 U+0064 +0x85 U+0065 +0x86 U+0066 +0x87 U+0067 +0x88 U+0068 +0x89 U+0069 +0x8a U+feb7 +0x8b U+f8f4 +0x8c U+febb +0x8d U+f8f7 +0x8e U+febf +0x8f U+fec3 +0x90 U+fec7 +0x91 U+006a +0x92 U+006b +0x93 U+006c +0x94 U+006d +0x95 U+006e +0x96 U+006f +0x97 U+0070 +0x98 U+0071 +0x99 U+0072 +0x9a U+fec9 +0x9b U+feca +0x9c U+fecb +0x9d U+fecc +0x9e U+fecd +0x9f U+fece +0xa0 U+fecf +0xa1 U+00f7 +0xa2 U+0073 +0xa3 U+0074 +0xa4 U+0075 +0xa5 U+0076 +0xa6 U+0077 +0xa7 U+0078 +0xa8 U+0079 +0xa9 U+007a +0xaa U+fed0 +0xab U+fed1 +0xac U+fed3 +0xad U+fed5 +0xae U+fed7 +0xaf U+fed9 +0xb0 U+fedb +0xb1 U+fedd +0xb2 U+fef5 +0xb3 U+fef6 +0xb4 U+fef7 +0xb5 U+fef8 +0xb6 U+fffd +0xb7 U+fffd +0xb8 U+fefb +0xb9 U+fefc +0xba U+fedf +0xbb U+fee1 +0xbc U+fee3 +0xbd U+fee5 +0xbe U+fee7 +0xbf U+fee9 +0xc0 U+061b +0xc1 U+0041 +0xc2 U+0042 +0xc3 U+0043 +0xc4 U+0044 +0xc5 U+0045 +0xc6 U+0046 +0xc7 U+0047 +0xc8 U+0048 +0xc9 U+0049 +0xca U+00ad +0xcb U+feeb +0xcc U+fffd +0xcd U+feec +0xce U+fffd +0xcf U+feed +0xd0 U+061f +0xd1 U+004a +0xd2 U+004b +0xd3 U+004c +0xd4 U+004d +0xd5 U+004e +0xd6 U+004f +0xd7 U+0050 +0xd8 U+0051 +0xd9 U+0052 +0xda U+feef +0xdb U+fef0 +0xdc U+fef1 +0xdd U+fef2 +0xde U+fef3 +0xdf U+0660 +0xe0 U+00d7 +0xe1 U+2007 +0xe2 U+0053 +0xe3 U+0054 +0xe4 U+0055 +0xe5 U+0056 +0xe6 U+0057 +0xe7 U+0058 +0xe8 U+0059 +0xe9 U+005a +0xea U+0661 +0xeb U+0662 +0xec U+fffd +0xed U+0663 +0xee U+0664 +0xef U+0665 +0xf0 U+0030 +0xf1 U+0031 +0xf2 U+0032 +0xf3 U+0033 +0xf4 U+0034 +0xf5 U+0035 +0xf6 U+0036 +0xf7 U+0037 +0xf8 U+0038 +0xf9 U+0039 +0xfa U+fffd +0xfb U+0666 +0xfc U+0667 +0xfd U+0668 +0xfe U+0669 +0xff U+009f diff --git a/jdk/make/tools/CharsetMapping/IBM420.nr b/jdk/make/tools/CharsetMapping/IBM420.nr new file mode 100644 index 00000000000..675451906d4 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM420.nr @@ -0,0 +1 @@ +0x25 U+000a diff --git a/jdk/make/tools/CharsetMapping/IBM424.c2b b/jdk/make/tools/CharsetMapping/IBM424.c2b new file mode 100644 index 00000000000..6cb38028124 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM424.c2b @@ -0,0 +1 @@ +0x15 U+0085 diff --git a/jdk/make/tools/CharsetMapping/IBM424.map b/jdk/make/tools/CharsetMapping/IBM424.map new file mode 100644 index 00000000000..da580c5d232 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM424.map @@ -0,0 +1,257 @@ +#Generated from IBM424.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+009c +0x05 U+0009 +0x06 U+0086 +0x07 U+007f +0x08 U+0097 +0x09 U+008d +0x0a U+008e +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+009d +0x15 U+000a +0x16 U+0008 +0x17 U+0087 +0x18 U+0018 +0x19 U+0019 +0x1a U+0092 +0x1b U+008f +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0080 +0x21 U+0081 +0x22 U+0082 +0x23 U+0083 +0x24 U+0084 +0x25 U+000a +0x26 U+0017 +0x27 U+001b +0x28 U+0088 +0x29 U+0089 +0x2a U+008a +0x2b U+008b +0x2c U+008c +0x2d U+0005 +0x2e U+0006 +0x2f U+0007 +0x30 U+0090 +0x31 U+0091 +0x32 U+0016 +0x33 U+0093 +0x34 U+0094 +0x35 U+0095 +0x36 U+0096 +0x37 U+0004 +0x38 U+0098 +0x39 U+0099 +0x3a U+009a +0x3b U+009b +0x3c U+0014 +0x3d U+0015 +0x3e U+009e +0x3f U+001a +0x40 U+0020 +0x41 U+05d0 +0x42 U+05d1 +0x43 U+05d2 +0x44 U+05d3 +0x45 U+05d4 +0x46 U+05d5 +0x47 U+05d6 +0x48 U+05d7 +0x49 U+05d8 +0x4a U+00a2 +0x4b U+002e +0x4c U+003c +0x4d U+0028 +0x4e U+002b +0x4f U+007c +0x50 U+0026 +0x51 U+05d9 +0x52 U+05da +0x53 U+05db +0x54 U+05dc +0x55 U+05dd +0x56 U+05de +0x57 U+05df +0x58 U+05e0 +0x59 U+05e1 +0x5a U+0021 +0x5b U+0024 +0x5c U+002a +0x5d U+0029 +0x5e U+003b +0x5f U+00ac +0x60 U+002d +0x61 U+002f +0x62 U+05e2 +0x63 U+05e3 +0x64 U+05e4 +0x65 U+05e5 +0x66 U+05e6 +0x67 U+05e7 +0x68 U+05e8 +0x69 U+05e9 +0x6a U+00a6 +0x6b U+002c +0x6c U+0025 +0x6d U+005f +0x6e U+003e +0x6f U+003f +0x70 U+fffd +0x71 U+05ea +0x72 U+fffd +0x73 U+fffd +0x74 U+00a0 +0x75 U+fffd +0x76 U+fffd +0x77 U+fffd +0x78 U+2017 +0x79 U+0060 +0x7a U+003a +0x7b U+0023 +0x7c U+0040 +0x7d U+0027 +0x7e U+003d +0x7f U+0022 +0x80 U+fffd +0x81 U+0061 +0x82 U+0062 +0x83 U+0063 +0x84 U+0064 +0x85 U+0065 +0x86 U+0066 +0x87 U+0067 +0x88 U+0068 +0x89 U+0069 +0x8a U+00ab +0x8b U+00bb +0x8c U+fffd +0x8d U+fffd +0x8e U+fffd +0x8f U+00b1 +0x90 U+00b0 +0x91 U+006a +0x92 U+006b +0x93 U+006c +0x94 U+006d +0x95 U+006e +0x96 U+006f +0x97 U+0070 +0x98 U+0071 +0x99 U+0072 +0x9a U+fffd +0x9b U+fffd +0x9c U+fffd +0x9d U+00b8 +0x9e U+fffd +0x9f U+00a4 +0xa0 U+00b5 +0xa1 U+007e +0xa2 U+0073 +0xa3 U+0074 +0xa4 U+0075 +0xa5 U+0076 +0xa6 U+0077 +0xa7 U+0078 +0xa8 U+0079 +0xa9 U+007a +0xaa U+fffd +0xab U+fffd +0xac U+fffd +0xad U+fffd +0xae U+fffd +0xaf U+00ae +0xb0 U+005e +0xb1 U+00a3 +0xb2 U+00a5 +0xb3 U+2022 +0xb4 U+00a9 +0xb5 U+00a7 +0xb6 U+00b6 +0xb7 U+00bc +0xb8 U+00bd +0xb9 U+00be +0xba U+005b +0xbb U+005d +0xbc U+203e +0xbd U+00a8 +0xbe U+00b4 +0xbf U+00d7 +0xc0 U+007b +0xc1 U+0041 +0xc2 U+0042 +0xc3 U+0043 +0xc4 U+0044 +0xc5 U+0045 +0xc6 U+0046 +0xc7 U+0047 +0xc8 U+0048 +0xc9 U+0049 +0xca U+00ad +0xcb U+fffd +0xcc U+fffd +0xcd U+fffd +0xce U+fffd +0xcf U+fffd +0xd0 U+007d +0xd1 U+004a +0xd2 U+004b +0xd3 U+004c +0xd4 U+004d +0xd5 U+004e +0xd6 U+004f +0xd7 U+0050 +0xd8 U+0051 +0xd9 U+0052 +0xda U+00b9 +0xdb U+fffd +0xdc U+fffd +0xdd U+fffd +0xde U+fffd +0xdf U+fffd +0xe0 U+005c +0xe1 U+00f7 +0xe2 U+0053 +0xe3 U+0054 +0xe4 U+0055 +0xe5 U+0056 +0xe6 U+0057 +0xe7 U+0058 +0xe8 U+0059 +0xe9 U+005a +0xea U+00b2 +0xeb U+fffd +0xec U+fffd +0xed U+fffd +0xee U+fffd +0xef U+fffd +0xf0 U+0030 +0xf1 U+0031 +0xf2 U+0032 +0xf3 U+0033 +0xf4 U+0034 +0xf5 U+0035 +0xf6 U+0036 +0xf7 U+0037 +0xf8 U+0038 +0xf9 U+0039 +0xfa U+00b3 +0xfb U+fffd +0xfc U+fffd +0xfd U+fffd +0xfe U+fffd +0xff U+009f diff --git a/jdk/make/tools/CharsetMapping/IBM424.nr b/jdk/make/tools/CharsetMapping/IBM424.nr new file mode 100644 index 00000000000..675451906d4 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM424.nr @@ -0,0 +1 @@ +0x25 U+000a diff --git a/jdk/make/tools/CharsetMapping/IBM437.map b/jdk/make/tools/CharsetMapping/IBM437.map new file mode 100644 index 00000000000..2ef0f79cd3b --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM437.map @@ -0,0 +1,257 @@ +#Generated from IBM437.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+00c7 +0x81 U+00fc +0x82 U+00e9 +0x83 U+00e2 +0x84 U+00e4 +0x85 U+00e0 +0x86 U+00e5 +0x87 U+00e7 +0x88 U+00ea +0x89 U+00eb +0x8a U+00e8 +0x8b U+00ef +0x8c U+00ee +0x8d U+00ec +0x8e U+00c4 +0x8f U+00c5 +0x90 U+00c9 +0x91 U+00e6 +0x92 U+00c6 +0x93 U+00f4 +0x94 U+00f6 +0x95 U+00f2 +0x96 U+00fb +0x97 U+00f9 +0x98 U+00ff +0x99 U+00d6 +0x9a U+00dc +0x9b U+00a2 +0x9c U+00a3 +0x9d U+00a5 +0x9e U+20a7 +0x9f U+0192 +0xa0 U+00e1 +0xa1 U+00ed +0xa2 U+00f3 +0xa3 U+00fa +0xa4 U+00f1 +0xa5 U+00d1 +0xa6 U+00aa +0xa7 U+00ba +0xa8 U+00bf +0xa9 U+2310 +0xaa U+00ac +0xab U+00bd +0xac U+00bc +0xad U+00a1 +0xae U+00ab +0xaf U+00bb +0xb0 U+2591 +0xb1 U+2592 +0xb2 U+2593 +0xb3 U+2502 +0xb4 U+2524 +0xb5 U+2561 +0xb6 U+2562 +0xb7 U+2556 +0xb8 U+2555 +0xb9 U+2563 +0xba U+2551 +0xbb U+2557 +0xbc U+255d +0xbd U+255c +0xbe U+255b +0xbf U+2510 +0xc0 U+2514 +0xc1 U+2534 +0xc2 U+252c +0xc3 U+251c +0xc4 U+2500 +0xc5 U+253c +0xc6 U+255e +0xc7 U+255f +0xc8 U+255a +0xc9 U+2554 +0xca U+2569 +0xcb U+2566 +0xcc U+2560 +0xcd U+2550 +0xce U+256c +0xcf U+2567 +0xd0 U+2568 +0xd1 U+2564 +0xd2 U+2565 +0xd3 U+2559 +0xd4 U+2558 +0xd5 U+2552 +0xd6 U+2553 +0xd7 U+256b +0xd8 U+256a +0xd9 U+2518 +0xda U+250c +0xdb U+2588 +0xdc U+2584 +0xdd U+258c +0xde U+2590 +0xdf U+2580 +0xe0 U+03b1 +0xe1 U+00df +0xe2 U+0393 +0xe3 U+03c0 +0xe4 U+03a3 +0xe5 U+03c3 +0xe6 U+00b5 +0xe7 U+03c4 +0xe8 U+03a6 +0xe9 U+0398 +0xea U+03a9 +0xeb U+03b4 +0xec U+221e +0xed U+03c6 +0xee U+03b5 +0xef U+2229 +0xf0 U+2261 +0xf1 U+00b1 +0xf2 U+2265 +0xf3 U+2264 +0xf4 U+2320 +0xf5 U+2321 +0xf6 U+00f7 +0xf7 U+2248 +0xf8 U+00b0 +0xf9 U+2219 +0xfa U+00b7 +0xfb U+221a +0xfc U+207f +0xfd U+00b2 +0xfe U+25a0 +0xff U+00a0 diff --git a/jdk/make/tools/CharsetMapping/IBM500.c2b b/jdk/make/tools/CharsetMapping/IBM500.c2b new file mode 100644 index 00000000000..6cb38028124 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM500.c2b @@ -0,0 +1 @@ +0x15 U+0085 diff --git a/jdk/make/tools/CharsetMapping/IBM500.map b/jdk/make/tools/CharsetMapping/IBM500.map new file mode 100644 index 00000000000..31d11e2d10e --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM500.map @@ -0,0 +1,257 @@ +#Generated from IBM500.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+009c +0x05 U+0009 +0x06 U+0086 +0x07 U+007f +0x08 U+0097 +0x09 U+008d +0x0a U+008e +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+009d +0x15 U+000a +0x16 U+0008 +0x17 U+0087 +0x18 U+0018 +0x19 U+0019 +0x1a U+0092 +0x1b U+008f +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0080 +0x21 U+0081 +0x22 U+0082 +0x23 U+0083 +0x24 U+0084 +0x25 U+000a +0x26 U+0017 +0x27 U+001b +0x28 U+0088 +0x29 U+0089 +0x2a U+008a +0x2b U+008b +0x2c U+008c +0x2d U+0005 +0x2e U+0006 +0x2f U+0007 +0x30 U+0090 +0x31 U+0091 +0x32 U+0016 +0x33 U+0093 +0x34 U+0094 +0x35 U+0095 +0x36 U+0096 +0x37 U+0004 +0x38 U+0098 +0x39 U+0099 +0x3a U+009a +0x3b U+009b +0x3c U+0014 +0x3d U+0015 +0x3e U+009e +0x3f U+001a +0x40 U+0020 +0x41 U+00a0 +0x42 U+00e2 +0x43 U+00e4 +0x44 U+00e0 +0x45 U+00e1 +0x46 U+00e3 +0x47 U+00e5 +0x48 U+00e7 +0x49 U+00f1 +0x4a U+005b +0x4b U+002e +0x4c U+003c +0x4d U+0028 +0x4e U+002b +0x4f U+0021 +0x50 U+0026 +0x51 U+00e9 +0x52 U+00ea +0x53 U+00eb +0x54 U+00e8 +0x55 U+00ed +0x56 U+00ee +0x57 U+00ef +0x58 U+00ec +0x59 U+00df +0x5a U+005d +0x5b U+0024 +0x5c U+002a +0x5d U+0029 +0x5e U+003b +0x5f U+005e +0x60 U+002d +0x61 U+002f +0x62 U+00c2 +0x63 U+00c4 +0x64 U+00c0 +0x65 U+00c1 +0x66 U+00c3 +0x67 U+00c5 +0x68 U+00c7 +0x69 U+00d1 +0x6a U+00a6 +0x6b U+002c +0x6c U+0025 +0x6d U+005f +0x6e U+003e +0x6f U+003f +0x70 U+00f8 +0x71 U+00c9 +0x72 U+00ca +0x73 U+00cb +0x74 U+00c8 +0x75 U+00cd +0x76 U+00ce +0x77 U+00cf +0x78 U+00cc +0x79 U+0060 +0x7a U+003a +0x7b U+0023 +0x7c U+0040 +0x7d U+0027 +0x7e U+003d +0x7f U+0022 +0x80 U+00d8 +0x81 U+0061 +0x82 U+0062 +0x83 U+0063 +0x84 U+0064 +0x85 U+0065 +0x86 U+0066 +0x87 U+0067 +0x88 U+0068 +0x89 U+0069 +0x8a U+00ab +0x8b U+00bb +0x8c U+00f0 +0x8d U+00fd +0x8e U+00fe +0x8f U+00b1 +0x90 U+00b0 +0x91 U+006a +0x92 U+006b +0x93 U+006c +0x94 U+006d +0x95 U+006e +0x96 U+006f +0x97 U+0070 +0x98 U+0071 +0x99 U+0072 +0x9a U+00aa +0x9b U+00ba +0x9c U+00e6 +0x9d U+00b8 +0x9e U+00c6 +0x9f U+00a4 +0xa0 U+00b5 +0xa1 U+007e +0xa2 U+0073 +0xa3 U+0074 +0xa4 U+0075 +0xa5 U+0076 +0xa6 U+0077 +0xa7 U+0078 +0xa8 U+0079 +0xa9 U+007a +0xaa U+00a1 +0xab U+00bf +0xac U+00d0 +0xad U+00dd +0xae U+00de +0xaf U+00ae +0xb0 U+00a2 +0xb1 U+00a3 +0xb2 U+00a5 +0xb3 U+00b7 +0xb4 U+00a9 +0xb5 U+00a7 +0xb6 U+00b6 +0xb7 U+00bc +0xb8 U+00bd +0xb9 U+00be +0xba U+00ac +0xbb U+007c +0xbc U+00af +0xbd U+00a8 +0xbe U+00b4 +0xbf U+00d7 +0xc0 U+007b +0xc1 U+0041 +0xc2 U+0042 +0xc3 U+0043 +0xc4 U+0044 +0xc5 U+0045 +0xc6 U+0046 +0xc7 U+0047 +0xc8 U+0048 +0xc9 U+0049 +0xca U+00ad +0xcb U+00f4 +0xcc U+00f6 +0xcd U+00f2 +0xce U+00f3 +0xcf U+00f5 +0xd0 U+007d +0xd1 U+004a +0xd2 U+004b +0xd3 U+004c +0xd4 U+004d +0xd5 U+004e +0xd6 U+004f +0xd7 U+0050 +0xd8 U+0051 +0xd9 U+0052 +0xda U+00b9 +0xdb U+00fb +0xdc U+00fc +0xdd U+00f9 +0xde U+00fa +0xdf U+00ff +0xe0 U+005c +0xe1 U+00f7 +0xe2 U+0053 +0xe3 U+0054 +0xe4 U+0055 +0xe5 U+0056 +0xe6 U+0057 +0xe7 U+0058 +0xe8 U+0059 +0xe9 U+005a +0xea U+00b2 +0xeb U+00d4 +0xec U+00d6 +0xed U+00d2 +0xee U+00d3 +0xef U+00d5 +0xf0 U+0030 +0xf1 U+0031 +0xf2 U+0032 +0xf3 U+0033 +0xf4 U+0034 +0xf5 U+0035 +0xf6 U+0036 +0xf7 U+0037 +0xf8 U+0038 +0xf9 U+0039 +0xfa U+00b3 +0xfb U+00db +0xfc U+00dc +0xfd U+00d9 +0xfe U+00da +0xff U+009f diff --git a/jdk/make/tools/CharsetMapping/IBM500.nr b/jdk/make/tools/CharsetMapping/IBM500.nr new file mode 100644 index 00000000000..675451906d4 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM500.nr @@ -0,0 +1 @@ +0x25 U+000a diff --git a/jdk/make/tools/CharsetMapping/IBM737.map b/jdk/make/tools/CharsetMapping/IBM737.map new file mode 100644 index 00000000000..c171b421f4e --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM737.map @@ -0,0 +1,257 @@ +#Generated from IBM737.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+0391 +0x81 U+0392 +0x82 U+0393 +0x83 U+0394 +0x84 U+0395 +0x85 U+0396 +0x86 U+0397 +0x87 U+0398 +0x88 U+0399 +0x89 U+039a +0x8a U+039b +0x8b U+039c +0x8c U+039d +0x8d U+039e +0x8e U+039f +0x8f U+03a0 +0x90 U+03a1 +0x91 U+03a3 +0x92 U+03a4 +0x93 U+03a5 +0x94 U+03a6 +0x95 U+03a7 +0x96 U+03a8 +0x97 U+03a9 +0x98 U+03b1 +0x99 U+03b2 +0x9a U+03b3 +0x9b U+03b4 +0x9c U+03b5 +0x9d U+03b6 +0x9e U+03b7 +0x9f U+03b8 +0xa0 U+03b9 +0xa1 U+03ba +0xa2 U+03bb +0xa3 U+03bc +0xa4 U+03bd +0xa5 U+03be +0xa6 U+03bf +0xa7 U+03c0 +0xa8 U+03c1 +0xa9 U+03c3 +0xaa U+03c2 +0xab U+03c4 +0xac U+03c5 +0xad U+03c6 +0xae U+03c7 +0xaf U+03c8 +0xb0 U+2591 +0xb1 U+2592 +0xb2 U+2593 +0xb3 U+2502 +0xb4 U+2524 +0xb5 U+2561 +0xb6 U+2562 +0xb7 U+2556 +0xb8 U+2555 +0xb9 U+2563 +0xba U+2551 +0xbb U+2557 +0xbc U+255d +0xbd U+255c +0xbe U+255b +0xbf U+2510 +0xc0 U+2514 +0xc1 U+2534 +0xc2 U+252c +0xc3 U+251c +0xc4 U+2500 +0xc5 U+253c +0xc6 U+255e +0xc7 U+255f +0xc8 U+255a +0xc9 U+2554 +0xca U+2569 +0xcb U+2566 +0xcc U+2560 +0xcd U+2550 +0xce U+256c +0xcf U+2567 +0xd0 U+2568 +0xd1 U+2564 +0xd2 U+2565 +0xd3 U+2559 +0xd4 U+2558 +0xd5 U+2552 +0xd6 U+2553 +0xd7 U+256b +0xd8 U+256a +0xd9 U+2518 +0xda U+250c +0xdb U+2588 +0xdc U+2584 +0xdd U+258c +0xde U+2590 +0xdf U+2580 +0xe0 U+03c9 +0xe1 U+03ac +0xe2 U+03ad +0xe3 U+03ae +0xe4 U+03ca +0xe5 U+03af +0xe6 U+03cc +0xe7 U+03cd +0xe8 U+03cb +0xe9 U+03ce +0xea U+0386 +0xeb U+0388 +0xec U+0389 +0xed U+038a +0xee U+038c +0xef U+038e +0xf0 U+038f +0xf1 U+00b1 +0xf2 U+2265 +0xf3 U+2264 +0xf4 U+03aa +0xf5 U+03ab +0xf6 U+00f7 +0xf7 U+2248 +0xf8 U+00b0 +0xf9 U+2219 +0xfa U+00b7 +0xfb U+221a +0xfc U+207f +0xfd U+00b2 +0xfe U+25a0 +0xff U+00a0 diff --git a/jdk/make/tools/CharsetMapping/IBM775.map b/jdk/make/tools/CharsetMapping/IBM775.map new file mode 100644 index 00000000000..a023d0e1bf1 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM775.map @@ -0,0 +1,257 @@ +#Generated from IBM775.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+0106 +0x81 U+00fc +0x82 U+00e9 +0x83 U+0101 +0x84 U+00e4 +0x85 U+0123 +0x86 U+00e5 +0x87 U+0107 +0x88 U+0142 +0x89 U+0113 +0x8a U+0156 +0x8b U+0157 +0x8c U+012b +0x8d U+0179 +0x8e U+00c4 +0x8f U+00c5 +0x90 U+00c9 +0x91 U+00e6 +0x92 U+00c6 +0x93 U+014d +0x94 U+00f6 +0x95 U+0122 +0x96 U+00a2 +0x97 U+015a +0x98 U+015b +0x99 U+00d6 +0x9a U+00dc +0x9b U+00f8 +0x9c U+00a3 +0x9d U+00d8 +0x9e U+00d7 +0x9f U+00a4 +0xa0 U+0100 +0xa1 U+012a +0xa2 U+00f3 +0xa3 U+017b +0xa4 U+017c +0xa5 U+017a +0xa6 U+201d +0xa7 U+00a6 +0xa8 U+00a9 +0xa9 U+00ae +0xaa U+00ac +0xab U+00bd +0xac U+00bc +0xad U+0141 +0xae U+00ab +0xaf U+00bb +0xb0 U+2591 +0xb1 U+2592 +0xb2 U+2593 +0xb3 U+2502 +0xb4 U+2524 +0xb5 U+0104 +0xb6 U+010c +0xb7 U+0118 +0xb8 U+0116 +0xb9 U+2563 +0xba U+2551 +0xbb U+2557 +0xbc U+255d +0xbd U+012e +0xbe U+0160 +0xbf U+2510 +0xc0 U+2514 +0xc1 U+2534 +0xc2 U+252c +0xc3 U+251c +0xc4 U+2500 +0xc5 U+253c +0xc6 U+0172 +0xc7 U+016a +0xc8 U+255a +0xc9 U+2554 +0xca U+2569 +0xcb U+2566 +0xcc U+2560 +0xcd U+2550 +0xce U+256c +0xcf U+017d +0xd0 U+0105 +0xd1 U+010d +0xd2 U+0119 +0xd3 U+0117 +0xd4 U+012f +0xd5 U+0161 +0xd6 U+0173 +0xd7 U+016b +0xd8 U+017e +0xd9 U+2518 +0xda U+250c +0xdb U+2588 +0xdc U+2584 +0xdd U+258c +0xde U+2590 +0xdf U+2580 +0xe0 U+00d3 +0xe1 U+00df +0xe2 U+014c +0xe3 U+0143 +0xe4 U+00f5 +0xe5 U+00d5 +0xe6 U+00b5 +0xe7 U+0144 +0xe8 U+0136 +0xe9 U+0137 +0xea U+013b +0xeb U+013c +0xec U+0146 +0xed U+0112 +0xee U+0145 +0xef U+2019 +0xf0 U+00ad +0xf1 U+00b1 +0xf2 U+201c +0xf3 U+00be +0xf4 U+00b6 +0xf5 U+00a7 +0xf6 U+00f7 +0xf7 U+201e +0xf8 U+00b0 +0xf9 U+2219 +0xfa U+00b7 +0xfb U+00b9 +0xfc U+00b3 +0xfd U+00b2 +0xfe U+25a0 +0xff U+00a0 diff --git a/jdk/make/tools/CharsetMapping/IBM838.c2b b/jdk/make/tools/CharsetMapping/IBM838.c2b new file mode 100644 index 00000000000..6cb38028124 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM838.c2b @@ -0,0 +1 @@ +0x15 U+0085 diff --git a/jdk/make/tools/CharsetMapping/IBM838.map b/jdk/make/tools/CharsetMapping/IBM838.map new file mode 100644 index 00000000000..eb587e71fc8 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM838.map @@ -0,0 +1,257 @@ +#Generated from IBM838.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+009c +0x05 U+0009 +0x06 U+0086 +0x07 U+007f +0x08 U+0097 +0x09 U+008d +0x0a U+008e +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+009d +0x15 U+000a +0x16 U+0008 +0x17 U+0087 +0x18 U+0018 +0x19 U+0019 +0x1a U+0092 +0x1b U+008f +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0080 +0x21 U+0081 +0x22 U+0082 +0x23 U+0083 +0x24 U+0084 +0x25 U+000a +0x26 U+0017 +0x27 U+001b +0x28 U+0088 +0x29 U+0089 +0x2a U+008a +0x2b U+008b +0x2c U+008c +0x2d U+0005 +0x2e U+0006 +0x2f U+0007 +0x30 U+0090 +0x31 U+0091 +0x32 U+0016 +0x33 U+0093 +0x34 U+0094 +0x35 U+0095 +0x36 U+0096 +0x37 U+0004 +0x38 U+0098 +0x39 U+0099 +0x3a U+009a +0x3b U+009b +0x3c U+0014 +0x3d U+0015 +0x3e U+009e +0x3f U+001a +0x40 U+0020 +0x41 U+00a0 +0x42 U+0e01 +0x43 U+0e02 +0x44 U+0e03 +0x45 U+0e04 +0x46 U+0e05 +0x47 U+0e06 +0x48 U+0e07 +0x49 U+005b +0x4a U+00a2 +0x4b U+002e +0x4c U+003c +0x4d U+0028 +0x4e U+002b +0x4f U+007c +0x50 U+0026 +0x51 U+0e48 +0x52 U+0e08 +0x53 U+0e09 +0x54 U+0e0a +0x55 U+0e0b +0x56 U+0e0c +0x57 U+0e0d +0x58 U+0e0e +0x59 U+005d +0x5a U+0021 +0x5b U+0024 +0x5c U+002a +0x5d U+0029 +0x5e U+003b +0x5f U+00ac +0x60 U+002d +0x61 U+002f +0x62 U+0e0f +0x63 U+0e10 +0x64 U+0e11 +0x65 U+0e12 +0x66 U+0e13 +0x67 U+0e14 +0x68 U+0e15 +0x69 U+005e +0x6a U+00a6 +0x6b U+002c +0x6c U+0025 +0x6d U+005f +0x6e U+003e +0x6f U+003f +0x70 U+0e3f +0x71 U+0e4e +0x72 U+0e16 +0x73 U+0e17 +0x74 U+0e18 +0x75 U+0e19 +0x76 U+0e1a +0x77 U+0e1b +0x78 U+0e1c +0x79 U+0060 +0x7a U+003a +0x7b U+0023 +0x7c U+0040 +0x7d U+0027 +0x7e U+003d +0x7f U+0022 +0x80 U+0e4f +0x81 U+0061 +0x82 U+0062 +0x83 U+0063 +0x84 U+0064 +0x85 U+0065 +0x86 U+0066 +0x87 U+0067 +0x88 U+0068 +0x89 U+0069 +0x8a U+0e1d +0x8b U+0e1e +0x8c U+0e1f +0x8d U+0e20 +0x8e U+0e21 +0x8f U+0e22 +0x90 U+0e5a +0x91 U+006a +0x92 U+006b +0x93 U+006c +0x94 U+006d +0x95 U+006e +0x96 U+006f +0x97 U+0070 +0x98 U+0071 +0x99 U+0072 +0x9a U+0e23 +0x9b U+0e24 +0x9c U+0e25 +0x9d U+0e26 +0x9e U+0e27 +0x9f U+0e28 +0xa0 U+0e5b +0xa1 U+007e +0xa2 U+0073 +0xa3 U+0074 +0xa4 U+0075 +0xa5 U+0076 +0xa6 U+0077 +0xa7 U+0078 +0xa8 U+0079 +0xa9 U+007a +0xaa U+0e29 +0xab U+0e2a +0xac U+0e2b +0xad U+0e2c +0xae U+0e2d +0xaf U+0e2e +0xb0 U+0e50 +0xb1 U+0e51 +0xb2 U+0e52 +0xb3 U+0e53 +0xb4 U+0e54 +0xb5 U+0e55 +0xb6 U+0e56 +0xb7 U+0e57 +0xb8 U+0e58 +0xb9 U+0e59 +0xba U+0e2f +0xbb U+0e30 +0xbc U+0e31 +0xbd U+0e32 +0xbe U+0e33 +0xbf U+0e34 +0xc0 U+007b +0xc1 U+0041 +0xc2 U+0042 +0xc3 U+0043 +0xc4 U+0044 +0xc5 U+0045 +0xc6 U+0046 +0xc7 U+0047 +0xc8 U+0048 +0xc9 U+0049 +0xca U+0e49 +0xcb U+0e35 +0xcc U+0e36 +0xcd U+0e37 +0xce U+0e38 +0xcf U+0e39 +0xd0 U+007d +0xd1 U+004a +0xd2 U+004b +0xd3 U+004c +0xd4 U+004d +0xd5 U+004e +0xd6 U+004f +0xd7 U+0050 +0xd8 U+0051 +0xd9 U+0052 +0xda U+0e3a +0xdb U+0e40 +0xdc U+0e41 +0xdd U+0e42 +0xde U+0e43 +0xdf U+0e44 +0xe0 U+005c +0xe1 U+0e4a +0xe2 U+0053 +0xe3 U+0054 +0xe4 U+0055 +0xe5 U+0056 +0xe6 U+0057 +0xe7 U+0058 +0xe8 U+0059 +0xe9 U+005a +0xea U+0e45 +0xeb U+0e46 +0xec U+0e47 +0xed U+0e48 +0xee U+0e49 +0xef U+0e4a +0xf0 U+0030 +0xf1 U+0031 +0xf2 U+0032 +0xf3 U+0033 +0xf4 U+0034 +0xf5 U+0035 +0xf6 U+0036 +0xf7 U+0037 +0xf8 U+0038 +0xf9 U+0039 +0xfa U+0e4b +0xfb U+0e4c +0xfc U+0e4d +0xfd U+0e4b +0xfe U+0e4c +0xff U+009f diff --git a/jdk/make/tools/CharsetMapping/IBM838.nr b/jdk/make/tools/CharsetMapping/IBM838.nr new file mode 100644 index 00000000000..3b3d08b0d16 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM838.nr @@ -0,0 +1,6 @@ +0x25 U+000a +0x51 U+0e48 +0xca U+0e49 +0xe1 U+0e4a +0xfd U+0e4b +0xfe U+0e4c diff --git a/jdk/make/tools/CharsetMapping/IBM850.map b/jdk/make/tools/CharsetMapping/IBM850.map new file mode 100644 index 00000000000..981356f85b2 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM850.map @@ -0,0 +1,257 @@ +#Generated from IBM850.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+00c7 +0x81 U+00fc +0x82 U+00e9 +0x83 U+00e2 +0x84 U+00e4 +0x85 U+00e0 +0x86 U+00e5 +0x87 U+00e7 +0x88 U+00ea +0x89 U+00eb +0x8a U+00e8 +0x8b U+00ef +0x8c U+00ee +0x8d U+00ec +0x8e U+00c4 +0x8f U+00c5 +0x90 U+00c9 +0x91 U+00e6 +0x92 U+00c6 +0x93 U+00f4 +0x94 U+00f6 +0x95 U+00f2 +0x96 U+00fb +0x97 U+00f9 +0x98 U+00ff +0x99 U+00d6 +0x9a U+00dc +0x9b U+00f8 +0x9c U+00a3 +0x9d U+00d8 +0x9e U+00d7 +0x9f U+0192 +0xa0 U+00e1 +0xa1 U+00ed +0xa2 U+00f3 +0xa3 U+00fa +0xa4 U+00f1 +0xa5 U+00d1 +0xa6 U+00aa +0xa7 U+00ba +0xa8 U+00bf +0xa9 U+00ae +0xaa U+00ac +0xab U+00bd +0xac U+00bc +0xad U+00a1 +0xae U+00ab +0xaf U+00bb +0xb0 U+2591 +0xb1 U+2592 +0xb2 U+2593 +0xb3 U+2502 +0xb4 U+2524 +0xb5 U+00c1 +0xb6 U+00c2 +0xb7 U+00c0 +0xb8 U+00a9 +0xb9 U+2563 +0xba U+2551 +0xbb U+2557 +0xbc U+255d +0xbd U+00a2 +0xbe U+00a5 +0xbf U+2510 +0xc0 U+2514 +0xc1 U+2534 +0xc2 U+252c +0xc3 U+251c +0xc4 U+2500 +0xc5 U+253c +0xc6 U+00e3 +0xc7 U+00c3 +0xc8 U+255a +0xc9 U+2554 +0xca U+2569 +0xcb U+2566 +0xcc U+2560 +0xcd U+2550 +0xce U+256c +0xcf U+00a4 +0xd0 U+00f0 +0xd1 U+00d0 +0xd2 U+00ca +0xd3 U+00cb +0xd4 U+00c8 +0xd5 U+0131 +0xd6 U+00cd +0xd7 U+00ce +0xd8 U+00cf +0xd9 U+2518 +0xda U+250c +0xdb U+2588 +0xdc U+2584 +0xdd U+00a6 +0xde U+00cc +0xdf U+2580 +0xe0 U+00d3 +0xe1 U+00df +0xe2 U+00d4 +0xe3 U+00d2 +0xe4 U+00f5 +0xe5 U+00d5 +0xe6 U+00b5 +0xe7 U+00fe +0xe8 U+00de +0xe9 U+00da +0xea U+00db +0xeb U+00d9 +0xec U+00fd +0xed U+00dd +0xee U+00af +0xef U+00b4 +0xf0 U+00ad +0xf1 U+00b1 +0xf2 U+2017 +0xf3 U+00be +0xf4 U+00b6 +0xf5 U+00a7 +0xf6 U+00f7 +0xf7 U+00b8 +0xf8 U+00b0 +0xf9 U+00a8 +0xfa U+00b7 +0xfb U+00b9 +0xfc U+00b3 +0xfd U+00b2 +0xfe U+25a0 +0xff U+00a0 diff --git a/jdk/make/tools/CharsetMapping/IBM852.map b/jdk/make/tools/CharsetMapping/IBM852.map new file mode 100644 index 00000000000..1c5768a01b6 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM852.map @@ -0,0 +1,257 @@ +#Generated from IBM852.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+00c7 +0x81 U+00fc +0x82 U+00e9 +0x83 U+00e2 +0x84 U+00e4 +0x85 U+016f +0x86 U+0107 +0x87 U+00e7 +0x88 U+0142 +0x89 U+00eb +0x8a U+0150 +0x8b U+0151 +0x8c U+00ee +0x8d U+0179 +0x8e U+00c4 +0x8f U+0106 +0x90 U+00c9 +0x91 U+0139 +0x92 U+013a +0x93 U+00f4 +0x94 U+00f6 +0x95 U+013d +0x96 U+013e +0x97 U+015a +0x98 U+015b +0x99 U+00d6 +0x9a U+00dc +0x9b U+0164 +0x9c U+0165 +0x9d U+0141 +0x9e U+00d7 +0x9f U+010d +0xa0 U+00e1 +0xa1 U+00ed +0xa2 U+00f3 +0xa3 U+00fa +0xa4 U+0104 +0xa5 U+0105 +0xa6 U+017d +0xa7 U+017e +0xa8 U+0118 +0xa9 U+0119 +0xaa U+00ac +0xab U+017a +0xac U+010c +0xad U+015f +0xae U+00ab +0xaf U+00bb +0xb0 U+2591 +0xb1 U+2592 +0xb2 U+2593 +0xb3 U+2502 +0xb4 U+2524 +0xb5 U+00c1 +0xb6 U+00c2 +0xb7 U+011a +0xb8 U+015e +0xb9 U+2563 +0xba U+2551 +0xbb U+2557 +0xbc U+255d +0xbd U+017b +0xbe U+017c +0xbf U+2510 +0xc0 U+2514 +0xc1 U+2534 +0xc2 U+252c +0xc3 U+251c +0xc4 U+2500 +0xc5 U+253c +0xc6 U+0102 +0xc7 U+0103 +0xc8 U+255a +0xc9 U+2554 +0xca U+2569 +0xcb U+2566 +0xcc U+2560 +0xcd U+2550 +0xce U+256c +0xcf U+00a4 +0xd0 U+0111 +0xd1 U+0110 +0xd2 U+010e +0xd3 U+00cb +0xd4 U+010f +0xd5 U+0147 +0xd6 U+00cd +0xd7 U+00ce +0xd8 U+011b +0xd9 U+2518 +0xda U+250c +0xdb U+2588 +0xdc U+2584 +0xdd U+0162 +0xde U+016e +0xdf U+2580 +0xe0 U+00d3 +0xe1 U+00df +0xe2 U+00d4 +0xe3 U+0143 +0xe4 U+0144 +0xe5 U+0148 +0xe6 U+0160 +0xe7 U+0161 +0xe8 U+0154 +0xe9 U+00da +0xea U+0155 +0xeb U+0170 +0xec U+00fd +0xed U+00dd +0xee U+0163 +0xef U+00b4 +0xf0 U+00ad +0xf1 U+02dd +0xf2 U+02db +0xf3 U+02c7 +0xf4 U+02d8 +0xf5 U+00a7 +0xf6 U+00f7 +0xf7 U+00b8 +0xf8 U+00b0 +0xf9 U+00a8 +0xfa U+02d9 +0xfb U+0171 +0xfc U+0158 +0xfd U+0159 +0xfe U+25a0 +0xff U+00a0 diff --git a/jdk/make/tools/CharsetMapping/IBM855.map b/jdk/make/tools/CharsetMapping/IBM855.map new file mode 100644 index 00000000000..4efc220a97c --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM855.map @@ -0,0 +1,257 @@ +#Generated from IBM855.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+0452 +0x81 U+0402 +0x82 U+0453 +0x83 U+0403 +0x84 U+0451 +0x85 U+0401 +0x86 U+0454 +0x87 U+0404 +0x88 U+0455 +0x89 U+0405 +0x8a U+0456 +0x8b U+0406 +0x8c U+0457 +0x8d U+0407 +0x8e U+0458 +0x8f U+0408 +0x90 U+0459 +0x91 U+0409 +0x92 U+045a +0x93 U+040a +0x94 U+045b +0x95 U+040b +0x96 U+045c +0x97 U+040c +0x98 U+045e +0x99 U+040e +0x9a U+045f +0x9b U+040f +0x9c U+044e +0x9d U+042e +0x9e U+044a +0x9f U+042a +0xa0 U+0430 +0xa1 U+0410 +0xa2 U+0431 +0xa3 U+0411 +0xa4 U+0446 +0xa5 U+0426 +0xa6 U+0434 +0xa7 U+0414 +0xa8 U+0435 +0xa9 U+0415 +0xaa U+0444 +0xab U+0424 +0xac U+0433 +0xad U+0413 +0xae U+00ab +0xaf U+00bb +0xb0 U+2591 +0xb1 U+2592 +0xb2 U+2593 +0xb3 U+2502 +0xb4 U+2524 +0xb5 U+0445 +0xb6 U+0425 +0xb7 U+0438 +0xb8 U+0418 +0xb9 U+2563 +0xba U+2551 +0xbb U+2557 +0xbc U+255d +0xbd U+0439 +0xbe U+0419 +0xbf U+2510 +0xc0 U+2514 +0xc1 U+2534 +0xc2 U+252c +0xc3 U+251c +0xc4 U+2500 +0xc5 U+253c +0xc6 U+043a +0xc7 U+041a +0xc8 U+255a +0xc9 U+2554 +0xca U+2569 +0xcb U+2566 +0xcc U+2560 +0xcd U+2550 +0xce U+256c +0xcf U+00a4 +0xd0 U+043b +0xd1 U+041b +0xd2 U+043c +0xd3 U+041c +0xd4 U+043d +0xd5 U+041d +0xd6 U+043e +0xd7 U+041e +0xd8 U+043f +0xd9 U+2518 +0xda U+250c +0xdb U+2588 +0xdc U+2584 +0xdd U+041f +0xde U+044f +0xdf U+2580 +0xe0 U+042f +0xe1 U+0440 +0xe2 U+0420 +0xe3 U+0441 +0xe4 U+0421 +0xe5 U+0442 +0xe6 U+0422 +0xe7 U+0443 +0xe8 U+0423 +0xe9 U+0436 +0xea U+0416 +0xeb U+0432 +0xec U+0412 +0xed U+044c +0xee U+042c +0xef U+2116 +0xf0 U+00ad +0xf1 U+044b +0xf2 U+042b +0xf3 U+0437 +0xf4 U+0417 +0xf5 U+0448 +0xf6 U+0428 +0xf7 U+044d +0xf8 U+042d +0xf9 U+0449 +0xfa U+0429 +0xfb U+0447 +0xfc U+0427 +0xfd U+00a7 +0xfe U+25a0 +0xff U+00a0 diff --git a/jdk/make/tools/CharsetMapping/IBM856.map b/jdk/make/tools/CharsetMapping/IBM856.map new file mode 100644 index 00000000000..8e703c6e53e --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM856.map @@ -0,0 +1,257 @@ +#Generated from IBM856.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+05d0 +0x81 U+05d1 +0x82 U+05d2 +0x83 U+05d3 +0x84 U+05d4 +0x85 U+05d5 +0x86 U+05d6 +0x87 U+05d7 +0x88 U+05d8 +0x89 U+05d9 +0x8a U+05da +0x8b U+05db +0x8c U+05dc +0x8d U+05dd +0x8e U+05de +0x8f U+05df +0x90 U+05e0 +0x91 U+05e1 +0x92 U+05e2 +0x93 U+05e3 +0x94 U+05e4 +0x95 U+05e5 +0x96 U+05e6 +0x97 U+05e7 +0x98 U+05e8 +0x99 U+05e9 +0x9a U+05ea +0x9b U+fffd +0x9c U+00a3 +0x9d U+fffd +0x9e U+00d7 +0x9f U+fffd +0xa0 U+fffd +0xa1 U+fffd +0xa2 U+fffd +0xa3 U+fffd +0xa4 U+fffd +0xa5 U+fffd +0xa6 U+fffd +0xa7 U+fffd +0xa8 U+fffd +0xa9 U+00ae +0xaa U+00ac +0xab U+00bd +0xac U+00bc +0xad U+fffd +0xae U+00ab +0xaf U+00bb +0xb0 U+2591 +0xb1 U+2592 +0xb2 U+2593 +0xb3 U+2502 +0xb4 U+2524 +0xb5 U+fffd +0xb6 U+fffd +0xb7 U+fffd +0xb8 U+00a9 +0xb9 U+2563 +0xba U+2551 +0xbb U+2557 +0xbc U+255d +0xbd U+00a2 +0xbe U+00a5 +0xbf U+2510 +0xc0 U+2514 +0xc1 U+2534 +0xc2 U+252c +0xc3 U+251c +0xc4 U+2500 +0xc5 U+253c +0xc6 U+fffd +0xc7 U+fffd +0xc8 U+255a +0xc9 U+2554 +0xca U+2569 +0xcb U+2566 +0xcc U+2560 +0xcd U+2550 +0xce U+256c +0xcf U+00a4 +0xd0 U+fffd +0xd1 U+fffd +0xd2 U+fffd +0xd3 U+fffd +0xd4 U+fffd +0xd5 U+fffd +0xd6 U+fffd +0xd7 U+fffd +0xd8 U+fffd +0xd9 U+2518 +0xda U+250c +0xdb U+2588 +0xdc U+2584 +0xdd U+00a6 +0xde U+fffd +0xdf U+2580 +0xe0 U+fffd +0xe1 U+fffd +0xe2 U+fffd +0xe3 U+fffd +0xe4 U+fffd +0xe5 U+fffd +0xe6 U+00b5 +0xe7 U+fffd +0xe8 U+fffd +0xe9 U+fffd +0xea U+fffd +0xeb U+fffd +0xec U+fffd +0xed U+fffd +0xee U+203e +0xef U+00b4 +0xf0 U+00ad +0xf1 U+00b1 +0xf2 U+2017 +0xf3 U+00be +0xf4 U+00b6 +0xf5 U+00a7 +0xf6 U+00f7 +0xf7 U+00b8 +0xf8 U+00b0 +0xf9 U+00a8 +0xfa U+2022 +0xfb U+00b9 +0xfc U+00b3 +0xfd U+00b2 +0xfe U+25a0 +0xff U+00a0 diff --git a/jdk/make/tools/CharsetMapping/IBM857.map b/jdk/make/tools/CharsetMapping/IBM857.map new file mode 100644 index 00000000000..e85b12bc7fd --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM857.map @@ -0,0 +1,257 @@ +#Generated from IBM857.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+00c7 +0x81 U+00fc +0x82 U+00e9 +0x83 U+00e2 +0x84 U+00e4 +0x85 U+00e0 +0x86 U+00e5 +0x87 U+00e7 +0x88 U+00ea +0x89 U+00eb +0x8a U+00e8 +0x8b U+00ef +0x8c U+00ee +0x8d U+0131 +0x8e U+00c4 +0x8f U+00c5 +0x90 U+00c9 +0x91 U+00e6 +0x92 U+00c6 +0x93 U+00f4 +0x94 U+00f6 +0x95 U+00f2 +0x96 U+00fb +0x97 U+00f9 +0x98 U+0130 +0x99 U+00d6 +0x9a U+00dc +0x9b U+00f8 +0x9c U+00a3 +0x9d U+00d8 +0x9e U+015e +0x9f U+015f +0xa0 U+00e1 +0xa1 U+00ed +0xa2 U+00f3 +0xa3 U+00fa +0xa4 U+00f1 +0xa5 U+00d1 +0xa6 U+011e +0xa7 U+011f +0xa8 U+00bf +0xa9 U+00ae +0xaa U+00ac +0xab U+00bd +0xac U+00bc +0xad U+00a1 +0xae U+00ab +0xaf U+00bb +0xb0 U+2591 +0xb1 U+2592 +0xb2 U+2593 +0xb3 U+2502 +0xb4 U+2524 +0xb5 U+00c1 +0xb6 U+00c2 +0xb7 U+00c0 +0xb8 U+00a9 +0xb9 U+2563 +0xba U+2551 +0xbb U+2557 +0xbc U+255d +0xbd U+00a2 +0xbe U+00a5 +0xbf U+2510 +0xc0 U+2514 +0xc1 U+2534 +0xc2 U+252c +0xc3 U+251c +0xc4 U+2500 +0xc5 U+253c +0xc6 U+00e3 +0xc7 U+00c3 +0xc8 U+255a +0xc9 U+2554 +0xca U+2569 +0xcb U+2566 +0xcc U+2560 +0xcd U+2550 +0xce U+256c +0xcf U+00a4 +0xd0 U+00ba +0xd1 U+00aa +0xd2 U+00ca +0xd3 U+00cb +0xd4 U+00c8 +0xd5 U+fffd +0xd6 U+00cd +0xd7 U+00ce +0xd8 U+00cf +0xd9 U+2518 +0xda U+250c +0xdb U+2588 +0xdc U+2584 +0xdd U+00a6 +0xde U+00cc +0xdf U+2580 +0xe0 U+00d3 +0xe1 U+00df +0xe2 U+00d4 +0xe3 U+00d2 +0xe4 U+00f5 +0xe5 U+00d5 +0xe6 U+00b5 +0xe7 U+fffd +0xe8 U+00d7 +0xe9 U+00da +0xea U+00db +0xeb U+00d9 +0xec U+00ec +0xed U+00ff +0xee U+00af +0xef U+00b4 +0xf0 U+00ad +0xf1 U+00b1 +0xf2 U+fffd +0xf3 U+00be +0xf4 U+00b6 +0xf5 U+00a7 +0xf6 U+00f7 +0xf7 U+00b8 +0xf8 U+00b0 +0xf9 U+00a8 +0xfa U+00b7 +0xfb U+00b9 +0xfc U+00b3 +0xfd U+00b2 +0xfe U+25a0 +0xff U+00a0 diff --git a/jdk/make/tools/CharsetMapping/IBM858.map b/jdk/make/tools/CharsetMapping/IBM858.map new file mode 100644 index 00000000000..c2878044020 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM858.map @@ -0,0 +1,257 @@ +#Generated from IBM858.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+00c7 +0x81 U+00fc +0x82 U+00e9 +0x83 U+00e2 +0x84 U+00e4 +0x85 U+00e0 +0x86 U+00e5 +0x87 U+00e7 +0x88 U+00ea +0x89 U+00eb +0x8a U+00e8 +0x8b U+00ef +0x8c U+00ee +0x8d U+00ec +0x8e U+00c4 +0x8f U+00c5 +0x90 U+00c9 +0x91 U+00e6 +0x92 U+00c6 +0x93 U+00f4 +0x94 U+00f6 +0x95 U+00f2 +0x96 U+00fb +0x97 U+00f9 +0x98 U+00ff +0x99 U+00d6 +0x9a U+00dc +0x9b U+00f8 +0x9c U+00a3 +0x9d U+00d8 +0x9e U+00d7 +0x9f U+0192 +0xa0 U+00e1 +0xa1 U+00ed +0xa2 U+00f3 +0xa3 U+00fa +0xa4 U+00f1 +0xa5 U+00d1 +0xa6 U+00aa +0xa7 U+00ba +0xa8 U+00bf +0xa9 U+00ae +0xaa U+00ac +0xab U+00bd +0xac U+00bc +0xad U+00a1 +0xae U+00ab +0xaf U+00bb +0xb0 U+2591 +0xb1 U+2592 +0xb2 U+2593 +0xb3 U+2502 +0xb4 U+2524 +0xb5 U+00c1 +0xb6 U+00c2 +0xb7 U+00c0 +0xb8 U+00a9 +0xb9 U+2563 +0xba U+2551 +0xbb U+2557 +0xbc U+255d +0xbd U+00a2 +0xbe U+00a5 +0xbf U+2510 +0xc0 U+2514 +0xc1 U+2534 +0xc2 U+252c +0xc3 U+251c +0xc4 U+2500 +0xc5 U+253c +0xc6 U+00e3 +0xc7 U+00c3 +0xc8 U+255a +0xc9 U+2554 +0xca U+2569 +0xcb U+2566 +0xcc U+2560 +0xcd U+2550 +0xce U+256c +0xcf U+00a4 +0xd0 U+00f0 +0xd1 U+00d0 +0xd2 U+00ca +0xd3 U+00cb +0xd4 U+00c8 +0xd5 U+20ac +0xd6 U+00cd +0xd7 U+00ce +0xd8 U+00cf +0xd9 U+2518 +0xda U+250c +0xdb U+2588 +0xdc U+2584 +0xdd U+00a6 +0xde U+00cc +0xdf U+2580 +0xe0 U+00d3 +0xe1 U+00df +0xe2 U+00d4 +0xe3 U+00d2 +0xe4 U+00f5 +0xe5 U+00d5 +0xe6 U+00b5 +0xe7 U+00fe +0xe8 U+00de +0xe9 U+00da +0xea U+00db +0xeb U+00d9 +0xec U+00fd +0xed U+00dd +0xee U+00af +0xef U+00b4 +0xf0 U+00ad +0xf1 U+00b1 +0xf2 U+2017 +0xf3 U+00be +0xf4 U+00b6 +0xf5 U+00a7 +0xf6 U+00f7 +0xf7 U+00b8 +0xf8 U+00b0 +0xf9 U+00a8 +0xfa U+00b7 +0xfb U+00b9 +0xfc U+00b3 +0xfd U+00b2 +0xfe U+25a0 +0xff U+00a0 diff --git a/jdk/make/tools/CharsetMapping/IBM860.map b/jdk/make/tools/CharsetMapping/IBM860.map new file mode 100644 index 00000000000..88ddee06894 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM860.map @@ -0,0 +1,257 @@ +#Generated from IBM860.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+00c7 +0x81 U+00fc +0x82 U+00e9 +0x83 U+00e2 +0x84 U+00e3 +0x85 U+00e0 +0x86 U+00c1 +0x87 U+00e7 +0x88 U+00ea +0x89 U+00ca +0x8a U+00e8 +0x8b U+00cd +0x8c U+00d4 +0x8d U+00ec +0x8e U+00c3 +0x8f U+00c2 +0x90 U+00c9 +0x91 U+00c0 +0x92 U+00c8 +0x93 U+00f4 +0x94 U+00f5 +0x95 U+00f2 +0x96 U+00da +0x97 U+00f9 +0x98 U+00cc +0x99 U+00d5 +0x9a U+00dc +0x9b U+00a2 +0x9c U+00a3 +0x9d U+00d9 +0x9e U+20a7 +0x9f U+00d3 +0xa0 U+00e1 +0xa1 U+00ed +0xa2 U+00f3 +0xa3 U+00fa +0xa4 U+00f1 +0xa5 U+00d1 +0xa6 U+00aa +0xa7 U+00ba +0xa8 U+00bf +0xa9 U+00d2 +0xaa U+00ac +0xab U+00bd +0xac U+00bc +0xad U+00a1 +0xae U+00ab +0xaf U+00bb +0xb0 U+2591 +0xb1 U+2592 +0xb2 U+2593 +0xb3 U+2502 +0xb4 U+2524 +0xb5 U+2561 +0xb6 U+2562 +0xb7 U+2556 +0xb8 U+2555 +0xb9 U+2563 +0xba U+2551 +0xbb U+2557 +0xbc U+255d +0xbd U+255c +0xbe U+255b +0xbf U+2510 +0xc0 U+2514 +0xc1 U+2534 +0xc2 U+252c +0xc3 U+251c +0xc4 U+2500 +0xc5 U+253c +0xc6 U+255e +0xc7 U+255f +0xc8 U+255a +0xc9 U+2554 +0xca U+2569 +0xcb U+2566 +0xcc U+2560 +0xcd U+2550 +0xce U+256c +0xcf U+2567 +0xd0 U+2568 +0xd1 U+2564 +0xd2 U+2565 +0xd3 U+2559 +0xd4 U+2558 +0xd5 U+2552 +0xd6 U+2553 +0xd7 U+256b +0xd8 U+256a +0xd9 U+2518 +0xda U+250c +0xdb U+2588 +0xdc U+2584 +0xdd U+258c +0xde U+2590 +0xdf U+2580 +0xe0 U+03b1 +0xe1 U+00df +0xe2 U+0393 +0xe3 U+03c0 +0xe4 U+03a3 +0xe5 U+03c3 +0xe6 U+00b5 +0xe7 U+03c4 +0xe8 U+03a6 +0xe9 U+0398 +0xea U+03a9 +0xeb U+03b4 +0xec U+221e +0xed U+03c6 +0xee U+03b5 +0xef U+2229 +0xf0 U+2261 +0xf1 U+00b1 +0xf2 U+2265 +0xf3 U+2264 +0xf4 U+2320 +0xf5 U+2321 +0xf6 U+00f7 +0xf7 U+2248 +0xf8 U+00b0 +0xf9 U+2219 +0xfa U+00b7 +0xfb U+221a +0xfc U+207f +0xfd U+00b2 +0xfe U+25a0 +0xff U+00a0 diff --git a/jdk/make/tools/CharsetMapping/IBM861.map b/jdk/make/tools/CharsetMapping/IBM861.map new file mode 100644 index 00000000000..05a1f5b0bb9 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM861.map @@ -0,0 +1,257 @@ +#Generated from IBM861.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+00c7 +0x81 U+00fc +0x82 U+00e9 +0x83 U+00e2 +0x84 U+00e4 +0x85 U+00e0 +0x86 U+00e5 +0x87 U+00e7 +0x88 U+00ea +0x89 U+00eb +0x8a U+00e8 +0x8b U+00d0 +0x8c U+00f0 +0x8d U+00de +0x8e U+00c4 +0x8f U+00c5 +0x90 U+00c9 +0x91 U+00e6 +0x92 U+00c6 +0x93 U+00f4 +0x94 U+00f6 +0x95 U+00fe +0x96 U+00fb +0x97 U+00dd +0x98 U+00fd +0x99 U+00d6 +0x9a U+00dc +0x9b U+00f8 +0x9c U+00a3 +0x9d U+00d8 +0x9e U+20a7 +0x9f U+0192 +0xa0 U+00e1 +0xa1 U+00ed +0xa2 U+00f3 +0xa3 U+00fa +0xa4 U+00c1 +0xa5 U+00cd +0xa6 U+00d3 +0xa7 U+00da +0xa8 U+00bf +0xa9 U+2310 +0xaa U+00ac +0xab U+00bd +0xac U+00bc +0xad U+00a1 +0xae U+00ab +0xaf U+00bb +0xb0 U+2591 +0xb1 U+2592 +0xb2 U+2593 +0xb3 U+2502 +0xb4 U+2524 +0xb5 U+2561 +0xb6 U+2562 +0xb7 U+2556 +0xb8 U+2555 +0xb9 U+2563 +0xba U+2551 +0xbb U+2557 +0xbc U+255d +0xbd U+255c +0xbe U+255b +0xbf U+2510 +0xc0 U+2514 +0xc1 U+2534 +0xc2 U+252c +0xc3 U+251c +0xc4 U+2500 +0xc5 U+253c +0xc6 U+255e +0xc7 U+255f +0xc8 U+255a +0xc9 U+2554 +0xca U+2569 +0xcb U+2566 +0xcc U+2560 +0xcd U+2550 +0xce U+256c +0xcf U+2567 +0xd0 U+2568 +0xd1 U+2564 +0xd2 U+2565 +0xd3 U+2559 +0xd4 U+2558 +0xd5 U+2552 +0xd6 U+2553 +0xd7 U+256b +0xd8 U+256a +0xd9 U+2518 +0xda U+250c +0xdb U+2588 +0xdc U+2584 +0xdd U+258c +0xde U+2590 +0xdf U+2580 +0xe0 U+03b1 +0xe1 U+00df +0xe2 U+0393 +0xe3 U+03c0 +0xe4 U+03a3 +0xe5 U+03c3 +0xe6 U+00b5 +0xe7 U+03c4 +0xe8 U+03a6 +0xe9 U+0398 +0xea U+03a9 +0xeb U+03b4 +0xec U+221e +0xed U+03c6 +0xee U+03b5 +0xef U+2229 +0xf0 U+2261 +0xf1 U+00b1 +0xf2 U+2265 +0xf3 U+2264 +0xf4 U+2320 +0xf5 U+2321 +0xf6 U+00f7 +0xf7 U+2248 +0xf8 U+00b0 +0xf9 U+2219 +0xfa U+00b7 +0xfb U+221a +0xfc U+207f +0xfd U+00b2 +0xfe U+25a0 +0xff U+00a0 diff --git a/jdk/make/tools/CharsetMapping/IBM862.map b/jdk/make/tools/CharsetMapping/IBM862.map new file mode 100644 index 00000000000..de3c0d16b5a --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM862.map @@ -0,0 +1,257 @@ +#Generated from IBM862.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+05d0 +0x81 U+05d1 +0x82 U+05d2 +0x83 U+05d3 +0x84 U+05d4 +0x85 U+05d5 +0x86 U+05d6 +0x87 U+05d7 +0x88 U+05d8 +0x89 U+05d9 +0x8a U+05da +0x8b U+05db +0x8c U+05dc +0x8d U+05dd +0x8e U+05de +0x8f U+05df +0x90 U+05e0 +0x91 U+05e1 +0x92 U+05e2 +0x93 U+05e3 +0x94 U+05e4 +0x95 U+05e5 +0x96 U+05e6 +0x97 U+05e7 +0x98 U+05e8 +0x99 U+05e9 +0x9a U+05ea +0x9b U+00a2 +0x9c U+00a3 +0x9d U+00a5 +0x9e U+20a7 +0x9f U+0192 +0xa0 U+00e1 +0xa1 U+00ed +0xa2 U+00f3 +0xa3 U+00fa +0xa4 U+00f1 +0xa5 U+00d1 +0xa6 U+00aa +0xa7 U+00ba +0xa8 U+00bf +0xa9 U+2310 +0xaa U+00ac +0xab U+00bd +0xac U+00bc +0xad U+00a1 +0xae U+00ab +0xaf U+00bb +0xb0 U+2591 +0xb1 U+2592 +0xb2 U+2593 +0xb3 U+2502 +0xb4 U+2524 +0xb5 U+2561 +0xb6 U+2562 +0xb7 U+2556 +0xb8 U+2555 +0xb9 U+2563 +0xba U+2551 +0xbb U+2557 +0xbc U+255d +0xbd U+255c +0xbe U+255b +0xbf U+2510 +0xc0 U+2514 +0xc1 U+2534 +0xc2 U+252c +0xc3 U+251c +0xc4 U+2500 +0xc5 U+253c +0xc6 U+255e +0xc7 U+255f +0xc8 U+255a +0xc9 U+2554 +0xca U+2569 +0xcb U+2566 +0xcc U+2560 +0xcd U+2550 +0xce U+256c +0xcf U+2567 +0xd0 U+2568 +0xd1 U+2564 +0xd2 U+2565 +0xd3 U+2559 +0xd4 U+2558 +0xd5 U+2552 +0xd6 U+2553 +0xd7 U+256b +0xd8 U+256a +0xd9 U+2518 +0xda U+250c +0xdb U+2588 +0xdc U+2584 +0xdd U+258c +0xde U+2590 +0xdf U+2580 +0xe0 U+03b1 +0xe1 U+00df +0xe2 U+0393 +0xe3 U+03c0 +0xe4 U+03a3 +0xe5 U+03c3 +0xe6 U+00b5 +0xe7 U+03c4 +0xe8 U+03a6 +0xe9 U+0398 +0xea U+03a9 +0xeb U+03b4 +0xec U+221e +0xed U+03c6 +0xee U+03b5 +0xef U+2229 +0xf0 U+2261 +0xf1 U+00b1 +0xf2 U+2265 +0xf3 U+2264 +0xf4 U+2320 +0xf5 U+2321 +0xf6 U+00f7 +0xf7 U+2248 +0xf8 U+00b0 +0xf9 U+2219 +0xfa U+00b7 +0xfb U+221a +0xfc U+207f +0xfd U+00b2 +0xfe U+25a0 +0xff U+00a0 diff --git a/jdk/make/tools/CharsetMapping/IBM863.map b/jdk/make/tools/CharsetMapping/IBM863.map new file mode 100644 index 00000000000..e6bd5e77d80 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM863.map @@ -0,0 +1,257 @@ +#Generated from IBM863.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+00c7 +0x81 U+00fc +0x82 U+00e9 +0x83 U+00e2 +0x84 U+00c2 +0x85 U+00e0 +0x86 U+00b6 +0x87 U+00e7 +0x88 U+00ea +0x89 U+00eb +0x8a U+00e8 +0x8b U+00ef +0x8c U+00ee +0x8d U+2017 +0x8e U+00c0 +0x8f U+00a7 +0x90 U+00c9 +0x91 U+00c8 +0x92 U+00ca +0x93 U+00f4 +0x94 U+00cb +0x95 U+00cf +0x96 U+00fb +0x97 U+00f9 +0x98 U+00a4 +0x99 U+00d4 +0x9a U+00dc +0x9b U+00a2 +0x9c U+00a3 +0x9d U+00d9 +0x9e U+00db +0x9f U+0192 +0xa0 U+00a6 +0xa1 U+00b4 +0xa2 U+00f3 +0xa3 U+00fa +0xa4 U+00a8 +0xa5 U+00b8 +0xa6 U+00b3 +0xa7 U+00af +0xa8 U+00ce +0xa9 U+2310 +0xaa U+00ac +0xab U+00bd +0xac U+00bc +0xad U+00be +0xae U+00ab +0xaf U+00bb +0xb0 U+2591 +0xb1 U+2592 +0xb2 U+2593 +0xb3 U+2502 +0xb4 U+2524 +0xb5 U+2561 +0xb6 U+2562 +0xb7 U+2556 +0xb8 U+2555 +0xb9 U+2563 +0xba U+2551 +0xbb U+2557 +0xbc U+255d +0xbd U+255c +0xbe U+255b +0xbf U+2510 +0xc0 U+2514 +0xc1 U+2534 +0xc2 U+252c +0xc3 U+251c +0xc4 U+2500 +0xc5 U+253c +0xc6 U+255e +0xc7 U+255f +0xc8 U+255a +0xc9 U+2554 +0xca U+2569 +0xcb U+2566 +0xcc U+2560 +0xcd U+2550 +0xce U+256c +0xcf U+2567 +0xd0 U+2568 +0xd1 U+2564 +0xd2 U+2565 +0xd3 U+2559 +0xd4 U+2558 +0xd5 U+2552 +0xd6 U+2553 +0xd7 U+256b +0xd8 U+256a +0xd9 U+2518 +0xda U+250c +0xdb U+2588 +0xdc U+2584 +0xdd U+258c +0xde U+2590 +0xdf U+2580 +0xe0 U+03b1 +0xe1 U+00df +0xe2 U+0393 +0xe3 U+03c0 +0xe4 U+03a3 +0xe5 U+03c3 +0xe6 U+00b5 +0xe7 U+03c4 +0xe8 U+03a6 +0xe9 U+0398 +0xea U+03a9 +0xeb U+03b4 +0xec U+221e +0xed U+03c6 +0xee U+03b5 +0xef U+2229 +0xf0 U+2261 +0xf1 U+00b1 +0xf2 U+2265 +0xf3 U+2264 +0xf4 U+2320 +0xf5 U+2321 +0xf6 U+00f7 +0xf7 U+2248 +0xf8 U+00b0 +0xf9 U+2219 +0xfa U+00b7 +0xfb U+221a +0xfc U+207f +0xfd U+00b2 +0xfe U+25a0 +0xff U+00a0 diff --git a/jdk/make/tools/CharsetMapping/IBM864.map b/jdk/make/tools/CharsetMapping/IBM864.map new file mode 100644 index 00000000000..9ca27253c10 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM864.map @@ -0,0 +1,257 @@ +#Generated from IBM864.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+066a +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+00b0 +0x81 U+00b7 +0x82 U+2219 +0x83 U+221a +0x84 U+2592 +0x85 U+2500 +0x86 U+2502 +0x87 U+253c +0x88 U+2524 +0x89 U+252c +0x8a U+251c +0x8b U+2534 +0x8c U+2510 +0x8d U+250c +0x8e U+2514 +0x8f U+2518 +0x90 U+03b2 +0x91 U+221e +0x92 U+03c6 +0x93 U+00b1 +0x94 U+00bd +0x95 U+00bc +0x96 U+2248 +0x97 U+00ab +0x98 U+00bb +0x99 U+fef7 +0x9a U+fef8 +0x9b U+fffd +0x9c U+fffd +0x9d U+fefb +0x9e U+fefc +0x9f U+fffd +0xa0 U+00a0 +0xa1 U+00ad +0xa2 U+fe82 +0xa3 U+00a3 +0xa4 U+00a4 +0xa5 U+fe84 +0xa6 U+fffd +0xa7 U+fffd +0xa8 U+fe8e +0xa9 U+fe8f +0xaa U+fe95 +0xab U+fe99 +0xac U+060c +0xad U+fe9d +0xae U+fea1 +0xaf U+fea5 +0xb0 U+0660 +0xb1 U+0661 +0xb2 U+0662 +0xb3 U+0663 +0xb4 U+0664 +0xb5 U+0665 +0xb6 U+0666 +0xb7 U+0667 +0xb8 U+0668 +0xb9 U+0669 +0xba U+fed1 +0xbb U+061b +0xbc U+feb1 +0xbd U+feb5 +0xbe U+feb9 +0xbf U+061f +0xc0 U+00a2 +0xc1 U+fe80 +0xc2 U+fe81 +0xc3 U+fe83 +0xc4 U+fe85 +0xc5 U+feca +0xc6 U+fe8b +0xc7 U+fe8d +0xc8 U+fe91 +0xc9 U+fe93 +0xca U+fe97 +0xcb U+fe9b +0xcc U+fe9f +0xcd U+fea3 +0xce U+fea7 +0xcf U+fea9 +0xd0 U+feab +0xd1 U+fead +0xd2 U+feaf +0xd3 U+feb3 +0xd4 U+feb7 +0xd5 U+febb +0xd6 U+febf +0xd7 U+fec1 +0xd8 U+fec5 +0xd9 U+fecb +0xda U+fecf +0xdb U+00a6 +0xdc U+00ac +0xdd U+00f7 +0xde U+00d7 +0xdf U+fec9 +0xe0 U+0640 +0xe1 U+fed3 +0xe2 U+fed7 +0xe3 U+fedb +0xe4 U+fedf +0xe5 U+fee3 +0xe6 U+fee7 +0xe7 U+feeb +0xe8 U+feed +0xe9 U+feef +0xea U+fef3 +0xeb U+febd +0xec U+fecc +0xed U+fece +0xee U+fecd +0xef U+fee1 +0xf0 U+fe7d +0xf1 U+0651 +0xf2 U+fee5 +0xf3 U+fee9 +0xf4 U+feec +0xf5 U+fef0 +0xf6 U+fef2 +0xf7 U+fed0 +0xf8 U+fed5 +0xf9 U+fef5 +0xfa U+fef6 +0xfb U+fedd +0xfc U+fed9 +0xfd U+fef1 +0xfe U+25a0 +0xff U+fffd diff --git a/jdk/make/tools/CharsetMapping/IBM865.map b/jdk/make/tools/CharsetMapping/IBM865.map new file mode 100644 index 00000000000..7271013f0f5 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM865.map @@ -0,0 +1,257 @@ +#Generated from IBM865.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+00c7 +0x81 U+00fc +0x82 U+00e9 +0x83 U+00e2 +0x84 U+00e4 +0x85 U+00e0 +0x86 U+00e5 +0x87 U+00e7 +0x88 U+00ea +0x89 U+00eb +0x8a U+00e8 +0x8b U+00ef +0x8c U+00ee +0x8d U+00ec +0x8e U+00c4 +0x8f U+00c5 +0x90 U+00c9 +0x91 U+00e6 +0x92 U+00c6 +0x93 U+00f4 +0x94 U+00f6 +0x95 U+00f2 +0x96 U+00fb +0x97 U+00f9 +0x98 U+00ff +0x99 U+00d6 +0x9a U+00dc +0x9b U+00f8 +0x9c U+00a3 +0x9d U+00d8 +0x9e U+20a7 +0x9f U+0192 +0xa0 U+00e1 +0xa1 U+00ed +0xa2 U+00f3 +0xa3 U+00fa +0xa4 U+00f1 +0xa5 U+00d1 +0xa6 U+00aa +0xa7 U+00ba +0xa8 U+00bf +0xa9 U+2310 +0xaa U+00ac +0xab U+00bd +0xac U+00bc +0xad U+00a1 +0xae U+00ab +0xaf U+00a4 +0xb0 U+2591 +0xb1 U+2592 +0xb2 U+2593 +0xb3 U+2502 +0xb4 U+2524 +0xb5 U+2561 +0xb6 U+2562 +0xb7 U+2556 +0xb8 U+2555 +0xb9 U+2563 +0xba U+2551 +0xbb U+2557 +0xbc U+255d +0xbd U+255c +0xbe U+255b +0xbf U+2510 +0xc0 U+2514 +0xc1 U+2534 +0xc2 U+252c +0xc3 U+251c +0xc4 U+2500 +0xc5 U+253c +0xc6 U+255e +0xc7 U+255f +0xc8 U+255a +0xc9 U+2554 +0xca U+2569 +0xcb U+2566 +0xcc U+2560 +0xcd U+2550 +0xce U+256c +0xcf U+2567 +0xd0 U+2568 +0xd1 U+2564 +0xd2 U+2565 +0xd3 U+2559 +0xd4 U+2558 +0xd5 U+2552 +0xd6 U+2553 +0xd7 U+256b +0xd8 U+256a +0xd9 U+2518 +0xda U+250c +0xdb U+2588 +0xdc U+2584 +0xdd U+258c +0xde U+2590 +0xdf U+2580 +0xe0 U+03b1 +0xe1 U+00df +0xe2 U+0393 +0xe3 U+03c0 +0xe4 U+03a3 +0xe5 U+03c3 +0xe6 U+00b5 +0xe7 U+03c4 +0xe8 U+03a6 +0xe9 U+0398 +0xea U+03a9 +0xeb U+03b4 +0xec U+221e +0xed U+03c6 +0xee U+03b5 +0xef U+2229 +0xf0 U+2261 +0xf1 U+00b1 +0xf2 U+2265 +0xf3 U+2264 +0xf4 U+2320 +0xf5 U+2321 +0xf6 U+00f7 +0xf7 U+2248 +0xf8 U+00b0 +0xf9 U+2219 +0xfa U+00b7 +0xfb U+221a +0xfc U+207f +0xfd U+00b2 +0xfe U+25a0 +0xff U+00a0 diff --git a/jdk/make/tools/CharsetMapping/IBM866.map b/jdk/make/tools/CharsetMapping/IBM866.map new file mode 100644 index 00000000000..1e28b46764e --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM866.map @@ -0,0 +1,257 @@ +#Generated from IBM866.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+0410 +0x81 U+0411 +0x82 U+0412 +0x83 U+0413 +0x84 U+0414 +0x85 U+0415 +0x86 U+0416 +0x87 U+0417 +0x88 U+0418 +0x89 U+0419 +0x8a U+041a +0x8b U+041b +0x8c U+041c +0x8d U+041d +0x8e U+041e +0x8f U+041f +0x90 U+0420 +0x91 U+0421 +0x92 U+0422 +0x93 U+0423 +0x94 U+0424 +0x95 U+0425 +0x96 U+0426 +0x97 U+0427 +0x98 U+0428 +0x99 U+0429 +0x9a U+042a +0x9b U+042b +0x9c U+042c +0x9d U+042d +0x9e U+042e +0x9f U+042f +0xa0 U+0430 +0xa1 U+0431 +0xa2 U+0432 +0xa3 U+0433 +0xa4 U+0434 +0xa5 U+0435 +0xa6 U+0436 +0xa7 U+0437 +0xa8 U+0438 +0xa9 U+0439 +0xaa U+043a +0xab U+043b +0xac U+043c +0xad U+043d +0xae U+043e +0xaf U+043f +0xb0 U+2591 +0xb1 U+2592 +0xb2 U+2593 +0xb3 U+2502 +0xb4 U+2524 +0xb5 U+2561 +0xb6 U+2562 +0xb7 U+2556 +0xb8 U+2555 +0xb9 U+2563 +0xba U+2551 +0xbb U+2557 +0xbc U+255d +0xbd U+255c +0xbe U+255b +0xbf U+2510 +0xc0 U+2514 +0xc1 U+2534 +0xc2 U+252c +0xc3 U+251c +0xc4 U+2500 +0xc5 U+253c +0xc6 U+255e +0xc7 U+255f +0xc8 U+255a +0xc9 U+2554 +0xca U+2569 +0xcb U+2566 +0xcc U+2560 +0xcd U+2550 +0xce U+256c +0xcf U+2567 +0xd0 U+2568 +0xd1 U+2564 +0xd2 U+2565 +0xd3 U+2559 +0xd4 U+2558 +0xd5 U+2552 +0xd6 U+2553 +0xd7 U+256b +0xd8 U+256a +0xd9 U+2518 +0xda U+250c +0xdb U+2588 +0xdc U+2584 +0xdd U+258c +0xde U+2590 +0xdf U+2580 +0xe0 U+0440 +0xe1 U+0441 +0xe2 U+0442 +0xe3 U+0443 +0xe4 U+0444 +0xe5 U+0445 +0xe6 U+0446 +0xe7 U+0447 +0xe8 U+0448 +0xe9 U+0449 +0xea U+044a +0xeb U+044b +0xec U+044c +0xed U+044d +0xee U+044e +0xef U+044f +0xf0 U+0401 +0xf1 U+0451 +0xf2 U+0404 +0xf3 U+0454 +0xf4 U+0407 +0xf5 U+0457 +0xf6 U+040e +0xf7 U+045e +0xf8 U+00b0 +0xf9 U+2219 +0xfa U+00b7 +0xfb U+221a +0xfc U+2116 +0xfd U+00a4 +0xfe U+25a0 +0xff U+00a0 diff --git a/jdk/make/tools/CharsetMapping/IBM868.map b/jdk/make/tools/CharsetMapping/IBM868.map new file mode 100644 index 00000000000..cb5a1737c19 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM868.map @@ -0,0 +1,257 @@ +#Generated from IBM868.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+06f0 +0x81 U+06f1 +0x82 U+06f2 +0x83 U+06f3 +0x84 U+06f4 +0x85 U+06f5 +0x86 U+06f6 +0x87 U+06f7 +0x88 U+06f8 +0x89 U+06f9 +0x8a U+060c +0x8b U+061b +0x8c U+061f +0x8d U+fe81 +0x8e U+fe8d +0x8f U+fe8e +0x90 U+f8fb +0x91 U+fe8f +0x92 U+fe91 +0x93 U+fb56 +0x94 U+fb58 +0x95 U+fe93 +0x96 U+fe95 +0x97 U+fe97 +0x98 U+fb66 +0x99 U+fb68 +0x9a U+fe99 +0x9b U+fe9b +0x9c U+fe9d +0x9d U+fe9f +0x9e U+fb7a +0x9f U+fb7c +0xa0 U+fea1 +0xa1 U+fea3 +0xa2 U+fea5 +0xa3 U+fea7 +0xa4 U+fea9 +0xa5 U+fb88 +0xa6 U+feab +0xa7 U+fead +0xa8 U+fb8c +0xa9 U+feaf +0xaa U+fb8a +0xab U+feb1 +0xac U+feb3 +0xad U+feb5 +0xae U+00ab +0xaf U+00bb +0xb0 U+2591 +0xb1 U+2592 +0xb2 U+2593 +0xb3 U+2502 +0xb4 U+2524 +0xb5 U+feb7 +0xb6 U+feb9 +0xb7 U+febb +0xb8 U+febd +0xb9 U+2563 +0xba U+2551 +0xbb U+2557 +0xbc U+255d +0xbd U+febf +0xbe U+fec3 +0xbf U+2510 +0xc0 U+2514 +0xc1 U+2534 +0xc2 U+252c +0xc3 U+251c +0xc4 U+2500 +0xc5 U+253c +0xc6 U+fec7 +0xc7 U+fec9 +0xc8 U+255a +0xc9 U+2554 +0xca U+2569 +0xcb U+2566 +0xcc U+2560 +0xcd U+2550 +0xce U+256c +0xcf U+feca +0xd0 U+fecb +0xd1 U+fecc +0xd2 U+fecd +0xd3 U+fece +0xd4 U+fecf +0xd5 U+fed0 +0xd6 U+fed1 +0xd7 U+fed3 +0xd8 U+fed5 +0xd9 U+2518 +0xda U+250c +0xdb U+2588 +0xdc U+2584 +0xdd U+fed7 +0xde U+fb8e +0xdf U+2580 +0xe0 U+fedb +0xe1 U+fb92 +0xe2 U+fb94 +0xe3 U+fedd +0xe4 U+fedf +0xe5 U+fee0 +0xe6 U+fee1 +0xe7 U+fee3 +0xe8 U+fb9e +0xe9 U+fee5 +0xea U+fee7 +0xeb U+fe85 +0xec U+feed +0xed U+fba6 +0xee U+fba8 +0xef U+fba9 +0xf0 U+00ad +0xf1 U+fbaa +0xf2 U+fe80 +0xf3 U+fe89 +0xf4 U+fe8a +0xf5 U+fe8b +0xf6 U+fbfc +0xf7 U+fbfd +0xf8 U+fbfe +0xf9 U+fbb0 +0xfa U+fbae +0xfb U+fe7c +0xfc U+fe7d +0xfd U+fffd +0xfe U+25a0 +0xff U+00a0 diff --git a/jdk/make/tools/CharsetMapping/IBM869.map b/jdk/make/tools/CharsetMapping/IBM869.map new file mode 100644 index 00000000000..097967484f4 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM869.map @@ -0,0 +1,257 @@ +#Generated from IBM869.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+fffd +0x81 U+fffd +0x82 U+fffd +0x83 U+fffd +0x84 U+fffd +0x85 U+fffd +0x86 U+0386 +0x87 U+fffd +0x88 U+00b7 +0x89 U+00ac +0x8a U+00a6 +0x8b U+2018 +0x8c U+2019 +0x8d U+0388 +0x8e U+2015 +0x8f U+0389 +0x90 U+038a +0x91 U+03aa +0x92 U+038c +0x93 U+fffd +0x94 U+fffd +0x95 U+038e +0x96 U+03ab +0x97 U+00a9 +0x98 U+038f +0x99 U+00b2 +0x9a U+00b3 +0x9b U+03ac +0x9c U+00a3 +0x9d U+03ad +0x9e U+03ae +0x9f U+03af +0xa0 U+03ca +0xa1 U+0390 +0xa2 U+03cc +0xa3 U+03cd +0xa4 U+0391 +0xa5 U+0392 +0xa6 U+0393 +0xa7 U+0394 +0xa8 U+0395 +0xa9 U+0396 +0xaa U+0397 +0xab U+00bd +0xac U+0398 +0xad U+0399 +0xae U+00ab +0xaf U+00bb +0xb0 U+2591 +0xb1 U+2592 +0xb2 U+2593 +0xb3 U+2502 +0xb4 U+2524 +0xb5 U+039a +0xb6 U+039b +0xb7 U+039c +0xb8 U+039d +0xb9 U+2563 +0xba U+2551 +0xbb U+2557 +0xbc U+255d +0xbd U+039e +0xbe U+039f +0xbf U+2510 +0xc0 U+2514 +0xc1 U+2534 +0xc2 U+252c +0xc3 U+251c +0xc4 U+2500 +0xc5 U+253c +0xc6 U+03a0 +0xc7 U+03a1 +0xc8 U+255a +0xc9 U+2554 +0xca U+2569 +0xcb U+2566 +0xcc U+2560 +0xcd U+2550 +0xce U+256c +0xcf U+03a3 +0xd0 U+03a4 +0xd1 U+03a5 +0xd2 U+03a6 +0xd3 U+03a7 +0xd4 U+03a8 +0xd5 U+03a9 +0xd6 U+03b1 +0xd7 U+03b2 +0xd8 U+03b3 +0xd9 U+2518 +0xda U+250c +0xdb U+2588 +0xdc U+2584 +0xdd U+03b4 +0xde U+03b5 +0xdf U+2580 +0xe0 U+03b6 +0xe1 U+03b7 +0xe2 U+03b8 +0xe3 U+03b9 +0xe4 U+03ba +0xe5 U+03bb +0xe6 U+03bc +0xe7 U+03bd +0xe8 U+03be +0xe9 U+03bf +0xea U+03c0 +0xeb U+03c1 +0xec U+03c3 +0xed U+03c2 +0xee U+03c4 +0xef U+0384 +0xf0 U+00ad +0xf1 U+00b1 +0xf2 U+03c5 +0xf3 U+03c6 +0xf4 U+03c7 +0xf5 U+00a7 +0xf6 U+03c8 +0xf7 U+0385 +0xf8 U+00b0 +0xf9 U+00a8 +0xfa U+03c9 +0xfb U+03cb +0xfc U+03b0 +0xfd U+03ce +0xfe U+25a0 +0xff U+00a0 diff --git a/jdk/make/tools/CharsetMapping/IBM870.c2b b/jdk/make/tools/CharsetMapping/IBM870.c2b new file mode 100644 index 00000000000..6cb38028124 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM870.c2b @@ -0,0 +1 @@ +0x15 U+0085 diff --git a/jdk/make/tools/CharsetMapping/IBM870.map b/jdk/make/tools/CharsetMapping/IBM870.map new file mode 100644 index 00000000000..a6b1a2dd24c --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM870.map @@ -0,0 +1,257 @@ +#Generated from IBM870.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+009c +0x05 U+0009 +0x06 U+0086 +0x07 U+007f +0x08 U+0097 +0x09 U+008d +0x0a U+008e +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+009d +0x15 U+000a +0x16 U+0008 +0x17 U+0087 +0x18 U+0018 +0x19 U+0019 +0x1a U+0092 +0x1b U+008f +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0080 +0x21 U+0081 +0x22 U+0082 +0x23 U+0083 +0x24 U+0084 +0x25 U+000a +0x26 U+0017 +0x27 U+001b +0x28 U+0088 +0x29 U+0089 +0x2a U+008a +0x2b U+008b +0x2c U+008c +0x2d U+0005 +0x2e U+0006 +0x2f U+0007 +0x30 U+0090 +0x31 U+0091 +0x32 U+0016 +0x33 U+0093 +0x34 U+0094 +0x35 U+0095 +0x36 U+0096 +0x37 U+0004 +0x38 U+0098 +0x39 U+0099 +0x3a U+009a +0x3b U+009b +0x3c U+0014 +0x3d U+0015 +0x3e U+009e +0x3f U+001a +0x40 U+0020 +0x41 U+00a0 +0x42 U+00e2 +0x43 U+00e4 +0x44 U+0163 +0x45 U+00e1 +0x46 U+0103 +0x47 U+010d +0x48 U+00e7 +0x49 U+0107 +0x4a U+005b +0x4b U+002e +0x4c U+003c +0x4d U+0028 +0x4e U+002b +0x4f U+0021 +0x50 U+0026 +0x51 U+00e9 +0x52 U+0119 +0x53 U+00eb +0x54 U+016f +0x55 U+00ed +0x56 U+00ee +0x57 U+013e +0x58 U+013a +0x59 U+00df +0x5a U+005d +0x5b U+0024 +0x5c U+002a +0x5d U+0029 +0x5e U+003b +0x5f U+005e +0x60 U+002d +0x61 U+002f +0x62 U+00c2 +0x63 U+00c4 +0x64 U+02dd +0x65 U+00c1 +0x66 U+0102 +0x67 U+010c +0x68 U+00c7 +0x69 U+0106 +0x6a U+007c +0x6b U+002c +0x6c U+0025 +0x6d U+005f +0x6e U+003e +0x6f U+003f +0x70 U+02c7 +0x71 U+00c9 +0x72 U+0118 +0x73 U+00cb +0x74 U+016e +0x75 U+00cd +0x76 U+00ce +0x77 U+013d +0x78 U+0139 +0x79 U+0060 +0x7a U+003a +0x7b U+0023 +0x7c U+0040 +0x7d U+0027 +0x7e U+003d +0x7f U+0022 +0x80 U+02d8 +0x81 U+0061 +0x82 U+0062 +0x83 U+0063 +0x84 U+0064 +0x85 U+0065 +0x86 U+0066 +0x87 U+0067 +0x88 U+0068 +0x89 U+0069 +0x8a U+015b +0x8b U+0148 +0x8c U+0111 +0x8d U+00fd +0x8e U+0159 +0x8f U+015f +0x90 U+00b0 +0x91 U+006a +0x92 U+006b +0x93 U+006c +0x94 U+006d +0x95 U+006e +0x96 U+006f +0x97 U+0070 +0x98 U+0071 +0x99 U+0072 +0x9a U+0142 +0x9b U+0144 +0x9c U+0161 +0x9d U+00b8 +0x9e U+02db +0x9f U+00a4 +0xa0 U+0105 +0xa1 U+007e +0xa2 U+0073 +0xa3 U+0074 +0xa4 U+0075 +0xa5 U+0076 +0xa6 U+0077 +0xa7 U+0078 +0xa8 U+0079 +0xa9 U+007a +0xaa U+015a +0xab U+0147 +0xac U+0110 +0xad U+00dd +0xae U+0158 +0xaf U+015e +0xb0 U+02d9 +0xb1 U+0104 +0xb2 U+017c +0xb3 U+0162 +0xb4 U+017b +0xb5 U+00a7 +0xb6 U+017e +0xb7 U+017a +0xb8 U+017d +0xb9 U+0179 +0xba U+0141 +0xbb U+0143 +0xbc U+0160 +0xbd U+00a8 +0xbe U+00b4 +0xbf U+00d7 +0xc0 U+007b +0xc1 U+0041 +0xc2 U+0042 +0xc3 U+0043 +0xc4 U+0044 +0xc5 U+0045 +0xc6 U+0046 +0xc7 U+0047 +0xc8 U+0048 +0xc9 U+0049 +0xca U+00ad +0xcb U+00f4 +0xcc U+00f6 +0xcd U+0155 +0xce U+00f3 +0xcf U+0151 +0xd0 U+007d +0xd1 U+004a +0xd2 U+004b +0xd3 U+004c +0xd4 U+004d +0xd5 U+004e +0xd6 U+004f +0xd7 U+0050 +0xd8 U+0051 +0xd9 U+0052 +0xda U+011a +0xdb U+0171 +0xdc U+00fc +0xdd U+0165 +0xde U+00fa +0xdf U+011b +0xe0 U+005c +0xe1 U+00f7 +0xe2 U+0053 +0xe3 U+0054 +0xe4 U+0055 +0xe5 U+0056 +0xe6 U+0057 +0xe7 U+0058 +0xe8 U+0059 +0xe9 U+005a +0xea U+010f +0xeb U+00d4 +0xec U+00d6 +0xed U+0154 +0xee U+00d3 +0xef U+0150 +0xf0 U+0030 +0xf1 U+0031 +0xf2 U+0032 +0xf3 U+0033 +0xf4 U+0034 +0xf5 U+0035 +0xf6 U+0036 +0xf7 U+0037 +0xf8 U+0038 +0xf9 U+0039 +0xfa U+010e +0xfb U+0170 +0xfc U+00dc +0xfd U+0164 +0xfe U+00da +0xff U+009f diff --git a/jdk/make/tools/CharsetMapping/IBM870.nr b/jdk/make/tools/CharsetMapping/IBM870.nr new file mode 100644 index 00000000000..675451906d4 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM870.nr @@ -0,0 +1 @@ +0x25 U+000a diff --git a/jdk/make/tools/CharsetMapping/IBM871.c2b b/jdk/make/tools/CharsetMapping/IBM871.c2b new file mode 100644 index 00000000000..6cb38028124 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM871.c2b @@ -0,0 +1 @@ +0x15 U+0085 diff --git a/jdk/make/tools/CharsetMapping/IBM871.map b/jdk/make/tools/CharsetMapping/IBM871.map new file mode 100644 index 00000000000..0227f335d64 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM871.map @@ -0,0 +1,257 @@ +#Generated from IBM871.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+009c +0x05 U+0009 +0x06 U+0086 +0x07 U+007f +0x08 U+0097 +0x09 U+008d +0x0a U+008e +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+009d +0x15 U+000a +0x16 U+0008 +0x17 U+0087 +0x18 U+0018 +0x19 U+0019 +0x1a U+0092 +0x1b U+008f +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0080 +0x21 U+0081 +0x22 U+0082 +0x23 U+0083 +0x24 U+0084 +0x25 U+000a +0x26 U+0017 +0x27 U+001b +0x28 U+0088 +0x29 U+0089 +0x2a U+008a +0x2b U+008b +0x2c U+008c +0x2d U+0005 +0x2e U+0006 +0x2f U+0007 +0x30 U+0090 +0x31 U+0091 +0x32 U+0016 +0x33 U+0093 +0x34 U+0094 +0x35 U+0095 +0x36 U+0096 +0x37 U+0004 +0x38 U+0098 +0x39 U+0099 +0x3a U+009a +0x3b U+009b +0x3c U+0014 +0x3d U+0015 +0x3e U+009e +0x3f U+001a +0x40 U+0020 +0x41 U+00a0 +0x42 U+00e2 +0x43 U+00e4 +0x44 U+00e0 +0x45 U+00e1 +0x46 U+00e3 +0x47 U+00e5 +0x48 U+00e7 +0x49 U+00f1 +0x4a U+00de +0x4b U+002e +0x4c U+003c +0x4d U+0028 +0x4e U+002b +0x4f U+0021 +0x50 U+0026 +0x51 U+00e9 +0x52 U+00ea +0x53 U+00eb +0x54 U+00e8 +0x55 U+00ed +0x56 U+00ee +0x57 U+00ef +0x58 U+00ec +0x59 U+00df +0x5a U+00c6 +0x5b U+0024 +0x5c U+002a +0x5d U+0029 +0x5e U+003b +0x5f U+00d6 +0x60 U+002d +0x61 U+002f +0x62 U+00c2 +0x63 U+00c4 +0x64 U+00c0 +0x65 U+00c1 +0x66 U+00c3 +0x67 U+00c5 +0x68 U+00c7 +0x69 U+00d1 +0x6a U+00a6 +0x6b U+002c +0x6c U+0025 +0x6d U+005f +0x6e U+003e +0x6f U+003f +0x70 U+00f8 +0x71 U+00c9 +0x72 U+00ca +0x73 U+00cb +0x74 U+00c8 +0x75 U+00cd +0x76 U+00ce +0x77 U+00cf +0x78 U+00cc +0x79 U+00f0 +0x7a U+003a +0x7b U+0023 +0x7c U+00d0 +0x7d U+0027 +0x7e U+003d +0x7f U+0022 +0x80 U+00d8 +0x81 U+0061 +0x82 U+0062 +0x83 U+0063 +0x84 U+0064 +0x85 U+0065 +0x86 U+0066 +0x87 U+0067 +0x88 U+0068 +0x89 U+0069 +0x8a U+00ab +0x8b U+00bb +0x8c U+0060 +0x8d U+00fd +0x8e U+007b +0x8f U+00b1 +0x90 U+00b0 +0x91 U+006a +0x92 U+006b +0x93 U+006c +0x94 U+006d +0x95 U+006e +0x96 U+006f +0x97 U+0070 +0x98 U+0071 +0x99 U+0072 +0x9a U+00aa +0x9b U+00ba +0x9c U+007d +0x9d U+00b8 +0x9e U+005d +0x9f U+00a4 +0xa0 U+00b5 +0xa1 U+00f6 +0xa2 U+0073 +0xa3 U+0074 +0xa4 U+0075 +0xa5 U+0076 +0xa6 U+0077 +0xa7 U+0078 +0xa8 U+0079 +0xa9 U+007a +0xaa U+00a1 +0xab U+00bf +0xac U+0040 +0xad U+00dd +0xae U+005b +0xaf U+00ae +0xb0 U+00a2 +0xb1 U+00a3 +0xb2 U+00a5 +0xb3 U+00b7 +0xb4 U+00a9 +0xb5 U+00a7 +0xb6 U+00b6 +0xb7 U+00bc +0xb8 U+00bd +0xb9 U+00be +0xba U+00ac +0xbb U+007c +0xbc U+00af +0xbd U+00a8 +0xbe U+005c +0xbf U+00d7 +0xc0 U+00fe +0xc1 U+0041 +0xc2 U+0042 +0xc3 U+0043 +0xc4 U+0044 +0xc5 U+0045 +0xc6 U+0046 +0xc7 U+0047 +0xc8 U+0048 +0xc9 U+0049 +0xca U+00ad +0xcb U+00f4 +0xcc U+007e +0xcd U+00f2 +0xce U+00f3 +0xcf U+00f5 +0xd0 U+00e6 +0xd1 U+004a +0xd2 U+004b +0xd3 U+004c +0xd4 U+004d +0xd5 U+004e +0xd6 U+004f +0xd7 U+0050 +0xd8 U+0051 +0xd9 U+0052 +0xda U+00b9 +0xdb U+00fb +0xdc U+00fc +0xdd U+00f9 +0xde U+00fa +0xdf U+00ff +0xe0 U+00b4 +0xe1 U+00f7 +0xe2 U+0053 +0xe3 U+0054 +0xe4 U+0055 +0xe5 U+0056 +0xe6 U+0057 +0xe7 U+0058 +0xe8 U+0059 +0xe9 U+005a +0xea U+00b2 +0xeb U+00d4 +0xec U+005e +0xed U+00d2 +0xee U+00d3 +0xef U+00d5 +0xf0 U+0030 +0xf1 U+0031 +0xf2 U+0032 +0xf3 U+0033 +0xf4 U+0034 +0xf5 U+0035 +0xf6 U+0036 +0xf7 U+0037 +0xf8 U+0038 +0xf9 U+0039 +0xfa U+00b3 +0xfb U+00db +0xfc U+00dc +0xfd U+00d9 +0xfe U+00da +0xff U+009f diff --git a/jdk/make/tools/CharsetMapping/IBM871.nr b/jdk/make/tools/CharsetMapping/IBM871.nr new file mode 100644 index 00000000000..675451906d4 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM871.nr @@ -0,0 +1 @@ +0x25 U+000a diff --git a/jdk/make/tools/CharsetMapping/IBM874.map b/jdk/make/tools/CharsetMapping/IBM874.map new file mode 100644 index 00000000000..403e9ba70f5 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM874.map @@ -0,0 +1,257 @@ +#Generated from IBM874.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+20ac +0x81 U+fffd +0x82 U+fffd +0x83 U+fffd +0x84 U+fffd +0x85 U+fffd +0x86 U+fffd +0x87 U+fffd +0x88 U+fffd +0x89 U+fffd +0x8a U+fffd +0x8b U+fffd +0x8c U+fffd +0x8d U+fffd +0x8e U+fffd +0x8f U+fffd +0x90 U+fffd +0x91 U+fffd +0x92 U+fffd +0x93 U+fffd +0x94 U+fffd +0x95 U+fffd +0x96 U+fffd +0x97 U+fffd +0x98 U+fffd +0x99 U+fffd +0x9a U+fffd +0x9b U+fffd +0x9c U+fffd +0x9d U+fffd +0x9e U+fffd +0x9f U+fffd +0xa0 U+0e48 +0xa1 U+0e01 +0xa2 U+0e02 +0xa3 U+0e03 +0xa4 U+0e04 +0xa5 U+0e05 +0xa6 U+0e06 +0xa7 U+0e07 +0xa8 U+0e08 +0xa9 U+0e09 +0xaa U+0e0a +0xab U+0e0b +0xac U+0e0c +0xad U+0e0d +0xae U+0e0e +0xaf U+0e0f +0xb0 U+0e10 +0xb1 U+0e11 +0xb2 U+0e12 +0xb3 U+0e13 +0xb4 U+0e14 +0xb5 U+0e15 +0xb6 U+0e16 +0xb7 U+0e17 +0xb8 U+0e18 +0xb9 U+0e19 +0xba U+0e1a +0xbb U+0e1b +0xbc U+0e1c +0xbd U+0e1d +0xbe U+0e1e +0xbf U+0e1f +0xc0 U+0e20 +0xc1 U+0e21 +0xc2 U+0e22 +0xc3 U+0e23 +0xc4 U+0e24 +0xc5 U+0e25 +0xc6 U+0e26 +0xc7 U+0e27 +0xc8 U+0e28 +0xc9 U+0e29 +0xca U+0e2a +0xcb U+0e2b +0xcc U+0e2c +0xcd U+0e2d +0xce U+0e2e +0xcf U+0e2f +0xd0 U+0e30 +0xd1 U+0e31 +0xd2 U+0e32 +0xd3 U+0e33 +0xd4 U+0e34 +0xd5 U+0e35 +0xd6 U+0e36 +0xd7 U+0e37 +0xd8 U+0e38 +0xd9 U+0e39 +0xda U+0e3a +0xdb U+0e49 +0xdc U+0e4a +0xdd U+0e4b +0xde U+0e4c +0xdf U+0e3f +0xe0 U+0e40 +0xe1 U+0e41 +0xe2 U+0e42 +0xe3 U+0e43 +0xe4 U+0e44 +0xe5 U+0e45 +0xe6 U+0e46 +0xe7 U+0e47 +0xe8 U+0e48 +0xe9 U+0e49 +0xea U+0e4a +0xeb U+0e4b +0xec U+0e4c +0xed U+0e4d +0xee U+0e4e +0xef U+0e4f +0xf0 U+0e50 +0xf1 U+0e51 +0xf2 U+0e52 +0xf3 U+0e53 +0xf4 U+0e54 +0xf5 U+0e55 +0xf6 U+0e56 +0xf7 U+0e57 +0xf8 U+0e58 +0xf9 U+0e59 +0xfa U+0e5a +0xfb U+0e5b +0xfc U+00a2 +0xfd U+00ac +0xfe U+00a6 +0xff U+00a0 diff --git a/jdk/make/tools/CharsetMapping/IBM874.nr b/jdk/make/tools/CharsetMapping/IBM874.nr new file mode 100644 index 00000000000..88afffb6f22 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM874.nr @@ -0,0 +1,5 @@ +0xa0 U+0e48 +0xdb U+0e49 +0xdc U+0e4a +0xdd U+0e4b +0xde U+0e4c diff --git a/jdk/make/tools/CharsetMapping/IBM875.c2b b/jdk/make/tools/CharsetMapping/IBM875.c2b new file mode 100644 index 00000000000..6cb38028124 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM875.c2b @@ -0,0 +1 @@ +0x15 U+0085 diff --git a/jdk/make/tools/CharsetMapping/IBM875.map b/jdk/make/tools/CharsetMapping/IBM875.map new file mode 100644 index 00000000000..35f7d5a1a04 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM875.map @@ -0,0 +1,257 @@ +#Generated from IBM875.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+009c +0x05 U+0009 +0x06 U+0086 +0x07 U+007f +0x08 U+0097 +0x09 U+008d +0x0a U+008e +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+009d +0x15 U+000a +0x16 U+0008 +0x17 U+0087 +0x18 U+0018 +0x19 U+0019 +0x1a U+0092 +0x1b U+008f +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0080 +0x21 U+0081 +0x22 U+0082 +0x23 U+0083 +0x24 U+0084 +0x25 U+000a +0x26 U+0017 +0x27 U+001b +0x28 U+0088 +0x29 U+0089 +0x2a U+008a +0x2b U+008b +0x2c U+008c +0x2d U+0005 +0x2e U+0006 +0x2f U+0007 +0x30 U+0090 +0x31 U+0091 +0x32 U+0016 +0x33 U+0093 +0x34 U+0094 +0x35 U+0095 +0x36 U+0096 +0x37 U+0004 +0x38 U+0098 +0x39 U+0099 +0x3a U+009a +0x3b U+009b +0x3c U+0014 +0x3d U+0015 +0x3e U+009e +0x3f U+001a +0x40 U+0020 +0x41 U+0391 +0x42 U+0392 +0x43 U+0393 +0x44 U+0394 +0x45 U+0395 +0x46 U+0396 +0x47 U+0397 +0x48 U+0398 +0x49 U+0399 +0x4a U+005b +0x4b U+002e +0x4c U+003c +0x4d U+0028 +0x4e U+002b +0x4f U+0021 +0x50 U+0026 +0x51 U+039a +0x52 U+039b +0x53 U+039c +0x54 U+039d +0x55 U+039e +0x56 U+039f +0x57 U+03a0 +0x58 U+03a1 +0x59 U+03a3 +0x5a U+005d +0x5b U+0024 +0x5c U+002a +0x5d U+0029 +0x5e U+003b +0x5f U+005e +0x60 U+002d +0x61 U+002f +0x62 U+03a4 +0x63 U+03a5 +0x64 U+03a6 +0x65 U+03a7 +0x66 U+03a8 +0x67 U+03a9 +0x68 U+03aa +0x69 U+03ab +0x6a U+007c +0x6b U+002c +0x6c U+0025 +0x6d U+005f +0x6e U+003e +0x6f U+003f +0x70 U+00a8 +0x71 U+0386 +0x72 U+0388 +0x73 U+0389 +0x74 U+00a0 +0x75 U+038a +0x76 U+038c +0x77 U+038e +0x78 U+038f +0x79 U+0060 +0x7a U+003a +0x7b U+0023 +0x7c U+0040 +0x7d U+0027 +0x7e U+003d +0x7f U+0022 +0x80 U+0385 +0x81 U+0061 +0x82 U+0062 +0x83 U+0063 +0x84 U+0064 +0x85 U+0065 +0x86 U+0066 +0x87 U+0067 +0x88 U+0068 +0x89 U+0069 +0x8a U+03b1 +0x8b U+03b2 +0x8c U+03b3 +0x8d U+03b4 +0x8e U+03b5 +0x8f U+03b6 +0x90 U+00b0 +0x91 U+006a +0x92 U+006b +0x93 U+006c +0x94 U+006d +0x95 U+006e +0x96 U+006f +0x97 U+0070 +0x98 U+0071 +0x99 U+0072 +0x9a U+03b7 +0x9b U+03b8 +0x9c U+03b9 +0x9d U+03ba +0x9e U+03bb +0x9f U+03bc +0xa0 U+00b4 +0xa1 U+007e +0xa2 U+0073 +0xa3 U+0074 +0xa4 U+0075 +0xa5 U+0076 +0xa6 U+0077 +0xa7 U+0078 +0xa8 U+0079 +0xa9 U+007a +0xaa U+03bd +0xab U+03be +0xac U+03bf +0xad U+03c0 +0xae U+03c1 +0xaf U+03c3 +0xb0 U+00a3 +0xb1 U+03ac +0xb2 U+03ad +0xb3 U+03ae +0xb4 U+03ca +0xb5 U+03af +0xb6 U+03cc +0xb7 U+03cd +0xb8 U+03cb +0xb9 U+03ce +0xba U+03c2 +0xbb U+03c4 +0xbc U+03c5 +0xbd U+03c6 +0xbe U+03c7 +0xbf U+03c8 +0xc0 U+007b +0xc1 U+0041 +0xc2 U+0042 +0xc3 U+0043 +0xc4 U+0044 +0xc5 U+0045 +0xc6 U+0046 +0xc7 U+0047 +0xc8 U+0048 +0xc9 U+0049 +0xca U+00ad +0xcb U+03c9 +0xcc U+0390 +0xcd U+03b0 +0xce U+2018 +0xcf U+2015 +0xd0 U+007d +0xd1 U+004a +0xd2 U+004b +0xd3 U+004c +0xd4 U+004d +0xd5 U+004e +0xd6 U+004f +0xd7 U+0050 +0xd8 U+0051 +0xd9 U+0052 +0xda U+00b1 +0xdb U+00bd +0xdc U+fffd +0xdd U+0387 +0xde U+2019 +0xdf U+00a6 +0xe0 U+005c +0xe1 U+fffd +0xe2 U+0053 +0xe3 U+0054 +0xe4 U+0055 +0xe5 U+0056 +0xe6 U+0057 +0xe7 U+0058 +0xe8 U+0059 +0xe9 U+005a +0xea U+00b2 +0xeb U+00a7 +0xec U+fffd +0xed U+fffd +0xee U+00ab +0xef U+00ac +0xf0 U+0030 +0xf1 U+0031 +0xf2 U+0032 +0xf3 U+0033 +0xf4 U+0034 +0xf5 U+0035 +0xf6 U+0036 +0xf7 U+0037 +0xf8 U+0038 +0xf9 U+0039 +0xfa U+00b3 +0xfb U+00a9 +0xfc U+fffd +0xfd U+fffd +0xfe U+00bb +0xff U+009f diff --git a/jdk/make/tools/CharsetMapping/IBM875.nr b/jdk/make/tools/CharsetMapping/IBM875.nr new file mode 100644 index 00000000000..675451906d4 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM875.nr @@ -0,0 +1 @@ +0x25 U+000a diff --git a/jdk/make/tools/CharsetMapping/IBM918.c2b b/jdk/make/tools/CharsetMapping/IBM918.c2b new file mode 100644 index 00000000000..6cb38028124 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM918.c2b @@ -0,0 +1 @@ +0x15 U+0085 diff --git a/jdk/make/tools/CharsetMapping/IBM918.map b/jdk/make/tools/CharsetMapping/IBM918.map new file mode 100644 index 00000000000..23739314781 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM918.map @@ -0,0 +1,257 @@ +#Generated from IBM918.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+009c +0x05 U+0009 +0x06 U+0086 +0x07 U+007f +0x08 U+0097 +0x09 U+008d +0x0a U+008e +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+009d +0x15 U+000a +0x16 U+0008 +0x17 U+0087 +0x18 U+0018 +0x19 U+0019 +0x1a U+0092 +0x1b U+008f +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0080 +0x21 U+0081 +0x22 U+0082 +0x23 U+0083 +0x24 U+0084 +0x25 U+000a +0x26 U+0017 +0x27 U+001b +0x28 U+0088 +0x29 U+0089 +0x2a U+008a +0x2b U+008b +0x2c U+008c +0x2d U+0005 +0x2e U+0006 +0x2f U+0007 +0x30 U+0090 +0x31 U+0091 +0x32 U+0016 +0x33 U+0093 +0x34 U+0094 +0x35 U+0095 +0x36 U+0096 +0x37 U+0004 +0x38 U+0098 +0x39 U+0099 +0x3a U+009a +0x3b U+009b +0x3c U+0014 +0x3d U+0015 +0x3e U+009e +0x3f U+001a +0x40 U+0020 +0x41 U+00a0 +0x42 U+060c +0x43 U+061b +0x44 U+061f +0x45 U+fe81 +0x46 U+fe8d +0x47 U+fe8e +0x48 U+f8fb +0x49 U+fe8f +0x4a U+005b +0x4b U+002e +0x4c U+003c +0x4d U+0028 +0x4e U+002b +0x4f U+0021 +0x50 U+0026 +0x51 U+fe91 +0x52 U+fb56 +0x53 U+fb58 +0x54 U+fe93 +0x55 U+fe95 +0x56 U+fe97 +0x57 U+fb66 +0x58 U+fb68 +0x59 U+fe99 +0x5a U+005d +0x5b U+0024 +0x5c U+002a +0x5d U+0029 +0x5e U+003b +0x5f U+005e +0x60 U+002d +0x61 U+002f +0x62 U+fe9b +0x63 U+fe9d +0x64 U+fe9f +0x65 U+fb7a +0x66 U+fb7c +0x67 U+fea1 +0x68 U+fea3 +0x69 U+fea5 +0x6a U+0060 +0x6b U+002c +0x6c U+0025 +0x6d U+005f +0x6e U+003e +0x6f U+003f +0x70 U+06f0 +0x71 U+06f1 +0x72 U+06f2 +0x73 U+06f3 +0x74 U+06f4 +0x75 U+06f5 +0x76 U+06f6 +0x77 U+06f7 +0x78 U+06f8 +0x79 U+06f9 +0x7a U+003a +0x7b U+0023 +0x7c U+0040 +0x7d U+0027 +0x7e U+003d +0x7f U+0022 +0x80 U+fea7 +0x81 U+0061 +0x82 U+0062 +0x83 U+0063 +0x84 U+0064 +0x85 U+0065 +0x86 U+0066 +0x87 U+0067 +0x88 U+0068 +0x89 U+0069 +0x8a U+fea9 +0x8b U+fb88 +0x8c U+feab +0x8d U+fead +0x8e U+fb8c +0x8f U+feaf +0x90 U+fb8a +0x91 U+006a +0x92 U+006b +0x93 U+006c +0x94 U+006d +0x95 U+006e +0x96 U+006f +0x97 U+0070 +0x98 U+0071 +0x99 U+0072 +0x9a U+feb1 +0x9b U+feb3 +0x9c U+feb5 +0x9d U+feb7 +0x9e U+feb9 +0x9f U+febb +0xa0 U+febd +0xa1 U+007e +0xa2 U+0073 +0xa3 U+0074 +0xa4 U+0075 +0xa5 U+0076 +0xa6 U+0077 +0xa7 U+0078 +0xa8 U+0079 +0xa9 U+007a +0xaa U+febf +0xab U+fec3 +0xac U+fec7 +0xad U+fec9 +0xae U+feca +0xaf U+fecb +0xb0 U+fecc +0xb1 U+fecd +0xb2 U+fece +0xb3 U+fecf +0xb4 U+fed0 +0xb5 U+fed1 +0xb6 U+fed3 +0xb7 U+fed5 +0xb8 U+fed7 +0xb9 U+fb8e +0xba U+fedb +0xbb U+007c +0xbc U+fb92 +0xbd U+fb94 +0xbe U+fedd +0xbf U+fedf +0xc0 U+007b +0xc1 U+0041 +0xc2 U+0042 +0xc3 U+0043 +0xc4 U+0044 +0xc5 U+0045 +0xc6 U+0046 +0xc7 U+0047 +0xc8 U+0048 +0xc9 U+0049 +0xca U+00ad +0xcb U+fee0 +0xcc U+fee1 +0xcd U+fee3 +0xce U+fb9e +0xcf U+fee5 +0xd0 U+007d +0xd1 U+004a +0xd2 U+004b +0xd3 U+004c +0xd4 U+004d +0xd5 U+004e +0xd6 U+004f +0xd7 U+0050 +0xd8 U+0051 +0xd9 U+0052 +0xda U+fee7 +0xdb U+fe85 +0xdc U+feed +0xdd U+fba6 +0xde U+fba8 +0xdf U+fba9 +0xe0 U+005c +0xe1 U+fbaa +0xe2 U+0053 +0xe3 U+0054 +0xe4 U+0055 +0xe5 U+0056 +0xe6 U+0057 +0xe7 U+0058 +0xe8 U+0059 +0xe9 U+005a +0xea U+fe80 +0xeb U+fe89 +0xec U+fe8a +0xed U+fe8b +0xee U+fbfc +0xef U+fbfd +0xf0 U+0030 +0xf1 U+0031 +0xf2 U+0032 +0xf3 U+0033 +0xf4 U+0034 +0xf5 U+0035 +0xf6 U+0036 +0xf7 U+0037 +0xf8 U+0038 +0xf9 U+0039 +0xfa U+fbfe +0xfb U+fbb0 +0xfc U+fbae +0xfd U+fe7c +0xfe U+fe7d +0xff U+009f diff --git a/jdk/make/tools/CharsetMapping/IBM918.nr b/jdk/make/tools/CharsetMapping/IBM918.nr new file mode 100644 index 00000000000..675451906d4 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM918.nr @@ -0,0 +1 @@ +0x25 U+000a diff --git a/jdk/make/tools/CharsetMapping/IBM921.map b/jdk/make/tools/CharsetMapping/IBM921.map new file mode 100644 index 00000000000..48487754d94 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM921.map @@ -0,0 +1,257 @@ +#Generated from IBM921.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+0080 +0x81 U+0081 +0x82 U+0082 +0x83 U+0083 +0x84 U+0084 +0x85 U+0085 +0x86 U+0086 +0x87 U+0087 +0x88 U+0088 +0x89 U+0089 +0x8a U+008a +0x8b U+008b +0x8c U+008c +0x8d U+008d +0x8e U+008e +0x8f U+008f +0x90 U+0090 +0x91 U+0091 +0x92 U+0092 +0x93 U+0093 +0x94 U+0094 +0x95 U+0095 +0x96 U+0096 +0x97 U+0097 +0x98 U+0098 +0x99 U+0099 +0x9a U+009a +0x9b U+009b +0x9c U+009c +0x9d U+009d +0x9e U+009e +0x9f U+009f +0xa0 U+00a0 +0xa1 U+201d +0xa2 U+00a2 +0xa3 U+00a3 +0xa4 U+00a4 +0xa5 U+201e +0xa6 U+00a6 +0xa7 U+00a7 +0xa8 U+00d8 +0xa9 U+00a9 +0xaa U+0156 +0xab U+00ab +0xac U+00ac +0xad U+00ad +0xae U+00ae +0xaf U+00c6 +0xb0 U+00b0 +0xb1 U+00b1 +0xb2 U+00b2 +0xb3 U+00b3 +0xb4 U+201c +0xb5 U+00b5 +0xb6 U+00b6 +0xb7 U+00b7 +0xb8 U+00f8 +0xb9 U+00b9 +0xba U+0157 +0xbb U+00bb +0xbc U+00bc +0xbd U+00bd +0xbe U+00be +0xbf U+00e6 +0xc0 U+0104 +0xc1 U+012e +0xc2 U+0100 +0xc3 U+0106 +0xc4 U+00c4 +0xc5 U+00c5 +0xc6 U+0118 +0xc7 U+0112 +0xc8 U+010c +0xc9 U+00c9 +0xca U+0179 +0xcb U+0116 +0xcc U+0122 +0xcd U+0136 +0xce U+012a +0xcf U+013b +0xd0 U+0160 +0xd1 U+0143 +0xd2 U+0145 +0xd3 U+00d3 +0xd4 U+014c +0xd5 U+00d5 +0xd6 U+00d6 +0xd7 U+00d7 +0xd8 U+0172 +0xd9 U+0141 +0xda U+015a +0xdb U+016a +0xdc U+00dc +0xdd U+017b +0xde U+017d +0xdf U+00df +0xe0 U+0105 +0xe1 U+012f +0xe2 U+0101 +0xe3 U+0107 +0xe4 U+00e4 +0xe5 U+00e5 +0xe6 U+0119 +0xe7 U+0113 +0xe8 U+010d +0xe9 U+00e9 +0xea U+017a +0xeb U+0117 +0xec U+0123 +0xed U+0137 +0xee U+012b +0xef U+013c +0xf0 U+0161 +0xf1 U+0144 +0xf2 U+0146 +0xf3 U+00f3 +0xf4 U+014d +0xf5 U+00f5 +0xf6 U+00f6 +0xf7 U+00f7 +0xf8 U+0173 +0xf9 U+0142 +0xfa U+015b +0xfb U+016b +0xfc U+00fc +0xfd U+017c +0xfe U+017e +0xff U+2019 diff --git a/jdk/make/tools/CharsetMapping/IBM922.map b/jdk/make/tools/CharsetMapping/IBM922.map new file mode 100644 index 00000000000..bda95197706 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/IBM922.map @@ -0,0 +1,257 @@ +#Generated from IBM922.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+0080 +0x81 U+0081 +0x82 U+0082 +0x83 U+0083 +0x84 U+0084 +0x85 U+0085 +0x86 U+0086 +0x87 U+0087 +0x88 U+0088 +0x89 U+0089 +0x8a U+008a +0x8b U+008b +0x8c U+008c +0x8d U+008d +0x8e U+008e +0x8f U+008f +0x90 U+0090 +0x91 U+0091 +0x92 U+0092 +0x93 U+0093 +0x94 U+0094 +0x95 U+0095 +0x96 U+0096 +0x97 U+0097 +0x98 U+0098 +0x99 U+0099 +0x9a U+009a +0x9b U+009b +0x9c U+009c +0x9d U+009d +0x9e U+009e +0x9f U+009f +0xa0 U+00a0 +0xa1 U+00a1 +0xa2 U+00a2 +0xa3 U+00a3 +0xa4 U+00a4 +0xa5 U+00a5 +0xa6 U+00a6 +0xa7 U+00a7 +0xa8 U+00a8 +0xa9 U+00a9 +0xaa U+00aa +0xab U+00ab +0xac U+00ac +0xad U+00ad +0xae U+00ae +0xaf U+203e +0xb0 U+00b0 +0xb1 U+00b1 +0xb2 U+00b2 +0xb3 U+00b3 +0xb4 U+00b4 +0xb5 U+00b5 +0xb6 U+00b6 +0xb7 U+00b7 +0xb8 U+00b8 +0xb9 U+00b9 +0xba U+00ba +0xbb U+00bb +0xbc U+00bc +0xbd U+00bd +0xbe U+00be +0xbf U+00bf +0xc0 U+00c0 +0xc1 U+00c1 +0xc2 U+00c2 +0xc3 U+00c3 +0xc4 U+00c4 +0xc5 U+00c5 +0xc6 U+00c6 +0xc7 U+00c7 +0xc8 U+00c8 +0xc9 U+00c9 +0xca U+00ca +0xcb U+00cb +0xcc U+00cc +0xcd U+00cd +0xce U+00ce +0xcf U+00cf +0xd0 U+0160 +0xd1 U+00d1 +0xd2 U+00d2 +0xd3 U+00d3 +0xd4 U+00d4 +0xd5 U+00d5 +0xd6 U+00d6 +0xd7 U+00d7 +0xd8 U+00d8 +0xd9 U+00d9 +0xda U+00da +0xdb U+00db +0xdc U+00dc +0xdd U+00dd +0xde U+017d +0xdf U+00df +0xe0 U+00e0 +0xe1 U+00e1 +0xe2 U+00e2 +0xe3 U+00e3 +0xe4 U+00e4 +0xe5 U+00e5 +0xe6 U+00e6 +0xe7 U+00e7 +0xe8 U+00e8 +0xe9 U+00e9 +0xea U+00ea +0xeb U+00eb +0xec U+00ec +0xed U+00ed +0xee U+00ee +0xef U+00ef +0xf0 U+0161 +0xf1 U+00f1 +0xf2 U+00f2 +0xf3 U+00f3 +0xf4 U+00f4 +0xf5 U+00f5 +0xf6 U+00f6 +0xf7 U+00f7 +0xf8 U+00f8 +0xf9 U+00f9 +0xfa U+00fa +0xfb U+00fb +0xfc U+00fc +0xfd U+00fd +0xfe U+017e +0xff U+00ff diff --git a/jdk/make/tools/CharsetMapping/ISO_8859_11.map b/jdk/make/tools/CharsetMapping/ISO_8859_11.map new file mode 100644 index 00000000000..67f75d851cf --- /dev/null +++ b/jdk/make/tools/CharsetMapping/ISO_8859_11.map @@ -0,0 +1,257 @@ +#Generated from ISO_8859_11.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+0080 +0x81 U+0081 +0x82 U+0082 +0x83 U+0083 +0x84 U+0084 +0x85 U+0085 +0x86 U+0086 +0x87 U+0087 +0x88 U+0088 +0x89 U+0089 +0x8a U+008a +0x8b U+008b +0x8c U+008c +0x8d U+008d +0x8e U+008e +0x8f U+008f +0x90 U+0090 +0x91 U+0091 +0x92 U+0092 +0x93 U+0093 +0x94 U+0094 +0x95 U+0095 +0x96 U+0096 +0x97 U+0097 +0x98 U+0098 +0x99 U+0099 +0x9a U+009a +0x9b U+009b +0x9c U+009c +0x9d U+009d +0x9e U+009e +0x9f U+009f +0xa0 U+00a0 +0xa1 U+0e01 +0xa2 U+0e02 +0xa3 U+0e03 +0xa4 U+0e04 +0xa5 U+0e05 +0xa6 U+0e06 +0xa7 U+0e07 +0xa8 U+0e08 +0xa9 U+0e09 +0xaa U+0e0a +0xab U+0e0b +0xac U+0e0c +0xad U+0e0d +0xae U+0e0e +0xaf U+0e0f +0xb0 U+0e10 +0xb1 U+0e11 +0xb2 U+0e12 +0xb3 U+0e13 +0xb4 U+0e14 +0xb5 U+0e15 +0xb6 U+0e16 +0xb7 U+0e17 +0xb8 U+0e18 +0xb9 U+0e19 +0xba U+0e1a +0xbb U+0e1b +0xbc U+0e1c +0xbd U+0e1d +0xbe U+0e1e +0xbf U+0e1f +0xc0 U+0e20 +0xc1 U+0e21 +0xc2 U+0e22 +0xc3 U+0e23 +0xc4 U+0e24 +0xc5 U+0e25 +0xc6 U+0e26 +0xc7 U+0e27 +0xc8 U+0e28 +0xc9 U+0e29 +0xca U+0e2a +0xcb U+0e2b +0xcc U+0e2c +0xcd U+0e2d +0xce U+0e2e +0xcf U+0e2f +0xd0 U+0e30 +0xd1 U+0e31 +0xd2 U+0e32 +0xd3 U+0e33 +0xd4 U+0e34 +0xd5 U+0e35 +0xd6 U+0e36 +0xd7 U+0e37 +0xd8 U+0e38 +0xd9 U+0e39 +0xda U+0e3a +0xdb U+fffd +0xdc U+fffd +0xdd U+fffd +0xde U+fffd +0xdf U+0e3f +0xe0 U+0e40 +0xe1 U+0e41 +0xe2 U+0e42 +0xe3 U+0e43 +0xe4 U+0e44 +0xe5 U+0e45 +0xe6 U+0e46 +0xe7 U+0e47 +0xe8 U+0e48 +0xe9 U+0e49 +0xea U+0e4a +0xeb U+0e4b +0xec U+0e4c +0xed U+0e4d +0xee U+0e4e +0xef U+0e4f +0xf0 U+0e50 +0xf1 U+0e51 +0xf2 U+0e52 +0xf3 U+0e53 +0xf4 U+0e54 +0xf5 U+0e55 +0xf6 U+0e56 +0xf7 U+0e57 +0xf8 U+0e58 +0xf9 U+0e59 +0xfa U+0e5a +0xfb U+0e5b +0xfc U+fffd +0xfd U+fffd +0xfe U+fffd +0xff U+fffd diff --git a/jdk/make/tools/CharsetMapping/ISO_8859_13.map b/jdk/make/tools/CharsetMapping/ISO_8859_13.map new file mode 100644 index 00000000000..b06dc749c29 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/ISO_8859_13.map @@ -0,0 +1,257 @@ +#Generated from ISO_8859_13.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+0080 +0x81 U+0081 +0x82 U+0082 +0x83 U+0083 +0x84 U+0084 +0x85 U+0085 +0x86 U+0086 +0x87 U+0087 +0x88 U+0088 +0x89 U+0089 +0x8a U+008a +0x8b U+008b +0x8c U+008c +0x8d U+008d +0x8e U+008e +0x8f U+008f +0x90 U+0090 +0x91 U+0091 +0x92 U+0092 +0x93 U+0093 +0x94 U+0094 +0x95 U+0095 +0x96 U+0096 +0x97 U+0097 +0x98 U+0098 +0x99 U+0099 +0x9a U+009a +0x9b U+009b +0x9c U+009c +0x9d U+009d +0x9e U+009e +0x9f U+009f +0xa0 U+00a0 +0xa1 U+201d +0xa2 U+00a2 +0xa3 U+00a3 +0xa4 U+00a4 +0xa5 U+201e +0xa6 U+00a6 +0xa7 U+00a7 +0xa8 U+00d8 +0xa9 U+00a9 +0xaa U+0156 +0xab U+00ab +0xac U+00ac +0xad U+00ad +0xae U+00ae +0xaf U+00c6 +0xb0 U+00b0 +0xb1 U+00b1 +0xb2 U+00b2 +0xb3 U+00b3 +0xb4 U+201c +0xb5 U+00b5 +0xb6 U+00b6 +0xb7 U+00b7 +0xb8 U+00f8 +0xb9 U+00b9 +0xba U+0157 +0xbb U+00bb +0xbc U+00bc +0xbd U+00bd +0xbe U+00be +0xbf U+00e6 +0xc0 U+0104 +0xc1 U+012e +0xc2 U+0100 +0xc3 U+0106 +0xc4 U+00c4 +0xc5 U+00c5 +0xc6 U+0118 +0xc7 U+0112 +0xc8 U+010c +0xc9 U+00c9 +0xca U+0179 +0xcb U+0116 +0xcc U+0122 +0xcd U+0136 +0xce U+012a +0xcf U+013b +0xd0 U+0160 +0xd1 U+0143 +0xd2 U+0145 +0xd3 U+00d3 +0xd4 U+014c +0xd5 U+00d5 +0xd6 U+00d6 +0xd7 U+00d7 +0xd8 U+0172 +0xd9 U+0141 +0xda U+015a +0xdb U+016a +0xdc U+00dc +0xdd U+017b +0xde U+017d +0xdf U+00df +0xe0 U+0105 +0xe1 U+012f +0xe2 U+0101 +0xe3 U+0107 +0xe4 U+00e4 +0xe5 U+00e5 +0xe6 U+0119 +0xe7 U+0113 +0xe8 U+010d +0xe9 U+00e9 +0xea U+017a +0xeb U+0117 +0xec U+0123 +0xed U+0137 +0xee U+012b +0xef U+013c +0xf0 U+0161 +0xf1 U+0144 +0xf2 U+0146 +0xf3 U+00f3 +0xf4 U+014d +0xf5 U+00f5 +0xf6 U+00f6 +0xf7 U+00f7 +0xf8 U+0173 +0xf9 U+0142 +0xfa U+015b +0xfb U+016b +0xfc U+00fc +0xfd U+017c +0xfe U+017e +0xff U+2019 diff --git a/jdk/make/tools/CharsetMapping/ISO_8859_15.map b/jdk/make/tools/CharsetMapping/ISO_8859_15.map new file mode 100644 index 00000000000..b75e3c6a342 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/ISO_8859_15.map @@ -0,0 +1,257 @@ +#Generated from ISO_8859_15.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+0080 +0x81 U+0081 +0x82 U+0082 +0x83 U+0083 +0x84 U+0084 +0x85 U+0085 +0x86 U+0086 +0x87 U+0087 +0x88 U+0088 +0x89 U+0089 +0x8a U+008a +0x8b U+008b +0x8c U+008c +0x8d U+008d +0x8e U+008e +0x8f U+008f +0x90 U+0090 +0x91 U+0091 +0x92 U+0092 +0x93 U+0093 +0x94 U+0094 +0x95 U+0095 +0x96 U+0096 +0x97 U+0097 +0x98 U+0098 +0x99 U+0099 +0x9a U+009a +0x9b U+009b +0x9c U+009c +0x9d U+009d +0x9e U+009e +0x9f U+009f +0xa0 U+00a0 +0xa1 U+00a1 +0xa2 U+00a2 +0xa3 U+00a3 +0xa4 U+20ac +0xa5 U+00a5 +0xa6 U+0160 +0xa7 U+00a7 +0xa8 U+0161 +0xa9 U+00a9 +0xaa U+00aa +0xab U+00ab +0xac U+00ac +0xad U+00ad +0xae U+00ae +0xaf U+00af +0xb0 U+00b0 +0xb1 U+00b1 +0xb2 U+00b2 +0xb3 U+00b3 +0xb4 U+017d +0xb5 U+00b5 +0xb6 U+00b6 +0xb7 U+00b7 +0xb8 U+017e +0xb9 U+00b9 +0xba U+00ba +0xbb U+00bb +0xbc U+0152 +0xbd U+0153 +0xbe U+0178 +0xbf U+00bf +0xc0 U+00c0 +0xc1 U+00c1 +0xc2 U+00c2 +0xc3 U+00c3 +0xc4 U+00c4 +0xc5 U+00c5 +0xc6 U+00c6 +0xc7 U+00c7 +0xc8 U+00c8 +0xc9 U+00c9 +0xca U+00ca +0xcb U+00cb +0xcc U+00cc +0xcd U+00cd +0xce U+00ce +0xcf U+00cf +0xd0 U+00d0 +0xd1 U+00d1 +0xd2 U+00d2 +0xd3 U+00d3 +0xd4 U+00d4 +0xd5 U+00d5 +0xd6 U+00d6 +0xd7 U+00d7 +0xd8 U+00d8 +0xd9 U+00d9 +0xda U+00da +0xdb U+00db +0xdc U+00dc +0xdd U+00dd +0xde U+00de +0xdf U+00df +0xe0 U+00e0 +0xe1 U+00e1 +0xe2 U+00e2 +0xe3 U+00e3 +0xe4 U+00e4 +0xe5 U+00e5 +0xe6 U+00e6 +0xe7 U+00e7 +0xe8 U+00e8 +0xe9 U+00e9 +0xea U+00ea +0xeb U+00eb +0xec U+00ec +0xed U+00ed +0xee U+00ee +0xef U+00ef +0xf0 U+00f0 +0xf1 U+00f1 +0xf2 U+00f2 +0xf3 U+00f3 +0xf4 U+00f4 +0xf5 U+00f5 +0xf6 U+00f6 +0xf7 U+00f7 +0xf8 U+00f8 +0xf9 U+00f9 +0xfa U+00fa +0xfb U+00fb +0xfc U+00fc +0xfd U+00fd +0xfe U+00fe +0xff U+00ff diff --git a/jdk/make/tools/CharsetMapping/ISO_8859_2.map b/jdk/make/tools/CharsetMapping/ISO_8859_2.map new file mode 100644 index 00000000000..e3c264b0141 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/ISO_8859_2.map @@ -0,0 +1,257 @@ +#Generated from ISO_8859_2.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+0080 +0x81 U+0081 +0x82 U+0082 +0x83 U+0083 +0x84 U+0084 +0x85 U+0085 +0x86 U+0086 +0x87 U+0087 +0x88 U+0088 +0x89 U+0089 +0x8a U+008a +0x8b U+008b +0x8c U+008c +0x8d U+008d +0x8e U+008e +0x8f U+008f +0x90 U+0090 +0x91 U+0091 +0x92 U+0092 +0x93 U+0093 +0x94 U+0094 +0x95 U+0095 +0x96 U+0096 +0x97 U+0097 +0x98 U+0098 +0x99 U+0099 +0x9a U+009a +0x9b U+009b +0x9c U+009c +0x9d U+009d +0x9e U+009e +0x9f U+009f +0xa0 U+00a0 +0xa1 U+0104 +0xa2 U+02d8 +0xa3 U+0141 +0xa4 U+00a4 +0xa5 U+013d +0xa6 U+015a +0xa7 U+00a7 +0xa8 U+00a8 +0xa9 U+0160 +0xaa U+015e +0xab U+0164 +0xac U+0179 +0xad U+00ad +0xae U+017d +0xaf U+017b +0xb0 U+00b0 +0xb1 U+0105 +0xb2 U+02db +0xb3 U+0142 +0xb4 U+00b4 +0xb5 U+013e +0xb6 U+015b +0xb7 U+02c7 +0xb8 U+00b8 +0xb9 U+0161 +0xba U+015f +0xbb U+0165 +0xbc U+017a +0xbd U+02dd +0xbe U+017e +0xbf U+017c +0xc0 U+0154 +0xc1 U+00c1 +0xc2 U+00c2 +0xc3 U+0102 +0xc4 U+00c4 +0xc5 U+0139 +0xc6 U+0106 +0xc7 U+00c7 +0xc8 U+010c +0xc9 U+00c9 +0xca U+0118 +0xcb U+00cb +0xcc U+011a +0xcd U+00cd +0xce U+00ce +0xcf U+010e +0xd0 U+0110 +0xd1 U+0143 +0xd2 U+0147 +0xd3 U+00d3 +0xd4 U+00d4 +0xd5 U+0150 +0xd6 U+00d6 +0xd7 U+00d7 +0xd8 U+0158 +0xd9 U+016e +0xda U+00da +0xdb U+0170 +0xdc U+00dc +0xdd U+00dd +0xde U+0162 +0xdf U+00df +0xe0 U+0155 +0xe1 U+00e1 +0xe2 U+00e2 +0xe3 U+0103 +0xe4 U+00e4 +0xe5 U+013a +0xe6 U+0107 +0xe7 U+00e7 +0xe8 U+010d +0xe9 U+00e9 +0xea U+0119 +0xeb U+00eb +0xec U+011b +0xed U+00ed +0xee U+00ee +0xef U+010f +0xf0 U+0111 +0xf1 U+0144 +0xf2 U+0148 +0xf3 U+00f3 +0xf4 U+00f4 +0xf5 U+0151 +0xf6 U+00f6 +0xf7 U+00f7 +0xf8 U+0159 +0xf9 U+016f +0xfa U+00fa +0xfb U+0171 +0xfc U+00fc +0xfd U+00fd +0xfe U+0163 +0xff U+02d9 diff --git a/jdk/make/tools/CharsetMapping/ISO_8859_3.map b/jdk/make/tools/CharsetMapping/ISO_8859_3.map new file mode 100644 index 00000000000..748bd267f90 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/ISO_8859_3.map @@ -0,0 +1,257 @@ +#Generated from ISO_8859_3.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+0080 +0x81 U+0081 +0x82 U+0082 +0x83 U+0083 +0x84 U+0084 +0x85 U+0085 +0x86 U+0086 +0x87 U+0087 +0x88 U+0088 +0x89 U+0089 +0x8a U+008a +0x8b U+008b +0x8c U+008c +0x8d U+008d +0x8e U+008e +0x8f U+008f +0x90 U+0090 +0x91 U+0091 +0x92 U+0092 +0x93 U+0093 +0x94 U+0094 +0x95 U+0095 +0x96 U+0096 +0x97 U+0097 +0x98 U+0098 +0x99 U+0099 +0x9a U+009a +0x9b U+009b +0x9c U+009c +0x9d U+009d +0x9e U+009e +0x9f U+009f +0xa0 U+00a0 +0xa1 U+0126 +0xa2 U+02d8 +0xa3 U+00a3 +0xa4 U+00a4 +0xa5 U+fffd +0xa6 U+0124 +0xa7 U+00a7 +0xa8 U+00a8 +0xa9 U+0130 +0xaa U+015e +0xab U+011e +0xac U+0134 +0xad U+00ad +0xae U+fffd +0xaf U+017b +0xb0 U+00b0 +0xb1 U+0127 +0xb2 U+00b2 +0xb3 U+00b3 +0xb4 U+00b4 +0xb5 U+00b5 +0xb6 U+0125 +0xb7 U+00b7 +0xb8 U+00b8 +0xb9 U+0131 +0xba U+015f +0xbb U+011f +0xbc U+0135 +0xbd U+00bd +0xbe U+fffd +0xbf U+017c +0xc0 U+00c0 +0xc1 U+00c1 +0xc2 U+00c2 +0xc3 U+fffd +0xc4 U+00c4 +0xc5 U+010a +0xc6 U+0108 +0xc7 U+00c7 +0xc8 U+00c8 +0xc9 U+00c9 +0xca U+00ca +0xcb U+00cb +0xcc U+00cc +0xcd U+00cd +0xce U+00ce +0xcf U+00cf +0xd0 U+fffd +0xd1 U+00d1 +0xd2 U+00d2 +0xd3 U+00d3 +0xd4 U+00d4 +0xd5 U+0120 +0xd6 U+00d6 +0xd7 U+00d7 +0xd8 U+011c +0xd9 U+00d9 +0xda U+00da +0xdb U+00db +0xdc U+00dc +0xdd U+016c +0xde U+015c +0xdf U+00df +0xe0 U+00e0 +0xe1 U+00e1 +0xe2 U+00e2 +0xe3 U+fffd +0xe4 U+00e4 +0xe5 U+010b +0xe6 U+0109 +0xe7 U+00e7 +0xe8 U+00e8 +0xe9 U+00e9 +0xea U+00ea +0xeb U+00eb +0xec U+00ec +0xed U+00ed +0xee U+00ee +0xef U+00ef +0xf0 U+fffd +0xf1 U+00f1 +0xf2 U+00f2 +0xf3 U+00f3 +0xf4 U+00f4 +0xf5 U+0121 +0xf6 U+00f6 +0xf7 U+00f7 +0xf8 U+011d +0xf9 U+00f9 +0xfa U+00fa +0xfb U+00fb +0xfc U+00fc +0xfd U+016d +0xfe U+015d +0xff U+02d9 diff --git a/jdk/make/tools/CharsetMapping/ISO_8859_4.map b/jdk/make/tools/CharsetMapping/ISO_8859_4.map new file mode 100644 index 00000000000..fe485427c46 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/ISO_8859_4.map @@ -0,0 +1,257 @@ +#Generated from ISO_8859_4.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+0080 +0x81 U+0081 +0x82 U+0082 +0x83 U+0083 +0x84 U+0084 +0x85 U+0085 +0x86 U+0086 +0x87 U+0087 +0x88 U+0088 +0x89 U+0089 +0x8a U+008a +0x8b U+008b +0x8c U+008c +0x8d U+008d +0x8e U+008e +0x8f U+008f +0x90 U+0090 +0x91 U+0091 +0x92 U+0092 +0x93 U+0093 +0x94 U+0094 +0x95 U+0095 +0x96 U+0096 +0x97 U+0097 +0x98 U+0098 +0x99 U+0099 +0x9a U+009a +0x9b U+009b +0x9c U+009c +0x9d U+009d +0x9e U+009e +0x9f U+009f +0xa0 U+00a0 +0xa1 U+0104 +0xa2 U+0138 +0xa3 U+0156 +0xa4 U+00a4 +0xa5 U+0128 +0xa6 U+013b +0xa7 U+00a7 +0xa8 U+00a8 +0xa9 U+0160 +0xaa U+0112 +0xab U+0122 +0xac U+0166 +0xad U+00ad +0xae U+017d +0xaf U+00af +0xb0 U+00b0 +0xb1 U+0105 +0xb2 U+02db +0xb3 U+0157 +0xb4 U+00b4 +0xb5 U+0129 +0xb6 U+013c +0xb7 U+02c7 +0xb8 U+00b8 +0xb9 U+0161 +0xba U+0113 +0xbb U+0123 +0xbc U+0167 +0xbd U+014a +0xbe U+017e +0xbf U+014b +0xc0 U+0100 +0xc1 U+00c1 +0xc2 U+00c2 +0xc3 U+00c3 +0xc4 U+00c4 +0xc5 U+00c5 +0xc6 U+00c6 +0xc7 U+012e +0xc8 U+010c +0xc9 U+00c9 +0xca U+0118 +0xcb U+00cb +0xcc U+0116 +0xcd U+00cd +0xce U+00ce +0xcf U+012a +0xd0 U+0110 +0xd1 U+0145 +0xd2 U+014c +0xd3 U+0136 +0xd4 U+00d4 +0xd5 U+00d5 +0xd6 U+00d6 +0xd7 U+00d7 +0xd8 U+00d8 +0xd9 U+0172 +0xda U+00da +0xdb U+00db +0xdc U+00dc +0xdd U+0168 +0xde U+016a +0xdf U+00df +0xe0 U+0101 +0xe1 U+00e1 +0xe2 U+00e2 +0xe3 U+00e3 +0xe4 U+00e4 +0xe5 U+00e5 +0xe6 U+00e6 +0xe7 U+012f +0xe8 U+010d +0xe9 U+00e9 +0xea U+0119 +0xeb U+00eb +0xec U+0117 +0xed U+00ed +0xee U+00ee +0xef U+012b +0xf0 U+0111 +0xf1 U+0146 +0xf2 U+014d +0xf3 U+0137 +0xf4 U+00f4 +0xf5 U+00f5 +0xf6 U+00f6 +0xf7 U+00f7 +0xf8 U+00f8 +0xf9 U+0173 +0xfa U+00fa +0xfb U+00fb +0xfc U+00fc +0xfd U+0169 +0xfe U+016b +0xff U+02d9 diff --git a/jdk/make/tools/CharsetMapping/ISO_8859_5.map b/jdk/make/tools/CharsetMapping/ISO_8859_5.map new file mode 100644 index 00000000000..d7f80137ffb --- /dev/null +++ b/jdk/make/tools/CharsetMapping/ISO_8859_5.map @@ -0,0 +1,257 @@ +#Generated from ISO_8859_5.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+0080 +0x81 U+0081 +0x82 U+0082 +0x83 U+0083 +0x84 U+0084 +0x85 U+0085 +0x86 U+0086 +0x87 U+0087 +0x88 U+0088 +0x89 U+0089 +0x8a U+008a +0x8b U+008b +0x8c U+008c +0x8d U+008d +0x8e U+008e +0x8f U+008f +0x90 U+0090 +0x91 U+0091 +0x92 U+0092 +0x93 U+0093 +0x94 U+0094 +0x95 U+0095 +0x96 U+0096 +0x97 U+0097 +0x98 U+0098 +0x99 U+0099 +0x9a U+009a +0x9b U+009b +0x9c U+009c +0x9d U+009d +0x9e U+009e +0x9f U+009f +0xa0 U+00a0 +0xa1 U+0401 +0xa2 U+0402 +0xa3 U+0403 +0xa4 U+0404 +0xa5 U+0405 +0xa6 U+0406 +0xa7 U+0407 +0xa8 U+0408 +0xa9 U+0409 +0xaa U+040a +0xab U+040b +0xac U+040c +0xad U+00ad +0xae U+040e +0xaf U+040f +0xb0 U+0410 +0xb1 U+0411 +0xb2 U+0412 +0xb3 U+0413 +0xb4 U+0414 +0xb5 U+0415 +0xb6 U+0416 +0xb7 U+0417 +0xb8 U+0418 +0xb9 U+0419 +0xba U+041a +0xbb U+041b +0xbc U+041c +0xbd U+041d +0xbe U+041e +0xbf U+041f +0xc0 U+0420 +0xc1 U+0421 +0xc2 U+0422 +0xc3 U+0423 +0xc4 U+0424 +0xc5 U+0425 +0xc6 U+0426 +0xc7 U+0427 +0xc8 U+0428 +0xc9 U+0429 +0xca U+042a +0xcb U+042b +0xcc U+042c +0xcd U+042d +0xce U+042e +0xcf U+042f +0xd0 U+0430 +0xd1 U+0431 +0xd2 U+0432 +0xd3 U+0433 +0xd4 U+0434 +0xd5 U+0435 +0xd6 U+0436 +0xd7 U+0437 +0xd8 U+0438 +0xd9 U+0439 +0xda U+043a +0xdb U+043b +0xdc U+043c +0xdd U+043d +0xde U+043e +0xdf U+043f +0xe0 U+0440 +0xe1 U+0441 +0xe2 U+0442 +0xe3 U+0443 +0xe4 U+0444 +0xe5 U+0445 +0xe6 U+0446 +0xe7 U+0447 +0xe8 U+0448 +0xe9 U+0449 +0xea U+044a +0xeb U+044b +0xec U+044c +0xed U+044d +0xee U+044e +0xef U+044f +0xf0 U+2116 +0xf1 U+0451 +0xf2 U+0452 +0xf3 U+0453 +0xf4 U+0454 +0xf5 U+0455 +0xf6 U+0456 +0xf7 U+0457 +0xf8 U+0458 +0xf9 U+0459 +0xfa U+045a +0xfb U+045b +0xfc U+045c +0xfd U+00a7 +0xfe U+045e +0xff U+045f diff --git a/jdk/make/tools/CharsetMapping/ISO_8859_6.map b/jdk/make/tools/CharsetMapping/ISO_8859_6.map new file mode 100644 index 00000000000..ade727b84e5 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/ISO_8859_6.map @@ -0,0 +1,257 @@ +#Generated from ISO_8859_6.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+0080 +0x81 U+0081 +0x82 U+0082 +0x83 U+0083 +0x84 U+0084 +0x85 U+0085 +0x86 U+0086 +0x87 U+0087 +0x88 U+0088 +0x89 U+0089 +0x8a U+008a +0x8b U+008b +0x8c U+008c +0x8d U+008d +0x8e U+008e +0x8f U+008f +0x90 U+0090 +0x91 U+0091 +0x92 U+0092 +0x93 U+0093 +0x94 U+0094 +0x95 U+0095 +0x96 U+0096 +0x97 U+0097 +0x98 U+0098 +0x99 U+0099 +0x9a U+009a +0x9b U+009b +0x9c U+009c +0x9d U+009d +0x9e U+009e +0x9f U+009f +0xa0 U+00a0 +0xa1 U+fffd +0xa2 U+fffd +0xa3 U+fffd +0xa4 U+00a4 +0xa5 U+fffd +0xa6 U+fffd +0xa7 U+fffd +0xa8 U+fffd +0xa9 U+fffd +0xaa U+fffd +0xab U+fffd +0xac U+060c +0xad U+00ad +0xae U+fffd +0xaf U+fffd +0xb0 U+fffd +0xb1 U+fffd +0xb2 U+fffd +0xb3 U+fffd +0xb4 U+fffd +0xb5 U+fffd +0xb6 U+fffd +0xb7 U+fffd +0xb8 U+fffd +0xb9 U+fffd +0xba U+fffd +0xbb U+061b +0xbc U+fffd +0xbd U+fffd +0xbe U+fffd +0xbf U+061f +0xc0 U+fffd +0xc1 U+0621 +0xc2 U+0622 +0xc3 U+0623 +0xc4 U+0624 +0xc5 U+0625 +0xc6 U+0626 +0xc7 U+0627 +0xc8 U+0628 +0xc9 U+0629 +0xca U+062a +0xcb U+062b +0xcc U+062c +0xcd U+062d +0xce U+062e +0xcf U+062f +0xd0 U+0630 +0xd1 U+0631 +0xd2 U+0632 +0xd3 U+0633 +0xd4 U+0634 +0xd5 U+0635 +0xd6 U+0636 +0xd7 U+0637 +0xd8 U+0638 +0xd9 U+0639 +0xda U+063a +0xdb U+fffd +0xdc U+fffd +0xdd U+fffd +0xde U+fffd +0xdf U+fffd +0xe0 U+0640 +0xe1 U+0641 +0xe2 U+0642 +0xe3 U+0643 +0xe4 U+0644 +0xe5 U+0645 +0xe6 U+0646 +0xe7 U+0647 +0xe8 U+0648 +0xe9 U+0649 +0xea U+064a +0xeb U+064b +0xec U+064c +0xed U+064d +0xee U+064e +0xef U+064f +0xf0 U+0650 +0xf1 U+0651 +0xf2 U+0652 +0xf3 U+fffd +0xf4 U+fffd +0xf5 U+fffd +0xf6 U+fffd +0xf7 U+fffd +0xf8 U+fffd +0xf9 U+fffd +0xfa U+fffd +0xfb U+fffd +0xfc U+fffd +0xfd U+fffd +0xfe U+fffd +0xff U+fffd diff --git a/jdk/make/tools/CharsetMapping/ISO_8859_7.map b/jdk/make/tools/CharsetMapping/ISO_8859_7.map new file mode 100644 index 00000000000..673902d99ec --- /dev/null +++ b/jdk/make/tools/CharsetMapping/ISO_8859_7.map @@ -0,0 +1,257 @@ +#Generated from ISO_8859_7.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+0080 +0x81 U+0081 +0x82 U+0082 +0x83 U+0083 +0x84 U+0084 +0x85 U+0085 +0x86 U+0086 +0x87 U+0087 +0x88 U+0088 +0x89 U+0089 +0x8a U+008a +0x8b U+008b +0x8c U+008c +0x8d U+008d +0x8e U+008e +0x8f U+008f +0x90 U+0090 +0x91 U+0091 +0x92 U+0092 +0x93 U+0093 +0x94 U+0094 +0x95 U+0095 +0x96 U+0096 +0x97 U+0097 +0x98 U+0098 +0x99 U+0099 +0x9a U+009a +0x9b U+009b +0x9c U+009c +0x9d U+009d +0x9e U+009e +0x9f U+009f +0xa0 U+00a0 +0xa1 U+2018 +0xa2 U+2019 +0xa3 U+00a3 +0xa4 U+20ac +0xa5 U+20af +0xa6 U+00a6 +0xa7 U+00a7 +0xa8 U+00a8 +0xa9 U+00a9 +0xaa U+037a +0xab U+00ab +0xac U+00ac +0xad U+00ad +0xae U+fffd +0xaf U+2015 +0xb0 U+00b0 +0xb1 U+00b1 +0xb2 U+00b2 +0xb3 U+00b3 +0xb4 U+0384 +0xb5 U+0385 +0xb6 U+0386 +0xb7 U+00b7 +0xb8 U+0388 +0xb9 U+0389 +0xba U+038a +0xbb U+00bb +0xbc U+038c +0xbd U+00bd +0xbe U+038e +0xbf U+038f +0xc0 U+0390 +0xc1 U+0391 +0xc2 U+0392 +0xc3 U+0393 +0xc4 U+0394 +0xc5 U+0395 +0xc6 U+0396 +0xc7 U+0397 +0xc8 U+0398 +0xc9 U+0399 +0xca U+039a +0xcb U+039b +0xcc U+039c +0xcd U+039d +0xce U+039e +0xcf U+039f +0xd0 U+03a0 +0xd1 U+03a1 +0xd2 U+fffd +0xd3 U+03a3 +0xd4 U+03a4 +0xd5 U+03a5 +0xd6 U+03a6 +0xd7 U+03a7 +0xd8 U+03a8 +0xd9 U+03a9 +0xda U+03aa +0xdb U+03ab +0xdc U+03ac +0xdd U+03ad +0xde U+03ae +0xdf U+03af +0xe0 U+03b0 +0xe1 U+03b1 +0xe2 U+03b2 +0xe3 U+03b3 +0xe4 U+03b4 +0xe5 U+03b5 +0xe6 U+03b6 +0xe7 U+03b7 +0xe8 U+03b8 +0xe9 U+03b9 +0xea U+03ba +0xeb U+03bb +0xec U+03bc +0xed U+03bd +0xee U+03be +0xef U+03bf +0xf0 U+03c0 +0xf1 U+03c1 +0xf2 U+03c2 +0xf3 U+03c3 +0xf4 U+03c4 +0xf5 U+03c5 +0xf6 U+03c6 +0xf7 U+03c7 +0xf8 U+03c8 +0xf9 U+03c9 +0xfa U+03ca +0xfb U+03cb +0xfc U+03cc +0xfd U+03cd +0xfe U+03ce +0xff U+fffd diff --git a/jdk/make/tools/CharsetMapping/ISO_8859_8.map b/jdk/make/tools/CharsetMapping/ISO_8859_8.map new file mode 100644 index 00000000000..aa05d5cbfa9 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/ISO_8859_8.map @@ -0,0 +1,257 @@ +#Generated from ISO_8859_8.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+0080 +0x81 U+0081 +0x82 U+0082 +0x83 U+0083 +0x84 U+0084 +0x85 U+0085 +0x86 U+0086 +0x87 U+0087 +0x88 U+0088 +0x89 U+0089 +0x8a U+008a +0x8b U+008b +0x8c U+008c +0x8d U+008d +0x8e U+008e +0x8f U+008f +0x90 U+0090 +0x91 U+0091 +0x92 U+0092 +0x93 U+0093 +0x94 U+0094 +0x95 U+0095 +0x96 U+0096 +0x97 U+0097 +0x98 U+0098 +0x99 U+0099 +0x9a U+009a +0x9b U+009b +0x9c U+009c +0x9d U+009d +0x9e U+009e +0x9f U+009f +0xa0 U+00a0 +0xa1 U+fffd +0xa2 U+00a2 +0xa3 U+00a3 +0xa4 U+00a4 +0xa5 U+00a5 +0xa6 U+00a6 +0xa7 U+00a7 +0xa8 U+00a8 +0xa9 U+00a9 +0xaa U+00d7 +0xab U+00ab +0xac U+00ac +0xad U+00ad +0xae U+00ae +0xaf U+00af +0xb0 U+00b0 +0xb1 U+00b1 +0xb2 U+00b2 +0xb3 U+00b3 +0xb4 U+00b4 +0xb5 U+00b5 +0xb6 U+00b6 +0xb7 U+00b7 +0xb8 U+00b8 +0xb9 U+00b9 +0xba U+00f7 +0xbb U+00bb +0xbc U+00bc +0xbd U+00bd +0xbe U+00be +0xbf U+fffd +0xc0 U+fffd +0xc1 U+fffd +0xc2 U+fffd +0xc3 U+fffd +0xc4 U+fffd +0xc5 U+fffd +0xc6 U+fffd +0xc7 U+fffd +0xc8 U+fffd +0xc9 U+fffd +0xca U+fffd +0xcb U+fffd +0xcc U+fffd +0xcd U+fffd +0xce U+fffd +0xcf U+fffd +0xd0 U+fffd +0xd1 U+fffd +0xd2 U+fffd +0xd3 U+fffd +0xd4 U+fffd +0xd5 U+fffd +0xd6 U+fffd +0xd7 U+fffd +0xd8 U+fffd +0xd9 U+fffd +0xda U+fffd +0xdb U+fffd +0xdc U+fffd +0xdd U+fffd +0xde U+fffd +0xdf U+2017 +0xe0 U+05d0 +0xe1 U+05d1 +0xe2 U+05d2 +0xe3 U+05d3 +0xe4 U+05d4 +0xe5 U+05d5 +0xe6 U+05d6 +0xe7 U+05d7 +0xe8 U+05d8 +0xe9 U+05d9 +0xea U+05da +0xeb U+05db +0xec U+05dc +0xed U+05dd +0xee U+05de +0xef U+05df +0xf0 U+05e0 +0xf1 U+05e1 +0xf2 U+05e2 +0xf3 U+05e3 +0xf4 U+05e4 +0xf5 U+05e5 +0xf6 U+05e6 +0xf7 U+05e7 +0xf8 U+05e8 +0xf9 U+05e9 +0xfa U+05ea +0xfb U+fffd +0xfc U+fffd +0xfd U+200e +0xfe U+200f +0xff U+fffd diff --git a/jdk/make/tools/CharsetMapping/ISO_8859_9.map b/jdk/make/tools/CharsetMapping/ISO_8859_9.map new file mode 100644 index 00000000000..e3a8afb3d85 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/ISO_8859_9.map @@ -0,0 +1,257 @@ +#Generated from ISO_8859_9.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+0080 +0x81 U+0081 +0x82 U+0082 +0x83 U+0083 +0x84 U+0084 +0x85 U+0085 +0x86 U+0086 +0x87 U+0087 +0x88 U+0088 +0x89 U+0089 +0x8a U+008a +0x8b U+008b +0x8c U+008c +0x8d U+008d +0x8e U+008e +0x8f U+008f +0x90 U+0090 +0x91 U+0091 +0x92 U+0092 +0x93 U+0093 +0x94 U+0094 +0x95 U+0095 +0x96 U+0096 +0x97 U+0097 +0x98 U+0098 +0x99 U+0099 +0x9a U+009a +0x9b U+009b +0x9c U+009c +0x9d U+009d +0x9e U+009e +0x9f U+009f +0xa0 U+00a0 +0xa1 U+00a1 +0xa2 U+00a2 +0xa3 U+00a3 +0xa4 U+00a4 +0xa5 U+00a5 +0xa6 U+00a6 +0xa7 U+00a7 +0xa8 U+00a8 +0xa9 U+00a9 +0xaa U+00aa +0xab U+00ab +0xac U+00ac +0xad U+00ad +0xae U+00ae +0xaf U+00af +0xb0 U+00b0 +0xb1 U+00b1 +0xb2 U+00b2 +0xb3 U+00b3 +0xb4 U+00b4 +0xb5 U+00b5 +0xb6 U+00b6 +0xb7 U+00b7 +0xb8 U+00b8 +0xb9 U+00b9 +0xba U+00ba +0xbb U+00bb +0xbc U+00bc +0xbd U+00bd +0xbe U+00be +0xbf U+00bf +0xc0 U+00c0 +0xc1 U+00c1 +0xc2 U+00c2 +0xc3 U+00c3 +0xc4 U+00c4 +0xc5 U+00c5 +0xc6 U+00c6 +0xc7 U+00c7 +0xc8 U+00c8 +0xc9 U+00c9 +0xca U+00ca +0xcb U+00cb +0xcc U+00cc +0xcd U+00cd +0xce U+00ce +0xcf U+00cf +0xd0 U+011e +0xd1 U+00d1 +0xd2 U+00d2 +0xd3 U+00d3 +0xd4 U+00d4 +0xd5 U+00d5 +0xd6 U+00d6 +0xd7 U+00d7 +0xd8 U+00d8 +0xd9 U+00d9 +0xda U+00da +0xdb U+00db +0xdc U+00dc +0xdd U+0130 +0xde U+015e +0xdf U+00df +0xe0 U+00e0 +0xe1 U+00e1 +0xe2 U+00e2 +0xe3 U+00e3 +0xe4 U+00e4 +0xe5 U+00e5 +0xe6 U+00e6 +0xe7 U+00e7 +0xe8 U+00e8 +0xe9 U+00e9 +0xea U+00ea +0xeb U+00eb +0xec U+00ec +0xed U+00ed +0xee U+00ee +0xef U+00ef +0xf0 U+011f +0xf1 U+00f1 +0xf2 U+00f2 +0xf3 U+00f3 +0xf4 U+00f4 +0xf5 U+00f5 +0xf6 U+00f6 +0xf7 U+00f7 +0xf8 U+00f8 +0xf9 U+00f9 +0xfa U+00fa +0xfb U+00fb +0xfc U+00fc +0xfd U+0131 +0xfe U+015f +0xff U+00ff diff --git a/jdk/make/tools/CharsetMapping/JIS_X_0201.map b/jdk/make/tools/CharsetMapping/JIS_X_0201.map new file mode 100644 index 00000000000..aaa8f1150a3 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/JIS_X_0201.map @@ -0,0 +1,257 @@ +#Generated from JIS_X_0201.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+fffd +0x81 U+fffd +0x82 U+fffd +0x83 U+fffd +0x84 U+fffd +0x85 U+fffd +0x86 U+fffd +0x87 U+fffd +0x88 U+fffd +0x89 U+fffd +0x8a U+fffd +0x8b U+fffd +0x8c U+fffd +0x8d U+fffd +0x8e U+fffd +0x8f U+fffd +0x90 U+fffd +0x91 U+fffd +0x92 U+fffd +0x93 U+fffd +0x94 U+fffd +0x95 U+fffd +0x96 U+fffd +0x97 U+fffd +0x98 U+fffd +0x99 U+fffd +0x9a U+fffd +0x9b U+fffd +0x9c U+fffd +0x9d U+fffd +0x9e U+fffd +0x9f U+fffd +0xa0 U+fffd +0xa1 U+ff61 +0xa2 U+ff62 +0xa3 U+ff63 +0xa4 U+ff64 +0xa5 U+ff65 +0xa6 U+ff66 +0xa7 U+ff67 +0xa8 U+ff68 +0xa9 U+ff69 +0xaa U+ff6a +0xab U+ff6b +0xac U+ff6c +0xad U+ff6d +0xae U+ff6e +0xaf U+ff6f +0xb0 U+ff70 +0xb1 U+ff71 +0xb2 U+ff72 +0xb3 U+ff73 +0xb4 U+ff74 +0xb5 U+ff75 +0xb6 U+ff76 +0xb7 U+ff77 +0xb8 U+ff78 +0xb9 U+ff79 +0xba U+ff7a +0xbb U+ff7b +0xbc U+ff7c +0xbd U+ff7d +0xbe U+ff7e +0xbf U+ff7f +0xc0 U+ff80 +0xc1 U+ff81 +0xc2 U+ff82 +0xc3 U+ff83 +0xc4 U+ff84 +0xc5 U+ff85 +0xc6 U+ff86 +0xc7 U+ff87 +0xc8 U+ff88 +0xc9 U+ff89 +0xca U+ff8a +0xcb U+ff8b +0xcc U+ff8c +0xcd U+ff8d +0xce U+ff8e +0xcf U+ff8f +0xd0 U+ff90 +0xd1 U+ff91 +0xd2 U+ff92 +0xd3 U+ff93 +0xd4 U+ff94 +0xd5 U+ff95 +0xd6 U+ff96 +0xd7 U+ff97 +0xd8 U+ff98 +0xd9 U+ff99 +0xda U+ff9a +0xdb U+ff9b +0xdc U+ff9c +0xdd U+ff9d +0xde U+ff9e +0xdf U+ff9f +0xe0 U+fffd +0xe1 U+fffd +0xe2 U+fffd +0xe3 U+fffd +0xe4 U+fffd +0xe5 U+fffd +0xe6 U+fffd +0xe7 U+fffd +0xe8 U+fffd +0xe9 U+fffd +0xea U+fffd +0xeb U+fffd +0xec U+fffd +0xed U+fffd +0xee U+fffd +0xef U+fffd +0xf0 U+fffd +0xf1 U+fffd +0xf2 U+fffd +0xf3 U+fffd +0xf4 U+fffd +0xf5 U+fffd +0xf6 U+fffd +0xf7 U+fffd +0xf8 U+fffd +0xf9 U+fffd +0xfa U+fffd +0xfb U+fffd +0xfc U+fffd +0xfd U+fffd +0xfe U+fffd +0xff U+fffd diff --git a/jdk/make/tools/CharsetMapping/KOI8_R.map b/jdk/make/tools/CharsetMapping/KOI8_R.map new file mode 100644 index 00000000000..c13c38de4b3 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/KOI8_R.map @@ -0,0 +1,257 @@ +#Generated from KOI8_R.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+2500 +0x81 U+2502 +0x82 U+250c +0x83 U+2510 +0x84 U+2514 +0x85 U+2518 +0x86 U+251c +0x87 U+2524 +0x88 U+252c +0x89 U+2534 +0x8a U+253c +0x8b U+2580 +0x8c U+2584 +0x8d U+2588 +0x8e U+258c +0x8f U+2590 +0x90 U+2591 +0x91 U+2592 +0x92 U+2593 +0x93 U+2320 +0x94 U+25a0 +0x95 U+2219 +0x96 U+221a +0x97 U+2248 +0x98 U+2264 +0x99 U+2265 +0x9a U+00a0 +0x9b U+2321 +0x9c U+00b0 +0x9d U+00b2 +0x9e U+00b7 +0x9f U+00f7 +0xa0 U+2550 +0xa1 U+2551 +0xa2 U+2552 +0xa3 U+0451 +0xa4 U+2553 +0xa5 U+2554 +0xa6 U+2555 +0xa7 U+2556 +0xa8 U+2557 +0xa9 U+2558 +0xaa U+2559 +0xab U+255a +0xac U+255b +0xad U+255c +0xae U+255d +0xaf U+255e +0xb0 U+255f +0xb1 U+2560 +0xb2 U+2561 +0xb3 U+0401 +0xb4 U+2562 +0xb5 U+2563 +0xb6 U+2564 +0xb7 U+2565 +0xb8 U+2566 +0xb9 U+2567 +0xba U+2568 +0xbb U+2569 +0xbc U+256a +0xbd U+256b +0xbe U+256c +0xbf U+00a9 +0xc0 U+044e +0xc1 U+0430 +0xc2 U+0431 +0xc3 U+0446 +0xc4 U+0434 +0xc5 U+0435 +0xc6 U+0444 +0xc7 U+0433 +0xc8 U+0445 +0xc9 U+0438 +0xca U+0439 +0xcb U+043a +0xcc U+043b +0xcd U+043c +0xce U+043d +0xcf U+043e +0xd0 U+043f +0xd1 U+044f +0xd2 U+0440 +0xd3 U+0441 +0xd4 U+0442 +0xd5 U+0443 +0xd6 U+0436 +0xd7 U+0432 +0xd8 U+044c +0xd9 U+044b +0xda U+0437 +0xdb U+0448 +0xdc U+044d +0xdd U+0449 +0xde U+0447 +0xdf U+044a +0xe0 U+042e +0xe1 U+0410 +0xe2 U+0411 +0xe3 U+0426 +0xe4 U+0414 +0xe5 U+0415 +0xe6 U+0424 +0xe7 U+0413 +0xe8 U+0425 +0xe9 U+0418 +0xea U+0419 +0xeb U+041a +0xec U+041b +0xed U+041c +0xee U+041d +0xef U+041e +0xf0 U+041f +0xf1 U+042f +0xf2 U+0420 +0xf3 U+0421 +0xf4 U+0422 +0xf5 U+0423 +0xf6 U+0416 +0xf7 U+0412 +0xf8 U+042c +0xf9 U+042b +0xfa U+0417 +0xfb U+0428 +0xfc U+042d +0xfd U+0429 +0xfe U+0427 +0xff U+042a diff --git a/jdk/make/tools/CharsetMapping/KOI8_U.map b/jdk/make/tools/CharsetMapping/KOI8_U.map new file mode 100644 index 00000000000..1f91e8f832d --- /dev/null +++ b/jdk/make/tools/CharsetMapping/KOI8_U.map @@ -0,0 +1,257 @@ +#Generated from KOI8_U.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+2500 +0x81 U+2502 +0x82 U+250c +0x83 U+2510 +0x84 U+2514 +0x85 U+2518 +0x86 U+251c +0x87 U+2524 +0x88 U+252c +0x89 U+2534 +0x8a U+253c +0x8b U+2580 +0x8c U+2584 +0x8d U+2588 +0x8e U+258c +0x8f U+2590 +0x90 U+2591 +0x91 U+2592 +0x92 U+2593 +0x93 U+2320 +0x94 U+25a0 +0x95 U+2219 +0x96 U+221a +0x97 U+2248 +0x98 U+2264 +0x99 U+2265 +0x9a U+00a0 +0x9b U+2321 +0x9c U+00b0 +0x9d U+00b2 +0x9e U+00b7 +0x9f U+00f7 +0xa0 U+2550 +0xa1 U+2551 +0xa2 U+2552 +0xa3 U+0451 +0xa4 U+0454 +0xa5 U+2554 +0xa6 U+0456 +0xa7 U+0457 +0xa8 U+2557 +0xa9 U+2558 +0xaa U+2559 +0xab U+255a +0xac U+255b +0xad U+0491 +0xae U+255d +0xaf U+255e +0xb0 U+255f +0xb1 U+2560 +0xb2 U+2561 +0xb3 U+0401 +0xb4 U+0404 +0xb5 U+2563 +0xb6 U+0406 +0xb7 U+0407 +0xb8 U+2566 +0xb9 U+2567 +0xba U+2568 +0xbb U+2569 +0xbc U+256a +0xbd U+0490 +0xbe U+256c +0xbf U+00a9 +0xc0 U+044e +0xc1 U+0430 +0xc2 U+0431 +0xc3 U+0446 +0xc4 U+0434 +0xc5 U+0435 +0xc6 U+0444 +0xc7 U+0433 +0xc8 U+0445 +0xc9 U+0438 +0xca U+0439 +0xcb U+043a +0xcc U+043b +0xcd U+043c +0xce U+043d +0xcf U+043e +0xd0 U+043f +0xd1 U+044f +0xd2 U+0440 +0xd3 U+0441 +0xd4 U+0442 +0xd5 U+0443 +0xd6 U+0436 +0xd7 U+0432 +0xd8 U+044c +0xd9 U+044b +0xda U+0437 +0xdb U+0448 +0xdc U+044d +0xdd U+0449 +0xde U+0447 +0xdf U+044a +0xe0 U+042e +0xe1 U+0410 +0xe2 U+0411 +0xe3 U+0426 +0xe4 U+0414 +0xe5 U+0415 +0xe6 U+0424 +0xe7 U+0413 +0xe8 U+0425 +0xe9 U+0418 +0xea U+0419 +0xeb U+041a +0xec U+041b +0xed U+041c +0xee U+041d +0xef U+041e +0xf0 U+041f +0xf1 U+042f +0xf2 U+0420 +0xf3 U+0421 +0xf4 U+0422 +0xf5 U+0423 +0xf6 U+0416 +0xf7 U+0412 +0xf8 U+042c +0xf9 U+042b +0xfa U+0417 +0xfb U+0428 +0xfc U+042d +0xfd U+0429 +0xfe U+0427 +0xff U+042a diff --git a/jdk/make/tools/CharsetMapping/MS1250.map b/jdk/make/tools/CharsetMapping/MS1250.map new file mode 100644 index 00000000000..b88030738d7 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/MS1250.map @@ -0,0 +1,257 @@ +#Generated from MS1250.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+20ac +0x81 U+fffd +0x82 U+201a +0x83 U+fffd +0x84 U+201e +0x85 U+2026 +0x86 U+2020 +0x87 U+2021 +0x88 U+fffd +0x89 U+2030 +0x8a U+0160 +0x8b U+2039 +0x8c U+015a +0x8d U+0164 +0x8e U+017d +0x8f U+0179 +0x90 U+fffd +0x91 U+2018 +0x92 U+2019 +0x93 U+201c +0x94 U+201d +0x95 U+2022 +0x96 U+2013 +0x97 U+2014 +0x98 U+fffd +0x99 U+2122 +0x9a U+0161 +0x9b U+203a +0x9c U+015b +0x9d U+0165 +0x9e U+017e +0x9f U+017a +0xa0 U+00a0 +0xa1 U+02c7 +0xa2 U+02d8 +0xa3 U+0141 +0xa4 U+00a4 +0xa5 U+0104 +0xa6 U+00a6 +0xa7 U+00a7 +0xa8 U+00a8 +0xa9 U+00a9 +0xaa U+015e +0xab U+00ab +0xac U+00ac +0xad U+00ad +0xae U+00ae +0xaf U+017b +0xb0 U+00b0 +0xb1 U+00b1 +0xb2 U+02db +0xb3 U+0142 +0xb4 U+00b4 +0xb5 U+00b5 +0xb6 U+00b6 +0xb7 U+00b7 +0xb8 U+00b8 +0xb9 U+0105 +0xba U+015f +0xbb U+00bb +0xbc U+013d +0xbd U+02dd +0xbe U+013e +0xbf U+017c +0xc0 U+0154 +0xc1 U+00c1 +0xc2 U+00c2 +0xc3 U+0102 +0xc4 U+00c4 +0xc5 U+0139 +0xc6 U+0106 +0xc7 U+00c7 +0xc8 U+010c +0xc9 U+00c9 +0xca U+0118 +0xcb U+00cb +0xcc U+011a +0xcd U+00cd +0xce U+00ce +0xcf U+010e +0xd0 U+0110 +0xd1 U+0143 +0xd2 U+0147 +0xd3 U+00d3 +0xd4 U+00d4 +0xd5 U+0150 +0xd6 U+00d6 +0xd7 U+00d7 +0xd8 U+0158 +0xd9 U+016e +0xda U+00da +0xdb U+0170 +0xdc U+00dc +0xdd U+00dd +0xde U+0162 +0xdf U+00df +0xe0 U+0155 +0xe1 U+00e1 +0xe2 U+00e2 +0xe3 U+0103 +0xe4 U+00e4 +0xe5 U+013a +0xe6 U+0107 +0xe7 U+00e7 +0xe8 U+010d +0xe9 U+00e9 +0xea U+0119 +0xeb U+00eb +0xec U+011b +0xed U+00ed +0xee U+00ee +0xef U+010f +0xf0 U+0111 +0xf1 U+0144 +0xf2 U+0148 +0xf3 U+00f3 +0xf4 U+00f4 +0xf5 U+0151 +0xf6 U+00f6 +0xf7 U+00f7 +0xf8 U+0159 +0xf9 U+016f +0xfa U+00fa +0xfb U+0171 +0xfc U+00fc +0xfd U+00fd +0xfe U+0163 +0xff U+02d9 diff --git a/jdk/make/tools/CharsetMapping/MS1251.map b/jdk/make/tools/CharsetMapping/MS1251.map new file mode 100644 index 00000000000..97937f2d08e --- /dev/null +++ b/jdk/make/tools/CharsetMapping/MS1251.map @@ -0,0 +1,257 @@ +#Generated from MS1251.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+0402 +0x81 U+0403 +0x82 U+201a +0x83 U+0453 +0x84 U+201e +0x85 U+2026 +0x86 U+2020 +0x87 U+2021 +0x88 U+20ac +0x89 U+2030 +0x8a U+0409 +0x8b U+2039 +0x8c U+040a +0x8d U+040c +0x8e U+040b +0x8f U+040f +0x90 U+0452 +0x91 U+2018 +0x92 U+2019 +0x93 U+201c +0x94 U+201d +0x95 U+2022 +0x96 U+2013 +0x97 U+2014 +0x98 U+fffd +0x99 U+2122 +0x9a U+0459 +0x9b U+203a +0x9c U+045a +0x9d U+045c +0x9e U+045b +0x9f U+045f +0xa0 U+00a0 +0xa1 U+040e +0xa2 U+045e +0xa3 U+0408 +0xa4 U+00a4 +0xa5 U+0490 +0xa6 U+00a6 +0xa7 U+00a7 +0xa8 U+0401 +0xa9 U+00a9 +0xaa U+0404 +0xab U+00ab +0xac U+00ac +0xad U+00ad +0xae U+00ae +0xaf U+0407 +0xb0 U+00b0 +0xb1 U+00b1 +0xb2 U+0406 +0xb3 U+0456 +0xb4 U+0491 +0xb5 U+00b5 +0xb6 U+00b6 +0xb7 U+00b7 +0xb8 U+0451 +0xb9 U+2116 +0xba U+0454 +0xbb U+00bb +0xbc U+0458 +0xbd U+0405 +0xbe U+0455 +0xbf U+0457 +0xc0 U+0410 +0xc1 U+0411 +0xc2 U+0412 +0xc3 U+0413 +0xc4 U+0414 +0xc5 U+0415 +0xc6 U+0416 +0xc7 U+0417 +0xc8 U+0418 +0xc9 U+0419 +0xca U+041a +0xcb U+041b +0xcc U+041c +0xcd U+041d +0xce U+041e +0xcf U+041f +0xd0 U+0420 +0xd1 U+0421 +0xd2 U+0422 +0xd3 U+0423 +0xd4 U+0424 +0xd5 U+0425 +0xd6 U+0426 +0xd7 U+0427 +0xd8 U+0428 +0xd9 U+0429 +0xda U+042a +0xdb U+042b +0xdc U+042c +0xdd U+042d +0xde U+042e +0xdf U+042f +0xe0 U+0430 +0xe1 U+0431 +0xe2 U+0432 +0xe3 U+0433 +0xe4 U+0434 +0xe5 U+0435 +0xe6 U+0436 +0xe7 U+0437 +0xe8 U+0438 +0xe9 U+0439 +0xea U+043a +0xeb U+043b +0xec U+043c +0xed U+043d +0xee U+043e +0xef U+043f +0xf0 U+0440 +0xf1 U+0441 +0xf2 U+0442 +0xf3 U+0443 +0xf4 U+0444 +0xf5 U+0445 +0xf6 U+0446 +0xf7 U+0447 +0xf8 U+0448 +0xf9 U+0449 +0xfa U+044a +0xfb U+044b +0xfc U+044c +0xfd U+044d +0xfe U+044e +0xff U+044f diff --git a/jdk/make/tools/CharsetMapping/MS1252.map b/jdk/make/tools/CharsetMapping/MS1252.map new file mode 100644 index 00000000000..d339bc4988e --- /dev/null +++ b/jdk/make/tools/CharsetMapping/MS1252.map @@ -0,0 +1,257 @@ +#Generated from MS1252.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+20ac +0x81 U+fffd +0x82 U+201a +0x83 U+0192 +0x84 U+201e +0x85 U+2026 +0x86 U+2020 +0x87 U+2021 +0x88 U+02c6 +0x89 U+2030 +0x8a U+0160 +0x8b U+2039 +0x8c U+0152 +0x8d U+fffd +0x8e U+017d +0x8f U+fffd +0x90 U+fffd +0x91 U+2018 +0x92 U+2019 +0x93 U+201c +0x94 U+201d +0x95 U+2022 +0x96 U+2013 +0x97 U+2014 +0x98 U+02dc +0x99 U+2122 +0x9a U+0161 +0x9b U+203a +0x9c U+0153 +0x9d U+fffd +0x9e U+017e +0x9f U+0178 +0xa0 U+00a0 +0xa1 U+00a1 +0xa2 U+00a2 +0xa3 U+00a3 +0xa4 U+00a4 +0xa5 U+00a5 +0xa6 U+00a6 +0xa7 U+00a7 +0xa8 U+00a8 +0xa9 U+00a9 +0xaa U+00aa +0xab U+00ab +0xac U+00ac +0xad U+00ad +0xae U+00ae +0xaf U+00af +0xb0 U+00b0 +0xb1 U+00b1 +0xb2 U+00b2 +0xb3 U+00b3 +0xb4 U+00b4 +0xb5 U+00b5 +0xb6 U+00b6 +0xb7 U+00b7 +0xb8 U+00b8 +0xb9 U+00b9 +0xba U+00ba +0xbb U+00bb +0xbc U+00bc +0xbd U+00bd +0xbe U+00be +0xbf U+00bf +0xc0 U+00c0 +0xc1 U+00c1 +0xc2 U+00c2 +0xc3 U+00c3 +0xc4 U+00c4 +0xc5 U+00c5 +0xc6 U+00c6 +0xc7 U+00c7 +0xc8 U+00c8 +0xc9 U+00c9 +0xca U+00ca +0xcb U+00cb +0xcc U+00cc +0xcd U+00cd +0xce U+00ce +0xcf U+00cf +0xd0 U+00d0 +0xd1 U+00d1 +0xd2 U+00d2 +0xd3 U+00d3 +0xd4 U+00d4 +0xd5 U+00d5 +0xd6 U+00d6 +0xd7 U+00d7 +0xd8 U+00d8 +0xd9 U+00d9 +0xda U+00da +0xdb U+00db +0xdc U+00dc +0xdd U+00dd +0xde U+00de +0xdf U+00df +0xe0 U+00e0 +0xe1 U+00e1 +0xe2 U+00e2 +0xe3 U+00e3 +0xe4 U+00e4 +0xe5 U+00e5 +0xe6 U+00e6 +0xe7 U+00e7 +0xe8 U+00e8 +0xe9 U+00e9 +0xea U+00ea +0xeb U+00eb +0xec U+00ec +0xed U+00ed +0xee U+00ee +0xef U+00ef +0xf0 U+00f0 +0xf1 U+00f1 +0xf2 U+00f2 +0xf3 U+00f3 +0xf4 U+00f4 +0xf5 U+00f5 +0xf6 U+00f6 +0xf7 U+00f7 +0xf8 U+00f8 +0xf9 U+00f9 +0xfa U+00fa +0xfb U+00fb +0xfc U+00fc +0xfd U+00fd +0xfe U+00fe +0xff U+00ff diff --git a/jdk/make/tools/CharsetMapping/MS1253.map b/jdk/make/tools/CharsetMapping/MS1253.map new file mode 100644 index 00000000000..714e5cd8a9e --- /dev/null +++ b/jdk/make/tools/CharsetMapping/MS1253.map @@ -0,0 +1,257 @@ +#Generated from MS1253.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+20ac +0x81 U+fffd +0x82 U+201a +0x83 U+0192 +0x84 U+201e +0x85 U+2026 +0x86 U+2020 +0x87 U+2021 +0x88 U+fffd +0x89 U+2030 +0x8a U+fffd +0x8b U+2039 +0x8c U+fffd +0x8d U+fffd +0x8e U+fffd +0x8f U+fffd +0x90 U+fffd +0x91 U+2018 +0x92 U+2019 +0x93 U+201c +0x94 U+201d +0x95 U+2022 +0x96 U+2013 +0x97 U+2014 +0x98 U+fffd +0x99 U+2122 +0x9a U+fffd +0x9b U+203a +0x9c U+fffd +0x9d U+fffd +0x9e U+fffd +0x9f U+fffd +0xa0 U+00a0 +0xa1 U+0385 +0xa2 U+0386 +0xa3 U+00a3 +0xa4 U+00a4 +0xa5 U+00a5 +0xa6 U+00a6 +0xa7 U+00a7 +0xa8 U+00a8 +0xa9 U+00a9 +0xaa U+fffd +0xab U+00ab +0xac U+00ac +0xad U+00ad +0xae U+00ae +0xaf U+2015 +0xb0 U+00b0 +0xb1 U+00b1 +0xb2 U+00b2 +0xb3 U+00b3 +0xb4 U+0384 +0xb5 U+00b5 +0xb6 U+00b6 +0xb7 U+00b7 +0xb8 U+0388 +0xb9 U+0389 +0xba U+038a +0xbb U+00bb +0xbc U+038c +0xbd U+00bd +0xbe U+038e +0xbf U+038f +0xc0 U+0390 +0xc1 U+0391 +0xc2 U+0392 +0xc3 U+0393 +0xc4 U+0394 +0xc5 U+0395 +0xc6 U+0396 +0xc7 U+0397 +0xc8 U+0398 +0xc9 U+0399 +0xca U+039a +0xcb U+039b +0xcc U+039c +0xcd U+039d +0xce U+039e +0xcf U+039f +0xd0 U+03a0 +0xd1 U+03a1 +0xd2 U+fffd +0xd3 U+03a3 +0xd4 U+03a4 +0xd5 U+03a5 +0xd6 U+03a6 +0xd7 U+03a7 +0xd8 U+03a8 +0xd9 U+03a9 +0xda U+03aa +0xdb U+03ab +0xdc U+03ac +0xdd U+03ad +0xde U+03ae +0xdf U+03af +0xe0 U+03b0 +0xe1 U+03b1 +0xe2 U+03b2 +0xe3 U+03b3 +0xe4 U+03b4 +0xe5 U+03b5 +0xe6 U+03b6 +0xe7 U+03b7 +0xe8 U+03b8 +0xe9 U+03b9 +0xea U+03ba +0xeb U+03bb +0xec U+03bc +0xed U+03bd +0xee U+03be +0xef U+03bf +0xf0 U+03c0 +0xf1 U+03c1 +0xf2 U+03c2 +0xf3 U+03c3 +0xf4 U+03c4 +0xf5 U+03c5 +0xf6 U+03c6 +0xf7 U+03c7 +0xf8 U+03c8 +0xf9 U+03c9 +0xfa U+03ca +0xfb U+03cb +0xfc U+03cc +0xfd U+03cd +0xfe U+03ce +0xff U+fffd diff --git a/jdk/make/tools/CharsetMapping/MS1254.map b/jdk/make/tools/CharsetMapping/MS1254.map new file mode 100644 index 00000000000..d28277579b3 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/MS1254.map @@ -0,0 +1,257 @@ +#Generated from MS1254.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+20ac +0x81 U+fffd +0x82 U+201a +0x83 U+0192 +0x84 U+201e +0x85 U+2026 +0x86 U+2020 +0x87 U+2021 +0x88 U+02c6 +0x89 U+2030 +0x8a U+0160 +0x8b U+2039 +0x8c U+0152 +0x8d U+fffd +0x8e U+fffd +0x8f U+fffd +0x90 U+fffd +0x91 U+2018 +0x92 U+2019 +0x93 U+201c +0x94 U+201d +0x95 U+2022 +0x96 U+2013 +0x97 U+2014 +0x98 U+02dc +0x99 U+2122 +0x9a U+0161 +0x9b U+203a +0x9c U+0153 +0x9d U+fffd +0x9e U+fffd +0x9f U+0178 +0xa0 U+00a0 +0xa1 U+00a1 +0xa2 U+00a2 +0xa3 U+00a3 +0xa4 U+00a4 +0xa5 U+00a5 +0xa6 U+00a6 +0xa7 U+00a7 +0xa8 U+00a8 +0xa9 U+00a9 +0xaa U+00aa +0xab U+00ab +0xac U+00ac +0xad U+00ad +0xae U+00ae +0xaf U+00af +0xb0 U+00b0 +0xb1 U+00b1 +0xb2 U+00b2 +0xb3 U+00b3 +0xb4 U+00b4 +0xb5 U+00b5 +0xb6 U+00b6 +0xb7 U+00b7 +0xb8 U+00b8 +0xb9 U+00b9 +0xba U+00ba +0xbb U+00bb +0xbc U+00bc +0xbd U+00bd +0xbe U+00be +0xbf U+00bf +0xc0 U+00c0 +0xc1 U+00c1 +0xc2 U+00c2 +0xc3 U+00c3 +0xc4 U+00c4 +0xc5 U+00c5 +0xc6 U+00c6 +0xc7 U+00c7 +0xc8 U+00c8 +0xc9 U+00c9 +0xca U+00ca +0xcb U+00cb +0xcc U+00cc +0xcd U+00cd +0xce U+00ce +0xcf U+00cf +0xd0 U+011e +0xd1 U+00d1 +0xd2 U+00d2 +0xd3 U+00d3 +0xd4 U+00d4 +0xd5 U+00d5 +0xd6 U+00d6 +0xd7 U+00d7 +0xd8 U+00d8 +0xd9 U+00d9 +0xda U+00da +0xdb U+00db +0xdc U+00dc +0xdd U+0130 +0xde U+015e +0xdf U+00df +0xe0 U+00e0 +0xe1 U+00e1 +0xe2 U+00e2 +0xe3 U+00e3 +0xe4 U+00e4 +0xe5 U+00e5 +0xe6 U+00e6 +0xe7 U+00e7 +0xe8 U+00e8 +0xe9 U+00e9 +0xea U+00ea +0xeb U+00eb +0xec U+00ec +0xed U+00ed +0xee U+00ee +0xef U+00ef +0xf0 U+011f +0xf1 U+00f1 +0xf2 U+00f2 +0xf3 U+00f3 +0xf4 U+00f4 +0xf5 U+00f5 +0xf6 U+00f6 +0xf7 U+00f7 +0xf8 U+00f8 +0xf9 U+00f9 +0xfa U+00fa +0xfb U+00fb +0xfc U+00fc +0xfd U+0131 +0xfe U+015f +0xff U+00ff diff --git a/jdk/make/tools/CharsetMapping/MS1255.map b/jdk/make/tools/CharsetMapping/MS1255.map new file mode 100644 index 00000000000..e2d2d3531a0 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/MS1255.map @@ -0,0 +1,257 @@ +#Generated from MS1255.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+20ac +0x81 U+fffd +0x82 U+201a +0x83 U+0192 +0x84 U+201e +0x85 U+2026 +0x86 U+2020 +0x87 U+2021 +0x88 U+02c6 +0x89 U+2030 +0x8a U+fffd +0x8b U+2039 +0x8c U+fffd +0x8d U+fffd +0x8e U+fffd +0x8f U+fffd +0x90 U+fffd +0x91 U+2018 +0x92 U+2019 +0x93 U+201c +0x94 U+201d +0x95 U+2022 +0x96 U+2013 +0x97 U+2014 +0x98 U+02dc +0x99 U+2122 +0x9a U+fffd +0x9b U+203a +0x9c U+fffd +0x9d U+fffd +0x9e U+fffd +0x9f U+fffd +0xa0 U+00a0 +0xa1 U+00a1 +0xa2 U+00a2 +0xa3 U+00a3 +0xa4 U+20aa +0xa5 U+00a5 +0xa6 U+00a6 +0xa7 U+00a7 +0xa8 U+00a8 +0xa9 U+00a9 +0xaa U+00d7 +0xab U+00ab +0xac U+00ac +0xad U+00ad +0xae U+00ae +0xaf U+00af +0xb0 U+00b0 +0xb1 U+00b1 +0xb2 U+00b2 +0xb3 U+00b3 +0xb4 U+00b4 +0xb5 U+00b5 +0xb6 U+00b6 +0xb7 U+00b7 +0xb8 U+00b8 +0xb9 U+00b9 +0xba U+00f7 +0xbb U+00bb +0xbc U+00bc +0xbd U+00bd +0xbe U+00be +0xbf U+00bf +0xc0 U+05b0 +0xc1 U+05b1 +0xc2 U+05b2 +0xc3 U+05b3 +0xc4 U+05b4 +0xc5 U+05b5 +0xc6 U+05b6 +0xc7 U+05b7 +0xc8 U+05b8 +0xc9 U+05b9 +0xca U+fffd +0xcb U+05bb +0xcc U+05bc +0xcd U+05bd +0xce U+05be +0xcf U+05bf +0xd0 U+05c0 +0xd1 U+05c1 +0xd2 U+05c2 +0xd3 U+05c3 +0xd4 U+05f0 +0xd5 U+05f1 +0xd6 U+05f2 +0xd7 U+05f3 +0xd8 U+05f4 +0xd9 U+fffd +0xda U+fffd +0xdb U+fffd +0xdc U+fffd +0xdd U+fffd +0xde U+fffd +0xdf U+fffd +0xe0 U+05d0 +0xe1 U+05d1 +0xe2 U+05d2 +0xe3 U+05d3 +0xe4 U+05d4 +0xe5 U+05d5 +0xe6 U+05d6 +0xe7 U+05d7 +0xe8 U+05d8 +0xe9 U+05d9 +0xea U+05da +0xeb U+05db +0xec U+05dc +0xed U+05dd +0xee U+05de +0xef U+05df +0xf0 U+05e0 +0xf1 U+05e1 +0xf2 U+05e2 +0xf3 U+05e3 +0xf4 U+05e4 +0xf5 U+05e5 +0xf6 U+05e6 +0xf7 U+05e7 +0xf8 U+05e8 +0xf9 U+05e9 +0xfa U+05ea +0xfb U+fffd +0xfc U+fffd +0xfd U+200e +0xfe U+200f +0xff U+fffd diff --git a/jdk/make/tools/CharsetMapping/MS1256.map b/jdk/make/tools/CharsetMapping/MS1256.map new file mode 100644 index 00000000000..6e0142c4d18 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/MS1256.map @@ -0,0 +1,257 @@ +#Generated from MS1256.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+20ac +0x81 U+067e +0x82 U+201a +0x83 U+0192 +0x84 U+201e +0x85 U+2026 +0x86 U+2020 +0x87 U+2021 +0x88 U+02c6 +0x89 U+2030 +0x8a U+0679 +0x8b U+2039 +0x8c U+0152 +0x8d U+0686 +0x8e U+0698 +0x8f U+0688 +0x90 U+06af +0x91 U+2018 +0x92 U+2019 +0x93 U+201c +0x94 U+201d +0x95 U+2022 +0x96 U+2013 +0x97 U+2014 +0x98 U+06a9 +0x99 U+2122 +0x9a U+0691 +0x9b U+203a +0x9c U+0153 +0x9d U+200c +0x9e U+200d +0x9f U+06ba +0xa0 U+00a0 +0xa1 U+060c +0xa2 U+00a2 +0xa3 U+00a3 +0xa4 U+00a4 +0xa5 U+00a5 +0xa6 U+00a6 +0xa7 U+00a7 +0xa8 U+00a8 +0xa9 U+00a9 +0xaa U+06be +0xab U+00ab +0xac U+00ac +0xad U+00ad +0xae U+00ae +0xaf U+00af +0xb0 U+00b0 +0xb1 U+00b1 +0xb2 U+00b2 +0xb3 U+00b3 +0xb4 U+00b4 +0xb5 U+00b5 +0xb6 U+00b6 +0xb7 U+00b7 +0xb8 U+00b8 +0xb9 U+00b9 +0xba U+061b +0xbb U+00bb +0xbc U+00bc +0xbd U+00bd +0xbe U+00be +0xbf U+061f +0xc0 U+06c1 +0xc1 U+0621 +0xc2 U+0622 +0xc3 U+0623 +0xc4 U+0624 +0xc5 U+0625 +0xc6 U+0626 +0xc7 U+0627 +0xc8 U+0628 +0xc9 U+0629 +0xca U+062a +0xcb U+062b +0xcc U+062c +0xcd U+062d +0xce U+062e +0xcf U+062f +0xd0 U+0630 +0xd1 U+0631 +0xd2 U+0632 +0xd3 U+0633 +0xd4 U+0634 +0xd5 U+0635 +0xd6 U+0636 +0xd7 U+00d7 +0xd8 U+0637 +0xd9 U+0638 +0xda U+0639 +0xdb U+063a +0xdc U+0640 +0xdd U+0641 +0xde U+0642 +0xdf U+0643 +0xe0 U+00e0 +0xe1 U+0644 +0xe2 U+00e2 +0xe3 U+0645 +0xe4 U+0646 +0xe5 U+0647 +0xe6 U+0648 +0xe7 U+00e7 +0xe8 U+00e8 +0xe9 U+00e9 +0xea U+00ea +0xeb U+00eb +0xec U+0649 +0xed U+064a +0xee U+00ee +0xef U+00ef +0xf0 U+064b +0xf1 U+064c +0xf2 U+064d +0xf3 U+064e +0xf4 U+00f4 +0xf5 U+064f +0xf6 U+0650 +0xf7 U+00f7 +0xf8 U+0651 +0xf9 U+00f9 +0xfa U+0652 +0xfb U+00fb +0xfc U+00fc +0xfd U+200e +0xfe U+200f +0xff U+06d2 diff --git a/jdk/make/tools/CharsetMapping/MS1257.map b/jdk/make/tools/CharsetMapping/MS1257.map new file mode 100644 index 00000000000..9315f2450f4 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/MS1257.map @@ -0,0 +1,257 @@ +#Generated from MS1257.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+20ac +0x81 U+fffd +0x82 U+201a +0x83 U+fffd +0x84 U+201e +0x85 U+2026 +0x86 U+2020 +0x87 U+2021 +0x88 U+fffd +0x89 U+2030 +0x8a U+fffd +0x8b U+2039 +0x8c U+fffd +0x8d U+00a8 +0x8e U+02c7 +0x8f U+00b8 +0x90 U+fffd +0x91 U+2018 +0x92 U+2019 +0x93 U+201c +0x94 U+201d +0x95 U+2022 +0x96 U+2013 +0x97 U+2014 +0x98 U+fffd +0x99 U+2122 +0x9a U+fffd +0x9b U+203a +0x9c U+fffd +0x9d U+00af +0x9e U+02db +0x9f U+fffd +0xa0 U+00a0 +0xa1 U+fffd +0xa2 U+00a2 +0xa3 U+00a3 +0xa4 U+00a4 +0xa5 U+fffd +0xa6 U+00a6 +0xa7 U+00a7 +0xa8 U+00d8 +0xa9 U+00a9 +0xaa U+0156 +0xab U+00ab +0xac U+00ac +0xad U+00ad +0xae U+00ae +0xaf U+00c6 +0xb0 U+00b0 +0xb1 U+00b1 +0xb2 U+00b2 +0xb3 U+00b3 +0xb4 U+00b4 +0xb5 U+00b5 +0xb6 U+00b6 +0xb7 U+00b7 +0xb8 U+00f8 +0xb9 U+00b9 +0xba U+0157 +0xbb U+00bb +0xbc U+00bc +0xbd U+00bd +0xbe U+00be +0xbf U+00e6 +0xc0 U+0104 +0xc1 U+012e +0xc2 U+0100 +0xc3 U+0106 +0xc4 U+00c4 +0xc5 U+00c5 +0xc6 U+0118 +0xc7 U+0112 +0xc8 U+010c +0xc9 U+00c9 +0xca U+0179 +0xcb U+0116 +0xcc U+0122 +0xcd U+0136 +0xce U+012a +0xcf U+013b +0xd0 U+0160 +0xd1 U+0143 +0xd2 U+0145 +0xd3 U+00d3 +0xd4 U+014c +0xd5 U+00d5 +0xd6 U+00d6 +0xd7 U+00d7 +0xd8 U+0172 +0xd9 U+0141 +0xda U+015a +0xdb U+016a +0xdc U+00dc +0xdd U+017b +0xde U+017d +0xdf U+00df +0xe0 U+0105 +0xe1 U+012f +0xe2 U+0101 +0xe3 U+0107 +0xe4 U+00e4 +0xe5 U+00e5 +0xe6 U+0119 +0xe7 U+0113 +0xe8 U+010d +0xe9 U+00e9 +0xea U+017a +0xeb U+0117 +0xec U+0123 +0xed U+0137 +0xee U+012b +0xef U+013c +0xf0 U+0161 +0xf1 U+0144 +0xf2 U+0146 +0xf3 U+00f3 +0xf4 U+014d +0xf5 U+00f5 +0xf6 U+00f6 +0xf7 U+00f7 +0xf8 U+0173 +0xf9 U+0142 +0xfa U+015b +0xfb U+016b +0xfc U+00fc +0xfd U+017c +0xfe U+017e +0xff U+02d9 diff --git a/jdk/make/tools/CharsetMapping/MS1258.map b/jdk/make/tools/CharsetMapping/MS1258.map new file mode 100644 index 00000000000..b557cedeaa1 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/MS1258.map @@ -0,0 +1,257 @@ +#Generated from MS1258.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+20ac +0x81 U+fffd +0x82 U+201a +0x83 U+0192 +0x84 U+201e +0x85 U+2026 +0x86 U+2020 +0x87 U+2021 +0x88 U+02c6 +0x89 U+2030 +0x8a U+fffd +0x8b U+2039 +0x8c U+0152 +0x8d U+fffd +0x8e U+fffd +0x8f U+fffd +0x90 U+fffd +0x91 U+2018 +0x92 U+2019 +0x93 U+201c +0x94 U+201d +0x95 U+2022 +0x96 U+2013 +0x97 U+2014 +0x98 U+02dc +0x99 U+2122 +0x9a U+fffd +0x9b U+203a +0x9c U+0153 +0x9d U+fffd +0x9e U+fffd +0x9f U+0178 +0xa0 U+00a0 +0xa1 U+00a1 +0xa2 U+00a2 +0xa3 U+00a3 +0xa4 U+00a4 +0xa5 U+00a5 +0xa6 U+00a6 +0xa7 U+00a7 +0xa8 U+00a8 +0xa9 U+00a9 +0xaa U+00aa +0xab U+00ab +0xac U+00ac +0xad U+00ad +0xae U+00ae +0xaf U+00af +0xb0 U+00b0 +0xb1 U+00b1 +0xb2 U+00b2 +0xb3 U+00b3 +0xb4 U+00b4 +0xb5 U+00b5 +0xb6 U+00b6 +0xb7 U+00b7 +0xb8 U+00b8 +0xb9 U+00b9 +0xba U+00ba +0xbb U+00bb +0xbc U+00bc +0xbd U+00bd +0xbe U+00be +0xbf U+00bf +0xc0 U+00c0 +0xc1 U+00c1 +0xc2 U+00c2 +0xc3 U+0102 +0xc4 U+00c4 +0xc5 U+00c5 +0xc6 U+00c6 +0xc7 U+00c7 +0xc8 U+00c8 +0xc9 U+00c9 +0xca U+00ca +0xcb U+00cb +0xcc U+0300 +0xcd U+00cd +0xce U+00ce +0xcf U+00cf +0xd0 U+0110 +0xd1 U+00d1 +0xd2 U+0309 +0xd3 U+00d3 +0xd4 U+00d4 +0xd5 U+01a0 +0xd6 U+00d6 +0xd7 U+00d7 +0xd8 U+00d8 +0xd9 U+00d9 +0xda U+00da +0xdb U+00db +0xdc U+00dc +0xdd U+01af +0xde U+0303 +0xdf U+00df +0xe0 U+00e0 +0xe1 U+00e1 +0xe2 U+00e2 +0xe3 U+0103 +0xe4 U+00e4 +0xe5 U+00e5 +0xe6 U+00e6 +0xe7 U+00e7 +0xe8 U+00e8 +0xe9 U+00e9 +0xea U+00ea +0xeb U+00eb +0xec U+0301 +0xed U+00ed +0xee U+00ee +0xef U+00ef +0xf0 U+0111 +0xf1 U+00f1 +0xf2 U+0323 +0xf3 U+00f3 +0xf4 U+00f4 +0xf5 U+01a1 +0xf6 U+00f6 +0xf7 U+00f7 +0xf8 U+00f8 +0xf9 U+00f9 +0xfa U+00fa +0xfb U+00fb +0xfc U+00fc +0xfd U+01b0 +0xfe U+20ab +0xff U+00ff diff --git a/jdk/make/tools/CharsetMapping/MS874.map b/jdk/make/tools/CharsetMapping/MS874.map new file mode 100644 index 00000000000..2e59d0c0ab7 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/MS874.map @@ -0,0 +1,257 @@ +#Generated from MS874.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+20ac +0x81 U+fffd +0x82 U+fffd +0x83 U+fffd +0x84 U+fffd +0x85 U+2026 +0x86 U+fffd +0x87 U+fffd +0x88 U+fffd +0x89 U+fffd +0x8a U+fffd +0x8b U+fffd +0x8c U+fffd +0x8d U+fffd +0x8e U+fffd +0x8f U+fffd +0x90 U+fffd +0x91 U+2018 +0x92 U+2019 +0x93 U+201c +0x94 U+201d +0x95 U+2022 +0x96 U+2013 +0x97 U+2014 +0x98 U+fffd +0x99 U+fffd +0x9a U+fffd +0x9b U+fffd +0x9c U+fffd +0x9d U+fffd +0x9e U+fffd +0x9f U+fffd +0xa0 U+00a0 +0xa1 U+0e01 +0xa2 U+0e02 +0xa3 U+0e03 +0xa4 U+0e04 +0xa5 U+0e05 +0xa6 U+0e06 +0xa7 U+0e07 +0xa8 U+0e08 +0xa9 U+0e09 +0xaa U+0e0a +0xab U+0e0b +0xac U+0e0c +0xad U+0e0d +0xae U+0e0e +0xaf U+0e0f +0xb0 U+0e10 +0xb1 U+0e11 +0xb2 U+0e12 +0xb3 U+0e13 +0xb4 U+0e14 +0xb5 U+0e15 +0xb6 U+0e16 +0xb7 U+0e17 +0xb8 U+0e18 +0xb9 U+0e19 +0xba U+0e1a +0xbb U+0e1b +0xbc U+0e1c +0xbd U+0e1d +0xbe U+0e1e +0xbf U+0e1f +0xc0 U+0e20 +0xc1 U+0e21 +0xc2 U+0e22 +0xc3 U+0e23 +0xc4 U+0e24 +0xc5 U+0e25 +0xc6 U+0e26 +0xc7 U+0e27 +0xc8 U+0e28 +0xc9 U+0e29 +0xca U+0e2a +0xcb U+0e2b +0xcc U+0e2c +0xcd U+0e2d +0xce U+0e2e +0xcf U+0e2f +0xd0 U+0e30 +0xd1 U+0e31 +0xd2 U+0e32 +0xd3 U+0e33 +0xd4 U+0e34 +0xd5 U+0e35 +0xd6 U+0e36 +0xd7 U+0e37 +0xd8 U+0e38 +0xd9 U+0e39 +0xda U+0e3a +0xdb U+fffd +0xdc U+fffd +0xdd U+fffd +0xde U+fffd +0xdf U+0e3f +0xe0 U+0e40 +0xe1 U+0e41 +0xe2 U+0e42 +0xe3 U+0e43 +0xe4 U+0e44 +0xe5 U+0e45 +0xe6 U+0e46 +0xe7 U+0e47 +0xe8 U+0e48 +0xe9 U+0e49 +0xea U+0e4a +0xeb U+0e4b +0xec U+0e4c +0xed U+0e4d +0xee U+0e4e +0xef U+0e4f +0xf0 U+0e50 +0xf1 U+0e51 +0xf2 U+0e52 +0xf3 U+0e53 +0xf4 U+0e54 +0xf5 U+0e55 +0xf6 U+0e56 +0xf7 U+0e57 +0xf8 U+0e58 +0xf9 U+0e59 +0xfa U+0e5a +0xfb U+0e5b +0xfc U+fffd +0xfd U+fffd +0xfe U+fffd +0xff U+fffd diff --git a/jdk/make/tools/CharsetMapping/MacArabic.map b/jdk/make/tools/CharsetMapping/MacArabic.map new file mode 100644 index 00000000000..eff2b0fdb70 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/MacArabic.map @@ -0,0 +1,257 @@ +#Generated from MacArabic.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+00c4 +0x81 U+00a0 +0x82 U+00c7 +0x83 U+00c9 +0x84 U+00d1 +0x85 U+00d6 +0x86 U+00dc +0x87 U+00e1 +0x88 U+00e0 +0x89 U+00e2 +0x8a U+00e4 +0x8b U+06ba +0x8c U+00ab +0x8d U+00e7 +0x8e U+00e9 +0x8f U+00e8 +0x90 U+00ea +0x91 U+00eb +0x92 U+00ed +0x93 U+2026 +0x94 U+00ee +0x95 U+00ef +0x96 U+00f1 +0x97 U+00f3 +0x98 U+00bb +0x99 U+00f4 +0x9a U+00f6 +0x9b U+00f7 +0x9c U+00fa +0x9d U+00f9 +0x9e U+00fb +0x9f U+00fc +0xa0 U+fffd +0xa1 U+fffd +0xa2 U+fffd +0xa3 U+fffd +0xa4 U+fffd +0xa5 U+066a +0xa6 U+fffd +0xa7 U+fffd +0xa8 U+fffd +0xa9 U+fffd +0xaa U+fffd +0xab U+fffd +0xac U+060c +0xad U+fffd +0xae U+fffd +0xaf U+fffd +0xb0 U+0660 +0xb1 U+0661 +0xb2 U+0662 +0xb3 U+0663 +0xb4 U+0664 +0xb5 U+0665 +0xb6 U+0666 +0xb7 U+0667 +0xb8 U+0668 +0xb9 U+0669 +0xba U+fffd +0xbb U+061b +0xbc U+fffd +0xbd U+fffd +0xbe U+fffd +0xbf U+061f +0xc0 U+066d +0xc1 U+0621 +0xc2 U+0622 +0xc3 U+0623 +0xc4 U+0624 +0xc5 U+0625 +0xc6 U+0626 +0xc7 U+0627 +0xc8 U+0628 +0xc9 U+0629 +0xca U+062a +0xcb U+062b +0xcc U+062c +0xcd U+062d +0xce U+062e +0xcf U+062f +0xd0 U+0630 +0xd1 U+0631 +0xd2 U+0632 +0xd3 U+0633 +0xd4 U+0634 +0xd5 U+0635 +0xd6 U+0636 +0xd7 U+0637 +0xd8 U+0638 +0xd9 U+0639 +0xda U+063a +0xdb U+fffd +0xdc U+fffd +0xdd U+fffd +0xde U+fffd +0xdf U+fffd +0xe0 U+0640 +0xe1 U+0641 +0xe2 U+0642 +0xe3 U+0643 +0xe4 U+0644 +0xe5 U+0645 +0xe6 U+0646 +0xe7 U+0647 +0xe8 U+0648 +0xe9 U+0649 +0xea U+064a +0xeb U+064b +0xec U+064c +0xed U+064d +0xee U+064e +0xef U+064f +0xf0 U+0650 +0xf1 U+0651 +0xf2 U+0652 +0xf3 U+067e +0xf4 U+0679 +0xf5 U+0686 +0xf6 U+06d5 +0xf7 U+06a4 +0xf8 U+06af +0xf9 U+0688 +0xfa U+0691 +0xfb U+fffd +0xfc U+fffd +0xfd U+fffd +0xfe U+0698 +0xff U+06d2 diff --git a/jdk/make/tools/CharsetMapping/MacCentralEurope.map b/jdk/make/tools/CharsetMapping/MacCentralEurope.map new file mode 100644 index 00000000000..0cc49633493 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/MacCentralEurope.map @@ -0,0 +1,257 @@ +#Generated from MacCentralEurope.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+00c4 +0x81 U+0100 +0x82 U+0101 +0x83 U+00c9 +0x84 U+0104 +0x85 U+00d6 +0x86 U+00dc +0x87 U+00e1 +0x88 U+0105 +0x89 U+010c +0x8a U+00e4 +0x8b U+010d +0x8c U+0106 +0x8d U+0107 +0x8e U+00e9 +0x8f U+0179 +0x90 U+017a +0x91 U+010e +0x92 U+00ed +0x93 U+010f +0x94 U+0112 +0x95 U+0113 +0x96 U+0116 +0x97 U+00f3 +0x98 U+0117 +0x99 U+00f4 +0x9a U+00f6 +0x9b U+00f5 +0x9c U+00fa +0x9d U+011a +0x9e U+011b +0x9f U+00fc +0xa0 U+2020 +0xa1 U+00b0 +0xa2 U+0118 +0xa3 U+00a3 +0xa4 U+00a7 +0xa5 U+2022 +0xa6 U+00b6 +0xa7 U+00df +0xa8 U+00ae +0xa9 U+00a9 +0xaa U+2122 +0xab U+0119 +0xac U+00a8 +0xad U+2260 +0xae U+0123 +0xaf U+012e +0xb0 U+012f +0xb1 U+012a +0xb2 U+2264 +0xb3 U+2265 +0xb4 U+012b +0xb5 U+0136 +0xb6 U+2202 +0xb7 U+2211 +0xb8 U+0142 +0xb9 U+013b +0xba U+013c +0xbb U+013d +0xbc U+013e +0xbd U+0139 +0xbe U+013a +0xbf U+0145 +0xc0 U+0146 +0xc1 U+0143 +0xc2 U+00ac +0xc3 U+221a +0xc4 U+0144 +0xc5 U+0147 +0xc6 U+2206 +0xc7 U+00ab +0xc8 U+00bb +0xc9 U+2026 +0xca U+00a0 +0xcb U+0148 +0xcc U+0150 +0xcd U+00d5 +0xce U+0151 +0xcf U+014c +0xd0 U+2013 +0xd1 U+2014 +0xd2 U+201c +0xd3 U+201d +0xd4 U+2018 +0xd5 U+2019 +0xd6 U+00f7 +0xd7 U+25ca +0xd8 U+014d +0xd9 U+0154 +0xda U+0155 +0xdb U+0158 +0xdc U+2039 +0xdd U+203a +0xde U+0159 +0xdf U+0156 +0xe0 U+0157 +0xe1 U+0160 +0xe2 U+201a +0xe3 U+201e +0xe4 U+0161 +0xe5 U+015a +0xe6 U+015b +0xe7 U+00c1 +0xe8 U+0164 +0xe9 U+0165 +0xea U+00cd +0xeb U+017d +0xec U+017e +0xed U+016a +0xee U+00d3 +0xef U+00d4 +0xf0 U+016b +0xf1 U+016e +0xf2 U+00da +0xf3 U+016f +0xf4 U+0170 +0xf5 U+0171 +0xf6 U+0172 +0xf7 U+0173 +0xf8 U+00dd +0xf9 U+00fd +0xfa U+0137 +0xfb U+017b +0xfc U+0141 +0xfd U+017c +0xfe U+0122 +0xff U+02c7 diff --git a/jdk/make/tools/CharsetMapping/MacCroatian.map b/jdk/make/tools/CharsetMapping/MacCroatian.map new file mode 100644 index 00000000000..25b1bbf0850 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/MacCroatian.map @@ -0,0 +1,257 @@ +#Generated from MacCroatian.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+00c4 +0x81 U+00c5 +0x82 U+00c7 +0x83 U+00c9 +0x84 U+00d1 +0x85 U+00d6 +0x86 U+00dc +0x87 U+00e1 +0x88 U+00e0 +0x89 U+00e2 +0x8a U+00e4 +0x8b U+00e3 +0x8c U+00e5 +0x8d U+00e7 +0x8e U+00e9 +0x8f U+00e8 +0x90 U+00ea +0x91 U+00eb +0x92 U+00ed +0x93 U+00ec +0x94 U+00ee +0x95 U+00ef +0x96 U+00f1 +0x97 U+00f3 +0x98 U+00f2 +0x99 U+00f4 +0x9a U+00f6 +0x9b U+00f5 +0x9c U+00fa +0x9d U+00f9 +0x9e U+00fb +0x9f U+00fc +0xa0 U+2020 +0xa1 U+00b0 +0xa2 U+00a2 +0xa3 U+00a3 +0xa4 U+00a7 +0xa5 U+2022 +0xa6 U+00b6 +0xa7 U+00df +0xa8 U+00ae +0xa9 U+0160 +0xaa U+2122 +0xab U+00b4 +0xac U+00a8 +0xad U+2260 +0xae U+017d +0xaf U+00d8 +0xb0 U+221e +0xb1 U+00b1 +0xb2 U+2264 +0xb3 U+2265 +0xb4 U+2206 +0xb5 U+00b5 +0xb6 U+2202 +0xb7 U+2211 +0xb8 U+220f +0xb9 U+0161 +0xba U+222b +0xbb U+00aa +0xbc U+00ba +0xbd U+2126 +0xbe U+017e +0xbf U+00f8 +0xc0 U+00bf +0xc1 U+00a1 +0xc2 U+00ac +0xc3 U+221a +0xc4 U+0192 +0xc5 U+2248 +0xc6 U+0106 +0xc7 U+00ab +0xc8 U+010c +0xc9 U+2026 +0xca U+00a0 +0xcb U+00c0 +0xcc U+00c3 +0xcd U+00d5 +0xce U+0152 +0xcf U+0153 +0xd0 U+0110 +0xd1 U+2014 +0xd2 U+201c +0xd3 U+201d +0xd4 U+2018 +0xd5 U+2019 +0xd6 U+00f7 +0xd7 U+25ca +0xd8 U+f8ff +0xd9 U+00a9 +0xda U+2044 +0xdb U+00a4 +0xdc U+2039 +0xdd U+203a +0xde U+00c6 +0xdf U+00bb +0xe0 U+2013 +0xe1 U+00b7 +0xe2 U+201a +0xe3 U+201e +0xe4 U+2030 +0xe5 U+00c2 +0xe6 U+0107 +0xe7 U+00c1 +0xe8 U+010d +0xe9 U+00c8 +0xea U+00cd +0xeb U+00ce +0xec U+00cf +0xed U+00cc +0xee U+00d3 +0xef U+00d4 +0xf0 U+0111 +0xf1 U+00d2 +0xf2 U+00da +0xf3 U+00db +0xf4 U+00d9 +0xf5 U+0131 +0xf6 U+02c6 +0xf7 U+02dc +0xf8 U+00af +0xf9 U+03c0 +0xfa U+00cb +0xfb U+02da +0xfc U+00b8 +0xfd U+00ca +0xfe U+00e6 +0xff U+02c7 diff --git a/jdk/make/tools/CharsetMapping/MacCyrillic.map b/jdk/make/tools/CharsetMapping/MacCyrillic.map new file mode 100644 index 00000000000..ab2ff857b0f --- /dev/null +++ b/jdk/make/tools/CharsetMapping/MacCyrillic.map @@ -0,0 +1,257 @@ +#Generated from MacCyrillic.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+0410 +0x81 U+0411 +0x82 U+0412 +0x83 U+0413 +0x84 U+0414 +0x85 U+0415 +0x86 U+0416 +0x87 U+0417 +0x88 U+0418 +0x89 U+0419 +0x8a U+041a +0x8b U+041b +0x8c U+041c +0x8d U+041d +0x8e U+041e +0x8f U+041f +0x90 U+0420 +0x91 U+0421 +0x92 U+0422 +0x93 U+0423 +0x94 U+0424 +0x95 U+0425 +0x96 U+0426 +0x97 U+0427 +0x98 U+0428 +0x99 U+0429 +0x9a U+042a +0x9b U+042b +0x9c U+042c +0x9d U+042d +0x9e U+042e +0x9f U+042f +0xa0 U+2020 +0xa1 U+00b0 +0xa2 U+00a2 +0xa3 U+00a3 +0xa4 U+00a7 +0xa5 U+2022 +0xa6 U+00b6 +0xa7 U+0406 +0xa8 U+00ae +0xa9 U+00a9 +0xaa U+2122 +0xab U+0402 +0xac U+0452 +0xad U+2260 +0xae U+0403 +0xaf U+0453 +0xb0 U+221e +0xb1 U+00b1 +0xb2 U+2264 +0xb3 U+2265 +0xb4 U+0456 +0xb5 U+00b5 +0xb6 U+2202 +0xb7 U+0408 +0xb8 U+0404 +0xb9 U+0454 +0xba U+0407 +0xbb U+0457 +0xbc U+0409 +0xbd U+0459 +0xbe U+040a +0xbf U+045a +0xc0 U+0458 +0xc1 U+0405 +0xc2 U+00ac +0xc3 U+221a +0xc4 U+0192 +0xc5 U+2248 +0xc6 U+2206 +0xc7 U+00ab +0xc8 U+00bb +0xc9 U+2026 +0xca U+00a0 +0xcb U+040b +0xcc U+045b +0xcd U+040c +0xce U+045c +0xcf U+0455 +0xd0 U+2013 +0xd1 U+2014 +0xd2 U+201c +0xd3 U+201d +0xd4 U+2018 +0xd5 U+2019 +0xd6 U+00f7 +0xd7 U+201e +0xd8 U+040e +0xd9 U+045e +0xda U+040f +0xdb U+045f +0xdc U+2116 +0xdd U+0401 +0xde U+0451 +0xdf U+044f +0xe0 U+0430 +0xe1 U+0431 +0xe2 U+0432 +0xe3 U+0433 +0xe4 U+0434 +0xe5 U+0435 +0xe6 U+0436 +0xe7 U+0437 +0xe8 U+0438 +0xe9 U+0439 +0xea U+043a +0xeb U+043b +0xec U+043c +0xed U+043d +0xee U+043e +0xef U+043f +0xf0 U+0440 +0xf1 U+0441 +0xf2 U+0442 +0xf3 U+0443 +0xf4 U+0444 +0xf5 U+0445 +0xf6 U+0446 +0xf7 U+0447 +0xf8 U+0448 +0xf9 U+0449 +0xfa U+044a +0xfb U+044b +0xfc U+044c +0xfd U+044d +0xfe U+044e +0xff U+00a4 diff --git a/jdk/make/tools/CharsetMapping/MacDingbat.map b/jdk/make/tools/CharsetMapping/MacDingbat.map new file mode 100644 index 00000000000..93abacaf434 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/MacDingbat.map @@ -0,0 +1,257 @@ +#Generated from MacDingbat.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+2701 +0x22 U+2702 +0x23 U+2703 +0x24 U+2704 +0x25 U+260e +0x26 U+2706 +0x27 U+2707 +0x28 U+2708 +0x29 U+2709 +0x2a U+261b +0x2b U+261e +0x2c U+270c +0x2d U+270d +0x2e U+270e +0x2f U+270f +0x30 U+2710 +0x31 U+2711 +0x32 U+2712 +0x33 U+2713 +0x34 U+2714 +0x35 U+2715 +0x36 U+2716 +0x37 U+2717 +0x38 U+2718 +0x39 U+2719 +0x3a U+271a +0x3b U+271b +0x3c U+271c +0x3d U+271d +0x3e U+271e +0x3f U+271f +0x40 U+2720 +0x41 U+2721 +0x42 U+2722 +0x43 U+2723 +0x44 U+2724 +0x45 U+2725 +0x46 U+2726 +0x47 U+2727 +0x48 U+2605 +0x49 U+2729 +0x4a U+272a +0x4b U+272b +0x4c U+272c +0x4d U+272d +0x4e U+272e +0x4f U+272f +0x50 U+2730 +0x51 U+2731 +0x52 U+2732 +0x53 U+2733 +0x54 U+2734 +0x55 U+2735 +0x56 U+2736 +0x57 U+2737 +0x58 U+2738 +0x59 U+2739 +0x5a U+273a +0x5b U+273b +0x5c U+273c +0x5d U+273d +0x5e U+273e +0x5f U+273f +0x60 U+2740 +0x61 U+2741 +0x62 U+2742 +0x63 U+2743 +0x64 U+2744 +0x65 U+2745 +0x66 U+2746 +0x67 U+2747 +0x68 U+2748 +0x69 U+2749 +0x6a U+274a +0x6b U+274b +0x6c U+25cf +0x6d U+274d +0x6e U+25a0 +0x6f U+274f +0x70 U+2750 +0x71 U+2751 +0x72 U+2752 +0x73 U+25b2 +0x74 U+25bc +0x75 U+25c6 +0x76 U+2756 +0x77 U+25d7 +0x78 U+2758 +0x79 U+2759 +0x7a U+275a +0x7b U+275b +0x7c U+275c +0x7d U+275d +0x7e U+275e +0x7f U+007f +0x80 U+fffd +0x81 U+fffd +0x82 U+fffd +0x83 U+fffd +0x84 U+fffd +0x85 U+fffd +0x86 U+fffd +0x87 U+fffd +0x88 U+fffd +0x89 U+fffd +0x8a U+fffd +0x8b U+fffd +0x8c U+fffd +0x8d U+fffd +0x8e U+fffd +0x8f U+fffd +0x90 U+fffd +0x91 U+fffd +0x92 U+fffd +0x93 U+fffd +0x94 U+fffd +0x95 U+fffd +0x96 U+fffd +0x97 U+fffd +0x98 U+fffd +0x99 U+fffd +0x9a U+fffd +0x9b U+fffd +0x9c U+fffd +0x9d U+fffd +0x9e U+fffd +0x9f U+fffd +0xa0 U+fffd +0xa1 U+2761 +0xa2 U+2762 +0xa3 U+2763 +0xa4 U+2764 +0xa5 U+2765 +0xa6 U+2766 +0xa7 U+2767 +0xa8 U+2663 +0xa9 U+2666 +0xaa U+2665 +0xab U+2660 +0xac U+2460 +0xad U+2461 +0xae U+2462 +0xaf U+2463 +0xb0 U+2464 +0xb1 U+2465 +0xb2 U+2466 +0xb3 U+2467 +0xb4 U+2468 +0xb5 U+2469 +0xb6 U+2776 +0xb7 U+2777 +0xb8 U+2778 +0xb9 U+2779 +0xba U+277a +0xbb U+277b +0xbc U+277c +0xbd U+277d +0xbe U+277e +0xbf U+277f +0xc0 U+2780 +0xc1 U+2781 +0xc2 U+2782 +0xc3 U+2783 +0xc4 U+2784 +0xc5 U+2785 +0xc6 U+2786 +0xc7 U+2787 +0xc8 U+2788 +0xc9 U+2789 +0xca U+278a +0xcb U+278b +0xcc U+278c +0xcd U+278d +0xce U+278e +0xcf U+278f +0xd0 U+2790 +0xd1 U+2791 +0xd2 U+2792 +0xd3 U+2793 +0xd4 U+2794 +0xd5 U+2192 +0xd6 U+2194 +0xd7 U+2195 +0xd8 U+2798 +0xd9 U+2799 +0xda U+279a +0xdb U+279b +0xdc U+279c +0xdd U+279d +0xde U+279e +0xdf U+279f +0xe0 U+27a0 +0xe1 U+27a1 +0xe2 U+27a2 +0xe3 U+27a3 +0xe4 U+27a4 +0xe5 U+27a5 +0xe6 U+27a6 +0xe7 U+27a7 +0xe8 U+27a8 +0xe9 U+27a9 +0xea U+27aa +0xeb U+27ab +0xec U+27ac +0xed U+27ad +0xee U+27ae +0xef U+27af +0xf0 U+fffd +0xf1 U+27b1 +0xf2 U+27b2 +0xf3 U+27b3 +0xf4 U+27b4 +0xf5 U+27b5 +0xf6 U+27b6 +0xf7 U+27b7 +0xf8 U+27b8 +0xf9 U+27b9 +0xfa U+27ba +0xfb U+27bb +0xfc U+27bc +0xfd U+27bd +0xfe U+27be +0xff U+fffd diff --git a/jdk/make/tools/CharsetMapping/MacGreek.map b/jdk/make/tools/CharsetMapping/MacGreek.map new file mode 100644 index 00000000000..aa88a24314f --- /dev/null +++ b/jdk/make/tools/CharsetMapping/MacGreek.map @@ -0,0 +1,257 @@ +#Generated from MacGreek.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+00c4 +0x81 U+00b9 +0x82 U+00b2 +0x83 U+00c9 +0x84 U+00b3 +0x85 U+00d6 +0x86 U+00dc +0x87 U+0385 +0x88 U+00e0 +0x89 U+00e2 +0x8a U+00e4 +0x8b U+0384 +0x8c U+00a8 +0x8d U+00e7 +0x8e U+00e9 +0x8f U+00e8 +0x90 U+00ea +0x91 U+00eb +0x92 U+00a3 +0x93 U+2122 +0x94 U+00ee +0x95 U+00ef +0x96 U+2022 +0x97 U+00bd +0x98 U+2030 +0x99 U+00f4 +0x9a U+00f6 +0x9b U+00a6 +0x9c U+00ad +0x9d U+00f9 +0x9e U+00fb +0x9f U+00fc +0xa0 U+2020 +0xa1 U+0393 +0xa2 U+0394 +0xa3 U+0398 +0xa4 U+039b +0xa5 U+039e +0xa6 U+03a0 +0xa7 U+00df +0xa8 U+00ae +0xa9 U+00a9 +0xaa U+03a3 +0xab U+03aa +0xac U+00a7 +0xad U+2260 +0xae U+00b0 +0xaf U+0387 +0xb0 U+0391 +0xb1 U+00b1 +0xb2 U+2264 +0xb3 U+2265 +0xb4 U+00a5 +0xb5 U+0392 +0xb6 U+0395 +0xb7 U+0396 +0xb8 U+0397 +0xb9 U+0399 +0xba U+039a +0xbb U+039c +0xbc U+03a6 +0xbd U+03ab +0xbe U+03a8 +0xbf U+03a9 +0xc0 U+03ac +0xc1 U+039d +0xc2 U+00ac +0xc3 U+039f +0xc4 U+03a1 +0xc5 U+2248 +0xc6 U+03a4 +0xc7 U+00ab +0xc8 U+00bb +0xc9 U+2026 +0xca U+00a0 +0xcb U+03a5 +0xcc U+03a7 +0xcd U+0386 +0xce U+0388 +0xcf U+0153 +0xd0 U+2013 +0xd1 U+2015 +0xd2 U+201c +0xd3 U+201d +0xd4 U+2018 +0xd5 U+2019 +0xd6 U+00f7 +0xd7 U+0389 +0xd8 U+038a +0xd9 U+038c +0xda U+038e +0xdb U+03ad +0xdc U+03ae +0xdd U+03af +0xde U+03cc +0xdf U+038f +0xe0 U+03cd +0xe1 U+03b1 +0xe2 U+03b2 +0xe3 U+03c8 +0xe4 U+03b4 +0xe5 U+03b5 +0xe6 U+03c6 +0xe7 U+03b3 +0xe8 U+03b7 +0xe9 U+03b9 +0xea U+03be +0xeb U+03ba +0xec U+03bb +0xed U+03bc +0xee U+03bd +0xef U+03bf +0xf0 U+03c0 +0xf1 U+03ce +0xf2 U+03c1 +0xf3 U+03c3 +0xf4 U+03c4 +0xf5 U+03b8 +0xf6 U+03c9 +0xf7 U+03c2 +0xf8 U+03c7 +0xf9 U+03c5 +0xfa U+03b6 +0xfb U+03ca +0xfc U+03cb +0xfd U+0390 +0xfe U+03b0 +0xff U+fffd diff --git a/jdk/make/tools/CharsetMapping/MacHebrew.map b/jdk/make/tools/CharsetMapping/MacHebrew.map new file mode 100644 index 00000000000..d847d1cb683 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/MacHebrew.map @@ -0,0 +1,257 @@ +#Generated from MacHebrew.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+00c4 +0x81 U+fb1f +0x82 U+00c7 +0x83 U+00c9 +0x84 U+00d1 +0x85 U+00d6 +0x86 U+00dc +0x87 U+00e1 +0x88 U+00e0 +0x89 U+00e2 +0x8a U+00e4 +0x8b U+00e3 +0x8c U+00e5 +0x8d U+00e7 +0x8e U+00e9 +0x8f U+00e8 +0x90 U+00ea +0x91 U+00eb +0x92 U+00ed +0x93 U+00ec +0x94 U+00ee +0x95 U+00ef +0x96 U+00f1 +0x97 U+00f3 +0x98 U+00f2 +0x99 U+00f4 +0x9a U+00f6 +0x9b U+00f5 +0x9c U+00fa +0x9d U+00f9 +0x9e U+00fb +0x9f U+00fc +0xa0 U+fffd +0xa1 U+fffd +0xa2 U+fffd +0xa3 U+fffd +0xa4 U+fffd +0xa5 U+fffd +0xa6 U+20aa +0xa7 U+fffd +0xa8 U+fffd +0xa9 U+fffd +0xaa U+fffd +0xab U+fffd +0xac U+fffd +0xad U+fffd +0xae U+fffd +0xaf U+fffd +0xb0 U+fffd +0xb1 U+fffd +0xb2 U+fffd +0xb3 U+fffd +0xb4 U+fffd +0xb5 U+fffd +0xb6 U+fffd +0xb7 U+fffd +0xb8 U+fffd +0xb9 U+fffd +0xba U+fffd +0xbb U+fffd +0xbc U+fffd +0xbd U+fffd +0xbe U+fffd +0xbf U+fffd +0xc0 U+fffd +0xc1 U+201e +0xc2 U+fffd +0xc3 U+fffd +0xc4 U+fffd +0xc5 U+fffd +0xc6 U+05bc +0xc7 U+fb4b +0xc8 U+fb35 +0xc9 U+2026 +0xca U+00a0 +0xcb U+05b8 +0xcc U+05b7 +0xcd U+05b5 +0xce U+05b6 +0xcf U+05b4 +0xd0 U+2013 +0xd1 U+2014 +0xd2 U+201c +0xd3 U+201d +0xd4 U+2018 +0xd5 U+2019 +0xd6 U+fb2a +0xd7 U+fb2b +0xd8 U+05bf +0xd9 U+05b0 +0xda U+05b2 +0xdb U+05b1 +0xdc U+05bb +0xdd U+05b9 +0xde U+fffd +0xdf U+05b3 +0xe0 U+05d0 +0xe1 U+05d1 +0xe2 U+05d2 +0xe3 U+05d3 +0xe4 U+05d4 +0xe5 U+05d5 +0xe6 U+05d6 +0xe7 U+05d7 +0xe8 U+05d8 +0xe9 U+05d9 +0xea U+05da +0xeb U+05db +0xec U+05dc +0xed U+05dd +0xee U+05de +0xef U+05df +0xf0 U+05e0 +0xf1 U+05e1 +0xf2 U+05e2 +0xf3 U+05e3 +0xf4 U+05e4 +0xf5 U+05e5 +0xf6 U+05e6 +0xf7 U+05e7 +0xf8 U+05e8 +0xf9 U+05e9 +0xfa U+05ea +0xfb U+fffd +0xfc U+fffd +0xfd U+fffd +0xfe U+fffd +0xff U+fffd diff --git a/jdk/make/tools/CharsetMapping/MacIceland.map b/jdk/make/tools/CharsetMapping/MacIceland.map new file mode 100644 index 00000000000..b47d11a814b --- /dev/null +++ b/jdk/make/tools/CharsetMapping/MacIceland.map @@ -0,0 +1,257 @@ +#Generated from MacIceland.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+00c4 +0x81 U+00c5 +0x82 U+00c7 +0x83 U+00c9 +0x84 U+00d1 +0x85 U+00d6 +0x86 U+00dc +0x87 U+00e1 +0x88 U+00e0 +0x89 U+00e2 +0x8a U+00e4 +0x8b U+00e3 +0x8c U+00e5 +0x8d U+00e7 +0x8e U+00e9 +0x8f U+00e8 +0x90 U+00ea +0x91 U+00eb +0x92 U+00ed +0x93 U+00ec +0x94 U+00ee +0x95 U+00ef +0x96 U+00f1 +0x97 U+00f3 +0x98 U+00f2 +0x99 U+00f4 +0x9a U+00f6 +0x9b U+00f5 +0x9c U+00fa +0x9d U+00f9 +0x9e U+00fb +0x9f U+00fc +0xa0 U+00dd +0xa1 U+00b0 +0xa2 U+00a2 +0xa3 U+00a3 +0xa4 U+00a7 +0xa5 U+2022 +0xa6 U+00b6 +0xa7 U+00df +0xa8 U+00ae +0xa9 U+00a9 +0xaa U+2122 +0xab U+00b4 +0xac U+00a8 +0xad U+2260 +0xae U+00c6 +0xaf U+00d8 +0xb0 U+221e +0xb1 U+00b1 +0xb2 U+2264 +0xb3 U+2265 +0xb4 U+00a5 +0xb5 U+00b5 +0xb6 U+2202 +0xb7 U+2211 +0xb8 U+220f +0xb9 U+03c0 +0xba U+222b +0xbb U+00aa +0xbc U+00ba +0xbd U+2126 +0xbe U+00e6 +0xbf U+00f8 +0xc0 U+00bf +0xc1 U+00a1 +0xc2 U+00ac +0xc3 U+221a +0xc4 U+0192 +0xc5 U+2248 +0xc6 U+2206 +0xc7 U+00ab +0xc8 U+00bb +0xc9 U+2026 +0xca U+00a0 +0xcb U+00c0 +0xcc U+00c3 +0xcd U+00d5 +0xce U+0152 +0xcf U+0153 +0xd0 U+2013 +0xd1 U+2014 +0xd2 U+201c +0xd3 U+201d +0xd4 U+2018 +0xd5 U+2019 +0xd6 U+00f7 +0xd7 U+25ca +0xd8 U+00ff +0xd9 U+0178 +0xda U+2044 +0xdb U+00a4 +0xdc U+00d0 +0xdd U+00f0 +0xde U+00de +0xdf U+00fe +0xe0 U+00fd +0xe1 U+00b7 +0xe2 U+201a +0xe3 U+201e +0xe4 U+2030 +0xe5 U+00c2 +0xe6 U+00ca +0xe7 U+00c1 +0xe8 U+00cb +0xe9 U+00c8 +0xea U+00cd +0xeb U+00ce +0xec U+00cf +0xed U+00cc +0xee U+00d3 +0xef U+00d4 +0xf0 U+f8ff +0xf1 U+00d2 +0xf2 U+00da +0xf3 U+00db +0xf4 U+00d9 +0xf5 U+0131 +0xf6 U+02c6 +0xf7 U+02dc +0xf8 U+00af +0xf9 U+02d8 +0xfa U+02d9 +0xfb U+02da +0xfc U+00b8 +0xfd U+02dd +0xfe U+02db +0xff U+02c7 diff --git a/jdk/make/tools/CharsetMapping/MacRoman.map b/jdk/make/tools/CharsetMapping/MacRoman.map new file mode 100644 index 00000000000..4d27bb812f6 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/MacRoman.map @@ -0,0 +1,257 @@ +#Generated from MacRoman.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+00c4 +0x81 U+00c5 +0x82 U+00c7 +0x83 U+00c9 +0x84 U+00d1 +0x85 U+00d6 +0x86 U+00dc +0x87 U+00e1 +0x88 U+00e0 +0x89 U+00e2 +0x8a U+00e4 +0x8b U+00e3 +0x8c U+00e5 +0x8d U+00e7 +0x8e U+00e9 +0x8f U+00e8 +0x90 U+00ea +0x91 U+00eb +0x92 U+00ed +0x93 U+00ec +0x94 U+00ee +0x95 U+00ef +0x96 U+00f1 +0x97 U+00f3 +0x98 U+00f2 +0x99 U+00f4 +0x9a U+00f6 +0x9b U+00f5 +0x9c U+00fa +0x9d U+00f9 +0x9e U+00fb +0x9f U+00fc +0xa0 U+2020 +0xa1 U+00b0 +0xa2 U+00a2 +0xa3 U+00a3 +0xa4 U+00a7 +0xa5 U+2022 +0xa6 U+00b6 +0xa7 U+00df +0xa8 U+00ae +0xa9 U+00a9 +0xaa U+2122 +0xab U+00b4 +0xac U+00a8 +0xad U+2260 +0xae U+00c6 +0xaf U+00d8 +0xb0 U+221e +0xb1 U+00b1 +0xb2 U+2264 +0xb3 U+2265 +0xb4 U+00a5 +0xb5 U+00b5 +0xb6 U+2202 +0xb7 U+2211 +0xb8 U+220f +0xb9 U+03c0 +0xba U+222b +0xbb U+00aa +0xbc U+00ba +0xbd U+03a9 +0xbe U+00e6 +0xbf U+00f8 +0xc0 U+00bf +0xc1 U+00a1 +0xc2 U+00ac +0xc3 U+221a +0xc4 U+0192 +0xc5 U+2248 +0xc6 U+2206 +0xc7 U+00ab +0xc8 U+00bb +0xc9 U+2026 +0xca U+00a0 +0xcb U+00c0 +0xcc U+00c3 +0xcd U+00d5 +0xce U+0152 +0xcf U+0153 +0xd0 U+2013 +0xd1 U+2014 +0xd2 U+201c +0xd3 U+201d +0xd4 U+2018 +0xd5 U+2019 +0xd6 U+00f7 +0xd7 U+25ca +0xd8 U+00ff +0xd9 U+0178 +0xda U+2044 +0xdb U+20ac +0xdc U+2039 +0xdd U+203a +0xde U+fb01 +0xdf U+fb02 +0xe0 U+2021 +0xe1 U+00b7 +0xe2 U+201a +0xe3 U+201e +0xe4 U+2030 +0xe5 U+00c2 +0xe6 U+00ca +0xe7 U+00c1 +0xe8 U+00cb +0xe9 U+00c8 +0xea U+00cd +0xeb U+00ce +0xec U+00cf +0xed U+00cc +0xee U+00d3 +0xef U+00d4 +0xf0 U+f8ff +0xf1 U+00d2 +0xf2 U+00da +0xf3 U+00db +0xf4 U+00d9 +0xf5 U+0131 +0xf6 U+02c6 +0xf7 U+02dc +0xf8 U+00af +0xf9 U+02d8 +0xfa U+02d9 +0xfb U+02da +0xfc U+00b8 +0xfd U+02dd +0xfe U+02db +0xff U+02c7 diff --git a/jdk/make/tools/CharsetMapping/MacRomania.map b/jdk/make/tools/CharsetMapping/MacRomania.map new file mode 100644 index 00000000000..622bc636edd --- /dev/null +++ b/jdk/make/tools/CharsetMapping/MacRomania.map @@ -0,0 +1,257 @@ +#Generated from MacRomania.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+00c4 +0x81 U+00c5 +0x82 U+00c7 +0x83 U+00c9 +0x84 U+00d1 +0x85 U+00d6 +0x86 U+00dc +0x87 U+00e1 +0x88 U+00e0 +0x89 U+00e2 +0x8a U+00e4 +0x8b U+00e3 +0x8c U+00e5 +0x8d U+00e7 +0x8e U+00e9 +0x8f U+00e8 +0x90 U+00ea +0x91 U+00eb +0x92 U+00ed +0x93 U+00ec +0x94 U+00ee +0x95 U+00ef +0x96 U+00f1 +0x97 U+00f3 +0x98 U+00f2 +0x99 U+00f4 +0x9a U+00f6 +0x9b U+00f5 +0x9c U+00fa +0x9d U+00f9 +0x9e U+00fb +0x9f U+00fc +0xa0 U+2020 +0xa1 U+00b0 +0xa2 U+00a2 +0xa3 U+00a3 +0xa4 U+00a7 +0xa5 U+2022 +0xa6 U+00b6 +0xa7 U+00df +0xa8 U+00ae +0xa9 U+00a9 +0xaa U+2122 +0xab U+00b4 +0xac U+00a8 +0xad U+2260 +0xae U+0102 +0xaf U+015e +0xb0 U+221e +0xb1 U+00b1 +0xb2 U+2264 +0xb3 U+2265 +0xb4 U+00a5 +0xb5 U+00b5 +0xb6 U+2202 +0xb7 U+2211 +0xb8 U+220f +0xb9 U+03c0 +0xba U+222b +0xbb U+00aa +0xbc U+00ba +0xbd U+2126 +0xbe U+0103 +0xbf U+015f +0xc0 U+00bf +0xc1 U+00a1 +0xc2 U+00ac +0xc3 U+221a +0xc4 U+0192 +0xc5 U+2248 +0xc6 U+2206 +0xc7 U+00ab +0xc8 U+00bb +0xc9 U+2026 +0xca U+00a0 +0xcb U+00c0 +0xcc U+00c3 +0xcd U+00d5 +0xce U+0152 +0xcf U+0153 +0xd0 U+2013 +0xd1 U+2014 +0xd2 U+201c +0xd3 U+201d +0xd4 U+2018 +0xd5 U+2019 +0xd6 U+00f7 +0xd7 U+25ca +0xd8 U+00ff +0xd9 U+0178 +0xda U+2044 +0xdb U+00a4 +0xdc U+2039 +0xdd U+203a +0xde U+0162 +0xdf U+0163 +0xe0 U+2021 +0xe1 U+00b7 +0xe2 U+201a +0xe3 U+201e +0xe4 U+2030 +0xe5 U+00c2 +0xe6 U+00ca +0xe7 U+00c1 +0xe8 U+00cb +0xe9 U+00c8 +0xea U+00cd +0xeb U+00ce +0xec U+00cf +0xed U+00cc +0xee U+00d3 +0xef U+00d4 +0xf0 U+f8ff +0xf1 U+00d2 +0xf2 U+00da +0xf3 U+00db +0xf4 U+00d9 +0xf5 U+0131 +0xf6 U+02c6 +0xf7 U+02dc +0xf8 U+00af +0xf9 U+02d8 +0xfa U+02d9 +0xfb U+02da +0xfc U+00b8 +0xfd U+02dd +0xfe U+02db +0xff U+02c7 diff --git a/jdk/make/tools/CharsetMapping/MacSymbol.map b/jdk/make/tools/CharsetMapping/MacSymbol.map new file mode 100644 index 00000000000..c3750f2f641 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/MacSymbol.map @@ -0,0 +1,257 @@ +#Generated from MacSymbol.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+2200 +0x23 U+0023 +0x24 U+2203 +0x25 U+0025 +0x26 U+0026 +0x27 U+220d +0x28 U+0028 +0x29 U+0029 +0x2a U+2217 +0x2b U+002b +0x2c U+002c +0x2d U+2212 +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+2245 +0x41 U+0391 +0x42 U+0392 +0x43 U+03a7 +0x44 U+0394 +0x45 U+0395 +0x46 U+03a6 +0x47 U+0393 +0x48 U+0397 +0x49 U+0399 +0x4a U+03d1 +0x4b U+039a +0x4c U+039b +0x4d U+039c +0x4e U+039d +0x4f U+039f +0x50 U+03a0 +0x51 U+0398 +0x52 U+03a1 +0x53 U+03a3 +0x54 U+03a4 +0x55 U+03a5 +0x56 U+03c2 +0x57 U+03a9 +0x58 U+039e +0x59 U+03a8 +0x5a U+0396 +0x5b U+005b +0x5c U+2234 +0x5d U+005d +0x5e U+22a5 +0x5f U+005f +0x60 U+f8e5 +0x61 U+03b1 +0x62 U+03b2 +0x63 U+03c7 +0x64 U+03b4 +0x65 U+03b5 +0x66 U+03c6 +0x67 U+03b3 +0x68 U+03b7 +0x69 U+03b9 +0x6a U+03d5 +0x6b U+03ba +0x6c U+03bb +0x6d U+03bc +0x6e U+03bd +0x6f U+03bf +0x70 U+03c0 +0x71 U+03b8 +0x72 U+03c1 +0x73 U+03c3 +0x74 U+03c4 +0x75 U+03c5 +0x76 U+03d6 +0x77 U+03c9 +0x78 U+03be +0x79 U+03c8 +0x7a U+03b6 +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+223c +0x7f U+007f +0x80 U+fffd +0x81 U+fffd +0x82 U+fffd +0x83 U+fffd +0x84 U+fffd +0x85 U+fffd +0x86 U+fffd +0x87 U+fffd +0x88 U+fffd +0x89 U+fffd +0x8a U+fffd +0x8b U+fffd +0x8c U+fffd +0x8d U+fffd +0x8e U+fffd +0x8f U+fffd +0x90 U+fffd +0x91 U+fffd +0x92 U+fffd +0x93 U+fffd +0x94 U+fffd +0x95 U+fffd +0x96 U+fffd +0x97 U+fffd +0x98 U+fffd +0x99 U+fffd +0x9a U+fffd +0x9b U+fffd +0x9c U+fffd +0x9d U+fffd +0x9e U+fffd +0x9f U+fffd +0xa0 U+20ac +0xa1 U+03d2 +0xa2 U+2032 +0xa3 U+2264 +0xa4 U+2044 +0xa5 U+221e +0xa6 U+0192 +0xa7 U+2663 +0xa8 U+2666 +0xa9 U+2665 +0xaa U+2660 +0xab U+2194 +0xac U+2190 +0xad U+2191 +0xae U+2192 +0xaf U+2193 +0xb0 U+00b0 +0xb1 U+00b1 +0xb2 U+2033 +0xb3 U+2265 +0xb4 U+00d7 +0xb5 U+221d +0xb6 U+2202 +0xb7 U+2022 +0xb8 U+00f7 +0xb9 U+2260 +0xba U+2261 +0xbb U+2248 +0xbc U+2026 +0xbd U+f8e6 +0xbe U+f8e7 +0xbf U+21b5 +0xc0 U+2135 +0xc1 U+2111 +0xc2 U+211c +0xc3 U+2118 +0xc4 U+2297 +0xc5 U+2295 +0xc6 U+2205 +0xc7 U+2229 +0xc8 U+222a +0xc9 U+2283 +0xca U+2287 +0xcb U+2284 +0xcc U+2282 +0xcd U+2286 +0xce U+2208 +0xcf U+2209 +0xd0 U+2220 +0xd1 U+2207 +0xd2 U+00ae +0xd3 U+00a9 +0xd4 U+2122 +0xd5 U+220f +0xd6 U+221a +0xd7 U+22c5 +0xd8 U+00ac +0xd9 U+2227 +0xda U+2228 +0xdb U+21d4 +0xdc U+21d0 +0xdd U+21d1 +0xde U+21d2 +0xdf U+21d3 +0xe0 U+22c4 +0xe1 U+3008 +0xe2 U+fffd +0xe3 U+fffd +0xe4 U+fffd +0xe5 U+2211 +0xe6 U+fffd +0xe7 U+fffd +0xe8 U+fffd +0xe9 U+fffd +0xea U+fffd +0xeb U+fffd +0xec U+fffd +0xed U+fffd +0xee U+fffd +0xef U+f8f4 +0xf0 U+f8ff +0xf1 U+3009 +0xf2 U+222b +0xf3 U+2320 +0xf4 U+fffd +0xf5 U+2321 +0xf6 U+fffd +0xf7 U+fffd +0xf8 U+fffd +0xf9 U+fffd +0xfa U+fffd +0xfb U+fffd +0xfc U+fffd +0xfd U+fffd +0xfe U+fffd +0xff U+fffd diff --git a/jdk/make/tools/CharsetMapping/MacThai.map b/jdk/make/tools/CharsetMapping/MacThai.map new file mode 100644 index 00000000000..68cf8ba727e --- /dev/null +++ b/jdk/make/tools/CharsetMapping/MacThai.map @@ -0,0 +1,257 @@ +#Generated from MacThai.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+00ab +0x81 U+00bb +0x82 U+2026 +0x83 U+f88c +0x84 U+f88f +0x85 U+f892 +0x86 U+f895 +0x87 U+f898 +0x88 U+f88b +0x89 U+f88e +0x8a U+f891 +0x8b U+f894 +0x8c U+f897 +0x8d U+201c +0x8e U+201d +0x8f U+f899 +0x90 U+fffd +0x91 U+2022 +0x92 U+f884 +0x93 U+f889 +0x94 U+f885 +0x95 U+f886 +0x96 U+f887 +0x97 U+f888 +0x98 U+f88a +0x99 U+f88d +0x9a U+f890 +0x9b U+f893 +0x9c U+f896 +0x9d U+2018 +0x9e U+2019 +0x9f U+fffd +0xa0 U+00a0 +0xa1 U+0e01 +0xa2 U+0e02 +0xa3 U+0e03 +0xa4 U+0e04 +0xa5 U+0e05 +0xa6 U+0e06 +0xa7 U+0e07 +0xa8 U+0e08 +0xa9 U+0e09 +0xaa U+0e0a +0xab U+0e0b +0xac U+0e0c +0xad U+0e0d +0xae U+0e0e +0xaf U+0e0f +0xb0 U+0e10 +0xb1 U+0e11 +0xb2 U+0e12 +0xb3 U+0e13 +0xb4 U+0e14 +0xb5 U+0e15 +0xb6 U+0e16 +0xb7 U+0e17 +0xb8 U+0e18 +0xb9 U+0e19 +0xba U+0e1a +0xbb U+0e1b +0xbc U+0e1c +0xbd U+0e1d +0xbe U+0e1e +0xbf U+0e1f +0xc0 U+0e20 +0xc1 U+0e21 +0xc2 U+0e22 +0xc3 U+0e23 +0xc4 U+0e24 +0xc5 U+0e25 +0xc6 U+0e26 +0xc7 U+0e27 +0xc8 U+0e28 +0xc9 U+0e29 +0xca U+0e2a +0xcb U+0e2b +0xcc U+0e2c +0xcd U+0e2d +0xce U+0e2e +0xcf U+0e2f +0xd0 U+0e30 +0xd1 U+0e31 +0xd2 U+0e32 +0xd3 U+0e33 +0xd4 U+0e34 +0xd5 U+0e35 +0xd6 U+0e36 +0xd7 U+0e37 +0xd8 U+0e38 +0xd9 U+0e39 +0xda U+0e3a +0xdb U+feff +0xdc U+200b +0xdd U+2013 +0xde U+2014 +0xdf U+0e3f +0xe0 U+0e40 +0xe1 U+0e41 +0xe2 U+0e42 +0xe3 U+0e43 +0xe4 U+0e44 +0xe5 U+0e45 +0xe6 U+0e46 +0xe7 U+0e47 +0xe8 U+0e48 +0xe9 U+0e49 +0xea U+0e4a +0xeb U+0e4b +0xec U+0e4c +0xed U+0e4d +0xee U+2122 +0xef U+0e4f +0xf0 U+0e50 +0xf1 U+0e51 +0xf2 U+0e52 +0xf3 U+0e53 +0xf4 U+0e54 +0xf5 U+0e55 +0xf6 U+0e56 +0xf7 U+0e57 +0xf8 U+0e58 +0xf9 U+0e59 +0xfa U+00ae +0xfb U+00a9 +0xfc U+fffd +0xfd U+fffd +0xfe U+fffd +0xff U+fffd diff --git a/jdk/make/tools/CharsetMapping/MacTurkish.map b/jdk/make/tools/CharsetMapping/MacTurkish.map new file mode 100644 index 00000000000..d316ca2d592 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/MacTurkish.map @@ -0,0 +1,257 @@ +#Generated from MacTurkish.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+00c4 +0x81 U+00c5 +0x82 U+00c7 +0x83 U+00c9 +0x84 U+00d1 +0x85 U+00d6 +0x86 U+00dc +0x87 U+00e1 +0x88 U+00e0 +0x89 U+00e2 +0x8a U+00e4 +0x8b U+00e3 +0x8c U+00e5 +0x8d U+00e7 +0x8e U+00e9 +0x8f U+00e8 +0x90 U+00ea +0x91 U+00eb +0x92 U+00ed +0x93 U+00ec +0x94 U+00ee +0x95 U+00ef +0x96 U+00f1 +0x97 U+00f3 +0x98 U+00f2 +0x99 U+00f4 +0x9a U+00f6 +0x9b U+00f5 +0x9c U+00fa +0x9d U+00f9 +0x9e U+00fb +0x9f U+00fc +0xa0 U+2020 +0xa1 U+00b0 +0xa2 U+00a2 +0xa3 U+00a3 +0xa4 U+00a7 +0xa5 U+2022 +0xa6 U+00b6 +0xa7 U+00df +0xa8 U+00ae +0xa9 U+00a9 +0xaa U+2122 +0xab U+00b4 +0xac U+00a8 +0xad U+2260 +0xae U+00c6 +0xaf U+00d8 +0xb0 U+221e +0xb1 U+00b1 +0xb2 U+2264 +0xb3 U+2265 +0xb4 U+00a5 +0xb5 U+00b5 +0xb6 U+2202 +0xb7 U+2211 +0xb8 U+220f +0xb9 U+03c0 +0xba U+222b +0xbb U+00aa +0xbc U+00ba +0xbd U+2126 +0xbe U+00e6 +0xbf U+00f8 +0xc0 U+00bf +0xc1 U+00a1 +0xc2 U+00ac +0xc3 U+221a +0xc4 U+0192 +0xc5 U+2248 +0xc6 U+2206 +0xc7 U+00ab +0xc8 U+00bb +0xc9 U+2026 +0xca U+00a0 +0xcb U+00c0 +0xcc U+00c3 +0xcd U+00d5 +0xce U+0152 +0xcf U+0153 +0xd0 U+2013 +0xd1 U+2014 +0xd2 U+201c +0xd3 U+201d +0xd4 U+2018 +0xd5 U+2019 +0xd6 U+00f7 +0xd7 U+25ca +0xd8 U+00ff +0xd9 U+0178 +0xda U+011e +0xdb U+011f +0xdc U+0130 +0xdd U+0131 +0xde U+015e +0xdf U+015f +0xe0 U+2021 +0xe1 U+00b7 +0xe2 U+201a +0xe3 U+201e +0xe4 U+2030 +0xe5 U+00c2 +0xe6 U+00ca +0xe7 U+00c1 +0xe8 U+00cb +0xe9 U+00c8 +0xea U+00cd +0xeb U+00ce +0xec U+00cf +0xed U+00cc +0xee U+00d3 +0xef U+00d4 +0xf0 U+f8ff +0xf1 U+00d2 +0xf2 U+00da +0xf3 U+00db +0xf4 U+00d9 +0xf5 U+fffd +0xf6 U+02c6 +0xf7 U+02dc +0xf8 U+00af +0xf9 U+02d8 +0xfa U+02d9 +0xfb U+02da +0xfc U+00b8 +0xfd U+02dd +0xfe U+02db +0xff U+02c7 diff --git a/jdk/make/tools/CharsetMapping/MacUkraine.map b/jdk/make/tools/CharsetMapping/MacUkraine.map new file mode 100644 index 00000000000..93f1dbf56e3 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/MacUkraine.map @@ -0,0 +1,257 @@ +#Generated from MacUkraine.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+0410 +0x81 U+0411 +0x82 U+0412 +0x83 U+0413 +0x84 U+0414 +0x85 U+0415 +0x86 U+0416 +0x87 U+0417 +0x88 U+0418 +0x89 U+0419 +0x8a U+041a +0x8b U+041b +0x8c U+041c +0x8d U+041d +0x8e U+041e +0x8f U+041f +0x90 U+0420 +0x91 U+0421 +0x92 U+0422 +0x93 U+0423 +0x94 U+0424 +0x95 U+0425 +0x96 U+0426 +0x97 U+0427 +0x98 U+0428 +0x99 U+0429 +0x9a U+042a +0x9b U+042b +0x9c U+042c +0x9d U+042d +0x9e U+042e +0x9f U+042f +0xa0 U+2020 +0xa1 U+00b0 +0xa2 U+0490 +0xa3 U+00a3 +0xa4 U+00a7 +0xa5 U+2022 +0xa6 U+00b6 +0xa7 U+0406 +0xa8 U+00ae +0xa9 U+00a9 +0xaa U+2122 +0xab U+0402 +0xac U+0452 +0xad U+2260 +0xae U+0403 +0xaf U+0453 +0xb0 U+221e +0xb1 U+00b1 +0xb2 U+2264 +0xb3 U+2265 +0xb4 U+0456 +0xb5 U+00b5 +0xb6 U+0491 +0xb7 U+0408 +0xb8 U+0404 +0xb9 U+0454 +0xba U+0407 +0xbb U+0457 +0xbc U+0409 +0xbd U+0459 +0xbe U+040a +0xbf U+045a +0xc0 U+0458 +0xc1 U+0405 +0xc2 U+00ac +0xc3 U+221a +0xc4 U+0192 +0xc5 U+2248 +0xc6 U+2206 +0xc7 U+00ab +0xc8 U+00bb +0xc9 U+2026 +0xca U+00a0 +0xcb U+040b +0xcc U+045b +0xcd U+040c +0xce U+045c +0xcf U+0455 +0xd0 U+2013 +0xd1 U+2014 +0xd2 U+201c +0xd3 U+201d +0xd4 U+2018 +0xd5 U+2019 +0xd6 U+00f7 +0xd7 U+201e +0xd8 U+040e +0xd9 U+045e +0xda U+040f +0xdb U+045f +0xdc U+2116 +0xdd U+0401 +0xde U+0451 +0xdf U+044f +0xe0 U+0430 +0xe1 U+0431 +0xe2 U+0432 +0xe3 U+0433 +0xe4 U+0434 +0xe5 U+0435 +0xe6 U+0436 +0xe7 U+0437 +0xe8 U+0438 +0xe9 U+0439 +0xea U+043a +0xeb U+043b +0xec U+043c +0xed U+043d +0xee U+043e +0xef U+043f +0xf0 U+0440 +0xf1 U+0441 +0xf2 U+0442 +0xf3 U+0443 +0xf4 U+0444 +0xf5 U+0445 +0xf6 U+0446 +0xf7 U+0447 +0xf8 U+0448 +0xf9 U+0449 +0xfa U+044a +0xfb U+044b +0xfc U+044c +0xfd U+044d +0xfe U+044e +0xff U+00a4 diff --git a/jdk/make/tools/CharsetMapping/SingleByte-X.java b/jdk/make/tools/CharsetMapping/SingleByte-X.java new file mode 100644 index 00000000000..f6c080a20f0 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/SingleByte-X.java @@ -0,0 +1,83 @@ +/* + * 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 $PACKAGE$; + +import java.nio.charset.Charset; +import java.nio.charset.CharsetDecoder; +import java.nio.charset.CharsetEncoder; +import sun.nio.cs.StandardCharsets; +import sun.nio.cs.SingleByte; +import sun.nio.cs.HistoricallyNamedCharset; +import static sun.nio.cs.CharsetMapping.*; + +public class $NAME_CLZ$ extends Charset implements HistoricallyNamedCharset +{ + public $NAME_CLZ$() { + super("$NAME_CS$", $NAME_ALIASES$); + } + + public String historicalName() { + return "$NAME_HIS$"; + } + + public boolean contains(Charset cs) { + $CONTAINS$; + } + + public CharsetDecoder newDecoder() { + return new SingleByte.Decoder(this, b2c); + } + + public CharsetEncoder newEncoder() { + return new SingleByte.Encoder(this, c2b, c2bIndex); + } + + public String getDecoderSingleByteMappings() { + return b2cTable; + } + + public char[] getEncoderIndex2() { + return c2b; + } + + public char[] getEncoderIndex1() { + return c2bIndex; + } + + private final static String b2cTable = $B2CTABLE$ + + private final static char[] b2c = b2cTable.toCharArray(); + private final static char[] c2b = new char[$C2BLENGTH$]; + private final static char[] c2bIndex = new char[0x100]; + + static { + char[] b2cMap = b2c; + char[] c2bNR = null; + $NONROUNDTRIP_B2C$ + $NONROUNDTRIP_C2B$ + SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex); + } +} diff --git a/jdk/make/tools/CharsetMapping/TIS_620.map b/jdk/make/tools/CharsetMapping/TIS_620.map new file mode 100644 index 00000000000..b832450a5ae --- /dev/null +++ b/jdk/make/tools/CharsetMapping/TIS_620.map @@ -0,0 +1,257 @@ +#Generated from TIS_620.java +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0a U+000a +0x0b U+000b +0x0c U+000c +0x0d U+000d +0x0e U+000e +0x0f U+000f +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1a U+001a +0x1b U+001b +0x1c U+001c +0x1d U+001d +0x1e U+001e +0x1f U+001f +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2a U+002a +0x2b U+002b +0x2c U+002c +0x2d U+002d +0x2e U+002e +0x2f U+002f +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3a U+003a +0x3b U+003b +0x3c U+003c +0x3d U+003d +0x3e U+003e +0x3f U+003f +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4a U+004a +0x4b U+004b +0x4c U+004c +0x4d U+004d +0x4e U+004e +0x4f U+004f +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5a U+005a +0x5b U+005b +0x5c U+005c +0x5d U+005d +0x5e U+005e +0x5f U+005f +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6a U+006a +0x6b U+006b +0x6c U+006c +0x6d U+006d +0x6e U+006e +0x6f U+006f +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7a U+007a +0x7b U+007b +0x7c U+007c +0x7d U+007d +0x7e U+007e +0x7f U+007f +0x80 U+fffd +0x81 U+fffd +0x82 U+fffd +0x83 U+fffd +0x84 U+fffd +0x85 U+fffd +0x86 U+fffd +0x87 U+fffd +0x88 U+fffd +0x89 U+fffd +0x8a U+fffd +0x8b U+fffd +0x8c U+fffd +0x8d U+fffd +0x8e U+fffd +0x8f U+fffd +0x90 U+fffd +0x91 U+fffd +0x92 U+fffd +0x93 U+fffd +0x94 U+fffd +0x95 U+fffd +0x96 U+fffd +0x97 U+fffd +0x98 U+fffd +0x99 U+fffd +0x9a U+fffd +0x9b U+fffd +0x9c U+fffd +0x9d U+fffd +0x9e U+fffd +0x9f U+fffd +0xa0 U+00a0 +0xa1 U+0e01 +0xa2 U+0e02 +0xa3 U+0e03 +0xa4 U+0e04 +0xa5 U+0e05 +0xa6 U+0e06 +0xa7 U+0e07 +0xa8 U+0e08 +0xa9 U+0e09 +0xaa U+0e0a +0xab U+0e0b +0xac U+0e0c +0xad U+0e0d +0xae U+0e0e +0xaf U+0e0f +0xb0 U+0e10 +0xb1 U+0e11 +0xb2 U+0e12 +0xb3 U+0e13 +0xb4 U+0e14 +0xb5 U+0e15 +0xb6 U+0e16 +0xb7 U+0e17 +0xb8 U+0e18 +0xb9 U+0e19 +0xba U+0e1a +0xbb U+0e1b +0xbc U+0e1c +0xbd U+0e1d +0xbe U+0e1e +0xbf U+0e1f +0xc0 U+0e20 +0xc1 U+0e21 +0xc2 U+0e22 +0xc3 U+0e23 +0xc4 U+0e24 +0xc5 U+0e25 +0xc6 U+0e26 +0xc7 U+0e27 +0xc8 U+0e28 +0xc9 U+0e29 +0xca U+0e2a +0xcb U+0e2b +0xcc U+0e2c +0xcd U+0e2d +0xce U+0e2e +0xcf U+0e2f +0xd0 U+0e30 +0xd1 U+0e31 +0xd2 U+0e32 +0xd3 U+0e33 +0xd4 U+0e34 +0xd5 U+0e35 +0xd6 U+0e36 +0xd7 U+0e37 +0xd8 U+0e38 +0xd9 U+0e39 +0xda U+0e3a +0xdb U+fffd +0xdc U+fffd +0xdd U+fffd +0xde U+fffd +0xdf U+0e3f +0xe0 U+0e40 +0xe1 U+0e41 +0xe2 U+0e42 +0xe3 U+0e43 +0xe4 U+0e44 +0xe5 U+0e45 +0xe6 U+0e46 +0xe7 U+0e47 +0xe8 U+0e48 +0xe9 U+0e49 +0xea U+0e4a +0xeb U+0e4b +0xec U+0e4c +0xed U+0e4d +0xee U+0e4e +0xef U+0e4f +0xf0 U+0e50 +0xf1 U+0e51 +0xf2 U+0e52 +0xf3 U+0e53 +0xf4 U+0e54 +0xf5 U+0e55 +0xf6 U+0e56 +0xf7 U+0e57 +0xf8 U+0e58 +0xf9 U+0e59 +0xfa U+0e5a +0xfb U+0e5b +0xfc U+fffd +0xfd U+fffd +0xfe U+fffd +0xff U+fffd diff --git a/jdk/make/tools/CharsetMapping/extsbcs b/jdk/make/tools/CharsetMapping/extsbcs new file mode 100644 index 00000000000..81a6acdf817 --- /dev/null +++ b/jdk/make/tools/CharsetMapping/extsbcs @@ -0,0 +1,74 @@ +# clzName csName hisName containASCII pkg +IBM037 IBM037 Cp037 false sun.nio.cs.ext +IBM1006 x-IBM1006 Cp1006 false sun.nio.cs.ext +IBM1025 x-IBM1025 Cp1025 false sun.nio.cs.ext +IBM1026 IBM1026 Cp1026 false sun.nio.cs.ext +IBM1046 x-IBM1046 Cp1046 false sun.nio.cs.ext +IBM1047 IBM1047 Cp1047 false sun.nio.cs.ext +IBM1097 x-IBM1097 Cp1097 false sun.nio.cs.ext +IBM1098 x-IBM1098 Cp1098 false sun.nio.cs.ext +IBM1112 x-IBM1112 Cp1112 false sun.nio.cs.ext +IBM1122 x-IBM1122 Cp1122 false sun.nio.cs.ext +IBM1123 x-IBM1123 Cp1123 false sun.nio.cs.ext +IBM1124 x-IBM1124 Cp1124 false sun.nio.cs.ext +# map tables for 1140-1149 are updated manualy with the u+20ac entry +IBM1140 IBM01140 Cp1140 false sun.nio.cs.ext +IBM1141 IBM01141 Cp1141 false sun.nio.cs.ext +IBM1142 IBM01142 Cp1142 false sun.nio.cs.ext +IBM1143 IBM01143 Cp1143 false sun.nio.cs.ext +IBM1144 IBM01144 Cp1144 false sun.nio.cs.ext +IBM1145 IBM01145 Cp1145 false sun.nio.cs.ext +IBM1146 IBM01146 Cp1146 false sun.nio.cs.ext +IBM1147 IBM01147 Cp1147 false sun.nio.cs.ext +IBM1148 IBM01148 Cp1148 false sun.nio.cs.ext +IBM1149 IBM01149 Cp1149 false sun.nio.cs.ext +IBM273 IBM273 Cp273 false sun.nio.cs.ext +IBM277 IBM277 Cp277 false sun.nio.cs.ext +IBM278 IBM278 Cp278 false sun.nio.cs.ext +IBM280 IBM280 Cp280 false sun.nio.cs.ext +IBM284 IBM284 Cp284 false sun.nio.cs.ext +IBM285 IBM285 Cp285 false sun.nio.cs.ext +IBM297 IBM297 Cp297 false sun.nio.cs.ext +IBM420 IBM420 Cp420 false sun.nio.cs.ext +IBM424 IBM424 Cp424 false sun.nio.cs.ext +IBM500 IBM500 Cp500 false sun.nio.cs.ext +IBM838 IBM-Thai Cp838 false sun.nio.cs.ext +IBM856 x-IBM856 Cp856 false sun.nio.cs.ext +IBM860 IBM860 Cp860 false sun.nio.cs.ext +IBM861 IBM861 Cp861 false sun.nio.cs.ext +IBM863 IBM863 Cp863 false sun.nio.cs.ext +IBM864 IBM864 Cp864 false sun.nio.cs.ext +IBM865 IBM865 Cp865 false sun.nio.cs.ext +IBM868 IBM868 Cp868 false sun.nio.cs.ext +IBM869 IBM869 Cp869 false sun.nio.cs.ext +IBM870 IBM870 Cp870 false sun.nio.cs.ext +IBM871 IBM871 Cp871 false sun.nio.cs.ext +IBM875 x-IBM875 Cp875 false sun.nio.cs.ext +IBM918 IBM918 Cp918 false sun.nio.cs.ext +IBM921 x-IBM921 Cp921 false sun.nio.cs.ext +IBM922 x-IBM922 Cp922 false sun.nio.cs.ext +# use name as hisname as well, cs did not support hisname prevously +ISO_8859_11 x-iso-8859-11 x-iso-8859-11 true sun.nio.cs.ext +ISO_8859_3 ISO-8859-3 ISO8859_3 true sun.nio.cs.ext +ISO_8859_6 ISO-8859-6 ISO8859_6 true sun.nio.cs.ext +ISO_8859_8 ISO-8859-8 ISO8859_8 true sun.nio.cs.ext +#JIS_X_0201 JIS_X0201 JIS_X0201 true sun.nio.cs.ext +MS1255 windows-1255 Cp1255 true sun.nio.cs.ext +MS1256 windows-1256 Cp1256 true sun.nio.cs.ext +MS1258 windows-1258 Cp1258 true sun.nio.cs.ext +MS874 x-windows-874 MS874 true sun.nio.cs.ext +MacArabic x-MacArabic MacArabic false sun.nio.cs.ext +MacCentralEurope x-MacCentralEurope MacCentralEurope false sun.nio.cs.ext +MacCroatian x-MacCroatian MacCroatian false sun.nio.cs.ext +MacCyrillic x-MacCyrillic MacCyrillic false sun.nio.cs.ext +MacDingbat x-MacDingbat MacDingbat false sun.nio.cs.ext +MacGreek x-MacGreek MacGreek false sun.nio.cs.ext +MacHebrew x-MacHebrew MacHebrew false sun.nio.cs.ext +MacIceland x-MacIceland MacIceland false sun.nio.cs.ext +MacRoman x-MacRoman MacRoman false sun.nio.cs.ext +MacRomania x-MacRomania MacRomania false sun.nio.cs.ext +MacSymbol x-MacSymbol MacSymbol false sun.nio.cs.ext +MacThai x-MacThai MacThai false sun.nio.cs.ext +MacTurkish x-MacTurkish MacTurkish false sun.nio.cs.ext +MacUkraine x-MacUkraine MacUkraine false sun.nio.cs.ext +TIS_620 TIS-620 TIS620 true sun.nio.cs.ext diff --git a/jdk/make/tools/CharsetMapping/sbcs b/jdk/make/tools/CharsetMapping/sbcs new file mode 100644 index 00000000000..0b11960411b --- /dev/null +++ b/jdk/make/tools/CharsetMapping/sbcs @@ -0,0 +1,28 @@ +# clzName csName hisName containASCII pkg +IBM437 IBM437 Cp437 false sun.nio.cs +IBM737 x-IBM737 Cp737 false sun.nio.cs +IBM775 IBM775 Cp775 false sun.nio.cs +IBM850 IBM850 Cp850 false sun.nio.cs +IBM852 IBM852 Cp852 false sun.nio.cs +IBM855 IBM855 Cp855 false sun.nio.cs +IBM857 IBM857 Cp857 false sun.nio.cs +IBM858 IBM00858 Cp858 false sun.nio.cs +IBM862 IBM862 Cp862 false sun.nio.cs +IBM866 IBM866 Cp866 false sun.nio.cs +IBM874 x-IBM874 Cp874 false sun.nio.cs +ISO_8859_2 ISO-8859-2 ISO8859_2 true sun.nio.cs +ISO_8859_4 ISO-8859-4 ISO8859_4 true sun.nio.cs +ISO_8859_5 ISO-8859-5 ISO8859_5 true sun.nio.cs +ISO_8859_7 ISO-8859-7 ISO8859_7 true sun.nio.cs +ISO_8859_9 ISO-8859-9 ISO8859_9 true sun.nio.cs +ISO_8859_13 ISO-8859-13 ISO8859_13 true sun.nio.cs +ISO_8859_15 ISO-8859-15 ISO8859_15 true sun.nio.cs +KOI8_R KOI8-R KOI8_R true sun.nio.cs +KOI8_U KOI8-U KOI8_U true sun.nio.cs +MS1250 windows-1250 Cp1250 true sun.nio.cs +MS1251 windows-1251 Cp1251 true sun.nio.cs +MS1252 windows-1252 Cp1252 true sun.nio.cs +MS1253 windows-1253 Cp1253 true sun.nio.cs +MS1254 windows-1254 Cp1254 true sun.nio.cs +MS1257 windows-1257 Cp1257 true sun.nio.cs + diff --git a/jdk/make/tools/src/build/tools/charsetmapping/GenerateMapping.java b/jdk/make/tools/src/build/tools/charsetmapping/GenerateMapping.java index e1f1d86ab79..6898820d873 100644 --- a/jdk/make/tools/src/build/tools/charsetmapping/GenerateMapping.java +++ b/jdk/make/tools/src/build/tools/charsetmapping/GenerateMapping.java @@ -27,12 +27,13 @@ package build.tools.charsetmapping; import java.io.*; import java.util.regex.*; +import build.tools.charsetmapping.GenerateSBCS; import static build.tools.charsetmapping.CharsetMapping.*; public class GenerateMapping { public static void main(String argv[]) throws IOException { if (argv.length < 2) { - System.out.println("Usage: java GenCSData fMap fDat"); + System.out.println("Usage: java GenerateMapping fMap fDat"); System.exit(1); } genDataJIS0213(new FileInputStream(argv[0]), diff --git a/jdk/make/tools/src/build/tools/charsetmapping/GenerateSBCS.java b/jdk/make/tools/src/build/tools/charsetmapping/GenerateSBCS.java new file mode 100644 index 00000000000..81b5d7be60f --- /dev/null +++ b/jdk/make/tools/src/build/tools/charsetmapping/GenerateSBCS.java @@ -0,0 +1,262 @@ +/* + * 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.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 GenerateSBCS { + public static void main(String args[]) throws Exception { + if (args.length < 3) { + System.err.println("Usage: java GenSBCS srcDir dstDir config"); + System.exit(1); + } + + Scanner s = new Scanner(new File(args[0], args[2])); + while (s.hasNextLine()) { + String line = s.nextLine(); + if (line.startsWith("#") || line.length() == 0) + continue; + String[] fields = line.split("\\s+"); + if (fields.length < 5) { + System.err.println("Misconfiged sbcs line <" + line + ">?"); + continue; + } + String clzName = fields[0]; + String csName = fields[1]; + String hisName = fields[2]; + boolean isASCII = Boolean.valueOf(fields[3]); + String pkgName = fields[4]; + System.out.printf("%s,%s,%s,%b,%s%n", clzName, csName, hisName, isASCII, pkgName); + + StringBuilder b2c = new StringBuilder(); + int c2bLen = genB2C( + new FileInputStream(new File(args[0], clzName+".map")), b2c); + + String b2cNR = null; + File nrF = new File(args[0], clzName+".nr"); + if (nrF.exists()) { + b2cNR = genNR(new FileInputStream(nrF)); + } + + String c2bNR = null; + File c2bF = new File(args[0], clzName+".c2b"); + if (c2bF.exists()) { + c2bNR = genC2BNR(new FileInputStream(c2bF)); + } + + genSBCSClass(args[0], args[1], "SingleByte-X.java", + clzName, csName, hisName, pkgName, isASCII, + b2c.toString(), b2cNR, c2bNR, c2bLen); + } + } + + private static void toString(char[] sb, int off, int end, + Formatter out, String closure) { + while (off < end) { + out.format(" \""); + for (int j = 0; j < 8; j++) { + char c = sb[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 // 0x%02x - 0x%02x%n", closure, off-8, off-1); + else + out.format("\" + // 0x%02x - 0x%02x%n", off-8, off-1); + } + } + + static Pattern sbmap = Pattern.compile("0x(\\p{XDigit}++)\\s++U\\+(\\p{XDigit}++)(\\s++#.*)?"); + private static int genB2C(InputStream in, StringBuilder out) + throws Exception + { + char[] sb = new char[0x100]; + int[] indexC2B = new int[0x100]; + + for (int i = 0; i < sb.length; i++) + sb[i] = UNMAPPABLE_DECODING; + + // parse the b2c mapping table + Parser p = new Parser(in, sbmap); + Entry e = null; + int off = 0; + while ((e = p.next()) != null) { + sb[e.bs] = (char)e.cp; + if (indexC2B[e.cp>>8] == 0) { + off += 0x100; + indexC2B[e.cp>>8] = 1; + } + } + + Formatter fm = new Formatter(out); + fm.format("%n"); + + // vm -server shows cc[byte + 128] access is much faster than + // cc[byte&0xff] so we output the upper segment first + toString(sb, 0x80, 0x100, fm, "+"); + toString(sb, 0x00, 0x80, fm, ";"); + + fm.close(); + return off; + } + + // generate non-roundtrip entries from xxx.nr file + private static String genNR(InputStream in) throws Exception + { + StringBuilder sb = new StringBuilder(); + Formatter fm = new Formatter(sb); + Parser p = new Parser(in, sbmap); + Entry e = null; + fm.format("// remove non-roundtrip entries%n"); + fm.format(" b2cMap = b2cTable.toCharArray();%n"); + while ((e = p.next()) != null) { + fm.format(" b2cMap[%d] = UNMAPPABLE_DECODING;%n", + (e.bs>=0x80)?(e.bs-0x80):(e.bs+0x80)); + } + fm.close(); + return sb.toString(); + } + + // generate c2b only entries from xxx.c2b file + private static String genC2BNR(InputStream in) throws Exception + { + StringBuilder sb = new StringBuilder(); + Formatter fm = new Formatter(sb); + Parser p = new Parser(in, sbmap); + ArrayList es = new ArrayList(); + Entry e = null; + while ((e = p.next()) != null) { + es.add(e); + } + + fm.format("// non-roundtrip c2b only entries%n"); + fm.format(" c2bNR = new char[%d];%n", es.size() * 2); + int i = 0; + for (Entry entry: es) { + fm.format(" c2bNR[%d] = 0x%x; c2bNR[%d] = 0x%x;%n", + i++, entry.bs, i++, entry.cp); + } + fm.close(); + return sb.toString(); + } + + private static void genSBCSClass(String srcDir, + String dstDir, + String template, + String clzName, + String csName, + String hisName, + String pkgName, + boolean isASCII, + String b2c, + String b2cNR, + String c2bNR, + int c2blen) + throws Exception + { + Scanner s = new Scanner(new File(srcDir, template)); + PrintStream out = new PrintStream(new FileOutputStream( + new File(dstDir, clzName + ".java"))); + + while (s.hasNextLine()) { + String line = s.nextLine(); + int i = line.indexOf("$"); + if (i == -1) { + out.println(line); + continue; + } + if (line.indexOf("$PACKAGE$", i) != -1) { + line = line.replace("$PACKAGE$", pkgName); + } + if (line.indexOf("$NAME_CLZ$", i) != -1) { + line = line.replace("$NAME_CLZ$", clzName); + } + if (line.indexOf("$NAME_CS$", i) != -1) { + line = line.replace("$NAME_CS$", csName); + } + if (line.indexOf("$NAME_ALIASES$", i) != -1) { + if ("sun.nio.cs".equals(pkgName)) + line = line.replace("$NAME_ALIASES$", + "StandardCharsets.aliases_" + clzName); + else + line = line.replace("$NAME_ALIASES$", + "ExtendedCharsets.aliasesFor(\"" + csName + "\")"); + } + if (line.indexOf("$NAME_HIS$", i) != -1) { + line = line.replace("$NAME_HIS$", hisName); + } + if (line.indexOf("$CONTAINS$", i) != -1) { + if (isASCII) + line = " return ((cs.name().equals(\"US-ASCII\")) || (cs instanceof " + clzName + "));"; + else + line = " return (cs instanceof " + clzName + ");"; + } + if (line.indexOf("$B2CTABLE$") != -1) { + line = line.replace("$B2CTABLE$", b2c); + } + if (line.indexOf("$C2BLENGTH$") != -1) { + line = line.replace("$C2BLENGTH$", "0x" + Integer.toString(c2blen, 16)); + } + if (line.indexOf("$NONROUNDTRIP_B2C$") != -1) { + if (b2cNR == null) + continue; + line = line.replace("$NONROUNDTRIP_B2C$", b2cNR); + } + + if (line.indexOf("$NONROUNDTRIP_C2B$") != -1) { + if (c2bNR == null) + continue; + line = line.replace("$NONROUNDTRIP_C2B$", c2bNR); + } + out.println(line); + } + out.close(); + } +} diff --git a/jdk/src/share/classes/sun/io/ByteToCharCp850.java b/jdk/src/share/classes/sun/io/ByteToCharCp850.java index c048a6b7ec1..62ceb3dba84 100644 --- a/jdk/src/share/classes/sun/io/ByteToCharCp850.java +++ b/jdk/src/share/classes/sun/io/ByteToCharCp850.java @@ -1,5 +1,5 @@ /* - * Copyright 1996-2005 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1996-2002 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 @@ -23,7 +23,6 @@ * have any questions. */ - package sun.io; import sun.nio.cs.IBM850; @@ -32,6 +31,7 @@ import sun.nio.cs.IBM850; * A table to convert to Cp850 to Unicode * * @author ConverterGenerator tool + * @version >= JDK1.1.6 */ public class ByteToCharCp850 extends ByteToCharSingleByte { @@ -41,6 +41,6 @@ public class ByteToCharCp850 extends ByteToCharSingleByte { } public ByteToCharCp850() { - super.byteToCharTable = IBM850.getDecoderSingleByteMappings(); + super.byteToCharTable = new IBM850().getDecoderSingleByteMappings(); } } diff --git a/jdk/src/share/classes/sun/io/CharToByteJIS0201.java b/jdk/src/share/classes/sun/io/CharToByteJIS0201.java index ea78fa7ddc4..ac85f5da75c 100644 --- a/jdk/src/share/classes/sun/io/CharToByteJIS0201.java +++ b/jdk/src/share/classes/sun/io/CharToByteJIS0201.java @@ -1,5 +1,5 @@ /* - * Copyright 1997-1998 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1996-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 @@ -29,6 +29,7 @@ package sun.io; * Tables and data to convert Unicode to JIS0201 * * @author ConverterGenerator tool + * @version >= JDK1.1.6 */ class CharToByteJIS0201 extends CharToByteSingleByte { @@ -41,8 +42,21 @@ class CharToByteJIS0201 extends CharToByteSingleByte { super.mask1 = 0xFF00; super.mask2 = 0x00FF; super.shift = 8; + /* super.index1 = index1; super.index2 = index2; + */ + } + + public byte getNative(char inputChar) { + return (byte)index2.charAt(index1[(inputChar & mask1) >> shift] + + (inputChar & mask2)); + } + + public boolean canConvert(char ch) { + if (index2.charAt(index1[((ch & mask1) >> shift)] + (ch & mask2)) != '\u0000') + return true; + return (ch == '\u0000'); } private final static String index2 = diff --git a/jdk/src/share/classes/sun/io/CharToByteSingleByte.java b/jdk/src/share/classes/sun/io/CharToByteSingleByte.java index 0812b6822e2..f56e3279a39 100644 --- a/jdk/src/share/classes/sun/io/CharToByteSingleByte.java +++ b/jdk/src/share/classes/sun/io/CharToByteSingleByte.java @@ -1,5 +1,5 @@ /* - * Copyright 1996-2002 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1996-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 @@ -25,6 +25,8 @@ package sun.io; +import static sun.nio.cs.CharsetMapping.*; + /** * A table driven conversion from char to byte for single byte * character sets. Tables will reside in the class CharToByteYYYYY, @@ -35,6 +37,7 @@ package sun.io; * * @author Lloyd Honomichl * @author Asmus Freytag +* @version 8/28/96 */ public abstract class CharToByteSingleByte extends CharToByteConverter { @@ -42,12 +45,12 @@ public abstract class CharToByteSingleByte extends CharToByteConverter { /* * 1st level index, provided by subclass */ - protected short index1[]; + protected char[] index1; /* * 2nd level index, provided by subclass */ - protected String index2; + protected char[] index2; /* * Mask to isolate bits for 1st level index, from subclass @@ -66,11 +69,11 @@ public abstract class CharToByteSingleByte extends CharToByteConverter { private char highHalfZoneCode; - public short[] getIndex1() { + public char[] getIndex1() { return index1; } - public String getIndex2() { + public char[] getIndex2() { return index2; } public int flush(byte[] output, int outStart, int outEnd) @@ -229,9 +232,18 @@ public abstract class CharToByteSingleByte extends CharToByteConverter { return 1; } + int encodeChar(char ch) { + char index = index1[ch >> 8]; + if (index == UNMAPPABLE_ENCODING) + return UNMAPPABLE_ENCODING; + return index2[index + (ch & 0xff)]; + } + public byte getNative(char inputChar) { - return (byte)index2.charAt(index1[(inputChar & mask1) >> shift] - + (inputChar & mask2)); + int b = encodeChar(inputChar); + if (b == UNMAPPABLE_ENCODING) + return 0; + return (byte)b; } /** @@ -248,11 +260,6 @@ public abstract class CharToByteSingleByte extends CharToByteConverter { * @return true if a character is mappable */ public boolean canConvert(char ch) { - // Look it up in the table - if (index2.charAt(index1[((ch & mask1) >> shift)] + (ch & mask2)) != '\u0000') - return true; - - // Nulls are always mappable - return (ch == '\u0000'); + return encodeChar(ch) != UNMAPPABLE_ENCODING; } } diff --git a/jdk/src/share/classes/sun/nio/cs/IBM437.java b/jdk/src/share/classes/sun/nio/cs/IBM437.java deleted file mode 100644 index bf4f77c6051..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/IBM437.java +++ /dev/null @@ -1,368 +0,0 @@ -/* - * Copyright 2003-2005 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 sun.nio.cs; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM437 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM437() { - super("IBM437", StandardCharsets.aliases_IBM437); - } - - public String historicalName() { - return "Cp437"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM437); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u00C7\u00FC\u00E9\u00E2\u00E4\u00E0\u00E5\u00E7" + // 0x80 - 0x87 - "\u00EA\u00EB\u00E8\u00EF\u00EE\u00EC\u00C4\u00C5" + // 0x88 - 0x8F - "\u00C9\u00E6\u00C6\u00F4\u00F6\u00F2\u00FB\u00F9" + // 0x90 - 0x97 - "\u00FF\u00D6\u00DC\u00A2\u00A3\u00A5\u20A7\u0192" + // 0x98 - 0x9F - "\u00E1\u00ED\u00F3\u00FA\u00F1\u00D1\u00AA\u00BA" + // 0xA0 - 0xA7 - "\u00BF\u2310\u00AC\u00BD\u00BC\u00A1\u00AB\u00BB" + // 0xA8 - 0xAF - "\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556" + // 0xB0 - 0xB7 - "\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510" + // 0xB8 - 0xBF - "\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F" + // 0xC0 - 0xC7 - "\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567" + // 0xC8 - 0xCF - "\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B" + // 0xD0 - 0xD7 - "\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580" + // 0xD8 - 0xDF - "\u03B1\u00DF\u0393\u03C0\u03A3\u03C3\u00B5\u03C4" + // 0xE0 - 0xE7 - "\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229" + // 0xE8 - 0xEF - "\u2261\u00B1\u2265\u2264\u2320\u2321\u00F7\u2248" + // 0xF0 - 0xF7 - "\u00B0\u2219\u00B7\u221A\u207F\u00B2\u25A0\u00A0" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00FF\u00AD\u009B\u009C\u0000\u009D\u0000\u0000" + - "\u0000\u0000\u00A6\u00AE\u00AA\u0000\u0000\u0000" + - "\u00F8\u00F1\u00FD\u0000\u0000\u00E6\u0000\u00FA" + - "\u0000\u0000\u00A7\u00AF\u00AC\u00AB\u0000\u00A8" + - "\u0000\u0000\u0000\u0000\u008E\u008F\u0092\u0080" + - "\u0000\u0090\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00A5\u0000\u0000\u0000\u0000\u0099\u0000" + - "\u0000\u0000\u0000\u0000\u009A\u0000\u0000\u00E1" + - "\u0085\u00A0\u0083\u0000\u0084\u0086\u0091\u0087" + - "\u008A\u0082\u0088\u0089\u008D\u00A1\u008C\u008B" + - "\u0000\u00A4\u0095\u00A2\u0093\u0000\u0094\u00F6" + - "\u0000\u0097\u00A3\u0096\u0081\u0000\u0000\u0098" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u009F\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00E2\u0000\u0000\u0000\u0000" + - "\u00E9\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00E4\u0000\u0000\u00E8\u0000" + - "\u0000\u00EA\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00E0\u0000\u0000\u00EB\u00EE\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00E3\u0000\u0000\u00E5\u00E7\u0000\u00ED\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00FC\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u009E\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00F9" + - "\u00FB\u0000\u0000\u0000\u00EC\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00EF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00F7\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00F0" + - "\u0000\u0000\u00F3\u00F2\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00A9\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00F4\u00F5" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00C4\u0000" + - "\u00B3\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00DA\u0000\u0000\u0000\u00BF\u0000" + - "\u0000\u0000\u00C0\u0000\u0000\u0000\u00D9\u0000" + - "\u0000\u0000\u00C3\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00B4\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00C2\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00C1\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00C5\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00CD\u00BA" + - "\u00D5\u00D6\u00C9\u00B8\u00B7\u00BB\u00D4\u00D3" + - "\u00C8\u00BE\u00BD\u00BC\u00C6\u00C7\u00CC\u00B5" + - "\u00B6\u00B9\u00D1\u00D2\u00CB\u00CF\u00D0\u00CA" + - "\u00D8\u00D7\u00CE\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00DF\u0000" + - "\u0000\u0000\u00DC\u0000\u0000\u0000\u00DB\u0000" + - "\u0000\u0000\u00DD\u0000\u0000\u0000\u00DE\u00B0" + - "\u00B1\u00B2\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00FE\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 403, 512, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 711, 403, 942, 1182, 403, 1438, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/IBM737.java b/jdk/src/share/classes/sun/nio/cs/IBM737.java deleted file mode 100644 index 2d5b7509b2c..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/IBM737.java +++ /dev/null @@ -1,321 +0,0 @@ -/* - * Copyright 2003-2005 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 sun.nio.cs; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM737 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM737() { - super("x-IBM737", StandardCharsets.aliases_IBM737); - } - - public String historicalName() { - return "Cp737"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM737); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398" + // 0x80 - 0x87 - "\u0399\u039A\u039B\u039C\u039D\u039E\u039F\u03A0" + // 0x88 - 0x8F - "\u03A1\u03A3\u03A4\u03A5\u03A6\u03A7\u03A8\u03A9" + // 0x90 - 0x97 - "\u03B1\u03B2\u03B3\u03B4\u03B5\u03B6\u03B7\u03B8" + // 0x98 - 0x9F - "\u03B9\u03BA\u03BB\u03BC\u03BD\u03BE\u03BF\u03C0" + // 0xA0 - 0xA7 - "\u03C1\u03C3\u03C2\u03C4\u03C5\u03C6\u03C7\u03C8" + // 0xA8 - 0xAF - "\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556" + // 0xB0 - 0xB7 - "\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510" + // 0xB8 - 0xBF - "\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F" + // 0xC0 - 0xC7 - "\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567" + // 0xC8 - 0xCF - "\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B" + // 0xD0 - 0xD7 - "\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580" + // 0xD8 - 0xDF - "\u03C9\u03AC\u03AD\u03AE\u03CA\u03AF\u03CC\u03CD" + // 0xE0 - 0xE7 - "\u03CB\u03CE\u0386\u0388\u0389\u038A\u038C\u038E" + // 0xE8 - 0xEF - "\u038F\u00B1\u2265\u2264\u03AA\u03AB\u00F7\u2248" + // 0xF0 - 0xF7 - "\u00B0\u2219\u00B7\u221A\u207F\u00B2\u25A0\u00A0" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00FF\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00F8\u00F1\u00FD\u0000\u0000\u0000\u0000\u00FA" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00F6" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00EA\u0000\u00EB\u00EC\u00ED\u0000\u00EE\u0000" + - "\u00EF\u00F0\u0000\u0080\u0081\u0082\u0083\u0084" + - "\u0085\u0086\u0087\u0088\u0089\u008A\u008B\u008C" + - "\u008D\u008E\u008F\u0090\u0000\u0091\u0092\u0093" + - "\u0094\u0095\u0096\u0097\u00F4\u00F5\u00E1\u00E2" + - "\u00E3\u00E5\u0000\u0098\u0099\u009A\u009B\u009C" + - "\u009D\u009E\u009F\u00A0\u00A1\u00A2\u00A3\u00A4" + - "\u00A5\u00A6\u00A7\u00A8\u00AA\u00A9\u00AB\u00AC" + - "\u00AD\u00AE\u00AF\u00E0\u00E4\u00E8\u00E6\u00E7" + - "\u00E9\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00FC\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00F9\u00FB\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00F7\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00F3\u00F2\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00C4\u0000\u00B3\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00DA\u0000\u0000\u0000" + - "\u00BF\u0000\u0000\u0000\u00C0\u0000\u0000\u0000" + - "\u00D9\u0000\u0000\u0000\u00C3\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00B4\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00C2\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00C1\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00C5\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00CD\u00BA\u00D5\u00D6\u00C9\u00B8\u00B7\u00BB" + - "\u00D4\u00D3\u00C8\u00BE\u00BD\u00BC\u00C6\u00C7" + - "\u00CC\u00B5\u00B6\u00B9\u00D1\u00D2\u00CB\u00CF" + - "\u00D0\u00CA\u00D8\u00D7\u00CE\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00DF\u0000\u0000\u0000\u00DC\u0000\u0000\u0000" + - "\u00DB\u0000\u0000\u0000\u00DD\u0000\u0000\u0000" + - "\u00DE\u00B0\u00B1\u00B2\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00FE\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 248, 248, 370, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 577, 248, 808, 248, 248, 1064, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/IBM775.java b/jdk/src/share/classes/sun/nio/cs/IBM775.java deleted file mode 100644 index c0185c9ca6a..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/IBM775.java +++ /dev/null @@ -1,326 +0,0 @@ -/* - * Copyright 2003-2005 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 sun.nio.cs; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM775 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM775() { - super("IBM775", StandardCharsets.aliases_IBM775); - } - - public String historicalName() { - return "Cp775"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM775); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u0106\u00FC\u00E9\u0101\u00E4\u0123\u00E5\u0107" + // 0x80 - 0x87 - "\u0142\u0113\u0156\u0157\u012B\u0179\u00C4\u00C5" + // 0x88 - 0x8F - "\u00C9\u00E6\u00C6\u014D\u00F6\u0122\u00A2\u015A" + // 0x90 - 0x97 - "\u015B\u00D6\u00DC\u00F8\u00A3\u00D8\u00D7\u00A4" + // 0x98 - 0x9F - "\u0100\u012A\u00F3\u017B\u017C\u017A\u201D\u00A6" + // 0xA0 - 0xA7 - "\u00A9\u00AE\u00AC\u00BD\u00BC\u0141\u00AB\u00BB" + // 0xA8 - 0xAF - "\u2591\u2592\u2593\u2502\u2524\u0104\u010C\u0118" + // 0xB0 - 0xB7 - "\u0116\u2563\u2551\u2557\u255D\u012E\u0160\u2510" + // 0xB8 - 0xBF - "\u2514\u2534\u252C\u251C\u2500\u253C\u0172\u016A" + // 0xC0 - 0xC7 - "\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u017D" + // 0xC8 - 0xCF - "\u0105\u010D\u0119\u0117\u012F\u0161\u0173\u016B" + // 0xD0 - 0xD7 - "\u017E\u2518\u250C\u2588\u2584\u258C\u2590\u2580" + // 0xD8 - 0xDF - "\u00D3\u00DF\u014C\u0143\u00F5\u00D5\u00B5\u0144" + // 0xE0 - 0xE7 - "\u0136\u0137\u013B\u013C\u0146\u0112\u0145\u2019" + // 0xE8 - 0xEF - "\u00AD\u00B1\u201C\u00BE\u00B6\u00A7\u00F7\u201E" + // 0xF0 - 0xF7 - "\u00B0\u2219\u00B7\u00B9\u00B3\u00B2\u25A0\u00A0" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00FF\u0000\u0096\u009C\u009F\u0000\u00A7\u00F5" + - "\u0000\u00A8\u0000\u00AE\u00AA\u00F0\u00A9\u0000" + - "\u00F8\u00F1\u00FD\u00FC\u0000\u00E6\u00F4\u00FA" + - "\u0000\u00FB\u0000\u00AF\u00AC\u00AB\u00F3\u0000" + - "\u0000\u0000\u0000\u0000\u008E\u008F\u0092\u0000" + - "\u0000\u0090\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00E0\u0000\u00E5\u0099\u009E" + - "\u009D\u0000\u0000\u0000\u009A\u0000\u0000\u00E1" + - "\u0000\u0000\u0000\u0000\u0084\u0086\u0091\u0000" + - "\u0000\u0082\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00A2\u0000\u00E4\u0094\u00F6" + - "\u009B\u0000\u0000\u0000\u0081\u0000\u0000\u0000" + - "\u00A0\u0083\u0000\u0000\u00B5\u00D0\u0080\u0087" + - "\u0000\u0000\u0000\u0000\u00B6\u00D1\u0000\u0000" + - "\u0000\u0000\u00ED\u0089\u0000\u0000\u00B8\u00D3" + - "\u00B7\u00D2\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0095\u0085\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00A1\u008C\u0000\u0000\u00BD\u00D4" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00E8\u00E9" + - "\u0000\u0000\u0000\u00EA\u00EB\u0000\u0000\u0000" + - "\u0000\u00AD\u0088\u00E3\u00E7\u00EE\u00EC\u0000" + - "\u0000\u0000\u0000\u0000\u00E2\u0093\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u008A\u008B" + - "\u0000\u0000\u0097\u0098\u0000\u0000\u0000\u0000" + - "\u00BE\u00D5\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00C7\u00D7\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00C6\u00D6\u0000\u0000\u0000\u0000" + - "\u0000\u008D\u00A5\u00A3\u00A4\u00CF\u00D8\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00EF" + - "\u0000\u0000\u00F2\u00A6\u00F7\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00F9\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00C4\u0000\u00B3" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00DA\u0000\u0000\u0000\u00BF\u0000\u0000" + - "\u0000\u00C0\u0000\u0000\u0000\u00D9\u0000\u0000" + - "\u0000\u00C3\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00B4\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00C2\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00C1\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00C5\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00CD\u00BA\u0000" + - "\u0000\u00C9\u0000\u0000\u00BB\u0000\u0000\u00C8" + - "\u0000\u0000\u00BC\u0000\u0000\u00CC\u0000\u0000" + - "\u00B9\u0000\u0000\u00CB\u0000\u0000\u00CA\u0000" + - "\u0000\u00CE\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00DF\u0000\u0000" + - "\u0000\u00DC\u0000\u0000\u0000\u00DB\u0000\u0000" + - "\u0000\u00DD\u0000\u0000\u0000\u00DE\u00B0\u00B1" + - "\u00B2\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00FE\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 614, 383, 845, 383, 383, 1101, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/IBM850.java b/jdk/src/share/classes/sun/nio/cs/IBM850.java deleted file mode 100644 index 6bb2a0bae0a..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/IBM850.java +++ /dev/null @@ -1,299 +0,0 @@ -/* - * Copyright 2003-2005 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 sun.nio.cs; - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM850 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM850() { - super("IBM850", StandardCharsets.aliases_IBM850); - } - - public String historicalName() { - return "Cp850"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM850); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public static String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - protected static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u00C7\u00FC\u00E9\u00E2\u00E4\u00E0\u00E5\u00E7" + // 0x80 - 0x87 - "\u00EA\u00EB\u00E8\u00EF\u00EE\u00EC\u00C4\u00C5" + // 0x88 - 0x8F - "\u00C9\u00E6\u00C6\u00F4\u00F6\u00F2\u00FB\u00F9" + // 0x90 - 0x97 - "\u00FF\u00D6\u00DC\u00F8\u00A3\u00D8\u00D7\u0192" + // 0x98 - 0x9F - "\u00E1\u00ED\u00F3\u00FA\u00F1\u00D1\u00AA\u00BA" + // 0xA0 - 0xA7 - "\u00BF\u00AE\u00AC\u00BD\u00BC\u00A1\u00AB\u00BB" + // 0xA8 - 0xAF - "\u2591\u2592\u2593\u2502\u2524\u00C1\u00C2\u00C0" + // 0xB0 - 0xB7 - "\u00A9\u2563\u2551\u2557\u255D\u00A2\u00A5\u2510" + // 0xB8 - 0xBF - "\u2514\u2534\u252C\u251C\u2500\u253C\u00E3\u00C3" + // 0xC0 - 0xC7 - "\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u00A4" + // 0xC8 - 0xCF - "\u00F0\u00D0\u00CA\u00CB\u00C8\u0131\u00CD\u00CE" + // 0xD0 - 0xD7 - "\u00CF\u2518\u250C\u2588\u2584\u00A6\u00CC\u2580" + // 0xD8 - 0xDF - "\u00D3\u00DF\u00D4\u00D2\u00F5\u00D5\u00B5\u00FE" + // 0xE0 - 0xE7 - "\u00DE\u00DA\u00DB\u00D9\u00FD\u00DD\u00AF\u00B4" + // 0xE8 - 0xEF - "\u00AD\u00B1\u2017\u00BE\u00B6\u00A7\u00F7\u00B8" + // 0xF0 - 0xF7 - "\u00B0\u00A8\u00B7\u00B9\u00B3\u00B2\u25A0\u00A0" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - protected static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00FF\u00AD\u00BD\u009C\u00CF\u00BE\u00DD\u00F5" + - "\u00F9\u00B8\u00A6\u00AE\u00AA\u00F0\u00A9\u00EE" + - "\u00F8\u00F1\u00FD\u00FC\u00EF\u00E6\u00F4\u00FA" + - "\u00F7\u00FB\u00A7\u00AF\u00AC\u00AB\u00F3\u00A8" + - "\u00B7\u00B5\u00B6\u00C7\u008E\u008F\u0092\u0080" + - "\u00D4\u0090\u00D2\u00D3\u00DE\u00D6\u00D7\u00D8" + - "\u00D1\u00A5\u00E3\u00E0\u00E2\u00E5\u0099\u009E" + - "\u009D\u00EB\u00E9\u00EA\u009A\u00ED\u00E8\u00E1" + - "\u0085\u00A0\u0083\u00C6\u0084\u0086\u0091\u0087" + - "\u008A\u0082\u0088\u0089\u008D\u00A1\u008C\u008B" + - "\u00D0\u00A4\u0095\u00A2\u0093\u00E4\u0094\u00F6" + - "\u009B\u0097\u00A3\u0096\u0081\u00EC\u00E7\u0098" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00D5\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u009F\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00F2\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00C4\u0000\u00B3\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00DA\u0000\u0000\u0000\u00BF\u0000\u0000\u0000" + - "\u00C0\u0000\u0000\u0000\u00D9\u0000\u0000\u0000" + - "\u00C3\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00B4\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00C2\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00C1\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00C5\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00CD\u00BA\u0000\u0000" + - "\u00C9\u0000\u0000\u00BB\u0000\u0000\u00C8\u0000" + - "\u0000\u00BC\u0000\u0000\u00CC\u0000\u0000\u00B9" + - "\u0000\u0000\u00CB\u0000\u0000\u00CA\u0000\u0000" + - "\u00CE\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00DF\u0000\u0000\u0000" + - "\u00DC\u0000\u0000\u0000\u00DB\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00B0\u00B1\u00B2" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00FE\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 636, 403, 403, 403, 403, 892, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/IBM852.java b/jdk/src/share/classes/sun/nio/cs/IBM852.java deleted file mode 100644 index c157d929d6f..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/IBM852.java +++ /dev/null @@ -1,274 +0,0 @@ -/* - * Copyright 2003-2005 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 sun.nio.cs; - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM852 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM852() { - super("IBM852", StandardCharsets.aliases_IBM852); - } - - public String historicalName() { - return "Cp852"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM852); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u00C7\u00FC\u00E9\u00E2\u00E4\u016F\u0107\u00E7" + // 0x80 - 0x87 - "\u0142\u00EB\u0150\u0151\u00EE\u0179\u00C4\u0106" + // 0x88 - 0x8F - "\u00C9\u0139\u013A\u00F4\u00F6\u013D\u013E\u015A" + // 0x90 - 0x97 - "\u015B\u00D6\u00DC\u0164\u0165\u0141\u00D7\u010D" + // 0x98 - 0x9F - "\u00E1\u00ED\u00F3\u00FA\u0104\u0105\u017D\u017E" + // 0xA0 - 0xA7 - "\u0118\u0119\u00AC\u017A\u010C\u015F\u00AB\u00BB" + // 0xA8 - 0xAF - "\u2591\u2592\u2593\u2502\u2524\u00C1\u00C2\u011A" + // 0xB0 - 0xB7 - "\u015E\u2563\u2551\u2557\u255D\u017B\u017C\u2510" + // 0xB8 - 0xBF - "\u2514\u2534\u252C\u251C\u2500\u253C\u0102\u0103" + // 0xC0 - 0xC7 - "\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u00A4" + // 0xC8 - 0xCF - "\u0111\u0110\u010E\u00CB\u010F\u0147\u00CD\u00CE" + // 0xD0 - 0xD7 - "\u011B\u2518\u250C\u2588\u2584\u0162\u016E\u2580" + // 0xD8 - 0xDF - "\u00D3\u00DF\u00D4\u0143\u0144\u0148\u0160\u0161" + // 0xE0 - 0xE7 - "\u0154\u00DA\u0155\u0170\u00FD\u00DD\u0163\u00B4" + // 0xE8 - 0xEF - "\u00AD\u02DD\u02DB\u02C7\u02D8\u00A7\u00F7\u00B8" + // 0xF0 - 0xF7 - "\u00B0\u00A8\u02D9\u0171\u0158\u0159\u25A0\u00A0" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00FF\u0000\u0000\u0000\u00CF\u0000\u0000\u00F5" + - "\u00F9\u0000\u0000\u00AE\u00AA\u00F0\u0000\u0000" + - "\u00F8\u0000\u0000\u0000\u00EF\u0000\u0000\u0000" + - "\u00F7\u0000\u0000\u00AF\u0000\u0000\u0000\u0000" + - "\u0000\u00B5\u00B6\u0000\u008E\u0000\u0000\u0080" + - "\u0000\u0090\u0000\u00D3\u0000\u00D6\u00D7\u0000" + - "\u0000\u0000\u0000\u00E0\u00E2\u0000\u0099\u009E" + - "\u0000\u0000\u00E9\u0000\u009A\u00ED\u0000\u00E1" + - "\u0000\u00A0\u0083\u0000\u0084\u0000\u0000\u0087" + - "\u0000\u0082\u0000\u0089\u0000\u00A1\u008C\u0000" + - "\u0000\u0000\u0000\u00A2\u0093\u0000\u0094\u00F6" + - "\u0000\u0000\u00A3\u0000\u0081\u00EC\u0000\u0000" + - "\u00C6\u00C7\u00A4\u00A5\u008F\u0086\u0000\u0000" + - "\u0000\u0000\u00AC\u009F\u00D2\u00D4\u00D1\u00D0" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00A8\u00A9" + - "\u00B7\u00D8\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0091" + - "\u0092\u0000\u0000\u0095\u0096\u0000\u0000\u009D" + - "\u0088\u00E3\u00E4\u0000\u0000\u00D5\u00E5\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u008A\u008B" + - "\u0000\u0000\u00E8\u00EA\u0000\u0000\u00FC\u00FD" + - "\u0097\u0098\u0000\u0000\u00B8\u00AD\u00E6\u00E7" + - "\u00DD\u00EE\u009B\u009C\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00DE\u0085\u00EB\u00FB" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u008D" + - "\u00AB\u00BD\u00BE\u00A6\u00A7\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00F3\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00F4\u00FA" + - "\u0000\u00F2\u0000\u00F1\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00C4\u0000" + - "\u00B3\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00DA\u0000\u0000\u0000\u00BF\u0000" + - "\u0000\u0000\u00C0\u0000\u0000\u0000\u00D9\u0000" + - "\u0000\u0000\u00C3\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00B4\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00C2\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00C1\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00C5\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00CD\u00BA" + - "\u0000\u0000\u00C9\u0000\u0000\u00BB\u0000\u0000" + - "\u00C8\u0000\u0000\u00BC\u0000\u0000\u00CC\u0000" + - "\u0000\u00B9\u0000\u0000\u00CB\u0000\u0000\u00CA" + - "\u0000\u0000\u00CE\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00DF\u0000" + - "\u0000\u0000\u00DC\u0000\u0000\u0000\u00DB\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00B0" + - "\u00B1\u00B2\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00FE\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 254, 438, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 694, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/IBM855.java b/jdk/src/share/classes/sun/nio/cs/IBM855.java deleted file mode 100644 index f27b9900572..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/IBM855.java +++ /dev/null @@ -1,304 +0,0 @@ -/* - * Copyright 2003-2005 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 sun.nio.cs; - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM855 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM855() { - super("IBM855", StandardCharsets.aliases_IBM855); - } - - public String historicalName() { - return "Cp855"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM855); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u0452\u0402\u0453\u0403\u0451\u0401\u0454\u0404" + // 0x80 - 0x87 - "\u0455\u0405\u0456\u0406\u0457\u0407\u0458\u0408" + // 0x88 - 0x8F - "\u0459\u0409\u045A\u040A\u045B\u040B\u045C\u040C" + // 0x90 - 0x97 - "\u045E\u040E\u045F\u040F\u044E\u042E\u044A\u042A" + // 0x98 - 0x9F - "\u0430\u0410\u0431\u0411\u0446\u0426\u0434\u0414" + // 0xA0 - 0xA7 - "\u0435\u0415\u0444\u0424\u0433\u0413\u00AB\u00BB" + // 0xA8 - 0xAF - "\u2591\u2592\u2593\u2502\u2524\u0445\u0425\u0438" + // 0xB0 - 0xB7 - "\u0418\u2563\u2551\u2557\u255D\u0439\u0419\u2510" + // 0xB8 - 0xBF - "\u2514\u2534\u252C\u251C\u2500\u253C\u043A\u041A" + // 0xC0 - 0xC7 - "\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u00A4" + // 0xC8 - 0xCF - "\u043B\u041B\u043C\u041C\u043D\u041D\u043E\u041E" + // 0xD0 - 0xD7 - "\u043F\u2518\u250C\u2588\u2584\u041F\u044F\u2580" + // 0xD8 - 0xDF - "\u042F\u0440\u0420\u0441\u0421\u0442\u0422\u0443" + // 0xE0 - 0xE7 - "\u0423\u0436\u0416\u0432\u0412\u044C\u042C\u2116" + // 0xE8 - 0xEF - "\u00AD\u044B\u042B\u0437\u0417\u0448\u0428\u044D" + // 0xF0 - 0xF7 - "\u042D\u0449\u0429\u0447\u0427\u00A7\u25A0\u00A0" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00FF\u0000\u0000\u0000\u00CF\u0000\u0000\u00FD" + - "\u0000\u0000\u0000\u00AE\u0000\u00F0\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00AF\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0085\u0081\u0083\u0087" + - "\u0089\u008B\u008D\u008F\u0091\u0093\u0095\u0097" + - "\u0000\u0099\u009B\u00A1\u00A3\u00EC\u00AD\u00A7" + - "\u00A9\u00EA\u00F4\u00B8\u00BE\u00C7\u00D1\u00D3" + - "\u00D5\u00D7\u00DD\u00E2\u00E4\u00E6\u00E8\u00AB" + - "\u00B6\u00A5\u00FC\u00F6\u00FA\u009F\u00F2\u00EE" + - "\u00F8\u009D\u00E0\u00A0\u00A2\u00EB\u00AC\u00A6" + - "\u00A8\u00E9\u00F3\u00B7\u00BD\u00C6\u00D0\u00D2" + - "\u00D4\u00D6\u00D8\u00E1\u00E3\u00E5\u00E7\u00AA" + - "\u00B5\u00A4\u00FB\u00F5\u00F9\u009E\u00F1\u00ED" + - "\u00F7\u009C\u00DE\u0000\u0084\u0080\u0082\u0086" + - "\u0088\u008A\u008C\u008E\u0090\u0092\u0094\u0096" + - "\u0000\u0098\u009A\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00EF\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00C4\u0000\u00B3" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00DA\u0000\u0000\u0000\u00BF\u0000\u0000" + - "\u0000\u00C0\u0000\u0000\u0000\u00D9\u0000\u0000" + - "\u0000\u00C3\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00B4\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00C2\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00C1\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00C5\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00CD\u00BA\u0000" + - "\u0000\u00C9\u0000\u0000\u00BB\u0000\u0000\u00C8" + - "\u0000\u0000\u00BC\u0000\u0000\u00CC\u0000\u0000" + - "\u00B9\u0000\u0000\u00CB\u0000\u0000\u00CA\u0000" + - "\u0000\u00CE\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00DF\u0000\u0000" + - "\u0000\u00DC\u0000\u0000\u0000\u00DB\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00B0\u00B1" + - "\u00B2\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00FE\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 188, 188, 188, 443, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 677, 188, 188, 188, 933, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/IBM857.java b/jdk/src/share/classes/sun/nio/cs/IBM857.java deleted file mode 100644 index 1462d6dc38d..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/IBM857.java +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright 2003-2005 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 sun.nio.cs; - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM857 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM857() { - super("IBM857", StandardCharsets.aliases_IBM857); - } - - public String historicalName() { - return "Cp857"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM857); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u00C7\u00FC\u00E9\u00E2\u00E4\u00E0\u00E5\u00E7" + // 0x80 - 0x87 - "\u00EA\u00EB\u00E8\u00EF\u00EE\u0131\u00C4\u00C5" + // 0x88 - 0x8F - "\u00C9\u00E6\u00C6\u00F4\u00F6\u00F2\u00FB\u00F9" + // 0x90 - 0x97 - "\u0130\u00D6\u00DC\u00F8\u00A3\u00D8\u015E\u015F" + // 0x98 - 0x9F - "\u00E1\u00ED\u00F3\u00FA\u00F1\u00D1\u011E\u011F" + // 0xA0 - 0xA7 - "\u00BF\u00AE\u00AC\u00BD\u00BC\u00A1\u00AB\u00BB" + // 0xA8 - 0xAF - "\u2591\u2592\u2593\u2502\u2524\u00C1\u00C2\u00C0" + // 0xB0 - 0xB7 - "\u00A9\u2563\u2551\u2557\u255D\u00A2\u00A5\u2510" + // 0xB8 - 0xBF - "\u2514\u2534\u252C\u251C\u2500\u253C\u00E3\u00C3" + // 0xC0 - 0xC7 - "\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u00A4" + // 0xC8 - 0xCF - "\u00BA\u00AA\u00CA\u00CB\u00C8\uFFFD\u00CD\u00CE" + // 0xD0 - 0xD7 - "\u00CF\u2518\u250C\u2588\u2584\u00A6\u00CC\u2580" + // 0xD8 - 0xDF - "\u00D3\u00DF\u00D4\u00D2\u00F5\u00D5\u00B5\uFFFD" + // 0xE0 - 0xE7 - "\u00D7\u00DA\u00DB\u00D9\u00EC\u00FF\u00AF\u00B4" + // 0xE8 - 0xEF - "\u00AD\u00B1\uFFFD\u00BE\u00B6\u00A7\u00F7\u00B8" + // 0xF0 - 0xF7 - "\u00B0\u00A8\u00B7\u00B9\u00B3\u00B2\u25A0\u00A0" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00FF\u00AD\u00BD\u009C\u00CF\u00BE\u00DD\u00F5" + - "\u00F9\u00B8\u00D1\u00AE\u00AA\u00F0\u00A9\u00EE" + - "\u00F8\u00F1\u00FD\u00FC\u00EF\u00E6\u00F4\u00FA" + - "\u00F7\u00FB\u00D0\u00AF\u00AC\u00AB\u00F3\u00A8" + - "\u00B7\u00B5\u00B6\u00C7\u008E\u008F\u0092\u0080" + - "\u00D4\u0090\u00D2\u00D3\u00DE\u00D6\u00D7\u00D8" + - "\u0000\u00A5\u00E3\u00E0\u00E2\u00E5\u0099\u00E8" + - "\u009D\u00EB\u00E9\u00EA\u009A\u0000\u0000\u00E1" + - "\u0085\u00A0\u0083\u00C6\u0084\u0086\u0091\u0087" + - "\u008A\u0082\u0088\u0089\u00EC\u00A1\u008C\u008B" + - "\u0000\u00A4\u0095\u00A2\u0093\u00E4\u0094\u00F6" + - "\u009B\u0097\u00A3\u0096\u0081\u0000\u0000\u00ED" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00A6\u00A7" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0098\u008D\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u009E\u009F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00C4\u0000\u00B3\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00DA\u0000\u0000\u0000" + - "\u00BF\u0000\u0000\u0000\u00C0\u0000\u0000\u0000" + - "\u00D9\u0000\u0000\u0000\u00C3\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00B4\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00C2\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00C1\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00C5\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00CD\u00BA\u0000\u0000\u00C9\u0000\u0000\u00BB" + - "\u0000\u0000\u00C8\u0000\u0000\u00BC\u0000\u0000" + - "\u00CC\u0000\u0000\u00B9\u0000\u0000\u00CB\u0000" + - "\u0000\u00CA\u0000\u0000\u00CE\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00DF\u0000\u0000\u0000\u00DC\u0000\u0000\u0000" + - "\u00DB\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00B0\u00B1\u00B2\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00FE\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 608, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/IBM858.java b/jdk/src/share/classes/sun/nio/cs/IBM858.java deleted file mode 100644 index ffe7ce0200a..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/IBM858.java +++ /dev/null @@ -1,264 +0,0 @@ -/* - * Copyright 2003-2005 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 sun.nio.cs; - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM858 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM858() { - super("IBM00858", StandardCharsets.aliases_IBM858); - } - - public String historicalName() { - return "Cp858"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM858); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public static String getDecoderSingleByteMappings() { - return IBM850.getDecoderSingleByteMappings(); - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends IBM850.Decoder { - public Decoder(Charset cs) { - super(cs); - } - - public char decode(int byteIndex) { - return (byteIndex == (byte)0xD5) ? '\u20AC' : super.decode(byteIndex); - } - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00FF\u00AD\u00BD\u009C\u00CF\u00BE\u00DD\u00F5" + - "\u00F9\u00B8\u00A6\u00AE\u00AA\u00F0\u00A9\u00EE" + - "\u00F8\u00F1\u00FD\u00FC\u00EF\u00E6\u00F4\u00FA" + - "\u00F7\u00FB\u00A7\u00AF\u00AC\u00AB\u00F3\u00A8" + - "\u00B7\u00B5\u00B6\u00C7\u008E\u008F\u0092\u0080" + - "\u00D4\u0090\u00D2\u00D3\u00DE\u00D6\u00D7\u00D8" + - "\u00D1\u00A5\u00E3\u00E0\u00E2\u00E5\u0099\u009E" + - "\u009D\u00EB\u00E9\u00EA\u009A\u00ED\u00E8\u00E1" + - "\u0085\u00A0\u0083\u00C6\u0084\u0086\u0091\u0087" + - "\u008A\u0082\u0088\u0089\u008D\u00A1\u008C\u008B" + - "\u00D0\u00A4\u0095\u00A2\u0093\u00E4\u0094\u00F6" + - "\u009B\u0097\u00A3\u0096\u0081\u00EC\u00E7\u0098" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u009F\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00F2\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00D5\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00C4\u0000\u00B3\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00DA\u0000\u0000\u0000\u00BF\u0000\u0000\u0000" + - "\u00C0\u0000\u0000\u0000\u00D9\u0000\u0000\u0000" + - "\u00C3\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00B4\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00C2\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00C1\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00C5\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00CD\u00BA\u0000\u0000" + - "\u00C9\u0000\u0000\u00BB\u0000\u0000\u00C8\u0000" + - "\u0000\u00BC\u0000\u0000\u00CC\u0000\u0000\u00B9" + - "\u0000\u0000\u00CB\u0000\u0000\u00CA\u0000\u0000" + - "\u00CE\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00DF\u0000\u0000\u0000" + - "\u00DC\u0000\u0000\u0000\u00DB\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00B0\u00B1\u00B2" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00FE\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 636, 403, 403, 403, 403, 892, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/IBM862.java b/jdk/src/share/classes/sun/nio/cs/IBM862.java deleted file mode 100644 index b6498447341..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/IBM862.java +++ /dev/null @@ -1,396 +0,0 @@ -/* - * Copyright 2003-2005 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 sun.nio.cs; - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM862 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM862() { - super("IBM862", StandardCharsets.aliases_IBM862); - } - - public String historicalName() { - return "Cp862"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM862); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u05D0\u05D1\u05D2\u05D3\u05D4\u05D5\u05D6\u05D7" + // 0x80 - 0x87 - "\u05D8\u05D9\u05DA\u05DB\u05DC\u05DD\u05DE\u05DF" + // 0x88 - 0x8F - "\u05E0\u05E1\u05E2\u05E3\u05E4\u05E5\u05E6\u05E7" + // 0x90 - 0x97 - "\u05E8\u05E9\u05EA\u00A2\u00A3\u00A5\u20A7\u0192" + // 0x98 - 0x9F - "\u00E1\u00ED\u00F3\u00FA\u00F1\u00D1\u00AA\u00BA" + // 0xA0 - 0xA7 - "\u00BF\u2310\u00AC\u00BD\u00BC\u00A1\u00AB\u00BB" + // 0xA8 - 0xAF - "\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556" + // 0xB0 - 0xB7 - "\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510" + // 0xB8 - 0xBF - "\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F" + // 0xC0 - 0xC7 - "\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567" + // 0xC8 - 0xCF - "\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B" + // 0xD0 - 0xD7 - "\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580" + // 0xD8 - 0xDF - "\u03B1\u00DF\u0393\u03C0\u03A3\u03C3\u00B5\u03C4" + // 0xE0 - 0xE7 - "\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229" + // 0xE8 - 0xEF - "\u2261\u00B1\u2265\u2264\u2320\u2321\u00F7\u2248" + // 0xF0 - 0xF7 - "\u00B0\u2219\u00B7\u221A\u207F\u00B2\u25A0\u00A0" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00FF\u00AD\u009B\u009C\u0000\u009D\u0000\u0000" + - "\u0000\u0000\u00A6\u00AE\u00AA\u0000\u0000\u0000" + - "\u00F8\u00F1\u00FD\u0000\u0000\u00E6\u0000\u00FA" + - "\u0000\u0000\u00A7\u00AF\u00AC\u00AB\u0000\u00A8" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00A5\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00E1" + - "\u0000\u00A0\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00A1\u0000\u0000" + - "\u0000\u00A4\u0000\u00A2\u0000\u0000\u0000\u00F6" + - "\u0000\u0000\u00A3\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u009F\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00E2\u0000" + - "\u0000\u0000\u0000\u00E9\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00E4\u0000" + - "\u0000\u00E8\u0000\u0000\u00EA\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00E0\u0000\u0000\u00EB" + - "\u00EE\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00E3\u0000\u0000\u00E5\u00E7" + - "\u0000\u00ED\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0080\u0081\u0082\u0083\u0084\u0085" + - "\u0086\u0087\u0088\u0089\u008A\u008B\u008C\u008D" + - "\u008E\u008F\u0090\u0091\u0092\u0093\u0094\u0095" + - "\u0096\u0097\u0098\u0099\u009A\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00FC\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u009E\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00F9\u00FB\u0000" + - "\u0000\u0000\u00EC\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00EF\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00F7\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00F0\u0000\u0000" + - "\u00F3\u00F2\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00A9\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00F4\u00F5\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00C4\u0000\u00B3\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00DA\u0000\u0000\u0000\u00BF\u0000\u0000\u0000" + - "\u00C0\u0000\u0000\u0000\u00D9\u0000\u0000\u0000" + - "\u00C3\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00B4\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00C2\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00C1\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00C5\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00CD\u00BA\u00D5\u00D6" + - "\u00C9\u00B8\u00B7\u00BB\u00D4\u00D3\u00C8\u00BE" + - "\u00BD\u00BC\u00C6\u00C7\u00CC\u00B5\u00B6\u00B9" + - "\u00D1\u00D2\u00CB\u00CF\u00D0\u00CA\u00D8\u00D7" + - "\u00CE\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00DF\u0000\u0000\u0000" + - "\u00DC\u0000\u0000\u0000\u00DB\u0000\u0000\u0000" + - "\u00DD\u0000\u0000\u0000\u00DE\u00B0\u00B1\u00B2" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00FE\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 251, 398, 507, 398, 706, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, - 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, - 941, 398, 1172, 1412, 398, 1668, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, - 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, - 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, - 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, - 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, - 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, - 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, - 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, - 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, - 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, - 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, - 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, - 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, - 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/IBM866.java b/jdk/src/share/classes/sun/nio/cs/IBM866.java deleted file mode 100644 index 5211cb36161..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/IBM866.java +++ /dev/null @@ -1,332 +0,0 @@ -/* - * Copyright 2003-2005 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 sun.nio.cs; - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM866 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM866() { - super("IBM866", StandardCharsets.aliases_IBM866); - } - - public String historicalName() { - return "Cp866"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM866); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417" + // 0x80 - 0x87 - "\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F" + // 0x88 - 0x8F - "\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427" + // 0x90 - 0x97 - "\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F" + // 0x98 - 0x9F - "\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437" + // 0xA0 - 0xA7 - "\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F" + // 0xA8 - 0xAF - "\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556" + // 0xB0 - 0xB7 - "\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510" + // 0xB8 - 0xBF - "\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F" + // 0xC0 - 0xC7 - "\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567" + // 0xC8 - 0xCF - "\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B" + // 0xD0 - 0xD7 - "\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580" + // 0xD8 - 0xDF - "\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447" + // 0xE0 - 0xE7 - "\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F" + // 0xE8 - 0xEF - "\u0401\u0451\u0404\u0454\u0407\u0457\u040E\u045E" + // 0xF0 - 0xF7 - "\u00B0\u2219\u00B7\u221A\u2116\u00A4\u25A0\u00A0" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00FF\u0000\u0000\u0000\u00FD\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00F8\u0000\u0000\u0000\u0000\u0000\u0000\u00FA" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00F0\u0000\u0000\u00F2\u0000\u0000\u00F4\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00F6\u0000\u0080" + - "\u0081\u0082\u0083\u0084\u0085\u0086\u0087\u0088" + - "\u0089\u008A\u008B\u008C\u008D\u008E\u008F\u0090" + - "\u0091\u0092\u0093\u0094\u0095\u0096\u0097\u0098" + - "\u0099\u009A\u009B\u009C\u009D\u009E\u009F\u00A0" + - "\u00A1\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7\u00A8" + - "\u00A9\u00AA\u00AB\u00AC\u00AD\u00AE\u00AF\u00E0" + - "\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7\u00E8" + - "\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF\u0000" + - "\u00F1\u0000\u0000\u00F3\u0000\u0000\u00F5\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00F7\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00FC" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00F9\u00FB\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00C4\u0000\u00B3\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00DA\u0000\u0000\u0000" + - "\u00BF\u0000\u0000\u0000\u00C0\u0000\u0000\u0000" + - "\u00D9\u0000\u0000\u0000\u00C3\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00B4\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00C2\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00C1\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00C5\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00CD\u00BA\u00D5\u00D6\u00C9\u00B8\u00B7\u00BB" + - "\u00D4\u00D3\u00C8\u00BE\u00BD\u00BC\u00C6\u00C7" + - "\u00CC\u00B5\u00B6\u00B9\u00D1\u00D2\u00CB\u00CF" + - "\u00D0\u00CA\u00D8\u00D7\u00CE\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00DF\u0000\u0000\u0000\u00DC\u0000\u0000\u0000" + - "\u00DB\u0000\u0000\u0000\u00DD\u0000\u0000\u0000" + - "\u00DE\u00B0\u00B1\u00B2\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00FE\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 184, 184, 184, 439, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, - 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, - 184, 673, 904, 184, 184, 1160, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, - 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, - 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, - 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, - 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, - 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, - 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, - 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, - 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, - 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, - 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, - 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, - 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, - 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/IBM874.java b/jdk/src/share/classes/sun/nio/cs/IBM874.java deleted file mode 100644 index a1d9195a920..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/IBM874.java +++ /dev/null @@ -1,252 +0,0 @@ -/* - * Copyright 2003-2005 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 sun.nio.cs; - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM874 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM874() { - super("x-IBM874", StandardCharsets.aliases_IBM874); - } - - public String historicalName() { - return "Cp874"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM874); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u20AC\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0x80 - 0x87 - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0x88 - 0x8F - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0x90 - 0x97 - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0x98 - 0x9F - "\u0E48\u0E01\u0E02\u0E03\u0E04\u0E05\u0E06\u0E07" + // 0xA0 - 0xA7 - "\u0E08\u0E09\u0E0A\u0E0B\u0E0C\u0E0D\u0E0E\u0E0F" + // 0xA8 - 0xAF - "\u0E10\u0E11\u0E12\u0E13\u0E14\u0E15\u0E16\u0E17" + // 0xB0 - 0xB7 - "\u0E18\u0E19\u0E1A\u0E1B\u0E1C\u0E1D\u0E1E\u0E1F" + // 0xB8 - 0xBF - "\u0E20\u0E21\u0E22\u0E23\u0E24\u0E25\u0E26\u0E27" + // 0xC0 - 0xC7 - "\u0E28\u0E29\u0E2A\u0E2B\u0E2C\u0E2D\u0E2E\u0E2F" + // 0xC8 - 0xCF - "\u0E30\u0E31\u0E32\u0E33\u0E34\u0E35\u0E36\u0E37" + // 0xD0 - 0xD7 - "\u0E38\u0E39\u0E3A\u0E49\u0E4A\u0E4B\u0E4C\u0E3F" + // 0xD8 - 0xDF - "\u0E40\u0E41\u0E42\u0E43\u0E44\u0E45\u0E46\u0E47" + // 0xE0 - 0xE7 - "\u0E48\u0E49\u0E4A\u0E4B\u0E4C\u0E4D\u0E4E\u0E4F" + // 0xE8 - 0xEF - "\u0E50\u0E51\u0E52\u0E53\u0E54\u0E55\u0E56\u0E57" + // 0xF0 - 0xF7 - "\u0E58\u0E59\u0E5A\u0E5B\u00A2\u00AC\u00A6\u00A0" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00FF\u0000\u00FC\u0000\u0000\u0000\u00FE\u0000" + - "\u0000\u0000\u0000\u0000\u00FD\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00A1\u00A2\u00A3" + - "\u00A4\u00A5\u00A6\u00A7\u00A8\u00A9\u00AA\u00AB" + - "\u00AC\u00AD\u00AE\u00AF\u00B0\u00B1\u00B2\u00B3" + - "\u00B4\u00B5\u00B6\u00B7\u00B8\u00B9\u00BA\u00BB" + - "\u00BC\u00BD\u00BE\u00BF\u00C0\u00C1\u00C2\u00C3" + - "\u00C4\u00C5\u00C6\u00C7\u00C8\u00C9\u00CA\u00CB" + - "\u00CC\u00CD\u00CE\u00CF\u00D0\u00D1\u00D2\u00D3" + - "\u00D4\u00D5\u00D6\u00D7\u00D8\u00D9\u00DA\u0000" + - "\u0000\u0000\u0000\u00DF\u00E0\u00E1\u00E2\u00E3" + - "\u00E4\u00E5\u00E6\u00E7\u00E8\u00E9\u00EA\u00EB" + - "\u00EC\u00ED\u00EE\u00EF\u00F0\u00F1\u00F2\u00F3" + - "\u00F4\u00F5\u00F6\u00F7\u00F8\u00F9\u00FA\u00FB" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0080\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 428, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 520, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ISO_8859_13.java b/jdk/src/share/classes/sun/nio/cs/ISO_8859_13.java deleted file mode 100644 index e19c0610631..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ISO_8859_13.java +++ /dev/null @@ -1,266 +0,0 @@ -/* - * Copyright 2002-2004 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 sun.nio.cs; - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class ISO_8859_13 - extends Charset - implements HistoricallyNamedCharset -{ - - public ISO_8859_13() { - super("ISO-8859-13", StandardCharsets.aliases_ISO_8859_13); - } - - public String historicalName() { - return "ISO8859_13"; - } - - public boolean contains(Charset cs) { - return ((cs.name().equals("US-ASCII")) - || (cs instanceof ISO_8859_13)); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + // 0x80 - 0x87 - "\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + // 0x88 - 0x8F - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097" + // 0x90 - 0x97 - "\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + // 0x98 - 0x9F - "\u00A0\u201D\u00A2\u00A3\u00A4\u201E\u00A6\u00A7" + // 0xA0 - 0xA7 - "\u00D8\u00A9\u0156\u00AB\u00AC\u00AD\u00AE\u00C6" + // 0xA8 - 0xAF - "\u00B0\u00B1\u00B2\u00B3\u201C\u00B5\u00B6\u00B7" + // 0xB0 - 0xB7 - "\u00F8\u00B9\u0157\u00BB\u00BC\u00BD\u00BE\u00E6" + // 0xB8 - 0xBF - "\u0104\u012E\u0100\u0106\u00C4\u00C5\u0118\u0112" + // 0xC0 - 0xC7 - "\u010C\u00C9\u0179\u0116\u0122\u0136\u012A\u013B" + // 0xC8 - 0xCF - "\u0160\u0143\u0145\u00D3\u014C\u00D5\u00D6\u00D7" + // 0xD0 - 0xD7 - "\u0172\u0141\u015A\u016A\u00DC\u017B\u017D\u00DF" + // 0xD8 - 0xDF - "\u0105\u012F\u0101\u0107\u00E4\u00E5\u0119\u0113" + // 0xE0 - 0xE7 - "\u010D\u00E9\u017A\u0117\u0123\u0137\u012B\u013C" + // 0xE8 - 0xEF - "\u0161\u0144\u0146\u00F3\u014D\u00F5\u00F6\u00F7" + // 0xF0 - 0xF7 - "\u0173\u0142\u015B\u016B\u00FC\u017C\u017E\u2019" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097" + - "\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + - "\u00A0\u0000\u00A2\u00A3\u00A4\u0000\u00A6\u00A7" + - "\u0000\u00A9\u0000\u00AB\u00AC\u00AD\u00AE\u0000" + - "\u00B0\u00B1\u00B2\u00B3\u0000\u00B5\u00B6\u00B7" + - "\u0000\u00B9\u0000\u00BB\u00BC\u00BD\u00BE\u0000" + - "\u0000\u0000\u0000\u0000\u00C4\u00C5\u00AF\u0000" + - "\u0000\u00C9\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00D3\u0000\u00D5\u00D6\u00D7" + - "\u00A8\u0000\u0000\u0000\u00DC\u0000\u0000\u00DF" + - "\u0000\u0000\u0000\u0000\u00E4\u00E5\u00BF\u0000" + - "\u0000\u00E9\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00F3\u0000\u00F5\u00F6\u00F7" + - "\u00B8\u0000\u0000\u0000\u00FC\u0000\u0000\u0000" + - "\u00C2\u00E2\u0000\u0000\u00C0\u00E0\u00C3\u00E3" + - "\u0000\u0000\u0000\u0000\u00C8\u00E8\u0000\u0000" + - "\u0000\u0000\u00C7\u00E7\u0000\u0000\u00CB\u00EB" + - "\u00C6\u00E6\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00CC\u00EC\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00CE\u00EE\u0000\u0000\u00C1\u00E1" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00CD\u00ED" + - "\u0000\u0000\u0000\u00CF\u00EF\u0000\u0000\u0000" + - "\u0000\u00D9\u00F9\u00D1\u00F1\u00D2\u00F2\u0000" + - "\u0000\u0000\u0000\u0000\u00D4\u00F4\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00AA\u00BA" + - "\u0000\u0000\u00DA\u00FA\u0000\u0000\u0000\u0000" + - "\u00D0\u00F0\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00DB\u00FB\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00D8\u00F8\u0000\u0000\u0000\u0000" + - "\u0000\u00CA\u00EA\u00DD\u00FD\u00DE\u00FE\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00FF" + - "\u0000\u0000\u00B4\u00A1\u00A5\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 614, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ISO_8859_15.java b/jdk/src/share/classes/sun/nio/cs/ISO_8859_15.java deleted file mode 100644 index 0841c23fc44..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ISO_8859_15.java +++ /dev/null @@ -1,249 +0,0 @@ - -/* - * Copyright 2000-2004 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 sun.nio.cs; - -import java.nio.ByteBuffer; -import java.nio.CharBuffer; -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import java.nio.charset.CharacterCodingException; -import java.nio.charset.MalformedInputException; -import java.nio.charset.UnmappableCharacterException; - - -public class ISO_8859_15 extends Charset implements HistoricallyNamedCharset -{ - - public ISO_8859_15() { - super("ISO-8859-15", StandardCharsets.aliases_ISO_8859_15); - } - - public String historicalName() { - return "ISO8859_15"; - } - - public boolean contains(Charset cs) { - return ((cs instanceof US_ASCII) - || (cs instanceof ISO_8859_1) - || (cs instanceof ISO_8859_15)); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + // 0x80 - 0x87 - "\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + // 0x88 - 0x8F - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097" + // 0x90 - 0x97 - "\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + // 0x98 - 0x9F - "\u00A0\u00A1\u00A2\u00A3\u20AC\u00A5\u0160\u00A7" + // 0xA0 - 0xA7 - "\u0161\u00A9\u00AA\u00AB\u00AC\u00AD\u00AE\u00AF" + // 0xA8 - 0xAF - "\u00B0\u00B1\u00B2\u00B3\u017D\u00B5\u00B6\u00B7" + // 0xB0 - 0xB7 - "\u017E\u00B9\u00BA\u00BB\u0152\u0153\u0178\u00BF" + // 0xB8 - 0xBF - "\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + // 0xC0 - 0xC7 - "\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF" + // 0xC8 - 0xCF - "\u00D0\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D7" + // 0xD0 - 0xD7 - "\u00D8\u00D9\u00DA\u00DB\u00DC\u00DD\u00DE\u00DF" + // 0xD8 - 0xDF - "\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7" + // 0xE0 - 0xE7 - "\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF" + // 0xE8 - 0xEF - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + // 0xF0 - 0xF7 - "\u00F8\u00F9\u00FA\u00FB\u00FC\u00FD\u00FE\u00FF" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097" + - "\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + - "\u00A0\u00A1\u00A2\u00A3\u0000\u00A5\u0000\u00A7" + - "\u0000\u00A9\u00AA\u00AB\u00AC\u00AD\u00AE\u00AF" + - "\u00B0\u00B1\u00B2\u00B3\u0000\u00B5\u00B6\u00B7" + - "\u0000\u00B9\u00BA\u00BB\u0000\u0000\u0000\u00BF" + - "\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF" + - "\u00D0\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D7" + - "\u00D8\u00D9\u00DA\u00DB\u00DC\u00DD\u00DE\u00DF" + - "\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7" + - "\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u00FA\u00FB\u00FC\u00FD\u00FE\u00FF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00BC\u00BD\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00A6\u00A8\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00BE\u0000\u0000\u0000\u0000\u00B4\u00B8\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00A4" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 467, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - }; - - } - -} diff --git a/jdk/src/share/classes/sun/nio/cs/ISO_8859_2.java b/jdk/src/share/classes/sun/nio/cs/ISO_8859_2.java deleted file mode 100644 index 6f2d74f503e..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ISO_8859_2.java +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Copyright 2002-2004 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 sun.nio.cs; - -import java.nio.ByteBuffer; -import java.nio.CharBuffer; -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import java.nio.charset.CharacterCodingException; -import java.nio.charset.MalformedInputException; -import java.nio.charset.UnmappableCharacterException; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - - -public class ISO_8859_2 - extends Charset - implements HistoricallyNamedCharset -{ - - public ISO_8859_2() { - super("ISO-8859-2", StandardCharsets.aliases_ISO_8859_2); - } - - public String historicalName() { - return "ISO8859_2"; - } - - public boolean contains(Charset cs) { - return ((cs.name().equals("US-ASCII")) - || (cs instanceof ISO_8859_2)); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + // 0x80 - 0x87 - "\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + // 0x88 - 0x8F - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097" + // 0x90 - 0x97 - "\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + // 0x98 - 0x9F - "\u00A0\u0104\u02D8\u0141\u00A4\u013D\u015A\u00A7" + // 0xA0 - 0xA7 - "\u00A8\u0160\u015E\u0164\u0179\u00AD\u017D\u017B" + // 0xA8 - 0xAF - "\u00B0\u0105\u02DB\u0142\u00B4\u013E\u015B\u02C7" + // 0xB0 - 0xB7 - "\u00B8\u0161\u015F\u0165\u017A\u02DD\u017E\u017C" + // 0xB8 - 0xBF - "\u0154\u00C1\u00C2\u0102\u00C4\u0139\u0106\u00C7" + // 0xC0 - 0xC7 - "\u010C\u00C9\u0118\u00CB\u011A\u00CD\u00CE\u010E" + // 0xC8 - 0xCF - "\u0110\u0143\u0147\u00D3\u00D4\u0150\u00D6\u00D7" + // 0xD0 - 0xD7 - "\u0158\u016E\u00DA\u0170\u00DC\u00DD\u0162\u00DF" + // 0xD8 - 0xDF - "\u0155\u00E1\u00E2\u0103\u00E4\u013A\u0107\u00E7" + // 0xE0 - 0xE7 - "\u010D\u00E9\u0119\u00EB\u011B\u00ED\u00EE\u010F" + // 0xE8 - 0xEF - "\u0111\u0144\u0148\u00F3\u00F4\u0151\u00F6\u00F7" + // 0xF0 - 0xF7 - "\u0159\u016F\u00FA\u0171\u00FC\u00FD\u0163\u02D9" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097" + - "\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + - "\u00A0\u0000\u0000\u0000\u00A4\u0000\u0000\u00A7" + - "\u00A8\u0000\u0000\u0000\u0000\u00AD\u0000\u0000" + - "\u00B0\u0000\u0000\u0000\u00B4\u0000\u0000\u0000" + - "\u00B8\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00C1\u00C2\u0000\u00C4\u0000\u0000\u00C7" + - "\u0000\u00C9\u0000\u00CB\u0000\u00CD\u00CE\u0000" + - "\u0000\u0000\u0000\u00D3\u00D4\u0000\u00D6\u00D7" + - "\u0000\u0000\u00DA\u0000\u00DC\u00DD\u0000\u00DF" + - "\u0000\u00E1\u00E2\u0000\u00E4\u0000\u0000\u00E7" + - "\u0000\u00E9\u0000\u00EB\u0000\u00ED\u00EE\u0000" + - "\u0000\u0000\u0000\u00F3\u00F4\u0000\u00F6\u00F7" + - "\u0000\u0000\u00FA\u0000\u00FC\u00FD\u0000\u0000" + - "\u00C3\u00E3\u00A1\u00B1\u00C6\u00E6\u0000\u0000" + - "\u0000\u0000\u00C8\u00E8\u00CF\u00EF\u00D0\u00F0" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00CA\u00EA" + - "\u00CC\u00EC\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00C5" + - "\u00E5\u0000\u0000\u00A5\u00B5\u0000\u0000\u00A3" + - "\u00B3\u00D1\u00F1\u0000\u0000\u00D2\u00F2\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00D5\u00F5" + - "\u0000\u0000\u00C0\u00E0\u0000\u0000\u00D8\u00F8" + - "\u00A6\u00B6\u0000\u0000\u00AA\u00BA\u00A9\u00B9" + - "\u00DE\u00FE\u00AB\u00BB\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00D9\u00F9\u00DB\u00FB" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00AC" + - "\u00BC\u00AF\u00BF\u00AE\u00BE\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00B7\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00A2\u00FF" + - "\u0000\u00B2\u0000\u00BD\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 254, 438, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ISO_8859_4.java b/jdk/src/share/classes/sun/nio/cs/ISO_8859_4.java deleted file mode 100644 index a3f87881550..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ISO_8859_4.java +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright 2002-2004 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 sun.nio.cs; - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class ISO_8859_4 - extends Charset - implements HistoricallyNamedCharset -{ - - public ISO_8859_4() { - super("ISO-8859-4", StandardCharsets.aliases_ISO_8859_4); - } - - public String historicalName() { - return "ISO8859_4"; - } - - public boolean contains(Charset cs) { - return ((cs.name().equals("US-ASCII")) - || (cs instanceof ISO_8859_4)); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + // 0x80 - 0x87 - "\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + // 0x88 - 0x8F - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097" + // 0x90 - 0x97 - "\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + // 0x98 - 0x9F - "\u00A0\u0104\u0138\u0156\u00A4\u0128\u013B\u00A7" + // 0xA0 - 0xA7 - "\u00A8\u0160\u0112\u0122\u0166\u00AD\u017D\u00AF" + // 0xA8 - 0xAF - "\u00B0\u0105\u02DB\u0157\u00B4\u0129\u013C\u02C7" + // 0xB0 - 0xB7 - "\u00B8\u0161\u0113\u0123\u0167\u014A\u017E\u014B" + // 0xB8 - 0xBF - "\u0100\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u012E" + // 0xC0 - 0xC7 - "\u010C\u00C9\u0118\u00CB\u0116\u00CD\u00CE\u012A" + // 0xC8 - 0xCF - "\u0110\u0145\u014C\u0136\u00D4\u00D5\u00D6\u00D7" + // 0xD0 - 0xD7 - "\u00D8\u0172\u00DA\u00DB\u00DC\u0168\u016A\u00DF" + // 0xD8 - 0xDF - "\u0101\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u012F" + // 0xE0 - 0xE7 - "\u010D\u00E9\u0119\u00EB\u0117\u00ED\u00EE\u012B" + // 0xE8 - 0xEF - "\u0111\u0146\u014D\u0137\u00F4\u00F5\u00F6\u00F7" + // 0xF0 - 0xF7 - "\u00F8\u0173\u00FA\u00FB\u00FC\u0169\u016B\u02D9" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097" + - "\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + - "\u00A0\u0000\u0000\u0000\u00A4\u0000\u0000\u00A7" + - "\u00A8\u0000\u0000\u0000\u0000\u00AD\u0000\u00AF" + - "\u00B0\u0000\u0000\u0000\u00B4\u0000\u0000\u0000" + - "\u00B8\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u0000" + - "\u0000\u00C9\u0000\u00CB\u0000\u00CD\u00CE\u0000" + - "\u0000\u0000\u0000\u0000\u00D4\u00D5\u00D6\u00D7" + - "\u00D8\u0000\u00DA\u00DB\u00DC\u0000\u0000\u00DF" + - "\u0000\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u0000" + - "\u0000\u00E9\u0000\u00EB\u0000\u00ED\u00EE\u0000" + - "\u0000\u0000\u0000\u0000\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u0000\u00FA\u00FB\u00FC\u0000\u0000\u0000" + - "\u00C0\u00E0\u0000\u0000\u00A1\u00B1\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00C8\u00E8\u0000\u0000" + - "\u00D0\u00F0\u00AA\u00BA\u0000\u0000\u00CC\u00EC" + - "\u00CA\u00EA\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00AB\u00BB\u0000\u0000\u0000\u0000" + - "\u00A5\u00B5\u00CF\u00EF\u0000\u0000\u00C7\u00E7" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00D3\u00F3" + - "\u00A2\u0000\u0000\u00A6\u00B6\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00D1\u00F1\u0000" + - "\u0000\u0000\u00BD\u00BF\u00D2\u00F2\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00A3\u00B3" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00A9\u00B9\u0000\u0000\u0000\u0000\u00AC\u00BC" + - "\u00DD\u00FD\u00DE\u00FE\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00D9\u00F9\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00AE\u00BE\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00B7" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00FF\u0000\u00B2\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 440, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ISO_8859_5.java b/jdk/src/share/classes/sun/nio/cs/ISO_8859_5.java deleted file mode 100644 index cb7fb5e3d15..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ISO_8859_5.java +++ /dev/null @@ -1,271 +0,0 @@ -/* - * Copyright 2002-2004 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 sun.nio.cs; - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class ISO_8859_5 - extends Charset - implements HistoricallyNamedCharset -{ - - public ISO_8859_5() { - super("ISO-8859-5", StandardCharsets.aliases_ISO_8859_5); - } - - public String historicalName() { - return "ISO8859_5"; - } - - public boolean contains(Charset cs) { - return ((cs.name().equals("US-ASCII")) - || (cs instanceof ISO_8859_5)); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + // 0x80 - 0x87 - "\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + // 0x88 - 0x8F - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097" + // 0x90 - 0x97 - "\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + // 0x98 - 0x9F - "\u00A0\u0401\u0402\u0403\u0404\u0405\u0406\u0407" + // 0xA0 - 0xA7 - "\u0408\u0409\u040A\u040B\u040C\u00AD\u040E\u040F" + // 0xA8 - 0xAF - "\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417" + // 0xB0 - 0xB7 - "\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F" + // 0xB8 - 0xBF - "\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427" + // 0xC0 - 0xC7 - "\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F" + // 0xC8 - 0xCF - "\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437" + // 0xD0 - 0xD7 - "\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F" + // 0xD8 - 0xDF - "\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447" + // 0xE0 - 0xE7 - "\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F" + // 0xE8 - 0xEF - "\u2116\u0451\u0452\u0453\u0454\u0455\u0456\u0457" + // 0xF0 - 0xF7 - "\u0458\u0459\u045A\u045B\u045C\u00A7\u045E\u045F" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097" + - "\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + - "\u00A0\u0000\u0000\u0000\u0000\u0000\u0000\u00FD" + - "\u0000\u0000\u0000\u0000\u0000\u00AD\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00A1\u00A2" + - "\u00A3\u00A4\u00A5\u00A6\u00A7\u00A8\u00A9\u00AA" + - "\u00AB\u00AC\u0000\u00AE\u00AF\u00B0\u00B1\u00B2" + - "\u00B3\u00B4\u00B5\u00B6\u00B7\u00B8\u00B9\u00BA" + - "\u00BB\u00BC\u00BD\u00BE\u00BF\u00C0\u00C1\u00C2" + - "\u00C3\u00C4\u00C5\u00C6\u00C7\u00C8\u00C9\u00CA" + - "\u00CB\u00CC\u00CD\u00CE\u00CF\u00D0\u00D1\u00D2" + - "\u00D3\u00D4\u00D5\u00D6\u00D7\u00D8\u00D9\u00DA" + - "\u00DB\u00DC\u00DD\u00DE\u00DF\u00E0\u00E1\u00E2" + - "\u00E3\u00E4\u00E5\u00E6\u00E7\u00E8\u00E9\u00EA" + - "\u00EB\u00EC\u00ED\u00EE\u00EF\u0000\u00F1\u00F2" + - "\u00F3\u00F4\u00F5\u00F6\u00F7\u00F8\u00F9\u00FA" + - "\u00FB\u00FC\u0000\u00FE\u00FF\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00F0\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 174, 174, 174, 429, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 663, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ISO_8859_7.java b/jdk/src/share/classes/sun/nio/cs/ISO_8859_7.java deleted file mode 100644 index e0469fe8bc4..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ISO_8859_7.java +++ /dev/null @@ -1,255 +0,0 @@ -/* - * Copyright 2002-2006 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 sun.nio.cs; - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class ISO_8859_7 - extends Charset - implements HistoricallyNamedCharset -{ - - public ISO_8859_7() { - super("ISO-8859-7", StandardCharsets.aliases_ISO_8859_7); - } - - public String historicalName() { - return "ISO8859_7"; - } - - public boolean contains(Charset cs) { - return ((cs.name().equals("US-ASCII")) - || (cs instanceof ISO_8859_7)); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + // 0x80 - 0x87 - "\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + // 0x88 - 0x8F - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097" + // 0x90 - 0x97 - "\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + // 0x98 - 0x9F - "\u00A0\u2018\u2019\u00A3\u20AC\u20AF\u00A6\u00A7" + // 0xA0 - 0xA7 - "\u00A8\u00A9\u037A\u00AB\u00AC\u00AD\uFFFD\u2015" + // 0xA8 - 0xAF - "\u00B0\u00B1\u00B2\u00B3\u0384\u0385\u0386\u00B7" + // 0xB0 - 0xB7 - "\u0388\u0389\u038A\u00BB\u038C\u00BD\u038E\u038F" + // 0xB8 - 0xBF - "\u0390\u0391\u0392\u0393\u0394\u0395\u0396\u0397" + // 0xC0 - 0xC7 - "\u0398\u0399\u039A\u039B\u039C\u039D\u039E\u039F" + // 0xC8 - 0xCF - "\u03A0\u03A1\uFFFD\u03A3\u03A4\u03A5\u03A6\u03A7" + // 0xD0 - 0xD7 - "\u03A8\u03A9\u03AA\u03AB\u03AC\u03AD\u03AE\u03AF" + // 0xD8 - 0xDF - "\u03B0\u03B1\u03B2\u03B3\u03B4\u03B5\u03B6\u03B7" + // 0xE0 - 0xE7 - "\u03B8\u03B9\u03BA\u03BB\u03BC\u03BD\u03BE\u03BF" + // 0xE8 - 0xEF - "\u03C0\u03C1\u03C2\u03C3\u03C4\u03C5\u03C6\u03C7" + // 0xF0 - 0xF7 - "\u03C8\u03C9\u03CA\u03CB\u03CC\u03CD\u03CE\uFFFD" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097" + - "\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + - "\u00A0\u0000\u0000\u00A3\u0000\u0000\u00A6\u00A7" + - "\u00A8\u00A9\u0000\u00AB\u00AC\u00AD\u0000\u0000" + - "\u00B0\u00B1\u00B2\u00B3\u0000\u0000\u0000\u00B7" + - "\u0000\u0000\u0000\u00BB\u0000\u00BD\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00AA\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00B4\u00B5\u00B6\u0000\u00B8\u00B9\u00BA\u0000" + - "\u00BC\u0000\u00BE\u00BF\u00C0\u00C1\u00C2\u00C3" + - "\u00C4\u00C5\u00C6\u00C7\u00C8\u00C9\u00CA\u00CB" + - "\u00CC\u00CD\u00CE\u00CF\u00D0\u00D1\u0000\u00D3" + - "\u00D4\u00D5\u00D6\u00D7\u00D8\u00D9\u00DA\u00DB" + - "\u00DC\u00DD\u00DE\u00DF\u00E0\u00E1\u00E2\u00E3" + - "\u00E4\u00E5\u00E6\u00E7\u00E8\u00E9\u00EA\u00EB" + - "\u00EC\u00ED\u00EE\u00EF\u00F0\u00F1\u00F2\u00F3" + - "\u00F4\u00F5\u00F6\u00F7\u00F8\u00F9\u00FA\u00FB" + - "\u00FC\u00FD\u00FE\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00AF\u0000\u0000\u00A1" + - "\u00A2\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00A4\u0000\u0000\u00A5\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 190, 190, 324, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 559, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ISO_8859_9.java b/jdk/src/share/classes/sun/nio/cs/ISO_8859_9.java deleted file mode 100644 index cc2c8121246..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ISO_8859_9.java +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Copyright 2002-2004 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 sun.nio.cs; - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class ISO_8859_9 - extends Charset - implements HistoricallyNamedCharset -{ - - public ISO_8859_9() { - super("ISO-8859-9", StandardCharsets.aliases_ISO_8859_9); - } - - public String historicalName() { - return "ISO8859_9"; - } - - public boolean contains(Charset cs) { - return ((cs.name().equals("US-ASCII")) - || (cs instanceof ISO_8859_9)); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + // 0x80 - 0x87 - "\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + // 0x88 - 0x8F - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097" + // 0x90 - 0x97 - "\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + // 0x98 - 0x9F - "\u00A0\u00A1\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7" + // 0xA0 - 0xA7 - "\u00A8\u00A9\u00AA\u00AB\u00AC\u00AD\u00AE\u00AF" + // 0xA8 - 0xAF - "\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7" + // 0xB0 - 0xB7 - "\u00B8\u00B9\u00BA\u00BB\u00BC\u00BD\u00BE\u00BF" + // 0xB8 - 0xBF - "\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + // 0xC0 - 0xC7 - "\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF" + // 0xC8 - 0xCF - "\u011E\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D7" + // 0xD0 - 0xD7 - "\u00D8\u00D9\u00DA\u00DB\u00DC\u0130\u015E\u00DF" + // 0xD8 - 0xDF - "\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7" + // 0xE0 - 0xE7 - "\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF" + // 0xE8 - 0xEF - "\u011F\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + // 0xF0 - 0xF7 - "\u00F8\u00F9\u00FA\u00FB\u00FC\u0131\u015F\u00FF" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097" + - "\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + - "\u00A0\u00A1\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7" + - "\u00A8\u00A9\u00AA\u00AB\u00AC\u00AD\u00AE\u00AF" + - "\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7" + - "\u00B8\u00B9\u00BA\u00BB\u00BC\u00BD\u00BE\u00BF" + - "\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF" + - "\u0000\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D7" + - "\u00D8\u00D9\u00DA\u00DB\u00DC\u0000\u0000\u00DF" + - "\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7" + - "\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF" + - "\u0000\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u00FA\u00FB\u00FC\u0000\u0000\u00FF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00D0\u00F0" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00DD\u00FD\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00DE\u00FE" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/KOI8_R.java b/jdk/src/share/classes/sun/nio/cs/KOI8_R.java deleted file mode 100644 index f237b361c26..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/KOI8_R.java +++ /dev/null @@ -1,344 +0,0 @@ -/* - * Copyright 2002-2004 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 sun.nio.cs; - -import java.nio.ByteBuffer; -import java.nio.CharBuffer; -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import java.nio.charset.CharacterCodingException; -import java.nio.charset.MalformedInputException; -import java.nio.charset.UnmappableCharacterException; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; - - -public class KOI8_R - extends Charset - implements HistoricallyNamedCharset -{ - - public KOI8_R() { - super("KOI8-R", StandardCharsets.aliases_KOI8_R); - } - - public String historicalName() { - return "KOI8_R"; - } - - public boolean contains(Charset cs) { - return ((cs.name().equals("US-ASCII")) - || (cs instanceof KOI8_R)); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u2500\u2502\u250C\u2510\u2514\u2518\u251C\u2524" + // 0x80 - 0x87 - "\u252C\u2534\u253C\u2580\u2584\u2588\u258C\u2590" + // 0x88 - 0x8F - "\u2591\u2592\u2593\u2320\u25A0\u2219\u221A\u2248" + // 0x90 - 0x97 - "\u2264\u2265\u00A0\u2321\u00B0\u00B2\u00B7\u00F7" + // 0x98 - 0x9F - "\u2550\u2551\u2552\u0451\u2553\u2554\u2555\u2556" + // 0xA0 - 0xA7 - "\u2557\u2558\u2559\u255A\u255B\u255C\u255D\u255E" + // 0xA8 - 0xAF - "\u255F\u2560\u2561\u0401\u2562\u2563\u2564\u2565" + // 0xB0 - 0xB7 - "\u2566\u2567\u2568\u2569\u256A\u256B\u256C\u00A9" + // 0xB8 - 0xBF - "\u044E\u0430\u0431\u0446\u0434\u0435\u0444\u0433" + // 0xC0 - 0xC7 - "\u0445\u0438\u0439\u043A\u043B\u043C\u043D\u043E" + // 0xC8 - 0xCF - "\u043F\u044F\u0440\u0441\u0442\u0443\u0436\u0432" + // 0xD0 - 0xD7 - "\u044C\u044B\u0437\u0448\u044D\u0449\u0447\u044A" + // 0xD8 - 0xDF - "\u042E\u0410\u0411\u0426\u0414\u0415\u0424\u0413" + // 0xE0 - 0xE7 - "\u0425\u0418\u0419\u041A\u041B\u041C\u041D\u041E" + // 0xE8 - 0xEF - "\u041F\u042F\u0420\u0421\u0422\u0423\u0416\u0412" + // 0xF0 - 0xF7 - "\u042C\u042B\u0417\u0428\u042D\u0429\u0427\u042A" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - } - - private static class Encoder extends SingleByteEncoder { - - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u009A\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00BF\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u009C\u0000\u009D\u0000\u0000\u0000\u0000\u009E" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u009F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00B3\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00E1" + - "\u00E2\u00F7\u00E7\u00E4\u00E5\u00F6\u00FA\u00E9" + - "\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF\u00F0\u00F2" + - "\u00F3\u00F4\u00F5\u00E6\u00E8\u00E3\u00FE\u00FB" + - "\u00FD\u00FF\u00F9\u00F8\u00FC\u00E0\u00F1\u00C1" + - "\u00C2\u00D7\u00C7\u00C4\u00C5\u00D6\u00DA\u00C9" + - "\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF\u00D0\u00D2" + - "\u00D3\u00D4\u00D5\u00C6\u00C8\u00C3\u00DE\u00DB" + - "\u00DD\u00DF\u00D9\u00D8\u00DC\u00C0\u00D1\u0000" + - "\u00A3\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0095" + - "\u0096\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0097\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0098\u0099\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0093\u009B" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u0000" + - "\u0081\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0082\u0000\u0000\u0000\u0083\u0000" + - "\u0000\u0000\u0084\u0000\u0000\u0000\u0085\u0000" + - "\u0000\u0000\u0086\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0087\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0088\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0089\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u008A\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00A0\u00A1" + - "\u00A2\u00A4\u00A5\u00A6\u00A7\u00A8\u00A9\u00AA" + - "\u00AB\u00AC\u00AD\u00AE\u00AF\u00B0\u00B1\u00B2" + - "\u00B4\u00B5\u00B6\u00B7\u00B8\u00B9\u00BA\u00BB" + - "\u00BC\u00BD\u00BE\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u008B\u0000" + - "\u0000\u0000\u008C\u0000\u0000\u0000\u008D\u0000" + - "\u0000\u0000\u008E\u0000\u0000\u0000\u008F\u0090" + - "\u0091\u0092\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0094\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 248, 248, 248, 503, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 734, 958, 248, 1214, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/KOI8_U.java b/jdk/src/share/classes/sun/nio/cs/KOI8_U.java deleted file mode 100644 index 26ad0c9d6cb..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/KOI8_U.java +++ /dev/null @@ -1,323 +0,0 @@ -/* - * Copyright 2006 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 sun.nio.cs; - -import java.nio.ByteBuffer; -import java.nio.CharBuffer; -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import java.nio.charset.CharacterCodingException; -import java.nio.charset.MalformedInputException; -import java.nio.charset.UnmappableCharacterException; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; - -/* - * An implementation of charset KOI8_U as specified by - * http://www.net.ua/KOI8-U - */ - -public class KOI8_U - extends Charset - implements HistoricallyNamedCharset -{ - - public KOI8_U() { - super("KOI8-U", StandardCharsets.aliases_KOI8_U); - } - - public String historicalName() { - return "KOI8_U"; - } - - public boolean contains(Charset cs) { - return ((cs.name().equals("US-ASCII")) - || (cs instanceof KOI8_U)); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - private static class Decoder extends SingleByteDecoder { - - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - "\u2500\u2502\u250C\u2510\u2514\u2518\u251C\u2524" + // 0x80 - 0x87 - "\u252C\u2534\u253C\u2580\u2584\u2588\u258C\u2590" + // 0x88 - 0x8F - "\u2591\u2592\u2593\u2320\u25A0\u2219\u221A\u2248" + // 0x90 - 0x97 - "\u2264\u2265\u00A0\u2321\u00B0\u00B2\u00B7\u00F7" + // 0x98 - 0x9F - "\u2550\u2551\u2552\u0451\u0454\u2554\u0456\u0457" + // 0xA0 - 0xA7 - "\u2557\u2558\u2559\u255A\u255B\u0491\u255D\u255E" + // 0xA8 - 0xAF - "\u255F\u2560\u2561\u0401\u0404\u2563\u0406\u0407" + // 0xB0 - 0xB7 - "\u2566\u2567\u2568\u2569\u256A\u0490\u256C\u00A9" + // 0xB8 - 0xBF - "\u044E\u0430\u0431\u0446\u0434\u0435\u0444\u0433" + // 0xC0 - 0xC7 - "\u0445\u0438\u0439\u043A\u043B\u043C\u043D\u043E" + // 0xC8 - 0xCF - "\u043F\u044F\u0440\u0441\u0442\u0443\u0436\u0432" + // 0xD0 - 0xD7 - "\u044C\u044B\u0437\u0448\u044D\u0449\u0447\u044A" + // 0xD8 - 0xDF - "\u042E\u0410\u0411\u0426\u0414\u0415\u0424\u0413" + // 0xE0 - 0xE7 - "\u0425\u0418\u0419\u041A\u041B\u041C\u041D\u041E" + // 0xE8 - 0xEF - "\u041F\u042F\u0420\u0421\u0422\u0423\u0416\u0412" + // 0xF0 - 0xF7 - "\u042C\u042B\u0417\u0428\u042D\u0429\u0427\u042A" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - } - - private static class Encoder extends SingleByteEncoder { - - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u009A\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00BF\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u009C\u0000\u009D\u0000\u0000\u0000\u0000\u009E" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u009F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00B3\u0000\u0000\u00B4\u0000\u00B6\u00B7\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00E1" + - "\u00E2\u00F7\u00E7\u00E4\u00E5\u00F6\u00FA\u00E9" + - "\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF\u00F0\u00F2" + - "\u00F3\u00F4\u00F5\u00E6\u00E8\u00E3\u00FE\u00FB" + - "\u00FD\u00FF\u00F9\u00F8\u00FC\u00E0\u00F1\u00C1" + - "\u00C2\u00D7\u00C7\u00C4\u00C5\u00D6\u00DA\u00C9" + - "\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF\u00D0\u00D2" + - "\u00D3\u00D4\u00D5\u00C6\u00C8\u00C3\u00DE\u00DB" + - "\u00DD\u00DF\u00D9\u00D8\u00DC\u00C0\u00D1\u0000" + - "\u00A3\u0000\u0000\u00A4\u0000\u00A6\u00A7\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00BD" + - "\u00AD\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0095" + - "\u0096\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0097\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0098\u0099\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0093\u009B" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u0000" + - "\u0081\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0082\u0000\u0000\u0000\u0083\u0000" + - "\u0000\u0000\u0084\u0000\u0000\u0000\u0085\u0000" + - "\u0000\u0000\u0086\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0087\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0088\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0089\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u008A\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00A0\u00A1" + - "\u00A2\u0000\u00A5\u0000\u0000\u00A8\u00A9\u00AA" + - "\u00AB\u00AC\u0000\u00AE\u00AF\u00B0\u00B1\u00B2" + - "\u0000\u00B5\u0000\u0000\u00B8\u00B9\u00BA\u00BB" + - "\u00BC\u0000\u00BE\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u008B\u0000" + - "\u0000\u0000\u008C\u0000\u0000\u0000\u008D\u0000" + - "\u0000\u0000\u008E\u0000\u0000\u0000\u008F\u0090" + - "\u0091\u0092\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0094\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 248, 248, 248, 503, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 734, 958, 248, 1214, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/MS1250.java b/jdk/src/share/classes/sun/nio/cs/MS1250.java deleted file mode 100644 index 51d97edca03..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/MS1250.java +++ /dev/null @@ -1,304 +0,0 @@ -/* - * Copyright 2002-2004 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 sun.nio.cs; - -import java.nio.ByteBuffer; -import java.nio.CharBuffer; -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import java.nio.charset.CharacterCodingException; -import java.nio.charset.MalformedInputException; -import java.nio.charset.UnmappableCharacterException; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - - -public class MS1250 - extends Charset - implements HistoricallyNamedCharset -{ - - public String historicalName() { - return "Cp1250"; - } - - public MS1250() { - super("windows-1250", StandardCharsets.aliases_MS1250); - } - - public boolean contains(Charset cs) { - return ((cs.name().equals("US-ASCII")) - || (cs instanceof MS1250)); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u20AC\uFFFD\u201A\uFFFD\u201E\u2026\u2020\u2021" + // 0x80 - 0x87 - "\uFFFD\u2030\u0160\u2039\u015A\u0164\u017D\u0179" + // 0x88 - 0x8F - "\uFFFD\u2018\u2019\u201C\u201D\u2022\u2013\u2014" + // 0x90 - 0x97 - "\uFFFD\u2122\u0161\u203A\u015B\u0165\u017E\u017A" + // 0x98 - 0x9F - "\u00A0\u02C7\u02D8\u0141\u00A4\u0104\u00A6\u00A7" + // 0xA0 - 0xA7 - "\u00A8\u00A9\u015E\u00AB\u00AC\u00AD\u00AE\u017B" + // 0xA8 - 0xAF - "\u00B0\u00B1\u02DB\u0142\u00B4\u00B5\u00B6\u00B7" + // 0xB0 - 0xB7 - "\u00B8\u0105\u015F\u00BB\u013D\u02DD\u013E\u017C" + // 0xB8 - 0xBF - "\u0154\u00C1\u00C2\u0102\u00C4\u0139\u0106\u00C7" + // 0xC0 - 0xC7 - "\u010C\u00C9\u0118\u00CB\u011A\u00CD\u00CE\u010E" + // 0xC8 - 0xCF - "\u0110\u0143\u0147\u00D3\u00D4\u0150\u00D6\u00D7" + // 0xD0 - 0xD7 - "\u0158\u016E\u00DA\u0170\u00DC\u00DD\u0162\u00DF" + // 0xD8 - 0xDF - "\u0155\u00E1\u00E2\u0103\u00E4\u013A\u0107\u00E7" + // 0xE0 - 0xE7 - "\u010D\u00E9\u0119\u00EB\u011B\u00ED\u00EE\u010F" + // 0xE8 - 0xEF - "\u0111\u0144\u0148\u00F3\u00F4\u0151\u00F6\u00F7" + // 0xF0 - 0xF7 - "\u0159\u016F\u00FA\u0171\u00FC\u00FD\u0163\u02D9" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00A0\u0000\u0000\u0000\u00A4\u0000\u00A6\u00A7" + - "\u00A8\u00A9\u0000\u00AB\u00AC\u00AD\u00AE\u0000" + - "\u00B0\u00B1\u0000\u0000\u00B4\u00B5\u00B6\u00B7" + - "\u00B8\u0000\u0000\u00BB\u0000\u0000\u0000\u0000" + - "\u0000\u00C1\u00C2\u0000\u00C4\u0000\u0000\u00C7" + - "\u0000\u00C9\u0000\u00CB\u0000\u00CD\u00CE\u0000" + - "\u0000\u0000\u0000\u00D3\u00D4\u0000\u00D6\u00D7" + - "\u0000\u0000\u00DA\u0000\u00DC\u00DD\u0000\u00DF" + - "\u0000\u00E1\u00E2\u0000\u00E4\u0000\u0000\u00E7" + - "\u0000\u00E9\u0000\u00EB\u0000\u00ED\u00EE\u0000" + - "\u0000\u0000\u0000\u00F3\u00F4\u0000\u00F6\u00F7" + - "\u0000\u0000\u00FA\u0000\u00FC\u00FD\u0000\u0000" + - "\u00C3\u00E3\u00A5\u00B9\u00C6\u00E6\u0000\u0000" + - "\u0000\u0000\u00C8\u00E8\u00CF\u00EF\u00D0\u00F0" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00CA\u00EA" + - "\u00CC\u00EC\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00C5" + - "\u00E5\u0000\u0000\u00BC\u00BE\u0000\u0000\u00A3" + - "\u00B3\u00D1\u00F1\u0000\u0000\u00D2\u00F2\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00D5\u00F5" + - "\u0000\u0000\u00C0\u00E0\u0000\u0000\u00D8\u00F8" + - "\u008C\u009C\u0000\u0000\u00AA\u00BA\u008A\u009A" + - "\u00DE\u00FE\u008D\u009D\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00D9\u00F9\u00DB\u00FB" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u008F" + - "\u009F\u00AF\u00BF\u008E\u009E\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00A1\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00A2\u00FF" + - "\u0000\u00B2\u0000\u00BD\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0096\u0097" + - "\u0000\u0000\u0000\u0091\u0092\u0082\u0000\u0093" + - "\u0094\u0084\u0000\u0086\u0087\u0095\u0000\u0000" + - "\u0000\u0085\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0089\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u008B\u009B\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0080" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0099\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000"; - - private final static short index1[] = { - 0, 254, 438, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 675, 897, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/MS1251.java b/jdk/src/share/classes/sun/nio/cs/MS1251.java deleted file mode 100644 index 2120de45c6b..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/MS1251.java +++ /dev/null @@ -1,306 +0,0 @@ -/* - * Copyright 2002-2004 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 sun.nio.cs; - -import java.nio.ByteBuffer; -import java.nio.CharBuffer; -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import java.nio.charset.CharacterCodingException; -import java.nio.charset.MalformedInputException; -import java.nio.charset.UnmappableCharacterException; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - - -public class MS1251 - extends Charset - implements HistoricallyNamedCharset -{ - - public String historicalName() { - return "Cp1251"; - } - - public MS1251() { - super("windows-1251", StandardCharsets.aliases_MS1251); - } - - public boolean contains(Charset cs) { - return ((cs.name().equals("US-ASCII")) - || (cs instanceof MS1251)); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u0402\u0403\u201A\u0453\u201E\u2026\u2020\u2021" + // 0x80 - 0x87 - "\u20AC\u2030\u0409\u2039\u040A\u040C\u040B\u040F" + // 0x88 - 0x8F - "\u0452\u2018\u2019\u201C\u201D\u2022\u2013\u2014" + // 0x90 - 0x97 - "\uFFFD\u2122\u0459\u203A\u045A\u045C\u045B\u045F" + // 0x98 - 0x9F - "\u00A0\u040E\u045E\u0408\u00A4\u0490\u00A6\u00A7" + // 0xA0 - 0xA7 - "\u0401\u00A9\u0404\u00AB\u00AC\u00AD\u00AE\u0407" + // 0xA8 - 0xAF - "\u00B0\u00B1\u0406\u0456\u0491\u00B5\u00B6\u00B7" + // 0xB0 - 0xB7 - "\u0451\u2116\u0454\u00BB\u0458\u0405\u0455\u0457" + // 0xB8 - 0xBF - "\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417" + // 0xC0 - 0xC7 - "\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F" + // 0xC8 - 0xCF - "\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427" + // 0xD0 - 0xD7 - "\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F" + // 0xD8 - 0xDF - "\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437" + // 0xE0 - 0xE7 - "\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F" + // 0xE8 - 0xEF - "\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447" + // 0xF0 - 0xF7 - "\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00A0\u0000\u0000\u0000\u00A4\u0000\u00A6\u00A7" + - "\u0000\u00A9\u0000\u00AB\u00AC\u00AD\u00AE\u0000" + - "\u00B0\u00B1\u0000\u0000\u0000\u00B5\u00B6\u00B7" + - "\u0000\u0000\u0000\u00BB\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00A8\u0080\u0081\u00AA" + - "\u00BD\u00B2\u00AF\u00A3\u008A\u008C\u008E\u008D" + - "\u0000\u00A1\u008F\u00C0\u00C1\u00C2\u00C3\u00C4" + - "\u00C5\u00C6\u00C7\u00C8\u00C9\u00CA\u00CB\u00CC" + - "\u00CD\u00CE\u00CF\u00D0\u00D1\u00D2\u00D3\u00D4" + - "\u00D5\u00D6\u00D7\u00D8\u00D9\u00DA\u00DB\u00DC" + - "\u00DD\u00DE\u00DF\u00E0\u00E1\u00E2\u00E3\u00E4" + - "\u00E5\u00E6\u00E7\u00E8\u00E9\u00EA\u00EB\u00EC" + - "\u00ED\u00EE\u00EF\u00F0\u00F1\u00F2\u00F3\u00F4" + - "\u00F5\u00F6\u00F7\u00F8\u00F9\u00FA\u00FB\u00FC" + - "\u00FD\u00FE\u00FF\u0000\u00B8\u0090\u0083\u00BA" + - "\u00BE\u00B3\u00BF\u00BC\u009A\u009C\u009E\u009D" + - "\u0000\u00A2\u009F\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00A5\u00B4\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0096\u0097\u0000\u0000\u0000" + - "\u0091\u0092\u0082\u0000\u0093\u0094\u0084\u0000" + - "\u0086\u0087\u0095\u0000\u0000\u0000\u0085\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0089\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u008B\u009B\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0088\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00B9\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0099\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000"; - - private final static short index1[] = { - 0, 188, 188, 188, 443, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 680, 914, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/MS1252.java b/jdk/src/share/classes/sun/nio/cs/MS1252.java deleted file mode 100644 index 728e7d7666e..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/MS1252.java +++ /dev/null @@ -1,304 +0,0 @@ -/* - * Copyright 2000-2004 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 sun.nio.cs; - -import java.nio.ByteBuffer; -import java.nio.CharBuffer; -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import java.nio.charset.CharacterCodingException; -import java.nio.charset.MalformedInputException; -import java.nio.charset.UnmappableCharacterException; - - -public class MS1252 - extends Charset - implements HistoricallyNamedCharset -{ - - public MS1252() { - super("windows-1252", StandardCharsets.aliases_MS1252); - } - - public String historicalName() { - return "Cp1252"; - } - - public boolean contains(Charset cs) { - return ((cs instanceof MS1252) - || (cs instanceof US_ASCII)); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u20AC\uFFFD\u201A\u0192\u201E\u2026\u2020\u2021" + // 0x80 - 0x87 - "\u02C6\u2030\u0160\u2039\u0152\uFFFD\u017D\uFFFD" + // 0x88 - 0x8F - "\uFFFD\u2018\u2019\u201C\u201D\u2022\u2013\u2014" + // 0x90 - 0x97 - "\u02DC\u2122\u0161\u203A\u0153\uFFFD\u017E\u0178" + // 0x98 - 0x9F - "\u00A0\u00A1\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7" + // 0xA0 - 0xA7 - "\u00A8\u00A9\u00AA\u00AB\u00AC\u00AD\u00AE\u00AF" + // 0xA8 - 0xAF - "\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7" + // 0xB0 - 0xB7 - "\u00B8\u00B9\u00BA\u00BB\u00BC\u00BD\u00BE\u00BF" + // 0xB8 - 0xBF - "\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + // 0xC0 - 0xC7 - "\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF" + // 0xC8 - 0xCF - "\u00D0\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D7" + // 0xD0 - 0xD7 - "\u00D8\u00D9\u00DA\u00DB\u00DC\u00DD\u00DE\u00DF" + // 0xD8 - 0xDF - "\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7" + // 0xE0 - 0xE7 - "\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF" + // 0xE8 - 0xEF - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + // 0xF0 - 0xF7 - "\u00F8\u00F9\u00FA\u00FB\u00FC\u00FD\u00FE\u00FF" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00A0\u00A1\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7" + - "\u00A8\u00A9\u00AA\u00AB\u00AC\u00AD\u00AE\u00AF" + - "\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7" + - "\u00B8\u00B9\u00BA\u00BB\u00BC\u00BD\u00BE\u00BF" + - "\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF" + - "\u00D0\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D7" + - "\u00D8\u00D9\u00DA\u00DB\u00DC\u00DD\u00DE\u00DF" + - "\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7" + - "\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u00FA\u00FB\u00FC\u00FD\u00FE\u00FF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u008C\u009C\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u008A\u009A\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u009F\u0000\u0000\u0000\u0000\u008E\u009E\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0083\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0088\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0098\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0096\u0097\u0000" + - "\u0000\u0000\u0091\u0092\u0082\u0000\u0093\u0094" + - "\u0084\u0000\u0086\u0087\u0095\u0000\u0000\u0000" + - "\u0085\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0089\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u008B\u009B\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0099\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 461, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 698, 920, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/MS1253.java b/jdk/src/share/classes/sun/nio/cs/MS1253.java deleted file mode 100644 index 41078f96a25..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/MS1253.java +++ /dev/null @@ -1,303 +0,0 @@ -/* - * Copyright 2002-2004 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 sun.nio.cs; - -import java.nio.ByteBuffer; -import java.nio.CharBuffer; -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import java.nio.charset.CharacterCodingException; -import java.nio.charset.MalformedInputException; -import java.nio.charset.UnmappableCharacterException; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - - -public class MS1253 - extends Charset - implements HistoricallyNamedCharset -{ - - public String historicalName() { - return "Cp1253"; - } - - public MS1253() { - super("windows-1253", StandardCharsets.aliases_MS1253); - } - - public boolean contains(Charset cs) { - return ((cs.name().equals("US-ASCII")) - || (cs instanceof MS1253)); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u20AC\uFFFD\u201A\u0192\u201E\u2026\u2020\u2021" + // 0x80 - 0x87 - "\uFFFD\u2030\uFFFD\u2039\uFFFD\uFFFD\uFFFD\uFFFD" + // 0x88 - 0x8F - "\uFFFD\u2018\u2019\u201C\u201D\u2022\u2013\u2014" + // 0x90 - 0x97 - "\uFFFD\u2122\uFFFD\u203A\uFFFD\uFFFD\uFFFD\uFFFD" + // 0x98 - 0x9F - "\u00A0\u0385\u0386\u00A3\u00A4\u00A5\u00A6\u00A7" + // 0xA0 - 0xA7 - "\u00A8\u00A9\uFFFD\u00AB\u00AC\u00AD\u00AE\u2015" + // 0xA8 - 0xAF - "\u00B0\u00B1\u00B2\u00B3\u0384\u00B5\u00B6\u00B7" + // 0xB0 - 0xB7 - "\u0388\u0389\u038A\u00BB\u038C\u00BD\u038E\u038F" + // 0xB8 - 0xBF - "\u0390\u0391\u0392\u0393\u0394\u0395\u0396\u0397" + // 0xC0 - 0xC7 - "\u0398\u0399\u039A\u039B\u039C\u039D\u039E\u039F" + // 0xC8 - 0xCF - "\u03A0\u03A1\uFFFD\u03A3\u03A4\u03A5\u03A6\u03A7" + // 0xD0 - 0xD7 - "\u03A8\u03A9\u03AA\u03AB\u03AC\u03AD\u03AE\u03AF" + // 0xD8 - 0xDF - "\u03B0\u03B1\u03B2\u03B3\u03B4\u03B5\u03B6\u03B7" + // 0xE0 - 0xE7 - "\u03B8\u03B9\u03BA\u03BB\u03BC\u03BD\u03BE\u03BF" + // 0xE8 - 0xEF - "\u03C0\u03C1\u03C2\u03C3\u03C4\u03C5\u03C6\u03C7" + // 0xF0 - 0xF7 - "\u03C8\u03C9\u03CA\u03CB\u03CC\u03CD\u03CE\uFFFD" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - private final static String index2 = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00A0\u0000\u0000\u00A3\u00A4\u00A5\u00A6\u00A7" + - "\u00A8\u00A9\u0000\u00AB\u00AC\u00AD\u00AE\u0000" + - "\u00B0\u00B1\u00B2\u00B3\u0000\u00B5\u00B6\u00B7" + - "\u0000\u0000\u0000\u00BB\u0000\u00BD\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0083\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00B4\u00A1\u00A2\u0000\u00B8\u00B9\u00BA" + - "\u0000\u00BC\u0000\u00BE\u00BF\u00C0\u00C1\u00C2" + - "\u00C3\u00C4\u00C5\u00C6\u00C7\u00C8\u00C9\u00CA" + - "\u00CB\u00CC\u00CD\u00CE\u00CF\u00D0\u00D1\u0000" + - "\u00D3\u00D4\u00D5\u00D6\u00D7\u00D8\u00D9\u00DA" + - "\u00DB\u00DC\u00DD\u00DE\u00DF\u00E0\u00E1\u00E2" + - "\u00E3\u00E4\u00E5\u00E6\u00E7\u00E8\u00E9\u00EA" + - "\u00EB\u00EC\u00ED\u00EE\u00EF\u00F0\u00F1\u00F2" + - "\u00F3\u00F4\u00F5\u00F6\u00F7\u00F8\u00F9\u00FA" + - "\u00FB\u00FC\u00FD\u00FE\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0096\u0097\u00AF" + - "\u0000\u0000\u0091\u0092\u0082\u0000\u0093\u0094" + - "\u0084\u0000\u0086\u0087\u0095\u0000\u0000\u0000" + - "\u0085\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0089\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u008B\u009B\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0099\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 190, 337, 461, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, - 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, - 698, 920, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, - 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, - 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, - 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, - 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, - 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, - 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, - 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, - 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, - 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, - 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, - 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, - 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, - 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/MS1254.java b/jdk/src/share/classes/sun/nio/cs/MS1254.java deleted file mode 100644 index d542d706675..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/MS1254.java +++ /dev/null @@ -1,305 +0,0 @@ -/* - * Copyright 2002-2004 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 sun.nio.cs; - -import java.nio.ByteBuffer; -import java.nio.CharBuffer; -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import java.nio.charset.CharacterCodingException; -import java.nio.charset.MalformedInputException; -import java.nio.charset.UnmappableCharacterException; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - - -public class MS1254 - extends Charset - implements HistoricallyNamedCharset -{ - - public String historicalName() { - return "Cp1254"; - } - - public MS1254() { - super("windows-1254", StandardCharsets.aliases_MS1254); - } - - public boolean contains(Charset cs) { - return ((cs.name().equals("US-ASCII")) - || (cs instanceof MS1254)); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u20AC\uFFFD\u201A\u0192\u201E\u2026\u2020\u2021" + // 0x80 - 0x87 - "\u02C6\u2030\u0160\u2039\u0152\uFFFD\uFFFD\uFFFD" + // 0x88 - 0x8F - "\uFFFD\u2018\u2019\u201C\u201D\u2022\u2013\u2014" + // 0x90 - 0x97 - "\u02DC\u2122\u0161\u203A\u0153\uFFFD\uFFFD\u0178" + // 0x98 - 0x9F - "\u00A0\u00A1\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7" + // 0xA0 - 0xA7 - "\u00A8\u00A9\u00AA\u00AB\u00AC\u00AD\u00AE\u00AF" + // 0xA8 - 0xAF - "\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7" + // 0xB0 - 0xB7 - "\u00B8\u00B9\u00BA\u00BB\u00BC\u00BD\u00BE\u00BF" + // 0xB8 - 0xBF - "\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + // 0xC0 - 0xC7 - "\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF" + // 0xC8 - 0xCF - "\u011E\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D7" + // 0xD0 - 0xD7 - "\u00D8\u00D9\u00DA\u00DB\u00DC\u0130\u015E\u00DF" + // 0xD8 - 0xDF - "\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7" + // 0xE0 - 0xE7 - "\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF" + // 0xE8 - 0xEF - "\u011F\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + // 0xF0 - 0xF7 - "\u00F8\u00F9\u00FA\u00FB\u00FC\u0131\u015F\u00FF" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - private final static String index2 = - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00A0\u00A1\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7" + - "\u00A8\u00A9\u00AA\u00AB\u00AC\u00AD\u00AE\u00AF" + - "\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7" + - "\u00B8\u00B9\u00BA\u00BB\u00BC\u00BD\u00BE\u00BF" + - "\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF" + - "\u0000\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D7" + - "\u00D8\u00D9\u00DA\u00DB\u00DC\u0000\u0000\u00DF" + - "\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7" + - "\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF" + - "\u0000\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u00FA\u00FB\u00FC\u0000\u0000\u00FF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00D0\u00F0" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00DD\u00FD\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u008C\u009C\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00DE\u00FE" + - "\u008A\u009A\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u009F\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0083\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0088\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0098\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0096\u0097\u0000" + - "\u0000\u0000\u0091\u0092\u0082\u0000\u0093\u0094" + - "\u0084\u0000\u0086\u0087\u0095\u0000\u0000\u0000" + - "\u0085\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0089\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u008B\u009B\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0099\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 461, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 698, 920, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/MS1257.java b/jdk/src/share/classes/sun/nio/cs/MS1257.java deleted file mode 100644 index 00f5dc9d287..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/MS1257.java +++ /dev/null @@ -1,304 +0,0 @@ -/* - * Copyright 2002-2004 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 sun.nio.cs; - -import java.nio.ByteBuffer; -import java.nio.CharBuffer; -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import java.nio.charset.CharacterCodingException; -import java.nio.charset.MalformedInputException; -import java.nio.charset.UnmappableCharacterException; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - - -public class MS1257 - extends Charset - implements HistoricallyNamedCharset -{ - - public String historicalName() { - return "Cp1257"; - } - - public MS1257() { - super("windows-1257", StandardCharsets.aliases_MS1257); - } - - public boolean contains(Charset cs) { - return ((cs.name().equals("US-ASCII")) - || (cs instanceof MS1257)); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u20AC\uFFFD\u201A\uFFFD\u201E\u2026\u2020\u2021" + // 0x80 - 0x87 - "\uFFFD\u2030\uFFFD\u2039\uFFFD\u00A8\u02C7\u00B8" + // 0x88 - 0x8F - "\uFFFD\u2018\u2019\u201C\u201D\u2022\u2013\u2014" + // 0x90 - 0x97 - "\uFFFD\u2122\uFFFD\u203A\uFFFD\u00AF\u02DB\uFFFD" + // 0x98 - 0x9F - "\u00A0\uFFFD\u00A2\u00A3\u00A4\uFFFD\u00A6\u00A7" + // 0xA0 - 0xA7 - "\u00D8\u00A9\u0156\u00AB\u00AC\u00AD\u00AE\u00C6" + // 0xA8 - 0xAF - "\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7" + // 0xB0 - 0xB7 - "\u00F8\u00B9\u0157\u00BB\u00BC\u00BD\u00BE\u00E6" + // 0xB8 - 0xBF - "\u0104\u012E\u0100\u0106\u00C4\u00C5\u0118\u0112" + // 0xC0 - 0xC7 - "\u010C\u00C9\u0179\u0116\u0122\u0136\u012A\u013B" + // 0xC8 - 0xCF - "\u0160\u0143\u0145\u00D3\u014C\u00D5\u00D6\u00D7" + // 0xD0 - 0xD7 - "\u0172\u0141\u015A\u016A\u00DC\u017B\u017D\u00DF" + // 0xD8 - 0xDF - "\u0105\u012F\u0101\u0107\u00E4\u00E5\u0119\u0113" + // 0xE0 - 0xE7 - "\u010D\u00E9\u017A\u0117\u0123\u0137\u012B\u013C" + // 0xE8 - 0xEF - "\u0161\u0144\u0146\u00F3\u014D\u00F5\u00F6\u00F7" + // 0xF0 - 0xF7 - "\u0173\u0142\u015B\u016B\u00FC\u017C\u017E\u02D9" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00A0\u0000\u00A2\u00A3\u00A4\u0000\u00A6\u00A7" + - "\u008D\u00A9\u0000\u00AB\u00AC\u00AD\u00AE\u009D" + - "\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7" + - "\u008F\u00B9\u0000\u00BB\u00BC\u00BD\u00BE\u0000" + - "\u0000\u0000\u0000\u0000\u00C4\u00C5\u00AF\u0000" + - "\u0000\u00C9\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00D3\u0000\u00D5\u00D6\u00D7" + - "\u00A8\u0000\u0000\u0000\u00DC\u0000\u0000\u00DF" + - "\u0000\u0000\u0000\u0000\u00E4\u00E5\u00BF\u0000" + - "\u0000\u00E9\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00F3\u0000\u00F5\u00F6\u00F7" + - "\u00B8\u0000\u0000\u0000\u00FC\u0000\u0000\u0000" + - "\u00C2\u00E2\u0000\u0000\u00C0\u00E0\u00C3\u00E3" + - "\u0000\u0000\u0000\u0000\u00C8\u00E8\u0000\u0000" + - "\u0000\u0000\u00C7\u00E7\u0000\u0000\u00CB\u00EB" + - "\u00C6\u00E6\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00CC\u00EC\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00CE\u00EE\u0000\u0000\u00C1\u00E1" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00CD\u00ED" + - "\u0000\u0000\u0000\u00CF\u00EF\u0000\u0000\u0000" + - "\u0000\u00D9\u00F9\u00D1\u00F1\u00D2\u00F2\u0000" + - "\u0000\u0000\u0000\u0000\u00D4\u00F4\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00AA\u00BA" + - "\u0000\u0000\u00DA\u00FA\u0000\u0000\u0000\u0000" + - "\u00D0\u00F0\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00DB\u00FB\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00D8\u00F8\u0000\u0000\u0000\u0000" + - "\u0000\u00CA\u00EA\u00DD\u00FD\u00DE\u00FE\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u008E" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00FF\u0000\u009E\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0096\u0097\u0000\u0000\u0000\u0091\u0092\u0082" + - "\u0000\u0093\u0094\u0084\u0000\u0086\u0087\u0095" + - "\u0000\u0000\u0000\u0085\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0089\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u008B\u009B" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0080\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0099\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 440, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 677, 899, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/SingleByte.java b/jdk/src/share/classes/sun/nio/cs/SingleByte.java new file mode 100644 index 00000000000..fdbf4e3c643 --- /dev/null +++ b/jdk/src/share/classes/sun/nio/cs/SingleByte.java @@ -0,0 +1,241 @@ +/* + * 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 sun.nio.cs; + +import java.nio.Buffer; +import java.nio.ByteBuffer; +import java.nio.CharBuffer; +import java.nio.charset.Charset; +import java.nio.charset.CharsetDecoder; +import java.nio.charset.CharsetEncoder; +import java.nio.charset.CoderResult; +import static sun.nio.cs.CharsetMapping.*; + +public class SingleByte +{ + private static final CoderResult withResult(CoderResult cr, + Buffer src, int sp, + Buffer dst, int dp) + { + src.position(sp - src.arrayOffset()); + dst.position(dp - dst.arrayOffset()); + return cr; + } + + public static class Decoder extends CharsetDecoder { + private final char[] b2c; + + public Decoder(Charset cs, char[] b2c) { + super(cs, 1.0f, 1.0f); + this.b2c = b2c; + } + + private CoderResult decodeArrayLoop(ByteBuffer src, CharBuffer dst) { + byte[] sa = src.array(); + int sp = src.arrayOffset() + src.position(); + int sl = src.arrayOffset() + src.limit(); + + char[] da = dst.array(); + int dp = dst.arrayOffset() + dst.position(); + int dl = dst.arrayOffset() + dst.limit(); + + CoderResult cr = CoderResult.UNDERFLOW; + if ((dl - dp) < (sl - sp)) { + sl = sp + (dl - dp); + cr = CoderResult.OVERFLOW; + } + + while (sp < sl) { + char c = decode(sa[sp]); + if (c == UNMAPPABLE_DECODING) { + return withResult(CoderResult.unmappableForLength(1), + src, sp, dst, dp); + } + da[dp++] = c; + sp++; + } + return withResult(cr, src, sp, dst, dp); + } + + private CoderResult decodeBufferLoop(ByteBuffer src, CharBuffer dst) { + int mark = src.position(); + try { + while (src.hasRemaining()) { + char c = decode(src.get()); + if (c == UNMAPPABLE_DECODING) + return CoderResult.unmappableForLength(1); + if (!dst.hasRemaining()) + return CoderResult.OVERFLOW; + dst.put(c); + mark++; + } + return CoderResult.UNDERFLOW; + } finally { + src.position(mark); + } + } + + protected CoderResult decodeLoop(ByteBuffer src, CharBuffer dst) { + if (src.hasArray() && dst.hasArray()) + return decodeArrayLoop(src, dst); + else + return decodeBufferLoop(src, dst); + } + + private final char decode(int b) { + return b2c[b + 128]; + } + } + + public static class Encoder extends CharsetEncoder { + private Surrogate.Parser sgp; + private final char[] c2b; + private final char[] c2bIndex; + + public Encoder(Charset cs, char[] c2b, char[] c2bIndex) { + super(cs, 1.0f, 1.0f); + this.c2b = c2b; + this.c2bIndex = c2bIndex; + } + + public boolean canEncode(char c) { + return encode(c) != UNMAPPABLE_ENCODING; + } + + private CoderResult encodeArrayLoop(CharBuffer src, ByteBuffer dst) { + char[] sa = src.array(); + int sp = src.arrayOffset() + src.position(); + int sl = src.arrayOffset() + src.limit(); + + byte[] da = dst.array(); + int dp = dst.arrayOffset() + dst.position(); + int dl = dst.arrayOffset() + dst.limit(); + + CoderResult cr = CoderResult.UNDERFLOW; + if ((dl - dp) < (sl - sp)) { + sl = sp + (dl - dp); + cr = CoderResult.OVERFLOW; + } + + while (sp < sl) { + char c = sa[sp]; + int b = encode(c); + if (b == UNMAPPABLE_ENCODING) { + if (Surrogate.is(c)) { + if (sgp == null) + sgp = new Surrogate.Parser(); + if (sgp.parse(c, sa, sp, sl) < 0) + return withResult(sgp.error(), src, sp, dst, dp); + return withResult(sgp.unmappableResult(), src, sp, dst, dp); + } + return withResult(CoderResult.unmappableForLength(1), + src, sp, dst, dp); + } + da[dp++] = (byte)b; + sp++; + } + return withResult(cr, src, sp, dst, dp); + } + + private CoderResult encodeBufferLoop(CharBuffer src, ByteBuffer dst) { + int mark = src.position(); + try { + while (src.hasRemaining()) { + char c = src.get(); + int b = encode(c); + if (b == UNMAPPABLE_ENCODING) { + if (Surrogate.is(c)) { + if (sgp == null) + sgp = new Surrogate.Parser(); + if (sgp.parse(c, src) < 0) + return sgp.error(); + return sgp.unmappableResult(); + } + return CoderResult.unmappableForLength(1); + } + if (!dst.hasRemaining()) + return CoderResult.OVERFLOW; + dst.put((byte)b); + mark++; + } + return CoderResult.UNDERFLOW; + } finally { + src.position(mark); + } + } + + protected CoderResult encodeLoop(CharBuffer src, ByteBuffer dst) { + if (src.hasArray() && dst.hasArray()) + return encodeArrayLoop(src, dst); + else + return encodeBufferLoop(src, dst); + } + + private final int encode(char ch) { + char index = c2bIndex[ch >> 8]; + if (index == UNMAPPABLE_ENCODING) + return UNMAPPABLE_ENCODING; + return c2b[index + (ch & 0xff)]; + } + } + + // init the c2b and c2bIndex tables from b2c. + public static void initC2B(char[] b2c, char[] c2bNR, + char[] c2b, char[] c2bIndex) { + for (int i = 0; i < c2bIndex.length; i++) + c2bIndex[i] = UNMAPPABLE_ENCODING; + for (int i = 0; i < c2b.length; i++) + c2b[i] = UNMAPPABLE_ENCODING; + int off = 0; + for (int i = 0; i < b2c.length; i++) { + char c = b2c[i]; + if (c == UNMAPPABLE_DECODING) + continue; + int index = (c >> 8); + if (c2bIndex[index] == UNMAPPABLE_ENCODING) { + c2bIndex[index] = (char)off; + off += 0x100; + } + index = c2bIndex[index] + (c & 0xff); + c2b[index] = (char)((i>=0x80)?(i-0x80):(i+0x80)); + } + if (c2bNR != null) { + // c-->b nr entries + int i = 0; + while (i < c2bNR.length) { + char b = c2bNR[i++]; + char c = c2bNR[i++]; + int index = (c >> 8); + if (c2bIndex[index] == UNMAPPABLE_ENCODING) { + c2bIndex[index] = (char)off; + off += 0x100; + } + index = c2bIndex[index] + (c & 0xff); + c2b[index] = b; + } + } + } +} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM037.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM037.java deleted file mode 100644 index 0de335fd40c..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM037.java +++ /dev/null @@ -1,221 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM037 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM037() { - super("IBM037", ExtendedCharsets.aliasesFor("IBM037")); - } - - public String historicalName() { - return "Cp037"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM037); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - protected static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87 - "\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + // 0x88 - 0x8F - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97 - "\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u00A4" + // 0x98 - 0x9F - "\u00B5\u007E\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xA0 - 0xA7 - "\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + // 0xA8 - 0xAF - "\u005E\u00A3\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC" + // 0xB0 - 0xB7 - "\u00BD\u00BE\u005B\u005D\u00AF\u00A8\u00B4\u00D7" + // 0xB8 - 0xBF - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xC0 - 0xC7 - "\u0048\u0049\u00AD\u00F4\u00F6\u00F2\u00F3\u00F5" + // 0xC8 - 0xCF - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xD0 - 0xD7 - "\u0051\u0052\u00B9\u00FB\u00FC\u00F9\u00FA\u00FF" + // 0xD8 - 0xDF - "\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xE0 - 0xE7 - "\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + // 0xE8 - 0xEF - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xF0 - 0xF7 - "\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07 - "\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17 - "\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27 - "\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2F - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37 - "\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3F - "\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u00E5" + // 0x40 - 0x47 - "\u00E7\u00F1\u00A2\u002E\u003C\u0028\u002B\u007C" + // 0x48 - 0x4F - "\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF" + // 0x50 - 0x57 - "\u00EC\u00DF\u0021\u0024\u002A\u0029\u003B\u00AC" + // 0x58 - 0x5F - "\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5" + // 0x60 - 0x67 - "\u00C7\u00D1\u00A6\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6F - "\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF" + // 0x70 - 0x77 - "\u00CC\u0060\u003A\u0023\u0040\'\u003D\""; // 0x78 - 0x7F - - } - - protected static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0037\u002D\u002E\u002F" + - "\u0016\u0005\u0015\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u003C\u003D\u0032\u0026" + - "\u0018\u0019\u003F\'\u001C\u001D\u001E\u001F" + - "\u0040\u005A\u007F\u007B\u005B\u006C\u0050\u007D" + - "\u004D\u005D\\\u004E\u006B\u0060\u004B\u0061" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u007A\u005E\u004C\u007E\u006E\u006F" + - "\u007C\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6" + - "\u00D7\u00D8\u00D9\u00E2\u00E3\u00E4\u00E5\u00E6" + - "\u00E7\u00E8\u00E9\u00BA\u00E0\u00BB\u00B0\u006D" + - "\u0079\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u0091\u0092\u0093\u0094\u0095\u0096" + - "\u0097\u0098\u0099\u00A2\u00A3\u00A4\u00A5\u00A6" + - "\u00A7\u00A8\u00A9\u00C0\u004F\u00D0\u00A1\u0007" + - "\u0020\u0021\"\u0023\u0024\u0015\u0006\u0017" + - "\u0028\u0029\u002A\u002B\u002C\t\n\u001B" + - "\u0030\u0031\u001A\u0033\u0034\u0035\u0036\b" + - "\u0038\u0039\u003A\u003B\u0004\u0014\u003E\u00FF" + - "\u0041\u00AA\u004A\u00B1\u009F\u00B2\u006A\u00B5" + - "\u00BD\u00B4\u009A\u008A\u005F\u00CA\u00AF\u00BC" + - "\u0090\u008F\u00EA\u00FA\u00BE\u00A0\u00B6\u00B3" + - "\u009D\u00DA\u009B\u008B\u00B7\u00B8\u00B9\u00AB" + - "\u0064\u0065\u0062\u0066\u0063\u0067\u009E\u0068" + - "\u0074\u0071\u0072\u0073\u0078\u0075\u0076\u0077" + - "\u00AC\u0069\u00ED\u00EE\u00EB\u00EF\u00EC\u00BF" + - "\u0080\u00FD\u00FE\u00FB\u00FC\u00AD\u00AE\u0059" + - "\u0044\u0045\u0042\u0046\u0043\u0047\u009C\u0048" + - "\u0054\u0051\u0052\u0053\u0058\u0055\u0056\u0057" + - "\u008C\u0049\u00CD\u00CE\u00CB\u00CF\u00CC\u00E1" + - "\u0070\u00DD\u00DE\u00DB\u00DC\u008D\u008E\u00DF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM1006.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM1006.java deleted file mode 100644 index 4d30d6f4e7e..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM1006.java +++ /dev/null @@ -1,336 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM1006 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM1006() { - super("x-IBM1006", ExtendedCharsets.aliasesFor("x-IBM1006")); - } - - public String historicalName() { - return "Cp1006"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM1006); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + // 0x80 - 0x87 - "\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + // 0x88 - 0x8F - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097" + // 0x90 - 0x97 - "\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + // 0x98 - 0x9F - "\u00A0\u06F0\u06F1\u06F2\u06F3\u06F4\u06F5\u06F6" + // 0xA0 - 0xA7 - "\u06F7\u06F8\u06F9\u060C\u061B\u00AD\u061F\uFE81" + // 0xA8 - 0xAF - "\uFE8D\uFE8E\uF8FB\uFE8F\uFE91\uFB56\uFB58\uFE93" + // 0xB0 - 0xB7 - "\uFE95\uFE97\uFB66\uFB68\uFE99\uFE9B\uFE9D\uFE9F" + // 0xB8 - 0xBF - "\uFB7A\uFB7C\uFEA1\uFEA3\uFEA5\uFEA7\uFEA9\uFB88" + // 0xC0 - 0xC7 - "\uFEAB\uFEAD\uFB8C\uFEAF\uFB8A\uFEB1\uFEB3\uFEB5" + // 0xC8 - 0xCF - "\uFEB7\uFEB9\uFEBB\uFEBD\uFEBF\uFEC3\uFEC7\uFEC9" + // 0xD0 - 0xD7 - "\uFECA\uFECB\uFECC\uFECD\uFECE\uFECF\uFED0\uFED1" + // 0xD8 - 0xDF - "\uFED3\uFED5\uFED7\uFB8E\uFEDB\uFB92\uFB94\uFEDD" + // 0xE0 - 0xE7 - "\uFEDF\uFEE0\uFEE1\uFEE3\uFB9E\uFEE5\uFEE7\uFE85" + // 0xE8 - 0xEF - "\uFEED\uFBA6\uFBA8\uFBA9\uFBAA\uFE80\uFE89\uFE8A" + // 0xF0 - 0xF7 - "\uFE8B\uFBFC\uFBFD\uFBFE\uFBB0\uFBAE\uFE7C\uFE7D" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097" + - "\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + - "\u00A0\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00AD\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00AB\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00AC\u0000\u0000" + - "\u0000\u00AE\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00A1\u00A2\u00A3\u00A4\u00A5\u00A6" + - "\u00A7\u00A8\u00A9\u00AA\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00B2" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00B5\u0000" + - "\u00B6\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00BA\u0000" + - "\u00BB\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00C0\u0000\u00C1\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00C7\u0000\u00CC\u0000\u00CA\u0000\u00E3\u0000" + - "\u0000\u0000\u00E5\u0000\u00E6\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00EC\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00F1\u0000" + - "\u00F2\u00F3\u00F4\u0000\u0000\u0000\u00FD\u0000" + - "\u00FC\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00F9\u00FA\u00FB\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00FE\u00FF\u0000\u0000\u00F5" + - "\u00AF\u0000\u0000\u0000\u00EF\u0000\u0000\u0000" + - "\u00F6\u00F7\u00F8\u0000\u00B0\u00B1\u00B3\u0000" + - "\u00B4\u0000\u00B7\u0000\u00B8\u0000\u00B9\u0000" + - "\u00BC\u0000\u00BD\u0000\u00BE\u0000\u00BF\u0000" + - "\u00C2\u0000\u00C3\u0000\u00C4\u0000\u00C5\u0000" + - "\u00C6\u0000\u00C8\u0000\u00C9\u0000\u00CB\u0000" + - "\u00CD\u0000\u00CE\u0000\u00CF\u0000\u00D0\u0000" + - "\u00D1\u0000\u00D2\u0000\u00D3\u0000\u00D4\u0000" + - "\u0000\u0000\u00D5\u0000\u0000\u0000\u00D6\u0000" + - "\u00D7\u00D8\u00D9\u00DA\u00DB\u00DC\u00DD\u00DE" + - "\u00DF\u0000\u00E0\u0000\u00E1\u0000\u00E2\u0000" + - "\u0000\u0000\u00E4\u0000\u00E7\u0000\u00E8\u00E9" + - "\u00EA\u0000\u00EB\u0000\u00ED\u0000\u00EE\u0000" + - "\u0000\u0000\u0000\u0000\u00F0\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 174, 174, 174, 174, 174, 418, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 668, 174, 174, 920, 174, 174, 1175, 174, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM1025.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM1025.java deleted file mode 100644 index 546234607b4..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM1025.java +++ /dev/null @@ -1,272 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM1025 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM1025() { - super("x-IBM1025", ExtendedCharsets.aliasesFor("x-IBM1025")); - } - - public String historicalName() { - return "Cp1025"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM1025); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u0446\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87 - "\u0068\u0069\u0434\u0435\u0444\u0433\u0445\u0438" + // 0x88 - 0x8F - "\u0439\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97 - "\u0071\u0072\u043A\u043B\u043C\u043D\u043E\u043F" + // 0x98 - 0x9F - "\u044F\u007E\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xA0 - 0xA7 - "\u0079\u007A\u0440\u0441\u0442\u0443\u0436\u0432" + // 0xA8 - 0xAF - "\u044C\u044B\u0437\u0448\u044D\u0449\u0447\u044A" + // 0xB0 - 0xB7 - "\u042E\u0410\u0411\u0426\u0414\u0415\u0424\u0413" + // 0xB8 - 0xBF - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xC0 - 0xC7 - "\u0048\u0049\u0425\u0418\u0419\u041A\u041B\u041C" + // 0xC8 - 0xCF - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xD0 - 0xD7 - "\u0051\u0052\u041D\u041E\u041F\u042F\u0420\u0421" + // 0xD8 - 0xDF - "\\\u00A7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xE0 - 0xE7 - "\u0059\u005A\u0422\u0423\u0416\u0412\u042C\u042B" + // 0xE8 - 0xEF - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xF0 - 0xF7 - "\u0038\u0039\u0417\u0428\u042D\u0429\u0427\u009F" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07 - "\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17 - "\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27 - "\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2F - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37 - "\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3F - "\u0020\u00A0\u0452\u0453\u0451\u0454\u0455\u0456" + // 0x40 - 0x47 - "\u0457\u0458\u005B\u002E\u003C\u0028\u002B\u0021" + // 0x48 - 0x4F - "\u0026\u0459\u045A\u045B\u045C\u045E\u045F\u042A" + // 0x50 - 0x57 - "\u2116\u0402\u005D\u0024\u002A\u0029\u003B\u005E" + // 0x58 - 0x5F - "\u002D\u002F\u0403\u0401\u0404\u0405\u0406\u0407" + // 0x60 - 0x67 - "\u0408\u0409\u007C\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6F - "\u040A\u040B\u040C\u00AD\u040E\u040F\u044E\u0430" + // 0x70 - 0x77 - "\u0431\u0060\u003A\u0023\u0040\'\u003D\""; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0037\u002D\u002E\u002F" + - "\u0016\u0005\u0015\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u003C\u003D\u0032\u0026" + - "\u0018\u0019\u003F\'\u001C\u001D\u001E\u001F" + - "\u0040\u004F\u007F\u007B\u005B\u006C\u0050\u007D" + - "\u004D\u005D\\\u004E\u006B\u0060\u004B\u0061" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u007A\u005E\u004C\u007E\u006E\u006F" + - "\u007C\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6" + - "\u00D7\u00D8\u00D9\u00E2\u00E3\u00E4\u00E5\u00E6" + - "\u00E7\u00E8\u00E9\u004A\u00E0\u005A\u005F\u006D" + - "\u0079\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u0091\u0092\u0093\u0094\u0095\u0096" + - "\u0097\u0098\u0099\u00A2\u00A3\u00A4\u00A5\u00A6" + - "\u00A7\u00A8\u00A9\u00C0\u006A\u00D0\u00A1\u0007" + - "\u0020\u0021\"\u0023\u0024\u0015\u0006\u0017" + - "\u0028\u0029\u002A\u002B\u002C\t\n\u001B" + - "\u0030\u0031\u001A\u0033\u0034\u0035\u0036\b" + - "\u0038\u0039\u003A\u003B\u0004\u0014\u003E\u00FF" + - "\u0041\u0000\u0000\u0000\u0000\u0000\u0000\u00E1" + - "\u0000\u0000\u0000\u0000\u0000\u0073\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0063\u0059" + - "\u0062\u0064\u0065\u0066\u0067\u0068\u0069\u0070" + - "\u0071\u0072\u0000\u0074\u0075\u00B9\u00BA\u00ED" + - "\u00BF\u00BC\u00BD\u00EC\u00FA\u00CB\u00CC\u00CD" + - "\u00CE\u00CF\u00DA\u00DB\u00DC\u00DE\u00DF\u00EA" + - "\u00EB\u00BE\u00CA\u00BB\u00FE\u00FB\u00FD\u0057" + - "\u00EF\u00EE\u00FC\u00B8\u00DD\u0077\u0078\u00AF" + - "\u008D\u008A\u008B\u00AE\u00B2\u008F\u0090\u009A" + - "\u009B\u009C\u009D\u009E\u009F\u00AA\u00AB\u00AC" + - "\u00AD\u008C\u008E\u0080\u00B6\u00B3\u00B5\u00B7" + - "\u00B1\u00B0\u00B4\u0076\u00A0\u0000\u0044\u0042" + - "\u0043\u0045\u0046\u0047\u0048\u0049\u0051\u0052" + - "\u0053\u0054\u0000\u0055\u0056\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0058\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 174, 174, 174, 429, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 663, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM1026.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM1026.java deleted file mode 100644 index 9e51569437e..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM1026.java +++ /dev/null @@ -1,233 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM1026 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM1026() { - super("IBM1026", ExtendedCharsets.aliasesFor("IBM1026")); - } - - public String historicalName() { - return "Cp1026"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM1026); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87 - "\u0068\u0069\u00AB\u00BB\u007D\u0060\u00A6\u00B1" + // 0x88 - 0x8F - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97 - "\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u00A4" + // 0x98 - 0x9F - "\u00B5\u00F6\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xA0 - 0xA7 - "\u0079\u007A\u00A1\u00BF\u005D\u0024\u0040\u00AE" + // 0xA8 - 0xAF - "\u00A2\u00A3\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC" + // 0xB0 - 0xB7 - "\u00BD\u00BE\u00AC\u007C\u00AF\u00A8\u00B4\u00D7" + // 0xB8 - 0xBF - "\u00E7\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xC0 - 0xC7 - "\u0048\u0049\u00AD\u00F4\u007E\u00F2\u00F3\u00F5" + // 0xC8 - 0xCF - "\u011F\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xD0 - 0xD7 - "\u0051\u0052\u00B9\u00FB\\\u00F9\u00FA\u00FF" + // 0xD8 - 0xDF - "\u00FC\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xE0 - 0xE7 - "\u0059\u005A\u00B2\u00D4\u0023\u00D2\u00D3\u00D5" + // 0xE8 - 0xEF - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xF0 - 0xF7 - "\u0038\u0039\u00B3\u00DB\"\u00D9\u00DA\u009F" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07 - "\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17 - "\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27 - "\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2F - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37 - "\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3F - "\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u00E5" + // 0x40 - 0x47 - "\u007B\u00F1\u00C7\u002E\u003C\u0028\u002B\u0021" + // 0x48 - 0x4F - "\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF" + // 0x50 - 0x57 - "\u00EC\u00DF\u011E\u0130\u002A\u0029\u003B\u005E" + // 0x58 - 0x5F - "\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5" + // 0x60 - 0x67 - "\u005B\u00D1\u015F\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6F - "\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF" + // 0x70 - 0x77 - "\u00CC\u0131\u003A\u00D6\u015E\'\u003D\u00DC"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0037\u002D\u002E\u002F" + - "\u0016\u0005\u0015\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u003C\u003D\u0032\u0026" + - "\u0018\u0019\u003F\'\u001C\u001D\u001E\u001F" + - "\u0040\u004F\u00FC\u00EC\u00AD\u006C\u0050\u007D" + - "\u004D\u005D\\\u004E\u006B\u0060\u004B\u0061" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u007A\u005E\u004C\u007E\u006E\u006F" + - "\u00AE\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6" + - "\u00D7\u00D8\u00D9\u00E2\u00E3\u00E4\u00E5\u00E6" + - "\u00E7\u00E8\u00E9\u0068\u00DC\u00AC\u005F\u006D" + - "\u008D\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u0091\u0092\u0093\u0094\u0095\u0096" + - "\u0097\u0098\u0099\u00A2\u00A3\u00A4\u00A5\u00A6" + - "\u00A7\u00A8\u00A9\u0048\u00BB\u008C\u00CC\u0007" + - "\u0020\u0021\"\u0023\u0024\u0015\u0006\u0017" + - "\u0028\u0029\u002A\u002B\u002C\t\n\u001B" + - "\u0030\u0031\u001A\u0033\u0034\u0035\u0036\b" + - "\u0038\u0039\u003A\u003B\u0004\u0014\u003E\u00FF" + - "\u0041\u00AA\u00B0\u00B1\u009F\u00B2\u008E\u00B5" + - "\u00BD\u00B4\u009A\u008A\u00BA\u00CA\u00AF\u00BC" + - "\u0090\u008F\u00EA\u00FA\u00BE\u00A0\u00B6\u00B3" + - "\u009D\u00DA\u009B\u008B\u00B7\u00B8\u00B9\u00AB" + - "\u0064\u0065\u0062\u0066\u0063\u0067\u009E\u004A" + - "\u0074\u0071\u0072\u0073\u0078\u0075\u0076\u0077" + - "\u0000\u0069\u00ED\u00EE\u00EB\u00EF\u007B\u00BF" + - "\u0080\u00FD\u00FE\u00FB\u007F\u0000\u0000\u0059" + - "\u0044\u0045\u0042\u0046\u0043\u0047\u009C\u00C0" + - "\u0054\u0051\u0052\u0053\u0058\u0055\u0056\u0057" + - "\u0000\u0049\u00CD\u00CE\u00CB\u00CF\u00A1\u00E1" + - "\u0070\u00DD\u00DE\u00DB\u00E0\u0000\u0000\u00DF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u005A\u00D0" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u005B\u0079\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u007C\u006A" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 352, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM1046.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM1046.java deleted file mode 100644 index 60e39ea6e28..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM1046.java +++ /dev/null @@ -1,335 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM1046 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM1046() { - super("x-IBM1046", ExtendedCharsets.aliasesFor("x-IBM1046")); - } - - public String historicalName() { - return "Cp1046"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM1046); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\uFE88\u00D7\u00F7\uF8F6\uF8F5\uF8F4\uF8F7\uFE71" + // 0x80 - 0x87 - "\u0088\u25A0\u2502\u2500\u2510\u250C\u2514\u2518" + // 0x88 - 0x8F - "\uFE79\uFE7B\uFE7D\uFE7F\uFE77\uFE8A\uFEF0\uFEF3" + // 0x90 - 0x97 - "\uFEF2\uFECE\uFECF\uFED0\uFEF6\uFEF8\uFEFA\uFEFC" + // 0x98 - 0x9F - "\u00A0\uF8FA\uF8F9\uF8F8\u00A4\uF8FB\uFE8B\uFE91" + // 0xA0 - 0xA7 - "\uFE97\uFE9B\uFE9F\uFEA3\u060C\u00AD\uFEA7\uFEB3" + // 0xA8 - 0xAF - "\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667" + // 0xB0 - 0xB7 - "\u0668\u0669\uFEB7\u061B\uFEBB\uFEBF\uFECA\u061F" + // 0xB8 - 0xBF - "\uFECB\uFE80\uFE81\uFE83\uFE85\uFE87\uFE89\uFE8D" + // 0xC0 - 0xC7 - "\uFE8F\uFE93\uFE95\uFE99\uFE9D\uFEA1\uFEA5\uFEA9" + // 0xC8 - 0xCF - "\uFEAB\uFEAD\uFEAF\uFEB1\uFEB5\uFEB9\uFEBD\uFEC3" + // 0xD0 - 0xD7 - "\uFEC7\uFEC9\uFECD\uFECC\uFE82\uFE84\uFE8E\uFED3" + // 0xD8 - 0xDF - "\u0640\uFED1\uFED5\uFED9\uFEDD\uFEE1\uFEE5\uFEEB" + // 0xE0 - 0xE7 - "\uFEED\uFEEF\uFEF1\uFE70\uFE72\uFE74\uFE76\uFE78" + // 0xE8 - 0xEF - "\uFE7A\uFE7C\uFE7E\uFED7\uFEDB\uFEDF\uF8FC\uFEF5" + // 0xF0 - 0xF7 - "\uFEF7\uFEF9\uFEFB\uFEE3\uFEE7\uFEEC\uFEE9\uFFFD" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0088\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00A0\u0000\u0000\u0000\u00A4\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00AD\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0081" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0082" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00AC\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00BB" + - "\u0000\u0000\u0000\u00BF\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00E0\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00B0\u00B1\u00B2\u00B3" + - "\u00B4\u00B5\u00B6\u00B7\u00B8\u00B9\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u008B\u0000\u008A\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u008D\u0000\u0000\u0000\u008C\u0000\u0000\u0000" + - "\u008E\u0000\u0000\u0000\u008F\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0089\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0085\u0084\u0083\u0086\u00A3\u00A2\u00A1" + - "\u00A5\u00F6\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00EB\u0087\u00EC\u0000\u00ED\u0000" + - "\u00EE\u0094\u00EF\u0090\u00F0\u0091\u00F1\u0092" + - "\u00F2\u0093\u00C1\u00C2\u00DC\u00C3\u00DD\u00C4" + - "\u0000\u00C5\u0080\u00C6\u0095\u00A6\u0000\u00C7" + - "\u00DE\u00C8\u0000\u00A7\u0000\u00C9\u0000\u00CA" + - "\u0000\u00A8\u0000\u00CB\u0000\u00A9\u0000\u00CC" + - "\u0000\u00AA\u0000\u00CD\u0000\u00AB\u0000\u00CE" + - "\u0000\u00AE\u0000\u00CF\u0000\u00D0\u0000\u00D1" + - "\u0000\u00D2\u0000\u00D3\u0000\u00AF\u0000\u00D4" + - "\u0000\u00BA\u0000\u00D5\u0000\u00BC\u0000\u00D6" + - "\u0000\u00BD\u0000\u0000\u0000\u00D7\u0000\u0000" + - "\u0000\u00D8\u0000\u00D9\u00BE\u00C0\u00DB\u00DA" + - "\u0099\u009A\u009B\u00E1\u0000\u00DF\u0000\u00E2" + - "\u0000\u00F3\u0000\u00E3\u0000\u00F4\u0000\u00E4" + - "\u0000\u00F5\u0000\u00E5\u0000\u00FB\u0000\u00E6" + - "\u0000\u00FC\u0000\u00FE\u0000\u00E7\u00FD\u00E8" + - "\u0000\u00E9\u0096\u00EA\u0098\u0097\u0000\u00F7" + - "\u009C\u00F8\u009D\u00F9\u009E\u00FA\u009F\u0000" + - "\u0000\u0000"; - - private final static short index1[] = { - 0, 248, 248, 248, 248, 248, 492, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 748, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 909, 248, 248, 248, 248, 248, 1162, 248, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM1047.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM1047.java deleted file mode 100644 index 55eb9294b6b..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM1047.java +++ /dev/null @@ -1,221 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM1047 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM1047() { - super("IBM1047", ExtendedCharsets.aliasesFor("IBM1047")); - } - - public String historicalName() { - return "Cp1047"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM1047); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87 - "\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + // 0x88 - 0x8F - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97 - "\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u00A4" + // 0x98 - 0x9F - "\u00B5\u007E\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xA0 - 0xA7 - "\u0079\u007A\u00A1\u00BF\u00D0\u005B\u00DE\u00AE" + // 0xA8 - 0xAF - "\u00AC\u00A3\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC" + // 0xB0 - 0xB7 - "\u00BD\u00BE\u00DD\u00A8\u00AF\u005D\u00B4\u00D7" + // 0xB8 - 0xBF - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xC0 - 0xC7 - "\u0048\u0049\u00AD\u00F4\u00F6\u00F2\u00F3\u00F5" + // 0xC8 - 0xCF - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xD0 - 0xD7 - "\u0051\u0052\u00B9\u00FB\u00FC\u00F9\u00FA\u00FF" + // 0xD8 - 0xDF - "\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xE0 - 0xE7 - "\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + // 0xE8 - 0xEF - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xF0 - 0xF7 - "\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07 - "\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17 - "\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0080\u0081\u0082\u0083\u0084\u0085\u0017\u001B" + // 0x20 - 0x27 - "\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2F - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37 - "\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3F - "\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u00E5" + // 0x40 - 0x47 - "\u00E7\u00F1\u00A2\u002E\u003C\u0028\u002B\u007C" + // 0x48 - 0x4F - "\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF" + // 0x50 - 0x57 - "\u00EC\u00DF\u0021\u0024\u002A\u0029\u003B\u005E" + // 0x58 - 0x5F - "\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5" + // 0x60 - 0x67 - "\u00C7\u00D1\u00A6\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6F - "\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF" + // 0x70 - 0x77 - "\u00CC\u0060\u003A\u0023\u0040\'\u003D\""; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0037\u002D\u002E\u002F" + - "\u0016\u0005\u0015\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u003C\u003D\u0032\u0026" + - "\u0018\u0019\u003F\'\u001C\u001D\u001E\u001F" + - "\u0040\u005A\u007F\u007B\u005B\u006C\u0050\u007D" + - "\u004D\u005D\\\u004E\u006B\u0060\u004B\u0061" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u007A\u005E\u004C\u007E\u006E\u006F" + - "\u007C\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6" + - "\u00D7\u00D8\u00D9\u00E2\u00E3\u00E4\u00E5\u00E6" + - "\u00E7\u00E8\u00E9\u00AD\u00E0\u00BD\u005F\u006D" + - "\u0079\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u0091\u0092\u0093\u0094\u0095\u0096" + - "\u0097\u0098\u0099\u00A2\u00A3\u00A4\u00A5\u00A6" + - "\u00A7\u00A8\u00A9\u00C0\u004F\u00D0\u00A1\u0007" + - "\u0020\u0021\"\u0023\u0024\u0025\u0006\u0017" + - "\u0028\u0029\u002A\u002B\u002C\t\n\u001B" + - "\u0030\u0031\u001A\u0033\u0034\u0035\u0036\b" + - "\u0038\u0039\u003A\u003B\u0004\u0014\u003E\u00FF" + - "\u0041\u00AA\u004A\u00B1\u009F\u00B2\u006A\u00B5" + - "\u00BB\u00B4\u009A\u008A\u00B0\u00CA\u00AF\u00BC" + - "\u0090\u008F\u00EA\u00FA\u00BE\u00A0\u00B6\u00B3" + - "\u009D\u00DA\u009B\u008B\u00B7\u00B8\u00B9\u00AB" + - "\u0064\u0065\u0062\u0066\u0063\u0067\u009E\u0068" + - "\u0074\u0071\u0072\u0073\u0078\u0075\u0076\u0077" + - "\u00AC\u0069\u00ED\u00EE\u00EB\u00EF\u00EC\u00BF" + - "\u0080\u00FD\u00FE\u00FB\u00FC\u00BA\u00AE\u0059" + - "\u0044\u0045\u0042\u0046\u0043\u0047\u009C\u0048" + - "\u0054\u0051\u0052\u0053\u0058\u0055\u0056\u0057" + - "\u008C\u0049\u00CD\u00CE\u00CB\u00CF\u00CC\u00E1" + - "\u0070\u00DD\u00DE\u00DB\u00DC\u008D\u008E\u00DF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM1097.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM1097.java deleted file mode 100644 index 7a04f1e171e..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM1097.java +++ /dev/null @@ -1,342 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM1097 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM1097() { - super("x-IBM1097", ExtendedCharsets.aliasesFor("x-IBM1097")); - } - - public String historicalName() { - return "Cp1097"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM1097); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\uFB8A\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87 - "\u0068\u0069\u00AB\u00BB\uFEB1\uFEB3\uFEB5\uFEB7" + // 0x88 - 0x8F - "\uFEB9\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97 - "\u0071\u0072\uFEBB\uFEBD\uFEBF\uFEC1\uFEC3\uFEC5" + // 0x98 - 0x9F - "\uFEC7\u007E\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xA0 - 0xA7 - "\u0079\u007A\uFEC9\uFECA\uFECB\uFECC\uFECD\uFECE" + // 0xA8 - 0xAF - "\uFECF\uFED0\uFED1\uFED3\uFED5\uFED7\uFB8E\uFEDB" + // 0xB0 - 0xB7 - "\uFB92\uFB94\u005B\u005D\uFEDD\uFEDF\uFEE1\u00D7" + // 0xB8 - 0xBF - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xC0 - 0xC7 - "\u0048\u0049\u00AD\uFEE3\uFEE5\uFEE7\uFEED\uFEE9" + // 0xC8 - 0xCF - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xD0 - 0xD7 - "\u0051\u0052\uFEEB\uFEEC\uFBA4\uFBFC\uFBFD\uFBFE" + // 0xD8 - 0xDF - "\\\u061F\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xE0 - 0xE7 - "\u0059\u005A\u0640\u06F0\u06F1\u06F2\u06F3\u06F4" + // 0xE8 - 0xEF - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xF0 - 0xF7 - "\u0038\u0039\u06F5\u06F6\u06F7\u06F8\u06F9\u009F" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07 - "\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u009D\u0085\b\u0087" + // 0x10 - 0x17 - "\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27 - "\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2F - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37 - "\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3F - "\u0020\u00A0\u060C\u064B\uFE81\uFE82\uF8FA\uFE8D" + // 0x40 - 0x47 - "\uFE8E\uF8FB\u00A4\u002E\u003C\u0028\u002B\u007C" + // 0x48 - 0x4F - "\u0026\uFE80\uFE83\uFE84\uF8F9\uFE85\uFE8B\uFE8F" + // 0x50 - 0x57 - "\uFE91\uFB56\u0021\u0024\u002A\u0029\u003B\u00AC" + // 0x58 - 0x5F - "\u002D\u002F\uFB58\uFE95\uFE97\uFE99\uFE9B\uFE9D" + // 0x60 - 0x67 - "\uFE9F\uFB7A\u061B\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6F - "\uFB7C\uFEA1\uFEA3\uFEA5\uFEA7\uFEA9\uFEAB\uFEAD" + // 0x70 - 0x77 - "\uFEAF\u0060\u003A\u0023\u0040\'\u003D\""; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0037\u002D\u002E\u002F" + - "\u0016\u0005\u0025\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u003C\u003D\u0032\u0026" + - "\u0018\u0019\u003F\'\u001C\u001D\u001E\u001F" + - "\u0040\u005A\u007F\u007B\u005B\u006C\u0050\u007D" + - "\u004D\u005D\\\u004E\u006B\u0060\u004B\u0061" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u007A\u005E\u004C\u007E\u006E\u006F" + - "\u007C\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6" + - "\u00D7\u00D8\u00D9\u00E2\u00E3\u00E4\u00E5\u00E6" + - "\u00E7\u00E8\u00E9\u00BA\u00E0\u00BB\u0000\u006D" + - "\u0079\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u0091\u0092\u0093\u0094\u0095\u0096" + - "\u0097\u0098\u0099\u00A2\u00A3\u00A4\u00A5\u00A6" + - "\u00A7\u00A8\u00A9\u00C0\u004F\u00D0\u00A1\u0007" + - "\u0020\u0021\"\u0023\u0024\u0015\u0006\u0017" + - "\u0028\u0029\u002A\u002B\u002C\t\n\u001B" + - "\u0030\u0031\u001A\u0033\u0034\u0035\u0036\b" + - "\u0038\u0039\u003A\u003B\u0004\u0014\u003E\u00FF" + - "\u0041\u0000\u0000\u0000\u004A\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u008A\u005F\u00CA\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u008B\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00BF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0042\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u006A" + - "\u0000\u0000\u0000\u00E1\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00EA\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0043" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00EB\u00EC\u00ED\u00EE" + - "\u00EF\u00FA\u00FB\u00FC\u00FD\u00FE\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0054" + - "\u0046\u0049\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0059\u0000\u0062\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0069\u0000\u0070\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0080\u0000\u0000\u0000" + - "\u00B6\u0000\u0000\u0000\u00B8\u0000\u00B9\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00DC\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00DD\u00DE" + - "\u00DF\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0051\u0044\u0045\u0052\u0053\u0055\u0000" + - "\u0000\u0000\u0000\u0000\u0056\u0000\u0047\u0048" + - "\u0057\u0000\u0058\u0000\u0000\u0000\u0063\u0000" + - "\u0064\u0000\u0065\u0000\u0066\u0000\u0067\u0000" + - "\u0068\u0000\u0071\u0000\u0072\u0000\u0073\u0000" + - "\u0074\u0000\u0075\u0000\u0076\u0000\u0077\u0000" + - "\u0078\u0000\u008C\u0000\u008D\u0000\u008E\u0000" + - "\u008F\u0000\u0090\u0000\u009A\u0000\u009B\u0000" + - "\u009C\u0000\u009D\u0000\u009E\u0000\u009F\u0000" + - "\u00A0\u0000\u00AA\u00AB\u00AC\u00AD\u00AE\u00AF" + - "\u00B0\u00B1\u00B2\u0000\u00B3\u0000\u00B4\u0000" + - "\u00B5\u0000\u0000\u0000\u00B7\u0000\u00BC\u0000" + - "\u00BD\u0000\u00BE\u0000\u00CB\u0000\u00CC\u0000" + - "\u00CD\u0000\u00CF\u0000\u00DA\u00DB\u00CE\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000"; - - private final static short index1[] = { - 0, 216, 216, 216, 216, 216, 460, 216, 216, 216, 216, 216, 216, 216, 216, 216, - 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, - 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, - 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, - 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, - 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, - 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, - 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, - 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, - 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, - 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, - 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, - 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, - 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, - 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, - 216, 216, 216, 216, 216, 216, 216, 216, 710, 216, 216, 962, 216, 216, 1217, 216, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM1098.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM1098.java deleted file mode 100644 index e689023c146..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM1098.java +++ /dev/null @@ -1,362 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM1098 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM1098() { - super("x-IBM1098", ExtendedCharsets.aliasesFor("x-IBM1098")); - } - - public String historicalName() { - return "Cp1098"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM1098); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\uFFFD\uFFFD\u060C\u061B\u061F\u064B\uFE81\uFE82" + // 0x80 - 0x87 - "\uF8FA\uFE8D\uFE8E\uF8FB\uFE80\uFE83\uFE84\uF8F9" + // 0x88 - 0x8F - "\uFE85\uFE8B\uFE8F\uFE91\uFB56\uFB58\uFE95\uFE97" + // 0x90 - 0x97 - "\uFE99\uFE9B\uFE9D\uFE9F\uFB7A\uFB7C\u00D7\uFEA1" + // 0x98 - 0x9F - "\uFEA3\uFEA5\uFEA7\uFEA9\uFEAB\uFEAD\uFEAF\uFB8A" + // 0xA0 - 0xA7 - "\uFEB1\uFEB3\uFEB5\uFEB7\uFEB9\uFEBB\u00AB\u00BB" + // 0xA8 - 0xAF - "\u2591\u2592\u2593\u2502\u2524\uFEBD\uFEBF\uFEC1" + // 0xB0 - 0xB7 - "\uFEC3\u2563\u2551\u2557\u255D\u00A4\uFEC5\u2510" + // 0xB8 - 0xBF - "\u2514\u2534\u252C\u251C\u2500\u253C\uFEC7\uFEC9" + // 0xC0 - 0xC7 - "\u255A\u2554\u2569\u2566\u2560\u2550\u256C\uFFFD" + // 0xC8 - 0xCF - "\uFECA\uFECB\uFECC\uFECD\uFECE\uFECF\uFED0\uFED1" + // 0xD0 - 0xD7 - "\uFED3\u2518\u250C\u2588\u2584\uFED5\uFED7\u2580" + // 0xD8 - 0xDF - "\uFB8E\uFEDB\uFB92\uFB94\uFEDD\uFEDF\uFEE1\uFEE3" + // 0xE0 - 0xE7 - "\uFEE5\uFEE7\uFEED\uFEE9\uFEEB\uFEEC\uFBA4\uFBFC" + // 0xE8 - 0xEF - "\u00AD\uFBFD\uFBFE\u0640\u06F0\u06F1\u06F2\u06F3" + // 0xF0 - 0xF7 - "\u06F4\u06F5\u06F6\u06F7\u06F8\u06F9\u25A0\u00A0" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00FF\u0000\u0000\u0000\u00BD\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00AE\u0000\u00F0\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00AF\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u009E" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0082\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0083" + - "\u0000\u0000\u0000\u0084\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00F3\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0085" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u00FA\u00FB\u00FC\u00FD\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00C4\u0000\u00B3\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00DA\u0000\u0000\u0000\u00BF\u0000\u0000\u0000" + - "\u00C0\u0000\u0000\u0000\u00D9\u0000\u0000\u0000" + - "\u00C3\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00B4\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00C2\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00C1\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00C5\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00CD\u00BA\u0000\u0000" + - "\u00C9\u0000\u0000\u00BB\u0000\u0000\u00C8\u0000" + - "\u0000\u00BC\u0000\u0000\u00CC\u0000\u0000\u00B9" + - "\u0000\u0000\u00CB\u0000\u0000\u00CA\u0000\u0000" + - "\u00CE\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00DF\u0000\u0000\u0000" + - "\u00DC\u0000\u0000\u0000\u00DB\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00B0\u00B1\u00B2" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00FE\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u008F\u0088" + - "\u008B\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0094" + - "\u0000\u0095\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u009C\u0000\u009D\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00A7\u0000\u0000\u0000\u00E0" + - "\u0000\u0000\u0000\u00E2\u0000\u00E3\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00EE\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00EF\u00F1\u00F2" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u008C\u0086\u0087\u008D\u008E\u0090\u0000\u0000" + - "\u0000\u0000\u0000\u0091\u0000\u0089\u008A\u0092" + - "\u0000\u0093\u0000\u0000\u0000\u0096\u0000\u0097" + - "\u0000\u0098\u0000\u0099\u0000\u009A\u0000\u009B" + - "\u0000\u009F\u0000\u00A0\u0000\u00A1\u0000\u00A2" + - "\u0000\u00A3\u0000\u00A4\u0000\u00A5\u0000\u00A6" + - "\u0000\u00A8\u0000\u00A9\u0000\u00AA\u0000\u00AB" + - "\u0000\u00AC\u0000\u00AD\u0000\u00B5\u0000\u00B6" + - "\u0000\u00B7\u0000\u00B8\u0000\u00BE\u0000\u00C6" + - "\u0000\u00C7\u00D0\u00D1\u00D2\u00D3\u00D4\u00D5" + - "\u00D6\u00D7\u0000\u00D8\u0000\u00DD\u0000\u00DE" + - "\u0000\u0000\u0000\u00E1\u0000\u00E4\u0000\u00E5" + - "\u0000\u00E6\u0000\u00E7\u0000\u00E8\u0000\u00E9" + - "\u0000\u00EB\u0000\u00EC\u00ED\u00EA\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 216, 216, 216, 216, 216, 460, 216, 216, 216, 216, 216, 216, 216, 216, 216, - 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, - 216, 216, 216, 216, 216, 716, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, - 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, - 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, - 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, - 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, - 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, - 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, - 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, - 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, - 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, - 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, - 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, - 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, 216, - 216, 216, 216, 216, 216, 216, 216, 216, 877, 216, 216, 1129, 216, 216, 1384, 216, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM1112.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM1112.java deleted file mode 100644 index 478f3fadb22..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM1112.java +++ /dev/null @@ -1,266 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM1112 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM1112() { - super("x-IBM1112", ExtendedCharsets.aliasesFor("x-IBM1112")); - } - - public String historicalName() { - return "Cp1112"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM1112); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87 - "\u0068\u0069\u00AB\u00BB\u0101\u017C\u0144\u00B1" + // 0x88 - 0x8F - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97 - "\u0071\u0072\u0156\u0157\u00E6\u0137\u00C6\u00A4" + // 0x98 - 0x9F - "\u00B5\u007E\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xA0 - 0xA7 - "\u0079\u007A\u201D\u017A\u0100\u017B\u0143\u00AE" + // 0xA8 - 0xAF - "\u005E\u00A3\u012B\u00B7\u00A9\u00A7\u00B6\u00BC" + // 0xB0 - 0xB7 - "\u00BD\u00BE\u005B\u005D\u0179\u0136\u013C\u00D7" + // 0xB8 - 0xBF - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xC0 - 0xC7 - "\u0048\u0049\u00AD\u014D\u00F6\u0146\u00F3\u00F5" + // 0xC8 - 0xCF - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xD0 - 0xD7 - "\u0051\u0052\u00B9\u0107\u00FC\u0142\u015B\u2019" + // 0xD8 - 0xDF - "\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xE0 - 0xE7 - "\u0059\u005A\u00B2\u014C\u00D6\u0145\u00D3\u00D5" + // 0xE8 - 0xEF - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xF0 - 0xF7 - "\u0038\u0039\u00B3\u0106\u00DC\u0141\u015A\u009F" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07 - "\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17 - "\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27 - "\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2F - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37 - "\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3F - "\u0020\u00A0\u0161\u00E4\u0105\u012F\u016B\u00E5" + // 0x40 - 0x47 - "\u0113\u017E\u00A2\u002E\u003C\u0028\u002B\u007C" + // 0x48 - 0x4F - "\u0026\u00E9\u0119\u0117\u010D\u0173\u201E\u201C" + // 0x50 - 0x57 - "\u0123\u00DF\u0021\u0024\u002A\u0029\u003B\u00AC" + // 0x58 - 0x5F - "\u002D\u002F\u0160\u00C4\u0104\u012E\u016A\u00C5" + // 0x60 - 0x67 - "\u0112\u017D\u00A6\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6F - "\u00F8\u00C9\u0118\u0116\u010C\u0172\u012A\u013B" + // 0x70 - 0x77 - "\u0122\u0060\u003A\u0023\u0040\'\u003D\""; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0037\u002D\u002E\u002F" + - "\u0016\u0005\u0015\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u003C\u003D\u0032\u0026" + - "\u0018\u0019\u003F\'\u001C\u001D\u001E\u001F" + - "\u0040\u005A\u007F\u007B\u005B\u006C\u0050\u007D" + - "\u004D\u005D\\\u004E\u006B\u0060\u004B\u0061" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u007A\u005E\u004C\u007E\u006E\u006F" + - "\u007C\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6" + - "\u00D7\u00D8\u00D9\u00E2\u00E3\u00E4\u00E5\u00E6" + - "\u00E7\u00E8\u00E9\u00BA\u00E0\u00BB\u00B0\u006D" + - "\u0079\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u0091\u0092\u0093\u0094\u0095\u0096" + - "\u0097\u0098\u0099\u00A2\u00A3\u00A4\u00A5\u00A6" + - "\u00A7\u00A8\u00A9\u00C0\u004F\u00D0\u00A1\u0007" + - "\u0020\u0021\"\u0023\u0024\u0015\u0006\u0017" + - "\u0028\u0029\u002A\u002B\u002C\t\n\u001B" + - "\u0030\u0031\u001A\u0033\u0034\u0035\u0036\b" + - "\u0038\u0039\u003A\u003B\u0004\u0014\u003E\u00FF" + - "\u0041\u0000\u004A\u00B1\u009F\u0000\u006A\u00B5" + - "\u0000\u00B4\u0000\u008A\u005F\u00CA\u00AF\u0000" + - "\u0090\u008F\u00EA\u00FA\u0000\u00A0\u00B6\u00B3" + - "\u0000\u00DA\u0000\u008B\u00B7\u00B8\u00B9\u0000" + - "\u0000\u0000\u0000\u0000\u0063\u0067\u009E\u0000" + - "\u0000\u0071\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00EE\u0000\u00EF\u00EC\u00BF" + - "\u0080\u0000\u0000\u0000\u00FC\u0000\u0000\u0059" + - "\u0000\u0000\u0000\u0000\u0043\u0047\u009C\u0000" + - "\u0000\u0051\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00CE\u0000\u00CF\u00CC\u00E1" + - "\u0070\u0000\u0000\u0000\u00DC\u0000\u0000\u0000" + - "\u00AC\u008C\u0000\u0000\u0064\u0044\u00FB\u00DB" + - "\u0000\u0000\u0000\u0000\u0074\u0054\u0000\u0000" + - "\u0000\u0000\u0068\u0048\u0000\u0000\u0073\u0053" + - "\u0072\u0052\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0078\u0058\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0076\u00B2\u0000\u0000\u0065\u0045" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00BD\u009D" + - "\u0000\u0000\u0000\u0077\u00BE\u0000\u0000\u0000" + - "\u0000\u00FD\u00DD\u00AE\u008E\u00ED\u00CD\u0000" + - "\u0000\u0000\u0000\u0000\u00EB\u00CB\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u009A\u009B" + - "\u0000\u0000\u00FE\u00DE\u0000\u0000\u0000\u0000" + - "\u0062\u0042\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0066\u0046\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0075\u0055\u0000\u0000\u0000\u0000" + - "\u0000\u00BC\u00AB\u00AD\u008D\u0069\u0049\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00DF" + - "\u0000\u0000\u0057\u00AA\u0056\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 614, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM1122.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM1122.java deleted file mode 100644 index ff9205b545b..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM1122.java +++ /dev/null @@ -1,262 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM1122 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM1122() { - super("x-IBM1122", ExtendedCharsets.aliasesFor("x-IBM1122")); - } - - public String historicalName() { - return "Cp1122"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM1122); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87 - "\u0068\u0069\u00AB\u00BB\u0161\u00FD\u017E\u00B1" + // 0x88 - 0x8F - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97 - "\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u005D" + // 0x98 - 0x9F - "\u00B5\u00FC\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xA0 - 0xA7 - "\u0079\u007A\u00A1\u00BF\u0160\u00DD\u017D\u00AE" + // 0xA8 - 0xAF - "\u00A2\u00A3\u00A5\u00B7\u00A9\u005B\u00B6\u00BC" + // 0xB0 - 0xB7 - "\u00BD\u00BE\u00AC\u007C\u203E\u00A8\u00B4\u00D7" + // 0xB8 - 0xBF - "\u00E4\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xC0 - 0xC7 - "\u0048\u0049\u00AD\u00F4\u00A6\u00F2\u00F3\u00F5" + // 0xC8 - 0xCF - "\u00E5\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xD0 - 0xD7 - "\u0051\u0052\u00B9\u00FB\u007E\u00F9\u00FA\u00FF" + // 0xD8 - 0xDF - "\u00C9\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xE0 - 0xE7 - "\u0059\u005A\u00B2\u00D4\u0040\u00D2\u00D3\u00D5" + // 0xE8 - 0xEF - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xF0 - 0xF7 - "\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07 - "\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17 - "\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27 - "\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2F - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37 - "\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3F - "\u0020\u00A0\u00E2\u007B\u00E0\u00E1\u00E3\u007D" + // 0x40 - 0x47 - "\u00E7\u00F1\u00A7\u002E\u003C\u0028\u002B\u0021" + // 0x48 - 0x4F - "\u0026\u0060\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF" + // 0x50 - 0x57 - "\u00EC\u00DF\u00A4\u00C5\u002A\u0029\u003B\u005E" + // 0x58 - 0x5F - "\u002D\u002F\u00C2\u0023\u00C0\u00C1\u00C3\u0024" + // 0x60 - 0x67 - "\u00C7\u00D1\u00F6\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6F - "\u00F8\\\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF" + // 0x70 - 0x77 - "\u00CC\u00E9\u003A\u00C4\u00D6\'\u003D\""; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0037\u002D\u002E\u002F" + - "\u0016\u0005\u0015\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u003C\u003D\u0032\u0026" + - "\u0018\u0019\u003F\'\u001C\u001D\u001E\u001F" + - "\u0040\u004F\u007F\u0063\u0067\u006C\u0050\u007D" + - "\u004D\u005D\\\u004E\u006B\u0060\u004B\u0061" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u007A\u005E\u004C\u007E\u006E\u006F" + - "\u00EC\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6" + - "\u00D7\u00D8\u00D9\u00E2\u00E3\u00E4\u00E5\u00E6" + - "\u00E7\u00E8\u00E9\u00B5\u0071\u009F\u005F\u006D" + - "\u0051\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u0091\u0092\u0093\u0094\u0095\u0096" + - "\u0097\u0098\u0099\u00A2\u00A3\u00A4\u00A5\u00A6" + - "\u00A7\u00A8\u00A9\u0043\u00BB\u0047\u00DC\u0007" + - "\u0020\u0021\"\u0023\u0024\u0015\u0006\u0017" + - "\u0028\u0029\u002A\u002B\u002C\t\n\u001B" + - "\u0030\u0031\u001A\u0033\u0034\u0035\u0036\b" + - "\u0038\u0039\u003A\u003B\u0004\u0014\u003E\u00FF" + - "\u0041\u00AA\u00B0\u00B1\u005A\u00B2\u00CC\u004A" + - "\u00BD\u00B4\u009A\u008A\u00BA\u00CA\u00AF\u0000" + - "\u0090\u008F\u00EA\u00FA\u00BE\u00A0\u00B6\u00B3" + - "\u009D\u00DA\u009B\u008B\u00B7\u00B8\u00B9\u00AB" + - "\u0064\u0065\u0062\u0066\u007B\u005B\u009E\u0068" + - "\u0074\u00E0\u0072\u0073\u0078\u0075\u0076\u0077" + - "\u0000\u0069\u00ED\u00EE\u00EB\u00EF\u007C\u00BF" + - "\u0080\u00FD\u00FE\u00FB\u00FC\u00AD\u0000\u0059" + - "\u0044\u0045\u0042\u0046\u00C0\u00D0\u009C\u0048" + - "\u0054\u0079\u0052\u0053\u0058\u0055\u0056\u0057" + - "\u0000\u0049\u00CD\u00CE\u00CB\u00CF\u006A\u00E1" + - "\u0070\u00DD\u00DE\u00DB\u00A1\u008D\u0000\u00DF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00AC\u008C\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00AE\u008E\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00BC" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000"; - - private final static short index1[] = { - 0, 256, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 577, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM1123.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM1123.java deleted file mode 100644 index 595277d5c54..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM1123.java +++ /dev/null @@ -1,272 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM1123 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM1123() { - super("x-IBM1123", ExtendedCharsets.aliasesFor("x-IBM1123")); - } - - public String historicalName() { - return "Cp1123"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM1123); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u0446\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87 - "\u0068\u0069\u0434\u0435\u0444\u0433\u0445\u0438" + // 0x88 - 0x8F - "\u0439\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97 - "\u0071\u0072\u043A\u043B\u043C\u043D\u043E\u043F" + // 0x98 - 0x9F - "\u044F\u007E\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xA0 - 0xA7 - "\u0079\u007A\u0440\u0441\u0442\u0443\u0436\u0432" + // 0xA8 - 0xAF - "\u044C\u044B\u0437\u0448\u044D\u0449\u0447\u044A" + // 0xB0 - 0xB7 - "\u042E\u0410\u0411\u0426\u0414\u0415\u0424\u0413" + // 0xB8 - 0xBF - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xC0 - 0xC7 - "\u0048\u0049\u0425\u0418\u0419\u041A\u041B\u041C" + // 0xC8 - 0xCF - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xD0 - 0xD7 - "\u0051\u0052\u041D\u041E\u041F\u042F\u0420\u0421" + // 0xD8 - 0xDF - "\\\u00A7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xE0 - 0xE7 - "\u0059\u005A\u0422\u0423\u0416\u0412\u042C\u042B" + // 0xE8 - 0xEF - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xF0 - 0xF7 - "\u0038\u0039\u0417\u0428\u042D\u0429\u0427\u009F" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07 - "\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17 - "\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27 - "\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2F - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37 - "\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3F - "\u0020\u00A0\u0452\u0491\u0451\u0454\u0455\u0456" + // 0x40 - 0x47 - "\u0457\u0458\u005B\u002E\u003C\u0028\u002B\u0021" + // 0x48 - 0x4F - "\u0026\u0459\u045A\u045B\u045C\u045E\u045F\u042A" + // 0x50 - 0x57 - "\u2116\u0402\u005D\u0024\u002A\u0029\u003B\u005E" + // 0x58 - 0x5F - "\u002D\u002F\u0490\u0401\u0404\u0405\u0406\u0407" + // 0x60 - 0x67 - "\u0408\u0409\u007C\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6F - "\u040A\u040B\u040C\u00AD\u040E\u040F\u044E\u0430" + // 0x70 - 0x77 - "\u0431\u0060\u003A\u0023\u0040\'\u003D\""; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0037\u002D\u002E\u002F" + - "\u0016\u0005\u0015\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u003C\u003D\u0032\u0026" + - "\u0018\u0019\u003F\'\u001C\u001D\u001E\u001F" + - "\u0040\u004F\u007F\u007B\u005B\u006C\u0050\u007D" + - "\u004D\u005D\\\u004E\u006B\u0060\u004B\u0061" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u007A\u005E\u004C\u007E\u006E\u006F" + - "\u007C\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6" + - "\u00D7\u00D8\u00D9\u00E2\u00E3\u00E4\u00E5\u00E6" + - "\u00E7\u00E8\u00E9\u004A\u00E0\u005A\u005F\u006D" + - "\u0079\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u0091\u0092\u0093\u0094\u0095\u0096" + - "\u0097\u0098\u0099\u00A2\u00A3\u00A4\u00A5\u00A6" + - "\u00A7\u00A8\u00A9\u00C0\u006A\u00D0\u00A1\u0007" + - "\u0020\u0021\"\u0023\u0024\u0015\u0006\u0017" + - "\u0028\u0029\u002A\u002B\u002C\t\n\u001B" + - "\u0030\u0031\u001A\u0033\u0034\u0035\u0036\b" + - "\u0038\u0039\u003A\u003B\u0004\u0014\u003E\u00FF" + - "\u0041\u0000\u0000\u0000\u0000\u0000\u0000\u00E1" + - "\u0000\u0000\u0000\u0000\u0000\u0073\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0063\u0059" + - "\u0000\u0064\u0065\u0066\u0067\u0068\u0069\u0070" + - "\u0071\u0072\u0000\u0074\u0075\u00B9\u00BA\u00ED" + - "\u00BF\u00BC\u00BD\u00EC\u00FA\u00CB\u00CC\u00CD" + - "\u00CE\u00CF\u00DA\u00DB\u00DC\u00DE\u00DF\u00EA" + - "\u00EB\u00BE\u00CA\u00BB\u00FE\u00FB\u00FD\u0057" + - "\u00EF\u00EE\u00FC\u00B8\u00DD\u0077\u0078\u00AF" + - "\u008D\u008A\u008B\u00AE\u00B2\u008F\u0090\u009A" + - "\u009B\u009C\u009D\u009E\u009F\u00AA\u00AB\u00AC" + - "\u00AD\u008C\u008E\u0080\u00B6\u00B3\u00B5\u00B7" + - "\u00B1\u00B0\u00B4\u0076\u00A0\u0000\u0044\u0042" + - "\u0000\u0045\u0046\u0047\u0048\u0049\u0051\u0052" + - "\u0053\u0054\u0000\u0055\u0056\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0062\u0043\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0058\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 174, 174, 174, 429, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 663, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM1124.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM1124.java deleted file mode 100644 index 8f7a112f5b5..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM1124.java +++ /dev/null @@ -1,272 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM1124 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM1124() { - super("x-IBM1124", ExtendedCharsets.aliasesFor("x-IBM1124")); - } - - public String historicalName() { - return "Cp1124"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM1124); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + // 0x80 - 0x87 - "\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + // 0x88 - 0x8F - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097" + // 0x90 - 0x97 - "\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + // 0x98 - 0x9F - "\u00A0\u0401\u0402\u0490\u0404\u0405\u0406\u0407" + // 0xA0 - 0xA7 - "\u0408\u0409\u040A\u040B\u040C\u00AD\u040E\u040F" + // 0xA8 - 0xAF - "\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417" + // 0xB0 - 0xB7 - "\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F" + // 0xB8 - 0xBF - "\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427" + // 0xC0 - 0xC7 - "\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F" + // 0xC8 - 0xCF - "\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437" + // 0xD0 - 0xD7 - "\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F" + // 0xD8 - 0xDF - "\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447" + // 0xE0 - 0xE7 - "\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F" + // 0xE8 - 0xEF - "\u2116\u0451\u0452\u0491\u0454\u0455\u0456\u0457" + // 0xF0 - 0xF7 - "\u0458\u0459\u045A\u045B\u045C\u00A7\u045E\u045F" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097" + - "\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + - "\u00A0\u0000\u0000\u0000\u0000\u0000\u0000\u00FD" + - "\u0000\u0000\u0000\u0000\u0000\u00AD\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00A1\u00A2" + - "\u0000\u00A4\u00A5\u00A6\u00A7\u00A8\u00A9\u00AA" + - "\u00AB\u00AC\u0000\u00AE\u00AF\u00B0\u00B1\u00B2" + - "\u00B3\u00B4\u00B5\u00B6\u00B7\u00B8\u00B9\u00BA" + - "\u00BB\u00BC\u00BD\u00BE\u00BF\u00C0\u00C1\u00C2" + - "\u00C3\u00C4\u00C5\u00C6\u00C7\u00C8\u00C9\u00CA" + - "\u00CB\u00CC\u00CD\u00CE\u00CF\u00D0\u00D1\u00D2" + - "\u00D3\u00D4\u00D5\u00D6\u00D7\u00D8\u00D9\u00DA" + - "\u00DB\u00DC\u00DD\u00DE\u00DF\u00E0\u00E1\u00E2" + - "\u00E3\u00E4\u00E5\u00E6\u00E7\u00E8\u00E9\u00EA" + - "\u00EB\u00EC\u00ED\u00EE\u00EF\u0000\u00F1\u00F2" + - "\u0000\u00F4\u00F5\u00F6\u00F7\u00F8\u00F9\u00FA" + - "\u00FB\u00FC\u0000\u00FE\u00FF\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00A3\u00F3\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00F0\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 174, 174, 174, 429, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 663, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM1140.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM1140.java deleted file mode 100644 index 45509dafbe1..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM1140.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM1140 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM1140() { - super("IBM01140", ExtendedCharsets.aliasesFor("IBM01140")); - } - - public String historicalName() { - return "Cp1140"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM1140); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public short[] getEncoderIndex1() { - return Encoder.index1; - } - - public String getEncoderIndex2() { - return Encoder.index2; - } - - private static class Decoder extends IBM037.Decoder { - public Decoder(Charset cs) { - super(cs); - } - - public char decode(int byteIndex) { - return (byteIndex == (byte)0x9F) ? '\u20AC' : super.decode(byteIndex); - } - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - "\u0000\u0001\u0002\u0003\u0037\u002D\u002E\u002F" + - "\u0016\u0005\u0025\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u003C\u003D\u0032\u0026" + - "\u0018\u0019\u003F\'\u001C\u001D\u001E\u001F" + - "\u0040\u005A\u007F\u007B\u005B\u006C\u0050\u007D" + - "\u004D\u005D\\\u004E\u006B\u0060\u004B\u0061" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u007A\u005E\u004C\u007E\u006E\u006F" + - "\u007C\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6" + - "\u00D7\u00D8\u00D9\u00E2\u00E3\u00E4\u00E5\u00E6" + - "\u00E7\u00E8\u00E9\u00BA\u00E0\u00BB\u00B0\u006D" + - "\u0079\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u0091\u0092\u0093\u0094\u0095\u0096" + - "\u0097\u0098\u0099\u00A2\u00A3\u00A4\u00A5\u00A6" + - "\u00A7\u00A8\u00A9\u00C0\u004F\u00D0\u00A1\u0007" + - "\u0020\u0021\"\u0023\u0024\u0015\u0006\u0017" + - "\u0028\u0029\u002A\u002B\u002C\t\n\u001B" + - "\u0030\u0031\u001A\u0033\u0034\u0035\u0036\b" + - "\u0038\u0039\u003A\u003B\u0004\u0014\u003E\u00FF" + - "\u0041\u00AA\u004A\u00B1\u0000\u00B2\u006A\u00B5" + - "\u00BD\u00B4\u009A\u008A\u005F\u00CA\u00AF\u00BC" + - "\u0090\u008F\u00EA\u00FA\u00BE\u00A0\u00B6\u00B3" + - "\u009D\u00DA\u009B\u008B\u00B7\u00B8\u00B9\u00AB" + - "\u0064\u0065\u0062\u0066\u0063\u0067\u009E\u0068" + - "\u0074\u0071\u0072\u0073\u0078\u0075\u0076\u0077" + - "\u00AC\u0069\u00ED\u00EE\u00EB\u00EF\u00EC\u00BF" + - "\u0080\u00FD\u00FE\u00FB\u00FC\u00AD\u00AE\u0059" + - "\u0044\u0045\u0042\u0046\u0043\u0047\u009C\u0048" + - "\u0054\u0051\u0052\u0053\u0058\u0055\u0056\u0057" + - "\u008C\u0049\u00CD\u00CE\u00CB\u00CF\u00CC\u00E1" + - "\u0070\u00DD\u00DE\u00DB\u00DC\u008D\u008E\u00DF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u009F\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 340, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - }; - - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM1141.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM1141.java deleted file mode 100644 index 40050ed85d1..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM1141.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM1141 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM1141() { - super("IBM01141", ExtendedCharsets.aliasesFor("IBM01141")); - } - - public String historicalName() { - return "Cp1141"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM1141); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public short[] getEncoderIndex1() { - return Encoder.index1; - } - - public String getEncoderIndex2() { - return Encoder.index2; - } - private static class Decoder extends IBM273.Decoder { - public Decoder(Charset cs) { - super(cs); - } - - public char decode(int byteIndex) { - return (byteIndex == (byte)0x9F) ? '\u20AC' : super.decode(byteIndex); - } - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - "\u0000\u0001\u0002\u0003\u0037\u002D\u002E\u002F" + - "\u0016\u0005\u0025\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u003C\u003D\u0032\u0026" + - "\u0018\u0019\u003F\'\u001C\u001D\u001E\u001F" + - "\u0040\u004F\u007F\u007B\u005B\u006C\u0050\u007D" + - "\u004D\u005D\\\u004E\u006B\u0060\u004B\u0061" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u007A\u005E\u004C\u007E\u006E\u006F" + - "\u00B5\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6" + - "\u00D7\u00D8\u00D9\u00E2\u00E3\u00E4\u00E5\u00E6" + - "\u00E7\u00E8\u00E9\u0063\u00EC\u00FC\u005F\u006D" + - "\u0079\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u0091\u0092\u0093\u0094\u0095\u0096" + - "\u0097\u0098\u0099\u00A2\u00A3\u00A4\u00A5\u00A6" + - "\u00A7\u00A8\u00A9\u0043\u00BB\u00DC\u0059\u0007" + - "\u0020\u0021\"\u0023\u0024\u0015\u0006\u0017" + - "\u0028\u0029\u002A\u002B\u002C\t\n\u001B" + - "\u0030\u0031\u001A\u0033\u0034\u0035\u0036\b" + - "\u0038\u0039\u003A\u003B\u0004\u0014\u003E\u00FF" + - "\u0041\u00AA\u00B0\u00B1\u0000\u00B2\u00CC\u007C" + - "\u00BD\u00B4\u009A\u008A\u00BA\u00CA\u00AF\u00BC" + - "\u0090\u008F\u00EA\u00FA\u00BE\u00A0\u00B6\u00B3" + - "\u009D\u00DA\u009B\u008B\u00B7\u00B8\u00B9\u00AB" + - "\u0064\u0065\u0062\u0066\u004A\u0067\u009E\u0068" + - "\u0074\u0071\u0072\u0073\u0078\u0075\u0076\u0077" + - "\u00AC\u0069\u00ED\u00EE\u00EB\u00EF\u00E0\u00BF" + - "\u0080\u00FD\u00FE\u00FB\u005A\u00AD\u00AE\u00A1" + - "\u0044\u0045\u0042\u0046\u00C0\u0047\u009C\u0048" + - "\u0054\u0051\u0052\u0053\u0058\u0055\u0056\u0057" + - "\u008C\u0049\u00CD\u00CE\u00CB\u00CF\u006A\u00E1" + - "\u0070\u00DD\u00DE\u00DB\u00D0\u008D\u008E\u00DF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u009F\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 340, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM1142.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM1142.java deleted file mode 100644 index e0682803948..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM1142.java +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM1142 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM1142() { - super("IBM01142", ExtendedCharsets.aliasesFor("IBM01142")); - } - - public String historicalName() { - return "Cp1142"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM1142); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public short[] getEncoderIndex1() { - return Encoder.index1; - } - - public String getEncoderIndex2() { - return Encoder.index2; - } - - private static class Decoder extends IBM277.Decoder { - public Decoder(Charset cs) { - super(cs); - } - - public char decode(int byteIndex) { - return (byteIndex == (byte)0x5A) ? '\u20AC' : super.decode(byteIndex); - } - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - "\u0000\u0001\u0002\u0003\u0037\u002D\u002E\u002F" + - "\u0016\u0005\u0025\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u003C\u003D\u0032\u0026" + - "\u0018\u0019\u003F\'\u001C\u001D\u001E\u001F" + - "\u0040\u004F\u007F\u004A\u0067\u006C\u0050\u007D" + - "\u004D\u005D\\\u004E\u006B\u0060\u004B\u0061" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u007A\u005E\u004C\u007E\u006E\u006F" + - "\u0080\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6" + - "\u00D7\u00D8\u00D9\u00E2\u00E3\u00E4\u00E5\u00E6" + - "\u00E7\u00E8\u00E9\u009E\u00E0\u009F\u005F\u006D" + - "\u0079\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u0091\u0092\u0093\u0094\u0095\u0096" + - "\u0097\u0098\u0099\u00A2\u00A3\u00A4\u00A5\u00A6" + - "\u00A7\u00A8\u00A9\u009C\u00BB\u0047\u00DC\u0007" + - "\u0020\u0021\"\u0023\u0024\u0015\u0006\u0017" + - "\u0028\u0029\u002A\u002B\u002C\t\n\u001B" + - "\u0030\u0031\u001A\u0033\u0034\u0035\u0036\b" + - "\u0038\u0039\u003A\u003B\u0004\u0014\u003E\u00FF" + - "\u0041\u00AA\u00B0\u00B1\u0000\u00B2\u0070\u00B5" + - "\u00BD\u00B4\u009A\u008A\u00BA\u00CA\u00AF\u00BC" + - "\u0090\u008F\u00EA\u00FA\u00BE\u00A0\u00B6\u00B3" + - "\u009D\u00DA\u009B\u008B\u00B7\u00B8\u00B9\u00AB" + - "\u0064\u0065\u0062\u0066\u0063\u005B\u007B\u0068" + - "\u0074\u0071\u0072\u0073\u0078\u0075\u0076\u0077" + - "\u00AC\u0069\u00ED\u00EE\u00EB\u00EF\u00EC\u00BF" + - "\u007C\u00FD\u00FE\u00FB\u00FC\u00AD\u00AE\u0059" + - "\u0044\u0045\u0042\u0046\u0043\u00D0\u00C0\u0048" + - "\u0054\u0051\u0052\u0053\u0058\u0055\u0056\u0057" + - "\u008C\u0049\u00CD\u00CE\u00CB\u00CF\u00CC\u00E1" + - "\u006A\u00DD\u00DE\u00DB\u00A1\u008D\u008E\u00DF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u005A\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 340, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM1143.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM1143.java deleted file mode 100644 index af02e542b7c..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM1143.java +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM1143 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM1143() { - super("IBM01143", ExtendedCharsets.aliasesFor("IBM01143")); - } - - public String historicalName() { - return "Cp1143"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM1143); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public short[] getEncoderIndex1() { - return Encoder.index1; - } - - public String getEncoderIndex2() { - return Encoder.index2; - } - - private static class Decoder extends IBM278.Decoder { - public Decoder(Charset cs) { - super(cs); - } - - public char decode(int byteIndex) { - return (byteIndex == (byte)0x5A) ? '\u20AC' : super.decode(byteIndex); - } - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - "\u0000\u0001\u0002\u0003\u0037\u002D\u002E\u002F" + - "\u0016\u0005\u0025\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u003C\u003D\u0032\u0026" + - "\u0018\u0019\u003F\'\u001C\u001D\u001E\u001F" + - "\u0040\u004F\u007F\u0063\u0067\u006C\u0050\u007D" + - "\u004D\u005D\\\u004E\u006B\u0060\u004B\u0061" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u007A\u005E\u004C\u007E\u006E\u006F" + - "\u00EC\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6" + - "\u00D7\u00D8\u00D9\u00E2\u00E3\u00E4\u00E5\u00E6" + - "\u00E7\u00E8\u00E9\u00B5\u0071\u009F\u005F\u006D" + - "\u0051\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u0091\u0092\u0093\u0094\u0095\u0096" + - "\u0097\u0098\u0099\u00A2\u00A3\u00A4\u00A5\u00A6" + - "\u00A7\u00A8\u00A9\u0043\u00BB\u0047\u00DC\u0007" + - "\u0020\u0021\"\u0023\u0024\u0015\u0006\u0017" + - "\u0028\u0029\u002A\u002B\u002C\t\n\u001B" + - "\u0030\u0031\u001A\u0033\u0034\u0035\u0036\b" + - "\u0038\u0039\u003A\u003B\u0004\u0014\u003E\u00FF" + - "\u0041\u00AA\u00B0\u00B1\u0000\u00B2\u00CC\u004A" + - "\u00BD\u00B4\u009A\u008A\u00BA\u00CA\u00AF\u00BC" + - "\u0090\u008F\u00EA\u00FA\u00BE\u00A0\u00B6\u00B3" + - "\u009D\u00DA\u009B\u008B\u00B7\u00B8\u00B9\u00AB" + - "\u0064\u0065\u0062\u0066\u007B\u005B\u009E\u0068" + - "\u0074\u00E0\u0072\u0073\u0078\u0075\u0076\u0077" + - "\u00AC\u0069\u00ED\u00EE\u00EB\u00EF\u007C\u00BF" + - "\u0080\u00FD\u00FE\u00FB\u00FC\u00AD\u00AE\u0059" + - "\u0044\u0045\u0042\u0046\u00C0\u00D0\u009C\u0048" + - "\u0054\u0079\u0052\u0053\u0058\u0055\u0056\u0057" + - "\u008C\u0049\u00CD\u00CE\u00CB\u00CF\u006A\u00E1" + - "\u0070\u00DD\u00DE\u00DB\u00A1\u008D\u008E\u00DF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u005A\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 340, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM1144.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM1144.java deleted file mode 100644 index d0cc741ed04..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM1144.java +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM1144 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM1144() { - super("IBM01144", ExtendedCharsets.aliasesFor("IBM01144")); - } - - public String historicalName() { - return "Cp1144"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM1144); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public short[] getEncoderIndex1() { - return Encoder.index1; - } - - public String getEncoderIndex2() { - return Encoder.index2; - } - - private static class Decoder extends IBM280.Decoder { - public Decoder(Charset cs) { - super(cs); - } - - public char decode(int byteIndex) { - return (byteIndex == (byte)0x9F) ? '\u20AC' : super.decode(byteIndex); - } - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - "\u0000\u0001\u0002\u0003\u0037\u002D\u002E\u002F" + - "\u0016\u0005\u0025\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u003C\u003D\u0032\u0026" + - "\u0018\u0019\u003F\'\u001C\u001D\u001E\u001F" + - "\u0040\u004F\u007F\u00B1\u005B\u006C\u0050\u007D" + - "\u004D\u005D\\\u004E\u006B\u0060\u004B\u0061" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u007A\u005E\u004C\u007E\u006E\u006F" + - "\u00B5\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6" + - "\u00D7\u00D8\u00D9\u00E2\u00E3\u00E4\u00E5\u00E6" + - "\u00E7\u00E8\u00E9\u0090\u0048\u0051\u005F\u006D" + - "\u00DD\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u0091\u0092\u0093\u0094\u0095\u0096" + - "\u0097\u0098\u0099\u00A2\u00A3\u00A4\u00A5\u00A6" + - "\u00A7\u00A8\u00A9\u0044\u00BB\u0054\u0058\u0007" + - "\u0020\u0021\"\u0023\u0024\u0015\u0006\u0017" + - "\u0028\u0029\u002A\u002B\u002C\t\n\u001B" + - "\u0030\u0031\u001A\u0033\u0034\u0035\u0036\b" + - "\u0038\u0039\u003A\u003B\u0004\u0014\u003E\u00FF" + - "\u0041\u00AA\u00B0\u007B\u0000\u00B2\u00CD\u007C" + - "\u00BD\u00B4\u009A\u008A\u00BA\u00CA\u00AF\u00BC" + - "\u004A\u008F\u00EA\u00FA\u00BE\u00A0\u00B6\u00B3" + - "\u009D\u00DA\u009B\u008B\u00B7\u00B8\u00B9\u00AB" + - "\u0064\u0065\u0062\u0066\u0063\u0067\u009E\u0068" + - "\u0074\u0071\u0072\u0073\u0078\u0075\u0076\u0077" + - "\u00AC\u0069\u00ED\u00EE\u00EB\u00EF\u00EC\u00BF" + - "\u0080\u00FD\u00FE\u00FB\u00FC\u00AD\u00AE\u0059" + - "\u00C0\u0045\u0042\u0046\u0043\u0047\u009C\u00E0" + - "\u00D0\u005A\u0052\u0053\u00A1\u0055\u0056\u0057" + - "\u008C\u0049\u006A\u00CE\u00CB\u00CF\u00CC\u00E1" + - "\u0070\u0079\u00DE\u00DB\u00DC\u008D\u008E\u00DF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u009F\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 340, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM1145.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM1145.java deleted file mode 100644 index dd89c0ea5ca..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM1145.java +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM1145 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM1145() { - super("IBM01145", ExtendedCharsets.aliasesFor("IBM01145")); - } - - public String historicalName() { - return "Cp1145"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM1145); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public short[] getEncoderIndex1() { - return Encoder.index1; - } - - public String getEncoderIndex2() { - return Encoder.index2; - } - - private static class Decoder extends IBM284.Decoder { - public Decoder(Charset cs) { - super(cs); - } - - public char decode(int byteIndex) { - return (byteIndex == (byte)0x9F) ? '\u20AC' : super.decode(byteIndex); - } - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - "\u0000\u0001\u0002\u0003\u0037\u002D\u002E\u002F" + - "\u0016\u0005\u0025\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u003C\u003D\u0032\u0026" + - "\u0018\u0019\u003F\'\u001C\u001D\u001E\u001F" + - "\u0040\u00BB\u007F\u0069\u005B\u006C\u0050\u007D" + - "\u004D\u005D\\\u004E\u006B\u0060\u004B\u0061" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u007A\u005E\u004C\u007E\u006E\u006F" + - "\u007C\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6" + - "\u00D7\u00D8\u00D9\u00E2\u00E3\u00E4\u00E5\u00E6" + - "\u00E7\u00E8\u00E9\u004A\u00E0\u005A\u00BA\u006D" + - "\u0079\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u0091\u0092\u0093\u0094\u0095\u0096" + - "\u0097\u0098\u0099\u00A2\u00A3\u00A4\u00A5\u00A6" + - "\u00A7\u00A8\u00A9\u00C0\u004F\u00D0\u00BD\u0007" + - "\u0020\u0021\"\u0023\u0024\u0015\u0006\u0017" + - "\u0028\u0029\u002A\u002B\u002C\t\n\u001B" + - "\u0030\u0031\u001A\u0033\u0034\u0035\u0036\b" + - "\u0038\u0039\u003A\u003B\u0004\u0014\u003E\u00FF" + - "\u0041\u00AA\u00B0\u00B1\u0000\u00B2\u0049\u00B5" + - "\u00A1\u00B4\u009A\u008A\u005F\u00CA\u00AF\u00BC" + - "\u0090\u008F\u00EA\u00FA\u00BE\u00A0\u00B6\u00B3" + - "\u009D\u00DA\u009B\u008B\u00B7\u00B8\u00B9\u00AB" + - "\u0064\u0065\u0062\u0066\u0063\u0067\u009E\u0068" + - "\u0074\u0071\u0072\u0073\u0078\u0075\u0076\u0077" + - "\u00AC\u007B\u00ED\u00EE\u00EB\u00EF\u00EC\u00BF" + - "\u0080\u00FD\u00FE\u00FB\u00FC\u00AD\u00AE\u0059" + - "\u0044\u0045\u0042\u0046\u0043\u0047\u009C\u0048" + - "\u0054\u0051\u0052\u0053\u0058\u0055\u0056\u0057" + - "\u008C\u006A\u00CD\u00CE\u00CB\u00CF\u00CC\u00E1" + - "\u0070\u00DD\u00DE\u00DB\u00DC\u008D\u008E\u00DF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u009F\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 340, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM1146.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM1146.java deleted file mode 100644 index 27919498364..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM1146.java +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM1146 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM1146() { - super("IBM01146", ExtendedCharsets.aliasesFor("IBM01146")); - } - - public String historicalName() { - return "Cp1146"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM1146); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public short[] getEncoderIndex1() { - return Encoder.index1; - } - - public String getEncoderIndex2() { - return Encoder.index2; - } - - private static class Decoder extends IBM285.Decoder { - public Decoder(Charset cs) { - super(cs); - } - - public char decode(int byteIndex) { - return (byteIndex == (byte)0x9F) ? '\u20AC' : super.decode(byteIndex); - } - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - "\u0000\u0001\u0002\u0003\u0037\u002D\u002E\u002F" + - "\u0016\u0005\u0025\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u003C\u003D\u0032\u0026" + - "\u0018\u0019\u003F\'\u001C\u001D\u001E\u001F" + - "\u0040\u005A\u007F\u007B\u004A\u006C\u0050\u007D" + - "\u004D\u005D\\\u004E\u006B\u0060\u004B\u0061" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u007A\u005E\u004C\u007E\u006E\u006F" + - "\u007C\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6" + - "\u00D7\u00D8\u00D9\u00E2\u00E3\u00E4\u00E5\u00E6" + - "\u00E7\u00E8\u00E9\u00B1\u00E0\u00BB\u00BA\u006D" + - "\u0079\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u0091\u0092\u0093\u0094\u0095\u0096" + - "\u0097\u0098\u0099\u00A2\u00A3\u00A4\u00A5\u00A6" + - "\u00A7\u00A8\u00A9\u00C0\u004F\u00D0\u00BC\u0007" + - "\u0020\u0021\"\u0023\u0024\u0015\u0006\u0017" + - "\u0028\u0029\u002A\u002B\u002C\t\n\u001B" + - "\u0030\u0031\u001A\u0033\u0034\u0035\u0036\b" + - "\u0038\u0039\u003A\u003B\u0004\u0014\u003E\u00FF" + - "\u0041\u00AA\u00B0\u005B\u0000\u00B2\u006A\u00B5" + - "\u00BD\u00B4\u009A\u008A\u005F\u00CA\u00AF\u00A1" + - "\u0090\u008F\u00EA\u00FA\u00BE\u00A0\u00B6\u00B3" + - "\u009D\u00DA\u009B\u008B\u00B7\u00B8\u00B9\u00AB" + - "\u0064\u0065\u0062\u0066\u0063\u0067\u009E\u0068" + - "\u0074\u0071\u0072\u0073\u0078\u0075\u0076\u0077" + - "\u00AC\u0069\u00ED\u00EE\u00EB\u00EF\u00EC\u00BF" + - "\u0080\u00FD\u00FE\u00FB\u00FC\u00AD\u00AE\u0059" + - "\u0044\u0045\u0042\u0046\u0043\u0047\u009C\u0048" + - "\u0054\u0051\u0052\u0053\u0058\u0055\u0056\u0057" + - "\u008C\u0049\u00CD\u00CE\u00CB\u00CF\u00CC\u00E1" + - "\u0070\u00DD\u00DE\u00DB\u00DC\u008D\u008E\u00DF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u009F\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 340, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM1147.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM1147.java deleted file mode 100644 index 9f79f842cc3..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM1147.java +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM1147 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM1147() { - super("IBM01147", ExtendedCharsets.aliasesFor("IBM01147")); - } - - public String historicalName() { - return "Cp1147"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM1147); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public short[] getEncoderIndex1() { - return Encoder.index1; - } - - public String getEncoderIndex2() { - return Encoder.index2; - } - - private static class Decoder extends IBM297.Decoder { - public Decoder(Charset cs) { - super(cs); - } - - public char decode(int byteIndex) { - return (byteIndex == (byte)0x9F) ? '\u20AC' : super.decode(byteIndex); - } - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - "\u0000\u0001\u0002\u0003\u0037\u002D\u002E\u002F" + - "\u0016\u0005\u0025\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u003C\u003D\u0032\u0026" + - "\u0018\u0019\u003F\'\u001C\u001D\u001E\u001F" + - "\u0040\u004F\u007F\u00B1\u005B\u006C\u0050\u007D" + - "\u004D\u005D\\\u004E\u006B\u0060\u004B\u0061" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u007A\u005E\u004C\u007E\u006E\u006F" + - "\u0044\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6" + - "\u00D7\u00D8\u00D9\u00E2\u00E3\u00E4\u00E5\u00E6" + - "\u00E7\u00E8\u00E9\u0090\u0048\u00B5\u005F\u006D" + - "\u00A0\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u0091\u0092\u0093\u0094\u0095\u0096" + - "\u0097\u0098\u0099\u00A2\u00A3\u00A4\u00A5\u00A6" + - "\u00A7\u00A8\u00A9\u0051\u00BB\u0054\u00BD\u0007" + - "\u0020\u0021\"\u0023\u0024\u0015\u0006\u0017" + - "\u0028\u0029\u002A\u002B\u002C\t\n\u001B" + - "\u0030\u0031\u001A\u0033\u0034\u0035\u0036\b" + - "\u0038\u0039\u003A\u003B\u0004\u0014\u003E\u00FF" + - "\u0041\u00AA\u00B0\u007B\u0000\u00B2\u00DD\u005A" + - "\u00A1\u00B4\u009A\u008A\u00BA\u00CA\u00AF\u00BC" + - "\u004A\u008F\u00EA\u00FA\u00BE\u0079\u00B6\u00B3" + - "\u009D\u00DA\u009B\u008B\u00B7\u00B8\u00B9\u00AB" + - "\u0064\u0065\u0062\u0066\u0063\u0067\u009E\u0068" + - "\u0074\u0071\u0072\u0073\u0078\u0075\u0076\u0077" + - "\u00AC\u0069\u00ED\u00EE\u00EB\u00EF\u00EC\u00BF" + - "\u0080\u00FD\u00FE\u00FB\u00FC\u00AD\u00AE\u0059" + - "\u007C\u0045\u0042\u0046\u0043\u0047\u009C\u00E0" + - "\u00D0\u00C0\u0052\u0053\u0058\u0055\u0056\u0057" + - "\u008C\u0049\u00CD\u00CE\u00CB\u00CF\u00CC\u00E1" + - "\u0070\u006A\u00DE\u00DB\u00DC\u008D\u008E\u00DF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u009F\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 340, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM1148.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM1148.java deleted file mode 100644 index 8adb4a5a24c..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM1148.java +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM1148 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM1148() { - super("IBM01148", ExtendedCharsets.aliasesFor("IBM01148")); - } - - public String historicalName() { - return "Cp1148"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM1148); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public short[] getEncoderIndex1() { - return Encoder.index1; - } - - public String getEncoderIndex2() { - return Encoder.index2; - } - - private static class Decoder extends IBM500.Decoder { - public Decoder(Charset cs) { - super(cs); - } - - public char decode(int byteIndex) { - return (byteIndex == (byte)0x9F) ? '\u20AC' : super.decode(byteIndex); - } - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - "\u0000\u0001\u0002\u0003\u0037\u002D\u002E\u002F" + - "\u0016\u0005\u0025\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u003C\u003D\u0032\u0026" + - "\u0018\u0019\u003F\'\u001C\u001D\u001E\u001F" + - "\u0040\u004F\u007F\u007B\u005B\u006C\u0050\u007D" + - "\u004D\u005D\\\u004E\u006B\u0060\u004B\u0061" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u007A\u005E\u004C\u007E\u006E\u006F" + - "\u007C\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6" + - "\u00D7\u00D8\u00D9\u00E2\u00E3\u00E4\u00E5\u00E6" + - "\u00E7\u00E8\u00E9\u004A\u00E0\u005A\u005F\u006D" + - "\u0079\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u0091\u0092\u0093\u0094\u0095\u0096" + - "\u0097\u0098\u0099\u00A2\u00A3\u00A4\u00A5\u00A6" + - "\u00A7\u00A8\u00A9\u00C0\u00BB\u00D0\u00A1\u0007" + - "\u0020\u0021\"\u0023\u0024\u0015\u0006\u0017" + - "\u0028\u0029\u002A\u002B\u002C\t\n\u001B" + - "\u0030\u0031\u001A\u0033\u0034\u0035\u0036\b" + - "\u0038\u0039\u003A\u003B\u0004\u0014\u003E\u00FF" + - "\u0041\u00AA\u00B0\u00B1\u0000\u00B2\u006A\u00B5" + - "\u00BD\u00B4\u009A\u008A\u00BA\u00CA\u00AF\u00BC" + - "\u0090\u008F\u00EA\u00FA\u00BE\u00A0\u00B6\u00B3" + - "\u009D\u00DA\u009B\u008B\u00B7\u00B8\u00B9\u00AB" + - "\u0064\u0065\u0062\u0066\u0063\u0067\u009E\u0068" + - "\u0074\u0071\u0072\u0073\u0078\u0075\u0076\u0077" + - "\u00AC\u0069\u00ED\u00EE\u00EB\u00EF\u00EC\u00BF" + - "\u0080\u00FD\u00FE\u00FB\u00FC\u00AD\u00AE\u0059" + - "\u0044\u0045\u0042\u0046\u0043\u0047\u009C\u0048" + - "\u0054\u0051\u0052\u0053\u0058\u0055\u0056\u0057" + - "\u008C\u0049\u00CD\u00CE\u00CB\u00CF\u00CC\u00E1" + - "\u0070\u00DD\u00DE\u00DB\u00DC\u008D\u008E\u00DF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u009F\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 340, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM1149.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM1149.java deleted file mode 100644 index 7359cea59e3..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM1149.java +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM1149 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM1149() { - super("IBM01149", ExtendedCharsets.aliasesFor("IBM01149")); - } - - public String historicalName() { - return "Cp1149"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM1149); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public short[] getEncoderIndex1() { - return Encoder.index1; - } - - public String getEncoderIndex2() { - return Encoder.index2; - } - - private static class Decoder extends IBM871.Decoder { - public Decoder(Charset cs) { - super(cs); - } - - public char decode(int byteIndex) { - return (byteIndex == (byte)0x9F) ? '\u20AC' : super.decode(byteIndex); - } - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - "\u0000\u0001\u0002\u0003\u0037\u002D\u002E\u002F" + - "\u0016\u0005\u0025\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u003C\u003D\u0032\u0026" + - "\u0018\u0019\u003F\'\u001C\u001D\u001E\u001F" + - "\u0040\u004F\u007F\u007B\u005B\u006C\u0050\u007D" + - "\u004D\u005D\\\u004E\u006B\u0060\u004B\u0061" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u007A\u005E\u004C\u007E\u006E\u006F" + - "\u00AC\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6" + - "\u00D7\u00D8\u00D9\u00E2\u00E3\u00E4\u00E5\u00E6" + - "\u00E7\u00E8\u00E9\u00AE\u00BE\u009E\u00EC\u006D" + - "\u008C\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u0091\u0092\u0093\u0094\u0095\u0096" + - "\u0097\u0098\u0099\u00A2\u00A3\u00A4\u00A5\u00A6" + - "\u00A7\u00A8\u00A9\u008E\u00BB\u009C\u00CC\u0007" + - "\u0020\u0021\"\u0023\u0024\u0015\u0006\u0017" + - "\u0028\u0029\u002A\u002B\u002C\t\n\u001B" + - "\u0030\u0031\u001A\u0033\u0034\u0035\u0036\b" + - "\u0038\u0039\u003A\u003B\u0004\u0014\u003E\u00FF" + - "\u0041\u00AA\u00B0\u00B1\u0000\u00B2\u006A\u00B5" + - "\u00BD\u00B4\u009A\u008A\u00BA\u00CA\u00AF\u00BC" + - "\u0090\u008F\u00EA\u00FA\u00E0\u00A0\u00B6\u00B3" + - "\u009D\u00DA\u009B\u008B\u00B7\u00B8\u00B9\u00AB" + - "\u0064\u0065\u0062\u0066\u0063\u0067\u005A\u0068" + - "\u0074\u0071\u0072\u0073\u0078\u0075\u0076\u0077" + - "\u007C\u0069\u00ED\u00EE\u00EB\u00EF\u005F\u00BF" + - "\u0080\u00FD\u00FE\u00FB\u00FC\u00AD\u004A\u0059" + - "\u0044\u0045\u0042\u0046\u0043\u0047\u00D0\u0048" + - "\u0054\u0051\u0052\u0053\u0058\u0055\u0056\u0057" + - "\u0079\u0049\u00CD\u00CE\u00CB\u00CF\u00A1\u00E1" + - "\u0070\u00DD\u00DE\u00DB\u00DC\u008D\u00C0\u00DF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u009F\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 340, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM273.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM273.java deleted file mode 100644 index 74a857e1f4b..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM273.java +++ /dev/null @@ -1,221 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM273 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM273() { - super("IBM273", ExtendedCharsets.aliasesFor("IBM273")); - } - - public String historicalName() { - return "Cp273"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM273); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - protected static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87 - "\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + // 0x88 - 0x8F - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97 - "\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u00A4" + // 0x98 - 0x9F - "\u00B5\u00DF\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xA0 - 0xA7 - "\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + // 0xA8 - 0xAF - "\u00A2\u00A3\u00A5\u00B7\u00A9\u0040\u00B6\u00BC" + // 0xB0 - 0xB7 - "\u00BD\u00BE\u00AC\u007C\u00AF\u00A8\u00B4\u00D7" + // 0xB8 - 0xBF - "\u00E4\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xC0 - 0xC7 - "\u0048\u0049\u00AD\u00F4\u00A6\u00F2\u00F3\u00F5" + // 0xC8 - 0xCF - "\u00FC\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xD0 - 0xD7 - "\u0051\u0052\u00B9\u00FB\u007D\u00F9\u00FA\u00FF" + // 0xD8 - 0xDF - "\u00D6\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xE0 - 0xE7 - "\u0059\u005A\u00B2\u00D4\\\u00D2\u00D3\u00D5" + // 0xE8 - 0xEF - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xF0 - 0xF7 - "\u0038\u0039\u00B3\u00DB\u005D\u00D9\u00DA\u009F" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07 - "\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17 - "\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27 - "\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2F - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37 - "\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3F - "\u0020\u00A0\u00E2\u007B\u00E0\u00E1\u00E3\u00E5" + // 0x40 - 0x47 - "\u00E7\u00F1\u00C4\u002E\u003C\u0028\u002B\u0021" + // 0x48 - 0x4F - "\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF" + // 0x50 - 0x57 - "\u00EC\u007E\u00DC\u0024\u002A\u0029\u003B\u005E" + // 0x58 - 0x5F - "\u002D\u002F\u00C2\u005B\u00C0\u00C1\u00C3\u00C5" + // 0x60 - 0x67 - "\u00C7\u00D1\u00F6\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6F - "\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF" + // 0x70 - 0x77 - "\u00CC\u0060\u003A\u0023\u00A7\'\u003D\""; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0037\u002D\u002E\u002F" + - "\u0016\u0005\u0015\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u003C\u003D\u0032\u0026" + - "\u0018\u0019\u003F\'\u001C\u001D\u001E\u001F" + - "\u0040\u004F\u007F\u007B\u005B\u006C\u0050\u007D" + - "\u004D\u005D\\\u004E\u006B\u0060\u004B\u0061" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u007A\u005E\u004C\u007E\u006E\u006F" + - "\u00B5\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6" + - "\u00D7\u00D8\u00D9\u00E2\u00E3\u00E4\u00E5\u00E6" + - "\u00E7\u00E8\u00E9\u0063\u00EC\u00FC\u005F\u006D" + - "\u0079\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u0091\u0092\u0093\u0094\u0095\u0096" + - "\u0097\u0098\u0099\u00A2\u00A3\u00A4\u00A5\u00A6" + - "\u00A7\u00A8\u00A9\u0043\u00BB\u00DC\u0059\u0007" + - "\u0020\u0021\"\u0023\u0024\u0015\u0006\u0017" + - "\u0028\u0029\u002A\u002B\u002C\t\n\u001B" + - "\u0030\u0031\u001A\u0033\u0034\u0035\u0036\b" + - "\u0038\u0039\u003A\u003B\u0004\u0014\u003E\u00FF" + - "\u0041\u00AA\u00B0\u00B1\u009F\u00B2\u00CC\u007C" + - "\u00BD\u00B4\u009A\u008A\u00BA\u00CA\u00AF\u00BC" + - "\u0090\u008F\u00EA\u00FA\u00BE\u00A0\u00B6\u00B3" + - "\u009D\u00DA\u009B\u008B\u00B7\u00B8\u00B9\u00AB" + - "\u0064\u0065\u0062\u0066\u004A\u0067\u009E\u0068" + - "\u0074\u0071\u0072\u0073\u0078\u0075\u0076\u0077" + - "\u00AC\u0069\u00ED\u00EE\u00EB\u00EF\u00E0\u00BF" + - "\u0080\u00FD\u00FE\u00FB\u005A\u00AD\u00AE\u00A1" + - "\u0044\u0045\u0042\u0046\u00C0\u0047\u009C\u0048" + - "\u0054\u0051\u0052\u0053\u0058\u0055\u0056\u0057" + - "\u008C\u0049\u00CD\u00CE\u00CB\u00CF\u006A\u00E1" + - "\u0070\u00DD\u00DE\u00DB\u00D0\u008D\u008E\u00DF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM277.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM277.java deleted file mode 100644 index d4917a0d272..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM277.java +++ /dev/null @@ -1,221 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM277 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM277() { - super("IBM277", ExtendedCharsets.aliasesFor("IBM277")); - } - - public String historicalName() { - return "Cp277"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM277); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - protected static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u0040\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87 - "\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + // 0x88 - 0x8F - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97 - "\u0071\u0072\u00AA\u00BA\u007B\u00B8\u005B\u005D" + // 0x98 - 0x9F - "\u00B5\u00FC\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xA0 - 0xA7 - "\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + // 0xA8 - 0xAF - "\u00A2\u00A3\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC" + // 0xB0 - 0xB7 - "\u00BD\u00BE\u00AC\u007C\u00AF\u00A8\u00B4\u00D7" + // 0xB8 - 0xBF - "\u00E6\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xC0 - 0xC7 - "\u0048\u0049\u00AD\u00F4\u00F6\u00F2\u00F3\u00F5" + // 0xC8 - 0xCF - "\u00E5\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xD0 - 0xD7 - "\u0051\u0052\u00B9\u00FB\u007E\u00F9\u00FA\u00FF" + // 0xD8 - 0xDF - "\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xE0 - 0xE7 - "\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + // 0xE8 - 0xEF - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xF0 - 0xF7 - "\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07 - "\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17 - "\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27 - "\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2F - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37 - "\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3F - "\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u007D" + // 0x40 - 0x47 - "\u00E7\u00F1\u0023\u002E\u003C\u0028\u002B\u0021" + // 0x48 - 0x4F - "\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF" + // 0x50 - 0x57 - "\u00EC\u00DF\u00A4\u00C5\u002A\u0029\u003B\u005E" + // 0x58 - 0x5F - "\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u0024" + // 0x60 - 0x67 - "\u00C7\u00D1\u00F8\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6F - "\u00A6\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF" + // 0x70 - 0x77 - "\u00CC\u0060\u003A\u00C6\u00D8\'\u003D\""; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0037\u002D\u002E\u002F" + - "\u0016\u0005\u0015\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u003C\u003D\u0032\u0026" + - "\u0018\u0019\u003F\'\u001C\u001D\u001E\u001F" + - "\u0040\u004F\u007F\u004A\u0067\u006C\u0050\u007D" + - "\u004D\u005D\\\u004E\u006B\u0060\u004B\u0061" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u007A\u005E\u004C\u007E\u006E\u006F" + - "\u0080\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6" + - "\u00D7\u00D8\u00D9\u00E2\u00E3\u00E4\u00E5\u00E6" + - "\u00E7\u00E8\u00E9\u009E\u00E0\u009F\u005F\u006D" + - "\u0079\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u0091\u0092\u0093\u0094\u0095\u0096" + - "\u0097\u0098\u0099\u00A2\u00A3\u00A4\u00A5\u00A6" + - "\u00A7\u00A8\u00A9\u009C\u00BB\u0047\u00DC\u0007" + - "\u0020\u0021\"\u0023\u0024\u0015\u0006\u0017" + - "\u0028\u0029\u002A\u002B\u002C\t\n\u001B" + - "\u0030\u0031\u001A\u0033\u0034\u0035\u0036\b" + - "\u0038\u0039\u003A\u003B\u0004\u0014\u003E\u00FF" + - "\u0041\u00AA\u00B0\u00B1\u005A\u00B2\u0070\u00B5" + - "\u00BD\u00B4\u009A\u008A\u00BA\u00CA\u00AF\u00BC" + - "\u0090\u008F\u00EA\u00FA\u00BE\u00A0\u00B6\u00B3" + - "\u009D\u00DA\u009B\u008B\u00B7\u00B8\u00B9\u00AB" + - "\u0064\u0065\u0062\u0066\u0063\u005B\u007B\u0068" + - "\u0074\u0071\u0072\u0073\u0078\u0075\u0076\u0077" + - "\u00AC\u0069\u00ED\u00EE\u00EB\u00EF\u00EC\u00BF" + - "\u007C\u00FD\u00FE\u00FB\u00FC\u00AD\u00AE\u0059" + - "\u0044\u0045\u0042\u0046\u0043\u00D0\u00C0\u0048" + - "\u0054\u0051\u0052\u0053\u0058\u0055\u0056\u0057" + - "\u008C\u0049\u00CD\u00CE\u00CB\u00CF\u00CC\u00E1" + - "\u006A\u00DD\u00DE\u00DB\u00A1\u008D\u008E\u00DF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM278.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM278.java deleted file mode 100644 index 58db790768f..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM278.java +++ /dev/null @@ -1,221 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM278 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM278() { - super("IBM278", ExtendedCharsets.aliasesFor("IBM278")); - } - - public String historicalName() { - return "Cp278"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM278); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - protected static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87 - "\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + // 0x88 - 0x8F - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97 - "\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u005D" + // 0x98 - 0x9F - "\u00B5\u00FC\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xA0 - 0xA7 - "\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + // 0xA8 - 0xAF - "\u00A2\u00A3\u00A5\u00B7\u00A9\u005B\u00B6\u00BC" + // 0xB0 - 0xB7 - "\u00BD\u00BE\u00AC\u007C\u00AF\u00A8\u00B4\u00D7" + // 0xB8 - 0xBF - "\u00E4\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xC0 - 0xC7 - "\u0048\u0049\u00AD\u00F4\u00A6\u00F2\u00F3\u00F5" + // 0xC8 - 0xCF - "\u00E5\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xD0 - 0xD7 - "\u0051\u0052\u00B9\u00FB\u007E\u00F9\u00FA\u00FF" + // 0xD8 - 0xDF - "\u00C9\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xE0 - 0xE7 - "\u0059\u005A\u00B2\u00D4\u0040\u00D2\u00D3\u00D5" + // 0xE8 - 0xEF - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xF0 - 0xF7 - "\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07 - "\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17 - "\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27 - "\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2F - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37 - "\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3F - "\u0020\u00A0\u00E2\u007B\u00E0\u00E1\u00E3\u007D" + // 0x40 - 0x47 - "\u00E7\u00F1\u00A7\u002E\u003C\u0028\u002B\u0021" + // 0x48 - 0x4F - "\u0026\u0060\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF" + // 0x50 - 0x57 - "\u00EC\u00DF\u00A4\u00C5\u002A\u0029\u003B\u005E" + // 0x58 - 0x5F - "\u002D\u002F\u00C2\u0023\u00C0\u00C1\u00C3\u0024" + // 0x60 - 0x67 - "\u00C7\u00D1\u00F6\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6F - "\u00F8\\\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF" + // 0x70 - 0x77 - "\u00CC\u00E9\u003A\u00C4\u00D6\'\u003D\""; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0037\u002D\u002E\u002F" + - "\u0016\u0005\u0015\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u003C\u003D\u0032\u0026" + - "\u0018\u0019\u003F\'\u001C\u001D\u001E\u001F" + - "\u0040\u004F\u007F\u0063\u0067\u006C\u0050\u007D" + - "\u004D\u005D\\\u004E\u006B\u0060\u004B\u0061" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u007A\u005E\u004C\u007E\u006E\u006F" + - "\u00EC\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6" + - "\u00D7\u00D8\u00D9\u00E2\u00E3\u00E4\u00E5\u00E6" + - "\u00E7\u00E8\u00E9\u00B5\u0071\u009F\u005F\u006D" + - "\u0051\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u0091\u0092\u0093\u0094\u0095\u0096" + - "\u0097\u0098\u0099\u00A2\u00A3\u00A4\u00A5\u00A6" + - "\u00A7\u00A8\u00A9\u0043\u00BB\u0047\u00DC\u0007" + - "\u0020\u0021\"\u0023\u0024\u0015\u0006\u0017" + - "\u0028\u0029\u002A\u002B\u002C\t\n\u001B" + - "\u0030\u0031\u001A\u0033\u0034\u0035\u0036\b" + - "\u0038\u0039\u003A\u003B\u0004\u0014\u003E\u00FF" + - "\u0041\u00AA\u00B0\u00B1\u005A\u00B2\u00CC\u004A" + - "\u00BD\u00B4\u009A\u008A\u00BA\u00CA\u00AF\u00BC" + - "\u0090\u008F\u00EA\u00FA\u00BE\u00A0\u00B6\u00B3" + - "\u009D\u00DA\u009B\u008B\u00B7\u00B8\u00B9\u00AB" + - "\u0064\u0065\u0062\u0066\u007B\u005B\u009E\u0068" + - "\u0074\u00E0\u0072\u0073\u0078\u0075\u0076\u0077" + - "\u00AC\u0069\u00ED\u00EE\u00EB\u00EF\u007C\u00BF" + - "\u0080\u00FD\u00FE\u00FB\u00FC\u00AD\u00AE\u0059" + - "\u0044\u0045\u0042\u0046\u00C0\u00D0\u009C\u0048" + - "\u0054\u0079\u0052\u0053\u0058\u0055\u0056\u0057" + - "\u008C\u0049\u00CD\u00CE\u00CB\u00CF\u006A\u00E1" + - "\u0070\u00DD\u00DE\u00DB\u00A1\u008D\u008E\u00DF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM280.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM280.java deleted file mode 100644 index 08d61d47fdf..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM280.java +++ /dev/null @@ -1,221 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM280 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM280() { - super("IBM280", ExtendedCharsets.aliasesFor("IBM280")); - } - - public String historicalName() { - return "Cp280"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM280); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - protected static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87 - "\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + // 0x88 - 0x8F - "\u005B\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97 - "\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u00A4" + // 0x98 - 0x9F - "\u00B5\u00EC\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xA0 - 0xA7 - "\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + // 0xA8 - 0xAF - "\u00A2\u0023\u00A5\u00B7\u00A9\u0040\u00B6\u00BC" + // 0xB0 - 0xB7 - "\u00BD\u00BE\u00AC\u007C\u00AF\u00A8\u00B4\u00D7" + // 0xB8 - 0xBF - "\u00E0\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xC0 - 0xC7 - "\u0048\u0049\u00AD\u00F4\u00F6\u00A6\u00F3\u00F5" + // 0xC8 - 0xCF - "\u00E8\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xD0 - 0xD7 - "\u0051\u0052\u00B9\u00FB\u00FC\u0060\u00FA\u00FF" + // 0xD8 - 0xDF - "\u00E7\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xE0 - 0xE7 - "\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + // 0xE8 - 0xEF - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xF0 - 0xF7 - "\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07 - "\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17 - "\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27 - "\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2F - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37 - "\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3F - "\u0020\u00A0\u00E2\u00E4\u007B\u00E1\u00E3\u00E5" + // 0x40 - 0x47 - "\\\u00F1\u00B0\u002E\u003C\u0028\u002B\u0021" + // 0x48 - 0x4F - "\u0026\u005D\u00EA\u00EB\u007D\u00ED\u00EE\u00EF" + // 0x50 - 0x57 - "\u007E\u00DF\u00E9\u0024\u002A\u0029\u003B\u005E" + // 0x58 - 0x5F - "\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5" + // 0x60 - 0x67 - "\u00C7\u00D1\u00F2\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6F - "\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF" + // 0x70 - 0x77 - "\u00CC\u00F9\u003A\u00A3\u00A7\'\u003D\""; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0037\u002D\u002E\u002F" + - "\u0016\u0005\u0015\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u003C\u003D\u0032\u0026" + - "\u0018\u0019\u003F\'\u001C\u001D\u001E\u001F" + - "\u0040\u004F\u007F\u00B1\u005B\u006C\u0050\u007D" + - "\u004D\u005D\\\u004E\u006B\u0060\u004B\u0061" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u007A\u005E\u004C\u007E\u006E\u006F" + - "\u00B5\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6" + - "\u00D7\u00D8\u00D9\u00E2\u00E3\u00E4\u00E5\u00E6" + - "\u00E7\u00E8\u00E9\u0090\u0048\u0051\u005F\u006D" + - "\u00DD\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u0091\u0092\u0093\u0094\u0095\u0096" + - "\u0097\u0098\u0099\u00A2\u00A3\u00A4\u00A5\u00A6" + - "\u00A7\u00A8\u00A9\u0044\u00BB\u0054\u0058\u0007" + - "\u0020\u0021\"\u0023\u0024\u0015\u0006\u0017" + - "\u0028\u0029\u002A\u002B\u002C\t\n\u001B" + - "\u0030\u0031\u001A\u0033\u0034\u0035\u0036\b" + - "\u0038\u0039\u003A\u003B\u0004\u0014\u003E\u00FF" + - "\u0041\u00AA\u00B0\u007B\u009F\u00B2\u00CD\u007C" + - "\u00BD\u00B4\u009A\u008A\u00BA\u00CA\u00AF\u00BC" + - "\u004A\u008F\u00EA\u00FA\u00BE\u00A0\u00B6\u00B3" + - "\u009D\u00DA\u009B\u008B\u00B7\u00B8\u00B9\u00AB" + - "\u0064\u0065\u0062\u0066\u0063\u0067\u009E\u0068" + - "\u0074\u0071\u0072\u0073\u0078\u0075\u0076\u0077" + - "\u00AC\u0069\u00ED\u00EE\u00EB\u00EF\u00EC\u00BF" + - "\u0080\u00FD\u00FE\u00FB\u00FC\u00AD\u00AE\u0059" + - "\u00C0\u0045\u0042\u0046\u0043\u0047\u009C\u00E0" + - "\u00D0\u005A\u0052\u0053\u00A1\u0055\u0056\u0057" + - "\u008C\u0049\u006A\u00CE\u00CB\u00CF\u00CC\u00E1" + - "\u0070\u0079\u00DE\u00DB\u00DC\u008D\u008E\u00DF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM284.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM284.java deleted file mode 100644 index ba612686884..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM284.java +++ /dev/null @@ -1,221 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM284 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM284() { - super("IBM284", ExtendedCharsets.aliasesFor("IBM284")); - } - - public String historicalName() { - return "Cp284"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM284); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - protected static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87 - "\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + // 0x88 - 0x8F - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97 - "\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u00A4" + // 0x98 - 0x9F - "\u00B5\u00A8\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xA0 - 0xA7 - "\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + // 0xA8 - 0xAF - "\u00A2\u00A3\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC" + // 0xB0 - 0xB7 - "\u00BD\u00BE\u005E\u0021\u00AF\u007E\u00B4\u00D7" + // 0xB8 - 0xBF - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xC0 - 0xC7 - "\u0048\u0049\u00AD\u00F4\u00F6\u00F2\u00F3\u00F5" + // 0xC8 - 0xCF - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xD0 - 0xD7 - "\u0051\u0052\u00B9\u00FB\u00FC\u00F9\u00FA\u00FF" + // 0xD8 - 0xDF - "\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xE0 - 0xE7 - "\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + // 0xE8 - 0xEF - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xF0 - 0xF7 - "\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07 - "\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17 - "\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27 - "\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2F - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37 - "\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3F - "\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u00E5" + // 0x40 - 0x47 - "\u00E7\u00A6\u005B\u002E\u003C\u0028\u002B\u007C" + // 0x48 - 0x4F - "\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF" + // 0x50 - 0x57 - "\u00EC\u00DF\u005D\u0024\u002A\u0029\u003B\u00AC" + // 0x58 - 0x5F - "\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5" + // 0x60 - 0x67 - "\u00C7\u0023\u00F1\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6F - "\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF" + // 0x70 - 0x77 - "\u00CC\u0060\u003A\u00D1\u0040\'\u003D\""; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0037\u002D\u002E\u002F" + - "\u0016\u0005\u0015\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u003C\u003D\u0032\u0026" + - "\u0018\u0019\u003F\'\u001C\u001D\u001E\u001F" + - "\u0040\u00BB\u007F\u0069\u005B\u006C\u0050\u007D" + - "\u004D\u005D\\\u004E\u006B\u0060\u004B\u0061" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u007A\u005E\u004C\u007E\u006E\u006F" + - "\u007C\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6" + - "\u00D7\u00D8\u00D9\u00E2\u00E3\u00E4\u00E5\u00E6" + - "\u00E7\u00E8\u00E9\u004A\u00E0\u005A\u00BA\u006D" + - "\u0079\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u0091\u0092\u0093\u0094\u0095\u0096" + - "\u0097\u0098\u0099\u00A2\u00A3\u00A4\u00A5\u00A6" + - "\u00A7\u00A8\u00A9\u00C0\u004F\u00D0\u00BD\u0007" + - "\u0020\u0021\"\u0023\u0024\u0015\u0006\u0017" + - "\u0028\u0029\u002A\u002B\u002C\t\n\u001B" + - "\u0030\u0031\u001A\u0033\u0034\u0035\u0036\b" + - "\u0038\u0039\u003A\u003B\u0004\u0014\u003E\u00FF" + - "\u0041\u00AA\u00B0\u00B1\u009F\u00B2\u0049\u00B5" + - "\u00A1\u00B4\u009A\u008A\u005F\u00CA\u00AF\u00BC" + - "\u0090\u008F\u00EA\u00FA\u00BE\u00A0\u00B6\u00B3" + - "\u009D\u00DA\u009B\u008B\u00B7\u00B8\u00B9\u00AB" + - "\u0064\u0065\u0062\u0066\u0063\u0067\u009E\u0068" + - "\u0074\u0071\u0072\u0073\u0078\u0075\u0076\u0077" + - "\u00AC\u007B\u00ED\u00EE\u00EB\u00EF\u00EC\u00BF" + - "\u0080\u00FD\u00FE\u00FB\u00FC\u00AD\u00AE\u0059" + - "\u0044\u0045\u0042\u0046\u0043\u0047\u009C\u0048" + - "\u0054\u0051\u0052\u0053\u0058\u0055\u0056\u0057" + - "\u008C\u006A\u00CD\u00CE\u00CB\u00CF\u00CC\u00E1" + - "\u0070\u00DD\u00DE\u00DB\u00DC\u008D\u008E\u00DF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM285.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM285.java deleted file mode 100644 index b7a44c45bef..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM285.java +++ /dev/null @@ -1,221 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM285 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM285() { - super("IBM285", ExtendedCharsets.aliasesFor("IBM285")); - } - - public String historicalName() { - return "Cp285"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM285); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - protected static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87 - "\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + // 0x88 - 0x8F - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97 - "\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u00A4" + // 0x98 - 0x9F - "\u00B5\u00AF\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xA0 - 0xA7 - "\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + // 0xA8 - 0xAF - "\u00A2\u005B\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC" + // 0xB0 - 0xB7 - "\u00BD\u00BE\u005E\u005D\u007E\u00A8\u00B4\u00D7" + // 0xB8 - 0xBF - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xC0 - 0xC7 - "\u0048\u0049\u00AD\u00F4\u00F6\u00F2\u00F3\u00F5" + // 0xC8 - 0xCF - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xD0 - 0xD7 - "\u0051\u0052\u00B9\u00FB\u00FC\u00F9\u00FA\u00FF" + // 0xD8 - 0xDF - "\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xE0 - 0xE7 - "\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + // 0xE8 - 0xEF - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xF0 - 0xF7 - "\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07 - "\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17 - "\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27 - "\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2F - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37 - "\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3F - "\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u00E5" + // 0x40 - 0x47 - "\u00E7\u00F1\u0024\u002E\u003C\u0028\u002B\u007C" + // 0x48 - 0x4F - "\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF" + // 0x50 - 0x57 - "\u00EC\u00DF\u0021\u00A3\u002A\u0029\u003B\u00AC" + // 0x58 - 0x5F - "\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5" + // 0x60 - 0x67 - "\u00C7\u00D1\u00A6\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6F - "\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF" + // 0x70 - 0x77 - "\u00CC\u0060\u003A\u0023\u0040\'\u003D\""; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0037\u002D\u002E\u002F" + - "\u0016\u0005\u0015\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u003C\u003D\u0032\u0026" + - "\u0018\u0019\u003F\'\u001C\u001D\u001E\u001F" + - "\u0040\u005A\u007F\u007B\u004A\u006C\u0050\u007D" + - "\u004D\u005D\\\u004E\u006B\u0060\u004B\u0061" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u007A\u005E\u004C\u007E\u006E\u006F" + - "\u007C\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6" + - "\u00D7\u00D8\u00D9\u00E2\u00E3\u00E4\u00E5\u00E6" + - "\u00E7\u00E8\u00E9\u00B1\u00E0\u00BB\u00BA\u006D" + - "\u0079\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u0091\u0092\u0093\u0094\u0095\u0096" + - "\u0097\u0098\u0099\u00A2\u00A3\u00A4\u00A5\u00A6" + - "\u00A7\u00A8\u00A9\u00C0\u004F\u00D0\u00BC\u0007" + - "\u0020\u0021\"\u0023\u0024\u0015\u0006\u0017" + - "\u0028\u0029\u002A\u002B\u002C\t\n\u001B" + - "\u0030\u0031\u001A\u0033\u0034\u0035\u0036\b" + - "\u0038\u0039\u003A\u003B\u0004\u0014\u003E\u00FF" + - "\u0041\u00AA\u00B0\u005B\u009F\u00B2\u006A\u00B5" + - "\u00BD\u00B4\u009A\u008A\u005F\u00CA\u00AF\u00A1" + - "\u0090\u008F\u00EA\u00FA\u00BE\u00A0\u00B6\u00B3" + - "\u009D\u00DA\u009B\u008B\u00B7\u00B8\u00B9\u00AB" + - "\u0064\u0065\u0062\u0066\u0063\u0067\u009E\u0068" + - "\u0074\u0071\u0072\u0073\u0078\u0075\u0076\u0077" + - "\u00AC\u0069\u00ED\u00EE\u00EB\u00EF\u00EC\u00BF" + - "\u0080\u00FD\u00FE\u00FB\u00FC\u00AD\u00AE\u0059" + - "\u0044\u0045\u0042\u0046\u0043\u0047\u009C\u0048" + - "\u0054\u0051\u0052\u0053\u0058\u0055\u0056\u0057" + - "\u008C\u0049\u00CD\u00CE\u00CB\u00CF\u00CC\u00E1" + - "\u0070\u00DD\u00DE\u00DB\u00DC\u008D\u008E\u00DF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM297.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM297.java deleted file mode 100644 index 74aecce606d..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM297.java +++ /dev/null @@ -1,221 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM297 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM297() { - super("IBM297", ExtendedCharsets.aliasesFor("IBM297")); - } - - public String historicalName() { - return "Cp297"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM297); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - protected static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87 - "\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + // 0x88 - 0x8F - "\u005B\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97 - "\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u00A4" + // 0x98 - 0x9F - "\u0060\u00A8\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xA0 - 0xA7 - "\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + // 0xA8 - 0xAF - "\u00A2\u0023\u00A5\u00B7\u00A9\u005D\u00B6\u00BC" + // 0xB0 - 0xB7 - "\u00BD\u00BE\u00AC\u007C\u00AF\u007E\u00B4\u00D7" + // 0xB8 - 0xBF - "\u00E9\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xC0 - 0xC7 - "\u0048\u0049\u00AD\u00F4\u00F6\u00F2\u00F3\u00F5" + // 0xC8 - 0xCF - "\u00E8\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xD0 - 0xD7 - "\u0051\u0052\u00B9\u00FB\u00FC\u00A6\u00FA\u00FF" + // 0xD8 - 0xDF - "\u00E7\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xE0 - 0xE7 - "\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + // 0xE8 - 0xEF - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xF0 - 0xF7 - "\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07 - "\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17 - "\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27 - "\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2F - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37 - "\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3F - "\u0020\u00A0\u00E2\u00E4\u0040\u00E1\u00E3\u00E5" + // 0x40 - 0x47 - "\\\u00F1\u00B0\u002E\u003C\u0028\u002B\u0021" + // 0x48 - 0x4F - "\u0026\u007B\u00EA\u00EB\u007D\u00ED\u00EE\u00EF" + // 0x50 - 0x57 - "\u00EC\u00DF\u00A7\u0024\u002A\u0029\u003B\u005E" + // 0x58 - 0x5F - "\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5" + // 0x60 - 0x67 - "\u00C7\u00D1\u00F9\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6F - "\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF" + // 0x70 - 0x77 - "\u00CC\u00B5\u003A\u00A3\u00E0\'\u003D\""; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0037\u002D\u002E\u002F" + - "\u0016\u0005\u0015\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u003C\u003D\u0032\u0026" + - "\u0018\u0019\u003F\'\u001C\u001D\u001E\u001F" + - "\u0040\u004F\u007F\u00B1\u005B\u006C\u0050\u007D" + - "\u004D\u005D\\\u004E\u006B\u0060\u004B\u0061" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u007A\u005E\u004C\u007E\u006E\u006F" + - "\u0044\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6" + - "\u00D7\u00D8\u00D9\u00E2\u00E3\u00E4\u00E5\u00E6" + - "\u00E7\u00E8\u00E9\u0090\u0048\u00B5\u005F\u006D" + - "\u00A0\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u0091\u0092\u0093\u0094\u0095\u0096" + - "\u0097\u0098\u0099\u00A2\u00A3\u00A4\u00A5\u00A6" + - "\u00A7\u00A8\u00A9\u0051\u00BB\u0054\u00BD\u0007" + - "\u0020\u0021\"\u0023\u0024\u0015\u0006\u0017" + - "\u0028\u0029\u002A\u002B\u002C\t\n\u001B" + - "\u0030\u0031\u001A\u0033\u0034\u0035\u0036\b" + - "\u0038\u0039\u003A\u003B\u0004\u0014\u003E\u00FF" + - "\u0041\u00AA\u00B0\u007B\u009F\u00B2\u00DD\u005A" + - "\u00A1\u00B4\u009A\u008A\u00BA\u00CA\u00AF\u00BC" + - "\u004A\u008F\u00EA\u00FA\u00BE\u0079\u00B6\u00B3" + - "\u009D\u00DA\u009B\u008B\u00B7\u00B8\u00B9\u00AB" + - "\u0064\u0065\u0062\u0066\u0063\u0067\u009E\u0068" + - "\u0074\u0071\u0072\u0073\u0078\u0075\u0076\u0077" + - "\u00AC\u0069\u00ED\u00EE\u00EB\u00EF\u00EC\u00BF" + - "\u0080\u00FD\u00FE\u00FB\u00FC\u00AD\u00AE\u0059" + - "\u007C\u0045\u0042\u0046\u0043\u0047\u009C\u00E0" + - "\u00D0\u00C0\u0052\u0053\u0058\u0055\u0056\u0057" + - "\u008C\u0049\u00CD\u00CE\u00CB\u00CF\u00CC\u00E1" + - "\u0070\u006A\u00DE\u00DB\u00DC\u008D\u008E\u00DF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM420.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM420.java deleted file mode 100644 index f99c85ad759..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM420.java +++ /dev/null @@ -1,315 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM420 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM420() { - super("IBM420", ExtendedCharsets.aliasesFor("IBM420")); - } - - public String historicalName() { - return "Cp420"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM420); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\uF8F5\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87 - "\u0068\u0069\uFEB7\uF8F4\uFEBB\uF8F7\uFEBF\uFEC3" + // 0x88 - 0x8F - "\uFEC7\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97 - "\u0071\u0072\uFEC9\uFECA\uFECB\uFECC\uFECD\uFECE" + // 0x98 - 0x9F - "\uFECF\u00F7\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xA0 - 0xA7 - "\u0079\u007A\uFED0\uFED1\uFED3\uFED5\uFED7\uFED9" + // 0xA8 - 0xAF - "\uFEDB\uFEDD\uFEF5\uFEF6\uFEF7\uFEF8\uFFFD\uFFFD" + // 0xB0 - 0xB7 - "\uFEFB\uFEFC\uFEDF\uFEE1\uFEE3\uFEE5\uFEE7\uFEE9" + // 0xB8 - 0xBF - "\u061B\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xC0 - 0xC7 - "\u0048\u0049\u00AD\uFEEB\uFFFD\uFEEC\uFFFD\uFEED" + // 0xC8 - 0xCF - "\u061F\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xD0 - 0xD7 - "\u0051\u0052\uFEEF\uFEF0\uFEF1\uFEF2\uFEF3\u0660" + // 0xD8 - 0xDF - "\u00D7\u2007\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xE0 - 0xE7 - "\u0059\u005A\u0661\u0662\uFFFD\u0663\u0664\u0665" + // 0xE8 - 0xEF - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xF0 - 0xF7 - "\u0038\u0039\uFFFD\u0666\u0667\u0668\u0669\u009F" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07 - "\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17 - "\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27 - "\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2F - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37 - "\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3F - "\u0020\u00A0\uFE7C\uFE7D\u0640\uF8FC\uFE80\uFE81" + // 0x40 - 0x47 - "\uFE82\uFE83\u00A2\u002E\u003C\u0028\u002B\u007C" + // 0x48 - 0x4F - "\u0026\uFE84\uFE85\uFFFD\uFFFD\uFE8B\uFE8D\uFE8E" + // 0x50 - 0x57 - "\uFE8F\uFE91\u0021\u0024\u002A\u0029\u003B\u00AC" + // 0x58 - 0x5F - "\u002D\u002F\uFE93\uFE95\uFE97\uFE99\uFE9B\uFE9D" + // 0x60 - 0x67 - "\uFE9F\uFEA1\u00A6\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6F - "\uFEA3\uFEA5\uFEA7\uFEA9\uFEAB\uFEAD\uFEAF\uF8F6" + // 0x70 - 0x77 - "\uFEB3\u060C\u003A\u0023\u0040\'\u003D\""; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0037\u002D\u002E\u002F" + - "\u0016\u0005\u0015\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u003C\u003D\u0032\u0026" + - "\u0018\u0019\u003F\'\u001C\u001D\u001E\u001F" + - "\u0040\u005A\u007F\u007B\u005B\u006C\u0050\u007D" + - "\u004D\u005D\\\u004E\u006B\u0060\u004B\u0061" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u007A\u005E\u004C\u007E\u006E\u006F" + - "\u007C\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6" + - "\u00D7\u00D8\u00D9\u00E2\u00E3\u00E4\u00E5\u00E6" + - "\u00E7\u00E8\u00E9\u0000\u0000\u0000\u0000\u006D" + - "\u0000\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u0091\u0092\u0093\u0094\u0095\u0096" + - "\u0097\u0098\u0099\u00A2\u00A3\u00A4\u00A5\u00A6" + - "\u00A7\u00A8\u00A9\u0000\u004F\u0000\u0000\u0007" + - "\u0020\u0021\"\u0023\u0024\u0015\u0006\u0017" + - "\u0028\u0029\u002A\u002B\u002C\t\n\u001B" + - "\u0030\u0031\u001A\u0033\u0034\u0035\u0036\b" + - "\u0038\u0039\u003A\u003B\u0004\u0014\u003E\u00FF" + - "\u0041\u0000\u004A\u0000\u0000\u0000\u006A\u0000" + - "\u0000\u0000\u0000\u0000\u005F\u00CA\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00E0" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00A1" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0079\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00C0" + - "\u0000\u0000\u0000\u00D0\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0044\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00DF\u00EA\u00EB\u00ED" + - "\u00EE\u00EF\u00FB\u00FC\u00FD\u00FE\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00E1\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u008B\u0080\u0077" + - "\u008D\u0000\u0000\u0000\u0000\u0045\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0042\u0043\u0000\u0000\u0046\u0047" + - "\u0048\u0049\u0051\u0052\u0000\u0000\u0000\u0000" + - "\u0000\u0055\u0000\u0056\u0057\u0058\u0000\u0059" + - "\u0000\u0062\u0000\u0063\u0000\u0064\u0000\u0065" + - "\u0000\u0066\u0000\u0067\u0000\u0068\u0000\u0069" + - "\u0000\u0070\u0000\u0071\u0000\u0072\u0000\u0073" + - "\u0000\u0074\u0000\u0075\u0000\u0076\u0000\u0000" + - "\u0000\u0078\u0000\u0000\u0000\u008A\u0000\u0000" + - "\u0000\u008C\u0000\u0000\u0000\u008E\u0000\u0000" + - "\u0000\u008F\u0000\u0000\u0000\u0090\u0000\u009A" + - "\u009B\u009C\u009D\u009E\u009F\u00A0\u00AA\u00AB" + - "\u0000\u00AC\u0000\u00AD\u0000\u00AE\u0000\u00AF" + - "\u0000\u00B0\u0000\u00B1\u0000\u00BA\u0000\u00BB" + - "\u0000\u00BC\u0000\u00BD\u0000\u00BE\u0000\u00BF" + - "\u0000\u00CB\u00CD\u00CF\u0000\u00DA\u00DB\u00DC" + - "\u00DD\u00DE\u0000\u00B2\u00B3\u00B4\u00B5\u0000" + - "\u0000\u00B8\u00B9\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 248, 248, 248, 248, 248, 492, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 741, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 753, 248, 248, 248, 248, 248, 1006, 248, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM424.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM424.java deleted file mode 100644 index d4d2c6d4598..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM424.java +++ /dev/null @@ -1,256 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM424 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM424() { - super("IBM424", ExtendedCharsets.aliasesFor("IBM424")); - } - - public String historicalName() { - return "Cp424"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM424); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\uFFFD\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87 - "\u0068\u0069\u00AB\u00BB\uFFFD\uFFFD\uFFFD\u00B1" + // 0x88 - 0x8F - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97 - "\u0071\u0072\uFFFD\uFFFD\uFFFD\u00B8\uFFFD\u00A4" + // 0x98 - 0x9F - "\u00B5\u007E\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xA0 - 0xA7 - "\u0079\u007A\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u00AE" + // 0xA8 - 0xAF - "\u005E\u00A3\u00A5\u2022\u00A9\u00A7\u00B6\u00BC" + // 0xB0 - 0xB7 - "\u00BD\u00BE\u005B\u005D\u203E\u00A8\u00B4\u00D7" + // 0xB8 - 0xBF - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xC0 - 0xC7 - "\u0048\u0049\u00AD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xC8 - 0xCF - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xD0 - 0xD7 - "\u0051\u0052\u00B9\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xD8 - 0xDF - "\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xE0 - 0xE7 - "\u0059\u005A\u00B2\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xE8 - 0xEF - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xF0 - 0xF7 - "\u0038\u0039\u00B3\uFFFD\uFFFD\uFFFD\uFFFD\u009F" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07 - "\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17 - "\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27 - "\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2F - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37 - "\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3F - "\u0020\u05D0\u05D1\u05D2\u05D3\u05D4\u05D5\u05D6" + // 0x40 - 0x47 - "\u05D7\u05D8\u00A2\u002E\u003C\u0028\u002B\u007C" + // 0x48 - 0x4F - "\u0026\u05D9\u05DA\u05DB\u05DC\u05DD\u05DE\u05DF" + // 0x50 - 0x57 - "\u05E0\u05E1\u0021\u0024\u002A\u0029\u003B\u00AC" + // 0x58 - 0x5F - "\u002D\u002F\u05E2\u05E3\u05E4\u05E5\u05E6\u05E7" + // 0x60 - 0x67 - "\u05E8\u05E9\u00A6\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6F - "\uFFFD\u05EA\uFFFD\uFFFD\u00A0\uFFFD\uFFFD\uFFFD" + // 0x70 - 0x77 - "\u2017\u0060\u003A\u0023\u0040\'\u003D\""; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0037\u002D\u002E\u002F" + - "\u0016\u0005\u0015\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u003C\u003D\u0032\u0026" + - "\u0018\u0019\u003F\'\u001C\u001D\u001E\u001F" + - "\u0040\u005A\u007F\u007B\u005B\u006C\u0050\u007D" + - "\u004D\u005D\\\u004E\u006B\u0060\u004B\u0061" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u007A\u005E\u004C\u007E\u006E\u006F" + - "\u007C\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6" + - "\u00D7\u00D8\u00D9\u00E2\u00E3\u00E4\u00E5\u00E6" + - "\u00E7\u00E8\u00E9\u00BA\u00E0\u00BB\u00B0\u006D" + - "\u0079\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u0091\u0092\u0093\u0094\u0095\u0096" + - "\u0097\u0098\u0099\u00A2\u00A3\u00A4\u00A5\u00A6" + - "\u00A7\u00A8\u00A9\u00C0\u004F\u00D0\u00A1\u0007" + - "\u0020\u0021\"\u0023\u0024\u0015\u0006\u0017" + - "\u0028\u0029\u002A\u002B\u002C\t\n\u001B" + - "\u0030\u0031\u001A\u0033\u0034\u0035\u0036\b" + - "\u0038\u0039\u003A\u003B\u0004\u0014\u003E\u00FF" + - "\u0074\u0000\u004A\u00B1\u009F\u00B2\u006A\u00B5" + - "\u00BD\u00B4\u0000\u008A\u005F\u00CA\u00AF\u0000" + - "\u0090\u008F\u00EA\u00FA\u00BE\u00A0\u00B6\u0000" + - "\u009D\u00DA\u0000\u008B\u00B7\u00B8\u00B9\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00BF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00E1" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048" + - "\u0049\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u0071\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0078\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00B3\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00BC\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 248, 248, 248, 248, 296, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 531, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM500.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM500.java deleted file mode 100644 index a6e08103bd0..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM500.java +++ /dev/null @@ -1,221 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM500 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM500() { - super("IBM500", ExtendedCharsets.aliasesFor("IBM500")); - } - - public String historicalName() { - return "Cp500"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM500); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - protected static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87 - "\u0068\u0069\u00AB\u00BB\u00F0\u00FD\u00FE\u00B1" + // 0x88 - 0x8F - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97 - "\u0071\u0072\u00AA\u00BA\u00E6\u00B8\u00C6\u00A4" + // 0x98 - 0x9F - "\u00B5\u007E\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xA0 - 0xA7 - "\u0079\u007A\u00A1\u00BF\u00D0\u00DD\u00DE\u00AE" + // 0xA8 - 0xAF - "\u00A2\u00A3\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC" + // 0xB0 - 0xB7 - "\u00BD\u00BE\u00AC\u007C\u00AF\u00A8\u00B4\u00D7" + // 0xB8 - 0xBF - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xC0 - 0xC7 - "\u0048\u0049\u00AD\u00F4\u00F6\u00F2\u00F3\u00F5" + // 0xC8 - 0xCF - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xD0 - 0xD7 - "\u0051\u0052\u00B9\u00FB\u00FC\u00F9\u00FA\u00FF" + // 0xD8 - 0xDF - "\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xE0 - 0xE7 - "\u0059\u005A\u00B2\u00D4\u00D6\u00D2\u00D3\u00D5" + // 0xE8 - 0xEF - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xF0 - 0xF7 - "\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07 - "\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17 - "\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27 - "\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2F - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37 - "\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3F - "\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u00E5" + // 0x40 - 0x47 - "\u00E7\u00F1\u005B\u002E\u003C\u0028\u002B\u0021" + // 0x48 - 0x4F - "\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF" + // 0x50 - 0x57 - "\u00EC\u00DF\u005D\u0024\u002A\u0029\u003B\u005E" + // 0x58 - 0x5F - "\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5" + // 0x60 - 0x67 - "\u00C7\u00D1\u00A6\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6F - "\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF" + // 0x70 - 0x77 - "\u00CC\u0060\u003A\u0023\u0040\'\u003D\""; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0037\u002D\u002E\u002F" + - "\u0016\u0005\u0015\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u003C\u003D\u0032\u0026" + - "\u0018\u0019\u003F\'\u001C\u001D\u001E\u001F" + - "\u0040\u004F\u007F\u007B\u005B\u006C\u0050\u007D" + - "\u004D\u005D\\\u004E\u006B\u0060\u004B\u0061" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u007A\u005E\u004C\u007E\u006E\u006F" + - "\u007C\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6" + - "\u00D7\u00D8\u00D9\u00E2\u00E3\u00E4\u00E5\u00E6" + - "\u00E7\u00E8\u00E9\u004A\u00E0\u005A\u005F\u006D" + - "\u0079\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u0091\u0092\u0093\u0094\u0095\u0096" + - "\u0097\u0098\u0099\u00A2\u00A3\u00A4\u00A5\u00A6" + - "\u00A7\u00A8\u00A9\u00C0\u00BB\u00D0\u00A1\u0007" + - "\u0020\u0021\"\u0023\u0024\u0015\u0006\u0017" + - "\u0028\u0029\u002A\u002B\u002C\t\n\u001B" + - "\u0030\u0031\u001A\u0033\u0034\u0035\u0036\b" + - "\u0038\u0039\u003A\u003B\u0004\u0014\u003E\u00FF" + - "\u0041\u00AA\u00B0\u00B1\u009F\u00B2\u006A\u00B5" + - "\u00BD\u00B4\u009A\u008A\u00BA\u00CA\u00AF\u00BC" + - "\u0090\u008F\u00EA\u00FA\u00BE\u00A0\u00B6\u00B3" + - "\u009D\u00DA\u009B\u008B\u00B7\u00B8\u00B9\u00AB" + - "\u0064\u0065\u0062\u0066\u0063\u0067\u009E\u0068" + - "\u0074\u0071\u0072\u0073\u0078\u0075\u0076\u0077" + - "\u00AC\u0069\u00ED\u00EE\u00EB\u00EF\u00EC\u00BF" + - "\u0080\u00FD\u00FE\u00FB\u00FC\u00AD\u00AE\u0059" + - "\u0044\u0045\u0042\u0046\u0043\u0047\u009C\u0048" + - "\u0054\u0051\u0052\u0053\u0058\u0055\u0056\u0057" + - "\u008C\u0049\u00CD\u00CE\u00CB\u00CF\u00CC\u00E1" + - "\u0070\u00DD\u00DE\u00DB\u00DC\u008D\u008E\u00DF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM838.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM838.java deleted file mode 100644 index 4c2f9f67c2e..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM838.java +++ /dev/null @@ -1,243 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM838 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM838() { - super("IBM-Thai", ExtendedCharsets.aliasesFor("IBM-Thai")); - } - - public String historicalName() { - return "Cp838"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM838); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u0E4F\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87 - "\u0068\u0069\u0E1D\u0E1E\u0E1F\u0E20\u0E21\u0E22" + // 0x88 - 0x8F - "\u0E5A\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97 - "\u0071\u0072\u0E23\u0E24\u0E25\u0E26\u0E27\u0E28" + // 0x98 - 0x9F - "\u0E5B\u007E\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xA0 - 0xA7 - "\u0079\u007A\u0E29\u0E2A\u0E2B\u0E2C\u0E2D\u0E2E" + // 0xA8 - 0xAF - "\u0E50\u0E51\u0E52\u0E53\u0E54\u0E55\u0E56\u0E57" + // 0xB0 - 0xB7 - "\u0E58\u0E59\u0E2F\u0E30\u0E31\u0E32\u0E33\u0E34" + // 0xB8 - 0xBF - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xC0 - 0xC7 - "\u0048\u0049\u0E49\u0E35\u0E36\u0E37\u0E38\u0E39" + // 0xC8 - 0xCF - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xD0 - 0xD7 - "\u0051\u0052\u0E3A\u0E40\u0E41\u0E42\u0E43\u0E44" + // 0xD8 - 0xDF - "\\\u0E4A\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xE0 - 0xE7 - "\u0059\u005A\u0E45\u0E46\u0E47\u0E48\u0E49\u0E4A" + // 0xE8 - 0xEF - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xF0 - 0xF7 - "\u0038\u0039\u0E4B\u0E4C\u0E4D\u0E4B\u0E4C\u009F" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07 - "\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17 - "\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27 - "\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2F - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37 - "\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3F - "\u0020\u00A0\u0E01\u0E02\u0E03\u0E04\u0E05\u0E06" + // 0x40 - 0x47 - "\u0E07\u005B\u00A2\u002E\u003C\u0028\u002B\u007C" + // 0x48 - 0x4F - "\u0026\u0E48\u0E08\u0E09\u0E0A\u0E0B\u0E0C\u0E0D" + // 0x50 - 0x57 - "\u0E0E\u005D\u0021\u0024\u002A\u0029\u003B\u00AC" + // 0x58 - 0x5F - "\u002D\u002F\u0E0F\u0E10\u0E11\u0E12\u0E13\u0E14" + // 0x60 - 0x67 - "\u0E15\u005E\u00A6\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6F - "\u0E3F\u0E4E\u0E16\u0E17\u0E18\u0E19\u0E1A\u0E1B" + // 0x70 - 0x77 - "\u0E1C\u0060\u003A\u0023\u0040\'\u003D\""; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0037\u002D\u002E\u002F" + - "\u0016\u0005\u0015\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u003C\u003D\u0032\u0026" + - "\u0018\u0019\u003F\'\u001C\u001D\u001E\u001F" + - "\u0040\u005A\u007F\u007B\u005B\u006C\u0050\u007D" + - "\u004D\u005D\\\u004E\u006B\u0060\u004B\u0061" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u007A\u005E\u004C\u007E\u006E\u006F" + - "\u007C\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6" + - "\u00D7\u00D8\u00D9\u00E2\u00E3\u00E4\u00E5\u00E6" + - "\u00E7\u00E8\u00E9\u0049\u00E0\u0059\u0069\u006D" + - "\u0079\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u0091\u0092\u0093\u0094\u0095\u0096" + - "\u0097\u0098\u0099\u00A2\u00A3\u00A4\u00A5\u00A6" + - "\u00A7\u00A8\u00A9\u00C0\u004F\u00D0\u00A1\u0007" + - "\u0020\u0021\"\u0023\u0024\u0015\u0006\u0017" + - "\u0028\u0029\u002A\u002B\u002C\t\n\u001B" + - "\u0030\u0031\u001A\u0033\u0034\u0035\u0036\b" + - "\u0038\u0039\u003A\u003B\u0004\u0014\u003E\u00FF" + - "\u0041\u0000\u004A\u0000\u0000\u0000\u006A\u0000" + - "\u0000\u0000\u0000\u0000\u005F\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0042\u0043\u0044" + - "\u0045\u0046\u0047\u0048\u0052\u0053\u0054\u0055" + - "\u0056\u0057\u0058\u0062\u0063\u0064\u0065\u0066" + - "\u0067\u0068\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u008A\u008B\u008C\u008D\u008E\u008F\u009A" + - "\u009B\u009C\u009D\u009E\u009F\u00AA\u00AB\u00AC" + - "\u00AD\u00AE\u00AF\u00BA\u00BB\u00BC\u00BD\u00BE" + - "\u00BF\u00CB\u00CC\u00CD\u00CE\u00CF\u00DA\u0000" + - "\u0000\u0000\u0000\u0070\u00DB\u00DC\u00DD\u00DE" + - "\u00DF\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF\u00FA" + - "\u00FB\u00FC\u0071\u0080\u00B0\u00B1\u00B2\u00B3" + - "\u00B4\u00B5\u00B6\u00B7\u00B8\u00B9\u0090\u00A0" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 428, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM856.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM856.java deleted file mode 100644 index 99280a4b22f..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM856.java +++ /dev/null @@ -1,288 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM856 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM856() { - super("x-IBM856", ExtendedCharsets.aliasesFor("x-IBM856")); - } - - public String historicalName() { - return "Cp856"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM856); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u05D0\u05D1\u05D2\u05D3\u05D4\u05D5\u05D6\u05D7" + // 0x80 - 0x87 - "\u05D8\u05D9\u05DA\u05DB\u05DC\u05DD\u05DE\u05DF" + // 0x88 - 0x8F - "\u05E0\u05E1\u05E2\u05E3\u05E4\u05E5\u05E6\u05E7" + // 0x90 - 0x97 - "\u05E8\u05E9\u05EA\uFFFD\u00A3\uFFFD\u00D7\uFFFD" + // 0x98 - 0x9F - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xA0 - 0xA7 - "\uFFFD\u00AE\u00AC\u00BD\u00BC\uFFFD\u00AB\u00BB" + // 0xA8 - 0xAF - "\u2591\u2592\u2593\u2502\u2524\uFFFD\uFFFD\uFFFD" + // 0xB0 - 0xB7 - "\u00A9\u2563\u2551\u2557\u255D\u00A2\u00A5\u2510" + // 0xB8 - 0xBF - "\u2514\u2534\u252C\u251C\u2500\u253C\uFFFD\uFFFD" + // 0xC0 - 0xC7 - "\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u00A4" + // 0xC8 - 0xCF - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xD0 - 0xD7 - "\uFFFD\u2518\u250C\u2588\u2584\u00A6\uFFFD\u2580" + // 0xD8 - 0xDF - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u00B5\uFFFD" + // 0xE0 - 0xE7 - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u203E\u00B4" + // 0xE8 - 0xEF - "\u00AD\u00B1\u2017\u00BE\u00B6\u00A7\u00F7\u00B8" + // 0xF0 - 0xF7 - "\u00B0\u00A8\u2022\u00B9\u00B3\u00B2\u25A0\u00A0" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00FF\u0000\u00BD\u009C\u00CF\u00BE\u00DD\u00F5" + - "\u00F9\u00B8\u0000\u00AE\u00AA\u00F0\u00A9\u0000" + - "\u00F8\u00F1\u00FD\u00FC\u00EF\u00E6\u00F4\u0000" + - "\u00F7\u00FB\u0000\u00AF\u00AC\u00AB\u00F3\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u009E" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00F6" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097" + - "\u0098\u0099\u009A\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00F2\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00FA\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00EE\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00C4\u0000\u00B3\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00DA" + - "\u0000\u0000\u0000\u00BF\u0000\u0000\u0000\u00C0" + - "\u0000\u0000\u0000\u00D9\u0000\u0000\u0000\u00C3" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00B4" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00C2" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00C1" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00C5" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00CD\u00BA\u0000\u0000\u00C9" + - "\u0000\u0000\u00BB\u0000\u0000\u00C8\u0000\u0000" + - "\u00BC\u0000\u0000\u00CC\u0000\u0000\u00B9\u0000" + - "\u0000\u00CB\u0000\u0000\u00CA\u0000\u0000\u00CE" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00DF\u0000\u0000\u0000\u00DC" + - "\u0000\u0000\u0000\u00DB\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00B0\u00B1\u00B2\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00FE\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 248, 248, 248, 248, 296, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 531, 248, 248, 248, 248, 787, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM860.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM860.java deleted file mode 100644 index 0aaa06c6d1b..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM860.java +++ /dev/null @@ -1,348 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM860 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM860() { - super("IBM860", ExtendedCharsets.aliasesFor("IBM860")); - } - - public String historicalName() { - return "Cp860"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM860); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u00C7\u00FC\u00E9\u00E2\u00E3\u00E0\u00C1\u00E7" + // 0x80 - 0x87 - "\u00EA\u00CA\u00E8\u00CD\u00D4\u00EC\u00C3\u00C2" + // 0x88 - 0x8F - "\u00C9\u00C0\u00C8\u00F4\u00F5\u00F2\u00DA\u00F9" + // 0x90 - 0x97 - "\u00CC\u00D5\u00DC\u00A2\u00A3\u00D9\u20A7\u00D3" + // 0x98 - 0x9F - "\u00E1\u00ED\u00F3\u00FA\u00F1\u00D1\u00AA\u00BA" + // 0xA0 - 0xA7 - "\u00BF\u00D2\u00AC\u00BD\u00BC\u00A1\u00AB\u00BB" + // 0xA8 - 0xAF - "\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556" + // 0xB0 - 0xB7 - "\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510" + // 0xB8 - 0xBF - "\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F" + // 0xC0 - 0xC7 - "\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567" + // 0xC8 - 0xCF - "\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B" + // 0xD0 - 0xD7 - "\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580" + // 0xD8 - 0xDF - "\u03B1\u00DF\u0393\u03C0\u03A3\u03C3\u00B5\u03C4" + // 0xE0 - 0xE7 - "\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229" + // 0xE8 - 0xEF - "\u2261\u00B1\u2265\u2264\u2320\u2321\u00F7\u2248" + // 0xF0 - 0xF7 - "\u00B0\u2219\u00B7\u221A\u207F\u00B2\u25A0\u00A0" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00FF\u00AD\u009B\u009C\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00A6\u00AE\u00AA\u0000\u0000\u0000" + - "\u00F8\u00F1\u00FD\u0000\u0000\u00E6\u0000\u00FA" + - "\u0000\u0000\u00A7\u00AF\u00AC\u00AB\u0000\u00A8" + - "\u0091\u0086\u008F\u008E\u0000\u0000\u0000\u0080" + - "\u0092\u0090\u0089\u0000\u0098\u008B\u0000\u0000" + - "\u0000\u00A5\u00A9\u009F\u008C\u0099\u0000\u0000" + - "\u0000\u009D\u0096\u0000\u009A\u0000\u0000\u00E1" + - "\u0085\u00A0\u0083\u0084\u0000\u0000\u0000\u0087" + - "\u008A\u0082\u0088\u0000\u008D\u00A1\u0000\u0000" + - "\u0000\u00A4\u0095\u00A2\u0093\u0094\u0000\u00F6" + - "\u0000\u0097\u00A3\u0000\u0081\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00E2\u0000\u0000" + - "\u0000\u0000\u00E9\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00E4\u0000\u0000" + - "\u00E8\u0000\u0000\u00EA\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00E0\u0000\u0000\u00EB\u00EE" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00E3\u0000\u0000\u00E5\u00E7\u0000" + - "\u00ED\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00FC\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u009E\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00F9\u00FB\u0000\u0000\u0000\u00EC\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00EF\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00F7\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00F0\u0000\u0000\u00F3\u00F2\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00F4\u00F5\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00C4\u0000\u00B3\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00DA\u0000\u0000\u0000" + - "\u00BF\u0000\u0000\u0000\u00C0\u0000\u0000\u0000" + - "\u00D9\u0000\u0000\u0000\u00C3\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00B4\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00C2\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00C1\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00C5\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00CD\u00BA\u00D5\u00D6\u00C9\u00B8\u00B7\u00BB" + - "\u00D4\u00D3\u00C8\u00BE\u00BD\u00BC\u00C6\u00C7" + - "\u00CC\u00B5\u00B6\u00B9\u00D1\u00D2\u00CB\u00CF" + - "\u00D0\u00CA\u00D8\u00D7\u00CE\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00DF\u0000\u0000\u0000\u00DC\u0000\u0000\u0000" + - "\u00DB\u0000\u0000\u0000\u00DD\u0000\u0000\u0000" + - "\u00DE\u00B0\u00B1\u00B2\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00FE\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 253, 253, 362, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 561, 253, 792, 1016, 253, 1272, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM861.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM861.java deleted file mode 100644 index 018d2e4252b..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM861.java +++ /dev/null @@ -1,369 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM861 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM861() { - super("IBM861", ExtendedCharsets.aliasesFor("IBM861")); - } - - public String historicalName() { - return "Cp861"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM861); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u00C7\u00FC\u00E9\u00E2\u00E4\u00E0\u00E5\u00E7" + // 0x80 - 0x87 - "\u00EA\u00EB\u00E8\u00D0\u00F0\u00DE\u00C4\u00C5" + // 0x88 - 0x8F - "\u00C9\u00E6\u00C6\u00F4\u00F6\u00FE\u00FB\u00DD" + // 0x90 - 0x97 - "\u00FD\u00D6\u00DC\u00F8\u00A3\u00D8\u20A7\u0192" + // 0x98 - 0x9F - "\u00E1\u00ED\u00F3\u00FA\u00C1\u00CD\u00D3\u00DA" + // 0xA0 - 0xA7 - "\u00BF\u2310\u00AC\u00BD\u00BC\u00A1\u00AB\u00BB" + // 0xA8 - 0xAF - "\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556" + // 0xB0 - 0xB7 - "\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510" + // 0xB8 - 0xBF - "\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F" + // 0xC0 - 0xC7 - "\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567" + // 0xC8 - 0xCF - "\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B" + // 0xD0 - 0xD7 - "\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580" + // 0xD8 - 0xDF - "\u03B1\u00DF\u0393\u03C0\u03A3\u03C3\u00B5\u03C4" + // 0xE0 - 0xE7 - "\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229" + // 0xE8 - 0xEF - "\u2261\u00B1\u2265\u2264\u2320\u2321\u00F7\u2248" + // 0xF0 - 0xF7 - "\u00B0\u2219\u00B7\u221A\u207F\u00B2\u25A0\u00A0" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00FF\u00AD\u0000\u009C\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00AE\u00AA\u0000\u0000\u0000" + - "\u00F8\u00F1\u00FD\u0000\u0000\u00E6\u0000\u00FA" + - "\u0000\u0000\u0000\u00AF\u00AC\u00AB\u0000\u00A8" + - "\u0000\u00A4\u0000\u0000\u008E\u008F\u0092\u0080" + - "\u0000\u0090\u0000\u0000\u0000\u00A5\u0000\u0000" + - "\u008B\u0000\u0000\u00A6\u0000\u0000\u0099\u0000" + - "\u009D\u0000\u00A7\u0000\u009A\u0097\u008D\u00E1" + - "\u0085\u00A0\u0083\u0000\u0084\u0086\u0091\u0087" + - "\u008A\u0082\u0088\u0089\u0000\u00A1\u0000\u0000" + - "\u008C\u0000\u0000\u00A2\u0093\u0000\u0094\u00F6" + - "\u009B\u0000\u00A3\u0096\u0081\u0098\u0095\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u009F\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00E2\u0000\u0000\u0000\u0000\u00E9" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00E4\u0000\u0000\u00E8\u0000\u0000" + - "\u00EA\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00E0\u0000\u0000\u00EB\u00EE\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00E3" + - "\u0000\u0000\u00E5\u00E7\u0000\u00ED\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00FC\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u009E\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00F9\u00FB" + - "\u0000\u0000\u0000\u00EC\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00EF\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00F7\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00F0\u0000" + - "\u0000\u00F3\u00F2\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00A9\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00F4\u00F5\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00C4\u0000\u00B3" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00DA\u0000\u0000\u0000\u00BF\u0000\u0000" + - "\u0000\u00C0\u0000\u0000\u0000\u00D9\u0000\u0000" + - "\u0000\u00C3\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00B4\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00C2\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00C1\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00C5\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00CD\u00BA\u00D5" + - "\u00D6\u00C9\u00B8\u00B7\u00BB\u00D4\u00D3\u00C8" + - "\u00BE\u00BD\u00BC\u00C6\u00C7\u00CC\u00B5\u00B6" + - "\u00B9\u00D1\u00D2\u00CB\u00CF\u00D0\u00CA\u00D8" + - "\u00D7\u00CE\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00DF\u0000\u0000" + - "\u0000\u00DC\u0000\u0000\u0000\u00DB\u0000\u0000" + - "\u0000\u00DD\u0000\u0000\u0000\u00DE\u00B0\u00B1" + - "\u00B2\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00FE\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 255, 402, 511, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, - 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, - 710, 402, 941, 1181, 402, 1437, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, - 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, - 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, - 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, - 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, - 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, - 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, - 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, - 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, - 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, - 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, - 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, - 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, - 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, 402, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM863.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM863.java deleted file mode 100644 index 32c9d1b298e..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM863.java +++ /dev/null @@ -1,373 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM863 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM863() { - super("IBM863", ExtendedCharsets.aliasesFor("IBM863")); - } - - public String historicalName() { - return "Cp863"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM863); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u00C7\u00FC\u00E9\u00E2\u00C2\u00E0\u00B6\u00E7" + // 0x80 - 0x87 - "\u00EA\u00EB\u00E8\u00EF\u00EE\u2017\u00C0\u00A7" + // 0x88 - 0x8F - "\u00C9\u00C8\u00CA\u00F4\u00CB\u00CF\u00FB\u00F9" + // 0x90 - 0x97 - "\u00A4\u00D4\u00DC\u00A2\u00A3\u00D9\u00DB\u0192" + // 0x98 - 0x9F - "\u00A6\u00B4\u00F3\u00FA\u00A8\u00B8\u00B3\u00AF" + // 0xA0 - 0xA7 - "\u00CE\u2310\u00AC\u00BD\u00BC\u00BE\u00AB\u00BB" + // 0xA8 - 0xAF - "\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556" + // 0xB0 - 0xB7 - "\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510" + // 0xB8 - 0xBF - "\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F" + // 0xC0 - 0xC7 - "\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567" + // 0xC8 - 0xCF - "\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B" + // 0xD0 - 0xD7 - "\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580" + // 0xD8 - 0xDF - "\u03B1\u00DF\u0393\u03C0\u03A3\u03C3\u00B5\u03C4" + // 0xE0 - 0xE7 - "\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229" + // 0xE8 - 0xEF - "\u2261\u00B1\u2265\u2264\u2320\u2321\u00F7\u2248" + // 0xF0 - 0xF7 - "\u00B0\u2219\u00B7\u221A\u207F\u00B2\u25A0\u00A0" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00FF\u0000\u009B\u009C\u0098\u0000\u00A0\u008F" + - "\u00A4\u0000\u0000\u00AE\u00AA\u0000\u0000\u00A7" + - "\u00F8\u00F1\u00FD\u00A6\u00A1\u00E6\u0086\u00FA" + - "\u00A5\u0000\u0000\u00AF\u00AC\u00AB\u00AD\u0000" + - "\u008E\u0000\u0084\u0000\u0000\u0000\u0000\u0080" + - "\u0091\u0090\u0092\u0094\u0000\u0000\u00A8\u0095" + - "\u0000\u0000\u0000\u0000\u0099\u0000\u0000\u0000" + - "\u0000\u009D\u0000\u009E\u009A\u0000\u0000\u00E1" + - "\u0085\u0000\u0083\u0000\u0000\u0000\u0000\u0087" + - "\u008A\u0082\u0088\u0089\u0000\u0000\u008C\u008B" + - "\u0000\u0000\u0000\u00A2\u0093\u0000\u0000\u00F6" + - "\u0000\u0097\u00A3\u0096\u0081\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u009F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00E2\u0000\u0000\u0000\u0000\u00E9\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00E4\u0000\u0000\u00E8\u0000\u0000\u00EA\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00E0\u0000" + - "\u0000\u00EB\u00EE\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00E3\u0000\u0000" + - "\u00E5\u00E7\u0000\u00ED\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u008D\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00FC\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00F9\u00FB" + - "\u0000\u0000\u0000\u00EC\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00EF\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00F7\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00F0\u0000" + - "\u0000\u00F3\u00F2\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00A9\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00F4\u00F5\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00C4\u0000\u00B3" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00DA\u0000\u0000\u0000\u00BF\u0000\u0000" + - "\u0000\u00C0\u0000\u0000\u0000\u00D9\u0000\u0000" + - "\u0000\u00C3\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00B4\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00C2\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00C1\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00C5\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00CD\u00BA\u00D5" + - "\u00D6\u00C9\u00B8\u00B7\u00BB\u00D4\u00D3\u00C8" + - "\u00BE\u00BD\u00BC\u00C6\u00C7\u00CC\u00B5\u00B6" + - "\u00B9\u00D1\u00D2\u00CB\u00CF\u00D0\u00CA\u00D8" + - "\u00D7\u00CE\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00DF\u0000\u0000" + - "\u0000\u00DC\u0000\u0000\u0000\u00DB\u0000\u0000" + - "\u0000\u00DD\u0000\u0000\u0000\u00DE\u00B0\u00B1" + - "\u00B2\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00FE\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 253, 400, 509, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 742, 400, 973, 1213, 400, 1469, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM864.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM864.java deleted file mode 100644 index acfa0670ea7..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM864.java +++ /dev/null @@ -1,342 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM864 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM864() { - super("IBM864", ExtendedCharsets.aliasesFor("IBM864")); - } - - public String historicalName() { - return "Cp864"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM864); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u00B0\u00B7\u2219\u221A\u2592\u2500\u2502\u253C" + // 0x80 - 0x87 - "\u2524\u252C\u251C\u2534\u2510\u250C\u2514\u2518" + // 0x88 - 0x8F - "\u03B2\u221E\u03C6\u00B1\u00BD\u00BC\u2248\u00AB" + // 0x90 - 0x97 - "\u00BB\uFEF7\uFEF8\uFFFD\uFFFD\uFEFB\uFEFC\uFFFD" + // 0x98 - 0x9F - "\u00A0\u00AD\uFE82\u00A3\u00A4\uFE84\uFFFD\uFFFD" + // 0xA0 - 0xA7 - "\uFE8E\uFE8F\uFE95\uFE99\u060C\uFE9D\uFEA1\uFEA5" + // 0xA8 - 0xAF - "\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667" + // 0xB0 - 0xB7 - "\u0668\u0669\uFED1\u061B\uFEB1\uFEB5\uFEB9\u061F" + // 0xB8 - 0xBF - "\u00A2\uFE80\uFE81\uFE83\uFE85\uFECA\uFE8B\uFE8D" + // 0xC0 - 0xC7 - "\uFE91\uFE93\uFE97\uFE9B\uFE9F\uFEA3\uFEA7\uFEA9" + // 0xC8 - 0xCF - "\uFEAB\uFEAD\uFEAF\uFEB3\uFEB7\uFEBB\uFEBF\uFEC1" + // 0xD0 - 0xD7 - "\uFEC5\uFECB\uFECF\u00A6\u00AC\u00F7\u00D7\uFEC9" + // 0xD8 - 0xDF - "\u0640\uFED3\uFED7\uFEDB\uFEDF\uFEE3\uFEE7\uFEEB" + // 0xE0 - 0xE7 - "\uFEED\uFEEF\uFEF3\uFEBD\uFECC\uFECE\uFECD\uFEE1" + // 0xE8 - 0xEF - "\uFE7D\u0651\uFEE5\uFEE9\uFEEC\uFEF0\uFEF2\uFED0" + // 0xF0 - 0xF7 - "\uFED5\uFEF5\uFEF6\uFEDD\uFED9\uFEF1\u25A0\uFFFD" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u066A\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0000\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00A0\u0000\u00C0\u00A3\u00A4\u0000\u00DB\u0000" + - "\u0000\u0000\u0000\u0097\u00DC\u00A1\u0000\u0000" + - "\u0080\u0093\u0000\u0000\u0000\u0000\u0000\u0081" + - "\u0000\u0000\u0000\u0098\u0095\u0094\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00DE" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00DD" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0090\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0092\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00AC\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00BB\u0000\u0000" + - "\u0000\u00BF\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00E0\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00F1\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5" + - "\u00B6\u00B7\u00B8\u00B9\u0025\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0082\u0083\u0000\u0000\u0000\u0091" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0096\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0085\u0000\u0086\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u008D\u0000\u0000" + - "\u0000\u008C\u0000\u0000\u0000\u008E\u0000\u0000" + - "\u0000\u008F\u0000\u0000\u0000\u008A\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0088\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0089\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u008B\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0087\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0084\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00FE\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00F0" + - "\u0000\u0000\u00C1\u00C2\u00A2\u00C3\u00A5\u00C4" + - "\u0000\u0000\u0000\u0000\u0000\u00C6\u0000\u00C7" + - "\u00A8\u00A9\u0000\u00C8\u0000\u00C9\u0000\u00AA" + - "\u0000\u00CA\u0000\u00AB\u0000\u00CB\u0000\u00AD" + - "\u0000\u00CC\u0000\u00AE\u0000\u00CD\u0000\u00AF" + - "\u0000\u00CE\u0000\u00CF\u0000\u00D0\u0000\u00D1" + - "\u0000\u00D2\u0000\u00BC\u0000\u00D3\u0000\u00BD" + - "\u0000\u00D4\u0000\u00BE\u0000\u00D5\u0000\u00EB" + - "\u0000\u00D6\u0000\u00D7\u0000\u0000\u0000\u00D8" + - "\u0000\u0000\u0000\u00DF\u00C5\u00D9\u00EC\u00EE" + - "\u00ED\u00DA\u00F7\u00BA\u0000\u00E1\u0000\u00F8" + - "\u0000\u00E2\u0000\u00FC\u0000\u00E3\u0000\u00FB" + - "\u0000\u00E4\u0000\u00EF\u0000\u00E5\u0000\u00F2" + - "\u0000\u00E6\u0000\u00F3\u0000\u00E7\u00F4\u00E8" + - "\u0000\u00E9\u00F5\u00FD\u00F6\u00EA\u0000\u00F9" + - "\u00FA\u0099\u009A\u0000\u0000\u009D\u009E\u0000" + - "\u0000\u0000"; - - private final static short index1[] = { - 0, 248, 248, 326, 248, 248, 570, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 801, 248, 248, 1057, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 1218, 248, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM865.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM865.java deleted file mode 100644 index 01a45a89a5c..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM865.java +++ /dev/null @@ -1,369 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM865 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM865() { - super("IBM865", ExtendedCharsets.aliasesFor("IBM865")); - } - - public String historicalName() { - return "Cp865"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM865); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u00C7\u00FC\u00E9\u00E2\u00E4\u00E0\u00E5\u00E7" + // 0x80 - 0x87 - "\u00EA\u00EB\u00E8\u00EF\u00EE\u00EC\u00C4\u00C5" + // 0x88 - 0x8F - "\u00C9\u00E6\u00C6\u00F4\u00F6\u00F2\u00FB\u00F9" + // 0x90 - 0x97 - "\u00FF\u00D6\u00DC\u00F8\u00A3\u00D8\u20A7\u0192" + // 0x98 - 0x9F - "\u00E1\u00ED\u00F3\u00FA\u00F1\u00D1\u00AA\u00BA" + // 0xA0 - 0xA7 - "\u00BF\u2310\u00AC\u00BD\u00BC\u00A1\u00AB\u00A4" + // 0xA8 - 0xAF - "\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556" + // 0xB0 - 0xB7 - "\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510" + // 0xB8 - 0xBF - "\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F" + // 0xC0 - 0xC7 - "\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567" + // 0xC8 - 0xCF - "\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B" + // 0xD0 - 0xD7 - "\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580" + // 0xD8 - 0xDF - "\u03B1\u00DF\u0393\u03C0\u03A3\u03C3\u00B5\u03C4" + // 0xE0 - 0xE7 - "\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229" + // 0xE8 - 0xEF - "\u2261\u00B1\u2265\u2264\u2320\u2321\u00F7\u2248" + // 0xF0 - 0xF7 - "\u00B0\u2219\u00B7\u221A\u207F\u00B2\u25A0\u00A0" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00FF\u00AD\u0000\u009C\u00AF\u0000\u0000\u0000" + - "\u0000\u0000\u00A6\u00AE\u00AA\u0000\u0000\u0000" + - "\u00F8\u00F1\u00FD\u0000\u0000\u00E6\u0000\u00FA" + - "\u0000\u0000\u00A7\u0000\u00AC\u00AB\u0000\u00A8" + - "\u0000\u0000\u0000\u0000\u008E\u008F\u0092\u0080" + - "\u0000\u0090\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00A5\u0000\u0000\u0000\u0000\u0099\u0000" + - "\u009D\u0000\u0000\u0000\u009A\u0000\u0000\u00E1" + - "\u0085\u00A0\u0083\u0000\u0084\u0086\u0091\u0087" + - "\u008A\u0082\u0088\u0089\u008D\u00A1\u008C\u008B" + - "\u0000\u00A4\u0095\u00A2\u0093\u0000\u0094\u00F6" + - "\u009B\u0097\u00A3\u0096\u0081\u0000\u0000\u0098" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u009F\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00E2\u0000\u0000\u0000\u0000" + - "\u00E9\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00E4\u0000\u0000\u00E8\u0000" + - "\u0000\u00EA\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00E0\u0000\u0000\u00EB\u00EE\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00E3\u0000\u0000\u00E5\u00E7\u0000\u00ED\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00FC\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u009E\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00F9" + - "\u00FB\u0000\u0000\u0000\u00EC\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00EF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00F7\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00F0" + - "\u0000\u0000\u00F3\u00F2\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00A9\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00F4\u00F5" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00C4\u0000" + - "\u00B3\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00DA\u0000\u0000\u0000\u00BF\u0000" + - "\u0000\u0000\u00C0\u0000\u0000\u0000\u00D9\u0000" + - "\u0000\u0000\u00C3\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00B4\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00C2\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00C1\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00C5\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00CD\u00BA" + - "\u00D5\u00D6\u00C9\u00B8\u00B7\u00BB\u00D4\u00D3" + - "\u00C8\u00BE\u00BD\u00BC\u00C6\u00C7\u00CC\u00B5" + - "\u00B6\u00B9\u00D1\u00D2\u00CB\u00CF\u00D0\u00CA" + - "\u00D8\u00D7\u00CE\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00DF\u0000" + - "\u0000\u0000\u00DC\u0000\u0000\u0000\u00DB\u0000" + - "\u0000\u0000\u00DD\u0000\u0000\u0000\u00DE\u00B0" + - "\u00B1\u00B2\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00FE\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 403, 512, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 711, 403, 942, 1182, 403, 1438, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM868.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM868.java deleted file mode 100644 index c3e0a32b933..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM868.java +++ /dev/null @@ -1,359 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM868 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM868() { - super("IBM868", ExtendedCharsets.aliasesFor("IBM868")); - } - - public String historicalName() { - return "Cp868"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM868); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u06F0\u06F1\u06F2\u06F3\u06F4\u06F5\u06F6\u06F7" + // 0x80 - 0x87 - "\u06F8\u06F9\u060C\u061B\u061F\uFE81\uFE8D\uFE8E" + // 0x88 - 0x8F - "\uF8FB\uFE8F\uFE91\uFB56\uFB58\uFE93\uFE95\uFE97" + // 0x90 - 0x97 - "\uFB66\uFB68\uFE99\uFE9B\uFE9D\uFE9F\uFB7A\uFB7C" + // 0x98 - 0x9F - "\uFEA1\uFEA3\uFEA5\uFEA7\uFEA9\uFB88\uFEAB\uFEAD" + // 0xA0 - 0xA7 - "\uFB8C\uFEAF\uFB8A\uFEB1\uFEB3\uFEB5\u00AB\u00BB" + // 0xA8 - 0xAF - "\u2591\u2592\u2593\u2502\u2524\uFEB7\uFEB9\uFEBB" + // 0xB0 - 0xB7 - "\uFEBD\u2563\u2551\u2557\u255D\uFEBF\uFEC3\u2510" + // 0xB8 - 0xBF - "\u2514\u2534\u252C\u251C\u2500\u253C\uFEC7\uFEC9" + // 0xC0 - 0xC7 - "\u255A\u2554\u2569\u2566\u2560\u2550\u256C\uFECA" + // 0xC8 - 0xCF - "\uFECB\uFECC\uFECD\uFECE\uFECF\uFED0\uFED1\uFED3" + // 0xD0 - 0xD7 - "\uFED5\u2518\u250C\u2588\u2584\uFED7\uFB8E\u2580" + // 0xD8 - 0xDF - "\uFEDB\uFB92\uFB94\uFEDD\uFEDF\uFEE0\uFEE1\uFEE3" + // 0xE0 - 0xE7 - "\uFB9E\uFEE5\uFEE7\uFE85\uFEED\uFBA6\uFBA8\uFBA9" + // 0xE8 - 0xEF - "\u00AD\uFBAA\uFE80\uFE89\uFE8A\uFE8B\uFBFC\uFBFD" + // 0xF0 - 0xF7 - "\uFBFE\uFBB0\uFBAE\uFE7C\uFE7D\uFFFD\u25A0\u00A0" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00FF\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00AE\u0000\u00F0\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00AF\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u008A\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u008B\u0000\u0000\u0000\u008C" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00C4\u0000\u00B3\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00DA\u0000\u0000\u0000" + - "\u00BF\u0000\u0000\u0000\u00C0\u0000\u0000\u0000" + - "\u00D9\u0000\u0000\u0000\u00C3\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00B4\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00C2\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00C1\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00C5\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00CD\u00BA\u0000\u0000\u00C9\u0000\u0000\u00BB" + - "\u0000\u0000\u00C8\u0000\u0000\u00BC\u0000\u0000" + - "\u00CC\u0000\u0000\u00B9\u0000\u0000\u00CB\u0000" + - "\u0000\u00CA\u0000\u0000\u00CE\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00DF\u0000\u0000\u0000\u00DC\u0000\u0000\u0000" + - "\u00DB\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00B0\u00B1\u00B2\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00FE\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0090\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0093\u0000\u0094\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0098\u0000\u0099\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u009E" + - "\u0000\u009F\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00A5\u0000\u00AA" + - "\u0000\u00A8\u0000\u00DE\u0000\u0000\u0000\u00E1" + - "\u0000\u00E2\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00E8\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00ED\u0000\u00EE\u00EF\u00F1" + - "\u0000\u0000\u0000\u00FA\u0000\u00F9\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00F6\u00F7\u00F8\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00FB\u00FC\u0000\u0000\u00F2\u008D\u0000\u0000" + - "\u0000\u00EB\u0000\u0000\u0000\u00F3\u00F4\u00F5" + - "\u0000\u008E\u008F\u0091\u0000\u0092\u0000\u0095" + - "\u0000\u0096\u0000\u0097\u0000\u009A\u0000\u009B" + - "\u0000\u009C\u0000\u009D\u0000\u00A0\u0000\u00A1" + - "\u0000\u00A2\u0000\u00A3\u0000\u00A4\u0000\u00A6" + - "\u0000\u00A7\u0000\u00A9\u0000\u00AB\u0000\u00AC" + - "\u0000\u00AD\u0000\u00B5\u0000\u00B6\u0000\u00B7" + - "\u0000\u00B8\u0000\u00BD\u0000\u0000\u0000\u00BE" + - "\u0000\u0000\u0000\u00C6\u0000\u00C7\u00CF\u00D0" + - "\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u0000\u00D7" + - "\u0000\u00D8\u0000\u00DD\u0000\u0000\u0000\u00E0" + - "\u0000\u00E3\u0000\u00E4\u00E5\u00E6\u0000\u00E7" + - "\u0000\u00E9\u0000\u00EA\u0000\u0000\u0000\u0000" + - "\u0000\u00EC\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 188, 188, 188, 188, 188, 432, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 688, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 849, 188, 188, 1101, 188, 188, 1356, 188, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM869.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM869.java deleted file mode 100644 index d9375265f10..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM869.java +++ /dev/null @@ -1,290 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM869 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM869() { - super("IBM869", ExtendedCharsets.aliasesFor("IBM869")); - } - - public String historicalName() { - return "Cp869"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM869); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u0386\uFFFD" + // 0x80 - 0x87 - "\u00B7\u00AC\u00A6\u2018\u2019\u0388\u2015\u0389" + // 0x88 - 0x8F - "\u038A\u03AA\u038C\uFFFD\uFFFD\u038E\u03AB\u00A9" + // 0x90 - 0x97 - "\u038F\u00B2\u00B3\u03AC\u00A3\u03AD\u03AE\u03AF" + // 0x98 - 0x9F - "\u03CA\u0390\u03CC\u03CD\u0391\u0392\u0393\u0394" + // 0xA0 - 0xA7 - "\u0395\u0396\u0397\u00BD\u0398\u0399\u00AB\u00BB" + // 0xA8 - 0xAF - "\u2591\u2592\u2593\u2502\u2524\u039A\u039B\u039C" + // 0xB0 - 0xB7 - "\u039D\u2563\u2551\u2557\u255D\u039E\u039F\u2510" + // 0xB8 - 0xBF - "\u2514\u2534\u252C\u251C\u2500\u253C\u03A0\u03A1" + // 0xC0 - 0xC7 - "\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u03A3" + // 0xC8 - 0xCF - "\u03A4\u03A5\u03A6\u03A7\u03A8\u03A9\u03B1\u03B2" + // 0xD0 - 0xD7 - "\u03B3\u2518\u250C\u2588\u2584\u03B4\u03B5\u2580" + // 0xD8 - 0xDF - "\u03B6\u03B7\u03B8\u03B9\u03BA\u03BB\u03BC\u03BD" + // 0xE0 - 0xE7 - "\u03BE\u03BF\u03C0\u03C1\u03C3\u03C2\u03C4\u0384" + // 0xE8 - 0xEF - "\u00AD\u00B1\u03C5\u03C6\u03C7\u00A7\u03C8\u0385" + // 0xF0 - 0xF7 - "\u00B0\u00A8\u03C9\u03CB\u03B0\u03CE\u25A0\u00A0" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00FF\u0000\u0000\u009C\u0000\u0000\u008A\u00F5" + - "\u00F9\u0097\u0000\u00AE\u0089\u00F0\u0000\u0000" + - "\u00F8\u00F1\u0099\u009A\u0000\u0000\u0000\u0088" + - "\u0000\u0000\u0000\u00AF\u0000\u00AB\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00EF\u00F7" + - "\u0086\u0000\u008D\u008F\u0090\u0000\u0092\u0000" + - "\u0095\u0098\u00A1\u00A4\u00A5\u00A6\u00A7\u00A8" + - "\u00A9\u00AA\u00AC\u00AD\u00B5\u00B6\u00B7\u00B8" + - "\u00BD\u00BE\u00C6\u00C7\u0000\u00CF\u00D0\u00D1" + - "\u00D2\u00D3\u00D4\u00D5\u0091\u0096\u009B\u009D" + - "\u009E\u009F\u00FC\u00D6\u00D7\u00D8\u00DD\u00DE" + - "\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7" + - "\u00E8\u00E9\u00EA\u00EB\u00ED\u00EC\u00EE\u00F2" + - "\u00F3\u00F4\u00F6\u00FA\u00A0\u00FB\u00A2\u00A3" + - "\u00FD\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u008E\u0000\u0000\u008B\u008C\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00C4\u0000\u00B3" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00DA\u0000\u0000\u0000\u00BF\u0000\u0000" + - "\u0000\u00C0\u0000\u0000\u0000\u00D9\u0000\u0000" + - "\u0000\u00C3\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00B4\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00C2\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00C1\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00C5\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00CD\u00BA\u0000" + - "\u0000\u00C9\u0000\u0000\u00BB\u0000\u0000\u00C8" + - "\u0000\u0000\u00BC\u0000\u0000\u00CC\u0000\u0000" + - "\u00B9\u0000\u0000\u00CB\u0000\u0000\u00CA\u0000" + - "\u0000\u00CE\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00DF\u0000\u0000" + - "\u0000\u00DC\u0000\u0000\u0000\u00DB\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00B0\u00B1" + - "\u00B2\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00FE\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 190, 190, 314, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 549, 190, 190, 190, 190, 805, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM870.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM870.java deleted file mode 100644 index f756a764cee..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM870.java +++ /dev/null @@ -1,244 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM870 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM870() { - super("IBM870", ExtendedCharsets.aliasesFor("IBM870")); - } - - public String historicalName() { - return "Cp870"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM870); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u02D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87 - "\u0068\u0069\u015B\u0148\u0111\u00FD\u0159\u015F" + // 0x88 - 0x8F - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97 - "\u0071\u0072\u0142\u0144\u0161\u00B8\u02DB\u00A4" + // 0x98 - 0x9F - "\u0105\u007E\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xA0 - 0xA7 - "\u0079\u007A\u015A\u0147\u0110\u00DD\u0158\u015E" + // 0xA8 - 0xAF - "\u02D9\u0104\u017C\u0162\u017B\u00A7\u017E\u017A" + // 0xB0 - 0xB7 - "\u017D\u0179\u0141\u0143\u0160\u00A8\u00B4\u00D7" + // 0xB8 - 0xBF - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xC0 - 0xC7 - "\u0048\u0049\u00AD\u00F4\u00F6\u0155\u00F3\u0151" + // 0xC8 - 0xCF - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xD0 - 0xD7 - "\u0051\u0052\u011A\u0171\u00FC\u0165\u00FA\u011B" + // 0xD8 - 0xDF - "\\\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xE0 - 0xE7 - "\u0059\u005A\u010F\u00D4\u00D6\u0154\u00D3\u0150" + // 0xE8 - 0xEF - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xF0 - 0xF7 - "\u0038\u0039\u010E\u0170\u00DC\u0164\u00DA\u009F" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07 - "\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17 - "\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27 - "\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2F - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37 - "\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3F - "\u0020\u00A0\u00E2\u00E4\u0163\u00E1\u0103\u010D" + // 0x40 - 0x47 - "\u00E7\u0107\u005B\u002E\u003C\u0028\u002B\u0021" + // 0x48 - 0x4F - "\u0026\u00E9\u0119\u00EB\u016F\u00ED\u00EE\u013E" + // 0x50 - 0x57 - "\u013A\u00DF\u005D\u0024\u002A\u0029\u003B\u005E" + // 0x58 - 0x5F - "\u002D\u002F\u00C2\u00C4\u02DD\u00C1\u0102\u010C" + // 0x60 - 0x67 - "\u00C7\u0106\u007C\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6F - "\u02C7\u00C9\u0118\u00CB\u016E\u00CD\u00CE\u013D" + // 0x70 - 0x77 - "\u0139\u0060\u003A\u0023\u0040\'\u003D\""; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0037\u002D\u002E\u002F" + - "\u0016\u0005\u0015\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u003C\u003D\u0032\u0026" + - "\u0018\u0019\u003F\'\u001C\u001D\u001E\u001F" + - "\u0040\u004F\u007F\u007B\u005B\u006C\u0050\u007D" + - "\u004D\u005D\\\u004E\u006B\u0060\u004B\u0061" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u007A\u005E\u004C\u007E\u006E\u006F" + - "\u007C\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6" + - "\u00D7\u00D8\u00D9\u00E2\u00E3\u00E4\u00E5\u00E6" + - "\u00E7\u00E8\u00E9\u004A\u00E0\u005A\u005F\u006D" + - "\u0079\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u0091\u0092\u0093\u0094\u0095\u0096" + - "\u0097\u0098\u0099\u00A2\u00A3\u00A4\u00A5\u00A6" + - "\u00A7\u00A8\u00A9\u00C0\u006A\u00D0\u00A1\u0007" + - "\u0020\u0021\"\u0023\u0024\u0015\u0006\u0017" + - "\u0028\u0029\u002A\u002B\u002C\t\n\u001B" + - "\u0030\u0031\u001A\u0033\u0034\u0035\u0036\b" + - "\u0038\u0039\u003A\u003B\u0004\u0014\u003E\u00FF" + - "\u0041\u0000\u0000\u0000\u009F\u0000\u0000\u00B5" + - "\u00BD\u0000\u0000\u0000\u0000\u00CA\u0000\u0000" + - "\u0090\u0000\u0000\u0000\u00BE\u0000\u0000\u0000" + - "\u009D\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0065\u0062\u0000\u0063\u0000\u0000\u0068" + - "\u0000\u0071\u0000\u0073\u0000\u0075\u0076\u0000" + - "\u0000\u0000\u0000\u00EE\u00EB\u0000\u00EC\u00BF" + - "\u0000\u0000\u00FE\u0000\u00FC\u00AD\u0000\u0059" + - "\u0000\u0045\u0042\u0000\u0043\u0000\u0000\u0048" + - "\u0000\u0051\u0000\u0053\u0000\u0055\u0056\u0000" + - "\u0000\u0000\u0000\u00CE\u00CB\u0000\u00CC\u00E1" + - "\u0000\u0000\u00DE\u0000\u00DC\u008D\u0000\u0000" + - "\u0066\u0046\u00B1\u00A0\u0069\u0049\u0000\u0000" + - "\u0000\u0000\u0067\u0047\u00FA\u00EA\u00AC\u008C" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0072\u0052" + - "\u00DA\u00DF\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0078" + - "\u0058\u0000\u0000\u0077\u0057\u0000\u0000\u00BA" + - "\u009A\u00BB\u009B\u0000\u0000\u00AB\u008B\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00EF\u00CF" + - "\u0000\u0000\u00ED\u00CD\u0000\u0000\u00AE\u008E" + - "\u00AA\u008A\u0000\u0000\u00AF\u008F\u00BC\u009C" + - "\u00B3\u0044\u00FD\u00DD\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0074\u0054\u00FB\u00DB" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00B9" + - "\u00B7\u00B4\u00B2\u00B8\u00B6\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0070\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u00B0" + - "\u0000\u009E\u0000\u0064\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 254, 438, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, 381, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM871.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM871.java deleted file mode 100644 index c2c3b96a297..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM871.java +++ /dev/null @@ -1,221 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM871 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM871() { - super("IBM871", ExtendedCharsets.aliasesFor("IBM871")); - } - - public String historicalName() { - return "Cp871"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM871); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - protected static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u00D8\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87 - "\u0068\u0069\u00AB\u00BB\u0060\u00FD\u007B\u00B1" + // 0x88 - 0x8F - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97 - "\u0071\u0072\u00AA\u00BA\u007D\u00B8\u005D\u00A4" + // 0x98 - 0x9F - "\u00B5\u00F6\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xA0 - 0xA7 - "\u0079\u007A\u00A1\u00BF\u0040\u00DD\u005B\u00AE" + // 0xA8 - 0xAF - "\u00A2\u00A3\u00A5\u00B7\u00A9\u00A7\u00B6\u00BC" + // 0xB0 - 0xB7 - "\u00BD\u00BE\u00AC\u007C\u00AF\u00A8\\\u00D7" + // 0xB8 - 0xBF - "\u00FE\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xC0 - 0xC7 - "\u0048\u0049\u00AD\u00F4\u007E\u00F2\u00F3\u00F5" + // 0xC8 - 0xCF - "\u00E6\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xD0 - 0xD7 - "\u0051\u0052\u00B9\u00FB\u00FC\u00F9\u00FA\u00FF" + // 0xD8 - 0xDF - "\u00B4\u00F7\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xE0 - 0xE7 - "\u0059\u005A\u00B2\u00D4\u005E\u00D2\u00D3\u00D5" + // 0xE8 - 0xEF - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xF0 - 0xF7 - "\u0038\u0039\u00B3\u00DB\u00DC\u00D9\u00DA\u009F" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07 - "\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17 - "\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27 - "\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2F - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37 - "\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3F - "\u0020\u00A0\u00E2\u00E4\u00E0\u00E1\u00E3\u00E5" + // 0x40 - 0x47 - "\u00E7\u00F1\u00DE\u002E\u003C\u0028\u002B\u0021" + // 0x48 - 0x4F - "\u0026\u00E9\u00EA\u00EB\u00E8\u00ED\u00EE\u00EF" + // 0x50 - 0x57 - "\u00EC\u00DF\u00C6\u0024\u002A\u0029\u003B\u00D6" + // 0x58 - 0x5F - "\u002D\u002F\u00C2\u00C4\u00C0\u00C1\u00C3\u00C5" + // 0x60 - 0x67 - "\u00C7\u00D1\u00A6\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6F - "\u00F8\u00C9\u00CA\u00CB\u00C8\u00CD\u00CE\u00CF" + // 0x70 - 0x77 - "\u00CC\u00F0\u003A\u0023\u00D0\'\u003D\""; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0037\u002D\u002E\u002F" + - "\u0016\u0005\u0015\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u003C\u003D\u0032\u0026" + - "\u0018\u0019\u003F\'\u001C\u001D\u001E\u001F" + - "\u0040\u004F\u007F\u007B\u005B\u006C\u0050\u007D" + - "\u004D\u005D\\\u004E\u006B\u0060\u004B\u0061" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u007A\u005E\u004C\u007E\u006E\u006F" + - "\u00AC\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6" + - "\u00D7\u00D8\u00D9\u00E2\u00E3\u00E4\u00E5\u00E6" + - "\u00E7\u00E8\u00E9\u00AE\u00BE\u009E\u00EC\u006D" + - "\u008C\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u0091\u0092\u0093\u0094\u0095\u0096" + - "\u0097\u0098\u0099\u00A2\u00A3\u00A4\u00A5\u00A6" + - "\u00A7\u00A8\u00A9\u008E\u00BB\u009C\u00CC\u0007" + - "\u0020\u0021\"\u0023\u0024\u0015\u0006\u0017" + - "\u0028\u0029\u002A\u002B\u002C\t\n\u001B" + - "\u0030\u0031\u001A\u0033\u0034\u0035\u0036\b" + - "\u0038\u0039\u003A\u003B\u0004\u0014\u003E\u00FF" + - "\u0041\u00AA\u00B0\u00B1\u009F\u00B2\u006A\u00B5" + - "\u00BD\u00B4\u009A\u008A\u00BA\u00CA\u00AF\u00BC" + - "\u0090\u008F\u00EA\u00FA\u00E0\u00A0\u00B6\u00B3" + - "\u009D\u00DA\u009B\u008B\u00B7\u00B8\u00B9\u00AB" + - "\u0064\u0065\u0062\u0066\u0063\u0067\u005A\u0068" + - "\u0074\u0071\u0072\u0073\u0078\u0075\u0076\u0077" + - "\u007C\u0069\u00ED\u00EE\u00EB\u00EF\u005F\u00BF" + - "\u0080\u00FD\u00FE\u00FB\u00FC\u00AD\u004A\u0059" + - "\u0044\u0045\u0042\u0046\u0043\u0047\u00D0\u0048" + - "\u0054\u0051\u0052\u0053\u0058\u0055\u0056\u0057" + - "\u0079\u0049\u00CD\u00CE\u00CB\u00CF\u00A1\u00E1" + - "\u0070\u00DD\u00DE\u00DB\u00DC\u008D\u00C0\u00DF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM875.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM875.java deleted file mode 100644 index c3453081c81..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM875.java +++ /dev/null @@ -1,258 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM875 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM875() { - super("x-IBM875", ExtendedCharsets.aliasesFor("x-IBM875")); - } - - public String historicalName() { - return "Cp875"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM875); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u0385\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87 - "\u0068\u0069\u03B1\u03B2\u03B3\u03B4\u03B5\u03B6" + // 0x88 - 0x8F - "\u00B0\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97 - "\u0071\u0072\u03B7\u03B8\u03B9\u03BA\u03BB\u03BC" + // 0x98 - 0x9F - "\u00B4\u007E\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xA0 - 0xA7 - "\u0079\u007A\u03BD\u03BE\u03BF\u03C0\u03C1\u03C3" + // 0xA8 - 0xAF - "\u00A3\u03AC\u03AD\u03AE\u03CA\u03AF\u03CC\u03CD" + // 0xB0 - 0xB7 - "\u03CB\u03CE\u03C2\u03C4\u03C5\u03C6\u03C7\u03C8" + // 0xB8 - 0xBF - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xC0 - 0xC7 - "\u0048\u0049\u00AD\u03C9\u0390\u03B0\u2018\u2015" + // 0xC8 - 0xCF - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xD0 - 0xD7 - "\u0051\u0052\u00B1\u00BD\uFFFD\u0387\u2019\u00A6" + // 0xD8 - 0xDF - "\\\uFFFD\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xE0 - 0xE7 - "\u0059\u005A\u00B2\u00A7\uFFFD\uFFFD\u00AB\u00AC" + // 0xE8 - 0xEF - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xF0 - 0xF7 - "\u0038\u0039\u00B3\u00A9\uFFFD\uFFFD\u00BB\u009F" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07 - "\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17 - "\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27 - "\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2F - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37 - "\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3F - "\u0020\u0391\u0392\u0393\u0394\u0395\u0396\u0397" + // 0x40 - 0x47 - "\u0398\u0399\u005B\u002E\u003C\u0028\u002B\u0021" + // 0x48 - 0x4F - "\u0026\u039A\u039B\u039C\u039D\u039E\u039F\u03A0" + // 0x50 - 0x57 - "\u03A1\u03A3\u005D\u0024\u002A\u0029\u003B\u005E" + // 0x58 - 0x5F - "\u002D\u002F\u03A4\u03A5\u03A6\u03A7\u03A8\u03A9" + // 0x60 - 0x67 - "\u03AA\u03AB\u007C\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6F - "\u00A8\u0386\u0388\u0389\u00A0\u038A\u038C\u038E" + // 0x70 - 0x77 - "\u038F\u0060\u003A\u0023\u0040\'\u003D\""; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0037\u002D\u002E\u002F" + - "\u0016\u0005\u0015\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u003C\u003D\u0032\u0026" + - "\u0018\u0019\u003F\'\u001C\u001D\u001E\u001F" + - "\u0040\u004F\u007F\u007B\u005B\u006C\u0050\u007D" + - "\u004D\u005D\\\u004E\u006B\u0060\u004B\u0061" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u007A\u005E\u004C\u007E\u006E\u006F" + - "\u007C\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6" + - "\u00D7\u00D8\u00D9\u00E2\u00E3\u00E4\u00E5\u00E6" + - "\u00E7\u00E8\u00E9\u004A\u00E0\u005A\u005F\u006D" + - "\u0079\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u0091\u0092\u0093\u0094\u0095\u0096" + - "\u0097\u0098\u0099\u00A2\u00A3\u00A4\u00A5\u00A6" + - "\u00A7\u00A8\u00A9\u00C0\u006A\u00D0\u00A1\u0007" + - "\u0020\u0021\"\u0023\u0024\u0015\u0006\u0017" + - "\u0028\u0029\u002A\u002B\u002C\t\n\u001B" + - "\u0030\u0031\u001A\u0033\u0034\u0035\u0036\b" + - "\u0038\u0039\u003A\u003B\u0004\u0014\u003E\u00FF" + - "\u0074\u0000\u0000\u00B0\u0000\u0000\u00DF\u00EB" + - "\u0070\u00FB\u0000\u00EE\u00EF\u00CA\u0000\u0000" + - "\u0090\u00DA\u00EA\u00FA\u00A0\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00FE\u0000\u00DB\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u0071" + - "\u00DD\u0072\u0073\u0075\u0000\u0076\u0000\u0077" + - "\u0078\u00CC\u0041\u0042\u0043\u0044\u0045\u0046" + - "\u0047\u0048\u0049\u0051\u0052\u0053\u0054\u0055" + - "\u0056\u0057\u0058\u0000\u0059\u0062\u0063\u0064" + - "\u0065\u0066\u0067\u0068\u0069\u00B1\u00B2\u00B3" + - "\u00B5\u00CD\u008A\u008B\u008C\u008D\u008E\u008F" + - "\u009A\u009B\u009C\u009D\u009E\u009F\u00AA\u00AB" + - "\u00AC\u00AD\u00AE\u00BA\u00AF\u00BB\u00BC\u00BD" + - "\u00BE\u00BF\u00CB\u00B4\u00B8\u00B6\u00B7\u00B9" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00CF\u0000\u0000\u00CE\u00DE\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 190, 190, 313, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 548, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM918.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM918.java deleted file mode 100644 index 62a2e8dcca9..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM918.java +++ /dev/null @@ -1,336 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM918 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM918() { - super("IBM918", ExtendedCharsets.aliasesFor("IBM918")); - } - - public String historicalName() { - return "Cp918"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM918); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\uFEA7\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x80 - 0x87 - "\u0068\u0069\uFEA9\uFB88\uFEAB\uFEAD\uFB8C\uFEAF" + // 0x88 - 0x8F - "\uFB8A\u006A\u006B\u006C\u006D\u006E\u006F\u0070" + // 0x90 - 0x97 - "\u0071\u0072\uFEB1\uFEB3\uFEB5\uFEB7\uFEB9\uFEBB" + // 0x98 - 0x9F - "\uFEBD\u007E\u0073\u0074\u0075\u0076\u0077\u0078" + // 0xA0 - 0xA7 - "\u0079\u007A\uFEBF\uFEC3\uFEC7\uFEC9\uFECA\uFECB" + // 0xA8 - 0xAF - "\uFECC\uFECD\uFECE\uFECF\uFED0\uFED1\uFED3\uFED5" + // 0xB0 - 0xB7 - "\uFED7\uFB8E\uFEDB\u007C\uFB92\uFB94\uFEDD\uFEDF" + // 0xB8 - 0xBF - "\u007B\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0xC0 - 0xC7 - "\u0048\u0049\u00AD\uFEE0\uFEE1\uFEE3\uFB9E\uFEE5" + // 0xC8 - 0xCF - "\u007D\u004A\u004B\u004C\u004D\u004E\u004F\u0050" + // 0xD0 - 0xD7 - "\u0051\u0052\uFEE7\uFE85\uFEED\uFBA6\uFBA8\uFBA9" + // 0xD8 - 0xDF - "\\\uFBAA\u0053\u0054\u0055\u0056\u0057\u0058" + // 0xE0 - 0xE7 - "\u0059\u005A\uFE80\uFE89\uFE8A\uFE8B\uFBFC\uFBFD" + // 0xE8 - 0xEF - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0xF0 - 0xF7 - "\u0038\u0039\uFBFE\uFBB0\uFBAE\uFE7C\uFE7D\u009F" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u009C\t\u0086\u007F" + // 0x00 - 0x07 - "\u0097\u008D\u008E\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u009D\n\b\u0087" + // 0x10 - 0x17 - "\u0018\u0019\u0092\u008F\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0080\u0081\u0082\u0083\u0084\n\u0017\u001B" + // 0x20 - 0x27 - "\u0088\u0089\u008A\u008B\u008C\u0005\u0006\u0007" + // 0x28 - 0x2F - "\u0090\u0091\u0016\u0093\u0094\u0095\u0096\u0004" + // 0x30 - 0x37 - "\u0098\u0099\u009A\u009B\u0014\u0015\u009E\u001A" + // 0x38 - 0x3F - "\u0020\u00A0\u060C\u061B\u061F\uFE81\uFE8D\uFE8E" + // 0x40 - 0x47 - "\uF8FB\uFE8F\u005B\u002E\u003C\u0028\u002B\u0021" + // 0x48 - 0x4F - "\u0026\uFE91\uFB56\uFB58\uFE93\uFE95\uFE97\uFB66" + // 0x50 - 0x57 - "\uFB68\uFE99\u005D\u0024\u002A\u0029\u003B\u005E" + // 0x58 - 0x5F - "\u002D\u002F\uFE9B\uFE9D\uFE9F\uFB7A\uFB7C\uFEA1" + // 0x60 - 0x67 - "\uFEA3\uFEA5\u0060\u002C\u0025\u005F\u003E\u003F" + // 0x68 - 0x6F - "\u06F0\u06F1\u06F2\u06F3\u06F4\u06F5\u06F6\u06F7" + // 0x70 - 0x77 - "\u06F8\u06F9\u003A\u0023\u0040\'\u003D\""; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0037\u002D\u002E\u002F" + - "\u0016\u0005\u0015\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u003C\u003D\u0032\u0026" + - "\u0018\u0019\u003F\'\u001C\u001D\u001E\u001F" + - "\u0040\u004F\u007F\u007B\u005B\u006C\u0050\u007D" + - "\u004D\u005D\\\u004E\u006B\u0060\u004B\u0061" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u007A\u005E\u004C\u007E\u006E\u006F" + - "\u007C\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6" + - "\u00D7\u00D8\u00D9\u00E2\u00E3\u00E4\u00E5\u00E6" + - "\u00E7\u00E8\u00E9\u004A\u00E0\u005A\u005F\u006D" + - "\u006A\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u0091\u0092\u0093\u0094\u0095\u0096" + - "\u0097\u0098\u0099\u00A2\u00A3\u00A4\u00A5\u00A6" + - "\u00A7\u00A8\u00A9\u00C0\u00BB\u00D0\u00A1\u0007" + - "\u0020\u0021\"\u0023\u0024\u0015\u0006\u0017" + - "\u0028\u0029\u002A\u002B\u002C\t\n\u001B" + - "\u0030\u0031\u001A\u0033\u0034\u0035\u0036\b" + - "\u0038\u0039\u003A\u003B\u0004\u0014\u003E\u00FF" + - "\u0041\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00CA\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0042\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0043\u0000\u0000" + - "\u0000\u0044\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0070\u0071\u0072\u0073\u0074\u0075" + - "\u0076\u0077\u0078\u0079\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0048" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0052\u0000" + - "\u0053\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0057\u0000" + - "\u0058\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0065\u0000\u0066\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u008B\u0000\u0090\u0000\u008E\u0000\u00B9\u0000" + - "\u0000\u0000\u00BC\u0000\u00BD\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00CE\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00DD\u0000" + - "\u00DE\u00DF\u00E1\u0000\u0000\u0000\u00FC\u0000" + - "\u00FB\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00EE\u00EF\u00FA\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00FD\u00FE\u0000\u0000\u00EA" + - "\u0045\u0000\u0000\u0000\u00DB\u0000\u0000\u0000" + - "\u00EB\u00EC\u00ED\u0000\u0046\u0047\u0049\u0000" + - "\u0051\u0000\u0054\u0000\u0055\u0000\u0056\u0000" + - "\u0059\u0000\u0062\u0000\u0063\u0000\u0064\u0000" + - "\u0067\u0000\u0068\u0000\u0069\u0000\u0080\u0000" + - "\u008A\u0000\u008C\u0000\u008D\u0000\u008F\u0000" + - "\u009A\u0000\u009B\u0000\u009C\u0000\u009D\u0000" + - "\u009E\u0000\u009F\u0000\u00A0\u0000\u00AA\u0000" + - "\u0000\u0000\u00AB\u0000\u0000\u0000\u00AC\u0000" + - "\u00AD\u00AE\u00AF\u00B0\u00B1\u00B2\u00B3\u00B4" + - "\u00B5\u0000\u00B6\u0000\u00B7\u0000\u00B8\u0000" + - "\u0000\u0000\u00BA\u0000\u00BE\u0000\u00BF\u00CB" + - "\u00CC\u0000\u00CD\u0000\u00CF\u0000\u00DA\u0000" + - "\u0000\u0000\u0000\u0000\u00DC\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 174, 174, 174, 174, 174, 418, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 668, 174, 174, 920, 174, 174, 1175, 174, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM921.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM921.java deleted file mode 100644 index 763a97e02db..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM921.java +++ /dev/null @@ -1,266 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM921 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM921() { - super("x-IBM921", ExtendedCharsets.aliasesFor("x-IBM921")); - } - - public String historicalName() { - return "Cp921"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM921); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + // 0x80 - 0x87 - "\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + // 0x88 - 0x8F - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097" + // 0x90 - 0x97 - "\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + // 0x98 - 0x9F - "\u00A0\u201D\u00A2\u00A3\u00A4\u201E\u00A6\u00A7" + // 0xA0 - 0xA7 - "\u00D8\u00A9\u0156\u00AB\u00AC\u00AD\u00AE\u00C6" + // 0xA8 - 0xAF - "\u00B0\u00B1\u00B2\u00B3\u201C\u00B5\u00B6\u00B7" + // 0xB0 - 0xB7 - "\u00F8\u00B9\u0157\u00BB\u00BC\u00BD\u00BE\u00E6" + // 0xB8 - 0xBF - "\u0104\u012E\u0100\u0106\u00C4\u00C5\u0118\u0112" + // 0xC0 - 0xC7 - "\u010C\u00C9\u0179\u0116\u0122\u0136\u012A\u013B" + // 0xC8 - 0xCF - "\u0160\u0143\u0145\u00D3\u014C\u00D5\u00D6\u00D7" + // 0xD0 - 0xD7 - "\u0172\u0141\u015A\u016A\u00DC\u017B\u017D\u00DF" + // 0xD8 - 0xDF - "\u0105\u012F\u0101\u0107\u00E4\u00E5\u0119\u0113" + // 0xE0 - 0xE7 - "\u010D\u00E9\u017A\u0117\u0123\u0137\u012B\u013C" + // 0xE8 - 0xEF - "\u0161\u0144\u0146\u00F3\u014D\u00F5\u00F6\u00F7" + // 0xF0 - 0xF7 - "\u0173\u0142\u015B\u016B\u00FC\u017C\u017E\u2019" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097" + - "\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + - "\u00A0\u0000\u00A2\u00A3\u00A4\u0000\u00A6\u00A7" + - "\u0000\u00A9\u0000\u00AB\u00AC\u00AD\u00AE\u0000" + - "\u00B0\u00B1\u00B2\u00B3\u0000\u00B5\u00B6\u00B7" + - "\u0000\u00B9\u0000\u00BB\u00BC\u00BD\u00BE\u0000" + - "\u0000\u0000\u0000\u0000\u00C4\u00C5\u00AF\u0000" + - "\u0000\u00C9\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00D3\u0000\u00D5\u00D6\u00D7" + - "\u00A8\u0000\u0000\u0000\u00DC\u0000\u0000\u00DF" + - "\u0000\u0000\u0000\u0000\u00E4\u00E5\u00BF\u0000" + - "\u0000\u00E9\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00F3\u0000\u00F5\u00F6\u00F7" + - "\u00B8\u0000\u0000\u0000\u00FC\u0000\u0000\u0000" + - "\u00C2\u00E2\u0000\u0000\u00C0\u00E0\u00C3\u00E3" + - "\u0000\u0000\u0000\u0000\u00C8\u00E8\u0000\u0000" + - "\u0000\u0000\u00C7\u00E7\u0000\u0000\u00CB\u00EB" + - "\u00C6\u00E6\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00CC\u00EC\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00CE\u00EE\u0000\u0000\u00C1\u00E1" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00CD\u00ED" + - "\u0000\u0000\u0000\u00CF\u00EF\u0000\u0000\u0000" + - "\u0000\u00D9\u00F9\u00D1\u00F1\u00D2\u00F2\u0000" + - "\u0000\u0000\u0000\u0000\u00D4\u00F4\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00AA\u00BA" + - "\u0000\u0000\u00DA\u00FA\u0000\u0000\u0000\u0000" + - "\u00D0\u00F0\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00DB\u00FB\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00D8\u00F8\u0000\u0000\u0000\u0000" + - "\u0000\u00CA\u00EA\u00DD\u00FD\u00DE\u00FE\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00FF" + - "\u0000\u0000\u00B4\u00A1\u00A5\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 614, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/IBM922.java b/jdk/src/share/classes/sun/nio/cs/ext/IBM922.java deleted file mode 100644 index 05280c93577..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/IBM922.java +++ /dev/null @@ -1,262 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class IBM922 - extends Charset - implements HistoricallyNamedCharset -{ - - public IBM922() { - super("x-IBM922", ExtendedCharsets.aliasesFor("x-IBM922")); - } - - public String historicalName() { - return "Cp922"; - } - - public boolean contains(Charset cs) { - return (cs instanceof IBM922); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + // 0x80 - 0x87 - "\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + // 0x88 - 0x8F - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097" + // 0x90 - 0x97 - "\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + // 0x98 - 0x9F - "\u00A0\u00A1\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7" + // 0xA0 - 0xA7 - "\u00A8\u00A9\u00AA\u00AB\u00AC\u00AD\u00AE\u203E" + // 0xA8 - 0xAF - "\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7" + // 0xB0 - 0xB7 - "\u00B8\u00B9\u00BA\u00BB\u00BC\u00BD\u00BE\u00BF" + // 0xB8 - 0xBF - "\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + // 0xC0 - 0xC7 - "\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF" + // 0xC8 - 0xCF - "\u0160\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D7" + // 0xD0 - 0xD7 - "\u00D8\u00D9\u00DA\u00DB\u00DC\u00DD\u017D\u00DF" + // 0xD8 - 0xDF - "\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7" + // 0xE0 - 0xE7 - "\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF" + // 0xE8 - 0xEF - "\u0161\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + // 0xF0 - 0xF7 - "\u00F8\u00F9\u00FA\u00FB\u00FC\u00FD\u017E\u00FF" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097" + - "\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + - "\u00A0\u00A1\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7" + - "\u00A8\u00A9\u00AA\u00AB\u00AC\u00AD\u00AE\u0000" + - "\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7" + - "\u00B8\u00B9\u00BA\u00BB\u00BC\u00BD\u00BE\u00BF" + - "\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF" + - "\u0000\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D7" + - "\u00D8\u00D9\u00DA\u00DB\u00DC\u00DD\u0000\u00DF" + - "\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7" + - "\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF" + - "\u0000\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u00FA\u00FB\u00FC\u00FD\u0000\u00FF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00D0\u00F0\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00DE\u00FE\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00AF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000"; - - private final static short index1[] = { - 0, 256, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 577, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/ISO_8859_11.java b/jdk/src/share/classes/sun/nio/cs/ext/ISO_8859_11.java deleted file mode 100644 index 8e49b22c5ec..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/ISO_8859_11.java +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright 2003 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. - */ - -/* - * - * NIO charset Support for Latin/Thai x-ISO-8859-11 charset - * (Currently not IANA registered) - */ - -package sun.nio.cs.ext; - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.SingleByteDecoder; - -public class ISO_8859_11 extends Charset -{ - - public ISO_8859_11() { - super("x-iso-8859-11", ExtendedCharsets.aliasesFor("x-iso-8859-11")); - } - - public boolean contains(Charset cs) { - return ((cs.name().equals("US-ASCII")) - || (cs instanceof ISO_8859_11)); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - protected static class Decoder extends SingleByteDecoder { - - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + // 0x80 - 0x87 - "\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + // 0x88 - 0x8F - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097" + // 0x90 - 0x97 - "\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + // 0x98 - 0x9F - "\u00A0\u0E01\u0E02\u0E03\u0E04\u0E05\u0E06\u0E07" + // 0xA0 - 0xA7 - "\u0E08\u0E09\u0E0A\u0E0B\u0E0C\u0E0D\u0E0E\u0E0F" + // 0xA8 - 0xAF - "\u0E10\u0E11\u0E12\u0E13\u0E14\u0E15\u0E16\u0E17" + // 0xB0 - 0xB7 - "\u0E18\u0E19\u0E1A\u0E1B\u0E1C\u0E1D\u0E1E\u0E1F" + // 0xB8 - 0xBF - "\u0E20\u0E21\u0E22\u0E23\u0E24\u0E25\u0E26\u0E27" + // 0xC0 - 0xC7 - "\u0E28\u0E29\u0E2A\u0E2B\u0E2C\u0E2D\u0E2E\u0E2F" + // 0xC8 - 0xCF - "\u0E30\u0E31\u0E32\u0E33\u0E34\u0E35\u0E36\u0E37" + // 0xD0 - 0xD7 - "\u0E38\u0E39\u0E3A\uFFFD\uFFFD\uFFFD\uFFFD\u0E3F" + // 0xD8 - 0xDF - "\u0E40\u0E41\u0E42\u0E43\u0E44\u0E45\u0E46\u0E47" + // 0xE0 - 0xE7 - "\u0E48\u0E49\u0E4A\u0E4B\u0E4C\u0E4D\u0E4E\u0E4F" + // 0xE8 - 0xEF - "\u0E50\u0E51\u0E52\u0E53\u0E54\u0E55\u0E56\u0E57" + // 0xF0 - 0xF7 - "\u0E58\u0E59\u0E5A\u0E5B\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - protected static class Encoder extends SingleByteEncoder { - - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097" + - "\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + - "\u00A0\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00A1\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7" + - "\u00A8\u00A9\u00AA\u00AB\u00AC\u00AD\u00AE\u00AF" + - "\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7" + - "\u00B8\u00B9\u00BA\u00BB\u00BC\u00BD\u00BE\u00BF" + - "\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF" + - "\u00D0\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D7" + - "\u00D8\u00D9\u00DA\u0000\u0000\u0000\u0000\u00DF" + - "\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7" + - "\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u00FA\u00FB\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 416, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/ISO_8859_3.java b/jdk/src/share/classes/sun/nio/cs/ext/ISO_8859_3.java deleted file mode 100644 index 6554891055c..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/ISO_8859_3.java +++ /dev/null @@ -1,243 +0,0 @@ - -/* - * Copyright 2002-2004 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 sun.nio.cs.ext; - -import java.nio.ByteBuffer; -import java.nio.CharBuffer; -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import java.nio.charset.CharacterCodingException; -import java.nio.charset.MalformedInputException; -import java.nio.charset.UnmappableCharacterException; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class ISO_8859_3 - extends Charset - implements HistoricallyNamedCharset -{ - - public ISO_8859_3() { - super("ISO-8859-3", ExtendedCharsets.aliasesFor("ISO-8859-3")); - } - - public String historicalName() { - return "ISO8859_3"; - } - - public boolean contains(Charset cs) { - return ((cs.name().equals("US-ASCII")) - || (cs instanceof ISO_8859_3)); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + // 0x80 - 0x87 - "\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + // 0x88 - 0x8F - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097" + // 0x90 - 0x97 - "\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + // 0x98 - 0x9F - "\u00A0\u0126\u02D8\u00A3\u00A4\uFFFD\u0124\u00A7" + // 0xA0 - 0xA7 - "\u00A8\u0130\u015E\u011E\u0134\u00AD\uFFFD\u017B" + // 0xA8 - 0xAF - "\u00B0\u0127\u00B2\u00B3\u00B4\u00B5\u0125\u00B7" + // 0xB0 - 0xB7 - "\u00B8\u0131\u015F\u011F\u0135\u00BD\uFFFD\u017C" + // 0xB8 - 0xBF - "\u00C0\u00C1\u00C2\uFFFD\u00C4\u010A\u0108\u00C7" + // 0xC0 - 0xC7 - "\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF" + // 0xC8 - 0xCF - "\uFFFD\u00D1\u00D2\u00D3\u00D4\u0120\u00D6\u00D7" + // 0xD0 - 0xD7 - "\u011C\u00D9\u00DA\u00DB\u00DC\u016C\u015C\u00DF" + // 0xD8 - 0xDF - "\u00E0\u00E1\u00E2\uFFFD\u00E4\u010B\u0109\u00E7" + // 0xE0 - 0xE7 - "\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF" + // 0xE8 - 0xEF - "\uFFFD\u00F1\u00F2\u00F3\u00F4\u0121\u00F6\u00F7" + // 0xF0 - 0xF7 - "\u011D\u00F9\u00FA\u00FB\u00FC\u016D\u015D\u02D9" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097" + - "\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + - "\u00A0\u0000\u0000\u00A3\u00A4\u0000\u0000\u00A7" + - "\u00A8\u0000\u0000\u0000\u0000\u00AD\u0000\u0000" + - "\u00B0\u0000\u00B2\u00B3\u00B4\u00B5\u0000\u00B7" + - "\u00B8\u0000\u0000\u0000\u0000\u00BD\u0000\u0000" + - "\u00C0\u00C1\u00C2\u0000\u00C4\u0000\u0000\u00C7" + - "\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF" + - "\u0000\u00D1\u00D2\u00D3\u00D4\u0000\u00D6\u00D7" + - "\u0000\u00D9\u00DA\u00DB\u00DC\u0000\u0000\u00DF" + - "\u00E0\u00E1\u00E2\u0000\u00E4\u0000\u0000\u00E7" + - "\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF" + - "\u0000\u00F1\u00F2\u00F3\u00F4\u0000\u00F6\u00F7" + - "\u0000\u00F9\u00FA\u00FB\u00FC\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00C6\u00E6\u00C5" + - "\u00E5\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00D8\u00F8\u00AB\u00BB\u00D5\u00F5\u0000" + - "\u0000\u00A6\u00B6\u00A1\u00B1\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00A9\u00B9\u0000" + - "\u0000\u00AC\u00BC\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00DE\u00FE\u00AA\u00BA\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00DD\u00FD\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00AF\u00BF\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00A2\u00FF\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000"; - - private final static short index1[] = { - 0, 253, 418, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/ISO_8859_6.java b/jdk/src/share/classes/sun/nio/cs/ext/ISO_8859_6.java deleted file mode 100644 index 56b7cf43088..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/ISO_8859_6.java +++ /dev/null @@ -1,246 +0,0 @@ - -/* - * Copyright 2002-2004 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 sun.nio.cs.ext; - -import java.nio.ByteBuffer; -import java.nio.CharBuffer; -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import java.nio.charset.CharacterCodingException; -import java.nio.charset.MalformedInputException; -import java.nio.charset.UnmappableCharacterException; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class ISO_8859_6 - extends Charset - implements HistoricallyNamedCharset -{ - - public ISO_8859_6() { - super("ISO-8859-6", ExtendedCharsets.aliasesFor("ISO-8859-6")); - } - - public String historicalName() { - return "ISO8859_6"; - } - - public boolean contains(Charset cs) { - return ((cs.name().equals("US-ASCII")) - || (cs instanceof ISO_8859_6)); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + // 0x80 - 0x87 - "\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + // 0x88 - 0x8F - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097" + // 0x90 - 0x97 - "\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + // 0x98 - 0x9F - "\u00A0\uFFFD\uFFFD\uFFFD\u00A4\uFFFD\uFFFD\uFFFD" + // 0xA0 - 0xA7 - "\uFFFD\uFFFD\uFFFD\uFFFD\u060C\u00AD\uFFFD\uFFFD" + // 0xA8 - 0xAF - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xB0 - 0xB7 - "\uFFFD\uFFFD\uFFFD\u061B\uFFFD\uFFFD\uFFFD\u061F" + // 0xB8 - 0xBF - "\uFFFD\u0621\u0622\u0623\u0624\u0625\u0626\u0627" + // 0xC0 - 0xC7 - "\u0628\u0629\u062A\u062B\u062C\u062D\u062E\u062F" + // 0xC8 - 0xCF - "\u0630\u0631\u0632\u0633\u0634\u0635\u0636\u0637" + // 0xD0 - 0xD7 - "\u0638\u0639\u063A\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xD8 - 0xDF - "\u0640\u0641\u0642\u0643\u0644\u0645\u0646\u0647" + // 0xE0 - 0xE7 - "\u0648\u0649\u064A\u064B\u064C\u064D\u064E\u064F" + // 0xE8 - 0xEF - "\u0650\u0651\u0652\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xF0 - 0xF7 - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097" + - "\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + - "\u00A0\u0000\u0000\u0000\u00A4\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00AD\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00AC\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00BB\u0000\u0000" + - "\u0000\u00BF\u0000\u00C1\u00C2\u00C3\u00C4\u00C5" + - "\u00C6\u00C7\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD" + - "\u00CE\u00CF\u00D0\u00D1\u00D2\u00D3\u00D4\u00D5" + - "\u00D6\u00D7\u00D8\u00D9\u00DA\u0000\u0000\u0000" + - "\u0000\u0000\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5" + - "\u00E6\u00E7\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED" + - "\u00EE\u00EF\u00F0\u00F1\u00F2\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000"; - - private final static short index1[] = { - 0, 174, 174, 174, 174, 174, 418, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/ISO_8859_8.java b/jdk/src/share/classes/sun/nio/cs/ext/ISO_8859_8.java deleted file mode 100644 index fca3a86f116..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/ISO_8859_8.java +++ /dev/null @@ -1,259 +0,0 @@ - -/* - * Copyright 2002-2004 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 sun.nio.cs.ext; - -import java.nio.ByteBuffer; -import java.nio.CharBuffer; -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import java.nio.charset.CharacterCodingException; -import java.nio.charset.MalformedInputException; -import java.nio.charset.UnmappableCharacterException; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - - -public class ISO_8859_8 - extends Charset - implements HistoricallyNamedCharset -{ - - public ISO_8859_8() { - super("ISO-8859-8", ExtendedCharsets.aliasesFor("ISO-8859-8")); - } - - public String historicalName() { - return "ISO8859_8"; - } - - public boolean contains(Charset cs) { - return ((cs.name().equals("US-ASCII")) - || (cs instanceof ISO_8859_8)); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + // 0x80 - 0x87 - "\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + // 0x88 - 0x8F - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097" + // 0x90 - 0x97 - "\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + // 0x98 - 0x9F - "\u00A0\uFFFD\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7" + // 0xA0 - 0xA7 - "\u00A8\u00A9\u00D7\u00AB\u00AC\u00AD\u00AE\u00AF" + // 0xA8 - 0xAF - "\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7" + // 0xB0 - 0xB7 - "\u00B8\u00B9\u00F7\u00BB\u00BC\u00BD\u00BE\uFFFD" + // 0xB8 - 0xBF - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xC0 - 0xC7 - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xC8 - 0xCF - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xD0 - 0xD7 - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2017" + // 0xD8 - 0xDF - "\u05D0\u05D1\u05D2\u05D3\u05D4\u05D5\u05D6\u05D7" + // 0xE0 - 0xE7 - "\u05D8\u05D9\u05DA\u05DB\u05DC\u05DD\u05DE\u05DF" + // 0xE8 - 0xEF - "\u05E0\u05E1\u05E2\u05E3\u05E4\u05E5\u05E6\u05E7" + // 0xF0 - 0xF7 - "\u05E8\u05E9\u05EA\uFFFD\uFFFD\u200E\u200F\uFFFD" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087" + - "\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F" + - "\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097" + - "\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F" + - "\u00A0\u0000\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7" + - "\u00A8\u00A9\u0000\u00AB\u00AC\u00AD\u00AE\u00AF" + - "\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7" + - "\u00B8\u00B9\u0000\u00BB\u00BC\u00BD\u00BE\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00AA" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00BA" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7" + - "\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u00FA\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00FD\u00FE\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00DF\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000"; - private final static short index1[] = { - 0, 248, 248, 248, 248, 296, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 538, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/MS1255.java b/jdk/src/share/classes/sun/nio/cs/ext/MS1255.java deleted file mode 100644 index d249f1d9503..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/MS1255.java +++ /dev/null @@ -1,333 +0,0 @@ - -/* - * Copyright 2002-2004 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 sun.nio.cs.ext; - -import java.nio.ByteBuffer; -import java.nio.CharBuffer; -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import java.nio.charset.CharacterCodingException; -import java.nio.charset.MalformedInputException; -import java.nio.charset.UnmappableCharacterException; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - - -public class MS1255 - extends Charset - implements HistoricallyNamedCharset -{ - - public String historicalName() { - return "Cp1255"; - } - - public MS1255() { - super("windows-1255", ExtendedCharsets.aliasesFor("windows-1255")); - } - - public boolean contains(Charset cs) { - return ((cs.name().equals("US-ASCII")) - || (cs instanceof MS1255)); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return MS1255.Decoder.byteToCharTable; - } - - public short[] getEncoderIndex1() { - return MS1255.Encoder.index1; - } - - public String getEncoderIndex2() { - return MS1255.Encoder.index2; - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u20AC\uFFFD\u201A\u0192\u201E\u2026\u2020\u2021" + // 0x80 - 0x87 - "\u02C6\u2030\uFFFD\u2039\uFFFD\uFFFD\uFFFD\uFFFD" + // 0x88 - 0x8F - "\uFFFD\u2018\u2019\u201C\u201D\u2022\u2013\u2014" + // 0x90 - 0x97 - "\u02DC\u2122\uFFFD\u203A\uFFFD\uFFFD\uFFFD\uFFFD" + // 0x98 - 0x9F - "\u00A0\u00A1\u00A2\u00A3\u20AA\u00A5\u00A6\u00A7" + // 0xA0 - 0xA7 - "\u00A8\u00A9\u00D7\u00AB\u00AC\u00AD\u00AE\u00AF" + // 0xA8 - 0xAF - "\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7" + // 0xB0 - 0xB7 - "\u00B8\u00B9\u00F7\u00BB\u00BC\u00BD\u00BE\u00BF" + // 0xB8 - 0xBF - "\u05B0\u05B1\u05B2\u05B3\u05B4\u05B5\u05B6\u05B7" + // 0xC0 - 0xC7 - "\u05B8\u05B9\uFFFD\u05BB\u05BC\u05BD\u05BE\u05BF" + // 0xC8 - 0xCF - "\u05C0\u05C1\u05C2\u05C3\u05F0\u05F1\u05F2\u05F3" + // 0xD0 - 0xD7 - "\u05F4\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xD8 - 0xDF - "\u05D0\u05D1\u05D2\u05D3\u05D4\u05D5\u05D6\u05D7" + // 0xE0 - 0xE7 - "\u05D8\u05D9\u05DA\u05DB\u05DC\u05DD\u05DE\u05DF" + // 0xE8 - 0xEF - "\u05E0\u05E1\u05E2\u05E3\u05E4\u05E5\u05E6\u05E7" + // 0xF0 - 0xF7 - "\u05E8\u05E9\u05EA\uFFFD\uFFFD\u200E\u200F\uFFFD" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00A0\u00A1\u00A2\u00A3\u0000\u00A5\u00A6\u00A7" + - "\u00A8\u00A9\u0000\u00AB\u00AC\u00AD\u00AE\u00AF" + - "\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7" + - "\u00B8\u00B9\u0000\u00BB\u00BC\u00BD\u00BE\u00BF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00AA" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00BA" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0083\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0088\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0098\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5" + - "\u00C6\u00C7\u00C8\u00C9\u0000\u00CB\u00CC\u00CD" + - "\u00CE\u00CF\u00D0\u00D1\u00D2\u00D3\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5" + - "\u00E6\u00E7\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED" + - "\u00EE\u00EF\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5" + - "\u00F6\u00F7\u00F8\u00F9\u00FA\u0000\u0000\u0000" + - "\u0000\u0000\u00D4\u00D5\u00D6\u00D7\u00D8\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00FD\u00FE\u0000" + - "\u0000\u0000\u0096\u0097\u0000\u0000\u0000\u0091" + - "\u0092\u0082\u0000\u0093\u0094\u0084\u0000\u0086" + - "\u0087\u0095\u0000\u0000\u0000\u0085\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0089" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u008B\u009B\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00A4\u0000\u0080\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0099" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 248, 453, 395, 395, 674, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 919, 1141, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/MS1256.java b/jdk/src/share/classes/sun/nio/cs/ext/MS1256.java deleted file mode 100644 index 3f6522580a9..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/MS1256.java +++ /dev/null @@ -1,334 +0,0 @@ - -/* - * Copyright 2002-2004 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 sun.nio.cs.ext; - -import java.nio.ByteBuffer; -import java.nio.CharBuffer; -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import java.nio.charset.CharacterCodingException; -import java.nio.charset.MalformedInputException; -import java.nio.charset.UnmappableCharacterException; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class MS1256 - extends Charset - implements HistoricallyNamedCharset -{ - - public String historicalName() { - return "Cp1256"; - } - - public MS1256() { - super("windows-1256", ExtendedCharsets.aliasesFor("windows-1256")); - } - - public boolean contains(Charset cs) { - return ((cs.name().equals("US-ASCII")) - || (cs instanceof MS1256)); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return MS1256.Decoder.byteToCharTable; - } - - public short[] getEncoderIndex1() { - return MS1256.Encoder.index1; - } - - public String getEncoderIndex2() { - return MS1256.Encoder.index2; - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u20AC\u067E\u201A\u0192\u201E\u2026\u2020\u2021" + // 0x80 - 0x87 - "\u02C6\u2030\u0679\u2039\u0152\u0686\u0698\u0688" + // 0x88 - 0x8F - "\u06AF\u2018\u2019\u201C\u201D\u2022\u2013\u2014" + // 0x90 - 0x97 - "\u06A9\u2122\u0691\u203A\u0153\u200C\u200D\u06BA" + // 0x98 - 0x9F - "\u00A0\u060C\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7" + // 0xA0 - 0xA7 - "\u00A8\u00A9\u06BE\u00AB\u00AC\u00AD\u00AE\u00AF" + // 0xA8 - 0xAF - "\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7" + // 0xB0 - 0xB7 - "\u00B8\u00B9\u061B\u00BB\u00BC\u00BD\u00BE\u061F" + // 0xB8 - 0xBF - "\u06C1\u0621\u0622\u0623\u0624\u0625\u0626\u0627" + // 0xC0 - 0xC7 - "\u0628\u0629\u062A\u062B\u062C\u062D\u062E\u062F" + // 0xC8 - 0xCF - "\u0630\u0631\u0632\u0633\u0634\u0635\u0636\u00D7" + // 0xD0 - 0xD7 - "\u0637\u0638\u0639\u063A\u0640\u0641\u0642\u0643" + // 0xD8 - 0xDF - "\u00E0\u0644\u00E2\u0645\u0646\u0647\u0648\u00E7" + // 0xE0 - 0xE7 - "\u00E8\u00E9\u00EA\u00EB\u0649\u064A\u00EE\u00EF" + // 0xE8 - 0xEF - "\u064B\u064C\u064D\u064E\u00F4\u064F\u0650\u00F7" + // 0xF0 - 0xF7 - "\u0651\u00F9\u0652\u00FB\u00FC\u200E\u200F\u06D2" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00A0\u0000\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7" + - "\u00A8\u00A9\u0000\u00AB\u00AC\u00AD\u00AE\u00AF" + - "\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7" + - "\u00B8\u00B9\u0000\u00BB\u00BC\u00BD\u00BE\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00D7" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00E0\u0000\u00E2\u0000\u0000\u0000\u0000\u00E7" + - "\u00E8\u00E9\u00EA\u00EB\u0000\u0000\u00EE\u00EF" + - "\u0000\u0000\u0000\u0000\u00F4\u0000\u0000\u00F7" + - "\u0000\u00F9\u0000\u00FB\u00FC\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u008C" + - "\u009C\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0083" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0088\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00A1\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00BA\u0000\u0000\u0000\u00BF\u0000\u00C1" + - "\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7\u00C8\u00C9" + - "\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF\u00D0\u00D1" + - "\u00D2\u00D3\u00D4\u00D5\u00D6\u00D8\u00D9\u00DA" + - "\u00DB\u0000\u0000\u0000\u0000\u0000\u00DC\u00DD" + - "\u00DE\u00DF\u00E1\u00E3\u00E4\u00E5\u00E6\u00EC" + - "\u00ED\u00F0\u00F1\u00F2\u00F3\u00F5\u00F6\u00F8" + - "\u00FA\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u008A" + - "\u0000\u0000\u0000\u0000\u0081\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u008D\u0000\u008F\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u009A" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u008E\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0098" + - "\u0000\u0000\u0000\u0000\u0000\u0090\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u009F\u0000\u0000\u0000\u00AA\u0000\u0000\u00C0" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00FF\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u009D\u009E" + - "\u00FD\u00FE\u0000\u0000\u0000\u0096\u0097\u0000" + - "\u0000\u0000\u0091\u0092\u0082\u0000\u0093\u0094" + - "\u0084\u0000\u0086\u0087\u0095\u0000\u0000\u0000" + - "\u0085\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0089\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u008B\u009B\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0080\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0099\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 253, 458, 400, 400, 400, 702, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 946, 1168, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/MS1258.java b/jdk/src/share/classes/sun/nio/cs/ext/MS1258.java deleted file mode 100644 index 6e8d6cca393..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/MS1258.java +++ /dev/null @@ -1,340 +0,0 @@ - -/* - * Copyright 2002-2004 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 sun.nio.cs.ext; - -import java.nio.ByteBuffer; -import java.nio.CharBuffer; -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import java.nio.charset.CharacterCodingException; -import java.nio.charset.MalformedInputException; -import java.nio.charset.UnmappableCharacterException; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class MS1258 - extends Charset - implements HistoricallyNamedCharset -{ - - public String historicalName() { - return "Cp1258"; - } - - public MS1258() { - super("windows-1258", ExtendedCharsets.aliasesFor("windows-1258")); - } - - public boolean contains(Charset cs) { - return ((cs.name().equals("US-ASCII")) - || (cs instanceof MS1258)); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return MS1258.Decoder.byteToCharTable; - } - - public short[] getEncoderIndex1() { - return MS1258.Encoder.index1; - } - - public String getEncoderIndex2() { - return MS1258.Encoder.index2; - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u20AC\uFFFD\u201A\u0192\u201E\u2026\u2020\u2021" + // 0x80 - 0x87 - "\u02C6\u2030\uFFFD\u2039\u0152\uFFFD\uFFFD\uFFFD" + // 0x88 - 0x8F - "\uFFFD\u2018\u2019\u201C\u201D\u2022\u2013\u2014" + // 0x90 - 0x97 - "\u02DC\u2122\uFFFD\u203A\u0153\uFFFD\uFFFD\u0178" + // 0x98 - 0x9F - "\u00A0\u00A1\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7" + // 0xA0 - 0xA7 - "\u00A8\u00A9\u00AA\u00AB\u00AC\u00AD\u00AE\u00AF" + // 0xA8 - 0xAF - "\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7" + // 0xB0 - 0xB7 - "\u00B8\u00B9\u00BA\u00BB\u00BC\u00BD\u00BE\u00BF" + // 0xB8 - 0xBF - "\u00C0\u00C1\u00C2\u0102\u00C4\u00C5\u00C6\u00C7" + // 0xC0 - 0xC7 - "\u00C8\u00C9\u00CA\u00CB\u0300\u00CD\u00CE\u00CF" + // 0xC8 - 0xCF - "\u0110\u00D1\u0309\u00D3\u00D4\u01A0\u00D6\u00D7" + // 0xD0 - 0xD7 - "\u00D8\u00D9\u00DA\u00DB\u00DC\u01AF\u0303\u00DF" + // 0xD8 - 0xDF - "\u00E0\u00E1\u00E2\u0103\u00E4\u00E5\u00E6\u00E7" + // 0xE0 - 0xE7 - "\u00E8\u00E9\u00EA\u00EB\u0301\u00ED\u00EE\u00EF" + // 0xE8 - 0xEF - "\u0111\u00F1\u0323\u00F3\u00F4\u01A1\u00F6\u00F7" + // 0xF0 - 0xF7 - "\u00F8\u00F9\u00FA\u00FB\u00FC\u01B0\u20AB\u00FF" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00A0\u00A1\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7" + - "\u00A8\u00A9\u00AA\u00AB\u00AC\u00AD\u00AE\u00AF" + - "\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7" + - "\u00B8\u00B9\u00BA\u00BB\u00BC\u00BD\u00BE\u00BF" + - "\u00C0\u00C1\u00C2\u0000\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00CA\u00CB\u0000\u00CD\u00CE\u00CF" + - "\u0000\u00D1\u0000\u00D3\u00D4\u0000\u00D6\u00D7" + - "\u00D8\u00D9\u00DA\u00DB\u00DC\u0000\u0000\u00DF" + - "\u00E0\u00E1\u00E2\u0000\u00E4\u00E5\u00E6\u00E7" + - "\u00E8\u00E9\u00EA\u00EB\u0000\u00ED\u00EE\u00EF" + - "\u0000\u00F1\u0000\u00F3\u00F4\u0000\u00F6\u00F7" + - "\u00F8\u00F9\u00FA\u00FB\u00FC\u0000\u0000\u00FF" + - "\u0000\u0000\u00C3\u00E3\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00D0\u00F0\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u008C\u009C\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u009F\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0083\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00D5\u00F5\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00DD" + - "\u00FD\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0088\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0098" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00CC\u00EC\u0000\u00DE\u0000" + - "\u0000\u0000\u0000\u0000\u00D2\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00F2\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0096\u0097\u0000\u0000\u0000" + - "\u0091\u0092\u0082\u0000\u0093\u0094\u0084\u0000" + - "\u0086\u0087\u0095\u0000\u0000\u0000\u0085\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0089\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u008B\u009B\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00FE\u0080\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0099\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 491, 747, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, - 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, - 984, 1206, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, - 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, - 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, - 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, - 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, - 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, - 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, - 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, - 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, - 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, - 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, - 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, - 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, - 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, 433, - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/MS874.java b/jdk/src/share/classes/sun/nio/cs/ext/MS874.java deleted file mode 100644 index 70940698ee8..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/MS874.java +++ /dev/null @@ -1,267 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class MS874 extends Charset implements HistoricallyNamedCharset -{ - public MS874() { - super("x-windows-874", ExtendedCharsets.aliasesFor("x-windows-874")); - } - - public String historicalName() { - return "MS874"; - } - - public boolean contains(Charset cs) { - return ((cs.name().equals("US-ASCII")) - || (cs instanceof MS874)); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - protected static class Decoder extends SingleByteDecoder { - - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - "\u20AC\uFFFD\uFFFD\uFFFD\uFFFD\u2026\uFFFD\uFFFD" + // 0x80 - 0x87 - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0x88 - 0x8F - "\uFFFD\u2018\u2019\u201C\u201D\u2022\u2013\u2014" + // 0x90 - 0x97 - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0x98 - 0x9F - "\u00A0\u0E01\u0E02\u0E03\u0E04\u0E05\u0E06\u0E07" + // 0xA0 - 0xA7 - "\u0E08\u0E09\u0E0A\u0E0B\u0E0C\u0E0D\u0E0E\u0E0F" + // 0xA8 - 0xAF - "\u0E10\u0E11\u0E12\u0E13\u0E14\u0E15\u0E16\u0E17" + // 0xB0 - 0xB7 - "\u0E18\u0E19\u0E1A\u0E1B\u0E1C\u0E1D\u0E1E\u0E1F" + // 0xB8 - 0xBF - "\u0E20\u0E21\u0E22\u0E23\u0E24\u0E25\u0E26\u0E27" + // 0xC0 - 0xC7 - "\u0E28\u0E29\u0E2A\u0E2B\u0E2C\u0E2D\u0E2E\u0E2F" + // 0xC8 - 0xCF - "\u0E30\u0E31\u0E32\u0E33\u0E34\u0E35\u0E36\u0E37" + // 0xD0 - 0xD7 - "\u0E38\u0E39\u0E3A\uFFFD\uFFFD\uFFFD\uFFFD\u0E3F" + // 0xD8 - 0xDF - "\u0E40\u0E41\u0E42\u0E43\u0E44\u0E45\u0E46\u0E47" + // 0xE0 - 0xE7 - "\u0E48\u0E49\u0E4A\u0E4B\u0E4C\u0E4D\u0E4E\u0E4F" + // 0xE8 - 0xEF - "\u0E50\u0E51\u0E52\u0E53\u0E54\u0E55\u0E56\u0E57" + // 0xF0 - 0xF7 - "\u0E58\u0E59\u0E5A\u0E5B\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - } - - protected static class Encoder extends SingleByteEncoder { - - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00A0\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00A1\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7" + - "\u00A8\u00A9\u00AA\u00AB\u00AC\u00AD\u00AE\u00AF" + - "\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7" + - "\u00B8\u00B9\u00BA\u00BB\u00BC\u00BD\u00BE\u00BF" + - "\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF" + - "\u00D0\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D7" + - "\u00D8\u00D9\u00DA\u0000\u0000\u0000\u0000\u00DF" + - "\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7" + - "\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u00FA\u00FB\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0096\u0097\u0000\u0000\u0000\u0091\u0092\u0000" + - "\u0000\u0093\u0094\u0000\u0000\u0000\u0000\u0095" + - "\u0000\u0000\u0000\u0085\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0080\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 416, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 653, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/MacArabic.java b/jdk/src/share/classes/sun/nio/cs/ext/MacArabic.java deleted file mode 100644 index 7d4d4b7d471..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/MacArabic.java +++ /dev/null @@ -1,279 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class MacArabic - extends Charset - implements HistoricallyNamedCharset -{ - - public MacArabic() { - super("x-MacArabic", ExtendedCharsets.aliasesFor("x-MacArabic")); - } - - public String historicalName() { - return "MacArabic"; - } - - public boolean contains(Charset cs) { - return (cs instanceof MacArabic); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u00C4\u00A0\u00C7\u00C9\u00D1\u00D6\u00DC\u00E1" + // 0x80 - 0x87 - "\u00E0\u00E2\u00E4\u06BA\u00AB\u00E7\u00E9\u00E8" + // 0x88 - 0x8F - "\u00EA\u00EB\u00ED\u2026\u00EE\u00EF\u00F1\u00F3" + // 0x90 - 0x97 - "\u00BB\u00F4\u00F6\u00F7\u00FA\u00F9\u00FB\u00FC" + // 0x98 - 0x9F - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u066A\uFFFD\uFFFD" + // 0xA0 - 0xA7 - "\uFFFD\uFFFD\uFFFD\uFFFD\u060C\uFFFD\uFFFD\uFFFD" + // 0xA8 - 0xAF - "\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667" + // 0xB0 - 0xB7 - "\u0668\u0669\uFFFD\u061B\uFFFD\uFFFD\uFFFD\u061F" + // 0xB8 - 0xBF - "\u066D\u0621\u0622\u0623\u0624\u0625\u0626\u0627" + // 0xC0 - 0xC7 - "\u0628\u0629\u062A\u062B\u062C\u062D\u062E\u062F" + // 0xC8 - 0xCF - "\u0630\u0631\u0632\u0633\u0634\u0635\u0636\u0637" + // 0xD0 - 0xD7 - "\u0638\u0639\u063A\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xD8 - 0xDF - "\u0640\u0641\u0642\u0643\u0644\u0645\u0646\u0647" + // 0xE0 - 0xE7 - "\u0648\u0649\u064A\u064B\u064C\u064D\u064E\u064F" + // 0xE8 - 0xEF - "\u0650\u0651\u0652\u067E\u0679\u0686\u06D5\u06A4" + // 0xF0 - 0xF7 - "\u06AF\u0688\u0691\uFFFD\uFFFD\uFFFD\u0698\u06D2" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0081\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u008C\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0098\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0080\u0000\u0000\u0082" + - "\u0000\u0083\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0084\u0000\u0000\u0000\u0000\u0085\u0000" + - "\u0000\u0000\u0000\u0000\u0086\u0000\u0000\u0000" + - "\u0088\u0087\u0089\u0000\u008A\u0000\u0000\u008D" + - "\u008F\u008E\u0090\u0091\u0000\u0092\u0094\u0095" + - "\u0000\u0096\u0000\u0097\u0099\u0000\u009A\u009B" + - "\u0000\u009D\u009C\u009E\u009F\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00AC\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00BB\u0000\u0000\u0000" + - "\u00BF\u0000\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6" + - "\u00C7\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE" + - "\u00CF\u00D0\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6" + - "\u00D7\u00D8\u00D9\u00DA\u0000\u0000\u0000\u0000" + - "\u0000\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6" + - "\u00E7\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE" + - "\u00EF\u00F0\u00F1\u00F2\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6" + - "\u00B7\u00B8\u00B9\u00A5\u0000\u0000\u00C0\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00F4\u0000\u0000\u0000\u0000\u00F3" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00F5" + - "\u0000\u00F9\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00FA\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00FE\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00F7\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00F8\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u008B\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00FF\u0000\u0000\u00F6\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0093\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 253, 253, 253, 253, 253, 497, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 715, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/MacCentralEurope.java b/jdk/src/share/classes/sun/nio/cs/ext/MacCentralEurope.java deleted file mode 100644 index f3c1510d794..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/MacCentralEurope.java +++ /dev/null @@ -1,346 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class MacCentralEurope - extends Charset - implements HistoricallyNamedCharset -{ - - public MacCentralEurope() { - super("x-MacCentralEurope", ExtendedCharsets.aliasesFor("x-MacCentralEurope")); - } - - public String historicalName() { - return "MacCentralEurope"; - } - - public boolean contains(Charset cs) { - return (cs instanceof MacCentralEurope); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u00C4\u0100\u0101\u00C9\u0104\u00D6\u00DC\u00E1" + // 0x80 - 0x87 - "\u0105\u010C\u00E4\u010D\u0106\u0107\u00E9\u0179" + // 0x88 - 0x8F - "\u017A\u010E\u00ED\u010F\u0112\u0113\u0116\u00F3" + // 0x90 - 0x97 - "\u0117\u00F4\u00F6\u00F5\u00FA\u011A\u011B\u00FC" + // 0x98 - 0x9F - "\u2020\u00B0\u0118\u00A3\u00A7\u2022\u00B6\u00DF" + // 0xA0 - 0xA7 - "\u00AE\u00A9\u2122\u0119\u00A8\u2260\u0123\u012E" + // 0xA8 - 0xAF - "\u012F\u012A\u2264\u2265\u012B\u0136\u2202\u2211" + // 0xB0 - 0xB7 - "\u0142\u013B\u013C\u013D\u013E\u0139\u013A\u0145" + // 0xB8 - 0xBF - "\u0146\u0143\u00AC\u221A\u0144\u0147\u2206\u00AB" + // 0xC0 - 0xC7 - "\u00BB\u2026\u00A0\u0148\u0150\u00D5\u0151\u014C" + // 0xC8 - 0xCF - "\u2013\u2014\u201C\u201D\u2018\u2019\u00F7\u25CA" + // 0xD0 - 0xD7 - "\u014D\u0154\u0155\u0158\u2039\u203A\u0159\u0156" + // 0xD8 - 0xDF - "\u0157\u0160\u201A\u201E\u0161\u015A\u015B\u00C1" + // 0xE0 - 0xE7 - "\u0164\u0165\u00CD\u017D\u017E\u016A\u00D3\u00D4" + // 0xE8 - 0xEF - "\u016B\u016E\u00DA\u016F\u0170\u0171\u0172\u0173" + // 0xF0 - 0xF7 - "\u00DD\u00FD\u0137\u017B\u0141\u017C\u0122\u02C7" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00CA\u0000\u0000\u00A3\u0000\u0000\u0000\u00A4" + - "\u00AC\u00A9\u0000\u00C7\u00C2\u0000\u00A8\u0000" + - "\u00A1\u0000\u0000\u0000\u0000\u0000\u00A6\u0000" + - "\u0000\u0000\u0000\u00C8\u0000\u0000\u0000\u0000" + - "\u0000\u00E7\u0000\u0000\u0080\u0000\u0000\u0000" + - "\u0000\u0083\u0000\u0000\u0000\u00EA\u0000\u0000" + - "\u0000\u0000\u0000\u00EE\u00EF\u00CD\u0085\u0000" + - "\u0000\u0000\u00F2\u0000\u0086\u00F8\u0000\u00A7" + - "\u0000\u0087\u0000\u0000\u008A\u0000\u0000\u0000" + - "\u0000\u008E\u0000\u0000\u0000\u0092\u0000\u0000" + - "\u0000\u0000\u0000\u0097\u0099\u009B\u009A\u00D6" + - "\u0000\u0000\u009C\u0000\u009F\u00F9\u0000\u0000" + - "\u0081\u0082\u0000\u0000\u0084\u0088\u008C\u008D" + - "\u0000\u0000\u0000\u0000\u0089\u008B\u0091\u0093" + - "\u0000\u0000\u0094\u0095\u0000\u0000\u0096\u0098" + - "\u00A2\u00AB\u009D\u009E\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00FE\u00AE\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00B1\u00B4\u0000\u0000\u00AF\u00B0" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00B5\u00FA" + - "\u0000\u00BD\u00BE\u00B9\u00BA\u00BB\u00BC\u0000" + - "\u0000\u00FC\u00B8\u00C1\u00C4\u00BF\u00C0\u00C5" + - "\u00CB\u0000\u0000\u0000\u00CF\u00D8\u0000\u0000" + - "\u00CC\u00CE\u0000\u0000\u00D9\u00DA\u00DF\u00E0" + - "\u00DB\u00DE\u00E5\u00E6\u0000\u0000\u0000\u0000" + - "\u00E1\u00E4\u0000\u0000\u00E8\u00E9\u0000\u0000" + - "\u0000\u0000\u00ED\u00F0\u0000\u0000\u00F1\u00F3" + - "\u00F4\u00F5\u00F6\u00F7\u0000\u0000\u0000\u0000" + - "\u0000\u008F\u0090\u00FB\u00FD\u00EB\u00EC\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00FF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00D0\u00D1\u0000\u0000\u0000\u00D4\u00D5\u00E2" + - "\u0000\u00D2\u00D3\u00E3\u0000\u00A0\u0000\u00A5" + - "\u0000\u0000\u0000\u00C9\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00DC\u00DD" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00AA\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00B6\u0000\u0000\u0000\u00C6" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00B7\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00C3\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00AD\u0000\u0000\u0000\u00B2\u00B3\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00D7\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 440, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 677, 899, 1153, 383, 383, 1255, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/MacCroatian.java b/jdk/src/share/classes/sun/nio/cs/ext/MacCroatian.java deleted file mode 100644 index f3bd5a5bfc0..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/MacCroatian.java +++ /dev/null @@ -1,402 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class MacCroatian - extends Charset - implements HistoricallyNamedCharset -{ - - public MacCroatian() { - super("x-MacCroatian", ExtendedCharsets.aliasesFor("x-MacCroatian")); - } - - public String historicalName() { - return "MacCroatian"; - } - - public boolean contains(Charset cs) { - return (cs instanceof MacCroatian); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u00C4\u00C5\u00C7\u00C9\u00D1\u00D6\u00DC\u00E1" + // 0x80 - 0x87 - "\u00E0\u00E2\u00E4\u00E3\u00E5\u00E7\u00E9\u00E8" + // 0x88 - 0x8F - "\u00EA\u00EB\u00ED\u00EC\u00EE\u00EF\u00F1\u00F3" + // 0x90 - 0x97 - "\u00F2\u00F4\u00F6\u00F5\u00FA\u00F9\u00FB\u00FC" + // 0x98 - 0x9F - "\u2020\u00B0\u00A2\u00A3\u00A7\u2022\u00B6\u00DF" + // 0xA0 - 0xA7 - "\u00AE\u0160\u2122\u00B4\u00A8\u2260\u017D\u00D8" + // 0xA8 - 0xAF - "\u221E\u00B1\u2264\u2265\u2206\u00B5\u2202\u2211" + // 0xB0 - 0xB7 - "\u220F\u0161\u222B\u00AA\u00BA\u2126\u017E\u00F8" + // 0xB8 - 0xBF - "\u00BF\u00A1\u00AC\u221A\u0192\u2248\u0106\u00AB" + // 0xC0 - 0xC7 - "\u010C\u2026\u00A0\u00C0\u00C3\u00D5\u0152\u0153" + // 0xC8 - 0xCF - "\u0110\u2014\u201C\u201D\u2018\u2019\u00F7\u25CA" + // 0xD0 - 0xD7 - "\uF8FF\u00A9\u2044\u00A4\u2039\u203A\u00C6\u00BB" + // 0xD8 - 0xDF - "\u2013\u00B7\u201A\u201E\u2030\u00C2\u0107\u00C1" + // 0xE0 - 0xE7 - "\u010D\u00C8\u00CD\u00CE\u00CF\u00CC\u00D3\u00D4" + // 0xE8 - 0xEF - "\u0111\u00D2\u00DA\u00DB\u00D9\u0131\u02C6\u02DC" + // 0xF0 - 0xF7 - "\u00AF\u03C0\u00CB\u02DA\u00B8\u00CA\u00E6\u02C7" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00CA\u00C1\u00A2\u00A3\u00DB\u0000\u0000\u00A4" + - "\u00AC\u00D9\u00BB\u00C7\u00C2\u0000\u00A8\u00F8" + - "\u00A1\u00B1\u0000\u0000\u00AB\u00B5\u00A6\u00E1" + - "\u00FC\u0000\u00BC\u00DF\u0000\u0000\u0000\u00C0" + - "\u00CB\u00E7\u00E5\u00CC\u0080\u0081\u00DE\u0082" + - "\u00E9\u0083\u00FD\u00FA\u00ED\u00EA\u00EB\u00EC" + - "\u0000\u0084\u00F1\u00EE\u00EF\u00CD\u0085\u0000" + - "\u00AF\u00F4\u00F2\u00F3\u0086\u0000\u0000\u00A7" + - "\u0088\u0087\u0089\u008B\u008A\u008C\u00FE\u008D" + - "\u008F\u008E\u0090\u0091\u0093\u0092\u0094\u0095" + - "\u0000\u0096\u0098\u0097\u0099\u009B\u009A\u00D6" + - "\u00BF\u009D\u009C\u009E\u009F\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00C6\u00E6\u0000\u0000\u0000" + - "\u0000\u00C8\u00E8\u0000\u0000\u00D0\u00F0\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00F5\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00CE" + - "\u00CF\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00A9\u00B9\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00AE\u00BE\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00C4" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00F6\u00FF\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00FB\u0000\u00F7\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00F9" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00E0" + - "\u00D1\u0000\u0000\u0000\u00D4\u00D5\u00E2\u0000" + - "\u00D2\u00D3\u00E3\u0000\u00A0\u0000\u00A5\u0000" + - "\u0000\u0000\u00C9\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00E4\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00DC\u00DD\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00DA\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00AA\u0000\u0000\u0000" + - "\u00BD\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00B6\u0000\u0000\u0000\u00B4\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00B8" + - "\u0000\u00B7\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00C3\u0000\u0000\u0000\u00B0\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00BA\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00C5\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00AD\u0000\u0000\u0000\u00B2\u00B3\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00D7\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00D8"; - - private final static short index1[] = { - 0, 253, 458, 679, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 916, 1138, 1392, 400, 400, 1494, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, - 400, 400, 400, 400, 400, 400, 400, 400, 1697, 400, 400, 400, 400, 400, 400, 400, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/MacCyrillic.java b/jdk/src/share/classes/sun/nio/cs/ext/MacCyrillic.java deleted file mode 100644 index 87a5148f598..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/MacCyrillic.java +++ /dev/null @@ -1,361 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class MacCyrillic - extends Charset - implements HistoricallyNamedCharset -{ - - public MacCyrillic() { - super("x-MacCyrillic", ExtendedCharsets.aliasesFor("x-MacCyrillic")); - } - - public String historicalName() { - return "MacCyrillic"; - } - - public boolean contains(Charset cs) { - return (cs instanceof MacCyrillic); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417" + // 0x80 - 0x87 - "\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F" + // 0x88 - 0x8F - "\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427" + // 0x90 - 0x97 - "\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F" + // 0x98 - 0x9F - "\u2020\u00B0\u00A2\u00A3\u00A7\u2022\u00B6\u0406" + // 0xA0 - 0xA7 - "\u00AE\u00A9\u2122\u0402\u0452\u2260\u0403\u0453" + // 0xA8 - 0xAF - "\u221E\u00B1\u2264\u2265\u0456\u00B5\u2202\u0408" + // 0xB0 - 0xB7 - "\u0404\u0454\u0407\u0457\u0409\u0459\u040A\u045A" + // 0xB8 - 0xBF - "\u0458\u0405\u00AC\u221A\u0192\u2248\u2206\u00AB" + // 0xC0 - 0xC7 - "\u00BB\u2026\u00A0\u040B\u045B\u040C\u045C\u0455" + // 0xC8 - 0xCF - "\u2013\u2014\u201C\u201D\u2018\u2019\u00F7\u201E" + // 0xD0 - 0xD7 - "\u040E\u045E\u040F\u045F\u2116\u0401\u0451\u044F" + // 0xD8 - 0xDF - "\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437" + // 0xE0 - 0xE7 - "\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F" + // 0xE8 - 0xEF - "\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447" + // 0xF0 - 0xF7 - "\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u00A4" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00CA\u0000\u00A2\u00A3\u00FF\u0000\u0000\u00A4" + - "\u0000\u00A9\u0000\u00C7\u00C2\u0000\u00A8\u0000" + - "\u00A1\u00B1\u0000\u0000\u0000\u00B5\u00A6\u0000" + - "\u0000\u0000\u0000\u00C8\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00D6" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00C4\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00DD\u00AB\u00AE\u00B8\u00C1" + - "\u00A7\u00BA\u00B7\u00BC\u00BE\u00CB\u00CD\u0000" + - "\u00D8\u00DA\u0080\u0081\u0082\u0083\u0084\u0085" + - "\u0086\u0087\u0088\u0089\u008A\u008B\u008C\u008D" + - "\u008E\u008F\u0090\u0091\u0092\u0093\u0094\u0095" + - "\u0096\u0097\u0098\u0099\u009A\u009B\u009C\u009D" + - "\u009E\u009F\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5" + - "\u00E6\u00E7\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED" + - "\u00EE\u00EF\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5" + - "\u00F6\u00F7\u00F8\u00F9\u00FA\u00FB\u00FC\u00FD" + - "\u00FE\u00DF\u0000\u00DE\u00AC\u00AF\u00B9\u00CF" + - "\u00B4\u00BB\u00C0\u00BD\u00BF\u00CC\u00CE\u0000" + - "\u00D9\u00DB\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00D0\u00D1\u0000\u0000\u0000\u00D4" + - "\u00D5\u0000\u0000\u00D2\u00D3\u00D7\u0000\u00A0" + - "\u0000\u00A5\u0000\u0000\u0000\u00C9\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00DC" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00AA\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00B6\u0000\u0000\u0000\u00C6\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00C3\u0000\u0000\u0000\u00B0\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00C5" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00AD" + - "\u0000\u0000\u0000\u00B2\u00B3\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 248, 395, 395, 650, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 887, 1121, 1375, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/MacDingbat.java b/jdk/src/share/classes/sun/nio/cs/ext/MacDingbat.java deleted file mode 100644 index f608424254b..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/MacDingbat.java +++ /dev/null @@ -1,316 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class MacDingbat - extends Charset - implements HistoricallyNamedCharset -{ - - public MacDingbat() { - super("x-MacDingbat", ExtendedCharsets.aliasesFor("x-MacDingbat")); - } - - public String historicalName() { - return "MacDingbat"; - } - - public boolean contains(Charset cs) { - return (cs instanceof MacDingbat); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0x80 - 0x87 - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0x88 - 0x8F - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0x90 - 0x97 - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0x98 - 0x9F - "\uFFFD\u2761\u2762\u2763\u2764\u2765\u2766\u2767" + // 0xA0 - 0xA7 - "\u2663\u2666\u2665\u2660\u2460\u2461\u2462\u2463" + // 0xA8 - 0xAF - "\u2464\u2465\u2466\u2467\u2468\u2469\u2776\u2777" + // 0xB0 - 0xB7 - "\u2778\u2779\u277A\u277B\u277C\u277D\u277E\u277F" + // 0xB8 - 0xBF - "\u2780\u2781\u2782\u2783\u2784\u2785\u2786\u2787" + // 0xC0 - 0xC7 - "\u2788\u2789\u278A\u278B\u278C\u278D\u278E\u278F" + // 0xC8 - 0xCF - "\u2790\u2791\u2792\u2793\u2794\u2192\u2194\u2195" + // 0xD0 - 0xD7 - "\u2798\u2799\u279A\u279B\u279C\u279D\u279E\u279F" + // 0xD8 - 0xDF - "\u27A0\u27A1\u27A2\u27A3\u27A4\u27A5\u27A6\u27A7" + // 0xE0 - 0xE7 - "\u27A8\u27A9\u27AA\u27AB\u27AC\u27AD\u27AE\u27AF" + // 0xE8 - 0xEF - "\uFFFD\u27B1\u27B2\u27B3\u27B4\u27B5\u27B6\u27B7" + // 0xF0 - 0xF7 - "\u27B8\u27B9\u27BA\u27BB\u27BC\u27BD\u27BE\uFFFD" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u2701\u2702\u2703\u2704\u260E\u2706\u2707" + // 0x20 - 0x27 - "\u2708\u2709\u261B\u261E\u270C\u270D\u270E\u270F" + // 0x28 - 0x2F - "\u2710\u2711\u2712\u2713\u2714\u2715\u2716\u2717" + // 0x30 - 0x37 - "\u2718\u2719\u271A\u271B\u271C\u271D\u271E\u271F" + // 0x38 - 0x3F - "\u2720\u2721\u2722\u2723\u2724\u2725\u2726\u2727" + // 0x40 - 0x47 - "\u2605\u2729\u272A\u272B\u272C\u272D\u272E\u272F" + // 0x48 - 0x4F - "\u2730\u2731\u2732\u2733\u2734\u2735\u2736\u2737" + // 0x50 - 0x57 - "\u2738\u2739\u273A\u273B\u273C\u273D\u273E\u273F" + // 0x58 - 0x5F - "\u2740\u2741\u2742\u2743\u2744\u2745\u2746\u2747" + // 0x60 - 0x67 - "\u2748\u2749\u274A\u274B\u25CF\u274D\u25A0\u274F" + // 0x68 - 0x6F - "\u2750\u2751\u2752\u25B2\u25BC\u25C6\u2756\u25D7" + // 0x70 - 0x77 - "\u2758\u2759\u275A\u275B\u275C\u275D\u275E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00D5\u0000\u00D6\u00D7\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00AC\u00AD" + - "\u00AE\u00AF\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u006E\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0073\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0074\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0075\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u006C" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0077" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0048\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0025\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u002A\u0000" + - "\u0000\u002B\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00AB\u0000\u0000\u00A8\u0000" + - "\u00AA\u00A9\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0021\"\u0023\u0024\u0000" + - "\u0026\'\u0028\u0029\u0000\u0000\u002C\u002D" + - "\u002E\u002F\u0030\u0031\u0032\u0033\u0034\u0035" + - "\u0036\u0037\u0038\u0039\u003A\u003B\u003C\u003D" + - "\u003E\u003F\u0040\u0041\u0042\u0043\u0044\u0045" + - "\u0046\u0047\u0000\u0049\u004A\u004B\u004C\u004D" + - "\u004E\u004F\u0050\u0051\u0052\u0053\u0054\u0055" + - "\u0056\u0057\u0058\u0059\u005A\u005B\\\u005D" + - "\u005E\u005F\u0060\u0061\u0062\u0063\u0064\u0065" + - "\u0066\u0067\u0068\u0069\u006A\u006B\u0000\u006D" + - "\u0000\u006F\u0070\u0071\u0072\u0000\u0000\u0000" + - "\u0076\u0000\u0078\u0079\u007A\u007B\u007C\u007D" + - "\u007E\u0000\u0000\u00A1\u00A2\u00A3\u00A4\u00A5" + - "\u00A6\u00A7\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00B6\u00B7\u00B8\u00B9\u00BA\u00BB\u00BC\u00BD" + - "\u00BE\u00BF\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5" + - "\u00C6\u00C7\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD" + - "\u00CE\u00CF\u00D0\u00D1\u00D2\u00D3\u00D4\u0000" + - "\u0000\u0000\u00D8\u00D9\u00DA\u00DB\u00DC\u00DD" + - "\u00DE\u00DF\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5" + - "\u00E6\u00E7\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED" + - "\u00EE\u00EF\u0000\u00F1\u00F2\u00F3\u00F4\u00F5" + - "\u00F6\u00F7\u00F8\u00F9\u00FA\u00FB\u00FC\u00FD" + - "\u00FE\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000"; - - private final static short index1[] = { - 0, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 238, 128, 128, 398, 504, 755, 1010, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/MacGreek.java b/jdk/src/share/classes/sun/nio/cs/ext/MacGreek.java deleted file mode 100644 index ebf93a6387b..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/MacGreek.java +++ /dev/null @@ -1,327 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class MacGreek - extends Charset - implements HistoricallyNamedCharset -{ - - public MacGreek() { - super("x-MacGreek", ExtendedCharsets.aliasesFor("x-MacGreek")); - } - - public String historicalName() { - return "MacGreek"; - } - - public boolean contains(Charset cs) { - return (cs instanceof MacGreek); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u00C4\u00B9\u00B2\u00C9\u00B3\u00D6\u00DC\u0385" + // 0x80 - 0x87 - "\u00E0\u00E2\u00E4\u0384\u00A8\u00E7\u00E9\u00E8" + // 0x88 - 0x8F - "\u00EA\u00EB\u00A3\u2122\u00EE\u00EF\u2022\u00BD" + // 0x90 - 0x97 - "\u2030\u00F4\u00F6\u00A6\u00AD\u00F9\u00FB\u00FC" + // 0x98 - 0x9F - "\u2020\u0393\u0394\u0398\u039B\u039E\u03A0\u00DF" + // 0xA0 - 0xA7 - "\u00AE\u00A9\u03A3\u03AA\u00A7\u2260\u00B0\u0387" + // 0xA8 - 0xAF - "\u0391\u00B1\u2264\u2265\u00A5\u0392\u0395\u0396" + // 0xB0 - 0xB7 - "\u0397\u0399\u039A\u039C\u03A6\u03AB\u03A8\u03A9" + // 0xB8 - 0xBF - "\u03AC\u039D\u00AC\u039F\u03A1\u2248\u03A4\u00AB" + // 0xC0 - 0xC7 - "\u00BB\u2026\u00A0\u03A5\u03A7\u0386\u0388\u0153" + // 0xC8 - 0xCF - "\u2013\u2015\u201C\u201D\u2018\u2019\u00F7\u0389" + // 0xD0 - 0xD7 - "\u038A\u038C\u038E\u03AD\u03AE\u03AF\u03CC\u038F" + // 0xD8 - 0xDF - "\u03CD\u03B1\u03B2\u03C8\u03B4\u03B5\u03C6\u03B3" + // 0xE0 - 0xE7 - "\u03B7\u03B9\u03BE\u03BA\u03BB\u03BC\u03BD\u03BF" + // 0xE8 - 0xEF - "\u03C0\u03CE\u03C1\u03C3\u03C4\u03B8\u03C9\u03C2" + // 0xF0 - 0xF7 - "\u03C7\u03C5\u03B6\u03CA\u03CB\u0390\u03B0\uFFFD" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00CA\u0000\u0000\u0092\u0000\u00B4\u009B\u00AC" + - "\u008C\u00A9\u0000\u00C7\u00C2\u009C\u00A8\u0000" + - "\u00AE\u00B1\u0082\u0084\u0000\u0000\u0000\u0000" + - "\u0000\u0081\u0000\u00C8\u0000\u0097\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0080\u0000\u0000\u0000" + - "\u0000\u0083\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0085\u0000" + - "\u0000\u0000\u0000\u0000\u0086\u0000\u0000\u00A7" + - "\u0088\u0000\u0089\u0000\u008A\u0000\u0000\u008D" + - "\u008F\u008E\u0090\u0091\u0000\u0000\u0094\u0095" + - "\u0000\u0000\u0000\u0000\u0099\u0000\u009A\u00D6" + - "\u0000\u009D\u0000\u009E\u009F\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00CF\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u008B\u0087\u00CD\u00AF\u00CE\u00D7\u00D8" + - "\u0000\u00D9\u0000\u00DA\u00DF\u00FD\u00B0\u00B5" + - "\u00A1\u00A2\u00B6\u00B7\u00B8\u00A3\u00B9\u00BA" + - "\u00A4\u00BB\u00C1\u00A5\u00C3\u00A6\u00C4\u0000" + - "\u00AA\u00C6\u00CB\u00BC\u00CC\u00BE\u00BF\u00AB" + - "\u00BD\u00C0\u00DB\u00DC\u00DD\u00FE\u00E1\u00E2" + - "\u00E7\u00E4\u00E5\u00FA\u00E8\u00F5\u00E9\u00EB" + - "\u00EC\u00ED\u00EE\u00EA\u00EF\u00F0\u00F2\u00F7" + - "\u00F3\u00F4\u00F9\u00E6\u00F8\u00E3\u00F6\u00FB" + - "\u00FC\u00DE\u00E0\u00F1\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00D0\u0000\u00D1" + - "\u0000\u0000\u00D4\u00D5\u0000\u0000\u00D2\u00D3" + - "\u0000\u0000\u00A0\u0000\u0096\u0000\u0000\u0000" + - "\u00C9\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0098\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0093\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00C5\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00AD\u0000\u0000\u0000\u00B2\u00B3\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 253, 337, 461, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, - 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, - 698, 920, 1104, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, - 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, - 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, - 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, - 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, - 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, - 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, - 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, - 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, - 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, - 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, - 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, - 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, - 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, 337, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/MacHebrew.java b/jdk/src/share/classes/sun/nio/cs/ext/MacHebrew.java deleted file mode 100644 index 6765157aafb..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/MacHebrew.java +++ /dev/null @@ -1,289 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class MacHebrew - extends Charset - implements HistoricallyNamedCharset -{ - - public MacHebrew() { - super("x-MacHebrew", ExtendedCharsets.aliasesFor("x-MacHebrew")); - } - - public String historicalName() { - return "MacHebrew"; - } - - public boolean contains(Charset cs) { - return (cs instanceof MacHebrew); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u00C4\uFB1F\u00C7\u00C9\u00D1\u00D6\u00DC\u00E1" + // 0x80 - 0x87 - "\u00E0\u00E2\u00E4\u00E3\u00E5\u00E7\u00E9\u00E8" + // 0x88 - 0x8F - "\u00EA\u00EB\u00ED\u00EC\u00EE\u00EF\u00F1\u00F3" + // 0x90 - 0x97 - "\u00F2\u00F4\u00F6\u00F5\u00FA\u00F9\u00FB\u00FC" + // 0x98 - 0x9F - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u20AA\uFFFD" + // 0xA0 - 0xA7 - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xA8 - 0xAF - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xB0 - 0xB7 - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xB8 - 0xBF - "\uFFFD\u201E\uFFFD\uFFFD\uFFFD\uFFFD\u05BC\uFB4B" + // 0xC0 - 0xC7 - "\uFB35\u2026\u00A0\u05B8\u05B7\u05B5\u05B6\u05B4" + // 0xC8 - 0xCF - "\u2013\u2014\u201C\u201D\u2018\u2019\uFB2A\uFB2B" + // 0xD0 - 0xD7 - "\u05BF\u05B0\u05B2\u05B1\u05BB\u05B9\uFFFD\u05B3" + // 0xD8 - 0xDF - "\u05D0\u05D1\u05D2\u05D3\u05D4\u05D5\u05D6\u05D7" + // 0xE0 - 0xE7 - "\u05D8\u05D9\u05DA\u05DB\u05DC\u05DD\u05DE\u05DF" + // 0xE8 - 0xEF - "\u05E0\u05E1\u05E2\u05E3\u05E4\u05E5\u05E6\u05E7" + // 0xF0 - 0xF7 - "\u05E8\u05E9\u05EA\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00CA\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0080\u0000\u0000\u0082" + - "\u0000\u0083\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0084\u0000\u0000\u0000\u0000\u0085\u0000" + - "\u0000\u0000\u0000\u0000\u0086\u0000\u0000\u0000" + - "\u0088\u0087\u0089\u008B\u008A\u008C\u0000\u008D" + - "\u008F\u008E\u0090\u0091\u0093\u0092\u0094\u0095" + - "\u0000\u0096\u0098\u0097\u0099\u009B\u009A\u0000" + - "\u0000\u009D\u009C\u009E\u009F\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00D9\u00DB\u00DA" + - "\u00DF\u00CF\u00CD\u00CE\u00CC\u00CB\u00DD\u0000" + - "\u00DC\u00C6\u0000\u0000\u00D8\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00E0\u00E1\u00E2" + - "\u00E3\u00E4\u00E5\u00E6\u00E7\u00E8\u00E9\u00EA" + - "\u00EB\u00EC\u00ED\u00EE\u00EF\u00F0\u00F1\u00F2" + - "\u00F3\u00F4\u00F5\u00F6\u00F7\u00F8\u00F9\u00FA" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00D0\u00D1\u0000" + - "\u0000\u0000\u00D4\u00D5\u0000\u0000\u00D2\u00D3" + - "\u00C1\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00C9\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00A6\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0081\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00D6\u00D7\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00C8\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00C7\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 253, 253, 253, 253, 333, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 570, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, - 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 253, 795, 253, 253, 253, 253, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/MacIceland.java b/jdk/src/share/classes/sun/nio/cs/ext/MacIceland.java deleted file mode 100644 index 988a3f09833..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/MacIceland.java +++ /dev/null @@ -1,402 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class MacIceland - extends Charset - implements HistoricallyNamedCharset -{ - - public MacIceland() { - super("x-MacIceland", ExtendedCharsets.aliasesFor("x-MacIceland")); - } - - public String historicalName() { - return "MacIceland"; - } - - public boolean contains(Charset cs) { - return (cs instanceof MacIceland); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u00C4\u00C5\u00C7\u00C9\u00D1\u00D6\u00DC\u00E1" + // 0x80 - 0x87 - "\u00E0\u00E2\u00E4\u00E3\u00E5\u00E7\u00E9\u00E8" + // 0x88 - 0x8F - "\u00EA\u00EB\u00ED\u00EC\u00EE\u00EF\u00F1\u00F3" + // 0x90 - 0x97 - "\u00F2\u00F4\u00F6\u00F5\u00FA\u00F9\u00FB\u00FC" + // 0x98 - 0x9F - "\u00DD\u00B0\u00A2\u00A3\u00A7\u2022\u00B6\u00DF" + // 0xA0 - 0xA7 - "\u00AE\u00A9\u2122\u00B4\u00A8\u2260\u00C6\u00D8" + // 0xA8 - 0xAF - "\u221E\u00B1\u2264\u2265\u00A5\u00B5\u2202\u2211" + // 0xB0 - 0xB7 - "\u220F\u03C0\u222B\u00AA\u00BA\u2126\u00E6\u00F8" + // 0xB8 - 0xBF - "\u00BF\u00A1\u00AC\u221A\u0192\u2248\u2206\u00AB" + // 0xC0 - 0xC7 - "\u00BB\u2026\u00A0\u00C0\u00C3\u00D5\u0152\u0153" + // 0xC8 - 0xCF - "\u2013\u2014\u201C\u201D\u2018\u2019\u00F7\u25CA" + // 0xD0 - 0xD7 - "\u00FF\u0178\u2044\u00A4\u00D0\u00F0\u00DE\u00FE" + // 0xD8 - 0xDF - "\u00FD\u00B7\u201A\u201E\u2030\u00C2\u00CA\u00C1" + // 0xE0 - 0xE7 - "\u00CB\u00C8\u00CD\u00CE\u00CF\u00CC\u00D3\u00D4" + // 0xE8 - 0xEF - "\uF8FF\u00D2\u00DA\u00DB\u00D9\u0131\u02C6\u02DC" + // 0xF0 - 0xF7 - "\u00AF\u02D8\u02D9\u02DA\u00B8\u02DD\u02DB\u02C7" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00CA\u00C1\u00A2\u00A3\u00DB\u00B4\u0000\u00A4" + - "\u00AC\u00A9\u00BB\u00C7\u00C2\u0000\u00A8\u00F8" + - "\u00A1\u00B1\u0000\u0000\u00AB\u00B5\u00A6\u00E1" + - "\u00FC\u0000\u00BC\u00C8\u0000\u0000\u0000\u00C0" + - "\u00CB\u00E7\u00E5\u00CC\u0080\u0081\u00AE\u0082" + - "\u00E9\u0083\u00E6\u00E8\u00ED\u00EA\u00EB\u00EC" + - "\u00DC\u0084\u00F1\u00EE\u00EF\u00CD\u0085\u0000" + - "\u00AF\u00F4\u00F2\u00F3\u0086\u00A0\u00DE\u00A7" + - "\u0088\u0087\u0089\u008B\u008A\u008C\u00BE\u008D" + - "\u008F\u008E\u0090\u0091\u0093\u0092\u0094\u0095" + - "\u00DD\u0096\u0098\u0097\u0099\u009B\u009A\u00D6" + - "\u00BF\u009D\u009C\u009E\u009F\u00E0\u00DF\u00D8" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00F5\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00CE\u00CF\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00D9\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00C4\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00F6\u00FF\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00F9\u00FA\u00FB" + - "\u00FE\u00F7\u00FD\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00B9\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00D0\u00D1\u0000\u0000\u0000" + - "\u00D4\u00D5\u00E2\u0000\u00D2\u00D3\u00E3\u0000" + - "\u0000\u0000\u00A5\u0000\u0000\u0000\u00C9\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00E4\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00DA\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00AA\u0000\u0000\u0000\u00BD\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00B6\u0000" + - "\u0000\u0000\u00C6\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00B8\u0000\u00B7\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00C3\u0000" + - "\u0000\u0000\u00B0\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00BA" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00C5\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00AD\u0000\u0000\u0000" + - "\u00B2\u00B3\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00D7\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00F0"; - - private final static short index1[] = { - 0, 256, 461, 683, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 920, 1142, 1396, 403, 403, 1498, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 1701, 403, 403, 403, 403, 403, 403, 403, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/MacRoman.java b/jdk/src/share/classes/sun/nio/cs/ext/MacRoman.java deleted file mode 100644 index 8fd75a96b5e..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/MacRoman.java +++ /dev/null @@ -1,434 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class MacRoman - extends Charset - implements HistoricallyNamedCharset -{ - - public MacRoman() { - super("x-MacRoman", ExtendedCharsets.aliasesFor("x-MacRoman")); - } - - public String historicalName() { - return "MacRoman"; - } - - public boolean contains(Charset cs) { - return (cs instanceof MacRoman); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u00C4\u00C5\u00C7\u00C9\u00D1\u00D6\u00DC\u00E1" + // 0x80 - 0x87 - "\u00E0\u00E2\u00E4\u00E3\u00E5\u00E7\u00E9\u00E8" + // 0x88 - 0x8F - "\u00EA\u00EB\u00ED\u00EC\u00EE\u00EF\u00F1\u00F3" + // 0x90 - 0x97 - "\u00F2\u00F4\u00F6\u00F5\u00FA\u00F9\u00FB\u00FC" + // 0x98 - 0x9F - "\u2020\u00B0\u00A2\u00A3\u00A7\u2022\u00B6\u00DF" + // 0xA0 - 0xA7 - "\u00AE\u00A9\u2122\u00B4\u00A8\u2260\u00C6\u00D8" + // 0xA8 - 0xAF - "\u221E\u00B1\u2264\u2265\u00A5\u00B5\u2202\u2211" + // 0xB0 - 0xB7 - "\u220F\u03C0\u222B\u00AA\u00BA\u03A9\u00E6\u00F8" + // 0xB8 - 0xBF - "\u00BF\u00A1\u00AC\u221A\u0192\u2248\u2206\u00AB" + // 0xC0 - 0xC7 - "\u00BB\u2026\u00A0\u00C0\u00C3\u00D5\u0152\u0153" + // 0xC8 - 0xCF - "\u2013\u2014\u201C\u201D\u2018\u2019\u00F7\u25CA" + // 0xD0 - 0xD7 - "\u00FF\u0178\u2044\u20AC\u2039\u203A\uFB01\uFB02" + // 0xD8 - 0xDF - "\u2021\u00B7\u201A\u201E\u2030\u00C2\u00CA\u00C1" + // 0xE0 - 0xE7 - "\u00CB\u00C8\u00CD\u00CE\u00CF\u00CC\u00D3\u00D4" + // 0xE8 - 0xEF - "\uF8FF\u00D2\u00DA\u00DB\u00D9\u0131\u02C6\u02DC" + // 0xF0 - 0xF7 - "\u00AF\u02D8\u02D9\u02DA\u00B8\u02DD\u02DB\u02C7" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00CA\u00C1\u00A2\u00A3\u0000\u00B4\u0000\u00A4" + - "\u00AC\u00A9\u00BB\u00C7\u00C2\u0000\u00A8\u00F8" + - "\u00A1\u00B1\u0000\u0000\u00AB\u00B5\u00A6\u00E1" + - "\u00FC\u0000\u00BC\u00C8\u0000\u0000\u0000\u00C0" + - "\u00CB\u00E7\u00E5\u00CC\u0080\u0081\u00AE\u0082" + - "\u00E9\u0083\u00E6\u00E8\u00ED\u00EA\u00EB\u00EC" + - "\u0000\u0084\u00F1\u00EE\u00EF\u00CD\u0085\u0000" + - "\u00AF\u00F4\u00F2\u00F3\u0086\u0000\u0000\u00A7" + - "\u0088\u0087\u0089\u008B\u008A\u008C\u00BE\u008D" + - "\u008F\u008E\u0090\u0091\u0093\u0092\u0094\u0095" + - "\u0000\u0096\u0098\u0097\u0099\u009B\u009A\u00D6" + - "\u00BF\u009D\u009C\u009E\u009F\u0000\u0000\u00D8" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00F5\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00CE\u00CF\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00D9\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00C4\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00F6\u00FF\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00F9\u00FA\u00FB" + - "\u00FE\u00F7\u00FD\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00BD\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00B9\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00D0\u00D1\u0000\u0000\u0000" + - "\u00D4\u00D5\u00E2\u0000\u00D2\u00D3\u00E3\u0000" + - "\u00A0\u00E0\u00A5\u0000\u0000\u0000\u00C9\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00E4\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00DC\u00DD\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00DA\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00DB\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00AA\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00B6\u0000" + - "\u0000\u0000\u00C6\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00B8\u0000\u00B7\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00C3\u0000" + - "\u0000\u0000\u00B0\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00BA" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00C5\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00AD\u0000\u0000\u0000" + - "\u00B2\u00B3\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00D7\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00F0\u0000\u00DE\u00DF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 256, 461, 683, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 920, 1142, 1396, 403, 403, 1498, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 1701, 403, 403, 1957, 403, 403, 403, 403, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/MacRomania.java b/jdk/src/share/classes/sun/nio/cs/ext/MacRomania.java deleted file mode 100644 index f5e48d8cb7e..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/MacRomania.java +++ /dev/null @@ -1,402 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class MacRomania - extends Charset - implements HistoricallyNamedCharset -{ - - public MacRomania() { - super("x-MacRomania", ExtendedCharsets.aliasesFor("x-MacRomania")); - } - - public String historicalName() { - return "MacRomania"; - } - - public boolean contains(Charset cs) { - return (cs instanceof MacRomania); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u00C4\u00C5\u00C7\u00C9\u00D1\u00D6\u00DC\u00E1" + // 0x80 - 0x87 - "\u00E0\u00E2\u00E4\u00E3\u00E5\u00E7\u00E9\u00E8" + // 0x88 - 0x8F - "\u00EA\u00EB\u00ED\u00EC\u00EE\u00EF\u00F1\u00F3" + // 0x90 - 0x97 - "\u00F2\u00F4\u00F6\u00F5\u00FA\u00F9\u00FB\u00FC" + // 0x98 - 0x9F - "\u2020\u00B0\u00A2\u00A3\u00A7\u2022\u00B6\u00DF" + // 0xA0 - 0xA7 - "\u00AE\u00A9\u2122\u00B4\u00A8\u2260\u0102\u015E" + // 0xA8 - 0xAF - "\u221E\u00B1\u2264\u2265\u00A5\u00B5\u2202\u2211" + // 0xB0 - 0xB7 - "\u220F\u03C0\u222B\u00AA\u00BA\u2126\u0103\u015F" + // 0xB8 - 0xBF - "\u00BF\u00A1\u00AC\u221A\u0192\u2248\u2206\u00AB" + // 0xC0 - 0xC7 - "\u00BB\u2026\u00A0\u00C0\u00C3\u00D5\u0152\u0153" + // 0xC8 - 0xCF - "\u2013\u2014\u201C\u201D\u2018\u2019\u00F7\u25CA" + // 0xD0 - 0xD7 - "\u00FF\u0178\u2044\u00A4\u2039\u203A\u0162\u0163" + // 0xD8 - 0xDF - "\u2021\u00B7\u201A\u201E\u2030\u00C2\u00CA\u00C1" + // 0xE0 - 0xE7 - "\u00CB\u00C8\u00CD\u00CE\u00CF\u00CC\u00D3\u00D4" + // 0xE8 - 0xEF - "\uF8FF\u00D2\u00DA\u00DB\u00D9\u0131\u02C6\u02DC" + // 0xF0 - 0xF7 - "\u00AF\u02D8\u02D9\u02DA\u00B8\u02DD\u02DB\u02C7" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00CA\u00C1\u00A2\u00A3\u00DB\u00B4\u0000\u00A4" + - "\u00AC\u00A9\u00BB\u00C7\u00C2\u0000\u00A8\u00F8" + - "\u00A1\u00B1\u0000\u0000\u00AB\u00B5\u00A6\u00E1" + - "\u00FC\u0000\u00BC\u00C8\u0000\u0000\u0000\u00C0" + - "\u00CB\u00E7\u00E5\u00CC\u0080\u0081\u0000\u0082" + - "\u00E9\u0083\u00E6\u00E8\u00ED\u00EA\u00EB\u00EC" + - "\u0000\u0084\u00F1\u00EE\u00EF\u00CD\u0085\u0000" + - "\u0000\u00F4\u00F2\u00F3\u0086\u0000\u0000\u00A7" + - "\u0088\u0087\u0089\u008B\u008A\u008C\u0000\u008D" + - "\u008F\u008E\u0090\u0091\u0093\u0092\u0094\u0095" + - "\u0000\u0096\u0098\u0097\u0099\u009B\u009A\u00D6" + - "\u0000\u009D\u009C\u009E\u009F\u0000\u0000\u00D8" + - "\u0000\u0000\u00AE\u00BE\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00F5\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00CE\u00CF\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00AF\u00BF" + - "\u0000\u0000\u00DE\u00DF\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00D9\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00C4\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00F6\u00FF\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00F9\u00FA\u00FB" + - "\u00FE\u00F7\u00FD\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00B9\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00D0\u00D1\u0000\u0000\u0000" + - "\u00D4\u00D5\u00E2\u0000\u00D2\u00D3\u00E3\u0000" + - "\u00A0\u00E0\u00A5\u0000\u0000\u0000\u00C9\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00E4\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00DC\u00DD\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00DA\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00AA\u0000\u0000\u0000\u00BD\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00B6\u0000" + - "\u0000\u0000\u00C6\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00B8\u0000\u00B7\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00C3\u0000" + - "\u0000\u0000\u00B0\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00BA" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00C5\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00AD\u0000\u0000\u0000" + - "\u00B2\u00B3\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00D7\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00F0"; - - private final static short index1[] = { - 0, 256, 461, 683, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 920, 1142, 1396, 403, 403, 1498, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 1701, 403, 403, 403, 403, 403, 403, 403, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/MacSymbol.java b/jdk/src/share/classes/sun/nio/cs/ext/MacSymbol.java deleted file mode 100644 index 580a53557b0..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/MacSymbol.java +++ /dev/null @@ -1,425 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class MacSymbol - extends Charset - implements HistoricallyNamedCharset -{ - - public MacSymbol() { - super("x-MacSymbol", ExtendedCharsets.aliasesFor("x-MacSymbol")); - } - - public String historicalName() { - return "MacSymbol"; - } - - public boolean contains(Charset cs) { - return (cs instanceof MacSymbol); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0x80 - 0x87 - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0x88 - 0x8F - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0x90 - 0x97 - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0x98 - 0x9F - "\u20AC\u03D2\u2032\u2264\u2044\u221E\u0192\u2663" + // 0xA0 - 0xA7 - "\u2666\u2665\u2660\u2194\u2190\u2191\u2192\u2193" + // 0xA8 - 0xAF - "\u00B0\u00B1\u2033\u2265\u00D7\u221D\u2202\u2022" + // 0xB0 - 0xB7 - "\u00F7\u2260\u2261\u2248\u2026\uF8E6\uF8E7\u21B5" + // 0xB8 - 0xBF - "\u2135\u2111\u211C\u2118\u2297\u2295\u2205\u2229" + // 0xC0 - 0xC7 - "\u222A\u2283\u2287\u2284\u2282\u2286\u2208\u2209" + // 0xC8 - 0xCF - "\u2220\u2207\u00AE\u00A9\u2122\u220F\u221A\u22C5" + // 0xD0 - 0xD7 - "\u00AC\u2227\u2228\u21D4\u21D0\u21D1\u21D2\u21D3" + // 0xD8 - 0xDF - "\u22C4\u3008\uFFFD\uFFFD\uFFFD\u2211\uFFFD\uFFFD" + // 0xE0 - 0xE7 - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uF8F4" + // 0xE8 - 0xEF - "\uF8FF\u3009\u222B\u2320\uFFFD\u2321\uFFFD\uFFFD" + // 0xF0 - 0xF7 - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\u2200\u0023\u2203\u0025\u0026\u220D" + // 0x20 - 0x27 - "\u0028\u0029\u2217\u002B\u002C\u2212\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u2245\u0391\u0392\u03A7\u0394\u0395\u03A6\u0393" + // 0x40 - 0x47 - "\u0397\u0399\u03D1\u039A\u039B\u039C\u039D\u039F" + // 0x48 - 0x4F - "\u03A0\u0398\u03A1\u03A3\u03A4\u03A5\u03C2\u03A9" + // 0x50 - 0x57 - "\u039E\u03A8\u0396\u005B\u2234\u005D\u22A5\u005F" + // 0x58 - 0x5F - "\uF8E5\u03B1\u03B2\u03C7\u03B4\u03B5\u03C6\u03B3" + // 0x60 - 0x67 - "\u03B7\u03B9\u03D5\u03BA\u03BB\u03BC\u03BD\u03BF" + // 0x68 - 0x6F - "\u03C0\u03B8\u03C1\u03C3\u03C4\u03C5\u03D6\u03C9" + // 0x70 - 0x77 - "\u03BE\u03C8\u03B6\u007B\u007C\u007D\u223C\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\u0000\u0023\u0000\u0025\u0026\u0000" + - "\u0028\u0029\u0000\u002B\u002C\u0000\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u005B\u0000\u005D\u0000\u005F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u007B\u007C\u007D\u0000\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00D3\u0000\u0000\u00D8\u0000\u00D2\u0000" + - "\u00B0\u00B1\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00B4" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00B8" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00A6\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0041\u0042\u0047\u0044\u0045" + - "\u005A\u0048\u0051\u0049\u004B\u004C\u004D\u004E" + - "\u0058\u004F\u0050\u0052\u0000\u0053\u0054\u0055" + - "\u0046\u0043\u0059\u0057\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0061\u0062\u0067\u0064\u0065" + - "\u007A\u0068\u0071\u0069\u006B\u006C\u006D\u006E" + - "\u0078\u006F\u0070\u0072\u0056\u0073\u0074\u0075" + - "\u0066\u0063\u0079\u0077\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u004A\u00A1\u0000\u0000\u006A" + - "\u0076\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00B7\u0000\u0000\u0000\u00BC\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00A2\u00B2\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00A4\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00A0\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00C1\u0000\u0000\u0000\u0000\u0000\u0000\u00C3" + - "\u0000\u0000\u0000\u00C2\u0000\u0000\u0000\u0000" + - "\u0000\u00D4\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00C0\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00AC" + - "\u00AD\u00AE\u00AF\u00AB\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00BF\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00DC" + - "\u00DD\u00DE\u00DF\u00DB\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\"" + - "\u0000\u00B6\u0024\u0000\u00C6\u0000\u00D1\u00CE" + - "\u00CF\u0000\u0000\u0000\'\u0000\u00D5\u0000" + - "\u00E5\u002D\u0000\u0000\u0000\u0000\u002A\u0000" + - "\u0000\u00D6\u0000\u0000\u00B5\u00A5\u0000\u00D0" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00D9\u00DA" + - "\u00C7\u00C8\u00F2\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\\\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u007E\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0040\u0000\u0000\u00BB" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00B9" + - "\u00BA\u0000\u0000\u00A3\u00B3\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00CC\u00C9\u00CB\u0000\u00CD\u00CA\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00C5\u0000\u00C4\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u005E\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00E0\u00D7\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00F3" + - "\u00F5\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00AA" + - "\u0000\u0000\u00A7\u0000\u00A9\u00A8\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00E1" + - "\u00F1\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0060" + - "\u00BD\u00BE\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00EF\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00F0"; - - private final static short index1[] = { - 0, 248, 395, 506, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 728, 967, 1223, 1447, 395, 395, 1607, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 1855, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 1882, 395, 395, 395, 395, 395, 395, 395, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/MacThai.java b/jdk/src/share/classes/sun/nio/cs/ext/MacThai.java deleted file mode 100644 index 0c82884aab0..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/MacThai.java +++ /dev/null @@ -1,338 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class MacThai - extends Charset - implements HistoricallyNamedCharset -{ - - public MacThai() { - super("x-MacThai", ExtendedCharsets.aliasesFor("x-MacThai")); - } - - public String historicalName() { - return "MacThai"; - } - - public boolean contains(Charset cs) { - return (cs instanceof MacThai); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u00AB\u00BB\u2026\uF88C\uF88F\uF892\uF895\uF898" + // 0x80 - 0x87 - "\uF88B\uF88E\uF891\uF894\uF897\u201C\u201D\uF899" + // 0x88 - 0x8F - "\uFFFD\u2022\uF884\uF889\uF885\uF886\uF887\uF888" + // 0x90 - 0x97 - "\uF88A\uF88D\uF890\uF893\uF896\u2018\u2019\uFFFD" + // 0x98 - 0x9F - "\u00A0\u0E01\u0E02\u0E03\u0E04\u0E05\u0E06\u0E07" + // 0xA0 - 0xA7 - "\u0E08\u0E09\u0E0A\u0E0B\u0E0C\u0E0D\u0E0E\u0E0F" + // 0xA8 - 0xAF - "\u0E10\u0E11\u0E12\u0E13\u0E14\u0E15\u0E16\u0E17" + // 0xB0 - 0xB7 - "\u0E18\u0E19\u0E1A\u0E1B\u0E1C\u0E1D\u0E1E\u0E1F" + // 0xB8 - 0xBF - "\u0E20\u0E21\u0E22\u0E23\u0E24\u0E25\u0E26\u0E27" + // 0xC0 - 0xC7 - "\u0E28\u0E29\u0E2A\u0E2B\u0E2C\u0E2D\u0E2E\u0E2F" + // 0xC8 - 0xCF - "\u0E30\u0E31\u0E32\u0E33\u0E34\u0E35\u0E36\u0E37" + // 0xD0 - 0xD7 - "\u0E38\u0E39\u0E3A\uFEFF\u200B\u2013\u2014\u0E3F" + // 0xD8 - 0xDF - "\u0E40\u0E41\u0E42\u0E43\u0E44\u0E45\u0E46\u0E47" + // 0xE0 - 0xE7 - "\u0E48\u0E49\u0E4A\u0E4B\u0E4C\u0E4D\u2122\u0E4F" + // 0xE8 - 0xEF - "\u0E50\u0E51\u0E52\u0E53\u0E54\u0E55\u0E56\u0E57" + // 0xF0 - 0xF7 - "\u0E58\u0E59\u00AE\u00A9\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00A0\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00FB\u0000\u0080\u0000\u0000\u00FA\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0081\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00A1\u00A2\u00A3\u00A4" + - "\u00A5\u00A6\u00A7\u00A8\u00A9\u00AA\u00AB\u00AC" + - "\u00AD\u00AE\u00AF\u00B0\u00B1\u00B2\u00B3\u00B4" + - "\u00B5\u00B6\u00B7\u00B8\u00B9\u00BA\u00BB\u00BC" + - "\u00BD\u00BE\u00BF\u00C0\u00C1\u00C2\u00C3\u00C4" + - "\u00C5\u00C6\u00C7\u00C8\u00C9\u00CA\u00CB\u00CC" + - "\u00CD\u00CE\u00CF\u00D0\u00D1\u00D2\u00D3\u00D4" + - "\u00D5\u00D6\u00D7\u00D8\u00D9\u00DA\u0000\u0000" + - "\u0000\u0000\u00DF\u00E0\u00E1\u00E2\u00E3\u00E4" + - "\u00E5\u00E6\u00E7\u00E8\u00E9\u00EA\u00EB\u00EC" + - "\u00ED\u0000\u00EF\u00F0\u00F1\u00F2\u00F3\u00F4" + - "\u00F5\u00F6\u00F7\u00F8\u00F9\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00DC\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00DD\u00DE\u0000\u0000\u0000" + - "\u009D\u009E\u0000\u0000\u008D\u008E\u0000\u0000" + - "\u0000\u0000\u0091\u0000\u0000\u0000\u0082\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00EE\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0092\u0094" + - "\u0095\u0096\u0097\u0093\u0098\u0088\u0083\u0099" + - "\u0089\u0084\u009A\u008A\u0085\u009B\u008B\u0086" + - "\u009C\u008C\u0087\u008F\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00DB"; - - private final static short index1[] = { - 0, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 443, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 688, 910, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, - 188, 188, 188, 188, 188, 188, 188, 188, 1034, 188, 188, 188, 188, 188, 1188, 188, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/MacTurkish.java b/jdk/src/share/classes/sun/nio/cs/ext/MacTurkish.java deleted file mode 100644 index 23fe73bc6d0..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/MacTurkish.java +++ /dev/null @@ -1,402 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class MacTurkish - extends Charset - implements HistoricallyNamedCharset -{ - - public MacTurkish() { - super("x-MacTurkish", ExtendedCharsets.aliasesFor("x-MacTurkish")); - } - - public String historicalName() { - return "MacTurkish"; - } - - public boolean contains(Charset cs) { - return (cs instanceof MacTurkish); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u00C4\u00C5\u00C7\u00C9\u00D1\u00D6\u00DC\u00E1" + // 0x80 - 0x87 - "\u00E0\u00E2\u00E4\u00E3\u00E5\u00E7\u00E9\u00E8" + // 0x88 - 0x8F - "\u00EA\u00EB\u00ED\u00EC\u00EE\u00EF\u00F1\u00F3" + // 0x90 - 0x97 - "\u00F2\u00F4\u00F6\u00F5\u00FA\u00F9\u00FB\u00FC" + // 0x98 - 0x9F - "\u2020\u00B0\u00A2\u00A3\u00A7\u2022\u00B6\u00DF" + // 0xA0 - 0xA7 - "\u00AE\u00A9\u2122\u00B4\u00A8\u2260\u00C6\u00D8" + // 0xA8 - 0xAF - "\u221E\u00B1\u2264\u2265\u00A5\u00B5\u2202\u2211" + // 0xB0 - 0xB7 - "\u220F\u03C0\u222B\u00AA\u00BA\u2126\u00E6\u00F8" + // 0xB8 - 0xBF - "\u00BF\u00A1\u00AC\u221A\u0192\u2248\u2206\u00AB" + // 0xC0 - 0xC7 - "\u00BB\u2026\u00A0\u00C0\u00C3\u00D5\u0152\u0153" + // 0xC8 - 0xCF - "\u2013\u2014\u201C\u201D\u2018\u2019\u00F7\u25CA" + // 0xD0 - 0xD7 - "\u00FF\u0178\u011E\u011F\u0130\u0131\u015E\u015F" + // 0xD8 - 0xDF - "\u2021\u00B7\u201A\u201E\u2030\u00C2\u00CA\u00C1" + // 0xE0 - 0xE7 - "\u00CB\u00C8\u00CD\u00CE\u00CF\u00CC\u00D3\u00D4" + // 0xE8 - 0xEF - "\uF8FF\u00D2\u00DA\u00DB\u00D9\uFFFD\u02C6\u02DC" + // 0xF0 - 0xF7 - "\u00AF\u02D8\u02D9\u02DA\u00B8\u02DD\u02DB\u02C7" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00CA\u00C1\u00A2\u00A3\u0000\u00B4\u0000\u00A4" + - "\u00AC\u00A9\u00BB\u00C7\u00C2\u0000\u00A8\u00F8" + - "\u00A1\u00B1\u0000\u0000\u00AB\u00B5\u00A6\u00E1" + - "\u00FC\u0000\u00BC\u00C8\u0000\u0000\u0000\u00C0" + - "\u00CB\u00E7\u00E5\u00CC\u0080\u0081\u00AE\u0082" + - "\u00E9\u0083\u00E6\u00E8\u00ED\u00EA\u00EB\u00EC" + - "\u0000\u0084\u00F1\u00EE\u00EF\u00CD\u0085\u0000" + - "\u00AF\u00F4\u00F2\u00F3\u0086\u0000\u0000\u00A7" + - "\u0088\u0087\u0089\u008B\u008A\u008C\u00BE\u008D" + - "\u008F\u008E\u0090\u0091\u0093\u0092\u0094\u0095" + - "\u0000\u0096\u0098\u0097\u0099\u009B\u009A\u00D6" + - "\u00BF\u009D\u009C\u009E\u009F\u0000\u0000\u00D8" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00DA\u00DB" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00DC\u00DD\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00CE\u00CF\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00DE\u00DF" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00D9\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00C4\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00F6\u00FF\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00F9\u00FA\u00FB" + - "\u00FE\u00F7\u00FD\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00B9\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00D0\u00D1\u0000\u0000\u0000" + - "\u00D4\u00D5\u00E2\u0000\u00D2\u00D3\u00E3\u0000" + - "\u00A0\u00E0\u00A5\u0000\u0000\u0000\u00C9\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00E4\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00AA\u0000\u0000\u0000\u00BD\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00B6\u0000" + - "\u0000\u0000\u00C6\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00B8\u0000\u00B7\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u00C3\u0000" + - "\u0000\u0000\u00B0\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00BA" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00C5\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00AD\u0000\u0000\u0000" + - "\u00B2\u00B3\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00D7\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u00F0"; - - private final static short index1[] = { - 0, 256, 461, 683, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 920, 1142, 1396, 403, 403, 1498, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - 403, 403, 403, 403, 403, 403, 403, 403, 1701, 403, 403, 403, 403, 403, 403, 403, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/MacUkraine.java b/jdk/src/share/classes/sun/nio/cs/ext/MacUkraine.java deleted file mode 100644 index 678c62f380f..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/MacUkraine.java +++ /dev/null @@ -1,361 +0,0 @@ - -/* - * Copyright 2003-2004 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 sun.nio.cs.ext; - - -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class MacUkraine - extends Charset - implements HistoricallyNamedCharset -{ - - public MacUkraine() { - super("x-MacUkraine", ExtendedCharsets.aliasesFor("x-MacUkraine")); - } - - public String historicalName() { - return "MacUkraine"; - } - - public boolean contains(Charset cs) { - return (cs instanceof MacUkraine); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417" + // 0x80 - 0x87 - "\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F" + // 0x88 - 0x8F - "\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427" + // 0x90 - 0x97 - "\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F" + // 0x98 - 0x9F - "\u2020\u00B0\u0490\u00A3\u00A7\u2022\u00B6\u0406" + // 0xA0 - 0xA7 - "\u00AE\u00A9\u2122\u0402\u0452\u2260\u0403\u0453" + // 0xA8 - 0xAF - "\u221E\u00B1\u2264\u2265\u0456\u00B5\u0491\u0408" + // 0xB0 - 0xB7 - "\u0404\u0454\u0407\u0457\u0409\u0459\u040A\u045A" + // 0xB8 - 0xBF - "\u0458\u0405\u00AC\u221A\u0192\u2248\u2206\u00AB" + // 0xC0 - 0xC7 - "\u00BB\u2026\u00A0\u040B\u045B\u040C\u045C\u0455" + // 0xC8 - 0xCF - "\u2013\u2014\u201C\u201D\u2018\u2019\u00F7\u201E" + // 0xD0 - 0xD7 - "\u040E\u045E\u040F\u045F\u2116\u0401\u0451\u044F" + // 0xD8 - 0xDF - "\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437" + // 0xE0 - 0xE7 - "\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F" + // 0xE8 - 0xEF - "\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447" + // 0xF0 - 0xF7 - "\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u00A4" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00CA\u0000\u0000\u00A3\u00FF\u0000\u0000\u00A4" + - "\u0000\u00A9\u0000\u00C7\u00C2\u0000\u00A8\u0000" + - "\u00A1\u00B1\u0000\u0000\u0000\u00B5\u00A6\u0000" + - "\u0000\u0000\u0000\u00C8\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00D6" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00C4\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00DD\u00AB\u00AE\u00B8\u00C1" + - "\u00A7\u00BA\u00B7\u00BC\u00BE\u00CB\u00CD\u0000" + - "\u00D8\u00DA\u0080\u0081\u0082\u0083\u0084\u0085" + - "\u0086\u0087\u0088\u0089\u008A\u008B\u008C\u008D" + - "\u008E\u008F\u0090\u0091\u0092\u0093\u0094\u0095" + - "\u0096\u0097\u0098\u0099\u009A\u009B\u009C\u009D" + - "\u009E\u009F\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5" + - "\u00E6\u00E7\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED" + - "\u00EE\u00EF\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5" + - "\u00F6\u00F7\u00F8\u00F9\u00FA\u00FB\u00FC\u00FD" + - "\u00FE\u00DF\u0000\u00DE\u00AC\u00AF\u00B9\u00CF" + - "\u00B4\u00BB\u00C0\u00BD\u00BF\u00CC\u00CE\u0000" + - "\u00D9\u00DB\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00A2\u00B6\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u00D0\u00D1\u0000\u0000\u0000\u00D4" + - "\u00D5\u0000\u0000\u00D2\u00D3\u00D7\u0000\u00A0" + - "\u0000\u00A5\u0000\u0000\u0000\u00C9\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u00DC" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00AA\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00C6\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u00C3\u0000\u0000" + - "\u0000\u00B0\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00C5\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u00AD\u0000\u0000\u0000\u00B2" + - "\u00B3\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 248, 395, 395, 650, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 887, 1121, 1371, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, 395, - - }; - } -} diff --git a/jdk/src/share/classes/sun/nio/cs/ext/TIS_620.java b/jdk/src/share/classes/sun/nio/cs/ext/TIS_620.java deleted file mode 100644 index 973135a98b3..00000000000 --- a/jdk/src/share/classes/sun/nio/cs/ext/TIS_620.java +++ /dev/null @@ -1,244 +0,0 @@ - -/* - * Copyright 2002-2004 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 sun.nio.cs.ext; - - -import java.nio.ByteBuffer; -import java.nio.CharBuffer; -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import java.nio.charset.CharacterCodingException; -import java.nio.charset.MalformedInputException; -import java.nio.charset.UnmappableCharacterException; -import sun.nio.cs.StandardCharsets; -import sun.nio.cs.SingleByteDecoder; -import sun.nio.cs.SingleByteEncoder; -import sun.nio.cs.HistoricallyNamedCharset; - -public class TIS_620 - extends Charset - implements HistoricallyNamedCharset -{ - - public TIS_620() { - super("TIS-620", ExtendedCharsets.aliasesFor("TIS-620")); - } - - public String historicalName() { - return "TIS620"; - } - - public boolean contains(Charset cs) { - return ((cs.name().equals("US-ASCII")) - || (cs instanceof TIS_620)); - } - - public CharsetDecoder newDecoder() { - return new Decoder(this); - } - - public CharsetEncoder newEncoder() { - return new Encoder(this); - } - - - /** - * These accessors are temporarily supplied while sun.io - * converters co-exist with the sun.nio.cs.{ext} charset coders - * These facilitate sharing of conversion tables between the - * two co-existing implementations. When sun.io converters - * are made extinct these will be unncessary and should be removed - */ - - public String getDecoderSingleByteMappings() { - return Decoder.byteToCharTable; - - } - - public short[] getEncoderIndex1() { - return Encoder.index1; - - } - public String getEncoderIndex2() { - return Encoder.index2; - - } - - private static class Decoder extends SingleByteDecoder { - public Decoder(Charset cs) { - super(cs, byteToCharTable); - } - - private final static String byteToCharTable = - - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0x80 - 0x87 - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0x88 - 0x8F - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0x90 - 0x97 - "\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD" + // 0x98 - 0x9F - "\u00A0\u0E01\u0E02\u0E03\u0E04\u0E05\u0E06\u0E07" + // 0xA0 - 0xA7 - "\u0E08\u0E09\u0E0A\u0E0B\u0E0C\u0E0D\u0E0E\u0E0F" + // 0xA8 - 0xAF - "\u0E10\u0E11\u0E12\u0E13\u0E14\u0E15\u0E16\u0E17" + // 0xB0 - 0xB7 - "\u0E18\u0E19\u0E1A\u0E1B\u0E1C\u0E1D\u0E1E\u0E1F" + // 0xB8 - 0xBF - "\u0E20\u0E21\u0E22\u0E23\u0E24\u0E25\u0E26\u0E27" + // 0xC0 - 0xC7 - "\u0E28\u0E29\u0E2A\u0E2B\u0E2C\u0E2D\u0E2E\u0E2F" + // 0xC8 - 0xCF - "\u0E30\u0E31\u0E32\u0E33\u0E34\u0E35\u0E36\u0E37" + // 0xD0 - 0xD7 - "\u0E38\u0E39\u0E3A\uFFFD\uFFFD\uFFFD\uFFFD\u0E3F" + // 0xD8 - 0xDF - "\u0E40\u0E41\u0E42\u0E43\u0E44\u0E45\u0E46\u0E47" + // 0xE0 - 0xE7 - "\u0E48\u0E49\u0E4A\u0E4B\u0E4C\u0E4D\u0E4E\u0E4F" + // 0xE8 - 0xEF - "\u0E50\u0E51\u0E52\u0E53\u0E54\u0E55\u0E56\u0E57" + // 0xF0 - 0xF7 - "\u0E58\u0E59\u0E5A\u0E5B\uFFFD\uFFFD\uFFFD\uFFFD" + // 0xF8 - 0xFF - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + // 0x00 - 0x07 - "\b\t\n\u000B\f\r\u000E\u000F" + // 0x08 - 0x0F - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + // 0x10 - 0x17 - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + // 0x18 - 0x1F - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + // 0x20 - 0x27 - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + // 0x28 - 0x2F - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + // 0x30 - 0x37 - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + // 0x38 - 0x3F - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + // 0x40 - 0x47 - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + // 0x48 - 0x4F - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + // 0x50 - 0x57 - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + // 0x58 - 0x5F - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + // 0x60 - 0x67 - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + // 0x68 - 0x6F - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + // 0x70 - 0x77 - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F"; // 0x78 - 0x7F - } - - private static class Encoder extends SingleByteEncoder { - public Encoder(Charset cs) { - super(cs, index1, index2, 0xFF00, 0x00FF, 8); - } - - private final static String index2 = - - "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007" + - "\b\t\n\u000B\f\r\u000E\u000F" + - "\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017" + - "\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F" + - "\u0020\u0021\"\u0023\u0024\u0025\u0026\'" + - "\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F" + - "\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037" + - "\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F" + - "\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047" + - "\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F" + - "\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057" + - "\u0058\u0059\u005A\u005B\\\u005D\u005E\u005F" + - "\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067" + - "\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F" + - "\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077" + - "\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u00A0\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u00A1\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7" + - "\u00A8\u00A9\u00AA\u00AB\u00AC\u00AD\u00AE\u00AF" + - "\u00B0\u00B1\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7" + - "\u00B8\u00B9\u00BA\u00BB\u00BC\u00BD\u00BE\u00BF" + - "\u00C0\u00C1\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7" + - "\u00C8\u00C9\u00CA\u00CB\u00CC\u00CD\u00CE\u00CF" + - "\u00D0\u00D1\u00D2\u00D3\u00D4\u00D5\u00D6\u00D7" + - "\u00D8\u00D9\u00DA\u0000\u0000\u0000\u0000\u00DF" + - "\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7" + - "\u00E8\u00E9\u00EA\u00EB\u00EC\u00ED\u00EE\u00EF" + - "\u00F0\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7" + - "\u00F8\u00F9\u00FA\u00FB\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" + - "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000"; - - private final static short index1[] = { - 0, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 416, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - }; - } -} From e0d2bfab81e2b9c577c6989ded28d8f1ee0784c1 Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Wed, 10 Dec 2008 15:14:29 -0800 Subject: [PATCH 203/267] 6727377: VM stack guard pages on Windows should PAGE_READWRITE not PAGE_EXECUTE_READWRITE Make reguard_stack change access to RW, not execute and use os::protect_memory with the new parameter when change needed to X. Reviewed-by: acorn, jcoomes --- hotspot/src/os/linux/vm/os_linux.cpp | 2 +- hotspot/src/os/solaris/vm/os_solaris.cpp | 4 +++- hotspot/src/os/windows/vm/os_windows.cpp | 9 +++++---- hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp | 5 +++-- hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp | 5 +++-- hotspot/src/share/vm/prims/jni.cpp | 3 ++- hotspot/src/share/vm/runtime/os.cpp | 5 +++-- hotspot/src/share/vm/runtime/os.hpp | 2 +- 8 files changed, 21 insertions(+), 14 deletions(-) diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp index 6331bf4aca5..3b8c0b4dc03 100644 --- a/hotspot/src/os/linux/vm/os_linux.cpp +++ b/hotspot/src/os/linux/vm/os_linux.cpp @@ -2500,7 +2500,7 @@ bool os::guard_memory(char* addr, size_t size) { } bool os::unguard_memory(char* addr, size_t size) { - return linux_mprotect(addr, size, PROT_READ|PROT_WRITE|PROT_EXEC); + return linux_mprotect(addr, size, PROT_READ|PROT_WRITE); } // Large page support diff --git a/hotspot/src/os/solaris/vm/os_solaris.cpp b/hotspot/src/os/solaris/vm/os_solaris.cpp index 7225f3be425..8553c1edee2 100644 --- a/hotspot/src/os/solaris/vm/os_solaris.cpp +++ b/hotspot/src/os/solaris/vm/os_solaris.cpp @@ -3026,6 +3026,8 @@ static bool solaris_mprotect(char* addr, size_t bytes, int prot) { // Protect memory (Used to pass readonly pages through // JNI GetArrayElements with empty arrays.) +// Also, used for serialization page and for compressed oops null pointer +// checking. bool os::protect_memory(char* addr, size_t bytes, ProtType prot, bool is_committed) { unsigned int p = 0; @@ -3049,7 +3051,7 @@ bool os::guard_memory(char* addr, size_t bytes) { } bool os::unguard_memory(char* addr, size_t bytes) { - return solaris_mprotect(addr, bytes, PROT_READ|PROT_WRITE|PROT_EXEC); + return solaris_mprotect(addr, bytes, PROT_READ|PROT_WRITE); } // Large page support diff --git a/hotspot/src/os/windows/vm/os_windows.cpp b/hotspot/src/os/windows/vm/os_windows.cpp index 97228370b9f..d674d434b90 100644 --- a/hotspot/src/os/windows/vm/os_windows.cpp +++ b/hotspot/src/os/windows/vm/os_windows.cpp @@ -2020,10 +2020,11 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) { if (UnguardOnExecutionViolation > 0 && addr != last_addr && (UnguardOnExecutionViolation > 1 || os::address_is_in_vm(addr))) { - // Unguard and retry + // Set memory to RWX and retry address page_start = (address) align_size_down((intptr_t) addr, (intptr_t) page_size); - bool res = os::unguard_memory((char*) page_start, page_size); + bool res = os::protect_memory((char*) page_start, page_size, + os::MEM_PROT_RWX); if (PrintMiscellaneous && Verbose) { char buf[256]; @@ -2755,12 +2756,12 @@ bool os::protect_memory(char* addr, size_t bytes, ProtType prot, bool os::guard_memory(char* addr, size_t bytes) { DWORD old_status; - return VirtualProtect(addr, bytes, PAGE_EXECUTE_READWRITE | PAGE_GUARD, &old_status) != 0; + return VirtualProtect(addr, bytes, PAGE_READWRITE | PAGE_GUARD, &old_status) != 0; } bool os::unguard_memory(char* addr, size_t bytes) { DWORD old_status; - return VirtualProtect(addr, bytes, PAGE_EXECUTE_READWRITE, &old_status) != 0; + return VirtualProtect(addr, bytes, PAGE_READWRITE, &old_status) != 0; } void os::realign_memory(char *addr, size_t bytes, size_t alignment_hint) { } diff --git a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp index 174c1df492e..90e1921f8a0 100644 --- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp +++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp @@ -422,10 +422,11 @@ JVM_handle_linux_signal(int sig, if (addr != last_addr && (UnguardOnExecutionViolation > 1 || os::address_is_in_vm(addr))) { - // Unguard and retry + // Set memory to RWX and retry address page_start = (address) align_size_down((intptr_t) addr, (intptr_t) page_size); - bool res = os::unguard_memory((char*) page_start, page_size); + bool res = os::protect_memory((char*) page_start, page_size, + os::MEM_PROT_RWX); if (PrintMiscellaneous && Verbose) { char buf[256]; diff --git a/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp b/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp index 011b671e850..c37370b572b 100644 --- a/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp +++ b/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp @@ -576,10 +576,11 @@ int JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid, int abort_ if (addr != last_addr && (UnguardOnExecutionViolation > 1 || os::address_is_in_vm(addr))) { - // Unguard and retry + // Make memory rwx and retry address page_start = (address) align_size_down((intptr_t) addr, (intptr_t) page_size); - bool res = os::unguard_memory((char*) page_start, page_size); + bool res = os::protect_memory((char*) page_start, page_size, + os::MEM_PROT_RWX); if (PrintMiscellaneous && Verbose) { char buf[256]; diff --git a/hotspot/src/share/vm/prims/jni.cpp b/hotspot/src/share/vm/prims/jni.cpp index 49ace5c9823..b4a82b9e547 100644 --- a/hotspot/src/share/vm/prims/jni.cpp +++ b/hotspot/src/share/vm/prims/jni.cpp @@ -2173,7 +2173,8 @@ static char* get_bad_address() { size_t size = os::vm_allocation_granularity(); bad_address = os::reserve_memory(size); if (bad_address != NULL) { - os::protect_memory(bad_address, size, os::MEM_PROT_READ); + os::protect_memory(bad_address, size, os::MEM_PROT_READ, + /*is_committed*/false); } } return bad_address; diff --git a/hotspot/src/share/vm/runtime/os.cpp b/hotspot/src/share/vm/runtime/os.cpp index 088a07ff45e..da6d719edc0 100644 --- a/hotspot/src/share/vm/runtime/os.cpp +++ b/hotspot/src/share/vm/runtime/os.cpp @@ -932,8 +932,9 @@ void os::serialize_thread_states() { // the mutator thread if such case is encountered. See bug 6546278 for details. Thread::muxAcquire(&SerializePageLock, "serialize_thread_states"); os::protect_memory((char *)os::get_memory_serialize_page(), - os::vm_page_size(), MEM_PROT_READ, /*is_committed*/true ); - os::unguard_memory((char *)os::get_memory_serialize_page(), os::vm_page_size()); + os::vm_page_size(), MEM_PROT_READ); + os::protect_memory((char *)os::get_memory_serialize_page(), + os::vm_page_size(), MEM_PROT_RW); Thread::muxRelease(&SerializePageLock); } diff --git a/hotspot/src/share/vm/runtime/os.hpp b/hotspot/src/share/vm/runtime/os.hpp index 423cc800529..0856d23a03b 100644 --- a/hotspot/src/share/vm/runtime/os.hpp +++ b/hotspot/src/share/vm/runtime/os.hpp @@ -208,7 +208,7 @@ class os: AllStatic { enum ProtType { MEM_PROT_NONE, MEM_PROT_READ, MEM_PROT_RW, MEM_PROT_RWX }; static bool protect_memory(char* addr, size_t bytes, ProtType prot, - bool is_committed = false); + bool is_committed = true); static bool guard_memory(char* addr, size_t bytes); static bool unguard_memory(char* addr, size_t bytes); From 26f6b1692ac681f0cd0aa081531f6264cbee7717 Mon Sep 17 00:00:00 2001 From: "Y. Srinivas Ramakrishna" Date: Wed, 10 Dec 2008 23:46:10 -0800 Subject: [PATCH 204/267] 6782457: CMS: Livelock in CompactibleFreeListSpace::block_size() 6736295: SIGSEGV in product jvm, assertion "these are the only valid states during a mark sweep" in fastdebug Restructured the code in the perm gen allocation retry loop so as to avoid "safepoint-blocking" on locks, in this case the Heap_lock, while holding uninitialized allocated heap storage. Reviewed-by: apetrusenko, iveresov, jcoomes, jmasa, poonam --- hotspot/src/share/vm/memory/permGen.cpp | 64 ++++++++++++------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/hotspot/src/share/vm/memory/permGen.cpp b/hotspot/src/share/vm/memory/permGen.cpp index e31c19c80ed..65635fe26cf 100644 --- a/hotspot/src/share/vm/memory/permGen.cpp +++ b/hotspot/src/share/vm/memory/permGen.cpp @@ -26,20 +26,24 @@ #include "incls/_permGen.cpp.incl" HeapWord* PermGen::mem_allocate_in_gen(size_t size, Generation* gen) { - MutexLocker ml(Heap_lock); GCCause::Cause next_cause = GCCause::_permanent_generation_full; GCCause::Cause prev_cause = GCCause::_no_gc; + unsigned int gc_count_before, full_gc_count_before; + HeapWord* obj; for (;;) { - HeapWord* obj = gen->allocate(size, false); - if (obj != NULL) { - return obj; - } - if (gen->capacity() < _capacity_expansion_limit || - prev_cause != GCCause::_no_gc) { - obj = gen->expand_and_allocate(size, false); - } - if (obj == NULL && prev_cause != GCCause::_last_ditch_collection) { + { + MutexLocker ml(Heap_lock); + if ((obj = gen->allocate(size, false)) != NULL) { + return obj; + } + if (gen->capacity() < _capacity_expansion_limit || + prev_cause != GCCause::_no_gc) { + obj = gen->expand_and_allocate(size, false); + } + if (obj != NULL || prev_cause == GCCause::_last_ditch_collection) { + return obj; + } if (GC_locker::is_active_and_needs_gc()) { // If this thread is not in a jni critical section, we stall // the requestor until the critical section has cleared and @@ -61,31 +65,27 @@ HeapWord* PermGen::mem_allocate_in_gen(size_t size, Generation* gen) { return NULL; } } - // Read the GC count while holding the Heap_lock - unsigned int gc_count_before = SharedHeap::heap()->total_collections(); - unsigned int full_gc_count_before = SharedHeap::heap()->total_full_collections(); - { - MutexUnlocker mu(Heap_lock); // give up heap lock, execute gets it back - VM_GenCollectForPermanentAllocation op(size, gc_count_before, full_gc_count_before, - next_cause); - VMThread::execute(&op); - if (!op.prologue_succeeded() || op.gc_locked()) { - assert(op.result() == NULL, "must be NULL if gc_locked() is true"); - continue; // retry and/or stall as necessary - } - obj = op.result(); - assert(obj == NULL || SharedHeap::heap()->is_in_reserved(obj), - "result not in heap"); - if (obj != NULL) { - return obj; - } - } - prev_cause = next_cause; - next_cause = GCCause::_last_ditch_collection; - } else { + gc_count_before = SharedHeap::heap()->total_collections(); + full_gc_count_before = SharedHeap::heap()->total_full_collections(); + } + + // Give up heap lock above, VMThread::execute below gets it back + VM_GenCollectForPermanentAllocation op(size, gc_count_before, full_gc_count_before, + next_cause); + VMThread::execute(&op); + if (!op.prologue_succeeded() || op.gc_locked()) { + assert(op.result() == NULL, "must be NULL if gc_locked() is true"); + continue; // retry and/or stall as necessary + } + obj = op.result(); + assert(obj == NULL || SharedHeap::heap()->is_in_reserved(obj), + "result not in heap"); + if (obj != NULL) { return obj; } + prev_cause = next_cause; + next_cause = GCCause::_last_ditch_collection; } } From 92ea783f35496b7c68282155f805c126749cff25 Mon Sep 17 00:00:00 2001 From: Lev Serebryakov Date: Thu, 11 Dec 2008 03:22:04 -0800 Subject: [PATCH 205/267] 6639341: sometimes contended-exit event comes after contended-entered on another thread DTrace probe "contended-exit" should be fired before unparking object, or context could be lost. Probe firing was moved to proper place. Reviewed-by: coleenp, kamg --- hotspot/src/share/vm/runtime/synchronizer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hotspot/src/share/vm/runtime/synchronizer.cpp b/hotspot/src/share/vm/runtime/synchronizer.cpp index eb4e2cac0c4..aeb66980add 100644 --- a/hotspot/src/share/vm/runtime/synchronizer.cpp +++ b/hotspot/src/share/vm/runtime/synchronizer.cpp @@ -3363,13 +3363,13 @@ void ObjectMonitor::ExitEpilog (Thread * Self, ObjectWaiter * Wakee) { // If the wakee is cold then transiently setting it's affinity // to the current CPU is a good idea. // See http://j2se.east/~dice/PERSIST/050624-PullAffinity.txt + DTRACE_MONITOR_PROBE(contended__exit, this, object(), Self); Trigger->unpark() ; // Maintain stats and report events to JVMTI if (ObjectSynchronizer::_sync_Parks != NULL) { ObjectSynchronizer::_sync_Parks->inc() ; } - DTRACE_MONITOR_PROBE(contended__exit, this, object(), Self); } From 000b18450778c44e737202f129264f3177be3fbd Mon Sep 17 00:00:00 2001 From: John Coomes Date: Thu, 11 Dec 2008 12:05:08 -0800 Subject: [PATCH 206/267] 6578152: fill_region_with_object has usability and safety issues Reviewed-by: apetrusenko, ysr --- .../gc_implementation/g1/g1CollectedHeap.cpp | 9 +- .../vm/gc_implementation/g1/heapRegionSeq.cpp | 2 +- .../parNew/parGCAllocBuffer.cpp | 16 ++- .../parNew/parNewGeneration.cpp | 2 +- .../parallelScavenge/psMarkSweep.cpp | 23 ++-- .../parallelScavenge/psMarkSweepDecorator.cpp | 19 +--- .../parallelScavenge/psParallelCompact.cpp | 19 ++-- .../parallelScavenge/psParallelCompact.hpp | 31 +++-- .../parallelScavenge/psPromotionManager.cpp | 23 +--- .../shared/mutableNUMASpace.cpp | 12 +- .../share/vm/gc_interface/collectedHeap.cpp | 106 +++++++++++++++++- .../share/vm/gc_interface/collectedHeap.hpp | 39 +++++++ .../vm/gc_interface/collectedHeap.inline.hpp | 7 +- hotspot/src/share/vm/includeDB_gc | 7 +- hotspot/src/share/vm/memory/sharedHeap.cpp | 40 ------- hotspot/src/share/vm/memory/sharedHeap.hpp | 8 -- hotspot/src/share/vm/memory/space.cpp | 16 +-- .../src/share/vm/memory/tenuredGeneration.cpp | 2 +- .../vm/memory/threadLocalAllocBuffer.cpp | 3 +- hotspot/src/share/vm/memory/universe.cpp | 33 +++--- hotspot/src/share/vm/memory/universe.hpp | 3 + hotspot/src/share/vm/oops/arrayOop.hpp | 23 ++-- hotspot/src/share/vm/oops/typeArrayKlass.cpp | 7 +- hotspot/src/share/vm/oops/typeArrayKlass.hpp | 6 +- hotspot/src/share/vm/runtime/globals.hpp | 3 + 25 files changed, 261 insertions(+), 198 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index f0cad8ed231..47bff6cca98 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -2954,7 +2954,7 @@ public: // The object has been either evacuated or is dead. Fill it with a // dummy object. MemRegion mr((HeapWord*)obj, obj->size()); - SharedHeap::fill_region_with_object(mr); + CollectedHeap::fill_with_object(mr); _cm->clearRangeBothMaps(mr); } } @@ -3225,7 +3225,7 @@ void G1CollectedHeap::par_allocate_remaining_space(HeapRegion* r) { // Otherwise, try to claim it. block = r->par_allocate(free_words); } while (block == NULL); - SharedHeap::fill_region_with_object(MemRegion(block, free_words)); + fill_with_object(block, free_words); } #define use_local_bitmaps 1 @@ -3619,9 +3619,8 @@ public: guarantee(alloc_buffer(purpose)->contains(obj + word_sz - 1), "should contain whole object"); alloc_buffer(purpose)->undo_allocation(obj, word_sz); - } - else { - SharedHeap::fill_region_with_object(MemRegion(obj, word_sz)); + } else { + CollectedHeap::fill_with_object(obj, word_sz); add_to_undo_waste(word_sz); } } diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp index 315e4a351b3..b3de279e402 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp @@ -102,7 +102,7 @@ HeapRegionSeq::alloc_obj_from_region_index(int ind, size_t word_size) { HeapWord* tmp = hr->allocate(sz); assert(tmp != NULL, "Humongous allocation failure"); MemRegion mr = MemRegion(tmp, sz); - SharedHeap::fill_region_with_object(mr); + CollectedHeap::fill_with_object(mr); hr->declare_filled_region_to_BOT(mr); if (i == first) { first_hr->set_startsHumongous(); diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parGCAllocBuffer.cpp b/hotspot/src/share/vm/gc_implementation/parNew/parGCAllocBuffer.cpp index d4c641bf028..e2d0ebd701f 100644 --- a/hotspot/src/share/vm/gc_implementation/parNew/parGCAllocBuffer.cpp +++ b/hotspot/src/share/vm/gc_implementation/parNew/parGCAllocBuffer.cpp @@ -51,14 +51,14 @@ void ParGCAllocBuffer::retire(bool end_of_gc, bool retain) { if (_retained) { // If the buffer had been retained shorten the previous filler object. assert(_retained_filler.end() <= _top, "INVARIANT"); - SharedHeap::fill_region_with_object(_retained_filler); + CollectedHeap::fill_with_object(_retained_filler); // Wasted space book-keeping, otherwise (normally) done in invalidate() _wasted += _retained_filler.word_size(); _retained = false; } assert(!end_of_gc || !_retained, "At this point, end_of_gc ==> !_retained."); if (_top < _hard_end) { - SharedHeap::fill_region_with_object(MemRegion(_top, _hard_end)); + CollectedHeap::fill_with_object(_top, _hard_end); if (!retain) { invalidate(); } else { @@ -155,7 +155,7 @@ ParGCAllocBufferWithBOT::ParGCAllocBufferWithBOT(size_t word_sz, // modifying the _next_threshold state in the BOT. void ParGCAllocBufferWithBOT::fill_region_with_block(MemRegion mr, bool contig) { - SharedHeap::fill_region_with_object(mr); + CollectedHeap::fill_with_object(mr); if (contig) { _bt.alloc_block(mr.start(), mr.end()); } else { @@ -171,7 +171,7 @@ HeapWord* ParGCAllocBufferWithBOT::allocate_slow(size_t word_sz) { "or else _true_end should be equal to _hard_end"); assert(_retained, "or else _true_end should be equal to _hard_end"); assert(_retained_filler.end() <= _top, "INVARIANT"); - SharedHeap::fill_region_with_object(_retained_filler); + CollectedHeap::fill_with_object(_retained_filler); if (_top < _hard_end) { fill_region_with_block(MemRegion(_top, _hard_end), true); } @@ -316,11 +316,9 @@ void ParGCAllocBufferWithBOT::retire(bool end_of_gc, bool retain) { while (_top <= chunk_boundary) { assert(pointer_delta(_hard_end, chunk_boundary) >= AlignmentReserve, "Consequence of last card handling above."); - MemRegion chunk_portion(chunk_boundary, _hard_end); - _bt.BlockOffsetArray::alloc_block(chunk_portion.start(), - chunk_portion.end()); - SharedHeap::fill_region_with_object(chunk_portion); - _hard_end = chunk_portion.start(); + _bt.BlockOffsetArray::alloc_block(chunk_boundary, _hard_end); + CollectedHeap::fill_with_object(chunk_boundary, _hard_end); + _hard_end = chunk_boundary; chunk_boundary -= ChunkSizeInWords; } _end = _hard_end - AlignmentReserve; diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp index 72907679905..a2b7607bb79 100644 --- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp +++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp @@ -201,7 +201,7 @@ void ParScanThreadState::undo_alloc_in_to_space(HeapWord* obj, "Should contain whole object."); to_space_alloc_buffer()->undo_allocation(obj, word_sz); } else { - SharedHeap::fill_region_with_object(MemRegion(obj, word_sz)); + CollectedHeap::fill_with_object(obj, word_sz); } } diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp index ea0c20b0148..829403f5128 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp @@ -389,7 +389,7 @@ bool PSMarkSweep::absorb_live_data_from_eden(PSAdaptiveSizePolicy* size_policy, // full GC. const size_t alignment = old_gen->virtual_space()->alignment(); const size_t eden_used = eden_space->used_in_bytes(); - const size_t promoted = (size_t)(size_policy->avg_promoted()->padded_average()); + const size_t promoted = (size_t)size_policy->avg_promoted()->padded_average(); const size_t absorb_size = align_size_up(eden_used + promoted, alignment); const size_t eden_capacity = eden_space->capacity_in_bytes(); @@ -416,16 +416,14 @@ bool PSMarkSweep::absorb_live_data_from_eden(PSAdaptiveSizePolicy* size_policy, // Fill the unused part of the old gen. MutableSpace* const old_space = old_gen->object_space(); - MemRegion old_gen_unused(old_space->top(), old_space->end()); + HeapWord* const unused_start = old_space->top(); + size_t const unused_words = pointer_delta(old_space->end(), unused_start); - // If the unused part of the old gen cannot be filled, skip - // absorbing eden. - if (old_gen_unused.word_size() < SharedHeap::min_fill_size()) { - return false; - } - - if (!old_gen_unused.is_empty()) { - SharedHeap::fill_region_with_object(old_gen_unused); + if (unused_words > 0) { + if (unused_words < CollectedHeap::min_fill_size()) { + return false; // If the old gen cannot be filled, must give up. + } + CollectedHeap::fill_with_objects(unused_start, unused_words); } // Take the live data from eden and set both top and end in the old gen to @@ -441,9 +439,8 @@ bool PSMarkSweep::absorb_live_data_from_eden(PSAdaptiveSizePolicy* size_policy, // Update the object start array for the filler object and the data from eden. ObjectStartArray* const start_array = old_gen->start_array(); - HeapWord* const start = old_gen_unused.start(); - for (HeapWord* addr = start; addr < new_top; addr += oop(addr)->size()) { - start_array->allocate_block(addr); + for (HeapWord* p = unused_start; p < new_top; p += oop(p)->size()) { + start_array->allocate_block(p); } // Could update the promoted average here, but it is not typically updated at diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp index 310ad40d1b7..4cc90cd2de2 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp @@ -275,22 +275,9 @@ bool PSMarkSweepDecorator::insert_deadspace(size_t& allowed_deadspace_words, HeapWord* q, size_t deadlength) { if (allowed_deadspace_words >= deadlength) { allowed_deadspace_words -= deadlength; - oop(q)->set_mark(markOopDesc::prototype()->set_marked()); - const size_t aligned_min_int_array_size = - align_object_size(typeArrayOopDesc::header_size(T_INT)); - if (deadlength >= aligned_min_int_array_size) { - oop(q)->set_klass(Universe::intArrayKlassObj()); - assert(((deadlength - aligned_min_int_array_size) * (HeapWordSize/sizeof(jint))) < (size_t)max_jint, - "deadspace too big for Arrayoop"); - typeArrayOop(q)->set_length((int)((deadlength - aligned_min_int_array_size) - * (HeapWordSize/sizeof(jint)))); - } else { - assert((int) deadlength == instanceOopDesc::header_size(), - "size for smallest fake dead object doesn't match"); - oop(q)->set_klass(SystemDictionary::object_klass()); - } - assert((int) deadlength == oop(q)->size(), - "make sure size for fake dead object match"); + CollectedHeap::fill_with_object(q, deadlength); + oop(q)->set_mark(oop(q)->mark()->set_marked()); + assert((int) deadlength == oop(q)->size(), "bad filler object size"); // Recall that we required "q == compaction_top". return true; } else { diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp index 1ad78f84c56..dd01b7b49ff 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp @@ -1308,8 +1308,7 @@ void PSParallelCompact::fill_dense_prefix_end(SpaceId id) } #endif // #ifdef _LP64 - MemRegion region(obj_beg, obj_len); - SharedHeap::fill_region_with_object(region); + gc_heap()->fill_with_object(obj_beg, obj_len); _mark_bitmap.mark_obj(obj_beg, obj_len); _summary_data.add_obj(obj_beg, obj_len); assert(start_array(id) != NULL, "sanity"); @@ -1807,9 +1806,14 @@ bool PSParallelCompact::absorb_live_data_from_eden(PSAdaptiveSizePolicy* size_po // Fill the unused part of the old gen. MutableSpace* const old_space = old_gen->object_space(); - MemRegion old_gen_unused(old_space->top(), old_space->end()); - if (!old_gen_unused.is_empty()) { - SharedHeap::fill_region_with_object(old_gen_unused); + HeapWord* const unused_start = old_space->top(); + size_t const unused_words = pointer_delta(old_space->end(), unused_start); + + if (unused_words > 0) { + if (unused_words < CollectedHeap::min_fill_size()) { + return false; // If the old gen cannot be filled, must give up. + } + CollectedHeap::fill_with_objects(unused_start, unused_words); } // Take the live data from eden and set both top and end in the old gen to @@ -1825,9 +1829,8 @@ bool PSParallelCompact::absorb_live_data_from_eden(PSAdaptiveSizePolicy* size_po // Update the object start array for the filler object and the data from eden. ObjectStartArray* const start_array = old_gen->start_array(); - HeapWord* const start = old_gen_unused.start(); - for (HeapWord* addr = start; addr < new_top; addr += oop(addr)->size()) { - start_array->allocate_block(addr); + for (HeapWord* p = unused_start; p < new_top; p += oop(p)->size()) { + start_array->allocate_block(p); } // Could update the promoted average here, but it is not typically updated at diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp index 7ca899956f4..476c6b7d731 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp @@ -1324,31 +1324,28 @@ inline void UpdateOnlyClosure::do_addr(HeapWord* addr) oop(addr)->update_contents(compaction_manager()); } -class FillClosure: public ParMarkBitMapClosure { - public: +class FillClosure: public ParMarkBitMapClosure +{ +public: FillClosure(ParCompactionManager* cm, PSParallelCompact::SpaceId space_id) : ParMarkBitMapClosure(PSParallelCompact::mark_bitmap(), cm), - _space_id(space_id), - _start_array(PSParallelCompact::start_array(space_id)) { - assert(_space_id == PSParallelCompact::perm_space_id || - _space_id == PSParallelCompact::old_space_id, + _start_array(PSParallelCompact::start_array(space_id)) + { + assert(space_id == PSParallelCompact::perm_space_id || + space_id == PSParallelCompact::old_space_id, "cannot use FillClosure in the young gen"); - assert(bitmap() != NULL, "need a bitmap"); - assert(_start_array != NULL, "need a start array"); - } - - void fill_region(HeapWord* addr, size_t size) { - MemRegion region(addr, size); - SharedHeap::fill_region_with_object(region); - _start_array->allocate_block(addr); } virtual IterationStatus do_addr(HeapWord* addr, size_t size) { - fill_region(addr, size); + CollectedHeap::fill_with_objects(addr, size); + HeapWord* const end = addr + size; + do { + _start_array->allocate_block(addr); + addr += oop(addr)->size(); + } while (addr < end); return ParMarkBitMap::incomplete; } private: - const PSParallelCompact::SpaceId _space_id; - ObjectStartArray* const _start_array; + ObjectStartArray* const _start_array; }; diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp index dd74617ebb3..11b6118322b 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp @@ -499,26 +499,15 @@ oop PSPromotionManager::copy_to_survivor_space(oop o, bool depth_first) { // We lost, someone else "owns" this object guarantee(o->is_forwarded(), "Object must be forwarded if the cas failed."); - // Unallocate the space used. NOTE! We may have directly allocated - // the object. If so, we cannot deallocate it, so we have to test! + // Try to deallocate the space. If it was directly allocated we cannot + // deallocate it, so we have to test. If the deallocation fails, + // overwrite with a filler object. if (new_obj_is_tenured) { if (!_old_lab.unallocate_object(new_obj)) { - // The promotion lab failed to unallocate the object. - // We need to overwrite the object with a filler that - // contains no interior pointers. - MemRegion mr((HeapWord*)new_obj, new_obj_size); - // Clean this up and move to oopFactory (see bug 4718422) - SharedHeap::fill_region_with_object(mr); - } - } else { - if (!_young_lab.unallocate_object(new_obj)) { - // The promotion lab failed to unallocate the object. - // We need to overwrite the object with a filler that - // contains no interior pointers. - MemRegion mr((HeapWord*)new_obj, new_obj_size); - // Clean this up and move to oopFactory (see bug 4718422) - SharedHeap::fill_region_with_object(mr); + CollectedHeap::fill_with_object((HeapWord*) new_obj, new_obj_size); } + } else if (!_young_lab.unallocate_object(new_obj)) { + CollectedHeap::fill_with_object((HeapWord*) new_obj, new_obj_size); } // don't update this before the unallocation! diff --git a/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp b/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp index 0f38b70ee69..c639bbf3f96 100644 --- a/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp +++ b/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp @@ -76,8 +76,8 @@ void MutableNUMASpace::ensure_parsability() { MutableSpace *s = ls->space(); if (s->top() < top()) { // For all spaces preceeding the one containing top() if (s->free_in_words() > 0) { - SharedHeap::fill_region_with_object(MemRegion(s->top(), s->end())); size_t area_touched_words = pointer_delta(s->end(), s->top()); + CollectedHeap::fill_with_object(s->top(), area_touched_words); #ifndef ASSERT if (!ZapUnusedHeapArea) { area_touched_words = MIN2((size_t)align_object_size(typeArrayOopDesc::header_size(T_INT)), @@ -686,11 +686,11 @@ void MutableNUMASpace::set_top(HeapWord* value) { // a minimal object; assuming that's not the last chunk in which case we don't care. if (i < lgrp_spaces()->length() - 1) { size_t remainder = pointer_delta(s->end(), value); - const size_t minimal_object_size = oopDesc::header_size(); - if (remainder < minimal_object_size && remainder > 0) { - // Add a filler object of a minimal size, it will cross the chunk boundary. - SharedHeap::fill_region_with_object(MemRegion(value, minimal_object_size)); - value += minimal_object_size; + const size_t min_fill_size = CollectedHeap::min_fill_size(); + if (remainder < min_fill_size && remainder > 0) { + // Add a minimum size filler object; it will cross the chunk boundary. + CollectedHeap::fill_with_object(value, min_fill_size); + value += min_fill_size; assert(!s->contains(value), "Should be in the next chunk"); // Restart the loop from the same chunk, since the value has moved // to the next one. diff --git a/hotspot/src/share/vm/gc_interface/collectedHeap.cpp b/hotspot/src/share/vm/gc_interface/collectedHeap.cpp index df8ef081632..4e0f7e8813e 100644 --- a/hotspot/src/share/vm/gc_interface/collectedHeap.cpp +++ b/hotspot/src/share/vm/gc_interface/collectedHeap.cpp @@ -30,12 +30,21 @@ int CollectedHeap::_fire_out_of_memory_count = 0; #endif +size_t CollectedHeap::_filler_array_max_size = 0; + // Memory state functions. -CollectedHeap::CollectedHeap() : - _reserved(), _barrier_set(NULL), _is_gc_active(false), - _total_collections(0), _total_full_collections(0), - _gc_cause(GCCause::_no_gc), _gc_lastcause(GCCause::_no_gc) { +CollectedHeap::CollectedHeap() +{ + const size_t max_len = size_t(arrayOopDesc::max_array_length(T_INT)); + const size_t elements_per_word = HeapWordSize / sizeof(jint); + _filler_array_max_size = align_object_size(filler_array_hdr_size() + + max_len * elements_per_word); + + _barrier_set = NULL; + _is_gc_active = false; + _total_collections = _total_full_collections = 0; + _gc_cause = _gc_lastcause = GCCause::_no_gc; NOT_PRODUCT(_promotion_failure_alot_count = 0;) NOT_PRODUCT(_promotion_failure_alot_gc_number = 0;) @@ -128,6 +137,95 @@ HeapWord* CollectedHeap::allocate_from_tlab_slow(Thread* thread, size_t size) { return obj; } +size_t CollectedHeap::filler_array_hdr_size() { + return size_t(arrayOopDesc::header_size(T_INT)); +} + +size_t CollectedHeap::filler_array_min_size() { + return align_object_size(filler_array_hdr_size()); +} + +size_t CollectedHeap::filler_array_max_size() { + return _filler_array_max_size; +} + +#ifdef ASSERT +void CollectedHeap::fill_args_check(HeapWord* start, size_t words) +{ + assert(words >= min_fill_size(), "too small to fill"); + assert(words % MinObjAlignment == 0, "unaligned size"); + assert(Universe::heap()->is_in_reserved(start), "not in heap"); + assert(Universe::heap()->is_in_reserved(start + words - 1), "not in heap"); +} + +void CollectedHeap::zap_filler_array(HeapWord* start, size_t words) +{ + if (ZapFillerObjects) { + Copy::fill_to_words(start + filler_array_hdr_size(), + words - filler_array_hdr_size(), 0XDEAFBABE); + } +} +#endif // ASSERT + +void +CollectedHeap::fill_with_array(HeapWord* start, size_t words) +{ + assert(words >= filler_array_min_size(), "too small for an array"); + assert(words <= filler_array_max_size(), "too big for a single object"); + + const size_t payload_size = words - filler_array_hdr_size(); + const size_t len = payload_size * HeapWordSize / sizeof(jint); + + // Set the length first for concurrent GC. + ((arrayOop)start)->set_length((int)len); + post_allocation_setup_common(Universe::fillerArrayKlassObj(), start, + words); + DEBUG_ONLY(zap_filler_array(start, words);) +} + +void +CollectedHeap::fill_with_object_impl(HeapWord* start, size_t words) +{ + assert(words <= filler_array_max_size(), "too big for a single object"); + + if (words >= filler_array_min_size()) { + fill_with_array(start, words); + } else if (words > 0) { + assert(words == min_fill_size(), "unaligned size"); + post_allocation_setup_common(SystemDictionary::object_klass(), start, + words); + } +} + +void CollectedHeap::fill_with_object(HeapWord* start, size_t words) +{ + DEBUG_ONLY(fill_args_check(start, words);) + HandleMark hm; // Free handles before leaving. + fill_with_object_impl(start, words); +} + +void CollectedHeap::fill_with_objects(HeapWord* start, size_t words) +{ + DEBUG_ONLY(fill_args_check(start, words);) + HandleMark hm; // Free handles before leaving. + +#ifdef LP64 + // A single array can fill ~8G, so multiple objects are needed only in 64-bit. + // First fill with arrays, ensuring that any remaining space is big enough to + // fill. The remainder is filled with a single object. + const size_t min = min_fill_size(); + const size_t max = filler_array_max_size(); + while (words > max) { + const size_t cur = words - max >= min ? max : max - min; + fill_with_array(start, cur); + start += cur; + words -= cur; + } +#endif + + fill_with_object_impl(start, words); +} + oop CollectedHeap::new_store_barrier(oop new_obj) { // %%% This needs refactoring. (It was imported from the server compiler.) guarantee(can_elide_tlab_store_barriers(), "store barrier elision not supported"); diff --git a/hotspot/src/share/vm/gc_interface/collectedHeap.hpp b/hotspot/src/share/vm/gc_interface/collectedHeap.hpp index 69369e3f7d4..13d30c70b6d 100644 --- a/hotspot/src/share/vm/gc_interface/collectedHeap.hpp +++ b/hotspot/src/share/vm/gc_interface/collectedHeap.hpp @@ -47,6 +47,9 @@ class CollectedHeap : public CHeapObj { static int _fire_out_of_memory_count; #endif + // Used for filler objects (static, but initialized in ctor). + static size_t _filler_array_max_size; + protected: MemRegion _reserved; BarrierSet* _barrier_set; @@ -119,6 +122,21 @@ class CollectedHeap : public CHeapObj { // Clears an allocated object. inline static void init_obj(HeapWord* obj, size_t size); + // Filler object utilities. + static inline size_t filler_array_hdr_size(); + static inline size_t filler_array_min_size(); + static inline size_t filler_array_max_size(); + + DEBUG_ONLY(static void fill_args_check(HeapWord* start, size_t words);) + DEBUG_ONLY(static void zap_filler_array(HeapWord* start, size_t words);) + + // Fill with a single array; caller must ensure filler_array_min_size() <= + // words <= filler_array_max_size(). + static inline void fill_with_array(HeapWord* start, size_t words); + + // Fill with a single object (either an int array or a java.lang.Object). + static inline void fill_with_object_impl(HeapWord* start, size_t words); + // Verification functions virtual void check_for_bad_heap_word_value(HeapWord* addr, size_t size) PRODUCT_RETURN; @@ -294,6 +312,27 @@ class CollectedHeap : public CHeapObj { // The boundary between a "large" and "small" array of primitives, in words. virtual size_t large_typearray_limit() = 0; + // Utilities for turning raw memory into filler objects. + // + // min_fill_size() is the smallest region that can be filled. + // fill_with_objects() can fill arbitrary-sized regions of the heap using + // multiple objects. fill_with_object() is for regions known to be smaller + // than the largest array of integers; it uses a single object to fill the + // region and has slightly less overhead. + static size_t min_fill_size() { + return size_t(align_object_size(oopDesc::header_size())); + } + + static void fill_with_objects(HeapWord* start, size_t words); + + static void fill_with_object(HeapWord* start, size_t words); + static void fill_with_object(MemRegion region) { + fill_with_object(region.start(), region.word_size()); + } + static void fill_with_object(HeapWord* start, HeapWord* end) { + fill_with_object(start, pointer_delta(end, start)); + } + // Some heaps may offer a contiguous region for shared non-blocking // allocation, via inlined code (by exporting the address of the top and // end fields defining the extent of the contiguous allocation region.) diff --git a/hotspot/src/share/vm/gc_interface/collectedHeap.inline.hpp b/hotspot/src/share/vm/gc_interface/collectedHeap.inline.hpp index efc3210bf0a..c8e59edac33 100644 --- a/hotspot/src/share/vm/gc_interface/collectedHeap.inline.hpp +++ b/hotspot/src/share/vm/gc_interface/collectedHeap.inline.hpp @@ -34,7 +34,6 @@ void CollectedHeap::post_allocation_setup_common(KlassHandle klass, void CollectedHeap::post_allocation_setup_no_klass_install(KlassHandle klass, HeapWord* objPtr, size_t size) { - oop obj = (oop)objPtr; assert(obj != NULL, "NULL object pointer"); @@ -44,9 +43,6 @@ void CollectedHeap::post_allocation_setup_no_klass_install(KlassHandle klass, // May be bootstrapping obj->set_mark(markOopDesc::prototype()); } - - // support low memory notifications (no-op if not enabled) - LowMemoryDetector::detect_low_memory_for_collected_pools(); } void CollectedHeap::post_allocation_install_obj_klass(KlassHandle klass, @@ -65,6 +61,9 @@ void CollectedHeap::post_allocation_install_obj_klass(KlassHandle klass, // Support for jvmti and dtrace inline void post_allocation_notify(KlassHandle klass, oop obj) { + // support low memory notifications (no-op if not enabled) + LowMemoryDetector::detect_low_memory_for_collected_pools(); + // support for JVMTI VMObjectAlloc event (no-op if not enabled) JvmtiExport::vm_object_alloc_event_collector(obj); diff --git a/hotspot/src/share/vm/includeDB_gc b/hotspot/src/share/vm/includeDB_gc index 662805cc0d4..336148bf8fa 100644 --- a/hotspot/src/share/vm/includeDB_gc +++ b/hotspot/src/share/vm/includeDB_gc @@ -28,21 +28,22 @@ collectedHeap.cpp collectedHeap.hpp collectedHeap.cpp collectedHeap.inline.hpp collectedHeap.cpp init.hpp collectedHeap.cpp oop.inline.hpp +collectedHeap.cpp systemDictionary.hpp collectedHeap.cpp thread_.inline.hpp collectedHeap.hpp allocation.hpp collectedHeap.hpp barrierSet.hpp collectedHeap.hpp gcCause.hpp collectedHeap.hpp handles.hpp -collectedHeap.hpp perfData.hpp +collectedHeap.hpp perfData.hpp collectedHeap.hpp safepoint.hpp collectedHeap.inline.hpp arrayOop.hpp collectedHeap.inline.hpp collectedHeap.hpp collectedHeap.inline.hpp copy.hpp collectedHeap.inline.hpp jvmtiExport.hpp -collectedHeap.inline.hpp lowMemoryDetector.hpp -collectedHeap.inline.hpp sharedRuntime.hpp +collectedHeap.inline.hpp lowMemoryDetector.hpp +collectedHeap.inline.hpp sharedRuntime.hpp collectedHeap.inline.hpp thread.hpp collectedHeap.inline.hpp threadLocalAllocBuffer.inline.hpp collectedHeap.inline.hpp universe.hpp diff --git a/hotspot/src/share/vm/memory/sharedHeap.cpp b/hotspot/src/share/vm/memory/sharedHeap.cpp index 853b0ebb310..392487a31ad 100644 --- a/hotspot/src/share/vm/memory/sharedHeap.cpp +++ b/hotspot/src/share/vm/memory/sharedHeap.cpp @@ -248,46 +248,6 @@ void SharedHeap::ref_processing_init() { perm_gen()->ref_processor_init(); } -void SharedHeap::fill_region_with_object(MemRegion mr) { - // Disable the posting of JVMTI VMObjectAlloc events as we - // don't want the filling of tlabs with filler arrays to be - // reported to the profiler. - NoJvmtiVMObjectAllocMark njm; - - // Disable low memory detector because there is no real allocation. - LowMemoryDetectorDisabler lmd_dis; - - // It turns out that post_allocation_setup_array takes a handle, so the - // call below contains an implicit conversion. Best to free that handle - // as soon as possible. - HandleMark hm; - - size_t word_size = mr.word_size(); - size_t aligned_array_header_size = - align_object_size(typeArrayOopDesc::header_size(T_INT)); - - if (word_size >= aligned_array_header_size) { - const size_t array_length = - pointer_delta(mr.end(), mr.start()) - - typeArrayOopDesc::header_size(T_INT); - const size_t array_length_words = - array_length * (HeapWordSize/sizeof(jint)); - post_allocation_setup_array(Universe::intArrayKlassObj(), - mr.start(), - mr.word_size(), - (int)array_length_words); -#ifdef ASSERT - HeapWord* elt_words = (mr.start() + typeArrayOopDesc::header_size(T_INT)); - Copy::fill_to_words(elt_words, array_length, 0xDEAFBABE); -#endif - } else { - assert(word_size == (size_t)oopDesc::header_size(), "Unaligned?"); - post_allocation_setup_obj(SystemDictionary::object_klass(), - mr.start(), - mr.word_size()); - } -} - // Some utilities. void SharedHeap::print_size_transition(outputStream* out, size_t bytes_before, diff --git a/hotspot/src/share/vm/memory/sharedHeap.hpp b/hotspot/src/share/vm/memory/sharedHeap.hpp index 662f011c7ab..c8c570e87db 100644 --- a/hotspot/src/share/vm/memory/sharedHeap.hpp +++ b/hotspot/src/share/vm/memory/sharedHeap.hpp @@ -108,14 +108,6 @@ public: void set_perm(PermGen* perm_gen) { _perm_gen = perm_gen; } - // A helper function that fills a region of the heap with - // with a single object. - static void fill_region_with_object(MemRegion mr); - - // Minimum garbage fill object size - static size_t min_fill_size() { return (size_t)align_object_size(oopDesc::header_size()); } - static size_t min_fill_size_in_bytes() { return min_fill_size() * HeapWordSize; } - // This function returns the "GenRemSet" object that allows us to scan // generations; at least the perm gen, possibly more in a fully // generational heap. diff --git a/hotspot/src/share/vm/memory/space.cpp b/hotspot/src/share/vm/memory/space.cpp index 82529444c0a..652d585bb8f 100644 --- a/hotspot/src/share/vm/memory/space.cpp +++ b/hotspot/src/share/vm/memory/space.cpp @@ -409,19 +409,9 @@ bool CompactibleSpace::insert_deadspace(size_t& allowed_deadspace_words, HeapWord* q, size_t deadlength) { if (allowed_deadspace_words >= deadlength) { allowed_deadspace_words -= deadlength; - oop(q)->set_mark(markOopDesc::prototype()->set_marked()); - const size_t min_int_array_size = typeArrayOopDesc::header_size(T_INT); - if (deadlength >= min_int_array_size) { - oop(q)->set_klass(Universe::intArrayKlassObj()); - typeArrayOop(q)->set_length((int)((deadlength - min_int_array_size) - * (HeapWordSize/sizeof(jint)))); - } else { - assert((int) deadlength == instanceOopDesc::header_size(), - "size for smallest fake dead object doesn't match"); - oop(q)->set_klass(SystemDictionary::object_klass()); - } - assert((int) deadlength == oop(q)->size(), - "make sure size for fake dead object match"); + CollectedHeap::fill_with_object(q, deadlength); + oop(q)->set_mark(oop(q)->mark()->set_marked()); + assert((int) deadlength == oop(q)->size(), "bad filler object size"); // Recall that we required "q == compaction_top". return true; } else { diff --git a/hotspot/src/share/vm/memory/tenuredGeneration.cpp b/hotspot/src/share/vm/memory/tenuredGeneration.cpp index dcd6626e80d..56eed211d98 100644 --- a/hotspot/src/share/vm/memory/tenuredGeneration.cpp +++ b/hotspot/src/share/vm/memory/tenuredGeneration.cpp @@ -387,7 +387,7 @@ void TenuredGeneration::par_promote_alloc_undo(int thread_num, "should contain whole object"); buf->undo_allocation(obj, word_sz); } else { - SharedHeap::fill_region_with_object(MemRegion(obj, word_sz)); + CollectedHeap::fill_with_object(obj, word_sz); } } diff --git a/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp b/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp index fdcfdd28e13..01d7d6e6a2f 100644 --- a/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp +++ b/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp @@ -100,8 +100,7 @@ void ThreadLocalAllocBuffer::accumulate_statistics() { void ThreadLocalAllocBuffer::make_parsable(bool retire) { if (end() != NULL) { invariants(); - MemRegion mr(top(), hard_end()); - SharedHeap::fill_region_with_object(mr); + CollectedHeap::fill_with_object(top(), hard_end()); if (retire || ZeroTLAB) { // "Reset" the TLAB set_start(NULL); diff --git a/hotspot/src/share/vm/memory/universe.cpp b/hotspot/src/share/vm/memory/universe.cpp index ffe583ecc16..567e10145bf 100644 --- a/hotspot/src/share/vm/memory/universe.cpp +++ b/hotspot/src/share/vm/memory/universe.cpp @@ -49,16 +49,17 @@ klassOop Universe::_constantPoolKlassObj = NULL; klassOop Universe::_constantPoolCacheKlassObj = NULL; klassOop Universe::_compiledICHolderKlassObj = NULL; klassOop Universe::_systemObjArrayKlassObj = NULL; -oop Universe::_int_mirror = NULL; -oop Universe::_float_mirror = NULL; -oop Universe::_double_mirror = NULL; -oop Universe::_byte_mirror = NULL; -oop Universe::_bool_mirror = NULL; -oop Universe::_char_mirror = NULL; -oop Universe::_long_mirror = NULL; -oop Universe::_short_mirror = NULL; -oop Universe::_void_mirror = NULL; -oop Universe::_mirrors[T_VOID+1] = { NULL /*, NULL...*/ }; +klassOop Universe::_fillerArrayKlassObj = NULL; +oop Universe::_int_mirror = NULL; +oop Universe::_float_mirror = NULL; +oop Universe::_double_mirror = NULL; +oop Universe::_byte_mirror = NULL; +oop Universe::_bool_mirror = NULL; +oop Universe::_char_mirror = NULL; +oop Universe::_long_mirror = NULL; +oop Universe::_short_mirror = NULL; +oop Universe::_void_mirror = NULL; +oop Universe::_mirrors[T_VOID+1] = { NULL /*, NULL...*/ }; oop Universe::_main_thread_group = NULL; oop Universe::_system_thread_group = NULL; typeArrayOop Universe::_the_empty_byte_array = NULL; @@ -126,6 +127,7 @@ void Universe::system_classes_do(void f(klassOop)) { f(instanceKlassKlassObj()); f(constantPoolKlassObj()); f(systemObjArrayKlassObj()); + f(fillerArrayKlassObj()); } void Universe::oops_do(OopClosure* f, bool do_all) { @@ -180,6 +182,7 @@ void Universe::oops_do(OopClosure* f, bool do_all) { f->do_oop((oop*)&_constantPoolCacheKlassObj); f->do_oop((oop*)&_compiledICHolderKlassObj); f->do_oop((oop*)&_systemObjArrayKlassObj); + f->do_oop((oop*)&_fillerArrayKlassObj); f->do_oop((oop*)&_the_empty_byte_array); f->do_oop((oop*)&_the_empty_short_array); f->do_oop((oop*)&_the_empty_int_array); @@ -257,16 +260,17 @@ void Universe::genesis(TRAPS) { _typeArrayKlassObjs[T_INT] = _intArrayKlassObj; _typeArrayKlassObjs[T_LONG] = _longArrayKlassObj; - _methodKlassObj = methodKlass::create_klass(CHECK); - _constMethodKlassObj = constMethodKlass::create_klass(CHECK); - _methodDataKlassObj = methodDataKlass::create_klass(CHECK); + _methodKlassObj = methodKlass::create_klass(CHECK); + _constMethodKlassObj = constMethodKlass::create_klass(CHECK); + _methodDataKlassObj = methodDataKlass::create_klass(CHECK); _constantPoolKlassObj = constantPoolKlass::create_klass(CHECK); _constantPoolCacheKlassObj = constantPoolCacheKlass::create_klass(CHECK); _compiledICHolderKlassObj = compiledICHolderKlass::create_klass(CHECK); _systemObjArrayKlassObj = objArrayKlassKlass::cast(objArrayKlassKlassObj())->allocate_system_objArray_klass(CHECK); + _fillerArrayKlassObj = typeArrayKlass::create_klass(T_INT, sizeof(jint), "", CHECK); - _the_empty_byte_array = oopFactory::new_permanent_byteArray(0, CHECK); + _the_empty_byte_array = oopFactory::new_permanent_byteArray(0, CHECK); _the_empty_short_array = oopFactory::new_permanent_shortArray(0, CHECK); _the_empty_int_array = oopFactory::new_permanent_intArray(0, CHECK); _the_empty_system_obj_array = oopFactory::new_system_objArray(0, CHECK); @@ -274,7 +278,6 @@ void Universe::genesis(TRAPS) { _the_array_interfaces_array = oopFactory::new_system_objArray(2, CHECK); _vm_exception = oopFactory::new_symbol("vm exception holder", CHECK); } else { - FileMapInfo *mapinfo = FileMapInfo::current_info(); char* buffer = mapinfo->region_base(CompactingPermGenGen::md); void** vtbl_list = (void**)buffer; diff --git a/hotspot/src/share/vm/memory/universe.hpp b/hotspot/src/share/vm/memory/universe.hpp index 118800f780b..0476d8af531 100644 --- a/hotspot/src/share/vm/memory/universe.hpp +++ b/hotspot/src/share/vm/memory/universe.hpp @@ -92,6 +92,7 @@ class LatestMethodOopCache : public CommonMethodOopCache { class Universe: AllStatic { + // Ugh. Universe is much too friendly. friend class MarkSweep; friend class oopDesc; friend class ClassLoader; @@ -132,6 +133,7 @@ class Universe: AllStatic { static klassOop _constantPoolCacheKlassObj; static klassOop _compiledICHolderKlassObj; static klassOop _systemObjArrayKlassObj; + static klassOop _fillerArrayKlassObj; // Known objects in the VM @@ -264,6 +266,7 @@ class Universe: AllStatic { static klassOop constantPoolCacheKlassObj() { return _constantPoolCacheKlassObj; } static klassOop compiledICHolderKlassObj() { return _compiledICHolderKlassObj; } static klassOop systemObjArrayKlassObj() { return _systemObjArrayKlassObj; } + static klassOop fillerArrayKlassObj() { return _fillerArrayKlassObj; } // Known objects in tbe VM static oop int_mirror() { return check_mirror(_int_mirror); diff --git a/hotspot/src/share/vm/oops/arrayOop.hpp b/hotspot/src/share/vm/oops/arrayOop.hpp index 8ede056496a..364d1dbfe40 100644 --- a/hotspot/src/share/vm/oops/arrayOop.hpp +++ b/hotspot/src/share/vm/oops/arrayOop.hpp @@ -96,19 +96,20 @@ class arrayOopDesc : public oopDesc { : typesize_in_bytes/HeapWordSize); } - // This method returns the maximum length that can passed into - // typeArrayOop::object_size(scale, length, header_size) without causing an - // overflow. We substract an extra 2*wordSize to guard against double word - // alignments. It gets the scale from the type2aelembytes array. + // Return the maximum length of an array of BasicType. The length can passed + // to typeArrayOop::object_size(scale, length, header_size) without causing an + // overflow. static int32_t max_array_length(BasicType type) { assert(type >= 0 && type < T_CONFLICT, "wrong type"); assert(type2aelembytes(type) != 0, "wrong type"); - // We use max_jint, since object_size is internally represented by an 'int' - // This gives us an upper bound of max_jint words for the size of the oop. - int32_t max_words = (max_jint - header_size(type) - 2); - int elembytes = type2aelembytes(type); - jlong len = ((jlong)max_words * HeapWordSize) / elembytes; - return (len > max_jint) ? max_jint : (int32_t)len; - } + const int bytes_per_element = type2aelembytes(type); + if (bytes_per_element < HeapWordSize) { + return max_jint; + } + const int32_t max_words = align_size_down(max_jint, MinObjAlignment); + const int32_t max_element_words = max_words - header_size(type); + const int32_t words_per_element = bytes_per_element >> LogHeapWordSize; + return max_element_words / words_per_element; + } }; diff --git a/hotspot/src/share/vm/oops/typeArrayKlass.cpp b/hotspot/src/share/vm/oops/typeArrayKlass.cpp index d48f8b4f25b..2e0ffbcba26 100644 --- a/hotspot/src/share/vm/oops/typeArrayKlass.cpp +++ b/hotspot/src/share/vm/oops/typeArrayKlass.cpp @@ -36,13 +36,14 @@ bool typeArrayKlass::compute_is_subtype_of(klassOop k) { return element_type() == tak->element_type(); } -klassOop typeArrayKlass::create_klass(BasicType type, int scale, TRAPS) { +klassOop typeArrayKlass::create_klass(BasicType type, int scale, + const char* name_str, TRAPS) { typeArrayKlass o; symbolHandle sym(symbolOop(NULL)); // bootstrapping: don't create sym if symbolKlass not created yet - if (Universe::symbolKlassObj() != NULL) { - sym = oopFactory::new_symbol_handle(external_name(type), CHECK_NULL); + if (Universe::symbolKlassObj() != NULL && name_str != NULL) { + sym = oopFactory::new_symbol_handle(name_str, CHECK_NULL); } KlassHandle klassklass (THREAD, Universe::typeArrayKlassKlassObj()); diff --git a/hotspot/src/share/vm/oops/typeArrayKlass.hpp b/hotspot/src/share/vm/oops/typeArrayKlass.hpp index 72336fb8db0..dac77f6b9bf 100644 --- a/hotspot/src/share/vm/oops/typeArrayKlass.hpp +++ b/hotspot/src/share/vm/oops/typeArrayKlass.hpp @@ -39,7 +39,11 @@ class typeArrayKlass : public arrayKlass { // klass allocation DEFINE_ALLOCATE_PERMANENT(typeArrayKlass); - static klassOop create_klass(BasicType type, int scale, TRAPS); + static klassOop create_klass(BasicType type, int scale, const char* name_str, + TRAPS); + static inline klassOop create_klass(BasicType type, int scale, TRAPS) { + return create_klass(type, scale, external_name(type), CHECK_NULL); + } int oop_size(oop obj) const; int klass_oop_size() const { return object_size(); } diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index 5d08a653bd5..0a9f4d45dc8 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -625,6 +625,9 @@ class CommandLineFlags { develop(bool, CheckZapUnusedHeapArea, false, \ "Check zapping of unused heap space") \ \ + develop(bool, ZapFillerObjects, trueInDebug, \ + "Zap filler objects with 0xDEAFBABE") \ + \ develop(bool, PrintVMMessages, true, \ "Print vm messages on console") \ \ From 7a9585170d1485a6cc3aba8c0efb49ff20e2e904 Mon Sep 17 00:00:00 2001 From: John Coomes Date: Thu, 11 Dec 2008 12:05:14 -0800 Subject: [PATCH 207/267] 6765745: par compact - allow young gen spaces to be split Reviewed-by: jmasa --- .../parallelScavenge/psParallelCompact.cpp | 536 +++++++++++++----- .../parallelScavenge/psParallelCompact.hpp | 142 ++++- 2 files changed, 516 insertions(+), 162 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp index dd01b7b49ff..852cf5e882d 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp @@ -88,6 +88,72 @@ GrowableArray* PSParallelCompact::_last_gc_live_oops_moved_to = NULL; GrowableArray * PSParallelCompact::_last_gc_live_oops_size = NULL; #endif +void SplitInfo::record(size_t src_region_idx, size_t partial_obj_size, + HeapWord* destination) +{ + assert(src_region_idx != 0, "invalid src_region_idx"); + assert(partial_obj_size != 0, "invalid partial_obj_size argument"); + assert(destination != NULL, "invalid destination argument"); + + _src_region_idx = src_region_idx; + _partial_obj_size = partial_obj_size; + _destination = destination; + + // These fields may not be updated below, so make sure they're clear. + assert(_dest_region_addr == NULL, "should have been cleared"); + assert(_first_src_addr == NULL, "should have been cleared"); + + // Determine the number of destination regions for the partial object. + HeapWord* const last_word = destination + partial_obj_size - 1; + const ParallelCompactData& sd = PSParallelCompact::summary_data(); + HeapWord* const beg_region_addr = sd.region_align_down(destination); + HeapWord* const end_region_addr = sd.region_align_down(last_word); + + if (beg_region_addr == end_region_addr) { + // One destination region. + _destination_count = 1; + if (end_region_addr == destination) { + // The destination falls on a region boundary, thus the first word of the + // partial object will be the first word copied to the destination region. + _dest_region_addr = end_region_addr; + _first_src_addr = sd.region_to_addr(src_region_idx); + } + } else { + // Two destination regions. When copied, the partial object will cross a + // destination region boundary, so a word somewhere within the partial + // object will be the first word copied to the second destination region. + _destination_count = 2; + _dest_region_addr = end_region_addr; + const size_t ofs = pointer_delta(end_region_addr, destination); + assert(ofs < _partial_obj_size, "sanity"); + _first_src_addr = sd.region_to_addr(src_region_idx) + ofs; + } +} + +void SplitInfo::clear() +{ + _src_region_idx = 0; + _partial_obj_size = 0; + _destination = NULL; + _destination_count = 0; + _dest_region_addr = NULL; + _first_src_addr = NULL; + assert(!is_valid(), "sanity"); +} + +#ifdef ASSERT +void SplitInfo::verify_clear() +{ + assert(_src_region_idx == 0, "not clear"); + assert(_partial_obj_size == 0, "not clear"); + assert(_destination == NULL, "not clear"); + assert(_destination_count == 0, "not clear"); + assert(_dest_region_addr == NULL, "not clear"); + assert(_first_src_addr == NULL, "not clear"); +} +#endif // #ifdef ASSERT + + #ifndef PRODUCT const char* PSParallelCompact::space_names[] = { "perm", "old ", "eden", "from", "to " @@ -416,21 +482,134 @@ ParallelCompactData::summarize_dense_prefix(HeapWord* beg, HeapWord* end) } } -bool ParallelCompactData::summarize(HeapWord* target_beg, HeapWord* target_end, - HeapWord* source_beg, HeapWord* source_end, - HeapWord** target_next, - HeapWord** source_next) { - // This is too strict. - // assert(region_offset(source_beg) == 0, "not RegionSize aligned"); +// Find the point at which a space can be split and, if necessary, record the +// split point. +// +// If the current src region (which overflowed the destination space) doesn't +// have a partial object, the split point is at the beginning of the current src +// region (an "easy" split, no extra bookkeeping required). +// +// If the current src region has a partial object, the split point is in the +// region where that partial object starts (call it the split_region). If +// split_region has a partial object, then the split point is just after that +// partial object (a "hard" split where we have to record the split data and +// zero the partial_obj_size field). With a "hard" split, we know that the +// partial_obj ends within split_region because the partial object that caused +// the overflow starts in split_region. If split_region doesn't have a partial +// obj, then the split is at the beginning of split_region (another "easy" +// split). +HeapWord* +ParallelCompactData::summarize_split_space(size_t src_region, + SplitInfo& split_info, + HeapWord* destination, + HeapWord* target_end, + HeapWord** target_next) +{ + assert(destination <= target_end, "sanity"); + assert(destination + _region_data[src_region].data_size() > target_end, + "region should not fit into target space"); + + size_t split_region = src_region; + HeapWord* split_destination = destination; + size_t partial_obj_size = _region_data[src_region].partial_obj_size(); + + if (destination + partial_obj_size > target_end) { + // The split point is just after the partial object (if any) in the + // src_region that contains the start of the object that overflowed the + // destination space. + // + // Find the start of the "overflow" object and set split_region to the + // region containing it. + HeapWord* const overflow_obj = _region_data[src_region].partial_obj_addr(); + split_region = addr_to_region_idx(overflow_obj); + + // Clear the source_region field of all destination regions whose first word + // came from data after the split point (a non-null source_region field + // implies a region must be filled). + // + // An alternative to the simple loop below: clear during post_compact(), + // which uses memcpy instead of individual stores, and is easy to + // parallelize. (The downside is that it clears the entire RegionData + // object as opposed to just one field.) + // + // post_compact() would have to clear the summary data up to the highest + // address that was written during the summary phase, which would be + // + // max(top, max(new_top, clear_top)) + // + // where clear_top is a new field in SpaceInfo. Would have to set clear_top + // to destination + partial_obj_size, where both have the values passed to + // this routine. + const RegionData* const sr = region(split_region); + const size_t beg_idx = + addr_to_region_idx(region_align_up(sr->destination() + + sr->partial_obj_size())); + const size_t end_idx = + addr_to_region_idx(region_align_up(destination + partial_obj_size)); + + if (TraceParallelOldGCSummaryPhase) { + gclog_or_tty->print_cr("split: clearing source_region field in [" + SIZE_FORMAT ", " SIZE_FORMAT ")", + beg_idx, end_idx); + } + for (size_t idx = beg_idx; idx < end_idx; ++idx) { + _region_data[idx].set_source_region(0); + } + + // Set split_destination and partial_obj_size to reflect the split region. + split_destination = sr->destination(); + partial_obj_size = sr->partial_obj_size(); + } + + // The split is recorded only if a partial object extends onto the region. + if (partial_obj_size != 0) { + _region_data[split_region].set_partial_obj_size(0); + split_info.record(split_region, partial_obj_size, split_destination); + } + + // Setup the continuation addresses. + *target_next = split_destination + partial_obj_size; + HeapWord* const source_next = region_to_addr(split_region) + partial_obj_size; if (TraceParallelOldGCSummaryPhase) { - tty->print_cr("tb=" PTR_FORMAT " te=" PTR_FORMAT " " - "sb=" PTR_FORMAT " se=" PTR_FORMAT " " - "tn=" PTR_FORMAT " sn=" PTR_FORMAT, - target_beg, target_end, - source_beg, source_end, - target_next != 0 ? *target_next : (HeapWord*) 0, - source_next != 0 ? *source_next : (HeapWord*) 0); + const char * split_type = partial_obj_size == 0 ? "easy" : "hard"; + gclog_or_tty->print_cr("%s split: src=" PTR_FORMAT " src_c=" SIZE_FORMAT + " pos=" SIZE_FORMAT, + split_type, source_next, split_region, + partial_obj_size); + gclog_or_tty->print_cr("%s split: dst=" PTR_FORMAT " dst_c=" SIZE_FORMAT + " tn=" PTR_FORMAT, + split_type, split_destination, + addr_to_region_idx(split_destination), + *target_next); + + if (partial_obj_size != 0) { + HeapWord* const po_beg = split_info.destination(); + HeapWord* const po_end = po_beg + split_info.partial_obj_size(); + gclog_or_tty->print_cr("%s split: " + "po_beg=" PTR_FORMAT " " SIZE_FORMAT " " + "po_end=" PTR_FORMAT " " SIZE_FORMAT, + split_type, + po_beg, addr_to_region_idx(po_beg), + po_end, addr_to_region_idx(po_end)); + } + } + + return source_next; +} + +bool ParallelCompactData::summarize(SplitInfo& split_info, + HeapWord* source_beg, HeapWord* source_end, + HeapWord** source_next, + HeapWord* target_beg, HeapWord* target_end, + HeapWord** target_next) +{ + if (TraceParallelOldGCSummaryPhase) { + HeapWord* const source_next_val = source_next == NULL ? NULL : *source_next; + tty->print_cr("sb=" PTR_FORMAT " se=" PTR_FORMAT " sn=" PTR_FORMAT + "tb=" PTR_FORMAT " te=" PTR_FORMAT " tn=" PTR_FORMAT, + source_beg, source_end, source_next_val, + target_beg, target_end, *target_next); } size_t cur_region = addr_to_region_idx(source_beg); @@ -438,45 +617,53 @@ bool ParallelCompactData::summarize(HeapWord* target_beg, HeapWord* target_end, HeapWord *dest_addr = target_beg; while (cur_region < end_region) { - size_t words = _region_data[cur_region].data_size(); - -#if 1 - assert(pointer_delta(target_end, dest_addr) >= words, - "source region does not fit into target region"); -#else - // XXX - need some work on the corner cases here. If the region does not - // fit, then must either make sure any partial_obj from the region fits, or - // "undo" the initial part of the partial_obj that is in the previous - // region. - if (dest_addr + words >= target_end) { - // Let the caller know where to continue. - *target_next = dest_addr; - *source_next = region_to_addr(cur_region); - return false; - } -#endif // #if 1 - + // The destination must be set even if the region has no data. _region_data[cur_region].set_destination(dest_addr); - // Set the destination_count for cur_region, and if necessary, update - // source_region for a destination region. The source_region field is - // updated if cur_region is the first (left-most) region to be copied to a - // destination region. - // - // The destination_count calculation is a bit subtle. A region that has - // data that compacts into itself does not count itself as a destination. - // This maintains the invariant that a zero count means the region is - // available and can be claimed and then filled. + size_t words = _region_data[cur_region].data_size(); if (words > 0) { + // If cur_region does not fit entirely into the target space, find a point + // at which the source space can be 'split' so that part is copied to the + // target space and the rest is copied elsewhere. + if (dest_addr + words > target_end) { + assert(source_next != NULL, "source_next is NULL when splitting"); + *source_next = summarize_split_space(cur_region, split_info, dest_addr, + target_end, target_next); + return false; + } + + // Compute the destination_count for cur_region, and if necessary, update + // source_region for a destination region. The source_region field is + // updated if cur_region is the first (left-most) region to be copied to a + // destination region. + // + // The destination_count calculation is a bit subtle. A region that has + // data that compacts into itself does not count itself as a destination. + // This maintains the invariant that a zero count means the region is + // available and can be claimed and then filled. + uint destination_count = 0; + if (split_info.is_split(cur_region)) { + // The current region has been split: the partial object will be copied + // to one destination space and the remaining data will be copied to + // another destination space. Adjust the initial destination_count and, + // if necessary, set the source_region field if the partial object will + // cross a destination region boundary. + destination_count = split_info.destination_count(); + if (destination_count == 2) { + size_t dest_idx = addr_to_region_idx(split_info.dest_region_addr()); + _region_data[dest_idx].set_source_region(cur_region); + } + } + HeapWord* const last_addr = dest_addr + words - 1; const size_t dest_region_1 = addr_to_region_idx(dest_addr); const size_t dest_region_2 = addr_to_region_idx(last_addr); -#if 0 + // Initially assume that the destination regions will be the same and // adjust the value below if necessary. Under this assumption, if // cur_region == dest_region_2, then cur_region will be compacted // completely into itself. - uint destination_count = cur_region == dest_region_2 ? 0 : 1; + destination_count += cur_region == dest_region_2 ? 0 : 1; if (dest_region_1 != dest_region_2) { // Destination regions differ; adjust destination_count. destination_count += 1; @@ -487,25 +674,6 @@ bool ParallelCompactData::summarize(HeapWord* target_beg, HeapWord* target_end, // region. _region_data[dest_region_1].set_source_region(cur_region); } -#else - // Initially assume that the destination regions will be different and - // adjust the value below if necessary. Under this assumption, if - // cur_region == dest_region2, then cur_region will be compacted partially - // into dest_region_1 and partially into itself. - uint destination_count = cur_region == dest_region_2 ? 1 : 2; - if (dest_region_1 != dest_region_2) { - // Data from cur_region will be copied to the start of dest_region_2. - _region_data[dest_region_2].set_source_region(cur_region); - } else { - // Destination regions are the same; adjust destination_count. - destination_count -= 1; - if (region_offset(dest_addr) == 0) { - // Data from cur_region will be copied to the start of the destination - // region. - _region_data[dest_region_1].set_source_region(cur_region); - } - } -#endif // #if 0 _region_data[cur_region].set_destination_count(destination_count); _region_data[cur_region].set_data_location(region_to_addr(cur_region)); @@ -749,6 +917,13 @@ PSParallelCompact::clear_data_covering_space(SpaceId id) const size_t end_region = _summary_data.addr_to_region_idx(_summary_data.region_align_up(max_top)); _summary_data.clear_range(beg_region, end_region); + + // Clear the data used to 'split' regions. + SplitInfo& split_info = _space_info[id].split_info(); + if (split_info.is_valid()) { + split_info.clear(); + } + DEBUG_ONLY(split_info.verify_clear();) } void PSParallelCompact::pre_compact(PreGCValues* pre_gc_values) @@ -807,10 +982,11 @@ void PSParallelCompact::post_compact() { TraceTime tm("post compact", print_phases(), true, gclog_or_tty); - // Clear the marking bitmap and summary data and update top() in each space. for (unsigned int id = perm_space_id; id < last_space_id; ++id) { + // Clear the marking bitmap, summary data and split info. clear_data_covering_space(SpaceId(id)); - _space_info[id].space()->set_top(_space_info[id].new_top()); + // Update top(). Must be done after clearing the bitmap and summary data. + _space_info[id].publish_new_top(); } MutableSpace* const eden_space = _space_info[eden_space_id].space(); @@ -1243,10 +1419,11 @@ void PSParallelCompact::summarize_spaces_quick() { for (unsigned int i = 0; i < last_space_id; ++i) { const MutableSpace* space = _space_info[i].space(); - bool result = _summary_data.summarize(space->bottom(), space->end(), - space->bottom(), space->top(), - _space_info[i].new_top_addr()); - assert(result, "should never fail"); + HeapWord** nta = _space_info[i].new_top_addr(); + bool result = _summary_data.summarize(_space_info[i].split_info(), + space->bottom(), space->top(), NULL, + space->bottom(), space->end(), nta); + assert(result, "space must fit into itself"); _space_info[i].set_dense_prefix(space->bottom()); } } @@ -1308,7 +1485,7 @@ void PSParallelCompact::fill_dense_prefix_end(SpaceId id) } #endif // #ifdef _LP64 - gc_heap()->fill_with_object(obj_beg, obj_len); + CollectedHeap::fill_with_object(obj_beg, obj_len); _mark_bitmap.mark_obj(obj_beg, obj_len); _summary_data.add_obj(obj_beg, obj_len); assert(start_array(id) != NULL, "sanity"); @@ -1316,6 +1493,17 @@ void PSParallelCompact::fill_dense_prefix_end(SpaceId id) } } +void +PSParallelCompact::clear_source_region(HeapWord* beg_addr, HeapWord* end_addr) +{ + RegionData* const beg_ptr = _summary_data.addr_to_region_ptr(beg_addr); + HeapWord* const end_aligned_up = _summary_data.region_align_up(end_addr); + RegionData* const end_ptr = _summary_data.addr_to_region_ptr(end_aligned_up); + for (RegionData* cur = beg_ptr; cur < end_ptr; ++cur) { + cur->set_source_region(0); + } +} + void PSParallelCompact::summarize_space(SpaceId id, bool maximum_compaction) { @@ -1337,20 +1525,24 @@ PSParallelCompact::summarize_space(SpaceId id, bool maximum_compaction) } #endif // #ifndef PRODUCT - // If dead space crosses the dense prefix boundary, it is (at least - // partially) filled with a dummy object, marked live and added to the - // summary data. This simplifies the copy/update phase and must be done - // before the final locations of objects are determined, to prevent leaving - // a fragment of dead space that is too small to fill with an object. + // Recompute the summary data, taking into account the dense prefix. If every + // last byte will be reclaimed, then the existing summary data which compacts + // everything can be left in place. if (!maximum_compaction && dense_prefix_end != space->bottom()) { + // If dead space crosses the dense prefix boundary, it is (at least + // partially) filled with a dummy object, marked live and added to the + // summary data. This simplifies the copy/update phase and must be done + // before the final locations of objects are determined, to prevent leaving + // a fragment of dead space that is too small to fill with an object. fill_dense_prefix_end(id); - } - // Compute the destination of each Region, and thus each object. - _summary_data.summarize_dense_prefix(space->bottom(), dense_prefix_end); - _summary_data.summarize(dense_prefix_end, space->end(), - dense_prefix_end, space->top(), - _space_info[id].new_top_addr()); + // Compute the destination of each Region, and thus each object. + _summary_data.summarize_dense_prefix(space->bottom(), dense_prefix_end); + _summary_data.summarize(_space_info[id].split_info(), + dense_prefix_end, space->top(), NULL, + dense_prefix_end, space->end(), + _space_info[id].new_top_addr()); + } } if (TraceParallelOldGCSummaryPhase) { @@ -1370,6 +1562,30 @@ PSParallelCompact::summarize_space(SpaceId id, bool maximum_compaction) } } +#ifndef PRODUCT +void PSParallelCompact::summary_phase_msg(SpaceId dst_space_id, + HeapWord* dst_beg, HeapWord* dst_end, + SpaceId src_space_id, + HeapWord* src_beg, HeapWord* src_end) +{ + if (TraceParallelOldGCSummaryPhase) { + tty->print_cr("summarizing %d [%s] into %d [%s]: " + "src=" PTR_FORMAT "-" PTR_FORMAT " " + SIZE_FORMAT "-" SIZE_FORMAT " " + "dst=" PTR_FORMAT "-" PTR_FORMAT " " + SIZE_FORMAT "-" SIZE_FORMAT, + src_space_id, space_names[src_space_id], + dst_space_id, space_names[dst_space_id], + src_beg, src_end, + _summary_data.addr_to_region_idx(src_beg), + _summary_data.addr_to_region_idx(src_end), + dst_beg, dst_end, + _summary_data.addr_to_region_idx(dst_beg), + _summary_data.addr_to_region_idx(dst_end)); + } +} +#endif // #ifndef PRODUCT + void PSParallelCompact::summary_phase(ParCompactionManager* cm, bool maximum_compaction) { @@ -1402,57 +1618,90 @@ void PSParallelCompact::summary_phase(ParCompactionManager* cm, // The amount of live data that will end up in old space (assuming it fits). size_t old_space_total_live = 0; - unsigned int id; - for (id = old_space_id; id < last_space_id; ++id) { + assert(perm_space_id < old_space_id, "should not count perm data here"); + for (unsigned int id = old_space_id; id < last_space_id; ++id) { old_space_total_live += pointer_delta(_space_info[id].new_top(), _space_info[id].space()->bottom()); } - const MutableSpace* old_space = _space_info[old_space_id].space(); + MutableSpace* const old_space = _space_info[old_space_id].space(); if (old_space_total_live > old_space->capacity_in_words()) { // XXX - should also try to expand maximum_compaction = true; - } else if (!UseParallelOldGCDensePrefix) { - maximum_compaction = true; } // Permanent and Old generations. summarize_space(perm_space_id, maximum_compaction); summarize_space(old_space_id, maximum_compaction); - // Summarize the remaining spaces (those in the young gen) into old space. If - // the live data from a space doesn't fit, the existing summarization is left - // intact, so the data is compacted down within the space itself. - HeapWord** new_top_addr = _space_info[old_space_id].new_top_addr(); - HeapWord* const target_space_end = old_space->end(); - for (id = eden_space_id; id < last_space_id; ++id) { + // Summarize the remaining spaces in the young gen. The initial target space + // is the old gen. If a space does not fit entirely into the target, then the + // remainder is compacted into the space itself and that space becomes the new + // target. + SpaceId dst_space_id = old_space_id; + HeapWord* dst_space_end = old_space->end(); + HeapWord** new_top_addr = _space_info[dst_space_id].new_top_addr(); + for (unsigned int id = eden_space_id; id < last_space_id; ++id) { const MutableSpace* space = _space_info[id].space(); const size_t live = pointer_delta(_space_info[id].new_top(), space->bottom()); - const size_t available = pointer_delta(target_space_end, *new_top_addr); + const size_t available = pointer_delta(dst_space_end, *new_top_addr); + + NOT_PRODUCT(summary_phase_msg(dst_space_id, *new_top_addr, dst_space_end, + SpaceId(id), space->bottom(), space->top());) if (live > 0 && live <= available) { // All the live data will fit. - if (TraceParallelOldGCSummaryPhase) { - tty->print_cr("summarizing %d into old_space @ " PTR_FORMAT, - id, *new_top_addr); - } - _summary_data.summarize(*new_top_addr, target_space_end, - space->bottom(), space->top(), - new_top_addr); + bool done = _summary_data.summarize(_space_info[id].split_info(), + space->bottom(), space->top(), + NULL, + *new_top_addr, dst_space_end, + new_top_addr); + assert(done, "space must fit into old gen"); + // XXX - this is necessary because decrement_destination_counts() tests + // source_region() to determine if a region will be filled. Probably + // better to pass src_space->new_top() into decrement_destination_counts + // and test that instead. + // // Clear the source_region field for each region in the space. - HeapWord* const new_top = _space_info[id].new_top(); - HeapWord* const clear_end = _summary_data.region_align_up(new_top); - RegionData* beg_region = - _summary_data.addr_to_region_ptr(space->bottom()); - RegionData* end_region = _summary_data.addr_to_region_ptr(clear_end); - while (beg_region < end_region) { - beg_region->set_source_region(0); - ++beg_region; - } + clear_source_region(space->bottom(), _space_info[id].new_top()); // Reset the new_top value for the space. _space_info[id].set_new_top(space->bottom()); + } else if (live > 0) { + // Attempt to fit part of the source space into the target space. + HeapWord* next_src_addr = NULL; + bool done = _summary_data.summarize(_space_info[id].split_info(), + space->bottom(), space->top(), + &next_src_addr, + *new_top_addr, dst_space_end, + new_top_addr); + assert(!done, "space should not fit into old gen"); + assert(next_src_addr != NULL, "sanity"); + + // The source space becomes the new target, so the remainder is compacted + // within the space itself. + dst_space_id = SpaceId(id); + dst_space_end = space->end(); + new_top_addr = _space_info[id].new_top_addr(); + HeapWord* const clear_end = _space_info[id].new_top(); + NOT_PRODUCT(summary_phase_msg(dst_space_id, + space->bottom(), dst_space_end, + SpaceId(id), next_src_addr, space->top());) + done = _summary_data.summarize(_space_info[id].split_info(), + next_src_addr, space->top(), + NULL, + space->bottom(), dst_space_end, + new_top_addr); + assert(done, "space must fit when compacted into itself"); + assert(*new_top_addr <= space->top(), "usage should not grow"); + + // XXX - this should go away. See comments above. + // + // Clear the source_region field in regions at the end of the space that + // will not be filled. + HeapWord* const clear_beg = _summary_data.region_align_up(*new_top_addr); + clear_source_region(clear_beg, clear_end); } } @@ -2051,14 +2300,13 @@ void PSParallelCompact::enqueue_dense_prefix_tasks(GCTaskQueue* q, // regions in the dense prefix. Assume that 1 gc thread // will work on opening the gaps and the remaining gc threads // will work on the dense prefix. - SpaceId space_id = old_space_id; - while (space_id != last_space_id) { + unsigned int space_id; + for (space_id = old_space_id; space_id < last_space_id; ++ space_id) { HeapWord* const dense_prefix_end = _space_info[space_id].dense_prefix(); const MutableSpace* const space = _space_info[space_id].space(); if (dense_prefix_end == space->bottom()) { // There is no dense prefix for this space. - space_id = next_compaction_space_id(space_id); continue; } @@ -2108,23 +2356,20 @@ void PSParallelCompact::enqueue_dense_prefix_tasks(GCTaskQueue* q, // region_index_end is not processed size_t region_index_end = MIN2(region_index_start + regions_per_thread, region_index_end_dense_prefix); - q->enqueue(new UpdateDensePrefixTask( - space_id, - region_index_start, - region_index_end)); + q->enqueue(new UpdateDensePrefixTask(SpaceId(space_id), + region_index_start, + region_index_end)); region_index_start = region_index_end; } } // This gets any part of the dense prefix that did not // fit evenly. if (region_index_start < region_index_end_dense_prefix) { - q->enqueue(new UpdateDensePrefixTask( - space_id, - region_index_start, - region_index_end_dense_prefix)); + q->enqueue(new UpdateDensePrefixTask(SpaceId(space_id), + region_index_start, + region_index_end_dense_prefix)); } - space_id = next_compaction_space_id(space_id); - } // End tasks for dense prefix + } } void PSParallelCompact::enqueue_region_stealing_tasks( @@ -2570,16 +2815,24 @@ PSParallelCompact::skip_live_words(HeapWord* beg, HeapWord* end, size_t count) return m->bit_to_addr(cur_beg); } -HeapWord* -PSParallelCompact::first_src_addr(HeapWord* const dest_addr, - size_t src_region_idx) +HeapWord* PSParallelCompact::first_src_addr(HeapWord* const dest_addr, + SpaceId src_space_id, + size_t src_region_idx) { - ParMarkBitMap* const bitmap = mark_bitmap(); + assert(summary_data().is_region_aligned(dest_addr), "not aligned"); + + const SplitInfo& split_info = _space_info[src_space_id].split_info(); + if (split_info.dest_region_addr() == dest_addr) { + // The partial object ending at the split point contains the first word to + // be copied to dest_addr. + return split_info.first_src_addr(); + } + const ParallelCompactData& sd = summary_data(); + ParMarkBitMap* const bitmap = mark_bitmap(); const size_t RegionSize = ParallelCompactData::RegionSize; assert(sd.is_region_aligned(dest_addr), "not aligned"); - const RegionData* const src_region_ptr = sd.region(src_region_idx); const size_t partial_obj_size = src_region_ptr->partial_obj_size(); HeapWord* const src_region_destination = src_region_ptr->destination(); @@ -2740,7 +2993,7 @@ void PSParallelCompact::fill_region(ParCompactionManager* cm, size_t region_idx) HeapWord* src_space_top = _space_info[src_space_id].space()->top(); MoveAndUpdateClosure closure(bitmap, cm, start_array, dest_addr, words); - closure.set_source(first_src_addr(dest_addr, src_region_idx)); + closure.set_source(first_src_addr(dest_addr, src_space_id, src_region_idx)); // Adjust src_region_idx to prepare for decrementing destination counts (the // destination count is not decremented when a region is copied to itself). @@ -3011,34 +3264,3 @@ void PSParallelCompact::compact_prologue() { summary_data().calc_new_pointer(Universe::intArrayKlassObj()); } -// The initial implementation of this method created a field -// _next_compaction_space_id in SpaceInfo and initialized -// that field in SpaceInfo::initialize_space_info(). That -// required that _next_compaction_space_id be declared a -// SpaceId in SpaceInfo and that would have required that -// either SpaceId be declared in a separate class or that -// it be declared in SpaceInfo. It didn't seem consistent -// to declare it in SpaceInfo (didn't really fit logically). -// Alternatively, defining a separate class to define SpaceId -// seem excessive. This implementation is simple and localizes -// the knowledge. - -PSParallelCompact::SpaceId -PSParallelCompact::next_compaction_space_id(SpaceId id) { - assert(id < last_space_id, "id out of range"); - switch (id) { - case perm_space_id : - return last_space_id; - case old_space_id : - return eden_space_id; - case eden_space_id : - return from_space_id; - case from_space_id : - return to_space_id; - case to_space_id : - return last_space_id; - default: - assert(false, "Bad space id"); - return last_space_id; - } -} diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp index 476c6b7d731..32f8f74a48f 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp @@ -36,6 +36,123 @@ class PreGCValues; class MoveAndUpdateClosure; class RefProcTaskExecutor; +// The SplitInfo class holds the information needed to 'split' a source region +// so that the live data can be copied to two destination *spaces*. Normally, +// all the live data in a region is copied to a single destination space (e.g., +// everything live in a region in eden is copied entirely into the old gen). +// However, when the heap is nearly full, all the live data in eden may not fit +// into the old gen. Copying only some of the regions from eden to old gen +// requires finding a region that does not contain a partial object (i.e., no +// live object crosses the region boundary) somewhere near the last object that +// does fit into the old gen. Since it's not always possible to find such a +// region, splitting is necessary for predictable behavior. +// +// A region is always split at the end of the partial object. This avoids +// additional tests when calculating the new location of a pointer, which is a +// very hot code path. The partial object and everything to its left will be +// copied to another space (call it dest_space_1). The live data to the right +// of the partial object will be copied either within the space itself, or to a +// different destination space (distinct from dest_space_1). +// +// Split points are identified during the summary phase, when region +// destinations are computed: data about the split, including the +// partial_object_size, is recorded in a SplitInfo record and the +// partial_object_size field in the summary data is set to zero. The zeroing is +// possible (and necessary) since the partial object will move to a different +// destination space than anything to its right, thus the partial object should +// not affect the locations of any objects to its right. +// +// The recorded data is used during the compaction phase, but only rarely: when +// the partial object on the split region will be copied across a destination +// region boundary. This test is made once each time a region is filled, and is +// a simple address comparison, so the overhead is negligible (see +// PSParallelCompact::first_src_addr()). +// +// Notes: +// +// Only regions with partial objects are split; a region without a partial +// object does not need any extra bookkeeping. +// +// At most one region is split per space, so the amount of data required is +// constant. +// +// A region is split only when the destination space would overflow. Once that +// happens, the destination space is abandoned and no other data (even from +// other source spaces) is targeted to that destination space. Abandoning the +// destination space may leave a somewhat large unused area at the end, if a +// large object caused the overflow. +// +// Future work: +// +// More bookkeeping would be required to continue to use the destination space. +// The most general solution would allow data from regions in two different +// source spaces to be "joined" in a single destination region. At the very +// least, additional code would be required in next_src_region() to detect the +// join and skip to an out-of-order source region. If the join region was also +// the last destination region to which a split region was copied (the most +// likely case), then additional work would be needed to get fill_region() to +// stop iteration and switch to a new source region at the right point. Basic +// idea would be to use a fake value for the top of the source space. It is +// doable, if a bit tricky. +// +// A simpler (but less general) solution would fill the remainder of the +// destination region with a dummy object and continue filling the next +// destination region. + +class SplitInfo +{ +public: + // Return true if this split info is valid (i.e., if a split has been + // recorded). The very first region cannot have a partial object and thus is + // never split, so 0 is the 'invalid' value. + bool is_valid() const { return _src_region_idx > 0; } + + // Return true if this split holds data for the specified source region. + inline bool is_split(size_t source_region) const; + + // The index of the split region, the size of the partial object on that + // region and the destination of the partial object. + size_t src_region_idx() const { return _src_region_idx; } + size_t partial_obj_size() const { return _partial_obj_size; } + HeapWord* destination() const { return _destination; } + + // The destination count of the partial object referenced by this split + // (either 1 or 2). This must be added to the destination count of the + // remainder of the source region. + unsigned int destination_count() const { return _destination_count; } + + // If a word within the partial object will be written to the first word of a + // destination region, this is the address of the destination region; + // otherwise this is NULL. + HeapWord* dest_region_addr() const { return _dest_region_addr; } + + // If a word within the partial object will be written to the first word of a + // destination region, this is the address of that word within the partial + // object; otherwise this is NULL. + HeapWord* first_src_addr() const { return _first_src_addr; } + + // Record the data necessary to split the region src_region_idx. + void record(size_t src_region_idx, size_t partial_obj_size, + HeapWord* destination); + + void clear(); + + DEBUG_ONLY(void verify_clear();) + +private: + size_t _src_region_idx; + size_t _partial_obj_size; + HeapWord* _destination; + unsigned int _destination_count; + HeapWord* _dest_region_addr; + HeapWord* _first_src_addr; +}; + +inline bool SplitInfo::is_split(size_t region_idx) const +{ + return _src_region_idx == region_idx && is_valid(); +} + class SpaceInfo { public: @@ -58,18 +175,23 @@ class SpaceInfo // is no start array. ObjectStartArray* start_array() const { return _start_array; } + SplitInfo& split_info() { return _split_info; } + void set_space(MutableSpace* s) { _space = s; } void set_new_top(HeapWord* addr) { _new_top = addr; } void set_min_dense_prefix(HeapWord* addr) { _min_dense_prefix = addr; } void set_dense_prefix(HeapWord* addr) { _dense_prefix = addr; } void set_start_array(ObjectStartArray* s) { _start_array = s; } + void publish_new_top() const { _space->set_top(_new_top); } + private: MutableSpace* _space; HeapWord* _new_top; HeapWord* _min_dense_prefix; HeapWord* _dense_prefix; ObjectStartArray* _start_array; + SplitInfo _split_info; }; class ParallelCompactData @@ -230,9 +352,14 @@ public: // must be region-aligned; end need not be. void summarize_dense_prefix(HeapWord* beg, HeapWord* end); - bool summarize(HeapWord* target_beg, HeapWord* target_end, + HeapWord* summarize_split_space(size_t src_region, SplitInfo& split_info, + HeapWord* destination, HeapWord* target_end, + HeapWord** target_next); + bool summarize(SplitInfo& split_info, HeapWord* source_beg, HeapWord* source_end, - HeapWord** target_next, HeapWord** source_next = 0); + HeapWord** source_next, + HeapWord* target_beg, HeapWord* target_end, + HeapWord** target_next); void clear(); void clear_range(size_t beg_region, size_t end_region); @@ -838,13 +965,13 @@ class PSParallelCompact : AllStatic { // non-empty. static void fill_dense_prefix_end(SpaceId id); + // Clear the summary data source_region field for the specified addresses. + static void clear_source_region(HeapWord* beg_addr, HeapWord* end_addr); + static void summarize_spaces_quick(); static void summarize_space(SpaceId id, bool maximum_compaction); static void summary_phase(ParCompactionManager* cm, bool maximum_compaction); - // The space that is compacted after space_id. - static SpaceId next_compaction_space_id(SpaceId space_id); - // Adjust addresses in roots. Does not adjust addresses in heap. static void adjust_roots(); @@ -999,6 +1126,7 @@ class PSParallelCompact : AllStatic { // Return the address of the word to be copied to dest_addr, which must be // aligned to a region boundary. static HeapWord* first_src_addr(HeapWord* const dest_addr, + SpaceId src_space_id, size_t src_region_idx); // Determine the next source region, set closure.source() to the start of the @@ -1081,6 +1209,10 @@ class PSParallelCompact : AllStatic { const SpaceId id, const bool maximum_compaction, HeapWord* const addr); + static void summary_phase_msg(SpaceId dst_space_id, + HeapWord* dst_beg, HeapWord* dst_end, + SpaceId src_space_id, + HeapWord* src_beg, HeapWord* src_end); #endif // #ifndef PRODUCT #ifdef ASSERT From 8fc946854cdb3b677f96cd0af7a8344c2cea6089 Mon Sep 17 00:00:00 2001 From: John Coomes Date: Thu, 11 Dec 2008 12:05:21 -0800 Subject: [PATCH 208/267] 6765954: par compact - stress mode for splitting young gen spaces Reviewed-by: jmasa --- .../parallelScavenge/psParallelCompact.cpp | 186 +++++++++++++++++- .../parallelScavenge/psParallelCompact.hpp | 14 ++ hotspot/src/share/vm/runtime/arguments.cpp | 10 + hotspot/src/share/vm/runtime/globals.hpp | 9 +- 4 files changed, 207 insertions(+), 12 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp index 852cf5e882d..3401383fd79 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp @@ -1327,6 +1327,13 @@ HeapWord* PSParallelCompact::compute_dense_prefix(const SpaceId id, bool maximum_compaction) { + if (ParallelOldGCSplitALot) { + if (_space_info[id].dense_prefix() != _space_info[id].space()->bottom()) { + // The value was chosen to provoke splitting a young gen space; use it. + return _space_info[id].dense_prefix(); + } + } + const size_t region_size = ParallelCompactData::RegionSize; const ParallelCompactData& sd = summary_data(); @@ -1415,6 +1422,160 @@ PSParallelCompact::compute_dense_prefix(const SpaceId id, return sd.region_to_addr(best_cp); } +#ifndef PRODUCT +void +PSParallelCompact::fill_with_live_objects(SpaceId id, HeapWord* const start, + size_t words) +{ + if (TraceParallelOldGCSummaryPhase) { + tty->print_cr("fill_with_live_objects [" PTR_FORMAT " " PTR_FORMAT ") " + SIZE_FORMAT, start, start + words, words); + } + + ObjectStartArray* const start_array = _space_info[id].start_array(); + CollectedHeap::fill_with_objects(start, words); + for (HeapWord* p = start; p < start + words; p += oop(p)->size()) { + _mark_bitmap.mark_obj(p, words); + _summary_data.add_obj(p, words); + start_array->allocate_block(p); + } +} + +void +PSParallelCompact::summarize_new_objects(SpaceId id, HeapWord* start) +{ + ParallelCompactData& sd = summary_data(); + MutableSpace* space = _space_info[id].space(); + + // Find the source and destination start addresses. + HeapWord* const src_addr = sd.region_align_down(start); + HeapWord* dst_addr; + if (src_addr < start) { + dst_addr = sd.addr_to_region_ptr(src_addr)->destination(); + } else if (src_addr > space->bottom()) { + // The start (the original top() value) is aligned to a region boundary so + // the associated region does not have a destination. Compute the + // destination from the previous region. + RegionData* const cp = sd.addr_to_region_ptr(src_addr) - 1; + dst_addr = cp->destination() + cp->data_size(); + } else { + // Filling the entire space. + dst_addr = space->bottom(); + } + assert(dst_addr != NULL, "sanity"); + + // Update the summary data. + bool result = _summary_data.summarize(_space_info[id].split_info(), + src_addr, space->top(), NULL, + dst_addr, space->end(), + _space_info[id].new_top_addr()); + assert(result, "should not fail: bad filler object size"); +} + +void +PSParallelCompact::provoke_split(bool & max_compaction) +{ + const size_t region_size = ParallelCompactData::RegionSize; + ParallelCompactData& sd = summary_data(); + + MutableSpace* const eden_space = _space_info[eden_space_id].space(); + MutableSpace* const from_space = _space_info[from_space_id].space(); + const size_t eden_live = pointer_delta(eden_space->top(), + _space_info[eden_space_id].new_top()); + const size_t from_live = pointer_delta(from_space->top(), + _space_info[from_space_id].new_top()); + + const size_t min_fill_size = CollectedHeap::min_fill_size(); + const size_t eden_free = pointer_delta(eden_space->end(), eden_space->top()); + const size_t eden_fillable = eden_free >= min_fill_size ? eden_free : 0; + const size_t from_free = pointer_delta(from_space->end(), from_space->top()); + const size_t from_fillable = from_free >= min_fill_size ? from_free : 0; + + // Choose the space to split; need at least 2 regions live (or fillable). + SpaceId id; + MutableSpace* space; + size_t live_words; + size_t fill_words; + if (eden_live + eden_fillable >= region_size * 2) { + id = eden_space_id; + space = eden_space; + live_words = eden_live; + fill_words = eden_fillable; + } else if (from_live + from_fillable >= region_size * 2) { + id = from_space_id; + space = from_space; + live_words = from_live; + fill_words = from_fillable; + } else { + return; // Give up. + } + assert(fill_words == 0 || fill_words >= min_fill_size, "sanity"); + + if (live_words < region_size * 2) { + // Fill from top() to end() w/live objects of mixed sizes. + HeapWord* const fill_start = space->top(); + live_words += fill_words; + + space->set_top(fill_start + fill_words); + if (ZapUnusedHeapArea) { + space->set_top_for_allocations(); + } + + HeapWord* cur_addr = fill_start; + while (fill_words > 0) { + const size_t r = (size_t)os::random() % (region_size / 2) + min_fill_size; + size_t cur_size = MIN2(align_object_size_(r), fill_words); + if (fill_words - cur_size < min_fill_size) { + cur_size = fill_words; // Avoid leaving a fragment too small to fill. + } + + CollectedHeap::fill_with_object(cur_addr, cur_size); + mark_bitmap()->mark_obj(cur_addr, cur_size); + sd.add_obj(cur_addr, cur_size); + + cur_addr += cur_size; + fill_words -= cur_size; + } + + summarize_new_objects(id, fill_start); + } + + max_compaction = false; + + // Manipulate the old gen so that it has room for about half of the live data + // in the target young gen space (live_words / 2). + id = old_space_id; + space = _space_info[id].space(); + const size_t free_at_end = space->free_in_words(); + const size_t free_target = align_object_size(live_words / 2); + const size_t dead = pointer_delta(space->top(), _space_info[id].new_top()); + + if (free_at_end >= free_target + min_fill_size) { + // Fill space above top() and set the dense prefix so everything survives. + HeapWord* const fill_start = space->top(); + const size_t fill_size = free_at_end - free_target; + space->set_top(space->top() + fill_size); + if (ZapUnusedHeapArea) { + space->set_top_for_allocations(); + } + fill_with_live_objects(id, fill_start, fill_size); + summarize_new_objects(id, fill_start); + _space_info[id].set_dense_prefix(sd.region_align_down(space->top())); + } else if (dead + free_at_end > free_target) { + // Find a dense prefix that makes the right amount of space available. + HeapWord* cur = sd.region_align_down(space->top()); + HeapWord* cur_destination = sd.addr_to_region_ptr(cur)->destination(); + size_t dead_to_right = pointer_delta(space->end(), cur_destination); + while (dead_to_right < free_target) { + cur -= region_size; + cur_destination = sd.addr_to_region_ptr(cur)->destination(); + dead_to_right = pointer_delta(space->end(), cur_destination); + } + _space_info[id].set_dense_prefix(cur); + } +} +#endif // #ifndef PRODUCT + void PSParallelCompact::summarize_spaces_quick() { for (unsigned int i = 0; i < last_space_id; ++i) { @@ -1508,8 +1669,9 @@ void PSParallelCompact::summarize_space(SpaceId id, bool maximum_compaction) { assert(id < last_space_id, "id out of range"); - assert(_space_info[id].dense_prefix() == _space_info[id].space()->bottom(), - "should have been set in summarize_spaces_quick()"); + assert(_space_info[id].dense_prefix() == _space_info[id].space()->bottom() || + ParallelOldGCSplitALot && id == old_space_id, + "should have been reset in summarize_spaces_quick()"); const MutableSpace* space = _space_info[id].space(); if (_space_info[id].new_top() != space->bottom()) { @@ -1525,15 +1687,15 @@ PSParallelCompact::summarize_space(SpaceId id, bool maximum_compaction) } #endif // #ifndef PRODUCT - // Recompute the summary data, taking into account the dense prefix. If every - // last byte will be reclaimed, then the existing summary data which compacts - // everything can be left in place. + // Recompute the summary data, taking into account the dense prefix. If + // every last byte will be reclaimed, then the existing summary data which + // compacts everything can be left in place. if (!maximum_compaction && dense_prefix_end != space->bottom()) { // If dead space crosses the dense prefix boundary, it is (at least // partially) filled with a dummy object, marked live and added to the // summary data. This simplifies the copy/update phase and must be done - // before the final locations of objects are determined, to prevent leaving - // a fragment of dead space that is too small to fill with an object. + // before the final locations of objects are determined, to prevent + // leaving a fragment of dead space that is too small to fill. fill_dense_prefix_end(id); // Compute the destination of each Region, and thus each object. @@ -1625,10 +1787,18 @@ void PSParallelCompact::summary_phase(ParCompactionManager* cm, } MutableSpace* const old_space = _space_info[old_space_id].space(); - if (old_space_total_live > old_space->capacity_in_words()) { + const size_t old_capacity = old_space->capacity_in_words(); + if (old_space_total_live > old_capacity) { // XXX - should also try to expand maximum_compaction = true; } +#ifndef PRODUCT + if (ParallelOldGCSplitALot && old_space_total_live < old_capacity) { + if (total_invocations() % ParallelOldGCSplitInterval == 0) { + provoke_split(maximum_compaction); + } + } +#endif // #ifndef PRODUCT // Permanent and Old generations. summarize_space(perm_space_id, maximum_compaction); diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp index 32f8f74a48f..de0dbdefd62 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp @@ -968,6 +968,20 @@ class PSParallelCompact : AllStatic { // Clear the summary data source_region field for the specified addresses. static void clear_source_region(HeapWord* beg_addr, HeapWord* end_addr); +#ifndef PRODUCT + // Routines to provoke splitting a young gen space (ParallelOldGCSplitALot). + + // Fill the region [start, start + words) with live object(s). Only usable + // for the old and permanent generations. + static void fill_with_live_objects(SpaceId id, HeapWord* const start, + size_t words); + // Include the new objects in the summary data. + static void summarize_new_objects(SpaceId id, HeapWord* start); + + // Add live objects and/or choose the dense prefix to provoke splitting. + static void provoke_split(bool & maximum_compaction); +#endif + static void summarize_spaces_quick(); static void summarize_space(SpaceId id, bool maximum_compaction); static void summary_phase(ParCompactionManager* cm, bool maximum_compaction); diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp index 831218796cf..06ff70505c9 100644 --- a/hotspot/src/share/vm/runtime/arguments.cpp +++ b/hotspot/src/share/vm/runtime/arguments.cpp @@ -1517,6 +1517,16 @@ bool Arguments::check_vm_args_consistency() { MarkSweepAlwaysCompactCount = 1; // Move objects every gc. } + if (UseParallelOldGC && ParallelOldGCSplitALot) { + // Settings to encourage splitting. + if (!FLAG_IS_CMDLINE(NewRatio)) { + FLAG_SET_CMDLINE(intx, NewRatio, 2); + } + if (!FLAG_IS_CMDLINE(ScavengeBeforeFullGC)) { + FLAG_SET_CMDLINE(bool, ScavengeBeforeFullGC, false); + } + } + status = status && verify_percentage(GCHeapFreeLimit, "GCHeapFreeLimit"); status = status && verify_percentage(GCTimeLimit, "GCTimeLimit"); if (GCTimeLimit == 100) { diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp index 0a9f4d45dc8..f945bb36708 100644 --- a/hotspot/src/share/vm/runtime/globals.hpp +++ b/hotspot/src/share/vm/runtime/globals.hpp @@ -1203,11 +1203,12 @@ class CommandLineFlags { product(uintx, ParallelCMSThreads, 0, \ "Max number of threads CMS will use for concurrent work") \ \ - develop(bool, ParallelOldMTUnsafeMarkBitMap, false, \ - "Use the Parallel Old MT unsafe in marking the bitmap") \ + develop(bool, ParallelOldGCSplitALot, false, \ + "Provoke splitting (copying data from a young gen space to" \ + "multiple destination spaces)") \ \ - develop(bool, ParallelOldMTUnsafeUpdateLiveData, false, \ - "Use the Parallel Old MT unsafe in update of live size") \ + develop(uintx, ParallelOldGCSplitInterval, 3, \ + "How often to provoke splitting a young gen space") \ \ develop(bool, TraceRegionTasksQueuing, false, \ "Trace the queuing of the region tasks") \ From 552c37000d8e1e32a39b755da0c4f827d4c89440 Mon Sep 17 00:00:00 2001 From: Tom Rodriguez Date: Fri, 12 Dec 2008 19:53:25 -0800 Subject: [PATCH 209/267] 6767587: missing call to make_not_entrant after deoptimizing for patching volatiles Reviewed-by: rasbold, kvn --- hotspot/src/share/vm/c1/c1_Runtime1.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hotspot/src/share/vm/c1/c1_Runtime1.cpp b/hotspot/src/share/vm/c1/c1_Runtime1.cpp index 04750308db3..dcd0f282ab9 100644 --- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp +++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp @@ -842,6 +842,13 @@ JRT_ENTRY(void, Runtime1::patch_code(JavaThread* thread, Runtime1::StubID stub_i if (TracePatching) { tty->print_cr("Deoptimizing for patching volatile field reference"); } + // It's possible the nmethod was invalidated in the last + // safepoint, but if it's still alive then make it not_entrant. + nmethod* nm = CodeCache::find_nmethod(caller_frame.pc()); + if (nm != NULL) { + nm->make_not_entrant(); + } + VM_DeoptimizeFrame deopt(thread, caller_frame.id()); VMThread::execute(&deopt); From 40a81c63b8b5cf82bd23c256d4006fbe41779b26 Mon Sep 17 00:00:00 2001 From: Tom Rodriguez Date: Fri, 12 Dec 2008 19:54:46 -0800 Subject: [PATCH 210/267] 6757316: load_constant() produces a wrong long constant, with high a low words swapped Reviewed-by: rasbold, jrose, kvn --- hotspot/src/share/vm/c1/c1_LIRGenerator.cpp | 4 +- .../test/compiler/6757316/Test6757316.java | 43 +++++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 hotspot/test/compiler/6757316/Test6757316.java diff --git a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp index 16552a7e5d3..9b718a3d28f 100644 --- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp +++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp @@ -1210,8 +1210,8 @@ LIR_Opr LIRGenerator::load_constant(LIR_Const* c) { break; case T_LONG: case T_DOUBLE: - if (c->as_jint_hi_bits() != other->as_jint_lo_bits()) continue; - if (c->as_jint_lo_bits() != other->as_jint_hi_bits()) continue; + if (c->as_jint_hi_bits() != other->as_jint_hi_bits()) continue; + if (c->as_jint_lo_bits() != other->as_jint_lo_bits()) continue; break; case T_OBJECT: if (c->as_jobject() != other->as_jobject()) continue; diff --git a/hotspot/test/compiler/6757316/Test6757316.java b/hotspot/test/compiler/6757316/Test6757316.java new file mode 100644 index 00000000000..2efc5acd84d --- /dev/null +++ b/hotspot/test/compiler/6757316/Test6757316.java @@ -0,0 +1,43 @@ +/* + * 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. + * + * 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 6757316 + * @summary load_constant() produces a wrong long constant, with high a low words swapped + * @run main/othervm -Xcomp Test6757316 + */ + +public class Test6757316 { + public static void main(String[] args) { + long[] arr = { + 0x11111111aaaaaaaaL, + 0xaaaaaaaa11111111L, + 0x11111111aaaaaaaaL, + 0xaaaaaaaa11111111L + }; + if (arr[0] == arr[1]) { + throw new InternalError(); + } + } +} From baa4663714d54352e3676dd9d1f89cd537fe65bc Mon Sep 17 00:00:00 2001 From: Tom Rodriguez Date: Fri, 12 Dec 2008 19:55:26 -0800 Subject: [PATCH 211/267] 6758234: if (k cond (a ? : b: c)) returns reversed answer if k is constant and b and c are longs Reviewed-by: kvn, jrose --- hotspot/src/share/vm/c1/c1_Optimizer.cpp | 2 - .../test/compiler/6758234/Test6758234.java | 40 +++++++++++++++++++ 2 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 hotspot/test/compiler/6758234/Test6758234.java diff --git a/hotspot/src/share/vm/c1/c1_Optimizer.cpp b/hotspot/src/share/vm/c1/c1_Optimizer.cpp index ea4b3a576db..1b9f77aeef2 100644 --- a/hotspot/src/share/vm/c1/c1_Optimizer.cpp +++ b/hotspot/src/share/vm/c1/c1_Optimizer.cpp @@ -327,8 +327,6 @@ class BlockMerger: public BlockClosure { BlockBegin* fsux = if_->fsux(); if (swapped) { cond = Instruction::mirror(cond); - tsux = if_->fsux(); - fsux = if_->tsux(); } BlockBegin* tblock = tval->compare(cond, con, tsux, fsux); diff --git a/hotspot/test/compiler/6758234/Test6758234.java b/hotspot/test/compiler/6758234/Test6758234.java new file mode 100644 index 00000000000..be916a2a191 --- /dev/null +++ b/hotspot/test/compiler/6758234/Test6758234.java @@ -0,0 +1,40 @@ +/* + * 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. + * + * 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 6758234 + * @summary if (k cond (a ? : b: c)) returns reversed answer if k is constant and b and c are longs + * @run main/othervm -Xcomp -XX:CompileOnly=Test6758234.main Test6758234 + */ + +public class Test6758234 { + static int x = 0; + static int y = 1; + + public static void main(String[] args) { + if (1 != ((x < y) ? 1L : 0)) { + throw new InternalError(); + } + } +} From 06e37c03fb2d4bf67215a700d359d8a7539b0773 Mon Sep 17 00:00:00 2001 From: Swamy Venkataramanappa Date: Mon, 15 Dec 2008 13:58:57 -0800 Subject: [PATCH 212/267] 6653214: MemoryPoolMXBean.setUsageThreshold() does not support large heap sizes Reviewed-by: ysr, mchung --- .../gc_implementation/g1/heapRegionRemSet.cpp | 2 +- .../src/share/vm/memory/cardTableModRefBS.cpp | 2 +- .../src/share/vm/memory/cardTableModRefBS.hpp | 2 +- hotspot/src/share/vm/runtime/arguments.cpp | 49 ++++++++++--------- hotspot/src/share/vm/runtime/arguments.hpp | 6 +-- hotspot/src/share/vm/services/management.cpp | 8 +-- 6 files changed, 37 insertions(+), 32 deletions(-) diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp index f2d262ebfb5..e2b15ca37c9 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp @@ -181,7 +181,7 @@ public: void scrub(CardTableModRefBS* ctbs, BitMap* card_bm) { HeapWord* hr_bot = hr()->bottom(); - int hr_first_card_index = ctbs->index_for(hr_bot); + size_t hr_first_card_index = ctbs->index_for(hr_bot); bm()->set_intersection_at_offset(*card_bm, hr_first_card_index); #if PRT_COUNT_OCCUPIED recount_occupied(); diff --git a/hotspot/src/share/vm/memory/cardTableModRefBS.cpp b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp index 8a006a4042b..ee9ed1fc8be 100644 --- a/hotspot/src/share/vm/memory/cardTableModRefBS.cpp +++ b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp @@ -283,7 +283,7 @@ void CardTableModRefBS::resize_covered_region(MemRegion new_region) { } else { entry = byte_after(old_region.last()); } - assert(index_for(new_region.last()) < (int) _guard_index, + assert(index_for(new_region.last()) < _guard_index, "The guard card will be overwritten"); // This line commented out cleans the newly expanded region and // not the aligned up expanded region. diff --git a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp index 440d42c6ac1..9a48ab5497d 100644 --- a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp +++ b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp @@ -428,7 +428,7 @@ public: } // Mapping from address to card marking array index. - int index_for(void* p) { + size_t index_for(void* p) { assert(_whole_heap.contains(p), "out of bounds access to card marking array"); return byte_for(p) - _byte_map; diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp index 06ff70505c9..b9c943d10b2 100644 --- a/hotspot/src/share/vm/runtime/arguments.cpp +++ b/hotspot/src/share/vm/runtime/arguments.cpp @@ -444,9 +444,9 @@ char* SysClassPath::add_jars_to_path(char* path, const char* directory) { } // Parses a memory size specification string. -static bool atomll(const char *s, jlong* result) { - jlong n = 0; - int args_read = sscanf(s, os::jlong_format_specifier(), &n); +static bool atomull(const char *s, julong* result) { + julong n = 0; + int args_read = sscanf(s, os::julong_format_specifier(), &n); if (args_read != 1) { return false; } @@ -460,15 +460,20 @@ static bool atomll(const char *s, jlong* result) { switch (*s) { case 'T': case 't': *result = n * G * K; + // Check for overflow. + if (*result/((julong)G * K) != n) return false; return true; case 'G': case 'g': *result = n * G; + if (*result/G != n) return false; return true; case 'M': case 'm': *result = n * M; + if (*result/M != n) return false; return true; case 'K': case 'k': *result = n * K; + if (*result/K != n) return false; return true; case '\0': *result = n; @@ -478,10 +483,10 @@ static bool atomll(const char *s, jlong* result) { } } -Arguments::ArgsRange Arguments::check_memory_size(jlong size, jlong min_size) { +Arguments::ArgsRange Arguments::check_memory_size(julong size, julong min_size) { if (size < min_size) return arg_too_small; // Check that size will fit in a size_t (only relevant on 32-bit) - if ((julong) size > max_uintx) return arg_too_big; + if (size > max_uintx) return arg_too_big; return arg_in_range; } @@ -522,10 +527,10 @@ static bool set_fp_numeric_flag(char* name, char* value, FlagValueOrigin origin) static bool set_numeric_flag(char* name, char* value, FlagValueOrigin origin) { - jlong v; + julong v; intx intx_v; bool is_neg = false; - // Check the sign first since atomll() parses only unsigned values. + // Check the sign first since atomull() parses only unsigned values. if (*value == '-') { if (!CommandLineFlags::intxAt(name, &intx_v)) { return false; @@ -533,7 +538,7 @@ static bool set_numeric_flag(char* name, char* value, FlagValueOrigin origin) { value++; is_neg = true; } - if (!atomll(value, &v)) { + if (!atomull(value, &v)) { return false; } intx_v = (intx) v; @@ -1677,9 +1682,9 @@ static bool match_option(const JavaVMOption* option, const char** names, const c } Arguments::ArgsRange Arguments::parse_memory_size(const char* s, - jlong* long_arg, - jlong min_size) { - if (!atomll(s, long_arg)) return arg_unreadable; + julong* long_arg, + julong min_size) { + if (!atomull(s, long_arg)) return arg_unreadable; return check_memory_size(*long_arg, min_size); } @@ -1857,7 +1862,7 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, FLAG_SET_CMDLINE(bool, BackgroundCompilation, false); // -Xmn for compatibility with other JVM vendors } else if (match_option(option, "-Xmn", &tail)) { - jlong long_initial_eden_size = 0; + julong long_initial_eden_size = 0; ArgsRange errcode = parse_memory_size(tail, &long_initial_eden_size, 1); if (errcode != arg_in_range) { jio_fprintf(defaultStream::error_stream(), @@ -1869,7 +1874,7 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, FLAG_SET_CMDLINE(uintx, NewSize, (size_t) long_initial_eden_size); // -Xms } else if (match_option(option, "-Xms", &tail)) { - jlong long_initial_heap_size = 0; + julong long_initial_heap_size = 0; ArgsRange errcode = parse_memory_size(tail, &long_initial_heap_size, 1); if (errcode != arg_in_range) { jio_fprintf(defaultStream::error_stream(), @@ -1882,7 +1887,7 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, set_min_heap_size(initial_heap_size()); // -Xmx } else if (match_option(option, "-Xmx", &tail)) { - jlong long_max_heap_size = 0; + julong long_max_heap_size = 0; ArgsRange errcode = parse_memory_size(tail, &long_max_heap_size, 1); if (errcode != arg_in_range) { jio_fprintf(defaultStream::error_stream(), @@ -1915,7 +1920,7 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, } // -Xss } else if (match_option(option, "-Xss", &tail)) { - jlong long_ThreadStackSize = 0; + julong long_ThreadStackSize = 0; ArgsRange errcode = parse_memory_size(tail, &long_ThreadStackSize, 1000); if (errcode != arg_in_range) { jio_fprintf(defaultStream::error_stream(), @@ -1931,9 +1936,9 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, // HotSpot does not have separate native and Java stacks, ignore silently for compatibility // -Xmaxjitcodesize } else if (match_option(option, "-Xmaxjitcodesize", &tail)) { - jlong long_ReservedCodeCacheSize = 0; + julong long_ReservedCodeCacheSize = 0; ArgsRange errcode = parse_memory_size(tail, &long_ReservedCodeCacheSize, - InitialCodeCacheSize); + (size_t)InitialCodeCacheSize); if (errcode != arg_in_range) { jio_fprintf(defaultStream::error_stream(), "Invalid maximum code cache size: %s\n", @@ -2238,7 +2243,7 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, } else if (match_option(option, "-XX:TLEFragmentationRatio=", &tail)) { // No longer used. } else if (match_option(option, "-XX:TLESize=", &tail)) { - jlong long_tlab_size = 0; + julong long_tlab_size = 0; ArgsRange errcode = parse_memory_size(tail, &long_tlab_size, 1); if (errcode != arg_in_range) { jio_fprintf(defaultStream::error_stream(), @@ -2293,7 +2298,7 @@ SOLARIS_ONLY( "-XX:ParCMSPromoteBlocksToClaim in the future\n"); } else if (match_option(option, "-XX:ParallelGCOldGenAllocBufferSize=", &tail)) { - jlong old_plab_size = 0; + julong old_plab_size = 0; ArgsRange errcode = parse_memory_size(tail, &old_plab_size, 1); if (errcode != arg_in_range) { jio_fprintf(defaultStream::error_stream(), @@ -2301,13 +2306,13 @@ SOLARIS_ONLY( describe_range_error(errcode); return JNI_EINVAL; } - FLAG_SET_CMDLINE(uintx, OldPLABSize, (julong)old_plab_size); + FLAG_SET_CMDLINE(uintx, OldPLABSize, old_plab_size); jio_fprintf(defaultStream::error_stream(), "Please use -XX:OldPLABSize in place of " "-XX:ParallelGCOldGenAllocBufferSize in the future\n"); } else if (match_option(option, "-XX:ParallelGCToSpaceAllocBufferSize=", &tail)) { - jlong young_plab_size = 0; + julong young_plab_size = 0; ArgsRange errcode = parse_memory_size(tail, &young_plab_size, 1); if (errcode != arg_in_range) { jio_fprintf(defaultStream::error_stream(), @@ -2315,7 +2320,7 @@ SOLARIS_ONLY( describe_range_error(errcode); return JNI_EINVAL; } - FLAG_SET_CMDLINE(uintx, YoungPLABSize, (julong)young_plab_size); + FLAG_SET_CMDLINE(uintx, YoungPLABSize, young_plab_size); jio_fprintf(defaultStream::error_stream(), "Please use -XX:YoungPLABSize in place of " "-XX:ParallelGCToSpaceAllocBufferSize in the future\n"); diff --git a/hotspot/src/share/vm/runtime/arguments.hpp b/hotspot/src/share/vm/runtime/arguments.hpp index 5dfd4aa78f9..b5dca5b90de 100644 --- a/hotspot/src/share/vm/runtime/arguments.hpp +++ b/hotspot/src/share/vm/runtime/arguments.hpp @@ -339,9 +339,9 @@ class Arguments : AllStatic { } static bool verify_percentage(uintx value, const char* name); static void describe_range_error(ArgsRange errcode); - static ArgsRange check_memory_size(jlong size, jlong min_size); - static ArgsRange parse_memory_size(const char* s, jlong* long_arg, - jlong min_size); + static ArgsRange check_memory_size(julong size, julong min_size); + static ArgsRange parse_memory_size(const char* s, julong* long_arg, + julong min_size); // methods to build strings from individual args static void build_jvm_args(const char* arg); diff --git a/hotspot/src/share/vm/services/management.cpp b/hotspot/src/share/vm/services/management.cpp index 387deee7325..f58e546ea13 100644 --- a/hotspot/src/share/vm/services/management.cpp +++ b/hotspot/src/share/vm/services/management.cpp @@ -694,10 +694,10 @@ JVM_ENTRY(jlong, jmm_SetPoolThreshold(JNIEnv* env, jobject obj, jmmThresholdType -1); } - if (threshold > max_intx) { - THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(), - "Invalid threshold value > max value of size_t", - -1); + if ((size_t)threshold > max_uintx) { + stringStream st; + st.print("Invalid valid threshold value. Threshold value (" UINT64_FORMAT ") > max value of size_t (" SIZE_FORMAT ")", (size_t)threshold, max_uintx); + THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(), st.as_string(), -1); } MemoryPool* pool = get_memory_pool_from_jobject(obj, CHECK_(0L)); From 87e027e6c781caed105d1d75747a4c13f3c0298a Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena Date: Mon, 15 Dec 2008 16:55:07 -0800 Subject: [PATCH 213/267] 6785258: Update copyright year Update copyright for files that have been modified starting July 2008 to Dec 2008 Reviewed-by: katleman, ohair, tbell --- corba/make/common/Defs-windows.gmk | 2 +- corba/make/common/shared/Compiler-msvc.gmk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/corba/make/common/Defs-windows.gmk b/corba/make/common/Defs-windows.gmk index aa863f64782..b387e8b51d2 100644 --- a/corba/make/common/Defs-windows.gmk +++ b/corba/make/common/Defs-windows.gmk @@ -1,5 +1,5 @@ # -# Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved. +# Copyright 1999-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 diff --git a/corba/make/common/shared/Compiler-msvc.gmk b/corba/make/common/shared/Compiler-msvc.gmk index e42dce91a40..e7ae0e35dcc 100644 --- a/corba/make/common/shared/Compiler-msvc.gmk +++ b/corba/make/common/shared/Compiler-msvc.gmk @@ -1,5 +1,5 @@ # -# Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. +# Copyright 2005-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 From 99f0eac1a20bac543b77986793dfb9e16f480cec Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena Date: Mon, 15 Dec 2008 16:55:11 -0800 Subject: [PATCH 214/267] 6785258: Update copyright year Update copyright for files that have been modified starting July 2008 to Dec 2008 Reviewed-by: katleman, ohair, tbell --- hotspot/src/cpu/x86/vm/vm_version_x86_32.hpp | 2 +- hotspot/src/cpu/x86/vm/vm_version_x86_64.hpp | 2 +- hotspot/src/os/linux/launcher/java.c | 2 +- hotspot/src/os/linux/launcher/java.h | 2 +- hotspot/src/os/linux/launcher/java_md.c | 2 +- hotspot/src/os/linux/vm/globals_linux.hpp | 2 +- hotspot/src/os/solaris/launcher/java.c | 2 +- hotspot/src/os/solaris/launcher/java.h | 2 +- hotspot/src/os/solaris/launcher/java_md.c | 2 +- hotspot/src/os/solaris/vm/globals_solaris.hpp | 2 +- hotspot/src/os/windows/vm/globals_windows.hpp | 2 +- hotspot/src/os/windows/vm/os_windows.hpp | 2 +- hotspot/src/os_cpu/linux_x86/vm/linux_x86_32.ad | 2 +- .../src/com/sun/hotspot/igv/data/serialization/XMLWriter.java | 2 +- .../src/com/sun/hotspot/igv/difference/Difference.java | 2 +- .../Filter/src/com/sun/hotspot/igv/filter/CustomFilter.java | 2 +- .../Util/src/com/sun/hotspot/igv/util/PropertiesSheet.java | 2 +- .../Util/src/com/sun/hotspot/igv/util/RangeSliderModel.java | 2 +- .../View/src/com/sun/hotspot/igv/view/DiagramViewModel.java | 2 +- hotspot/src/share/vm/adlc/adlparse.cpp | 2 +- hotspot/src/share/vm/adlc/adlparse.hpp | 2 +- hotspot/src/share/vm/adlc/filebuff.cpp | 2 +- hotspot/src/share/vm/adlc/filebuff.hpp | 2 +- hotspot/src/share/vm/adlc/formssel.hpp | 2 +- hotspot/src/share/vm/c1/c1_GraphBuilder.cpp | 2 +- hotspot/src/share/vm/c1/c1_GraphBuilder.hpp | 2 +- hotspot/src/share/vm/c1/c1_IR.cpp | 2 +- hotspot/src/share/vm/c1/c1_ValueMap.hpp | 2 +- hotspot/src/share/vm/ci/ciEnv.cpp | 2 +- hotspot/src/share/vm/ci/ciTypeFlow.cpp | 2 +- hotspot/src/share/vm/classfile/classFileParser.hpp | 2 +- hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp | 2 +- hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp | 2 +- .../src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp | 2 +- hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp | 2 +- hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp | 2 +- hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp | 2 +- hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp | 2 +- hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp | 2 +- hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp | 2 +- hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp | 2 +- hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.hpp | 2 +- hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp | 2 +- hotspot/src/share/vm/gc_implementation/g1/ptrQueue.hpp | 2 +- hotspot/src/share/vm/gc_implementation/includeDB_gc_g1 | 2 +- .../src/share/vm/gc_implementation/parallelScavenge/pcTasks.hpp | 2 +- .../gc_implementation/parallelScavenge/psCompactionManager.cpp | 2 +- .../gc_implementation/parallelScavenge/psCompactionManager.hpp | 2 +- .../gc_implementation/parallelScavenge/psMarkSweepDecorator.hpp | 2 +- .../share/vm/gc_implementation/parallelScavenge/psPermGen.cpp | 2 +- hotspot/src/share/vm/interpreter/bytecodeStream.cpp | 2 +- hotspot/src/share/vm/interpreter/bytecodes.cpp | 2 +- hotspot/src/share/vm/interpreter/bytecodes.hpp | 2 +- hotspot/src/share/vm/memory/referencePolicy.cpp | 2 +- hotspot/src/share/vm/memory/referencePolicy.hpp | 2 +- hotspot/src/share/vm/memory/tenuredGeneration.hpp | 2 +- hotspot/src/share/vm/oops/constantPoolOop.cpp | 2 +- hotspot/src/share/vm/opto/block.hpp | 2 +- hotspot/src/share/vm/opto/phase.cpp | 2 +- hotspot/src/share/vm/opto/phase.hpp | 2 +- hotspot/src/share/vm/prims/jniCheck.cpp | 2 +- hotspot/src/share/vm/prims/jniCheck.hpp | 2 +- hotspot/src/share/vm/prims/jvmtiEnvBase.cpp | 2 +- hotspot/src/share/vm/prims/jvmtiTrace.cpp | 2 +- hotspot/src/share/vm/runtime/javaCalls.cpp | 2 +- hotspot/src/share/vm/runtime/javaCalls.hpp | 2 +- hotspot/src/share/vm/runtime/perfMemory.cpp | 2 +- hotspot/src/share/vm/runtime/perfMemory.hpp | 2 +- hotspot/src/share/vm/runtime/thread.hpp | 2 +- hotspot/src/share/vm/services/threadService.hpp | 2 +- hotspot/src/share/vm/utilities/array.hpp | 2 +- hotspot/src/share/vm/utilities/constantTag.hpp | 2 +- hotspot/src/share/vm/utilities/growableArray.hpp | 2 +- hotspot/src/share/vm/utilities/hashtable.cpp | 2 +- hotspot/src/share/vm/utilities/taskqueue.cpp | 2 +- 75 files changed, 75 insertions(+), 75 deletions(-) diff --git a/hotspot/src/cpu/x86/vm/vm_version_x86_32.hpp b/hotspot/src/cpu/x86/vm/vm_version_x86_32.hpp index b37b4f4e516..54b3cb0370d 100644 --- a/hotspot/src/cpu/x86/vm/vm_version_x86_32.hpp +++ b/hotspot/src/cpu/x86/vm/vm_version_x86_32.hpp @@ -1,5 +1,5 @@ /* - * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-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 diff --git a/hotspot/src/cpu/x86/vm/vm_version_x86_64.hpp b/hotspot/src/cpu/x86/vm/vm_version_x86_64.hpp index 37ba2d07558..43492f5fb16 100644 --- a/hotspot/src/cpu/x86/vm/vm_version_x86_64.hpp +++ b/hotspot/src/cpu/x86/vm/vm_version_x86_64.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2003-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 diff --git a/hotspot/src/os/linux/launcher/java.c b/hotspot/src/os/linux/launcher/java.c index c68bb41449b..a13782ec437 100644 --- a/hotspot/src/os/linux/launcher/java.c +++ b/hotspot/src/os/linux/launcher/java.c @@ -1,5 +1,5 @@ /* - * Copyright 1999-2006 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1999-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 diff --git a/hotspot/src/os/linux/launcher/java.h b/hotspot/src/os/linux/launcher/java.h index 9e4a1a6f623..cbc70ce9eb4 100644 --- a/hotspot/src/os/linux/launcher/java.h +++ b/hotspot/src/os/linux/launcher/java.h @@ -1,5 +1,5 @@ /* - * Copyright 1999-2005 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1999-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 diff --git a/hotspot/src/os/linux/launcher/java_md.c b/hotspot/src/os/linux/launcher/java_md.c index 248df18fc4b..50a86cd4de5 100644 --- a/hotspot/src/os/linux/launcher/java_md.c +++ b/hotspot/src/os/linux/launcher/java_md.c @@ -1,5 +1,5 @@ /* - * Copyright 1999-2005 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1999-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 diff --git a/hotspot/src/os/linux/vm/globals_linux.hpp b/hotspot/src/os/linux/vm/globals_linux.hpp index 9c4482ab927..6d7a6360fd4 100644 --- a/hotspot/src/os/linux/vm/globals_linux.hpp +++ b/hotspot/src/os/linux/vm/globals_linux.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2005-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2005-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 diff --git a/hotspot/src/os/solaris/launcher/java.c b/hotspot/src/os/solaris/launcher/java.c index 17a939bb3a4..e4fc014de6d 100644 --- a/hotspot/src/os/solaris/launcher/java.c +++ b/hotspot/src/os/solaris/launcher/java.c @@ -1,5 +1,5 @@ /* - * Copyright 1998-2005 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1998-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 diff --git a/hotspot/src/os/solaris/launcher/java.h b/hotspot/src/os/solaris/launcher/java.h index 3bea15527d2..4a8df069ac2 100644 --- a/hotspot/src/os/solaris/launcher/java.h +++ b/hotspot/src/os/solaris/launcher/java.h @@ -1,5 +1,5 @@ /* - * Copyright 1998-2005 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1998-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 diff --git a/hotspot/src/os/solaris/launcher/java_md.c b/hotspot/src/os/solaris/launcher/java_md.c index b006d24b676..d46b6fdf0b4 100644 --- a/hotspot/src/os/solaris/launcher/java_md.c +++ b/hotspot/src/os/solaris/launcher/java_md.c @@ -1,5 +1,5 @@ /* - * Copyright 1998-2005 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1998-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 diff --git a/hotspot/src/os/solaris/vm/globals_solaris.hpp b/hotspot/src/os/solaris/vm/globals_solaris.hpp index 85fcc8c8752..76c68482a00 100644 --- a/hotspot/src/os/solaris/vm/globals_solaris.hpp +++ b/hotspot/src/os/solaris/vm/globals_solaris.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2005-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2005-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 diff --git a/hotspot/src/os/windows/vm/globals_windows.hpp b/hotspot/src/os/windows/vm/globals_windows.hpp index b5b6ef870d3..9b27f4b4df3 100644 --- a/hotspot/src/os/windows/vm/globals_windows.hpp +++ b/hotspot/src/os/windows/vm/globals_windows.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2005-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2005-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 diff --git a/hotspot/src/os/windows/vm/os_windows.hpp b/hotspot/src/os/windows/vm/os_windows.hpp index 9b5a0301a08..7599586842e 100644 --- a/hotspot/src/os/windows/vm/os_windows.hpp +++ b/hotspot/src/os/windows/vm/os_windows.hpp @@ -1,5 +1,5 @@ /* - * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-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 diff --git a/hotspot/src/os_cpu/linux_x86/vm/linux_x86_32.ad b/hotspot/src/os_cpu/linux_x86/vm/linux_x86_32.ad index ed92526efe4..86133fad51f 100644 --- a/hotspot/src/os_cpu/linux_x86/vm/linux_x86_32.ad +++ b/hotspot/src/os_cpu/linux_x86/vm/linux_x86_32.ad @@ -1,5 +1,5 @@ // -// Copyright 1999-2006 Sun Microsystems, Inc. All Rights Reserved. +// Copyright 1999-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 diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/XMLWriter.java b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/XMLWriter.java index 8ff54f75d41..90876c42482 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/XMLWriter.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/XMLWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 1998-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1998-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 diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Difference/src/com/sun/hotspot/igv/difference/Difference.java b/hotspot/src/share/tools/IdealGraphVisualizer/Difference/src/com/sun/hotspot/igv/difference/Difference.java index 650ee5f63ed..776560b15f5 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Difference/src/com/sun/hotspot/igv/difference/Difference.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Difference/src/com/sun/hotspot/igv/difference/Difference.java @@ -1,5 +1,5 @@ /* - * Copyright 1998-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1998-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 diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/CustomFilter.java b/hotspot/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/CustomFilter.java index 18a8841f66d..9704d834a4a 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/CustomFilter.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Filter/src/com/sun/hotspot/igv/filter/CustomFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 1998-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1998-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 diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/PropertiesSheet.java b/hotspot/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/PropertiesSheet.java index ab7da78f2c4..6eca3e9517b 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/PropertiesSheet.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/PropertiesSheet.java @@ -1,5 +1,5 @@ /* - * Copyright 1998-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1998-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 diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/RangeSliderModel.java b/hotspot/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/RangeSliderModel.java index a179d1ee08c..5c1d9ee31fe 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/RangeSliderModel.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/Util/src/com/sun/hotspot/igv/util/RangeSliderModel.java @@ -1,5 +1,5 @@ /* - * Copyright 1998-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1998-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 diff --git a/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/DiagramViewModel.java b/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/DiagramViewModel.java index 5d1da8ceacf..0db439650e2 100644 --- a/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/DiagramViewModel.java +++ b/hotspot/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/DiagramViewModel.java @@ -1,5 +1,5 @@ /* - * Copyright 1998-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1998-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 diff --git a/hotspot/src/share/vm/adlc/adlparse.cpp b/hotspot/src/share/vm/adlc/adlparse.cpp index c266df104c8..097684acdde 100644 --- a/hotspot/src/share/vm/adlc/adlparse.cpp +++ b/hotspot/src/share/vm/adlc/adlparse.cpp @@ -1,5 +1,5 @@ /* - * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-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 diff --git a/hotspot/src/share/vm/adlc/adlparse.hpp b/hotspot/src/share/vm/adlc/adlparse.hpp index 42329ac279e..d3e26886558 100644 --- a/hotspot/src/share/vm/adlc/adlparse.hpp +++ b/hotspot/src/share/vm/adlc/adlparse.hpp @@ -1,5 +1,5 @@ /* - * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-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 diff --git a/hotspot/src/share/vm/adlc/filebuff.cpp b/hotspot/src/share/vm/adlc/filebuff.cpp index 6fe23fcbae7..9cccb5d069e 100644 --- a/hotspot/src/share/vm/adlc/filebuff.cpp +++ b/hotspot/src/share/vm/adlc/filebuff.cpp @@ -1,5 +1,5 @@ /* - * Copyright 1997-2002 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-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 diff --git a/hotspot/src/share/vm/adlc/filebuff.hpp b/hotspot/src/share/vm/adlc/filebuff.hpp index c36fdbaf3fa..10bb68fcb4f 100644 --- a/hotspot/src/share/vm/adlc/filebuff.hpp +++ b/hotspot/src/share/vm/adlc/filebuff.hpp @@ -1,5 +1,5 @@ /* - * Copyright 1997-2004 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-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 diff --git a/hotspot/src/share/vm/adlc/formssel.hpp b/hotspot/src/share/vm/adlc/formssel.hpp index 9bcbe636ef7..a363f16ee41 100644 --- a/hotspot/src/share/vm/adlc/formssel.hpp +++ b/hotspot/src/share/vm/adlc/formssel.hpp @@ -1,5 +1,5 @@ /* - * Copyright 1998-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1998-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 diff --git a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp index 050823dbde9..5b7834c8b34 100644 --- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp +++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp @@ -1,5 +1,5 @@ /* - * Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1999-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 diff --git a/hotspot/src/share/vm/c1/c1_GraphBuilder.hpp b/hotspot/src/share/vm/c1/c1_GraphBuilder.hpp index 7f185ef4b96..aff61c6cac2 100644 --- a/hotspot/src/share/vm/c1/c1_GraphBuilder.hpp +++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.hpp @@ -1,5 +1,5 @@ /* - * Copyright 1999-2006 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1999-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 diff --git a/hotspot/src/share/vm/c1/c1_IR.cpp b/hotspot/src/share/vm/c1/c1_IR.cpp index ccb6abfbbd7..f1a268de40e 100644 --- a/hotspot/src/share/vm/c1/c1_IR.cpp +++ b/hotspot/src/share/vm/c1/c1_IR.cpp @@ -1,5 +1,5 @@ /* - * Copyright 1999-2006 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1999-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 diff --git a/hotspot/src/share/vm/c1/c1_ValueMap.hpp b/hotspot/src/share/vm/c1/c1_ValueMap.hpp index 94823245875..8e2d0cb2eab 100644 --- a/hotspot/src/share/vm/c1/c1_ValueMap.hpp +++ b/hotspot/src/share/vm/c1/c1_ValueMap.hpp @@ -1,5 +1,5 @@ /* - * Copyright 1999-2006 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1999-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 diff --git a/hotspot/src/share/vm/ci/ciEnv.cpp b/hotspot/src/share/vm/ci/ciEnv.cpp index cb2be0f5ad9..de75c734ac0 100644 --- a/hotspot/src/share/vm/ci/ciEnv.cpp +++ b/hotspot/src/share/vm/ci/ciEnv.cpp @@ -1,5 +1,5 @@ /* - * Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1999-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 diff --git a/hotspot/src/share/vm/ci/ciTypeFlow.cpp b/hotspot/src/share/vm/ci/ciTypeFlow.cpp index 2054ee5b536..08396235067 100644 --- a/hotspot/src/share/vm/ci/ciTypeFlow.cpp +++ b/hotspot/src/share/vm/ci/ciTypeFlow.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2000-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2000-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 diff --git a/hotspot/src/share/vm/classfile/classFileParser.hpp b/hotspot/src/share/vm/classfile/classFileParser.hpp index 4a58fca558b..6cb79f11b69 100644 --- a/hotspot/src/share/vm/classfile/classFileParser.hpp +++ b/hotspot/src/share/vm/classfile/classFileParser.hpp @@ -1,5 +1,5 @@ /* - * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-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 diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp index 646804205c7..c7a7ca7dc8f 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2001-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 diff --git a/hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp b/hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp index 28159924298..f3934812dd1 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2001-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 diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp index 4d9d7f0ce6c..eddbf86d999 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2001-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 diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index f0cad8ed231..daf31a0e8f5 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2001-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 diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp index 557456e4024..e83b1a7de1c 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2001-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 diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp index 97e697c8073..a5d0165bb4d 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2001-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 diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp index d94c6f97cc6..42d177a1e59 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2001-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 diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp index e5105cc81f0..26817660e60 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2001-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 diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp index eee90ecb9bb..5c8d02f045d 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2001-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 diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp index 315e4a351b3..89cd9e45f88 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2001-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 diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.hpp index a79ff99f4a2..6ddec8d3fc4 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2001-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 diff --git a/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp b/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp index 157383237b5..c6a4faad931 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp +++ b/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2001-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 diff --git a/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.hpp b/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.hpp index 899801039d0..029aac48c2f 100644 --- a/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.hpp +++ b/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2001-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 diff --git a/hotspot/src/share/vm/gc_implementation/includeDB_gc_g1 b/hotspot/src/share/vm/gc_implementation/includeDB_gc_g1 index 53770855458..536a3704fe6 100644 --- a/hotspot/src/share/vm/gc_implementation/includeDB_gc_g1 +++ b/hotspot/src/share/vm/gc_implementation/includeDB_gc_g1 @@ -1,5 +1,5 @@ // -// Copyright 2004-2006 Sun Microsystems, Inc. All Rights Reserved. +// Copyright 2004-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 diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.hpp index f41b77c3d04..b536dd3f514 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2005-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2005-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 diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp index 651cd420f26..67b8690c3d7 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2005-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 diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.hpp index 68268d39d34..6bd5e11fd37 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2005-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2005-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 diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.hpp index affd17edc4c..4f4022e6996 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.hpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2002 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2001-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 diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPermGen.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPermGen.cpp index 5fd5f5539d1..7609be480f6 100644 --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPermGen.cpp +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPermGen.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2005 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2001-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 diff --git a/hotspot/src/share/vm/interpreter/bytecodeStream.cpp b/hotspot/src/share/vm/interpreter/bytecodeStream.cpp index bb051e53049..0f62eb0a7dd 100644 --- a/hotspot/src/share/vm/interpreter/bytecodeStream.cpp +++ b/hotspot/src/share/vm/interpreter/bytecodeStream.cpp @@ -1,5 +1,5 @@ /* - * Copyright 1997-2005 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-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 diff --git a/hotspot/src/share/vm/interpreter/bytecodes.cpp b/hotspot/src/share/vm/interpreter/bytecodes.cpp index 396c87f958b..5f875944104 100644 --- a/hotspot/src/share/vm/interpreter/bytecodes.cpp +++ b/hotspot/src/share/vm/interpreter/bytecodes.cpp @@ -1,5 +1,5 @@ /* - * Copyright 1997-2005 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-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 diff --git a/hotspot/src/share/vm/interpreter/bytecodes.hpp b/hotspot/src/share/vm/interpreter/bytecodes.hpp index f9201d953f5..609591c3fdc 100644 --- a/hotspot/src/share/vm/interpreter/bytecodes.hpp +++ b/hotspot/src/share/vm/interpreter/bytecodes.hpp @@ -1,5 +1,5 @@ /* - * Copyright 1997-2005 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-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 diff --git a/hotspot/src/share/vm/memory/referencePolicy.cpp b/hotspot/src/share/vm/memory/referencePolicy.cpp index 26aef4a2fd4..25d9f6a31a2 100644 --- a/hotspot/src/share/vm/memory/referencePolicy.cpp +++ b/hotspot/src/share/vm/memory/referencePolicy.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2000-2003 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2000-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 diff --git a/hotspot/src/share/vm/memory/referencePolicy.hpp b/hotspot/src/share/vm/memory/referencePolicy.hpp index 2cf22c825ab..dbc312a1e69 100644 --- a/hotspot/src/share/vm/memory/referencePolicy.hpp +++ b/hotspot/src/share/vm/memory/referencePolicy.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2000 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2000-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 diff --git a/hotspot/src/share/vm/memory/tenuredGeneration.hpp b/hotspot/src/share/vm/memory/tenuredGeneration.hpp index a7c22c9bb3a..27eff0069df 100644 --- a/hotspot/src/share/vm/memory/tenuredGeneration.hpp +++ b/hotspot/src/share/vm/memory/tenuredGeneration.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2001-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 diff --git a/hotspot/src/share/vm/oops/constantPoolOop.cpp b/hotspot/src/share/vm/oops/constantPoolOop.cpp index 263b7bbe435..842f8067934 100644 --- a/hotspot/src/share/vm/oops/constantPoolOop.cpp +++ b/hotspot/src/share/vm/oops/constantPoolOop.cpp @@ -1,5 +1,5 @@ /* - * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-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 diff --git a/hotspot/src/share/vm/opto/block.hpp b/hotspot/src/share/vm/opto/block.hpp index 52163809568..43ce09fe9ad 100644 --- a/hotspot/src/share/vm/opto/block.hpp +++ b/hotspot/src/share/vm/opto/block.hpp @@ -1,5 +1,5 @@ /* - * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-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 diff --git a/hotspot/src/share/vm/opto/phase.cpp b/hotspot/src/share/vm/opto/phase.cpp index 8bed29122f0..904214a330f 100644 --- a/hotspot/src/share/vm/opto/phase.cpp +++ b/hotspot/src/share/vm/opto/phase.cpp @@ -1,5 +1,5 @@ /* - * Copyright 1997-2005 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-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 diff --git a/hotspot/src/share/vm/opto/phase.hpp b/hotspot/src/share/vm/opto/phase.hpp index 788f07acc71..a207968206f 100644 --- a/hotspot/src/share/vm/opto/phase.hpp +++ b/hotspot/src/share/vm/opto/phase.hpp @@ -1,5 +1,5 @@ /* - * Copyright 1997-2005 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-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 diff --git a/hotspot/src/share/vm/prims/jniCheck.cpp b/hotspot/src/share/vm/prims/jniCheck.cpp index 5a905843103..d3f35897976 100644 --- a/hotspot/src/share/vm/prims/jniCheck.cpp +++ b/hotspot/src/share/vm/prims/jniCheck.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2001-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 diff --git a/hotspot/src/share/vm/prims/jniCheck.hpp b/hotspot/src/share/vm/prims/jniCheck.hpp index f78ace017bd..8a5276388e1 100644 --- a/hotspot/src/share/vm/prims/jniCheck.hpp +++ b/hotspot/src/share/vm/prims/jniCheck.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2003-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 diff --git a/hotspot/src/share/vm/prims/jvmtiEnvBase.cpp b/hotspot/src/share/vm/prims/jvmtiEnvBase.cpp index cae4a6a76d5..3152e91c3a5 100644 --- a/hotspot/src/share/vm/prims/jvmtiEnvBase.cpp +++ b/hotspot/src/share/vm/prims/jvmtiEnvBase.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2003-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 diff --git a/hotspot/src/share/vm/prims/jvmtiTrace.cpp b/hotspot/src/share/vm/prims/jvmtiTrace.cpp index 09d30fbda16..f76e663f224 100644 --- a/hotspot/src/share/vm/prims/jvmtiTrace.cpp +++ b/hotspot/src/share/vm/prims/jvmtiTrace.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2003-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 diff --git a/hotspot/src/share/vm/runtime/javaCalls.cpp b/hotspot/src/share/vm/runtime/javaCalls.cpp index 38ad6973feb..02e9424c8f2 100644 --- a/hotspot/src/share/vm/runtime/javaCalls.cpp +++ b/hotspot/src/share/vm/runtime/javaCalls.cpp @@ -1,5 +1,5 @@ /* - * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-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 diff --git a/hotspot/src/share/vm/runtime/javaCalls.hpp b/hotspot/src/share/vm/runtime/javaCalls.hpp index 60648c64866..345206f02c5 100644 --- a/hotspot/src/share/vm/runtime/javaCalls.hpp +++ b/hotspot/src/share/vm/runtime/javaCalls.hpp @@ -1,5 +1,5 @@ /* - * Copyright 1997-2005 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-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 diff --git a/hotspot/src/share/vm/runtime/perfMemory.cpp b/hotspot/src/share/vm/runtime/perfMemory.cpp index d48d7b508b5..a91bc13899e 100644 --- a/hotspot/src/share/vm/runtime/perfMemory.cpp +++ b/hotspot/src/share/vm/runtime/perfMemory.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2006 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2001-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 diff --git a/hotspot/src/share/vm/runtime/perfMemory.hpp b/hotspot/src/share/vm/runtime/perfMemory.hpp index 0909bfa0c9e..2077b770bab 100644 --- a/hotspot/src/share/vm/runtime/perfMemory.hpp +++ b/hotspot/src/share/vm/runtime/perfMemory.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2006 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2001-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 diff --git a/hotspot/src/share/vm/runtime/thread.hpp b/hotspot/src/share/vm/runtime/thread.hpp index 1ee5c72604b..6e6e88fe318 100644 --- a/hotspot/src/share/vm/runtime/thread.hpp +++ b/hotspot/src/share/vm/runtime/thread.hpp @@ -1,5 +1,5 @@ /* - * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-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 diff --git a/hotspot/src/share/vm/services/threadService.hpp b/hotspot/src/share/vm/services/threadService.hpp index 97a83bb5e35..b9cd3bbe612 100644 --- a/hotspot/src/share/vm/services/threadService.hpp +++ b/hotspot/src/share/vm/services/threadService.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2003-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 diff --git a/hotspot/src/share/vm/utilities/array.hpp b/hotspot/src/share/vm/utilities/array.hpp index 7dee671cc58..7f2faac7d2a 100644 --- a/hotspot/src/share/vm/utilities/array.hpp +++ b/hotspot/src/share/vm/utilities/array.hpp @@ -1,5 +1,5 @@ /* - * Copyright 2000-2005 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2000-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 diff --git a/hotspot/src/share/vm/utilities/constantTag.hpp b/hotspot/src/share/vm/utilities/constantTag.hpp index 07a8be76d9c..72c078dd705 100644 --- a/hotspot/src/share/vm/utilities/constantTag.hpp +++ b/hotspot/src/share/vm/utilities/constantTag.hpp @@ -1,5 +1,5 @@ /* - * Copyright 1997-2005 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-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 diff --git a/hotspot/src/share/vm/utilities/growableArray.hpp b/hotspot/src/share/vm/utilities/growableArray.hpp index ab4eeb5411e..77ce93c1396 100644 --- a/hotspot/src/share/vm/utilities/growableArray.hpp +++ b/hotspot/src/share/vm/utilities/growableArray.hpp @@ -1,5 +1,5 @@ /* - * Copyright 1997-2005 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 1997-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 diff --git a/hotspot/src/share/vm/utilities/hashtable.cpp b/hotspot/src/share/vm/utilities/hashtable.cpp index 8efa44a203c..df1592f9b66 100644 --- a/hotspot/src/share/vm/utilities/hashtable.cpp +++ b/hotspot/src/share/vm/utilities/hashtable.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2003-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 diff --git a/hotspot/src/share/vm/utilities/taskqueue.cpp b/hotspot/src/share/vm/utilities/taskqueue.cpp index d5220089c5a..779ec4e7f3a 100644 --- a/hotspot/src/share/vm/utilities/taskqueue.cpp +++ b/hotspot/src/share/vm/utilities/taskqueue.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2006 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2001-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 From cc8641d33a8dafc24b7fd9b5b27b905ff043cbc5 Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena Date: Mon, 15 Dec 2008 16:55:25 -0800 Subject: [PATCH 215/267] 6785258: Update copyright year Update copyright for files that have been modified starting July 2008 to Dec 2008 Reviewed-by: katleman, ohair, tbell --- jdk/make/javax/swing/Makefile | 2 +- jdk/make/netbeans/jmx/build.xml | 2 +- jdk/make/sun/net/spi/Makefile | 2 +- jdk/make/sun/net/spi/nameservice/Makefile | 2 +- jdk/src/share/classes/com/sun/java/swing/SwingUtilities3.java | 2 +- .../com/sun/java/swing/plaf/windows/DesktopProperty.java | 2 +- .../com/sun/java/swing/plaf/windows/WindowsDesktopManager.java | 2 +- .../com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java | 2 +- .../java/swing/plaf/windows/WindowsInternalFrameTitlePane.java | 2 +- .../com/sun/java/swing/plaf/windows/WindowsScrollBarUI.java | 2 +- .../com/sun/java/swing/plaf/windows/WindowsTabbedPaneUI.java | 2 +- .../com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java | 2 +- jdk/src/share/classes/com/sun/jmx/defaults/ServiceName.java | 2 +- .../com/sun/jmx/mbeanserver/ClassLoaderRepositorySupport.java | 2 +- .../com/sun/jmx/mbeanserver/ObjectInputStreamWithLoader.java | 2 +- .../com/sun/jmx/mbeanserver/SecureClassLoaderRepository.java | 2 +- .../classes/com/sun/jmx/mbeanserver/WeakIdentityHashMap.java | 2 +- .../com/sun/jmx/remote/internal/ArrayNotificationBuffer.java | 2 +- .../share/classes/com/sun/jmx/remote/internal/Unmarshal.java | 2 +- .../com/sun/jmx/remote/util/ClassLoaderWithRepository.java | 2 +- jdk/src/share/classes/com/sun/jmx/remote/util/ClassLogger.java | 2 +- .../classes/com/sun/jmx/remote/util/OrderClassLoaders.java | 2 +- .../internal/www/protocol/https/HttpsURLConnectionOldImpl.java | 2 +- jdk/src/share/classes/java/awt/EventDispatchThread.java | 2 +- jdk/src/share/classes/java/net/HttpURLConnection.java | 2 +- jdk/src/share/classes/java/nio/Buffer.java | 2 +- jdk/src/share/classes/java/nio/channels/SelectableChannel.java | 2 +- .../java/nio/channels/spi/AbstractSelectableChannel.java | 2 +- jdk/src/share/classes/java/text/SimpleDateFormat.java | 2 +- jdk/src/share/classes/javax/management/ClientContext.java | 2 +- .../share/classes/javax/management/DefaultLoaderRepository.java | 2 +- jdk/src/share/classes/javax/management/JMRuntimeException.java | 2 +- jdk/src/share/classes/javax/management/MBeanAttributeInfo.java | 2 +- .../share/classes/javax/management/MBeanConstructorInfo.java | 2 +- jdk/src/share/classes/javax/management/MBeanInfo.java | 2 +- jdk/src/share/classes/javax/management/Notification.java | 2 +- .../share/classes/javax/management/NotificationListener.java | 2 +- .../javax/management/loading/DefaultLoaderRepository.java | 2 +- .../classes/javax/management/loading/MLetObjectInputStream.java | 2 +- .../classes/javax/management/modelmbean/ModelMBeanInfo.java | 2 +- .../management/openmbean/OpenMBeanParameterInfoSupport.java | 2 +- .../management/relation/MBeanServerNotificationFilter.java | 2 +- jdk/src/share/classes/javax/management/relation/Role.java | 2 +- jdk/src/share/classes/javax/management/relation/RoleList.java | 2 +- jdk/src/share/classes/javax/management/relation/RoleResult.java | 2 +- .../share/classes/javax/management/relation/RoleUnresolved.java | 2 +- .../classes/javax/management/relation/RoleUnresolvedList.java | 2 +- .../javax/management/remote/rmi/NoCallStackClassLoader.java | 2 +- .../classes/javax/management/remote/rmi/RMIConnection.java | 2 +- .../classes/javax/management/remote/rmi/RMIServerImpl.java | 2 +- jdk/src/share/classes/javax/swing/AbstractCellEditor.java | 2 +- jdk/src/share/classes/javax/swing/AbstractListModel.java | 2 +- jdk/src/share/classes/javax/swing/AbstractSpinnerModel.java | 2 +- jdk/src/share/classes/javax/swing/ActionMap.java | 2 +- jdk/src/share/classes/javax/swing/AncestorNotifier.java | 2 +- jdk/src/share/classes/javax/swing/ArrayTable.java | 2 +- jdk/src/share/classes/javax/swing/ButtonGroup.java | 2 +- jdk/src/share/classes/javax/swing/DefaultBoundedRangeModel.java | 2 +- jdk/src/share/classes/javax/swing/DefaultButtonModel.java | 2 +- jdk/src/share/classes/javax/swing/DefaultFocusManager.java | 2 +- .../share/classes/javax/swing/DefaultSingleSelectionModel.java | 2 +- jdk/src/share/classes/javax/swing/GroupLayout.java | 2 +- jdk/src/share/classes/javax/swing/InputMap.java | 2 +- jdk/src/share/classes/javax/swing/JDesktopPane.java | 2 +- jdk/src/share/classes/javax/swing/JDialog.java | 2 +- jdk/src/share/classes/javax/swing/JLayeredPane.java | 2 +- jdk/src/share/classes/javax/swing/JMenu.java | 2 +- jdk/src/share/classes/javax/swing/JMenuItem.java | 2 +- jdk/src/share/classes/javax/swing/JSpinner.java | 2 +- jdk/src/share/classes/javax/swing/JTextField.java | 2 +- jdk/src/share/classes/javax/swing/JTree.java | 2 +- jdk/src/share/classes/javax/swing/JWindow.java | 2 +- jdk/src/share/classes/javax/swing/KeyboardManager.java | 2 +- jdk/src/share/classes/javax/swing/LayoutComparator.java | 2 +- .../share/classes/javax/swing/LayoutFocusTraversalPolicy.java | 2 +- .../classes/javax/swing/LegacyGlueFocusTraversalPolicy.java | 2 +- jdk/src/share/classes/javax/swing/MultiUIDefaults.java | 2 +- jdk/src/share/classes/javax/swing/RepaintManager.java | 2 +- .../share/classes/javax/swing/SortingFocusTraversalPolicy.java | 2 +- jdk/src/share/classes/javax/swing/SpringLayout.java | 2 +- jdk/src/share/classes/javax/swing/Timer.java | 2 +- jdk/src/share/classes/javax/swing/TimerQueue.java | 2 +- jdk/src/share/classes/javax/swing/UIDefaults.java | 2 +- jdk/src/share/classes/javax/swing/UIManager.java | 2 +- jdk/src/share/classes/javax/swing/border/CompoundBorder.java | 2 +- .../classes/javax/swing/plaf/basic/BasicButtonListener.java | 2 +- .../classes/javax/swing/plaf/basic/BasicComboBoxEditor.java | 2 +- .../share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java | 2 +- .../classes/javax/swing/plaf/basic/BasicGraphicsUtils.java | 2 +- .../javax/swing/plaf/basic/BasicInternalFrameTitlePane.java | 2 +- jdk/src/share/classes/javax/swing/plaf/basic/BasicLabelUI.java | 2 +- jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuUI.java | 2 +- .../share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java | 2 +- .../classes/javax/swing/plaf/basic/BasicRadioButtonUI.java | 2 +- .../share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java | 2 +- jdk/src/share/classes/javax/swing/plaf/basic/BasicTextUI.java | 2 +- .../classes/javax/swing/plaf/basic/BasicToggleButtonUI.java | 2 +- jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java | 2 +- .../classes/javax/swing/plaf/basic/DragRecognitionSupport.java | 2 +- jdk/src/share/classes/javax/swing/plaf/basic/LazyActionMap.java | 2 +- .../share/classes/javax/swing/plaf/metal/DefaultMetalTheme.java | 2 +- jdk/src/share/classes/javax/swing/plaf/metal/MetalBumps.java | 2 +- .../classes/javax/swing/plaf/metal/MetalFileChooserUI.java | 2 +- .../javax/swing/plaf/metal/MetalInternalFrameTitlePane.java | 2 +- .../classes/javax/swing/plaf/metal/MetalRadioButtonUI.java | 2 +- jdk/src/share/classes/javax/swing/plaf/metal/MetalSliderUI.java | 2 +- .../share/classes/javax/swing/plaf/metal/MetalToolBarUI.java | 2 +- .../javax/swing/plaf/synth/DefaultSynthStyleFactory.java | 2 +- jdk/src/share/classes/javax/swing/plaf/synth/ImagePainter.java | 2 +- jdk/src/share/classes/javax/swing/plaf/synth/Region.java | 2 +- jdk/src/share/classes/javax/swing/plaf/synth/SynthButtonUI.java | 2 +- .../share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java | 2 +- jdk/src/share/classes/javax/swing/plaf/synth/SynthContext.java | 2 +- .../share/classes/javax/swing/plaf/synth/SynthEditorPaneUI.java | 2 +- .../javax/swing/plaf/synth/SynthInternalFrameTitlePane.java | 2 +- .../share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java | 2 +- jdk/src/share/classes/javax/swing/plaf/synth/SynthParser.java | 2 +- jdk/src/share/classes/javax/swing/plaf/synth/SynthStyle.java | 2 +- .../share/classes/javax/swing/plaf/synth/SynthTextAreaUI.java | 2 +- .../share/classes/javax/swing/plaf/synth/SynthTextFieldUI.java | 2 +- jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java | 2 +- jdk/src/share/classes/javax/swing/table/AbstractTableModel.java | 2 +- jdk/src/share/classes/javax/swing/table/DefaultTableModel.java | 2 +- jdk/src/share/classes/javax/swing/text/AsyncBoxView.java | 2 +- jdk/src/share/classes/javax/swing/text/ComponentView.java | 2 +- jdk/src/share/classes/javax/swing/text/DefaultCaret.java | 2 +- jdk/src/share/classes/javax/swing/text/DefaultFormatter.java | 2 +- jdk/src/share/classes/javax/swing/text/DefaultHighlighter.java | 2 +- .../share/classes/javax/swing/text/DefaultStyledDocument.java | 2 +- jdk/src/share/classes/javax/swing/text/ElementIterator.java | 2 +- jdk/src/share/classes/javax/swing/text/GapContent.java | 2 +- .../share/classes/javax/swing/text/InternationalFormatter.java | 2 +- jdk/src/share/classes/javax/swing/text/LayoutQueue.java | 2 +- jdk/src/share/classes/javax/swing/text/MaskFormatter.java | 2 +- jdk/src/share/classes/javax/swing/text/SegmentCache.java | 2 +- jdk/src/share/classes/javax/swing/text/SimpleAttributeSet.java | 2 +- jdk/src/share/classes/javax/swing/text/StringContent.java | 2 +- jdk/src/share/classes/javax/swing/text/StyleContext.java | 2 +- jdk/src/share/classes/javax/swing/text/TableView.java | 2 +- jdk/src/share/classes/javax/swing/text/TextAction.java | 2 +- jdk/src/share/classes/javax/swing/text/TextLayoutStrategy.java | 2 +- jdk/src/share/classes/javax/swing/text/ZoneView.java | 2 +- jdk/src/share/classes/javax/swing/text/html/HRuleView.java | 2 +- jdk/src/share/classes/javax/swing/text/html/HTML.java | 2 +- jdk/src/share/classes/javax/swing/text/html/HTMLDocument.java | 2 +- jdk/src/share/classes/javax/swing/text/html/HTMLWriter.java | 2 +- jdk/src/share/classes/javax/swing/text/html/Map.java | 2 +- .../share/classes/javax/swing/text/html/MinimalHTMLWriter.java | 2 +- .../share/classes/javax/swing/text/html/OptionListModel.java | 2 +- jdk/src/share/classes/javax/swing/text/html/StyleSheet.java | 2 +- jdk/src/share/classes/javax/swing/text/html/TableView.java | 2 +- .../share/classes/javax/swing/text/html/parser/TagStack.java | 2 +- .../share/classes/javax/swing/text/rtf/MockAttributeSet.java | 2 +- jdk/src/share/classes/javax/swing/text/rtf/RTFParser.java | 2 +- jdk/src/share/classes/javax/swing/text/rtf/RTFReader.java | 2 +- .../share/classes/javax/swing/tree/DefaultTreeCellEditor.java | 2 +- jdk/src/share/classes/javax/swing/tree/DefaultTreeModel.java | 2 +- .../share/classes/javax/swing/tree/FixedHeightLayoutCache.java | 2 +- .../classes/javax/swing/tree/VariableHeightLayoutCache.java | 2 +- jdk/src/share/classes/javax/swing/undo/StateEdit.java | 2 +- jdk/src/share/classes/javax/swing/undo/UndoManager.java | 2 +- jdk/src/share/classes/javax/swing/undo/UndoableEditSupport.java | 2 +- .../classes/org/jcp/xml/dsig/internal/DigesterOutputStream.java | 2 +- .../classes/org/jcp/xml/dsig/internal/SignerOutputStream.java | 2 +- .../org/jcp/xml/dsig/internal/dom/ApacheCanonicalizer.java | 2 +- .../share/classes/org/jcp/xml/dsig/internal/dom/ApacheData.java | 2 +- .../org/jcp/xml/dsig/internal/dom/ApacheNodeSetData.java | 2 +- .../org/jcp/xml/dsig/internal/dom/ApacheOctetStreamData.java | 2 +- .../classes/org/jcp/xml/dsig/internal/dom/ApacheTransform.java | 2 +- .../org/jcp/xml/dsig/internal/dom/DOMBase64Transform.java | 2 +- .../jcp/xml/dsig/internal/dom/DOMCanonicalXMLC14NMethod.java | 2 +- .../jcp/xml/dsig/internal/dom/DOMCanonicalizationMethod.java | 2 +- .../classes/org/jcp/xml/dsig/internal/dom/DOMCryptoBinary.java | 2 +- .../classes/org/jcp/xml/dsig/internal/dom/DOMDigestMethod.java | 2 +- .../org/jcp/xml/dsig/internal/dom/DOMEnvelopedTransform.java | 2 +- .../classes/org/jcp/xml/dsig/internal/dom/DOMExcC14NMethod.java | 2 +- .../org/jcp/xml/dsig/internal/dom/DOMHMACSignatureMethod.java | 2 +- .../share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfo.java | 2 +- .../org/jcp/xml/dsig/internal/dom/DOMKeyInfoFactory.java | 2 +- .../share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyName.java | 2 +- .../classes/org/jcp/xml/dsig/internal/dom/DOMKeyValue.java | 2 +- .../classes/org/jcp/xml/dsig/internal/dom/DOMManifest.java | 2 +- .../share/classes/org/jcp/xml/dsig/internal/dom/DOMPGPData.java | 2 +- .../org/jcp/xml/dsig/internal/dom/DOMSignatureMethod.java | 2 +- .../org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java | 2 +- .../org/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java | 2 +- .../classes/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java | 2 +- .../classes/org/jcp/xml/dsig/internal/dom/DOMStructure.java | 2 +- .../classes/org/jcp/xml/dsig/internal/dom/DOMSubTreeData.java | 2 +- .../classes/org/jcp/xml/dsig/internal/dom/DOMTransform.java | 2 +- .../org/jcp/xml/dsig/internal/dom/DOMURIDereferencer.java | 2 +- .../share/classes/org/jcp/xml/dsig/internal/dom/DOMUtils.java | 2 +- .../classes/org/jcp/xml/dsig/internal/dom/DOMX509Data.java | 2 +- .../org/jcp/xml/dsig/internal/dom/DOMX509IssuerSerial.java | 2 +- .../classes/org/jcp/xml/dsig/internal/dom/DOMXMLObject.java | 2 +- .../org/jcp/xml/dsig/internal/dom/DOMXMLSignatureFactory.java | 2 +- .../org/jcp/xml/dsig/internal/dom/DOMXPathTransform.java | 2 +- .../classes/org/jcp/xml/dsig/internal/dom/DOMXSLTTransform.java | 2 +- jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/Utils.java | 2 +- jdk/src/share/classes/sun/awt/im/CompositionArea.java | 2 +- .../sun/management/jmxremote/LocalRMIServerSocketFactory.java | 2 +- jdk/src/share/classes/sun/net/ProgressEvent.java | 2 +- jdk/src/share/classes/sun/net/httpserver/ExchangeImpl.java | 2 +- .../classes/sun/net/httpserver/FixedLengthInputStream.java | 2 +- jdk/src/share/classes/sun/net/httpserver/Request.java | 2 +- .../sun/net/www/protocol/https/HttpsURLConnectionImpl.java | 2 +- jdk/src/share/classes/sun/nio/ch/AbstractPollSelectorImpl.java | 2 +- .../classes/sun/security/provider/certpath/OCSPResponse.java | 2 +- jdk/src/share/classes/sun/swing/AccessibleMethod.java | 2 +- jdk/src/share/classes/sun/swing/SwingLazyValue.java | 2 +- jdk/src/share/classes/sun/swing/SwingUtilities2.java | 2 +- .../share/classes/sun/swing/plaf/synth/DefaultSynthStyle.java | 2 +- .../classes/sun/swing/plaf/synth/SynthFileChooserUIImpl.java | 2 +- jdk/src/share/classes/sun/util/calendar/ZoneInfo.java | 2 +- jdk/src/share/classes/sun/util/resources/TimeZoneNames.java | 2 +- jdk/src/share/classes/sun/util/resources/TimeZoneNames_de.java | 2 +- jdk/src/share/classes/sun/util/resources/TimeZoneNames_es.java | 2 +- jdk/src/share/classes/sun/util/resources/TimeZoneNames_fr.java | 2 +- jdk/src/share/classes/sun/util/resources/TimeZoneNames_it.java | 2 +- jdk/src/share/classes/sun/util/resources/TimeZoneNames_ja.java | 2 +- jdk/src/share/classes/sun/util/resources/TimeZoneNames_ko.java | 2 +- jdk/src/share/classes/sun/util/resources/TimeZoneNames_sv.java | 2 +- .../share/classes/sun/util/resources/TimeZoneNames_zh_CN.java | 2 +- .../share/classes/sun/util/resources/TimeZoneNames_zh_TW.java | 2 +- jdk/src/share/native/sun/font/bidi/ubidi.c | 2 +- .../classes/sun/net/www/protocol/http/NTLMAuthentication.java | 2 +- jdk/src/solaris/classes/sun/nio/ch/EPollSelectorImpl.java | 2 +- jdk/src/windows/classes/sun/nio/ch/WindowsSelectorImpl.java | 2 +- .../SetDatagramSocketImplFactory/ADatagramSocket.sh | 2 +- jdk/test/java/nio/Buffer/Basic-X.java | 2 +- jdk/test/java/nio/Buffer/Basic.java | 2 +- jdk/test/java/nio/Buffer/BasicByte.java | 2 +- jdk/test/java/nio/Buffer/BasicChar.java | 2 +- jdk/test/java/nio/Buffer/BasicDouble.java | 2 +- jdk/test/java/nio/Buffer/BasicFloat.java | 2 +- jdk/test/java/nio/Buffer/BasicInt.java | 2 +- jdk/test/java/nio/Buffer/BasicLong.java | 2 +- jdk/test/java/nio/Buffer/BasicShort.java | 2 +- jdk/test/java/nio/Buffer/genBasic.sh | 2 +- jdk/test/java/nio/Buffer/genCopyDirectMemory.sh | 2 +- jdk/test/java/nio/channels/Channels/Basic.java | 2 +- jdk/test/java/util/TimeZone/OldIDMappingTest.sh | 2 +- jdk/test/javax/management/Introspector/AnnotationTest.java | 2 +- jdk/test/javax/management/MBeanServer/MBeanExceptionTest.java | 2 +- jdk/test/javax/management/context/ContextTest.java | 2 +- jdk/test/javax/management/context/LocaleTest.java | 2 +- jdk/test/javax/management/context/LocalizableTest.java | 2 +- .../management/context/localizable/MBeanDescriptions_fr.java | 2 +- jdk/test/javax/management/context/localizable/Whatsit.java | 2 +- jdk/test/javax/management/context/localizable/WhatsitMBean.java | 2 +- .../management/remote/mandatory/provider/ProviderTest.java | 2 +- .../remote/mandatory/subjectDelegation/SimpleStandard.java | 2 +- jdk/test/javax/swing/RepaintManager/6608456/bug6608456.java | 2 +- jdk/test/javax/swing/text/html/HRuleView/Test5062055.java | 2 +- jdk/test/javax/xml/crypto/dsig/GenerationTests.java | 2 +- 255 files changed, 255 insertions(+), 255 deletions(-) diff --git a/jdk/make/javax/swing/Makefile b/jdk/make/javax/swing/Makefile index e112e609cd9..1f3fa6c0f39 100644 --- a/jdk/make/javax/swing/Makefile +++ b/jdk/make/javax/swing/Makefile @@ -1,5 +1,5 @@ # -# Copyright 1998-2006 Sun Microsystems, Inc. All Rights Reserved. +# Copyright 1998-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 diff --git a/jdk/make/netbeans/jmx/build.xml b/jdk/make/netbeans/jmx/build.xml index e306b8ea40a..7bff95ae405 100644 --- a/jdk/make/netbeans/jmx/build.xml +++ b/jdk/make/netbeans/jmx/build.xml @@ -1,5 +1,5 @@ "); scriptEnd(); noScript(); - println(" " + getHyperLink(link, where, label, bold, "", "", target)); + println(" " + getHyperLink(link, where, label, strong, "", "", target)); noScriptEnd(); println(DocletConstants.NL); } @@ -958,10 +958,10 @@ public class HtmlDocletWriter extends HtmlDocWriter { * * @param pkg the package to link to. * @param label the label for the link. - * @param isBold true if the label should be bold. + * @param isStrong true if the label should be strong. */ - public void printPackageLink(PackageDoc pkg, String label, boolean isBold) { - print(getPackageLink(pkg, label, isBold)); + public void printPackageLink(PackageDoc pkg, String label, boolean isStrong) { + print(getPackageLink(pkg, label, isStrong)); } /** @@ -969,12 +969,12 @@ public class HtmlDocletWriter extends HtmlDocWriter { * * @param pkg the package to link to. * @param label the label for the link. - * @param isBold true if the label should be bold. + * @param isStrong true if the label should be strong. * @param style the font of the package link label. */ - public void printPackageLink(PackageDoc pkg, String label, boolean isBold, + public void printPackageLink(PackageDoc pkg, String label, boolean isStrong, String style) { - print(getPackageLink(pkg, label, isBold, style)); + print(getPackageLink(pkg, label, isStrong, style)); } /** @@ -982,12 +982,12 @@ public class HtmlDocletWriter extends HtmlDocWriter { * * @param pkg the package to link to. * @param label the label for the link. - * @param isBold true if the label should be bold. + * @param isStrong true if the label should be strong. * @return the link to the given package. */ public String getPackageLink(PackageDoc pkg, String label, - boolean isBold) { - return getPackageLink(pkg, label, isBold, ""); + boolean isStrong) { + return getPackageLink(pkg, label, isStrong, ""); } /** @@ -995,11 +995,11 @@ public class HtmlDocletWriter extends HtmlDocWriter { * * @param pkg the package to link to. * @param label the label for the link. - * @param isBold true if the label should be bold. + * @param isStrong true if the label should be strong. * @param style the font of the package link label. * @return the link to the given package. */ - public String getPackageLink(PackageDoc pkg, String label, boolean isBold, + public String getPackageLink(PackageDoc pkg, String label, boolean isStrong, String style) { boolean included = pkg != null && pkg.isIncluded(); if (! included) { @@ -1013,11 +1013,11 @@ public class HtmlDocletWriter extends HtmlDocWriter { } if (included || pkg == null) { return getHyperLink(pathString(pkg, "package-summary.html"), - "", label, isBold, style); + "", label, isStrong, style); } else { String crossPkgLink = getCrossPackageLink(Util.getPackageName(pkg)); if (crossPkgLink != null) { - return getHyperLink(crossPkgLink, "", label, isBold, style); + return getHyperLink(crossPkgLink, "", label, isStrong, style); } else { return label; } @@ -1087,12 +1087,12 @@ public class HtmlDocletWriter extends HtmlDocWriter { * @param refMemName the name of the member being referenced. This should * be null or empty string if no member is being referenced. * @param label the label for the external link. - * @param bold true if the link should be bold. + * @param strong true if the link should be strong. * @param style the style of the link. * @param code true if the label should be code font. */ public String getCrossClassLink(String qualifiedClassName, String refMemName, - String label, boolean bold, String style, + String label, boolean strong, String style, boolean code) { String className = "", packageName = qualifiedClassName == null ? "" : qualifiedClassName; @@ -1113,7 +1113,7 @@ public class HtmlDocletWriter extends HtmlDocWriter { className + ".html?is-external=true"), refMemName == null ? "" : refMemName, label == null || label.length() == 0 ? defaultLabel : label, - bold, style, + strong, style, configuration.getText("doclet.Href_Class_Or_Interface_Title", packageName), ""); } @@ -1152,26 +1152,26 @@ public class HtmlDocletWriter extends HtmlDocWriter { * link label. * * @param cd the class to link to. - * @param isBold true if the link should be bold. + * @param isStrong true if the link should be strong. * @return the link with the package portion of the label in plain text. */ public String getPreQualifiedClassLink(int context, - ClassDoc cd, boolean isBold) { + ClassDoc cd, boolean isStrong) { String classlink = ""; PackageDoc pd = cd.containingPackage(); if(pd != null && ! configuration.shouldExcludeQualifier(pd.name())) { classlink = getPkgName(cd); } - classlink += getLink(new LinkInfoImpl(context, cd, cd.name(), isBold)); + classlink += getLink(new LinkInfoImpl(context, cd, cd.name(), isStrong)); return classlink; } /** - * Print Class link, with only class name as the bold link and prefixing + * Print Class link, with only class name as the strong link and prefixing * plain package name. */ - public void printPreQualifiedBoldClassLink(int context, ClassDoc cd) { + public void printPreQualifiedStrongClassLink(int context, ClassDoc cd) { print(getPreQualifiedClassLink(context, cd, true)); } @@ -1187,16 +1187,16 @@ public class HtmlDocletWriter extends HtmlDocWriter { print(configuration.getText(key, a1, a2)); } - public void boldText(String key) { - bold(configuration.getText(key)); + public void strongText(String key) { + strong(configuration.getText(key)); } - public void boldText(String key, String a1) { - bold(configuration.getText(key, a1)); + public void strongText(String key, String a1) { + strong(configuration.getText(key, a1)); } - public void boldText(String key, String a1, String a2) { - bold(configuration.getText(key, a1, a2)); + public void strongText(String key, String a1, String a2) { + strong(configuration.getText(key, a1, a2)); } /** @@ -1205,11 +1205,11 @@ public class HtmlDocletWriter extends HtmlDocWriter { * @param context the id of the context where the link will be printed. * @param doc the member being linked to. * @param label the label for the link. - * @param bold true if the link should be bold. + * @param strong true if the link should be strong. */ public void printDocLink(int context, MemberDoc doc, String label, - boolean bold) { - print(getDocLink(context, doc, label, bold)); + boolean strong) { + print(getDocLink(context, doc, label, strong)); } /** @@ -1221,11 +1221,11 @@ public class HtmlDocletWriter extends HtmlDocWriter { * inheriting comments. * @param doc the member being linked to. * @param label the label for the link. - * @param bold true if the link should be bold. + * @param strong true if the link should be strong. */ public void printDocLink(int context, ClassDoc classDoc, MemberDoc doc, - String label, boolean bold) { - print(getDocLink(context, classDoc, doc, label, bold)); + String label, boolean strong) { + print(getDocLink(context, classDoc, doc, label, strong)); } /** @@ -1234,12 +1234,12 @@ public class HtmlDocletWriter extends HtmlDocWriter { * @param context the id of the context where the link will be printed. * @param doc the member being linked to. * @param label the label for the link. - * @param bold true if the link should be bold. + * @param strong true if the link should be strong. * @return the link for the given member. */ public String getDocLink(int context, MemberDoc doc, String label, - boolean bold) { - return getDocLink(context, doc.containingClass(), doc, label, bold); + boolean strong) { + return getDocLink(context, doc.containingClass(), doc, label, strong); } /** @@ -1251,21 +1251,21 @@ public class HtmlDocletWriter extends HtmlDocWriter { * inheriting comments. * @param doc the member being linked to. * @param label the label for the link. - * @param bold true if the link should be bold. + * @param strong true if the link should be strong. * @return the link for the given member. */ public String getDocLink(int context, ClassDoc classDoc, MemberDoc doc, - String label, boolean bold) { + String label, boolean strong) { if (! (doc.isIncluded() || Util.isLinkable(classDoc, configuration()))) { return label; } else if (doc instanceof ExecutableMemberDoc) { ExecutableMemberDoc emd = (ExecutableMemberDoc)doc; return getLink(new LinkInfoImpl(context, classDoc, - getAnchor(emd), label, bold)); + getAnchor(emd), label, strong)); } else if (doc instanceof MemberDoc) { return getLink(new LinkInfoImpl(context, classDoc, - doc.name(), label, bold)); + doc.name(), label, strong)); } else { return label; } diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java index ed90d540433..ff648659ba5 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java @@ -100,7 +100,7 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl fieldType)); } print(fieldDimensions + ' '); - bold(fieldName); + strong(fieldName); writer.preEnd(); writer.dl(); } diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java index 4a2abf11077..b459bff49b9 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java @@ -81,7 +81,7 @@ public class LinkFactoryImpl extends LinkFactory { !(linkInfo.classDoc.name() + ".html").equals(m_writer.filename)) { linkOutput.append(m_writer.getHyperLink(filename, classLinkInfo.where, label.toString(), - classLinkInfo.isBold, classLinkInfo.styleName, + classLinkInfo.isStrong, classLinkInfo.styleName, title, classLinkInfo.target)); if (noLabel && !classLinkInfo.excludeTypeParameterLinks) { linkOutput.append(getTypeParameterLinks(linkInfo).toString()); @@ -92,7 +92,7 @@ public class LinkFactoryImpl extends LinkFactory { } else { String crossLink = m_writer.getCrossClassLink( classDoc.qualifiedName(), classLinkInfo.where, - label.toString(), classLinkInfo.isBold, classLinkInfo.styleName, + label.toString(), classLinkInfo.isStrong, classLinkInfo.styleName, true); if (crossLink != null) { linkOutput.append(crossLink); diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkInfoImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkInfoImpl.java index 9bf955db4af..363e0f4c6fa 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkInfoImpl.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkInfoImpl.java @@ -235,15 +235,15 @@ public class LinkInfoImpl extends LinkInfo { * @param classDoc the class to link to. * @param where the value of the marker #. * @param label the label for the link. - * @param isBold true if the link should be bold. + * @param isStrong true if the link should be strong. * @param styleName String style of text defined in style sheet. */ public LinkInfoImpl (int context, ClassDoc classDoc, String where, String label, - boolean isBold, String styleName){ + boolean isStrong, String styleName){ this.classDoc = classDoc; this.where = where; this.label = label; - this.isBold = isBold; + this.isStrong = isStrong; this.styleName = styleName; setContext(context); } @@ -255,14 +255,14 @@ public class LinkInfoImpl extends LinkInfo { * @param classDoc the class to link to. * @param where the value of the marker #. * @param label the label for the link. - * @param isBold true if the link should be bold. + * @param isStrong true if the link should be strong. */ public LinkInfoImpl (int context, ClassDoc classDoc, String where, String label, - boolean isBold){ + boolean isStrong){ this.classDoc = classDoc; this.where = where; this.label = label; - this.isBold = isBold; + this.isStrong = isStrong; setContext(context); } @@ -283,12 +283,12 @@ public class LinkInfoImpl extends LinkInfo { * * @param context the context of the link. * @param executableMemberDoc the member to link to. - * @param isBold true if the link should be bold. + * @param isStrong true if the link should be strong. */ public LinkInfoImpl (int context, ExecutableMemberDoc executableMemberDoc, - boolean isBold){ + boolean isStrong){ this.executableMemberDoc = executableMemberDoc; - this.isBold = isBold; + this.isStrong = isStrong; setContext(context); } @@ -297,11 +297,11 @@ public class LinkInfoImpl extends LinkInfo { * * @param context the context of the link. * @param classDoc the class to link to. - * @param isBold true if the link should be bold. + * @param isStrong true if the link should be strong. */ - public LinkInfoImpl (int context, ClassDoc classDoc, boolean isBold){ + public LinkInfoImpl (int context, ClassDoc classDoc, boolean isStrong){ this.classDoc = classDoc; - this.isBold = isBold; + this.isStrong = isStrong; setContext(context); } @@ -335,13 +335,13 @@ public class LinkInfoImpl extends LinkInfo { * @param context the context of the link. * @param type the class to link to. * @param label the label for the link. - * @param isBold true if the link should be bold. + * @param isStrong true if the link should be strong. */ public LinkInfoImpl (int context, Type type, String label, - boolean isBold){ + boolean isStrong){ this.type = type; this.label = label; - this.isBold = isBold; + this.isStrong = isStrong; setContext(context); } @@ -351,13 +351,13 @@ public class LinkInfoImpl extends LinkInfo { * @param context the context of the link. * @param classDoc the class to link to. * @param label the label for the link. - * @param isBold true if the link should be bold. + * @param isStrong true if the link should be strong. */ public LinkInfoImpl (int context, ClassDoc classDoc, String label, - boolean isBold){ + boolean isStrong){ this.classDoc = classDoc; this.label = label; - this.isBold = isBold; + this.isStrong = isStrong; setContext(context); } diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java index 16976c43eb2..7a4da14b0d6 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java @@ -167,7 +167,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter if (configuration().linksource) { writer.printSrcLink(method, method.name()); } else { - bold(method.name()); + strong(method.name()); } writeParameters(method); writeExceptions(method); @@ -210,7 +210,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter holder.typeName() : holder.qualifiedTypeName(), false)); writer.dd(); - writer.boldText(holder.asClassDoc().isClass()? + writer.strongText(holder.asClassDoc().isClass()? "doclet.Description_From_Class": "doclet.Description_From_Interface", classlink); @@ -259,7 +259,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter } public void printSummaryLabel(ClassDoc cd) { - writer.boldText("doclet.Method_Summary"); + writer.strongText("doclet.Method_Summary"); } public void printSummaryAnchor(ClassDoc cd) { @@ -274,12 +274,12 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter public void printInheritedSummaryLabel(ClassDoc cd) { String classlink = writer.getPreQualifiedClassLink( LinkInfoImpl.CONTEXT_MEMBER, cd, false); - writer.bold(); + writer.strong(); String key = cd.isClass()? "doclet.Methods_Inherited_From_Class" : "doclet.Methods_Inherited_From_Interface"; writer.printText(key, classlink); - writer.boldEnd(); + writer.strongEnd(); } protected void printSummaryType(ProgramElementDoc member) { @@ -317,7 +317,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter writer.getLink(new LinkInfoImpl(context, overriddenType))); String name = method.name(); writer.dt(); - writer.boldText(label); + writer.strongText(label); writer.dd(); String methLink = writer.codeText( writer.getLink( @@ -363,7 +363,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter writer.getLink(new LinkInfoImpl( LinkInfoImpl.CONTEXT_METHOD_SPECIFIED_BY, intfac))); writer.dt(); - writer.boldText("doclet.Specified_By"); + writer.strongText("doclet.Specified_By"); writer.dd(); methlink = writer.codeText(writer.getDocLink( LinkInfoImpl.CONTEXT_MEMBER, implementedMeth, diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java index db1e21f40fe..2b3d2ea3709 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java @@ -149,7 +149,7 @@ public class NestedClassWriterImpl extends AbstractMemberWriter } public void printSummaryLabel(ClassDoc cd) { - writer.boldText("doclet.Nested_Class_Summary"); + writer.strongText("doclet.Nested_Class_Summary"); } public void printSummaryAnchor(ClassDoc cd) { @@ -164,18 +164,18 @@ public class NestedClassWriterImpl extends AbstractMemberWriter public void printInheritedSummaryLabel(ClassDoc cd) { String clslink = writer.getPreQualifiedClassLink( LinkInfoImpl.CONTEXT_MEMBER, cd, false); - writer.bold(); + writer.strong(); writer.printText(cd.isInterface() ? "doclet.Nested_Classes_Interface_Inherited_From_Interface" : "doclet.Nested_Classes_Interfaces_Inherited_From_Class", clslink); - writer.boldEnd(); + writer.strongEnd(); } protected void writeSummaryLink(int context, ClassDoc cd, ProgramElementDoc member) { - writer.bold(); + writer.strong(); writer.printLink(new LinkInfoImpl(context, (ClassDoc)member, false)); - writer.boldEnd(); + writer.strongEnd(); } protected void writeInheritedSummaryLink(ClassDoc cd, diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java index 20e412eb68a..ebc7118ab5d 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java @@ -87,7 +87,7 @@ public class PackageIndexFrameWriter extends AbstractPackageIndexWriter { } /** - * Print the "-packagesheader" string in bold format, at top of the page, + * Print the "-packagesheader" string in strong format, at top of the page, * if it is not the empty string. Otherwise print the "-header" string. * Despite the name, there is actually no navigation bar for this page. */ @@ -95,9 +95,9 @@ public class PackageIndexFrameWriter extends AbstractPackageIndexWriter { printTableHeader(true); fontSizeStyle("+1", "FrameTitleFont"); if (configuration.packagesheader.length() > 0) { - bold(replaceDocRootDir(configuration.packagesheader)); + strong(replaceDocRootDir(configuration.packagesheader)); } else { - bold(replaceDocRootDir(configuration.header)); + strong(replaceDocRootDir(configuration.header)); } fontEnd(); printTableFooter(true); diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java index 5eac4cdc714..9cc222cea9d 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java @@ -102,9 +102,9 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter { if(pkg != null && pkg.name().length() > 0) { trBgcolorStyle("white", "TableRowColor"); summaryRow(20); - bold(); + strong(); printPackageLink(pkg, Util.getPackageName(pkg), false); - boldEnd(); + strongEnd(); summaryRowEnd(); summaryRow(0); printSummaryComment(pkg); @@ -137,7 +137,7 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter { if (root.inlineTags().length > 0) { printSummaryComment(root); p(); - bold(configuration.getText("doclet.See")); + strong(configuration.getText("doclet.See")); br(); printNbsps(); printHyperLink("", "overview_description", @@ -152,7 +152,7 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter { protected void printIndexHeader(String text) { tableIndexSummary(); tableHeaderStart("#CCCCFF"); - bold(text); + strong(text); tableHeaderEnd(); } diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java index 6633af796a0..638c6d4d75f 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java @@ -144,7 +144,7 @@ public class PackageTreeWriter extends AbstractTreeWriter { protected void printLinkToMainTree() { dl(); dt(); - boldText("doclet.Package_Hierarchies"); + strongText("doclet.Package_Hierarchies"); dd(); navLinkMainTree(configuration.getText("doclet.All_Packages")); dlEnd(); diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java index 83eec5e7e74..03ee446d95e 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java @@ -178,9 +178,9 @@ public class PackageUseWriter extends SubWriterHolderWriter { trBgcolorStyle("white", "TableRowColor"); summaryRow(0); - bold(); + strong(); printHyperLink(path, packageName, usedClass.name(), true); - boldEnd(); + strongEnd(); println(); br(); printNbsps(); printIndexComment(usedClass); @@ -219,7 +219,7 @@ public class PackageUseWriter extends SubWriterHolderWriter { hr(); center(); h2(); - boldText("doclet.ClassUse_Title", packageLabel, name); + strongText("doclet.ClassUse_Title", packageLabel, name); h2End(); centerEnd(); } @@ -251,7 +251,7 @@ public class PackageUseWriter extends SubWriterHolderWriter { protected void navLinkClassUse() { navCellRevStart(); fontStyle("NavBarFont1Rev"); - boldText("doclet.navClassUse"); + strongText("doclet.navClassUse"); fontEnd(); navCellEnd(); } diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java index f7911c01c9c..eca6d49bbbf 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java @@ -123,14 +123,14 @@ public class PackageWriterImpl extends HtmlDocletWriter } trBgcolorStyle("white", "TableRowColor"); summaryRow(15); - bold(); + strong(); printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_PACKAGE, classes[i], false)); - boldEnd(); + strongEnd(); summaryRowEnd(); summaryRow(0); if (Util.isDeprecated(classes[i])) { - boldText("doclet.Deprecated"); + strongText("doclet.Deprecated"); if (classes[i].tags("deprecated").length > 0) { space(); printSummaryDeprecatedComment(classes[i], @@ -155,7 +155,7 @@ public class PackageWriterImpl extends HtmlDocletWriter */ protected void printFirstRow(String label) { tableHeaderStart("#CCCCFF"); - bold(label); + strong(label); tableHeaderEnd(); } @@ -194,7 +194,7 @@ public class PackageWriterImpl extends HtmlDocletWriter if (packageDoc.inlineTags().length > 0 && ! configuration.nocomment) { printSummaryComment(packageDoc); p(); - bold(configuration.getText("doclet.See")); + strong(configuration.getText("doclet.See")); br(); printNbsps(); printHyperLink("", "package_description", @@ -268,7 +268,7 @@ public class PackageWriterImpl extends HtmlDocletWriter protected void navLinkPackage() { navCellRevStart(); fontStyle("NavBarFont1Rev"); - boldText("doclet.Package"); + strongText("doclet.Package"); fontEnd(); navCellEnd(); } diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java index 7dc668a077d..afcce254a1d 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java @@ -73,9 +73,9 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter tableHeader(); thAlign("center"); font("+2"); - boldText("doclet.Package"); + strongText("doclet.Package"); print(' '); - bold(packageName); + strong(packageName); tableFooter(); } @@ -86,7 +86,7 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter * @param serialUID the serial UID to print. */ public void writeSerialUIDInfo(String header, String serialUID) { - bold(header + " "); + strong(header + " "); println(serialUID); p(); } @@ -131,7 +131,7 @@ public class SerializedFormWriterImpl extends SubWriterHolderWriter tableHeader(); thAlignColspan("left", 2); font("+2"); - bold(className); + strong(className); tableFooter(); p(); } diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java index e82966cf848..f6b6b98b6e5 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java @@ -81,7 +81,7 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter { public void printTableHeadingBackground(String str) { tableIndexDetail(); tableHeaderStart("#CCCCFF", 1); - bold(str); + strong(str); tableHeaderEnd(); tableEnd(); } @@ -117,7 +117,7 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter { protected void printIndexComment(Doc member, Tag[] firstSentenceTags) { Tag[] deprs = member.tags("deprecated"); if (Util.isDeprecated((ProgramElementDoc) member)) { - boldText("doclet.Deprecated"); + strongText("doclet.Deprecated"); space(); if (deprs.length > 0) { printInlineDeprecatedComment(member, deprs[0]); @@ -126,7 +126,7 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter { } else { ClassDoc cd = ((ProgramElementDoc)member).containingClass(); if (cd != null && Util.isDeprecated(cd)) { - boldText("doclet.Deprecated"); space(); + strongText("doclet.Deprecated"); space(); } } printSummaryComment(member, firstSentenceTags); diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java index 6a82d06f0f0..353937f630a 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java @@ -69,9 +69,9 @@ public class TagletWriterImpl extends TagletWriter { Tag[] deprs = doc.tags("deprecated"); if (doc instanceof ClassDoc) { if (Util.isDeprecated((ProgramElementDoc) doc)) { - output.append("" + + output.append("" + ConfigurationImpl.getInstance(). - getText("doclet.Deprecated") + " "); + getText("doclet.Deprecated") + " "); if (deprs.length > 0) { Tag[] commentTags = deprs[0].inlineTags(); if (commentTags.length > 0) { @@ -86,9 +86,9 @@ public class TagletWriterImpl extends TagletWriter { } else { MemberDoc member = (MemberDoc) doc; if (Util.isDeprecated((ProgramElementDoc) doc)) { - output.append("
      " + + output.append("
      " + ConfigurationImpl.getInstance(). - getText("doclet.Deprecated") + " "); + getText("doclet.Deprecated") + " "); if (deprs.length > 0) { output.append(""); output.append(commentTagsToOutput(null, doc, @@ -101,9 +101,9 @@ public class TagletWriterImpl extends TagletWriter { } } else { if (Util.isDeprecated(member.containingClass())) { - output.append("
      " + + output.append("
      " + ConfigurationImpl.getInstance(). - getText("doclet.Deprecated") + " "); + getText("doclet.Deprecated") + " "); } } } @@ -123,7 +123,7 @@ public class TagletWriterImpl extends TagletWriter { public TagletOutput getParamHeader(String header) { StringBuffer result = new StringBuffer(); result.append("
      "); - result.append("" + header + ""); + result.append("" + header + ""); return new TagletOutputImpl(result.toString()); } @@ -141,8 +141,8 @@ public class TagletWriterImpl extends TagletWriter { */ public TagletOutput returnTagOutput(Tag returnTag) { TagletOutput result = new TagletOutputImpl(DocletConstants.NL + "
      " + - "" + htmlWriter.configuration.getText("doclet.Returns") + - "" + "
      " + + "" + htmlWriter.configuration.getText("doclet.Returns") + + "" + "
      " + htmlWriter.commentTagsToString(returnTag, null, returnTag.inlineTags(), false)); return result; @@ -189,7 +189,7 @@ public class TagletWriterImpl extends TagletWriter { if (result != null && result.length() > 0) { return result + ", " + DocletConstants.NL; } else { - return "
      " + htmlWriter.configuration().getText("doclet.See_Also") + "
      "; + return "
      " + htmlWriter.configuration().getText("doclet.See_Also") + "
      "; } } @@ -197,7 +197,7 @@ public class TagletWriterImpl extends TagletWriter { * {@inheritDoc} */ public TagletOutput simpleTagOutput(Tag[] simpleTags, String header) { - String result = "
      " + header + "
      " + DocletConstants.NL + + String result = "
      " + header + "
      " + DocletConstants.NL + "
      "; for (int i = 0; i < simpleTags.length; i++) { if (i > 0) { @@ -212,7 +212,7 @@ public class TagletWriterImpl extends TagletWriter { * {@inheritDoc} */ public TagletOutput simpleTagOutput(Tag simpleTag, String header) { - return new TagletOutputImpl("
      " + header + "
      " + "
      " + return new TagletOutputImpl("
      " + header + "
      " + "
      " + htmlWriter.commentTagsToString(simpleTag, null, simpleTag.inlineTags(), false) + "
      " + DocletConstants.NL); } @@ -221,8 +221,8 @@ public class TagletWriterImpl extends TagletWriter { * {@inheritDoc} */ public TagletOutput getThrowsHeader() { - return new TagletOutputImpl(DocletConstants.NL + "
      " + "" + - htmlWriter.configuration().getText("doclet.Throws") + ""); + return new TagletOutputImpl(DocletConstants.NL + "
      " + "" + + htmlWriter.configuration().getText("doclet.Throws") + ""); } /** diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java index 77e6a10a4df..669cd1c86a1 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java @@ -119,7 +119,7 @@ public class TreeWriter extends AbstractTreeWriter { if (!classesonly) { dl(); dt(); - boldText("doclet.Package_Hierarchies"); + strongText("doclet.Package_Hierarchies"); dd(); for (int i = 0; i < packages.length; i++) { if (packages[i].name().length() == 0) { diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java index cb8862a9510..8644af9a22f 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java @@ -83,11 +83,11 @@ public abstract class HtmlDocWriter extends HtmlWriter { * @param where Position of the link in the file. Character '#' is not * needed. * @param label Tag for the link. - * @param bold Boolean that sets label to bold. + * @param strong Boolean that sets label to strong. */ public void printHyperLink(String link, String where, - String label, boolean bold) { - print(getHyperLink(link, where, label, bold, "", "", "")); + String label, boolean strong) { + print(getHyperLink(link, where, label, strong, "", "", "")); } /** @@ -109,13 +109,13 @@ public abstract class HtmlDocWriter extends HtmlWriter { * @param where Position of the link in the file. Character '#' is not * needed. * @param label Tag for the link. - * @param bold Boolean that sets label to bold. + * @param strong Boolean that sets label to strong. * @param stylename String style of text defined in style sheet. */ public void printHyperLink(String link, String where, - String label, boolean bold, + String label, boolean strong, String stylename) { - print(getHyperLink(link, where, label, bold, stylename, "", "")); + print(getHyperLink(link, where, label, strong, stylename, "", "")); } /** @@ -125,12 +125,12 @@ public abstract class HtmlDocWriter extends HtmlWriter { * @param where Position of the link in the file. Character '#' is not * needed. * @param label Tag for the link. - * @param bold Boolean that sets label to bold. + * @param strong Boolean that sets label to strong. * @return String Hyper Link. */ public String getHyperLink(String link, String where, - String label, boolean bold) { - return getHyperLink(link, where, label, bold, "", "", ""); + String label, boolean strong) { + return getHyperLink(link, where, label, strong, "", "", ""); } /** @@ -140,14 +140,14 @@ public abstract class HtmlDocWriter extends HtmlWriter { * @param where Position of the link in the file. Character '#' is not * needed. * @param label Tag for the link. - * @param bold Boolean that sets label to bold. + * @param strong Boolean that sets label to strong. * @param stylename String style of text defined in style sheet. * @return String Hyper Link. */ public String getHyperLink(String link, String where, - String label, boolean bold, + String label, boolean strong, String stylename) { - return getHyperLink(link, where, label, bold, stylename, "", ""); + return getHyperLink(link, where, label, strong, stylename, "", ""); } /** @@ -157,14 +157,14 @@ public abstract class HtmlDocWriter extends HtmlWriter { * @param where Position of the link in the file. Character '#' is not * needed. * @param label Tag for the link. - * @param bold Boolean that sets label to bold. + * @param strong Boolean that sets label to strong. * @param stylename String style of text defined in style sheet. * @param title String that describes the link's content for accessibility. * @param target Target frame. * @return String Hyper Link. */ public String getHyperLink(String link, String where, - String label, boolean bold, + String label, boolean strong, String stylename, String title, String target) { StringBuffer retlink = new StringBuffer(); retlink.append(""); } - if (bold) { - retlink.append(""); + if (strong) { + retlink.append(""); } retlink.append(label); - if (bold) { - retlink.append(""); + if (strong) { + retlink.append(""); } if (stylename != null && stylename.length() != 0) { retlink.append(""); diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java index 49c882127aa..21fb7e642b0 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java @@ -433,46 +433,46 @@ public class HtmlWriter extends PrintWriter { } /** - * Get the "<B>" string. + * Get the "<STRONG>" string. * - * @return String Return String "<B>"; + * @return String Return String "<STRONG>"; */ - public String getBold() { - return ""; + public String getStrong() { + return ""; } /** - * Get the "</B>" string. + * Get the "</STRONG>" string. * - * @return String Return String "</B>"; + * @return String Return String "</STRONG>"; */ - public String getBoldEnd() { - return ""; + public String getStrongEnd() { + return ""; } /** - * Print <B> tag. + * Print <STRONG> tag. */ - public void bold() { - print(""); + public void strong() { + print(""); } /** - * Print </B> tag. + * Print </STRONG> tag. */ - public void boldEnd() { - print(""); + public void strongEnd() { + print(""); } /** - * Print text passed, in bold format using <B> and </B> tags. + * Print text passed, in strong format using <STRONG> and </STRONG> tags. * - * @param text String to be printed in between <B> and </B> tags. + * @param text String to be printed in between <STRONG> and </STRONG> tags. */ - public void bold(String text) { - bold(); + public void strong(String text) { + strong(); print(text); - boldEnd(); + strongEnd(); } /** diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/LinkInfo.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/LinkInfo.java index 93bdc3612b6..586ddb90873 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/LinkInfo.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/LinkInfo.java @@ -69,9 +69,9 @@ public abstract class LinkInfo { public String label; /** - * True if the link should be bolded. + * True if the link should be strong. */ - public boolean isBold = false; + public boolean isStrong = false; /** * True if we should include the type in the link label. False otherwise. diff --git a/langtools/test/com/sun/javadoc/AccessAsciiArt/AccessAsciiArt.java b/langtools/test/com/sun/javadoc/AccessAsciiArt/AccessAsciiArt.java index 581325b89e6..f8a244c6e3b 100644 --- a/langtools/test/com/sun/javadoc/AccessAsciiArt/AccessAsciiArt.java +++ b/langtools/test/com/sun/javadoc/AccessAsciiArt/AccessAsciiArt.java @@ -94,7 +94,7 @@ public class AccessAsciiArt { // Test the third line of the class tree { -" \"extendedp1.subpkg.SSC", +" \"extendedp1.subpkg.SSC", TMPDEST_DIR1 + "p1" + FS + "subpkg" + FS +"SSC.html" }, }; diff --git a/langtools/test/com/sun/javadoc/AuthorDD/AuthorDD.java b/langtools/test/com/sun/javadoc/AuthorDD/AuthorDD.java index 1a114ee6eb9..7dc7961e467 100644 --- a/langtools/test/com/sun/javadoc/AuthorDD/AuthorDD.java +++ b/langtools/test/com/sun/javadoc/AuthorDD/AuthorDD.java @@ -86,12 +86,12 @@ public class AuthorDD // Test single @since tag: - { "
      Since:
      "+NL+"
      JDK 1.0
      ", + { "
      Since:
      "+NL+"
      JDK 1.0
      ", BUGID + FS + "p1" + FS + "C1.html" }, // Test multiple @author tags: - { "
      Author:
      "+NL+"
      Doug Kramer, Jamie, Neal
      "+NL, + { "
      Author:
      "+NL+"
      Doug Kramer, Jamie, Neal
      "+NL, BUGID + FS + "p1" + FS + "C1.html" }, }; diff --git a/langtools/test/com/sun/javadoc/testClassCrossReferences/TestClassCrossReferences.java b/langtools/test/com/sun/javadoc/testClassCrossReferences/TestClassCrossReferences.java index 960d368f1c3..ced91ed79c1 100644 --- a/langtools/test/com/sun/javadoc/testClassCrossReferences/TestClassCrossReferences.java +++ b/langtools/test/com/sun/javadoc/testClassCrossReferences/TestClassCrossReferences.java @@ -48,7 +48,7 @@ public class TestClassCrossReferences extends JavadocTester { "
      Link to external member gcd"}, {BUG_ID + FS + "C.html", - "Overrides:
      toString in class java.lang.Object"} + "Overrides:
      toString in class java.lang.Object"} }; private static final String[][] NEGATED_TEST = NO_TEST; private static final String[] ARGS = diff --git a/langtools/test/com/sun/javadoc/testClassTree/TestClassTree.java b/langtools/test/com/sun/javadoc/testClassTree/TestClassTree.java index f9c5a9fa6b5..543d2f096c7 100644 --- a/langtools/test/com/sun/javadoc/testClassTree/TestClassTree.java +++ b/langtools/test/com/sun/javadoc/testClassTree/TestClassTree.java @@ -49,12 +49,12 @@ public class TestClassTree extends JavadocTester { private static final String[][] TEST = { {BUG_ID + FS + "pkg" + FS + "package-tree.html", "
    • pkg.ParentClass
        "}, + "title=\"class in pkg\">ParentClass
          "}, {BUG_ID + FS + "pkg" + FS + "package-tree.html", "Annotation Type Hierarchy" + NL + "" + NL + "
            " + NL + "
          • pkg.AnnotationType " + + "title=\"annotation in pkg\">AnnotationType " + "(implements java.lang.annotation.Annotation)" + NL + "
          "}, {BUG_ID + FS + "pkg" + FS + "package-tree.html", @@ -65,7 +65,7 @@ public class TestClassTree extends JavadocTester { "
        • java.lang.Object
            " + NL + "
          • java.lang.Enum<E> (implements java.lang.Comparable<T>, java.io.Serializable)" + NL + "
              " + NL + - "
            • pkg.Coin
            " + NL + + "
          • pkg.Coin
          " + NL + "
        " + NL + "
      " }, @@ -73,7 +73,7 @@ public class TestClassTree extends JavadocTester { private static final String[][] NEGATED_TEST = { {BUG_ID + FS + "pkg" + FS + "package-tree.html", "
    • class pkg.ParentClass
        "} + "title=\"class in pkg\">ParentClass
          "} }; /** diff --git a/langtools/test/com/sun/javadoc/testConstructorIndent/TestConstructorIndent.java b/langtools/test/com/sun/javadoc/testConstructorIndent/TestConstructorIndent.java index b75254db154..cd892a4e31d 100644 --- a/langtools/test/com/sun/javadoc/testConstructorIndent/TestConstructorIndent.java +++ b/langtools/test/com/sun/javadoc/testConstructorIndent/TestConstructorIndent.java @@ -46,7 +46,7 @@ public class TestConstructorIndent extends JavadocTester { //Input for string search tests. private static final String[][] TEST = { {BUG_ID + FS + "C.html", "
          "+NL+"
          This is just a simple constructor."+ NL + - "

          "+NL+"

          "+NL+"
          Parameters:
          i - a param.
          "+NL + + "

          "+NL+"

          "+NL+"
          Parameters:
          i - a param.
          "+NL + "
          " } }; diff --git a/langtools/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java b/langtools/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java index 32499390c75..ab11813e95e 100644 --- a/langtools/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java +++ b/langtools/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java @@ -76,25 +76,25 @@ public class TestDeprecatedDocs extends JavadocTester { {TARGET_FILE, "pkg.DeprecatedClassByAnnotation.method()"}, {TARGET_FILE, "pkg.DeprecatedClassByAnnotation.field"}, - {TARGET_FILE2, "Deprecated." + NL + + {TARGET_FILE2, "Deprecated." + NL + "

          " + NL + "

          " + NL + "
          @Deprecated" + NL +
          -            "public class DeprecatedClassByAnnotation"},
          +            "public class DeprecatedClassByAnnotation"},
           
          -        {TARGET_FILE2, "public int field
          " + NL + + {TARGET_FILE2, "public int field" + NL + "
          " + NL + - "
          Deprecated. 
          "}, + "
          Deprecated. 
          "}, {TARGET_FILE2, "@Deprecated" + NL + - "public DeprecatedClassByAnnotation()" + NL + + "public DeprecatedClassByAnnotation()" + NL + "
          " + NL + - "
          Deprecated."}, + "
          Deprecated."}, {TARGET_FILE2, "@Deprecated" + NL + - "public void method()" + NL + + "public void method()" + NL + "
          " + NL + - "
          Deprecated."}, + "
          Deprecated."}, }; private static final String[][] NEGATED_TEST = NO_TEST; diff --git a/langtools/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java b/langtools/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java index 9f73b26a4da..4308ccfe27f 100644 --- a/langtools/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java +++ b/langtools/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java @@ -39,13 +39,13 @@ public class TestExternalOverridenMethod extends JavadocTester { private static final String BUG_ID = "4857717"; private static final String[][] TEST = { {BUG_ID + FS + "pkg" + FS + "XReader.html", - "Overrides:
          Overrides:
          read in class " + "FilterReader"}, {BUG_ID + FS + "pkg" + FS + "XReader.html", - "Specified by:
          Specified by:
          readInt in interface " + "" + NL + - "Class Summary" + "Class Summary" }, // Class documentation {BUG_ID + FS + "pkg1" + FS + "C1.html", "" + NL + - "Field Summary" + "Field Summary" }, {BUG_ID + FS + "pkg1" + FS + "C1.html", - "Methods inherited from class " + "java.lang.Object" + "Methods inherited from class " + "java.lang.Object" }, // Class use documentation @@ -76,7 +76,7 @@ public class TestHeadings extends JavadocTester { // Deprecated {BUG_ID + FS + "deprecated-list.html", "" + NL + - "Deprecated Methods" + "Deprecated Methods" }, // Constant values @@ -90,20 +90,20 @@ public class TestHeadings extends JavadocTester { // Serialized Form {BUG_ID + FS + "serialized-form.html", "" + NL + - "Package pkg1" + "Package pkg1" }, {BUG_ID + FS + "serialized-form.html", "" + NL + - "Class pkg1.C1 extends java.lang.Object " + "implements Serializable" + "Class pkg1.C1 extends java.lang.Object " + "implements Serializable" }, {BUG_ID + FS + "serialized-form.html", "" + NL + - "Serialized Fields" + "Serialized Fields" }, // Overview Frame {BUG_ID + FS + "overview-frame.html", - "" + NL + "Test Files" + "" + NL + "Test Files" }, {BUG_ID + FS + "overview-frame.html", "" + NL + diff --git a/langtools/test/com/sun/javadoc/testHelpOption/TestHelpOption.java b/langtools/test/com/sun/javadoc/testHelpOption/TestHelpOption.java index 18dab3d0ffc..e9e3e6b9d63 100644 --- a/langtools/test/com/sun/javadoc/testHelpOption/TestHelpOption.java +++ b/langtools/test/com/sun/javadoc/testHelpOption/TestHelpOption.java @@ -91,7 +91,8 @@ public class TestHelpOption extends JavadocTester { private static final String[][] TEST2 = { {BUG_ID + FS + "TestHelpOption.html", - "<A HREF=\"help-doc.html\"><FONT CLASS=\"NavBarFont1\">" + "<B>Help</B></FONT></A>" + "<A HREF=\"help-doc.html\"><FONT CLASS=\"NavBarFont1\">" + + "<STRONG>Help</STRONG></FONT></A>" }, }; private static final String[][] NEGATED_TEST2 = NO_TEST; diff --git a/langtools/test/com/sun/javadoc/testHref/TestHref.java b/langtools/test/com/sun/javadoc/testHref/TestHref.java index 0b901830ab3..609c66d89bd 100644 --- a/langtools/test/com/sun/javadoc/testHref/TestHref.java +++ b/langtools/test/com/sun/javadoc/testHref/TestHref.java @@ -67,7 +67,7 @@ public class TestHref extends JavadocTester { }, //@see test. {BUG_ID + FS + "pkg" + FS + "C2.html", - "See Also:</B><DD><A HREF=\"../pkg/C1.html#method(int, int, java.util.ArrayList)\">" + "See Also:</STRONG><DD><A HREF=\"../pkg/C1.html#method(int, int, java.util.ArrayList)\">" }, //Header does not link to the page itself. @@ -77,7 +77,7 @@ public class TestHref extends JavadocTester { //Signature does not link to the page itself. {BUG_ID + FS + "pkg" + FS + "C4.html", - "public abstract class <B>C4<E extends C4<E>></B>" + "public abstract class <STRONG>C4<E extends C4<E>></STRONG>" }, }; private static final String[][] NEGATED_TEST = diff --git a/langtools/test/com/sun/javadoc/testHtmlStrongTag/TestHtmlStrongTag.java b/langtools/test/com/sun/javadoc/testHtmlStrongTag/TestHtmlStrongTag.java new file mode 100644 index 00000000000..3bb26e83992 --- /dev/null +++ b/langtools/test/com/sun/javadoc/testHtmlStrongTag/TestHtmlStrongTag.java @@ -0,0 +1,82 @@ +/* + * Copyright 1999-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. + */ + +/* + * @test + * @bug 6786028 + * @summary This test verifys the use of <strong> HTML tag instead of <B> by Javadoc std doclet. + * @author Bhavesh Patel + * @library ../lib/ + * @build JavadocTester + * @build TestHtmlStrongTag + * @run main TestHtmlStrongTag + */ + +public class TestHtmlStrongTag extends JavadocTester { + + private static final String BUG_ID = "6786028"; + private static final String[][] TEST1 = { + {BUG_ID + FS + "pkg1" + FS + "C1.html", "<STRONG>Method Summary</STRONG>"}, + {BUG_ID + FS + "pkg1" + FS + "C1.html", "<STRONG>See Also:</STRONG>"}, + {BUG_ID + FS + "pkg1" + FS + "package-summary.html", "<STRONG>Class Summary</STRONG>"}}; + private static final String[][] NEGATED_TEST1 = { + {BUG_ID + FS + "pkg1" + FS + "C1.html", "<B>"}}; + private static final String[][] TEST2 = { + {BUG_ID + FS + "pkg2" + FS + "C2.html", "<STRONG>Method Summary</STRONG>"}, + {BUG_ID + FS + "pkg2" + FS + "C2.html", "<B>Comments:</B>"}, + {BUG_ID + FS + "pkg1" + FS + "package-summary.html", "<STRONG>Class Summary</STRONG>"}}; + + private static final String[] ARGS1 = + new String[] { + "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1"}; + private static final String[] ARGS2 = + new String[] { + "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg2"}; + + /** + * The entry point of the test. + * @param args the array of command line arguments. + */ + public static void main(String[] args) { + TestHtmlStrongTag tester = new TestHtmlStrongTag(); + run(tester, ARGS1, TEST1, NEGATED_TEST1); + run(tester, ARGS2, TEST2, NO_TEST); + tester.printSummary(); + } + + /** + * {@inheritDoc} + */ + public String getBugId() { + return BUG_ID; + } + + /** + * {@inheritDoc} + */ + public String getBugName() { + return getClass().getName(); + } +} diff --git a/langtools/test/com/sun/javadoc/testHtmlStrongTag/pkg1/C1.java b/langtools/test/com/sun/javadoc/testHtmlStrongTag/pkg1/C1.java new file mode 100644 index 00000000000..411f42b7709 --- /dev/null +++ b/langtools/test/com/sun/javadoc/testHtmlStrongTag/pkg1/C1.java @@ -0,0 +1,36 @@ +/* + * Copyright 1999-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 pkg1; + +/** + * @see java.lang.Object#wait(long, int) + */ +public class C1 { + + public void method(int param1, int param2) { + + } +} diff --git a/langtools/test/com/sun/javadoc/testHtmlStrongTag/pkg2/C2.java b/langtools/test/com/sun/javadoc/testHtmlStrongTag/pkg2/C2.java new file mode 100644 index 00000000000..ffdda94b073 --- /dev/null +++ b/langtools/test/com/sun/javadoc/testHtmlStrongTag/pkg2/C2.java @@ -0,0 +1,31 @@ +/* + * Copyright 1999-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 pkg2; + +/** + * <B>Comments:</B> Class 2 + */ +public class C2 {} diff --git a/langtools/test/com/sun/javadoc/testIndex/TestIndex.java b/langtools/test/com/sun/javadoc/testIndex/TestIndex.java index 9bf93d64bf0..0594d3d9371 100644 --- a/langtools/test/com/sun/javadoc/testIndex/TestIndex.java +++ b/langtools/test/com/sun/javadoc/testIndex/TestIndex.java @@ -54,27 +54,27 @@ public class TestIndex extends JavadocTester { //Test index-all.html {BUG_ID + FS + "index-all.html", - "<A HREF=\"./pkg/C.html\" title=\"class in pkg\"><B>C</B></A>" + + "<A HREF=\"./pkg/C.html\" title=\"class in pkg\"><STRONG>C</STRONG></A>" + " - Class in <A HREF=\"./pkg/package-summary.html\">pkg</A>"}, {BUG_ID + FS + "index-all.html", "<A HREF=\"./pkg/Interface.html\" title=\"interface in pkg\">" + - "<B>Interface</B></A> - Interface in " + + "<STRONG>Interface</STRONG></A> - Interface in " + "<A HREF=\"./pkg/package-summary.html\">pkg</A>"}, {BUG_ID + FS + "index-all.html", "<A HREF=\"./pkg/AnnotationType.html\" title=\"annotation in pkg\">" + - "<B>AnnotationType</B></A> - Annotation Type in " + + "<STRONG>AnnotationType</STRONG></A> - Annotation Type in " + "<A HREF=\"./pkg/package-summary.html\">pkg</A>"}, {BUG_ID + FS + "index-all.html", "<A HREF=\"./pkg/Coin.html\" title=\"enum in pkg\">" + - "<B>Coin</B></A> - Enum in " + + "<STRONG>Coin</STRONG></A> - Enum in " + "<A HREF=\"./pkg/package-summary.html\">pkg</A>"}, {BUG_ID + FS + "index-all.html", "Class in <A HREF=\"./package-summary.html\"><Unnamed></A>"}, {BUG_ID + FS + "index-all.html", - "<DT><A HREF=\"./pkg/C.html#Java\"><B>Java</B></A> - " + NL + + "<DT><A HREF=\"./pkg/C.html#Java\"><STRONG>Java</STRONG></A> - " + NL + "Static variable in class pkg.<A HREF=\"./pkg/C.html\" title=\"class in pkg\">C</A>" + NL + "<DD> " + NL + - "<DT><A HREF=\"./pkg/C.html#JDK\"><B>JDK</B></A> - " + NL + + "<DT><A HREF=\"./pkg/C.html#JDK\"><STRONG>JDK</STRONG></A> - " + NL + "Static variable in class pkg.<A HREF=\"./pkg/C.html\" title=\"class in pkg\">C</A>" + NL + "<DD> "}, }; diff --git a/langtools/test/com/sun/javadoc/testInterface/TestInterface.java b/langtools/test/com/sun/javadoc/testInterface/TestInterface.java index 3a3ae3ea62d..0dd3ebb9003 100644 --- a/langtools/test/com/sun/javadoc/testInterface/TestInterface.java +++ b/langtools/test/com/sun/javadoc/testInterface/TestInterface.java @@ -48,14 +48,14 @@ public class TestInterface extends JavadocTester { //Input for string search tests. private static final String[][] TEST = { {BUG_ID + FS + "pkg" + FS + "Interface.html", - "int <B>method</B>()"}, + "int <STRONG>method</STRONG>()"}, {BUG_ID + FS + "pkg" + FS + "Interface.html", - "static final int <B>field</B>"}, + "static final int <STRONG>field</STRONG>"}, // Make sure known implementing class list is correct and omits type parameters. {BUG_ID + FS + "pkg" + FS + "Interface.html", - "<DT><B>All Known Implementing Classes:</B> " + + "<DT><STRONG>All Known Implementing Classes:</STRONG> " + "<DD><A HREF=\"../pkg/Child.html\" " + "title=\"class in pkg\">Child</A>, " + "<A HREF=\"../pkg/Parent.html\" title=\"class in pkg\">" + @@ -63,34 +63,34 @@ public class TestInterface extends JavadocTester { // Make sure "All Implemented Interfaces": has substituted type parameters {BUG_ID + FS + "pkg" + FS + "Child.html", - "<B>All Implemented Interfaces:</B> <DD><A HREF=\"../pkg/Interface.html\" title=\"interface in pkg\">Interface</A><T>" + "<STRONG>All Implemented Interfaces:</STRONG> <DD><A HREF=\"../pkg/Interface.html\" title=\"interface in pkg\">Interface</A><T>" }, //Make sure Class Tree has substituted type parameters. {BUG_ID + FS + "pkg" + FS + "Child.html", "<PRE>" + NL + "java.lang.Object" + NL + " <IMG SRC=\"../resources/inherit.gif\" ALT=\"extended by \"><A HREF=\"../pkg/Parent.html\" title=\"class in pkg\">pkg.Parent</A><T>" + NL + - " <IMG SRC=\"../resources/inherit.gif\" ALT=\"extended by \"><B>pkg.Child<T></B>" + NL + + " <IMG SRC=\"../resources/inherit.gif\" ALT=\"extended by \"><STRONG>pkg.Child<T></STRONG>" + NL + "</PRE>" }, //Make sure "Direct Know Subclasses" omits type parameters {BUG_ID + FS + "pkg" + FS + "Parent.html", - "<B>Direct Known Subclasses:</B> <DD><A HREF=\"../pkg/Child.html\" title=\"class in pkg\">Child</A>" + "<STRONG>Direct Known Subclasses:</STRONG> <DD><A HREF=\"../pkg/Child.html\" title=\"class in pkg\">Child</A>" }, //Make sure "Specified By" has substituted type parameters. {BUG_ID + FS + "pkg" + FS + "Child.html", - "<B>Specified by:</B><DD><CODE><A HREF=\"../pkg/Interface.html#method()\">method</A></CODE> in interface <CODE><A HREF=\"../pkg/Interface.html\" title=\"interface in pkg\">Interface</A><<A HREF=\"../pkg/Child.html\" title=\"type parameter in Child\">T</A>></CODE>" + "<STRONG>Specified by:</STRONG><DD><CODE><A HREF=\"../pkg/Interface.html#method()\">method</A></CODE> in interface <CODE><A HREF=\"../pkg/Interface.html\" title=\"interface in pkg\">Interface</A><<A HREF=\"../pkg/Child.html\" title=\"type parameter in Child\">T</A>></CODE>" }, //Make sure "Overrides" has substituted type parameters. {BUG_ID + FS + "pkg" + FS + "Child.html", - "<B>Overrides:</B><DD><CODE><A HREF=\"../pkg/Parent.html#method()\">method</A></CODE> in class <CODE><A HREF=\"../pkg/Parent.html\" title=\"class in pkg\">Parent</A><<A HREF=\"../pkg/Child.html\" title=\"type parameter in Child\">T</A>></CODE>" + "<STRONG>Overrides:</STRONG><DD><CODE><A HREF=\"../pkg/Parent.html#method()\">method</A></CODE> in class <CODE><A HREF=\"../pkg/Parent.html\" title=\"class in pkg\">Parent</A><<A HREF=\"../pkg/Child.html\" title=\"type parameter in Child\">T</A>></CODE>" }, }; private static final String[][] NEGATED_TEST = { {BUG_ID + FS + "pkg" + FS + "Interface.html", - "public int <B>method</B>()"}, + "public int <STRONG>method</STRONG>()"}, {BUG_ID + FS + "pkg" + FS + "Interface.html", - "public static final int <B>field</B>"}, + "public static final int <STRONG>field</STRONG>"}, }; /** diff --git a/langtools/test/com/sun/javadoc/testJavascript/TestJavascript.java b/langtools/test/com/sun/javadoc/testJavascript/TestJavascript.java index a8377478f81..22955cc0d89 100644 --- a/langtools/test/com/sun/javadoc/testJavascript/TestJavascript.java +++ b/langtools/test/com/sun/javadoc/testJavascript/TestJavascript.java @@ -45,9 +45,9 @@ public class TestJavascript extends JavadocTester { //Input for string search tests. private static final String[][] TEST = { {BUG_ID + FS + "pkg" + FS + "C.html", - "<A HREF=\"../index.html?pkg/C.html\" target=\"_top\"><B>FRAMES</B></A>"}, + "<A HREF=\"../index.html?pkg/C.html\" target=\"_top\"><STRONG>FRAMES</STRONG></A>"}, {BUG_ID + FS + "TestJavascript.html", - "<A HREF=\"index.html?TestJavascript.html\" target=\"_top\"><B>FRAMES</B></A>"}, + "<A HREF=\"index.html?TestJavascript.html\" target=\"_top\"><STRONG>FRAMES</STRONG></A>"}, {BUG_ID + FS + "index.html", "<SCRIPT type=\"text/javascript\">" + NL + " targetPage = \"\" + window.location.search;" + NL + diff --git a/langtools/test/com/sun/javadoc/testLinkOption/TestLinkOption.java b/langtools/test/com/sun/javadoc/testLinkOption/TestLinkOption.java index adb44d26c90..1a2156ee03c 100644 --- a/langtools/test/com/sun/javadoc/testLinkOption/TestLinkOption.java +++ b/langtools/test/com/sun/javadoc/testLinkOption/TestLinkOption.java @@ -63,7 +63,7 @@ public class TestLinkOption extends JavadocTester { "title=\"class or interface in java.lang\">Object</A> p3)" }, {BUG_ID + "-1" + FS + "java" + FS + "lang" + FS + "StringBuilderChild.html", - "public abstract class <B>StringBuilderChild</B><DT>extends <A HREF=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true\" title=\"class or interface in java.lang\">Object</A>" + "public abstract class <STRONG>StringBuilderChild</STRONG><DT>extends <A HREF=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true\" title=\"class or interface in java.lang\">Object</A>" }, }; diff --git a/langtools/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java b/langtools/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java index 5795dacaaf9..1eb2c998639 100644 --- a/langtools/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java +++ b/langtools/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java @@ -59,7 +59,7 @@ public class TestLinkTaglet extends JavadocTester { " Link to another inner class: <A HREF=\"../pkg/C.InnerC2.html\" title=\"class in pkg\"><CODE>C.InnerC2</CODE></A>" }, {BUG_ID + FS + "pkg" + FS + "C.InnerC2.html", - "Enclosing class:</B><DD><A HREF=\"../pkg/C.html\" title=\"class in pkg\">C</A>" + "Enclosing class:</STRONG><DD><A HREF=\"../pkg/C.html\" title=\"class in pkg\">C</A>" }, }; private static final String[][] NEGATED_TEST = { diff --git a/langtools/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java b/langtools/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java index 7f8dfbf3f1a..15b9e343267 100644 --- a/langtools/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java +++ b/langtools/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java @@ -64,13 +64,17 @@ public class TestMemberInheritence extends JavadocTester { // New labels as of 1.5.0 {BUG_ID + FS + "pkg" + FS + "SubClass.html", - "<B>Nested classes/interfaces inherited from class pkg." + "<A HREF=\"../pkg/BaseClass.html\" title=\"class in pkg\">" + "BaseClass</A></B>"}, + "<STRONG>Nested classes/interfaces inherited from class pkg." + + "<A HREF=\"../pkg/BaseClass.html\" title=\"class in pkg\">" + + "BaseClass</A></STRONG>"}, {BUG_ID + FS + "pkg" + FS + "SubClass.html", - "<B>Nested classes/interfaces inherited from interface pkg." + "<A HREF=\"../pkg/BaseInterface.html\" title=\"interface in pkg\">" + "BaseInterface</A></B>"}, + "<STRONG>Nested classes/interfaces inherited from interface pkg." + + "<A HREF=\"../pkg/BaseInterface.html\" title=\"interface in pkg\">" + + "BaseInterface</A></STRONG>"}, // Test overriding/implementing methods with generic parameters. {BUG_ID + FS + "pkg" + FS + "BaseClass.html", - "<DT><B>Specified by:</B><DD><CODE><A HREF=\"../pkg/BaseInterface.html#getAnnotation(java.lang.Class)\">getAnnotation</A></CODE> in interface <CODE><A HREF=\"../pkg/BaseInterface.html\" title=\"interface in pkg\">BaseInterface</A></CODE></DL>"}, + "<DT><STRONG>Specified by:</STRONG><DD><CODE><A HREF=\"../pkg/BaseInterface.html#getAnnotation(java.lang.Class)\">getAnnotation</A></CODE> in interface <CODE><A HREF=\"../pkg/BaseInterface.html\" title=\"interface in pkg\">BaseInterface</A></CODE></DL>"}, // Test diamond inheritence member summary (6256068) {BUG_ID + FS + "diamond" + FS + "Z.html", diff --git a/langtools/test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java b/langtools/test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java index d270fe5e46c..fb061b145fc 100644 --- a/langtools/test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java +++ b/langtools/test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java @@ -50,14 +50,14 @@ public class TestMemberSummary extends JavadocTester { {BUG_ID + FS + "pkg" + FS + "PublicChild.html", "<CODE> <A HREF=\"../pkg/PublicChild.html\" " + "title=\"class in pkg\">PublicChild</A></CODE></FONT></TD>" + NL + - "<TD><CODE><B><A HREF=\"../pkg/PublicChild.html#" + - "returnTypeTest()\">returnTypeTest</A></B>()</CODE>" + "<TD><CODE><STRONG><A HREF=\"../pkg/PublicChild.html#" + + "returnTypeTest()\">returnTypeTest</A></STRONG>()</CODE>" }, // Check return type in member detail. {BUG_ID + FS + "pkg" + FS + "PublicChild.html", "public <A HREF=\"../pkg/PublicChild.html\" " + "title=\"class in pkg\">PublicChild</A> " + - "<B>returnTypeTest</B>()" + "<STRONG>returnTypeTest</STRONG>()" }, // Legacy anchor dimensions (6290760) diff --git a/langtools/test/com/sun/javadoc/testNavagation/TestNavagation.java b/langtools/test/com/sun/javadoc/testNavagation/TestNavagation.java index 2ab4f785c39..3b1b267fefb 100644 --- a/langtools/test/com/sun/javadoc/testNavagation/TestNavagation.java +++ b/langtools/test/com/sun/javadoc/testNavagation/TestNavagation.java @@ -47,17 +47,17 @@ public class TestNavagation extends JavadocTester { private static final String[][] TEST = { {BUG_ID + FS + "pkg" + FS + "A.html", " PREV CLASS "}, {BUG_ID + FS + "pkg" + FS + "A.html", - "<A HREF=\"../pkg/C.html\" title=\"class in pkg\"><B>NEXT CLASS</B></A>"}, + "<A HREF=\"../pkg/C.html\" title=\"class in pkg\"><STRONG>NEXT CLASS</STRONG></A>"}, {BUG_ID + FS + "pkg" + FS + "C.html", - "<A HREF=\"../pkg/A.html\" title=\"annotation in pkg\"><B>PREV CLASS</B></A>"}, + "<A HREF=\"../pkg/A.html\" title=\"annotation in pkg\"><STRONG>PREV CLASS</STRONG></A>"}, {BUG_ID + FS + "pkg" + FS + "C.html", - "<A HREF=\"../pkg/E.html\" title=\"enum in pkg\"><B>NEXT CLASS</B></A>"}, + "<A HREF=\"../pkg/E.html\" title=\"enum in pkg\"><STRONG>NEXT CLASS</STRONG></A>"}, {BUG_ID + FS + "pkg" + FS + "E.html", - "<A HREF=\"../pkg/C.html\" title=\"class in pkg\"><B>PREV CLASS</B></A>"}, + "<A HREF=\"../pkg/C.html\" title=\"class in pkg\"><STRONG>PREV CLASS</STRONG></A>"}, {BUG_ID + FS + "pkg" + FS + "E.html", - "<A HREF=\"../pkg/I.html\" title=\"interface in pkg\"><B>NEXT CLASS</B></A>"}, + "<A HREF=\"../pkg/I.html\" title=\"interface in pkg\"><STRONG>NEXT CLASS</STRONG></A>"}, {BUG_ID + FS + "pkg" + FS + "I.html", - "<A HREF=\"../pkg/E.html\" title=\"enum in pkg\"><B>PREV CLASS</B></A>"}, + "<A HREF=\"../pkg/E.html\" title=\"enum in pkg\"><STRONG>PREV CLASS</STRONG></A>"}, {BUG_ID + FS + "pkg" + FS + "I.html", " NEXT CLASS"}, // Test for 4664607 {BUG_ID + FS + "pkg" + FS + "I.html", diff --git a/langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java b/langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java index 550c0d1802c..1bc573d3950 100644 --- a/langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java +++ b/langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java @@ -54,14 +54,14 @@ public class TestNewLanguageFeatures extends JavadocTester { {BUG_ID + FS + "pkg" + FS + "Coin.html", "Enum Coin</H2>"}, //Make sure enum signature is correct. {BUG_ID + FS + "pkg" + FS + "Coin.html", "public enum "+ - "<B>Coin</B><DT>extends java.lang.Enum<" + + "<STRONG>Coin</STRONG><DT>extends java.lang.Enum<" + "<A HREF=\"../pkg/Coin.html\" title=\"enum in pkg\">Coin</A>>" }, //Check for enum constant section - {BUG_ID + FS + "pkg" + FS + "Coin.html", "<B>Enum Constant Summary</B>"}, + {BUG_ID + FS + "pkg" + FS + "Coin.html", "<STRONG>Enum Constant Summary</STRONG>"}, //Detail for enum constant {BUG_ID + FS + "pkg" + FS + "Coin.html", - "<B><A HREF=\"../pkg/Coin.html#Dime\">Dime</A></B>"}, + "<STRONG><A HREF=\"../pkg/Coin.html#Dime\">Dime</A></STRONG>"}, //Automatically insert documentation for values() and valueOf(). {BUG_ID + FS + "pkg" + FS + "Coin.html", "Returns an array containing the constants of this enum type,"}, @@ -79,11 +79,11 @@ public class TestNewLanguageFeatures extends JavadocTester { "Class TypeParameters<E></H2>"}, //Check class type parameters section. {BUG_ID + FS + "pkg" + FS + "TypeParameters.html", - "<DT><B>Type Parameters:</B><DD><CODE>E</CODE> - " + + "<DT><STRONG>Type Parameters:</STRONG><DD><CODE>E</CODE> - " + "the type parameter for this class."}, //Type parameters in @see/@link {BUG_ID + FS + "pkg" + FS + "TypeParameters.html", - "<DT><B>See Also:</B><DD><A HREF=\"../pkg/TypeParameters.html\" " + + "<DT><STRONG>See Also:</STRONG><DD><A HREF=\"../pkg/TypeParameters.html\" " + "title=\"class in pkg\"><CODE>TypeParameters</CODE></A></DL>"}, //Method that uses class type parameter. {BUG_ID + FS + "pkg" + FS + "TypeParameters.html", @@ -91,13 +91,13 @@ public class TestNewLanguageFeatures extends JavadocTester { "parameter in TypeParameters\">E</A> param)"}, //Method type parameter section. {BUG_ID + FS + "pkg" + FS + "TypeParameters.html", - "<B>Type Parameters:</B><DD><CODE>T</CODE> - This is the first " + + "<STRONG>Type Parameters:</STRONG><DD><CODE>T</CODE> - This is the first " + "type parameter.<DD><CODE>V</CODE> - This is the second type " + "parameter."}, //Signature of method with type parameters {BUG_ID + FS + "pkg" + FS + "TypeParameters.html", "public <T extends java.util.List,V> " + - "java.lang.String[] <B>methodThatHasTypeParameters</B>"}, + "java.lang.String[] <STRONG>methodThatHasTypeParameters</STRONG>"}, //Wildcard testing. {BUG_ID + FS + "pkg" + FS + "Wildcards.html", "<A HREF=\"../pkg/TypeParameters.html\" title=\"class in pkg\">" + @@ -116,18 +116,18 @@ public class TestNewLanguageFeatures extends JavadocTester { //Signature of subclass that has type parameters. {BUG_ID + FS + "pkg" + FS + "TypeParameterSubClass.html", - "public class <B>TypeParameterSubClass<T extends java.lang.String>" + - "</B><DT>extends <A HREF=\"../pkg/TypeParameterSuperClass.html\" " + + "public class <STRONG>TypeParameterSubClass<T extends java.lang.String>" + + "</STRONG><DT>extends <A HREF=\"../pkg/TypeParameterSuperClass.html\" " + "title=\"class in pkg\">TypeParameterSuperClass</A><T>"}, //Interface generic parameter substitution //Signature of subclass that has type parameters. {BUG_ID + FS + "pkg" + FS + "TypeParameters.html", - "<B>All Implemented Interfaces:</B> <DD><A HREF=\"../pkg/SubInterface.html\" title=\"interface in pkg\">SubInterface</A><E>, <A HREF=\"../pkg/SuperInterface.html\" title=\"interface in pkg\">SuperInterface</A><E></DD>"}, + "<STRONG>All Implemented Interfaces:</STRONG> <DD><A HREF=\"../pkg/SubInterface.html\" title=\"interface in pkg\">SubInterface</A><E>, <A HREF=\"../pkg/SuperInterface.html\" title=\"interface in pkg\">SuperInterface</A><E></DD>"}, {BUG_ID + FS + "pkg" + FS + "SuperInterface.html", - "<B>All Known Subinterfaces:</B> <DD><A HREF=\"../pkg/SubInterface.html\" title=\"interface in pkg\">SubInterface</A><V></DD>"}, + "<STRONG>All Known Subinterfaces:</STRONG> <DD><A HREF=\"../pkg/SubInterface.html\" title=\"interface in pkg\">SubInterface</A><V></DD>"}, {BUG_ID + FS + "pkg" + FS + "SubInterface.html", - "<B>All Superinterfaces:</B> <DD><A HREF=\"../pkg/SuperInterface.html\" title=\"interface in pkg\">SuperInterface</A><V></DD>"}, + "<STRONG>All Superinterfaces:</STRONG> <DD><A HREF=\"../pkg/SuperInterface.html\" title=\"interface in pkg\">SuperInterface</A><V></DD>"}, //================================= // VAR ARG TESTING @@ -155,18 +155,18 @@ public class TestNewLanguageFeatures extends JavadocTester { "Annotation Type AnnotationType</H2>"}, //Make sure the signature is correct. {BUG_ID + FS + "pkg" + FS + "AnnotationType.html", - "public @interface <B>AnnotationType</B>"}, + "public @interface <STRONG>AnnotationType</STRONG>"}, //Make sure member summary headings are correct. {BUG_ID + FS + "pkg" + FS + "AnnotationType.html", - "<B>Required Element Summary</B>"}, + "<STRONG>Required Element Summary</STRONG>"}, {BUG_ID + FS + "pkg" + FS + "AnnotationType.html", - "<B>Optional Element Summary</B>"}, + "<STRONG>Optional Element Summary</STRONG>"}, //Make sure element detail heading is correct {BUG_ID + FS + "pkg" + FS + "AnnotationType.html", "Element Detail"}, //Make sure default annotation type value is printed when necessary. {BUG_ID + FS + "pkg" + FS + "AnnotationType.html", - "<B>Default:</B><DD>\"unknown\"</DD>"}, + "<STRONG>Default:</STRONG><DD>\"unknown\"</DD>"}, //================================= // ANNOTATION TYPE USAGE TESTING @@ -182,40 +182,40 @@ public class TestNewLanguageFeatures extends JavadocTester { "<FONT SIZE=\"-1\">" + "<A HREF=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</A>(<A HREF=\"../pkg/AnnotationType.html#optional()\">optional</A>=\"Class Annotation\","+NL + " <A HREF=\"../pkg/AnnotationType.html#required()\">required</A>=1994)"+NL + - "</FONT>public class <B>AnnotationTypeUsage</B><DT>extends java.lang.Object</DL>"}, + "</FONT>public class <STRONG>AnnotationTypeUsage</STRONG><DT>extends java.lang.Object</DL>"}, //FIELD {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html", "<FONT SIZE=\"-1\">" + "<A HREF=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</A>(<A HREF=\"../pkg/AnnotationType.html#optional()\">optional</A>=\"Field Annotation\","+NL + " <A HREF=\"../pkg/AnnotationType.html#required()\">required</A>=1994)"+NL + - "</FONT>public int <B>field</B>"}, + "</FONT>public int <STRONG>field</STRONG>"}, //CONSTRUCTOR {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html", "<FONT SIZE=\"-1\">" + "<A HREF=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</A>(<A HREF=\"../pkg/AnnotationType.html#optional()\">optional</A>=\"Constructor Annotation\","+NL + " <A HREF=\"../pkg/AnnotationType.html#required()\">required</A>=1994)"+NL + - "</FONT>public <B>AnnotationTypeUsage</B>()"}, + "</FONT>public <STRONG>AnnotationTypeUsage</STRONG>()"}, //METHOD {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html", "<FONT SIZE=\"-1\">" + "<A HREF=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</A>(<A HREF=\"../pkg/AnnotationType.html#optional()\">optional</A>=\"Method Annotation\","+NL + " <A HREF=\"../pkg/AnnotationType.html#required()\">required</A>=1994)"+NL + - "</FONT>public void <B>method</B>()"}, + "</FONT>public void <STRONG>method</STRONG>()"}, //METHOD PARAMS {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html", "<PRE>" + NL + - "public void <B>methodWithParams</B>(<FONT SIZE=\"-1\"><A HREF=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</A>(<A HREF=\"../pkg/AnnotationType.html#optional()\">optional</A>=\"Parameter Annotation\",<A HREF=\"../pkg/AnnotationType.html#required()\">required</A>=1994)</FONT>" + NL + + "public void <STRONG>methodWithParams</STRONG>(<FONT SIZE=\"-1\"><A HREF=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</A>(<A HREF=\"../pkg/AnnotationType.html#optional()\">optional</A>=\"Parameter Annotation\",<A HREF=\"../pkg/AnnotationType.html#required()\">required</A>=1994)</FONT>" + NL + " int documented," + NL + " int undocmented)</PRE>"}, //CONSTRUCTOR PARAMS {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html", "<PRE>" + NL + - "public <B>AnnotationTypeUsage</B>(<FONT SIZE=\"-1\"><A HREF=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</A>(<A HREF=\"../pkg/AnnotationType.html#optional()\">optional</A>=\"Constructor Param Annotation\",<A HREF=\"../pkg/AnnotationType.html#required()\">required</A>=1994)</FONT>" + NL + + "public <STRONG>AnnotationTypeUsage</STRONG>(<FONT SIZE=\"-1\"><A HREF=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</A>(<A HREF=\"../pkg/AnnotationType.html#optional()\">optional</A>=\"Constructor Param Annotation\",<A HREF=\"../pkg/AnnotationType.html#required()\">required</A>=1994)</FONT>" + NL + " int documented," + NL + " int undocmented)</PRE>"}, @@ -270,7 +270,7 @@ public class TestNewLanguageFeatures extends JavadocTester { {BUG_ID + FS + "pkg1" + FS + "B.html", "<PRE><FONT SIZE=\"-1\"><A HREF=\"../pkg1/A.html\" title=\"annotation in pkg1\">@A</A>"}, {BUG_ID + FS + "pkg1" + FS + "B.html", - "</FONT>public interface <B>B</B></DL>" + NL + + "</FONT>public interface <STRONG>B</STRONG></DL>" + NL + "</PRE>"}, @@ -278,7 +278,7 @@ public class TestNewLanguageFeatures extends JavadocTester { // Handle multiple bounds. //============================================================== {BUG_ID + FS + "pkg" + FS + "MultiTypeParameters.html", - "public <T extends java.lang.Number & java.lang.Runnable> T <B>foo</B>(T t)"}, + "public <T extends java.lang.Number & java.lang.Runnable> T <STRONG>foo</STRONG>(T t)"}, //============================================================== // Test Class-Use Documenation for Type Parameters. @@ -289,13 +289,13 @@ public class TestNewLanguageFeatures extends JavadocTester { "<TH ALIGN=\"left\" COLSPAN=\"2\">Classes in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/Foo.html\" title=\"class in pkg2\">Foo</A></FONT></TH>" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html", - "<TD><CODE><B><A HREF=\"../../pkg2/ClassUseTest1.html\" title=\"class in pkg2\">ClassUseTest1<T extends Foo & Foo2></A></B></CODE>" + "<TD><CODE><STRONG><A HREF=\"../../pkg2/ClassUseTest1.html\" title=\"class in pkg2\">ClassUseTest1<T extends Foo & Foo2></A></STRONG></CODE>" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html", "<TH ALIGN=\"left\" COLSPAN=\"2\">Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/Foo.html\" title=\"class in pkg2\">Foo</A></FONT></TH>" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html", - "<TD><CODE><B>ClassUseTest1.</B><B><A HREF=\"../../pkg2/ClassUseTest1.html#method(T)\">method</A></B>(T t)</CODE>" + "<TD><CODE><STRONG>ClassUseTest1.</STRONG><STRONG><A HREF=\"../../pkg2/ClassUseTest1.html#method(T)\">method</A></STRONG>(T t)</CODE>" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html", "<TH ALIGN=\"left\" COLSPAN=\"2\">Fields in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/Foo.html\" title=\"class in pkg2\">Foo</A></FONT></TH>" @@ -315,13 +315,13 @@ public class TestNewLanguageFeatures extends JavadocTester { "<TH ALIGN=\"left\" COLSPAN=\"2\">Classes in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/Foo2.html\" title=\"interface in pkg2\">Foo2</A></FONT></TH>" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo2.html", - "<TD><CODE><B><A HREF=\"../../pkg2/ClassUseTest1.html\" title=\"class in pkg2\">ClassUseTest1<T extends Foo & Foo2></A></B></CODE>" + "<TD><CODE><STRONG><A HREF=\"../../pkg2/ClassUseTest1.html\" title=\"class in pkg2\">ClassUseTest1<T extends Foo & Foo2></A></STRONG></CODE>" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo2.html", "<TH ALIGN=\"left\" COLSPAN=\"2\">Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/Foo2.html\" title=\"interface in pkg2\">Foo2</A></FONT></TH>" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo2.html", - "<TD><CODE><B>ClassUseTest1.</B><B><A HREF=\"../../pkg2/ClassUseTest1.html#method(T)\">method</A></B>(T t)</CODE>" + "<TD><CODE><STRONG>ClassUseTest1.</STRONG><STRONG><A HREF=\"../../pkg2/ClassUseTest1.html#method(T)\">method</A></STRONG>(T t)</CODE>" }, //ClassUseTest2: <T extends ParamTest<Foo3>> @@ -329,13 +329,13 @@ public class TestNewLanguageFeatures extends JavadocTester { "<TH ALIGN=\"left\" COLSPAN=\"2\">Classes in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest</A></FONT></TH>" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html", - "<TD><CODE><B><A HREF=\"../../pkg2/ClassUseTest2.html\" title=\"class in pkg2\">ClassUseTest2<T extends ParamTest<<A HREF=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">Foo3</A>>></A></B></CODE>" + "<TD><CODE><STRONG><A HREF=\"../../pkg2/ClassUseTest2.html\" title=\"class in pkg2\">ClassUseTest2<T extends ParamTest<<A HREF=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">Foo3</A>>></A></STRONG></CODE>" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html", "<TH ALIGN=\"left\" COLSPAN=\"2\">Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest</A></FONT></TH>" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html", - "<TD><CODE><B>ClassUseTest2.</B><B><A HREF=\"../../pkg2/ClassUseTest2.html#method(T)\">method</A></B>(T t)</CODE>" + "<TD><CODE><STRONG>ClassUseTest2.</STRONG><STRONG><A HREF=\"../../pkg2/ClassUseTest2.html#method(T)\">method</A></STRONG>(T t)</CODE>" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html", "<TH ALIGN=\"left\" COLSPAN=\"2\">Fields in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> declared as <A HREF=\"../../pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest</A></FONT></TH>" @@ -354,13 +354,13 @@ public class TestNewLanguageFeatures extends JavadocTester { "<TH ALIGN=\"left\" COLSPAN=\"2\">Classes in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">Foo3</A></FONT></TH>" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html", - "<TD><CODE><B><A HREF=\"../../pkg2/ClassUseTest2.html\" title=\"class in pkg2\">ClassUseTest2<T extends ParamTest<<A HREF=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">Foo3</A>>></A></B></CODE>" + "<TD><CODE><STRONG><A HREF=\"../../pkg2/ClassUseTest2.html\" title=\"class in pkg2\">ClassUseTest2<T extends ParamTest<<A HREF=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">Foo3</A>>></A></STRONG></CODE>" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html", "<TH ALIGN=\"left\" COLSPAN=\"2\">Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">Foo3</A></FONT></TH>" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html", - "<TD><CODE><B>ClassUseTest2.</B><B><A HREF=\"../../pkg2/ClassUseTest2.html#method(T)\">method</A></B>(T t)</CODE>" + "<TD><CODE><STRONG>ClassUseTest2.</STRONG><STRONG><A HREF=\"../../pkg2/ClassUseTest2.html#method(T)\">method</A></STRONG>(T t)</CODE>" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html", "<TH ALIGN=\"left\" COLSPAN=\"2\">Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> that return types with arguments of type <A HREF=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">Foo3</A></FONT></TH>" @@ -374,13 +374,13 @@ public class TestNewLanguageFeatures extends JavadocTester { "<TH ALIGN=\"left\" COLSPAN=\"2\">Classes in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/ParamTest2.html\" title=\"class in pkg2\">ParamTest2</A></FONT></TH>" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html", - "<TD><CODE><B><A HREF=\"../../pkg2/ClassUseTest3.html\" title=\"class in pkg2\">ClassUseTest3<T extends ParamTest2<java.util.List<? extends Foo4>>></A></B></CODE>" + "<TD><CODE><STRONG><A HREF=\"../../pkg2/ClassUseTest3.html\" title=\"class in pkg2\">ClassUseTest3<T extends ParamTest2<java.util.List<? extends Foo4>>></A></STRONG></CODE>" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html", "<TH ALIGN=\"left\" COLSPAN=\"2\">Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/ParamTest2.html\" title=\"class in pkg2\">ParamTest2</A></FONT></TH>" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html", - "<TD><CODE><B>ClassUseTest3.</B><B><A HREF=\"../../pkg2/ClassUseTest3.html#method(T)\">method</A></B>(T t)</CODE>" + "<TD><CODE><STRONG>ClassUseTest3.</STRONG><STRONG><A HREF=\"../../pkg2/ClassUseTest3.html#method(T)\">method</A></STRONG>(T t)</CODE>" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html", "<TH ALIGN=\"left\" COLSPAN=\"2\">Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/ParamTest2.html\" title=\"class in pkg2\">ParamTest2</A></FONT></TH>" @@ -393,13 +393,13 @@ public class TestNewLanguageFeatures extends JavadocTester { "<TH ALIGN=\"left\" COLSPAN=\"2\">Classes in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</A></FONT></TH>" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html", - "<TD><CODE><B><A HREF=\"../../pkg2/ClassUseTest3.html\" title=\"class in pkg2\">ClassUseTest3<T extends ParamTest2<java.util.List<? extends Foo4>>></A></B></CODE>" + "<TD><CODE><STRONG><A HREF=\"../../pkg2/ClassUseTest3.html\" title=\"class in pkg2\">ClassUseTest3<T extends ParamTest2<java.util.List<? extends Foo4>>></A></STRONG></CODE>" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html", "<TH ALIGN=\"left\" COLSPAN=\"2\">Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type parameters of type <A HREF=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</A></FONT></TH>" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html", - "<TD><CODE><B>ClassUseTest3.</B><B><A HREF=\"../../pkg2/ClassUseTest3.html#method(T)\">method</A></B>(T t)</CODE>" + "<TD><CODE><STRONG>ClassUseTest3.</STRONG><STRONG><A HREF=\"../../pkg2/ClassUseTest3.html#method(T)\">method</A></STRONG>(T t)</CODE>" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html", "<TH ALIGN=\"left\" COLSPAN=\"2\">Methods in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> that return types with arguments of type <A HREF=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</A></FONT></TH>" @@ -415,13 +415,13 @@ public class TestNewLanguageFeatures extends JavadocTester { "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL + "<TD ALIGN=\"right\" VALIGN=\"top\" WIDTH=\"1%\"><FONT SIZE=\"-1\">" + NL + "<CODE> void</CODE></FONT></TD>" + NL + - "<TD><CODE><B>ClassUseTest3.</B><B><A HREF=\"../../pkg2/ClassUseTest3.html#method(java.util.Set)\">method</A></B>(java.util.Set<<A HREF=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</A>> p)</CODE>" + "<TD><CODE><STRONG>ClassUseTest3.</STRONG><STRONG><A HREF=\"../../pkg2/ClassUseTest3.html#method(java.util.Set)\">method</A></STRONG>(java.util.Set<<A HREF=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</A>> p)</CODE>" }, {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html", "<TH ALIGN=\"left\" COLSPAN=\"2\">Constructor parameters in <A HREF=\"../../pkg2/package-summary.html\">pkg2</A> with type arguments of type <A HREF=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</A></FONT></TH>" + NL + "</TR>" + NL + "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL + - "<TD><CODE><B><A HREF=\"../../pkg2/ClassUseTest3.html#ClassUseTest3(java.util.Set)\">ClassUseTest3</A></B>(java.util.Set<<A HREF=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</A>> p)</CODE>" + "<TD><CODE><STRONG><A HREF=\"../../pkg2/ClassUseTest3.html#ClassUseTest3(java.util.Set)\">ClassUseTest3</A></STRONG>(java.util.Set<<A HREF=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</A>> p)</CODE>" }, //================================= @@ -432,7 +432,7 @@ public class TestNewLanguageFeatures extends JavadocTester { "Packages with annotations of type <A HREF=\"../../pkg/AnnotationType.html\" title=\"annotation in pkg\">AnnotationType</A></FONT></TH>" + NL + "</TR>" + NL + "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL + - "<TD><A HREF=\"../../pkg/package-summary.html\"><B>pkg</B></A></TD>" + "<TD><A HREF=\"../../pkg/package-summary.html\"><STRONG>pkg</STRONG></A></TD>" }, {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "AnnotationType.html", @@ -441,7 +441,7 @@ public class TestNewLanguageFeatures extends JavadocTester { "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL + "<TD ALIGN=\"right\" VALIGN=\"top\" WIDTH=\"1%\"><FONT SIZE=\"-1\">" + NL + "<CODE> class</CODE></FONT></TD>" + NL + - "<TD><CODE><B><A HREF=\"../../pkg/AnnotationTypeUsage.html\" title=\"class in pkg\">AnnotationTypeUsage</A></B></CODE>" + "<TD><CODE><STRONG><A HREF=\"../../pkg/AnnotationTypeUsage.html\" title=\"class in pkg\">AnnotationTypeUsage</A></STRONG></CODE>" }, {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "AnnotationType.html", @@ -450,7 +450,7 @@ public class TestNewLanguageFeatures extends JavadocTester { "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL + "<TD ALIGN=\"right\" VALIGN=\"top\" WIDTH=\"1%\"><FONT SIZE=\"-1\">" + NL + "<CODE> int</CODE></FONT></TD>" + NL + - "<TD><CODE><B>AnnotationTypeUsage.</B><B><A HREF=\"../../pkg/AnnotationTypeUsage.html#field\">field</A></B></CODE>" + "<TD><CODE><STRONG>AnnotationTypeUsage.</STRONG><STRONG><A HREF=\"../../pkg/AnnotationTypeUsage.html#field\">field</A></STRONG></CODE>" }, {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "AnnotationType.html", @@ -459,7 +459,7 @@ public class TestNewLanguageFeatures extends JavadocTester { "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL + "<TD ALIGN=\"right\" VALIGN=\"top\" WIDTH=\"1%\"><FONT SIZE=\"-1\">" + NL + "<CODE> void</CODE></FONT></TD>" + NL + - "<TD><CODE><B>AnnotationTypeUsage.</B><B><A HREF=\"../../pkg/AnnotationTypeUsage.html#method()\">method</A></B>()</CODE>" + "<TD><CODE><STRONG>AnnotationTypeUsage.</STRONG><STRONG><A HREF=\"../../pkg/AnnotationTypeUsage.html#method()\">method</A></STRONG>()</CODE>" }, {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "AnnotationType.html", @@ -468,7 +468,7 @@ public class TestNewLanguageFeatures extends JavadocTester { "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL + "<TD ALIGN=\"right\" VALIGN=\"top\" WIDTH=\"1%\"><FONT SIZE=\"-1\">" + NL + "<CODE> void</CODE></FONT></TD>" + NL + - "<TD><CODE><B>AnnotationTypeUsage.</B><B><A HREF=\"../../pkg/AnnotationTypeUsage.html#methodWithParams(int, int)\">methodWithParams</A></B>(int documented," + NL + + "<TD><CODE><STRONG>AnnotationTypeUsage.</STRONG><STRONG><A HREF=\"../../pkg/AnnotationTypeUsage.html#methodWithParams(int, int)\">methodWithParams</A></STRONG>(int documented," + NL + " int undocmented)</CODE>" }, @@ -476,14 +476,14 @@ public class TestNewLanguageFeatures extends JavadocTester { "Constructors in <A HREF=\"../../pkg/package-summary.html\">pkg</A> with annotations of type <A HREF=\"../../pkg/AnnotationType.html\" title=\"annotation in pkg\">AnnotationType</A></FONT></TH>" + NL + "</TR>" + NL + "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL + - "<TD><CODE><B><A HREF=\"../../pkg/AnnotationTypeUsage.html#AnnotationTypeUsage()\">AnnotationTypeUsage</A></B>()</CODE>" + "<TD><CODE><STRONG><A HREF=\"../../pkg/AnnotationTypeUsage.html#AnnotationTypeUsage()\">AnnotationTypeUsage</A></STRONG>()</CODE>" }, {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "AnnotationType.html", "Constructor parameters in <A HREF=\"../../pkg/package-summary.html\">pkg</A> with annotations of type <A HREF=\"../../pkg/AnnotationType.html\" title=\"annotation in pkg\">AnnotationType</A></FONT></TH>" + NL + "</TR>" + NL + "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">" + NL + - "<TD><CODE><B><A HREF=\"../../pkg/AnnotationTypeUsage.html#AnnotationTypeUsage(int, int)\">AnnotationTypeUsage</A></B>(int documented," + NL + + "<TD><CODE><STRONG><A HREF=\"../../pkg/AnnotationTypeUsage.html#AnnotationTypeUsage(int, int)\">AnnotationTypeUsage</A></STRONG>(int documented," + NL + " int undocmented)</CODE>" }, @@ -491,13 +491,13 @@ public class TestNewLanguageFeatures extends JavadocTester { // TYPE PARAMETER IN INDEX //================================= {BUG_ID + FS + "index-all.html", - "<A HREF=\"./pkg2/Foo.html#method(java.util.Vector)\"><B>method(Vector<Object>)</B></A>" + "<A HREF=\"./pkg2/Foo.html#method(java.util.Vector)\"><STRONG>method(Vector<Object>)</STRONG></A>" }, //================================= // TYPE PARAMETER IN INDEX //================================= {BUG_ID + FS + "index-all.html", - "<A HREF=\"./pkg2/Foo.html#method(java.util.Vector)\"><B>method(Vector<Object>)</B></A>" + "<A HREF=\"./pkg2/Foo.html#method(java.util.Vector)\"><STRONG>method(Vector<Object>)</STRONG></A>" }, }; private static final String[][] NEGATED_TEST = { @@ -505,7 +505,7 @@ public class TestNewLanguageFeatures extends JavadocTester { // ENUM TESTING //================================= //NO constructor section - {BUG_ID + FS + "pkg" + FS + "Coin.html", "<B>Constructor Summary</B>"}, + {BUG_ID + FS + "pkg" + FS + "Coin.html", "<STRONG>Constructor Summary</STRONG>"}, //================================= // TYPE PARAMETER TESTING //================================= @@ -525,28 +525,28 @@ public class TestNewLanguageFeatures extends JavadocTester { "<FONT SIZE=\"-1\">" + NL + "<A HREF=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</A>(<A HREF=\"../pkg/AnnotationType.html#optional\">optional</A>=\"Class Annotation\"," + NL + " <A HREF=\"../pkg/AnnotationType.html#required\">required</A>=1994)" + NL + - "</FONT>public class <B>AnnotationTypeUsage</B><DT>extends java.lang.Object</DL>"}, + "</FONT>public class <STRONG>AnnotationTypeUsage</STRONG><DT>extends java.lang.Object</DL>"}, //FIELD {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html", "<FONT SIZE=\"-1\">" + NL + "<A HREF=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</A>(<A HREF=\"../pkg/AnnotationType.html#optional\">optional</A>=\"Field Annotation\"," + NL + " <A HREF=\"../pkg/AnnotationType.html#required\">required</A>=1994)" + NL + - "</FONT>public int <B>field</B>"}, + "</FONT>public int <STRONG>field</STRONG>"}, //CONSTRUCTOR {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html", "<FONT SIZE=\"-1\">" + NL + "<A HREF=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</A>(<A HREF=\"../pkg/AnnotationType.html#optional\">optional</A>=\"Constructor Annotation\"," + NL + " <A HREF=\"../pkg/AnnotationType.html#required\">required</A>=1994)" + NL + - "</FONT>public <B>AnnotationTypeUsage</B>()"}, + "</FONT>public <STRONG>AnnotationTypeUsage</STRONG>()"}, //METHOD {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html", "<FONT SIZE=\"-1\">" + NL + "<A HREF=\"../pkg/AnnotationTypeUndocumented.html\" title=\"annotation in pkg\">@AnnotationTypeUndocumented</A>(<A HREF=\"../pkg/AnnotationType.html#optional\">optional</A>=\"Method Annotation\"," + NL + " <A HREF=\"../pkg/AnnotationType.html#required\">required</A>=1994)" + NL + - "</FONT>public void <B>method</B>()"}, + "</FONT>public void <STRONG>method</STRONG>()"}, //================================= // Make sure annotation types do not diff --git a/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java b/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java index 4fe236ff6ca..e06b739eba2 100644 --- a/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java +++ b/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java @@ -46,9 +46,9 @@ public class TestOverridenMethodDocCopy extends JavadocTester { //Input for string search tests. private static final String[][] TEST = { {BUG_ID + FS + "pkg1" + FS + "SubClass.html", - "<B>Description copied from class: <CODE>" + + "<STRONG>Description copied from class: <CODE>" + "<A HREF=\"../pkg1/BaseClass.html#overridenMethodWithDocsToCopy()\">" + - "BaseClass</A></CODE></B>" + "BaseClass</A></CODE></STRONG>" } }; private static final String[][] NEGATED_TEST = NO_TEST; diff --git a/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethods.java b/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethods.java index 8b7bc6be352..7c11f4bd70b 100644 --- a/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethods.java +++ b/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethods.java @@ -40,11 +40,11 @@ public class TestOverridenPrivateMethods extends JavadocTester { private static final String[][] TEST = { //The public method should be overriden {BUG_ID + FS + "pkg1" + FS + "SubClass.html", - "Overrides:</B><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"}, + "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"}, //The public method in different package should be overriden {BUG_ID + FS + "pkg2" + FS + "SubClass.html", - "Overrides:</B><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"} + "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"} }; private static final String[][] NEGATED_TEST = { @@ -52,20 +52,20 @@ public class TestOverridenPrivateMethods extends JavadocTester { //The package private method should be overriden since the base and sub class are in the same //package. However, the link should not show up because the package private methods are not documented. {BUG_ID + FS + "pkg1" + FS + "SubClass.html", - "Overrides:</B><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"}, + "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"}, //The private method in should not be overriden {BUG_ID + FS + "pkg1" + FS + "SubClass.html", - "Overrides:</B><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"}, + "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"}, //The private method in different package should not be overriden {BUG_ID + FS + "pkg2" + FS + "SubClass.html", - "Overrides:</B><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"}, + "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"}, //The package private method should not be overriden since the base and sub class are in //different packages. {BUG_ID + FS + "pkg2" + FS + "SubClass.html", - "Overrides:</B><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"} + "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"} }; private static final String[] ARGS = diff --git a/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPackageFlag.java b/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPackageFlag.java index c859a02e86b..ddd4f50b1e8 100644 --- a/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPackageFlag.java +++ b/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPackageFlag.java @@ -40,32 +40,32 @@ public class TestOverridenPrivateMethodsWithPackageFlag extends JavadocTester { private static final String[][] TEST = { //The public method should be overriden {BUG_ID + FS + "pkg1" + FS + "SubClass.html", - "Overrides:</B><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"}, + "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"}, //The public method in different package should be overriden {BUG_ID + FS + "pkg2" + FS + "SubClass.html", - "Overrides:</B><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"}, + "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"}, //The package private method should be overriden since the base and sub class are in the same //package. {BUG_ID + FS + "pkg1" + FS + "SubClass.html", - "Overrides:</B><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"} + "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"} }; private static final String[][] NEGATED_TEST = { //The private method in should not be overriden {BUG_ID + FS + "pkg1" + FS + "SubClass.html", - "Overrides:</B><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"}, + "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"}, //The private method in different package should not be overriden {BUG_ID + FS + "pkg2" + FS + "SubClass.html", - "Overrides:</B><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"}, + "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"}, //The package private method should not be overriden since the base and sub class are in //different packages. {BUG_ID + FS + "pkg2" + FS + "SubClass.html", - "Overrides:</B><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"}, + "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"}, }; private static final String[] ARGS = diff --git a/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPrivateFlag.java b/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPrivateFlag.java index 0113abfb21f..4b338c0328c 100644 --- a/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPrivateFlag.java +++ b/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPrivateFlag.java @@ -40,32 +40,32 @@ public class TestOverridenPrivateMethodsWithPrivateFlag extends JavadocTester { private static final String[][] TEST = { //The public method should be overriden {BUG_ID + FS + "pkg1" + FS + "SubClass.html", - "Overrides:</B><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"}, + "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"}, //The package private method should be overriden since the base and sub class are in the same //package. {BUG_ID + FS + "pkg1" + FS + "SubClass.html", - "Overrides:</B><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"}, + "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"}, //The public method in different package should be overriden {BUG_ID + FS + "pkg2" + FS + "SubClass.html", - "Overrides:</B><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"}, + "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#publicMethod"}, }; private static final String[][] NEGATED_TEST = { //The private method in should not be overriden {BUG_ID + FS + "pkg1" + FS + "SubClass.html", - "Overrides:</B><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"}, + "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"}, //The private method in different package should not be overriden {BUG_ID + FS + "pkg2" + FS + "SubClass.html", - "Overrides:</B><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"}, + "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#privateMethod"}, //The package private method should not be overriden since the base and sub class are in //different packages. {BUG_ID + FS + "pkg2" + FS + "SubClass.html", - "Overrides:</B><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"} + "Overrides:</STRONG><DD><CODE><A HREF=\"../pkg1/BaseClass.html#packagePrivateMethod"} }; diff --git a/langtools/test/com/sun/javadoc/testPackagePage/TestPackagePage.java b/langtools/test/com/sun/javadoc/testPackagePage/TestPackagePage.java index 803b053837e..640a124b746 100644 --- a/langtools/test/com/sun/javadoc/testPackagePage/TestPackagePage.java +++ b/langtools/test/com/sun/javadoc/testPackagePage/TestPackagePage.java @@ -43,23 +43,24 @@ public class TestPackagePage extends JavadocTester { }, //With just one package, all general pages link to the single package page. {BUG_ID + "-1" + FS + "com" + FS + "pkg" + FS + "C.html", - "<A HREF=\"../../com/pkg/package-summary.html\">" + "<FONT CLASS=\"NavBarFont1\"><B>Package</B></FONT></A>" + "<A HREF=\"../../com/pkg/package-summary.html\">" + + "<FONT CLASS=\"NavBarFont1\"><STRONG>Package</STRONG></FONT></A>" }, {BUG_ID + "-1" + FS + "com" + FS + "pkg" + FS + "package-tree.html", "<A HREF=\"../../com/pkg/package-summary.html\">" + - "<FONT CLASS=\"NavBarFont1\"><B>Package</B></FONT></A>" + "<FONT CLASS=\"NavBarFont1\"><STRONG>Package</STRONG></FONT></A>" }, {BUG_ID + "-1" + FS + "deprecated-list.html", "<A HREF=\"com/pkg/package-summary.html\">" + - "<FONT CLASS=\"NavBarFont1\"><B>Package</B></FONT></A>" + "<FONT CLASS=\"NavBarFont1\"><STRONG>Package</STRONG></FONT></A>" }, {BUG_ID + "-1" + FS + "index-all.html", "<A HREF=\"./com/pkg/package-summary.html\">" + - "<FONT CLASS=\"NavBarFont1\"><B>Package</B></FONT></A>" + "<FONT CLASS=\"NavBarFont1\"><STRONG>Package</STRONG></FONT></A>" }, {BUG_ID + "-1" + FS + "help-doc.html", "<A HREF=\"com/pkg/package-summary.html\">" + - "<FONT CLASS=\"NavBarFont1\"><B>Package</B></FONT></A>" + "<FONT CLASS=\"NavBarFont1\"><STRONG>Package</STRONG></FONT></A>" }, }; diff --git a/langtools/test/com/sun/javadoc/testParamTaglet/TestParamTaglet.java b/langtools/test/com/sun/javadoc/testParamTaglet/TestParamTaglet.java index 5abe92a0919..ec802b8d40a 100644 --- a/langtools/test/com/sun/javadoc/testParamTaglet/TestParamTaglet.java +++ b/langtools/test/com/sun/javadoc/testParamTaglet/TestParamTaglet.java @@ -48,12 +48,12 @@ public class TestParamTaglet extends JavadocTester { private static final String[][] TEST = { //Regular param tags. {BUG_ID + FS + "pkg" + FS + "C.html", - "<B>Parameters:</B><DD><CODE>param1</CODE> - testing 1 2 3." + + "<STRONG>Parameters:</STRONG><DD><CODE>param1</CODE> - testing 1 2 3." + "<DD><CODE>param2</CODE> - testing 1 2 3." }, //Param tags that don't match with any real parameters. {BUG_ID + FS + "pkg" + FS + "C.html", - "<B>Parameters:</B><DD><CODE><I>p1</I></CODE> - testing 1 2 3." + + "<STRONG>Parameters:</STRONG><DD><CODE><I>p1</I></CODE> - testing 1 2 3." + "<DD><CODE><I>p2</I></CODE> - testing 1 2 3." }, //{@inherit} doc misuse does not cause doclet to throw exception. diff --git a/langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java b/langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java index 9bfc61e193e..f7f5bda38a9 100644 --- a/langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java +++ b/langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java @@ -85,22 +85,22 @@ public class TestPrivateClasses extends JavadocTester { "<PRE>" + NL + "java.lang.Object" + NL + " <IMG SRC=\"../resources/inherit.gif\" " + - "ALT=\"extended by \"><B>pkg.PublicChild</B>" + NL + + "ALT=\"extended by \"><STRONG>pkg.PublicChild</STRONG>" + NL + "</PRE>" }, // Method is documented as though it is declared in the inheriting method. {BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html", - "public void <B>methodInheritedFromParent</B>(int p1)" + "public void <STRONG>methodInheritedFromParent</STRONG>(int p1)" }, //Make sure implemented interfaces from private superclass are inherited {BUG_ID + "-1" + FS + "pkg" + FS + "PublicInterface.html", - "<B>All Known Implementing Classes:</B> <DD><A HREF=\"../pkg/PublicChild.html\" " + + "<STRONG>All Known Implementing Classes:</STRONG> <DD><A HREF=\"../pkg/PublicChild.html\" " + "title=\"class in pkg\">PublicChild</A>"}, {BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html", - "<B>All Implemented Interfaces:</B> <DD><A HREF=\"../pkg/PublicInterface.html\" " + + "<STRONG>All Implemented Interfaces:</STRONG> <DD><A HREF=\"../pkg/PublicInterface.html\" " + "title=\"interface in pkg\">PublicInterface</A>"}, //Generic interface method test. @@ -110,12 +110,12 @@ public class TestPrivateClasses extends JavadocTester { private static final String[][] NEGATED_TEST1 = { // Should not document that a method overrides method from private class. {BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html", - "<B>Overrides:</B>"}, + "<STRONG>Overrides:</STRONG>"}, // Should not document that a method specified by private interface. {BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html", - "<B>Specified by:</B>"}, + "<STRONG>Specified by:</STRONG>"}, {BUG_ID + "-1" + FS + "pkg" + FS + "PublicInterface.html", - "<B>Specified by:</B>"}, + "<STRONG>Specified by:</STRONG>"}, // Should not mention that any documentation was copied. {BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html", "Description copied from"}, @@ -137,7 +137,7 @@ public class TestPrivateClasses extends JavadocTester { //Do not inherit private interface method with generic parameters. //This method has been implemented. {BUG_ID + "-1" + FS + "pkg2" + FS + "C.html", - "<B><A HREF=\"../pkg2/I.html#hello(T)\">hello</A></B>"}, + "<STRONG><A HREF=\"../pkg2/I.html#hello(T)\">hello</A></STRONG>"}, }; // Test output when -private flag is used. @@ -174,14 +174,14 @@ public class TestPrivateClasses extends JavadocTester { }, // Should document that a method overrides method from private class. {BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html", - "<B>Overrides:</B><DD><CODE>" + + "<STRONG>Overrides:</STRONG><DD><CODE>" + "<A HREF=\"../pkg/PrivateParent.html#methodOverridenFromParent(char[], int, T, V, java.util.List)\">" + "methodOverridenFromParent</A></CODE> in class <CODE>" + "<A HREF=\"../pkg/PrivateParent.html\" title=\"class in pkg\">" + "PrivateParent</A></CODE></DL>"}, // Should document that a method is specified by private interface. {BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html", - "<B>Specified by:</B><DD><CODE>" + + "<STRONG>Specified by:</STRONG><DD><CODE>" + "<A HREF=\"../pkg/PrivateInterface.html#methodInterface(int)\">" + "methodInterface</A></CODE> in interface <CODE>" + "<A HREF=\"../pkg/PrivateInterface.html\" title=\"interface in pkg\">" + @@ -209,12 +209,12 @@ public class TestPrivateClasses extends JavadocTester { //Make sure implemented interfaces from private superclass are inherited {BUG_ID + "-2" + FS + "pkg" + FS + "PublicInterface.html", - "<B>All Known Implementing Classes:</B> <DD><A HREF=\"../pkg/PrivateParent.html\" " + + "<STRONG>All Known Implementing Classes:</STRONG> <DD><A HREF=\"../pkg/PrivateParent.html\" " + "title=\"class in pkg\">PrivateParent</A>, " + "<A HREF=\"../pkg/PublicChild.html\" title=\"class in pkg\">PublicChild</A>"}, {BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html", - "<B>All Implemented Interfaces:</B> <DD><A HREF=\"../pkg/PrivateInterface.html\" " + + "<STRONG>All Implemented Interfaces:</STRONG> <DD><A HREF=\"../pkg/PrivateInterface.html\" " + "title=\"interface in pkg\">PrivateInterface</A>, " + "<A HREF=\"../pkg/PublicInterface.html\" title=\"interface in pkg\">" + "PublicInterface</A>"}, @@ -222,10 +222,13 @@ public class TestPrivateClasses extends JavadocTester { //Since private flag is used, we can document that private interface method //with generic parameters has been implemented. {BUG_ID + "-2" + FS + "pkg2" + FS + "C.html", - "<B>Description copied from interface: " + "<CODE><A HREF=\"../pkg2/I.html#hello(T)\">I</A></CODE></B>"}, + "<STRONG>Description copied from interface: " + + "<CODE><A HREF=\"../pkg2/I.html#hello(T)\">I</A></CODE></STRONG>"}, {BUG_ID + "-2" + FS + "pkg2" + FS + "C.html", - "<B>Specified by:</B><DD><CODE><A HREF=\"../pkg2/I.html#hello(T)\">" + "hello</A></CODE> in interface <CODE><A HREF=\"../pkg2/I.html\" " + "title=\"interface in pkg2\">I</A>"}, + "<STRONG>Specified by:</STRONG><DD><CODE><A HREF=\"../pkg2/I.html#hello(T)\">" + + "hello</A></CODE> in interface <CODE><A HREF=\"../pkg2/I.html\" " + + "title=\"interface in pkg2\">I</A>"}, }; private static final String[][] NEGATED_TEST2 = NO_TEST; diff --git a/langtools/test/com/sun/javadoc/testSerializedForm/TestSerializedForm.java b/langtools/test/com/sun/javadoc/testSerializedForm/TestSerializedForm.java index 9a7aff0e934..231cce68cab 100644 --- a/langtools/test/com/sun/javadoc/testSerializedForm/TestSerializedForm.java +++ b/langtools/test/com/sun/javadoc/testSerializedForm/TestSerializedForm.java @@ -47,11 +47,11 @@ public class TestSerializedForm extends JavadocTester implements Serializable { private static final String[][] TEST = { {BUG_ID + FS + "serialized-form.html", - "protected java.lang.Object <B>readResolve</B>()"}, + "protected java.lang.Object <STRONG>readResolve</STRONG>()"}, {BUG_ID + FS + "serialized-form.html", - "protected java.lang.Object <B>writeReplace</B>()"}, + "protected java.lang.Object <STRONG>writeReplace</STRONG>()"}, {BUG_ID + FS + "serialized-form.html", - "protected java.lang.Object <B>readObjectNoData</B>()"}, + "protected java.lang.Object <STRONG>readObjectNoData</STRONG>()"}, {BUG_ID + FS + "serialized-form.html", "See Also"}, }; diff --git a/langtools/test/com/sun/javadoc/testSimpleTag/TestSimpleTag.java b/langtools/test/com/sun/javadoc/testSimpleTag/TestSimpleTag.java index 8dff2915871..83914cbb8c8 100644 --- a/langtools/test/com/sun/javadoc/testSimpleTag/TestSimpleTag.java +++ b/langtools/test/com/sun/javadoc/testSimpleTag/TestSimpleTag.java @@ -42,13 +42,13 @@ public class TestSimpleTag extends JavadocTester { private static final String[][] TEST = new String[][] { {"./" + BUG_ID + "/C.html", - "<B>Todo:</B>"}, + "<STRONG>Todo:</STRONG>"}, {"./" + BUG_ID + "/C.html", - "<B>EJB Beans:</B>"}, + "<STRONG>EJB Beans:</STRONG>"}, {"./" + BUG_ID + "/C.html", - "<B>Regular Tag:</B>"}, + "<STRONG>Regular Tag:</STRONG>"}, {"./" + BUG_ID + "/C.html", - "<B>Back-Slash-Tag:</B>"}, + "<STRONG>Back-Slash-Tag:</STRONG>"}, }; private static final String[] ARGS = new String[] { diff --git a/langtools/test/com/sun/javadoc/testSummaryHeading/TestSummaryHeading.java b/langtools/test/com/sun/javadoc/testSummaryHeading/TestSummaryHeading.java index ace6862e0ed..36cd089c32f 100644 --- a/langtools/test/com/sun/javadoc/testSummaryHeading/TestSummaryHeading.java +++ b/langtools/test/com/sun/javadoc/testSummaryHeading/TestSummaryHeading.java @@ -46,7 +46,7 @@ public class TestSummaryHeading extends JavadocTester { //Input for string search tests. private static final String[][] TEST = { - {BUG_ID + FS + "C.html", "<B>Method Summary</B>"} + {BUG_ID + FS + "C.html", "<STRONG>Method Summary</STRONG>"} }; private static final String[][] NEGATED_TEST = NO_TEST; diff --git a/langtools/test/com/sun/javadoc/testThrowsHead/TestThrowsHead.java b/langtools/test/com/sun/javadoc/testThrowsHead/TestThrowsHead.java index c8a289eb95a..74153a0f1ed 100644 --- a/langtools/test/com/sun/javadoc/testThrowsHead/TestThrowsHead.java +++ b/langtools/test/com/sun/javadoc/testThrowsHead/TestThrowsHead.java @@ -38,7 +38,7 @@ public class TestThrowsHead extends JavadocTester { private static final String BUG_ID = "4530727"; private static final String[][] TEST = { - {BUG_ID + FS + "C.html", "<DT><B>Throws:</B>"} + {BUG_ID + FS + "C.html", "<DT><STRONG>Throws:</STRONG>"} }; private static final String[][] NEGATED_TEST = NO_TEST; private static final String[] ARGS = new String[] { diff --git a/langtools/test/com/sun/javadoc/testValueTag/TestValueTag.java b/langtools/test/com/sun/javadoc/testValueTag/TestValueTag.java index b841a27f476..751869deffa 100644 --- a/langtools/test/com/sun/javadoc/testValueTag/TestValueTag.java +++ b/langtools/test/com/sun/javadoc/testValueTag/TestValueTag.java @@ -88,7 +88,7 @@ public class TestValueTag extends JavadocTester { "Result: <A HREF=\"../pkg2/Class3.html#TEST_17_PASSES\">\"Test 17 passes\"</A>"}, //Test @value tag used with custom tag. {BUG_ID + FS + "pkg1" + FS + "CustomTagUsage.html", - "<DT><B>Todo:</B></DT>" + NL + + "<DT><STRONG>Todo:</STRONG></DT>" + NL + " <DD>the value of this constant is 55.</DD>"}, //Test @value warning printed when used with non-constant. {WARNING_OUTPUT,"warning - @value tag (which references nonConstant) " + From 1db3e0312e5b190cab028103c7257298af40edcd Mon Sep 17 00:00:00 2001 From: Martin Buchholz <martin@openjdk.org> Date: Fri, 9 Jan 2009 16:48:46 -0800 Subject: [PATCH 241/267] 6792066: src/share/native/java/io/io_util.c clean-ups Reviewed-by: alanb --- jdk/src/share/native/java/io/io_util.c | 60 +++++++++++++------------- jdk/src/share/native/java/io/io_util.h | 6 +-- 2 files changed, 34 insertions(+), 32 deletions(-) diff --git a/jdk/src/share/native/java/io/io_util.c b/jdk/src/share/native/java/io/io_util.c index c5ca5334fbd..144287bb758 100644 --- a/jdk/src/share/native/java/io/io_util.c +++ b/jdk/src/share/native/java/io/io_util.c @@ -25,6 +25,7 @@ #include <stdlib.h> #include <string.h> +#include <stddef.h> #include "jni.h" #include "jni_util.h" @@ -34,9 +35,9 @@ /* IO helper functions */ -int +jint readSingle(JNIEnv *env, jobject this, jfieldID fid) { - int nread; + jint nread; char ret; FD fd = GET_FD(this, fid); if (fd == -1) { @@ -49,7 +50,7 @@ readSingle(JNIEnv *env, jobject this, jfieldID fid) { } else if (nread == JVM_IO_ERR) { /* error */ JNU_ThrowIOExceptionWithLastError(env, "Read error"); } else if (nread == JVM_IO_INTR) { - JNU_ThrowByName(env, "java/io/InterruptedIOException", 0); + JNU_ThrowByName(env, "java/io/InterruptedIOException", NULL); } return ret & 0xFF; } @@ -71,22 +72,22 @@ outOfBounds(JNIEnv *env, jint off, jint len, jbyteArray array) { ((*env)->GetArrayLength(env, array) - off < len)); } -int +jint readBytes(JNIEnv *env, jobject this, jbyteArray bytes, jint off, jint len, jfieldID fid) { - int nread; + jint nread; char stackBuf[BUF_SIZE]; - char *buf = 0; + char *buf = NULL; FD fd; if (IS_NULL(bytes)) { - JNU_ThrowNullPointerException(env, 0); + JNU_ThrowNullPointerException(env, NULL); return -1; } if (outOfBounds(env, off, len, bytes)) { - JNU_ThrowByName(env, "java/lang/IndexOutOfBoundsException", 0); + JNU_ThrowByName(env, "java/lang/IndexOutOfBoundsException", NULL); return -1; } @@ -94,8 +95,8 @@ readBytes(JNIEnv *env, jobject this, jbyteArray bytes, return 0; } else if (len > BUF_SIZE) { buf = malloc(len); - if (buf == 0) { - JNU_ThrowOutOfMemoryError(env, 0); + if (buf == NULL) { + JNU_ThrowOutOfMemoryError(env, NULL); return 0; } } else { @@ -112,8 +113,8 @@ readBytes(JNIEnv *env, jobject this, jbyteArray bytes, (*env)->SetByteArrayRegion(env, bytes, off, nread, (jbyte *)buf); } else if (nread == JVM_IO_ERR) { JNU_ThrowIOExceptionWithLastError(env, "Read error"); - } else if (nread == JVM_IO_INTR) { /* EOF */ - JNU_ThrowByName(env, "java/io/InterruptedIOException", 0); + } else if (nread == JVM_IO_INTR) { + JNU_ThrowByName(env, "java/io/InterruptedIOException", NULL); } else { /* EOF */ nread = -1; } @@ -127,8 +128,9 @@ readBytes(JNIEnv *env, jobject this, jbyteArray bytes, void writeSingle(JNIEnv *env, jobject this, jint byte, jfieldID fid) { - char c = byte; - int n; + // Discard the 24 high-order bits of byte. See OutputStream#write(int) + char c = (char) byte; + jint n; FD fd = GET_FD(this, fid); if (fd == -1) { JNU_ThrowIOException(env, "Stream Closed"); @@ -138,26 +140,26 @@ writeSingle(JNIEnv *env, jobject this, jint byte, jfieldID fid) { if (n == JVM_IO_ERR) { JNU_ThrowIOExceptionWithLastError(env, "Write error"); } else if (n == JVM_IO_INTR) { - JNU_ThrowByName(env, "java/io/InterruptedIOException", 0); + JNU_ThrowByName(env, "java/io/InterruptedIOException", NULL); } } void writeBytes(JNIEnv *env, jobject this, jbyteArray bytes, - jint off, jint len, jfieldID fid) + jint off, jint len, jfieldID fid) { - int n; + jint n; char stackBuf[BUF_SIZE]; - char *buf = 0; + char *buf = NULL; FD fd; if (IS_NULL(bytes)) { - JNU_ThrowNullPointerException(env, 0); + JNU_ThrowNullPointerException(env, NULL); return; } if (outOfBounds(env, off, len, bytes)) { - JNU_ThrowByName(env, "java/lang/IndexOutOfBoundsException", 0); + JNU_ThrowByName(env, "java/lang/IndexOutOfBoundsException", NULL); return; } @@ -165,8 +167,8 @@ writeBytes(JNIEnv *env, jobject this, jbyteArray bytes, return; } else if (len > BUF_SIZE) { buf = malloc(len); - if (buf == 0) { - JNU_ThrowOutOfMemoryError(env, 0); + if (buf == NULL) { + JNU_ThrowOutOfMemoryError(env, NULL); return; } } else { @@ -188,7 +190,7 @@ writeBytes(JNIEnv *env, jobject this, jbyteArray bytes, JNU_ThrowIOExceptionWithLastError(env, "Write error"); break; } else if (n == JVM_IO_INTR) { - JNU_ThrowByName(env, "java/io/InterruptedIOException", 0); + JNU_ThrowByName(env, "java/io/InterruptedIOException", NULL); break; } off += n; @@ -204,19 +206,19 @@ void throwFileNotFoundException(JNIEnv *env, jstring path) { char buf[256]; - int n; + jint n; jobject x; jstring why = NULL; n = JVM_GetLastErrorString(buf, sizeof(buf)); if (n > 0) { - why = JNU_NewStringPlatform(env, buf); + why = JNU_NewStringPlatform(env, buf); } x = JNU_NewObjectByName(env, - "java/io/FileNotFoundException", - "(Ljava/lang/String;Ljava/lang/String;)V", - path, why); + "java/io/FileNotFoundException", + "(Ljava/lang/String;Ljava/lang/String;)V", + path, why); if (x != NULL) { - (*env)->Throw(env, x); + (*env)->Throw(env, x); } } diff --git a/jdk/src/share/native/java/io/io_util.h b/jdk/src/share/native/java/io/io_util.h index 5b2d487058a..9a7e7b13f85 100644 --- a/jdk/src/share/native/java/io/io_util.h +++ b/jdk/src/share/native/java/io/io_util.h @@ -38,9 +38,9 @@ extern jfieldID IO_handle_fdID; * IO helper functions */ -int readSingle(JNIEnv *env, jobject this, jfieldID fid); -int readBytes(JNIEnv *env, jobject this, jbyteArray bytes, jint off, - jint len, jfieldID fid); +jint readSingle(JNIEnv *env, jobject this, jfieldID fid); +jint readBytes(JNIEnv *env, jobject this, jbyteArray bytes, jint off, + jint len, jfieldID fid); void writeSingle(JNIEnv *env, jobject this, jint byte, jfieldID fid); void writeBytes(JNIEnv *env, jobject this, jbyteArray bytes, jint off, jint len, jfieldID fid); From 795b53a014bba2c51c67c247088a327eb4370477 Mon Sep 17 00:00:00 2001 From: Maurizio Cimadamore <mcimadamore@openjdk.org> Date: Tue, 13 Jan 2009 13:27:14 +0000 Subject: [PATCH 242/267] 6765045: Remove rawtypes warnings from langtools Removed all occurrences of rawtypes warnings from langtools Reviewed-by: jjg, bpatel --- langtools/make/build.properties | 2 +- .../classes/com/sun/source/util/Trees.java | 2 +- .../classes/com/sun/tools/apt/comp/Apt.java | 2 +- .../declaration/AnnotationProxyMaker.java | 4 +-- .../apt/mirror/declaration/Constants.java | 6 ++--- .../formats/html/AbstractIndexWriter.java | 4 +-- .../formats/html/AbstractMemberWriter.java | 8 +++--- .../formats/html/AbstractTreeWriter.java | 8 +++--- .../formats/html/AllClassesFrameWriter.java | 4 +-- .../doclets/formats/html/ClassUseWriter.java | 14 +++++----- .../doclets/formats/html/ClassWriterImpl.java | 12 ++++----- .../html/ConstantsSummaryWriterImpl.java | 4 +-- .../formats/html/ConstructorWriterImpl.java | 2 +- .../formats/html/HtmlDocletWriter.java | 14 +++++----- .../formats/html/HtmlSerialFieldWriter.java | 2 +- .../formats/html/PackageFrameWriter.java | 2 +- .../formats/html/PackageIndexWriter.java | 2 +- .../formats/html/PackageUseWriter.java | 19 +++++++------- .../internal/toolkit/Configuration.java | 6 ++--- .../toolkit/ConstantsSummaryWriter.java | 2 +- .../toolkit/builders/AbstractBuilder.java | 14 +++++----- .../builders/AbstractMemberBuilder.java | 2 +- .../builders/AnnotationTypeBuilder.java | 10 +++---- .../AnnotationTypeOptionalMemberBuilder.java | 4 +-- .../AnnotationTypeRequiredMemberBuilder.java | 6 ++--- .../toolkit/builders/ClassBuilder.java | 14 +++++----- .../builders/ConstantsSummaryBuilder.java | 14 +++++----- .../toolkit/builders/ConstructorBuilder.java | 6 ++--- .../toolkit/builders/EnumConstantBuilder.java | 6 ++--- .../toolkit/builders/FieldBuilder.java | 6 ++--- .../toolkit/builders/LayoutParser.java | 4 +-- .../builders/MemberSummaryBuilder.java | 8 +++--- .../toolkit/builders/MethodBuilder.java | 6 ++--- .../builders/PackageSummaryBuilder.java | 6 ++--- .../builders/SerializedFormBuilder.java | 16 ++++++------ .../internal/toolkit/taglets/ParamTaglet.java | 6 ++--- .../toolkit/taglets/TagletManager.java | 6 ++--- .../internal/toolkit/util/ClassTree.java | 24 ++++++++--------- .../internal/toolkit/util/ClassUseMapper.java | 22 +++++++--------- .../doclets/internal/toolkit/util/Group.java | 4 +-- .../toolkit/util/ImplementedMethods.java | 6 ++--- .../internal/toolkit/util/IndexBuilder.java | 8 +++--- .../doclets/internal/toolkit/util/Util.java | 22 ++++++++-------- .../toolkit/util/VisibleMemberMap.java | 26 +++++++++---------- .../classes/com/sun/tools/javac/Main.java | 2 +- .../tools/javac/file/JavacFileManager.java | 4 +-- .../sun/tools/javac/file/ZipFileIndex.java | 2 +- .../javac/model/AnnotationProxyMaker.java | 6 ++--- .../JavacProcessingEnvironment.java | 2 +- .../tools/javac/processing/ServiceProxy.java | 6 ++--- .../com/sun/tools/javac/util/Context.java | 12 ++++----- .../com/sun/tools/javac/util/List.java | 11 ++++---- .../com/sun/tools/javac/util/Pair.java | 6 ++--- .../com/sun/tools/javadoc/DocletInvoker.java | 12 ++++----- .../classes/com/sun/tools/javah/Gen.java | 2 +- .../classes/com/sun/tools/javah/LLNI.java | 4 +-- .../com/sun/tools/javah/TypeSignature.java | 2 +- .../classes/sun/tools/javap/FieldData.java | 2 +- .../classes/sun/tools/javap/JavapPrinter.java | 12 ++++----- .../classes/sun/tools/javap/MethodData.java | 10 +++---- 60 files changed, 229 insertions(+), 231 deletions(-) diff --git a/langtools/make/build.properties b/langtools/make/build.properties index c1059c2eadb..38fd0f4705d 100644 --- a/langtools/make/build.properties +++ b/langtools/make/build.properties @@ -66,7 +66,7 @@ javac.no.jdk.warnings = -XDignore.symbol.file=true # set the following to -version to verify the versions of javac being used javac.version.opt = # in time, there should be no exceptions to -Xlint:all -javac.lint.opts = -Xlint:all,-deprecation,-fallthrough,-serial,-unchecked,-cast,-rawtypes +javac.lint.opts = -Xlint:all,-deprecation,-fallthrough,-serial,-unchecked,-cast # options for the <javadoc> task for javac javadoc.jls3.url=http://java.sun.com/docs/books/jls/ diff --git a/langtools/src/share/classes/com/sun/source/util/Trees.java b/langtools/src/share/classes/com/sun/source/util/Trees.java index dd4e16e9548..506e6bb0523 100644 --- a/langtools/src/share/classes/com/sun/source/util/Trees.java +++ b/langtools/src/share/classes/com/sun/source/util/Trees.java @@ -74,7 +74,7 @@ public abstract class Trees { ClassLoader cl = arg.getClass().getClassLoader(); Class<?> c = Class.forName("com.sun.tools.javac.api.JavacTrees", false, cl); argType = Class.forName(argType.getName(), false, cl); - Method m = c.getMethod("instance", new Class[] { argType }); + Method m = c.getMethod("instance", new Class<?>[] { argType }); return (Trees) m.invoke(null, new Object[] { arg }); } catch (Throwable e) { throw new AssertionError(e); diff --git a/langtools/src/share/classes/com/sun/tools/apt/comp/Apt.java b/langtools/src/share/classes/com/sun/tools/apt/comp/Apt.java index aab5dadec46..abd09f5bf9e 100644 --- a/langtools/src/share/classes/com/sun/tools/apt/comp/Apt.java +++ b/langtools/src/share/classes/com/sun/tools/apt/comp/Apt.java @@ -281,7 +281,7 @@ public class Apt extends ListBuffer<Env<AttrContext>> { // Discovery process // List of annotation processory factory instances - java.util.Iterator providers = null; + java.util.Iterator<AnnotationProcessorFactory> providers = null; { /* * If a factory is provided by the user, the diff --git a/langtools/src/share/classes/com/sun/tools/apt/mirror/declaration/AnnotationProxyMaker.java b/langtools/src/share/classes/com/sun/tools/apt/mirror/declaration/AnnotationProxyMaker.java index 4e90ad1cc29..64727fda4c1 100644 --- a/langtools/src/share/classes/com/sun/tools/apt/mirror/declaration/AnnotationProxyMaker.java +++ b/langtools/src/share/classes/com/sun/tools/apt/mirror/declaration/AnnotationProxyMaker.java @@ -217,7 +217,7 @@ class AnnotationProxyMaker { } } - @SuppressWarnings("unchecked") + @SuppressWarnings({"unchecked", "rawtypes"}) public void visitEnum(Attribute.Enum e) { if (runtimeType.isEnum()) { String constName = e.value.toString(); @@ -225,7 +225,7 @@ class AnnotationProxyMaker { value = Enum.valueOf((Class)runtimeType, constName); } catch (IllegalArgumentException ex) { value = new EnumConstantNotPresentExceptionProxy( - (Class)runtimeType, constName); + (Class<Enum<?>>)runtimeType, constName); } } else { value = null; // indicates a type mismatch diff --git a/langtools/src/share/classes/com/sun/tools/apt/mirror/declaration/Constants.java b/langtools/src/share/classes/com/sun/tools/apt/mirror/declaration/Constants.java index e589735de41..ba2afd8b47e 100644 --- a/langtools/src/share/classes/com/sun/tools/apt/mirror/declaration/Constants.java +++ b/langtools/src/share/classes/com/sun/tools/apt/mirror/declaration/Constants.java @@ -130,8 +130,8 @@ class Constants { append((EnumConstantDeclarationImpl) val); } else if (val instanceof AnnotationMirror) { append((AnnotationMirrorImpl) val); - } else if (val instanceof Collection) { - append((Collection) val); + } else if (val instanceof Collection<?>) { + append((Collection<?>) val); } else { appendUnquoted(val.toString()); } @@ -234,7 +234,7 @@ class Constants { * and separated by ", ". Useful for array-valued annotation * elements. */ - void append(Collection vals) { + void append(Collection<?> vals) { buf.append('{'); boolean first = true; for (Object val : vals) { diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java index f27094d3e21..a7cad980bbc 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java @@ -95,14 +95,14 @@ public class AbstractIndexWriter extends HtmlDocletWriter { * @param unicode Unicode for which member list information to be generated. * @param memberlist List of members for the unicode character. */ - protected void generateContents(Character unicode, List memberlist) { + protected void generateContents(Character unicode, List<? extends Doc> memberlist) { anchor("_" + unicode + "_"); h2(); strong(unicode.toString()); h2End(); dl(); for (int i = 0; i < memberlist.size(); i++) { - Doc element = (Doc)memberlist.get(i); + Doc element = memberlist.get(i); if (element instanceof MemberDoc) { printDescription((MemberDoc)element); } else if (element instanceof ClassDoc) { diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java index 32e50829523..268dbe009fb 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java @@ -317,7 +317,7 @@ public abstract class AbstractMemberWriter { * format for listing the API. Call methods from the sub-class to complete * the generation. */ - protected void printDeprecatedAPI(List deprmembers, String headingKey) { + protected void printDeprecatedAPI(List<Doc> deprmembers, String headingKey) { if (deprmembers.size() > 0) { writer.tableIndexSummary(); writer.tableHeaderStart("#CCCCFF"); @@ -377,12 +377,12 @@ public abstract class AbstractMemberWriter { } } - protected void navDetailLink(List members) { + protected void navDetailLink(List<?> members) { printNavDetailLink(members.size() > 0? true: false); } - protected void navSummaryLink(List members, + protected void navSummaryLink(List<?> members, VisibleMemberMap visibleMemberMap) { if (members.size() > 0) { printNavSummaryLink(null, true); @@ -390,7 +390,7 @@ public abstract class AbstractMemberWriter { } else { ClassDoc icd = classdoc.superclass(); while (icd != null) { - List inhmembers = visibleMemberMap.getMembersFor(icd); + List<?> inhmembers = visibleMemberMap.getMembersFor(icd); if (inhmembers.size() > 0) { printNavSummaryLink(icd, true); return; diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractTreeWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractTreeWriter.java index edff251f30f..8fec8b0de87 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractTreeWriter.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractTreeWriter.java @@ -96,12 +96,12 @@ public abstract class AbstractTreeWriter extends HtmlDocletWriter { * @param list list of the sub-classes at this level. * @param isEnum true if we are generating a tree for enums. */ - protected void generateLevelInfo(ClassDoc parent, List list, + protected void generateLevelInfo(ClassDoc parent, List<ClassDoc> list, boolean isEnum) { if (list.size() > 0) { ul(); for (int i = 0; i < list.size(); i++) { - ClassDoc local = (ClassDoc)list.get(i); + ClassDoc local = list.get(i); printPartialInfo(local); printExtendsImplements(parent, local); generateLevelInfo(local, classtree.subs(local, isEnum), @@ -119,9 +119,9 @@ public abstract class AbstractTreeWriter extends HtmlDocletWriter { * other classes in this run will derive from these classes. * @param heading Heading for the tree. */ - protected void generateTree(List list, String heading) { + protected void generateTree(List<ClassDoc> list, String heading) { if (list.size() > 0) { - ClassDoc firstClassDoc = (ClassDoc)list.get(0); + ClassDoc firstClassDoc = list.get(0); printTreeHeading(heading); generateLevelInfo(!firstClassDoc.isInterface()? firstClassDoc : null, list, diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java index 3058cc293e0..4c663ac6376 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java @@ -137,9 +137,9 @@ public class AllClassesFrameWriter extends HtmlDocletWriter { * @param classlist Sorted list of classes. * @param wantFrames True if we want frames. */ - protected void generateContents(List classlist, boolean wantFrames) { + protected void generateContents(List<Doc> classlist, boolean wantFrames) { for (int i = 0; i < classlist.size(); i++) { - ClassDoc cd = (ClassDoc)(classlist.get(i)); + ClassDoc cd = (ClassDoc)classlist.get(i); if (!Util.isCoreClass(cd)) { continue; } diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java index e122252961d..73d957e3c4e 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java @@ -38,7 +38,7 @@ import java.util.*; public class ClassUseWriter extends SubWriterHolderWriter { final ClassDoc classdoc; - Set pkgToPackageAnnotations = null; + Set<PackageDoc> pkgToPackageAnnotations = null; final Map<String,List<ProgramElementDoc>> pkgToClassTypeParameter; final Map<String,List<ProgramElementDoc>> pkgToClassAnnotations; final Map<String,List<ProgramElementDoc>> pkgToMethodTypeParameter; @@ -220,8 +220,8 @@ public class ClassUseWriter extends SubWriterHolderWriter { false))); tableHeaderEnd(); - for (Iterator it = pkgSet.iterator(); it.hasNext();) { - PackageDoc pkg = (PackageDoc)it.next(); + for (Iterator<PackageDoc> it = pkgSet.iterator(); it.hasNext();) { + PackageDoc pkg = it.next(); generatePackageUse(pkg); } tableEnd(); @@ -240,8 +240,8 @@ public class ClassUseWriter extends SubWriterHolderWriter { getLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_CLASS_USE_HEADER, classdoc, false))); tableHeaderEnd(); - for (Iterator it = pkgToPackageAnnotations.iterator(); it.hasNext();) { - PackageDoc pkg = (PackageDoc)it.next(); + for (Iterator<PackageDoc> it = pkgToPackageAnnotations.iterator(); it.hasNext();) { + PackageDoc pkg = it.next(); trBgcolorStyle("white", "TableRowColor"); summaryRow(0); //Just want an anchor here. @@ -259,8 +259,8 @@ public class ClassUseWriter extends SubWriterHolderWriter { } protected void generateClassList() throws IOException { - for (Iterator it = pkgSet.iterator(); it.hasNext();) { - PackageDoc pkg = (PackageDoc)it.next(); + for (Iterator<PackageDoc> it = pkgSet.iterator(); it.hasNext();) { + PackageDoc pkg = it.next(); anchor(pkg.name()); tableIndexSummary(); tableHeaderStart("#CCCCFF"); diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java index ac485e2888b..c15f76367dc 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java @@ -355,7 +355,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter classDoc.qualifiedName().equals("org.omg.CORBA.Object")) { return; // Don't generate the list, too huge } - List subclasses = classtree.subs(classDoc, false); + List<ClassDoc> subclasses = classtree.subs(classDoc, false); if (subclasses.size() > 0) { dl(); dt(); @@ -371,7 +371,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter */ public void writeSubInterfacesInfo() { if (classDoc.isInterface()) { - List subInterfaces = classtree.allSubs(classDoc, false); + List<ClassDoc> subInterfaces = classtree.allSubs(classDoc, false); if (subInterfaces.size() > 0) { dl(); dt(); @@ -393,7 +393,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter classDoc.qualifiedName().equals("java.io.Serializable")) { return; // Don't generate the list, too big } - List implcl = classtree.implementingclasses(classDoc); + List<ClassDoc> implcl = classtree.implementingclasses(classDoc); if (implcl.size() > 0) { dl(); dt(); @@ -409,7 +409,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter public void writeImplementedInterfacesInfo() { //NOTE: we really should be using ClassDoc.interfaceTypes() here, but // it doesn't walk up the tree like we want it to. - List interfaceArray = Util.getAllInterfaces(classDoc, configuration); + List<Type> interfaceArray = Util.getAllInterfaces(classDoc, configuration); if (classDoc.isClass() && interfaceArray.size() > 0) { dl(); dt(); @@ -425,7 +425,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter public void writeSuperInterfacesInfo() { //NOTE: we really should be using ClassDoc.interfaceTypes() here, but // it doesn't walk up the tree like we want it to. - List interfaceArray = Util.getAllInterfaces(classDoc, configuration); + List<Type> interfaceArray = Util.getAllInterfaces(classDoc, configuration); if (classDoc.isInterface() && interfaceArray.size() > 0) { dl(); dt(); @@ -438,7 +438,7 @@ public class ClassWriterImpl extends SubWriterHolderWriter /** * Generate links to the given classes. */ - private void writeClassLinks(int context, List list) { + private void writeClassLinks(int context, List<?> list) { Object[] typeList = list.toArray(); //Sort the list to be printed. print(' '); diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java index 670e8d5e80a..d64b2656d59 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java @@ -194,10 +194,10 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter /** * {@inheritDoc} */ - public void writeConstantMembers(ClassDoc cd, List fields) { + public void writeConstantMembers(ClassDoc cd, List<FieldDoc> fields) { currentClassDoc = cd; for (int i = 0; i < fields.size(); ++i) { - writeConstantMember((FieldDoc)(fields.get(i))); + writeConstantMember(fields.get(i)); } } diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java index c0dfe14262c..72d2e7ca4c5 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java @@ -238,7 +238,7 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter return VisibleMemberMap.CONSTRUCTORS; } - protected void navSummaryLink(List members) { + protected void navSummaryLink(List<?> members) { printNavSummaryLink(classdoc, members.size() > 0? true: false); } diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java index 740fab54330..8a668cdc819 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java @@ -1728,13 +1728,13 @@ public class HtmlDocletWriter extends HtmlDocWriter { * @param descList the array of {@link AnnotationDesc}. */ private boolean writeAnnotationInfo(int indent, Doc doc, AnnotationDesc[] descList, boolean lineBreak) { - List annotations = getAnnotations(indent, descList, lineBreak); + List<String> annotations = getAnnotations(indent, descList, lineBreak); if (annotations.size() == 0) { return false; } fontNoNewLine("-1"); - for (Iterator iter = annotations.iterator(); iter.hasNext();) { - print((String) iter.next()); + for (Iterator<String> iter = annotations.iterator(); iter.hasNext();) { + print(iter.next()); } fontEnd(); return true; @@ -1792,8 +1792,8 @@ public class HtmlDocletWriter extends HtmlDocWriter { annotationTypeValues.add(annotationValue); } annotation.append(annotationTypeValues.size() == 1 ? "" : "{"); - for (Iterator iter = annotationTypeValues.iterator(); iter.hasNext(); ) { - annotation.append(annotationValueToString((AnnotationValue) iter.next())); + for (Iterator<AnnotationValue> iter = annotationTypeValues.iterator(); iter.hasNext(); ) { + annotation.append(annotationValueToString(iter.next())); annotation.append(iter.hasNext() ? "," : ""); } annotation.append(annotationTypeValues.size() == 1 ? "" : "}"); @@ -1820,11 +1820,11 @@ public class HtmlDocletWriter extends HtmlDocWriter { return type.typeName() + type.dimension() + ".class"; } } else if (annotationValue.value() instanceof AnnotationDesc) { - List list = getAnnotations(0, + List<String> list = getAnnotations(0, new AnnotationDesc[]{(AnnotationDesc) annotationValue.value()}, false); StringBuffer buf = new StringBuffer(); - for (Iterator iter = list.iterator(); iter.hasNext(); ) { + for (Iterator<String> iter = list.iterator(); iter.hasNext(); ) { buf.append(iter.next()); } return buf.toString(); diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java index ff648659ba5..5b770658eca 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java @@ -51,7 +51,7 @@ public class HtmlSerialFieldWriter extends FieldWriterImpl super(writer, classdoc); } - public List members(ClassDoc cd) { + public List<FieldDoc> members(ClassDoc cd) { return Util.asList(cd.serializableFields()); } diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java index 4ea71bcb817..8503c03d7ba 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java @@ -49,7 +49,7 @@ public class PackageFrameWriter extends HtmlDocletWriter { * The classes to be documented. Use this to filter out classes * that will not be documented. */ - private Set documentedClasses; + private Set<ClassDoc> documentedClasses; /** * The name of the output file. diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java index 9cc222cea9d..630ed3669c4 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java @@ -54,7 +54,7 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter { /** * List to store the order groups as specified on the command line. */ - private List groupList; + private List<String> groupList; /** * Construct the PackageIndexWriter. Also constructs the grouping diff --git a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java index 03ee446d95e..a83cc3d70a0 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java @@ -63,8 +63,8 @@ public class PackageUseWriter extends SubWriterHolderWriter { ClassDoc usedClass = content[i]; Set<ClassDoc> usingClasses = mapper.classToClass.get(usedClass.qualifiedName()); if (usingClasses != null) { - for (Iterator it = usingClasses.iterator(); it.hasNext(); ) { - ClassDoc usingClass = (ClassDoc)it.next(); + for (Iterator<ClassDoc> it = usingClasses.iterator(); it.hasNext(); ) { + ClassDoc usingClass = it.next(); PackageDoc usingPackage = usingClass.containingPackage(); Set<ClassDoc> usedClasses = usingPackageToUsedClasses .get(usingPackage.name()); @@ -136,9 +136,9 @@ public class PackageUseWriter extends SubWriterHolderWriter { printText("doclet.ClassUse_Packages.that.use.0", getPackageLink(pkgdoc, Util.getPackageName(pkgdoc), false)); tableHeaderEnd(); - Iterator it = usingPackageToUsedClasses.keySet().iterator(); + Iterator<String> it = usingPackageToUsedClasses.keySet().iterator(); while (it.hasNext()) { - PackageDoc pkg = configuration.root.packageNamed((String)it.next()); + PackageDoc pkg = configuration.root.packageNamed(it.next()); generatePackageUse(pkg); } tableEnd(); @@ -147,9 +147,9 @@ public class PackageUseWriter extends SubWriterHolderWriter { } protected void generateClassList() throws IOException { - Iterator itp = usingPackageToUsedClasses.keySet().iterator(); + Iterator<String> itp = usingPackageToUsedClasses.keySet().iterator(); while (itp.hasNext()) { - String packageName = (String)itp.next(); + String packageName = itp.next(); PackageDoc usingPackage = configuration.root.packageNamed(packageName); if (usingPackage != null) { anchor(usingPackage.name()); @@ -160,11 +160,10 @@ public class PackageUseWriter extends SubWriterHolderWriter { getPackageLink(pkgdoc, Util.getPackageName(pkgdoc), false), getPackageLink(usingPackage,Util.getPackageName(usingPackage), false)); tableHeaderEnd(); - Iterator itc = - ((Collection)usingPackageToUsedClasses.get(packageName)) - .iterator(); + Iterator<ClassDoc> itc = + usingPackageToUsedClasses.get(packageName).iterator(); while (itc.hasNext()) { - printClassRow((ClassDoc)itc.next(), packageName); + printClassRow(itc.next(), packageName); } tableEnd(); space(); diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java index b7941dba07d..11b37b34498 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java @@ -441,13 +441,13 @@ public abstract class Configuration { * @param customTagStrs the set two dimentional arrays of strings. These arrays contain * either -tag or -taglet arguments. */ - private void initTagletManager(Set customTagStrs) { + private void initTagletManager(Set<String[]> customTagStrs) { tagletManager = tagletManager == null ? new TagletManager(nosince, showversion, showauthor, message) : tagletManager; String[] args; - for (Iterator it = customTagStrs.iterator(); it.hasNext(); ) { - args = (String[]) it.next(); + for (Iterator<String[]> it = customTagStrs.iterator(); it.hasNext(); ) { + args = it.next(); if (args[0].equals("-taglet")) { tagletManager.addCustomTag(args[1], tagletpath); continue; diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/ConstantsSummaryWriter.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/ConstantsSummaryWriter.java index 5fd2cf4d331..ae6a5b3f500 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/ConstantsSummaryWriter.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/ConstantsSummaryWriter.java @@ -103,7 +103,7 @@ public interface ConstantsSummaryWriter { * @param cd the class whose constants are being documented. * @param fields the constants being documented. */ - public abstract void writeConstantMembers(ClassDoc cd, List fields); + public abstract void writeConstantMembers(ClassDoc cd, List<FieldDoc> fields); /** * Document the given constants. diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java index 7f9a5c35ae0..59b6659af28 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java @@ -97,22 +97,22 @@ public abstract class AbstractBuilder { * @param elements the XML elements that specify which components to * document. */ - protected void build(List elements) { + protected void build(List<?> elements) { for (int i = 0; i < elements.size(); i++ ) { Object element = elements.get(i); String component = (String) ((element instanceof String) ? element : - ((List) element).get(0)); + ((List<?>) element).get(0)); try { invokeMethod("build" + component, element instanceof String ? - new Class[] {} : - new Class[] {List.class}, + new Class<?>[] {} : + new Class<?>[] {List.class}, element instanceof String ? new Object[] {} : - new Object[] {((List) element).subList(1, - ((List) element).size())}); + new Object[] {((List<?>) element).subList(1, + ((List<?>) element).size())}); } catch (NoSuchMethodException e) { e.printStackTrace(); configuration.root.printError("Unknown element: " + component); @@ -138,7 +138,7 @@ public abstract class AbstractBuilder { * @param paramClasses the types for each parameter. * @param params the parameters of the method. */ - protected abstract void invokeMethod(String methodName, Class[] paramClasses, + protected abstract void invokeMethod(String methodName, Class<?>[] paramClasses, Object[] params) throws Exception; } diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractMemberBuilder.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractMemberBuilder.java index f98a95c93d4..f353d1085b7 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractMemberBuilder.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractMemberBuilder.java @@ -69,7 +69,7 @@ public abstract class AbstractMemberBuilder extends AbstractBuilder { * * @param elements {@inheritDoc} */ - public void build(List elements) { + public void build(List<?> elements) { if (hasMembersToDocument()) { super.build(elements); } diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java index 7442b0968fc..bb1f9307858 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java @@ -92,7 +92,7 @@ public class AnnotationTypeBuilder extends AbstractBuilder { /** * {@inheritDoc} */ - public void invokeMethod(String methodName, Class[] paramClasses, + public void invokeMethod(String methodName, Class<?>[] paramClasses, Object[] params) throws Exception { if (DEBUG) { @@ -122,7 +122,7 @@ public class AnnotationTypeBuilder extends AbstractBuilder { * * @param elements the XML elements that specify how to document a class. */ - public void buildAnnotationTypeDoc(List elements) throws Exception { + public void buildAnnotationTypeDoc(List<?> elements) throws Exception { build(elements); writer.close(); copyDocFiles(); @@ -197,7 +197,7 @@ public class AnnotationTypeBuilder extends AbstractBuilder { * @param elements the XML elements that specify how a member summary is * documented. */ - public void buildMemberSummary(List elements) throws Exception { + public void buildMemberSummary(List<?> elements) throws Exception { configuration.getBuilderFactory(). getMemberSummaryBuilder(writer).build(elements); writer.completeMemberSummaryBuild(); @@ -209,7 +209,7 @@ public class AnnotationTypeBuilder extends AbstractBuilder { * @param elements the XML elements that specify how a annotation type * members are documented. */ - public void buildAnnotationTypeOptionalMemberDetails(List elements) + public void buildAnnotationTypeOptionalMemberDetails(List<?> elements) throws Exception { configuration.getBuilderFactory(). getAnnotationTypeOptionalMemberBuilder(writer).build(elements); @@ -221,7 +221,7 @@ public class AnnotationTypeBuilder extends AbstractBuilder { * @param elements the XML elements that specify how a annotation type * members are documented. */ - public void buildAnnotationTypeRequiredMemberDetails(List elements) + public void buildAnnotationTypeRequiredMemberDetails(List<?> elements) throws Exception { configuration.getBuilderFactory(). getAnnotationTypeRequiredMemberBuilder(writer).build(elements); diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeOptionalMemberBuilder.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeOptionalMemberBuilder.java index 5a85eed173f..54dbe4e6619 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeOptionalMemberBuilder.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeOptionalMemberBuilder.java @@ -95,7 +95,7 @@ public class AnnotationTypeOptionalMemberBuilder extends * @param elements the XML elements that specify how to construct this * documentation. */ - public void buildAnnotationTypeOptionalMember(List elements) { + public void buildAnnotationTypeOptionalMember(List<?> elements) { if (writer == null) { return; } @@ -108,7 +108,7 @@ public class AnnotationTypeOptionalMemberBuilder extends /** * {@inheritDoc} */ - public void invokeMethod(String methodName, Class[] paramClasses, + public void invokeMethod(String methodName, Class<?>[] paramClasses, Object[] params) throws Exception { if (DEBUG) { diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java index 70ae9961191..3b891a4a4fb 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java @@ -116,7 +116,7 @@ public class AnnotationTypeRequiredMemberBuilder extends AbstractMemberBuilder { /** * {@inheritDoc} */ - public void invokeMethod(String methodName, Class[] paramClasses, + public void invokeMethod(String methodName, Class<?>[] paramClasses, Object[] params) throws Exception { if (DEBUG) { @@ -135,7 +135,7 @@ public class AnnotationTypeRequiredMemberBuilder extends AbstractMemberBuilder { * @param classDoc the {@link ClassDoc} we want to check. * @return a list of members that will be documented. */ - public List members(ClassDoc classDoc) { + public List<ProgramElementDoc> members(ClassDoc classDoc) { return visibleMemberMap.getMembersFor(classDoc); } @@ -161,7 +161,7 @@ public class AnnotationTypeRequiredMemberBuilder extends AbstractMemberBuilder { * @param elements the XML elements that specify how to construct this * documentation. */ - public void buildAnnotationTypeRequiredMember(List elements) { + public void buildAnnotationTypeRequiredMember(List<?> elements) { if (writer == null) { return; } diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java index 908746e2622..0cde79b17a1 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java @@ -108,7 +108,7 @@ public class ClassBuilder extends AbstractBuilder { /** * {@inheritDoc} */ - public void invokeMethod(String methodName, Class[] paramClasses, + public void invokeMethod(String methodName, Class<?>[] paramClasses, Object[] params) throws Exception { if (DEBUG) { @@ -138,7 +138,7 @@ public class ClassBuilder extends AbstractBuilder { * * @param elements the XML elements that specify how to document a class. */ - public void buildClassDoc(List elements) throws Exception { + public void buildClassDoc(List<?> elements) throws Exception { build(elements); writer.close(); copyDocFiles(); @@ -293,7 +293,7 @@ public class ClassBuilder extends AbstractBuilder { * @param elements the XML elements that specify how a member summary is * documented. */ - public void buildMemberSummary(List elements) throws Exception { + public void buildMemberSummary(List<?> elements) throws Exception { configuration.getBuilderFactory(). getMemberSummaryBuilder(writer).build(elements); writer.completeMemberSummaryBuild(); @@ -305,7 +305,7 @@ public class ClassBuilder extends AbstractBuilder { * @param elements the XML elements that specify how a enum constants are * documented. */ - public void buildEnumConstantsDetails(List elements) throws Exception { + public void buildEnumConstantsDetails(List<?> elements) throws Exception { configuration.getBuilderFactory(). getEnumConstantsBuilder(writer).build(elements); } @@ -315,7 +315,7 @@ public class ClassBuilder extends AbstractBuilder { * * @param elements the XML elements that specify how a field is documented. */ - public void buildFieldDetails(List elements) throws Exception { + public void buildFieldDetails(List<?> elements) throws Exception { configuration.getBuilderFactory(). getFieldBuilder(writer).build(elements); } @@ -326,7 +326,7 @@ public class ClassBuilder extends AbstractBuilder { * @param elements the XML elements that specify how to document a * constructor. */ - public void buildConstructorDetails(List elements) throws Exception { + public void buildConstructorDetails(List<?> elements) throws Exception { configuration.getBuilderFactory(). getConstructorBuilder(writer).build(elements); } @@ -336,7 +336,7 @@ public class ClassBuilder extends AbstractBuilder { * * @param elements the XML elements that specify how a method is documented. */ - public void buildMethodDetails(List elements) throws Exception { + public void buildMethodDetails(List<?> elements) throws Exception { configuration.getBuilderFactory(). getMethodBuilder(writer).build(elements); } diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java index ca26c7e4f0c..591d5d1ef1c 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java @@ -109,7 +109,7 @@ public class ConstantsSummaryBuilder extends AbstractBuilder { /** * {@inheritDoc} */ - public void invokeMethod(String methodName, Class[] paramClasses, + public void invokeMethod(String methodName, Class<?>[] paramClasses, Object[] params) throws Exception { if (DEBUG) { @@ -144,7 +144,7 @@ public class ConstantsSummaryBuilder extends AbstractBuilder { * @param elements the list of elements describing constant summary * documentation. */ - public void buildConstantSummary(List elements) throws Exception { + public void buildConstantSummary(List<?> elements) throws Exception { build(elements); writer.close(); } @@ -186,7 +186,7 @@ public class ConstantsSummaryBuilder extends AbstractBuilder { * @param elements the XML elements that represent the components * of documentation for each package. */ - public void buildConstantSummaries(List elements) { + public void buildConstantSummaries(List<?> elements) { PackageDoc[] packages = configuration.packages; printedPackageHeaders = new HashSet<String>(); for (int i = 0; i < packages.length; i++) { @@ -204,7 +204,7 @@ public class ConstantsSummaryBuilder extends AbstractBuilder { * @param elements the list of XML elements that make up package * documentation. */ - public void buildPackageConstantSummary(List elements) { + public void buildPackageConstantSummary(List<?> elements) { build(elements); } @@ -214,7 +214,7 @@ public class ConstantsSummaryBuilder extends AbstractBuilder { * @param elements the list of XML elements that make up the class * constant summary. */ - public void buildClassConstantSummary(List elements) { + public void buildClassConstantSummary(List<?> elements) { ClassDoc[] classes = currentPackage.name().length() > 0 ? currentPackage.allClasses() : configuration.classDocCatalog.allClasses( @@ -297,8 +297,8 @@ public class ConstantsSummaryBuilder extends AbstractBuilder { private boolean hasConstantField (ClassDoc classDoc) { VisibleMemberMap visibleMemberMapFields = new VisibleMemberMap(classDoc, VisibleMemberMap.FIELDS, configuration.nodeprecated); - List fields = visibleMemberMapFields.getLeafClassMembers(configuration); - for (Iterator iter = fields.iterator(); iter.hasNext(); ) { + List<?> fields = visibleMemberMapFields.getLeafClassMembers(configuration); + for (Iterator<?> iter = fields.iterator(); iter.hasNext(); ) { FieldDoc field = (FieldDoc) iter.next(); if (field.constantValueExpression() != null) { classDocsWithConstFields.add(classDoc); diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java index 6e2e4480228..69e4276a991 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java @@ -138,7 +138,7 @@ public class ConstructorBuilder extends AbstractMemberBuilder { */ public void invokeMethod( String methodName, - Class[] paramClasses, + Class<?>[] paramClasses, Object[] params) throws Exception { if (DEBUG) { @@ -156,7 +156,7 @@ public class ConstructorBuilder extends AbstractMemberBuilder { * * @return a list of constructors that will be documented. */ - public List members(ClassDoc classDoc) { + public List<ProgramElementDoc> members(ClassDoc classDoc) { return visibleMemberMap.getMembersFor(classDoc); } @@ -175,7 +175,7 @@ public class ConstructorBuilder extends AbstractMemberBuilder { * @param elements the XML elements that specify how to construct this * documentation. */ - public void buildConstructorDoc(List elements) { + public void buildConstructorDoc(List<?> elements) { if (writer == null) { return; } diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/EnumConstantBuilder.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/EnumConstantBuilder.java index 0cf2e74dd45..8c545e55ccc 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/EnumConstantBuilder.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/EnumConstantBuilder.java @@ -120,7 +120,7 @@ public class EnumConstantBuilder extends AbstractMemberBuilder { */ public void invokeMethod( String methodName, - Class[] paramClasses, + Class<?>[] paramClasses, Object[] params) throws Exception { if (DEBUG) { @@ -139,7 +139,7 @@ public class EnumConstantBuilder extends AbstractMemberBuilder { * @param classDoc the {@link ClassDoc} we want to check. * @return a list of enum constants that will be documented. */ - public List members(ClassDoc classDoc) { + public List<ProgramElementDoc> members(ClassDoc classDoc) { return visibleMemberMap.getMembersFor(classDoc); } @@ -165,7 +165,7 @@ public class EnumConstantBuilder extends AbstractMemberBuilder { * @param elements the XML elements that specify how to construct this * documentation. */ - public void buildEnumConstant(List elements) { + public void buildEnumConstant(List<?> elements) { if (writer == null) { return; } diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/FieldBuilder.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/FieldBuilder.java index bbee61b7aa1..19604e8e2ce 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/FieldBuilder.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/FieldBuilder.java @@ -121,7 +121,7 @@ public class FieldBuilder extends AbstractMemberBuilder { */ public void invokeMethod( String methodName, - Class[] paramClasses, + Class<?>[] paramClasses, Object[] params) throws Exception { if (DEBUG) { @@ -140,7 +140,7 @@ public class FieldBuilder extends AbstractMemberBuilder { * @param classDoc the {@link ClassDoc} we want to check. * @return a list of fields that will be documented. */ - public List members(ClassDoc classDoc) { + public List<ProgramElementDoc> members(ClassDoc classDoc) { return visibleMemberMap.getMembersFor(classDoc); } @@ -166,7 +166,7 @@ public class FieldBuilder extends AbstractMemberBuilder { * @param elements the XML elements that specify how to construct this * documentation. */ - public void buildFieldDoc(List elements) { + public void buildFieldDoc(List<?> elements) { if (writer == null) { return; } diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/LayoutParser.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/LayoutParser.java index 810ddb5614f..874c2cef79f 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/LayoutParser.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/LayoutParser.java @@ -78,9 +78,9 @@ public class LayoutParser extends DefaultHandler { * * @return List the list of XML elements parsed. */ - public List parseXML(String root) { + public List<?> parseXML(String root) { if (xmlElementsMap.containsKey(root)) { - return (List) xmlElementsMap.get(root); + return xmlElementsMap.get(root); } try { List<Object> xmlElements = new ArrayList<Object>(); diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java index 27d0cd8e8dd..fad6e3a4302 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java @@ -170,7 +170,7 @@ public class MemberSummaryBuilder extends AbstractMemberBuilder { * @return a list of methods that will be documented. * @see VisibleMemberMap */ - public List members(int type) { + public List<ProgramElementDoc> members(int type) { return visibleMemberMaps[type].getLeafClassMembers(configuration); } @@ -179,7 +179,7 @@ public class MemberSummaryBuilder extends AbstractMemberBuilder { */ public void invokeMethod( String methodName, - Class[] paramClasses, + Class<?>[] paramClasses, Object[] params) throws Exception { if (DEBUG) { @@ -339,9 +339,9 @@ public class MemberSummaryBuilder extends AbstractMemberBuilder { */ private void buildInheritedSummary(MemberSummaryWriter writer, VisibleMemberMap visibleMemberMap) { - for (Iterator iter = visibleMemberMap.getVisibleClassesList().iterator(); + for (Iterator<ClassDoc> iter = visibleMemberMap.getVisibleClassesList().iterator(); iter.hasNext();) { - ClassDoc inhclass = (ClassDoc) (iter.next()); + ClassDoc inhclass = iter.next(); if (! (inhclass.isPublic() || Util.isLinkable(inhclass, configuration))) { continue; diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java index 36a3cea3672..9ede7c5fc96 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java @@ -116,7 +116,7 @@ public class MethodBuilder extends AbstractMemberBuilder { */ public void invokeMethod( String methodName, - Class[] paramClasses, + Class<?>[] paramClasses, Object[] params) throws Exception { if (DEBUG) { @@ -135,7 +135,7 @@ public class MethodBuilder extends AbstractMemberBuilder { * @param classDoc the {@link ClassDoc} we want to check. * @return a list of methods that will be documented. */ - public List members(ClassDoc classDoc) { + public List<ProgramElementDoc> members(ClassDoc classDoc) { return visibleMemberMap.getMembersFor(classDoc); } @@ -158,7 +158,7 @@ public class MethodBuilder extends AbstractMemberBuilder { /** * Build the method documentation. */ - public void buildMethodDoc(List elements) { + public void buildMethodDoc(List<?> elements) { if (writer == null) { return; } diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java index 262f0a3f86e..c85b0b30b8d 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java @@ -88,7 +88,7 @@ public class PackageSummaryBuilder extends AbstractBuilder { */ public void invokeMethod( String methodName, - Class[] paramClasses, + Class<?>[] paramClasses, Object[] params) throws Exception { if (DEBUG) { @@ -120,7 +120,7 @@ public class PackageSummaryBuilder extends AbstractBuilder { /** * Build the package documentation. */ - public void buildPackageDoc(List elements) throws Exception { + public void buildPackageDoc(List<?> elements) throws Exception { build(elements); packageWriter.close(); Util.copyDocFiles( @@ -162,7 +162,7 @@ public class PackageSummaryBuilder extends AbstractBuilder { /** * Build the package summary. */ - public void buildSummary(List elements) { + public void buildSummary(List<?> elements) { build(elements); } diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java index a7c9822a043..7f025b6ff5b 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java @@ -130,7 +130,7 @@ public class SerializedFormBuilder extends AbstractBuilder { /** * Build the serialized form. */ - public void buildSerializedForm(List elements) throws Exception { + public void buildSerializedForm(List<?> elements) throws Exception { build(elements); writer.close(); } @@ -138,7 +138,7 @@ public class SerializedFormBuilder extends AbstractBuilder { /** * {@inheritDoc} */ - public void invokeMethod(String methodName, Class[] paramClasses, + public void invokeMethod(String methodName, Class<?>[] paramClasses, Object[] params) throws Exception { if (DEBUG) { @@ -159,7 +159,7 @@ public class SerializedFormBuilder extends AbstractBuilder { /** * Build the contents. */ - public void buildSerializedFormSummaries(List elements) { + public void buildSerializedFormSummaries(List<?> elements) { PackageDoc[] packages = configuration.packages; for (int i = 0; i < packages.length; i++) { currentPackage = packages[i]; @@ -170,7 +170,7 @@ public class SerializedFormBuilder extends AbstractBuilder { /** * Build the package serialized for for the current package being processed. */ - public void buildPackageSerializedForm(List elements) { + public void buildPackageSerializedForm(List<?> elements) { String foo = currentPackage.name(); ClassDoc[] classes = currentPackage.allClasses(false); if (classes == null || classes.length == 0) { @@ -189,7 +189,7 @@ public class SerializedFormBuilder extends AbstractBuilder { writer.writePackageHeader(Util.getPackageName(currentPackage)); } - public void buildClassSerializedForm(List elements) { + public void buildClassSerializedForm(List<?> elements) { ClassDoc[] classes = currentPackage.allClasses(false); Arrays.sort(classes); for (int j = 0; j < classes.length; j++) { @@ -368,7 +368,7 @@ public class SerializedFormBuilder extends AbstractBuilder { /** * build the information for the method. */ - public void buildMethodInfo(List elements) { + public void buildMethodInfo(List<?> elements) { if(configuration.nocomment){ return; } @@ -478,7 +478,7 @@ public class SerializedFormBuilder extends AbstractBuilder { * Build the summaries for the methods that belong to the given * class. */ - public void buildSerializableMethods(List elements) { + public void buildSerializableMethods(List<?> elements) { MemberDoc[] members = currentClass.serializationMethods(); if (members.length > 0) { for (int i = 0; i < members.length; i++) { @@ -492,7 +492,7 @@ public class SerializedFormBuilder extends AbstractBuilder { * Build the summaries for the fields that belong to the given * class. */ - public void buildSerializableFields(List elements) { + public void buildSerializableFields(List<?> elements) { MemberDoc[] members = currentClass.serializableFields(); if (members.length > 0) { for (int i = 0; i < members.length; i++) { diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ParamTaglet.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ParamTaglet.java index fb9690d16ef..6350bed7f25 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ParamTaglet.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ParamTaglet.java @@ -100,7 +100,7 @@ public class ParamTaglet extends BaseTaglet implements InheritableTaglet { } ParamTag[] tags = input.isTypeVariableParamTag ? input.method.typeParamTags() : input.method.paramTags(); - Map rankMap = getRankMap(input.isTypeVariableParamTag ? + Map<String, String> rankMap = getRankMap(input.isTypeVariableParamTag ? (Object[]) input.method.typeParameters() : (Object[]) input.method.parameters()); for (int i = 0; i < tags.length; i++) { @@ -262,7 +262,7 @@ public class ParamTaglet extends BaseTaglet implements InheritableTaglet { * @return the TagletOutput representation of this <code>Tag</code>. */ private TagletOutput processParamTags(boolean isNonTypeParams, - ParamTag[] paramTags, Map rankMap, TagletWriter writer, + ParamTag[] paramTags, Map<String, String> rankMap, TagletWriter writer, Set<String> alreadyDocumented) { TagletOutput result = writer.getOutputInstance(); if (paramTags.length > 0) { @@ -277,7 +277,7 @@ public class ParamTaglet extends BaseTaglet implements InheritableTaglet { "doclet.Type_Parameters_warn", paramName); } - String rank = (String) rankMap.get(pt.parameterName()); + String rank = rankMap.get(pt.parameterName()); if (rank != null && alreadyDocumented.contains(rank)) { writer.getMsgRetriever().warning(pt.position(), isNonTypeParams ? diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java index 84ff4917f58..9da8cd10649 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java @@ -212,7 +212,7 @@ public class TagletManager { URLClassLoader appClassLoader = new URLClassLoader(pathToURLs(cpString)); customTagClass = appClassLoader.loadClass(classname); Method meth = customTagClass.getMethod("register", - new Class[] {Class.forName("java.util.Map")}); + new Class<?>[] {java.util.Map.class}); Object[] list = customTags.values().toArray(); Taglet lastTag = (list != null && list.length > 0) ? (Taglet) list[list.length-1] : null; @@ -705,9 +705,9 @@ public class TagletManager { * Initialize lowercase version of standard Javadoc tags. */ private void initStandardTagsLowercase() { - Iterator it = standardTags.iterator(); + Iterator<String> it = standardTags.iterator(); while (it.hasNext()) { - standardTagsLowercase.add(((String)it.next()).toLowerCase()); + standardTagsLowercase.add(it.next().toLowerCase()); } } diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassTree.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassTree.java index dd57ba843a6..3d7c1176800 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassTree.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassTree.java @@ -177,9 +177,9 @@ public class ClassTree { bases.add(cd); } } - List intfacs = Util.getAllInterfaces(cd, configuration); - for (Iterator iter = intfacs.iterator(); iter.hasNext();) { - add(implementingclasses, ((Type) iter.next()).asClassDoc(), cd); + List<Type> intfacs = Util.getAllInterfaces(cd, configuration); + for (Iterator<Type> iter = intfacs.iterator(); iter.hasNext();) { + add(implementingclasses, iter.next().asClassDoc(), cd); } } @@ -278,13 +278,13 @@ public class ClassTree { //If class x implements a subinterface of cd, then it follows //that class x implements cd. - Iterator implementingClassesIter, subInterfacesIter = subinterfaces.listIterator(); + Iterator<ClassDoc> implementingClassesIter, subInterfacesIter = subinterfaces.listIterator(); ClassDoc c; while(subInterfacesIter.hasNext()){ - implementingClassesIter = implementingclasses((ClassDoc) + implementingClassesIter = implementingclasses( subInterfacesIter.next()).listIterator(); while(implementingClassesIter.hasNext()){ - c = (ClassDoc)implementingClassesIter.next(); + c = implementingClassesIter.next(); if(! result.contains(c)){ result.add(c); } @@ -328,9 +328,9 @@ public class ClassTree { List<ClassDoc> list = subs(cd, isEnum); for (int i = 0; i < list.size(); i++) { cd = list.get(i); - List tlist = subs(cd, isEnum); + List<ClassDoc> tlist = subs(cd, isEnum); for (int j = 0; j < tlist.size(); j++) { - ClassDoc tcd = (ClassDoc)tlist.get(j); + ClassDoc tcd = tlist.get(j); if (!list.contains(tcd)) { list.add(tcd); } @@ -345,7 +345,7 @@ public class ClassTree { * thw classdoc for java.lang.Object, since this is the base class for all * classes. */ - public List baseclasses() { + public List<ClassDoc> baseclasses() { return baseclasses; } @@ -353,7 +353,7 @@ public class ClassTree { * Return the list of base interfaces. This is the list of interfaces * which do not have super-interface. */ - public List baseinterfaces() { + public List<ClassDoc> baseinterfaces() { return baseinterfaces; } @@ -361,7 +361,7 @@ public class ClassTree { * Return the list of base enums. This is the list of enums * which do not have super-enums. */ - public List baseEnums() { + public List<ClassDoc> baseEnums() { return baseEnums; } @@ -369,7 +369,7 @@ public class ClassTree { * Return the list of base annotation types. This is the list of * annotation types which do not have super-annotation types. */ - public List baseAnnotationTypes() { + public List<ClassDoc> baseAnnotationTypes() { return baseAnnotationTypes; } } diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassUseMapper.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassUseMapper.java index 79f950c1266..5dbe9c3182c 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassUseMapper.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassUseMapper.java @@ -184,12 +184,12 @@ public class ClassUseMapper { this.classtree = classtree; // Map subclassing, subinterfacing implementing, ... - for (Iterator it = classtree.baseclasses().iterator(); it.hasNext();) { - subclasses((ClassDoc)it.next()); + for (Iterator<ClassDoc> it = classtree.baseclasses().iterator(); it.hasNext();) { + subclasses(it.next()); } - for (Iterator it = classtree.baseinterfaces().iterator(); it.hasNext();) { + for (Iterator<ClassDoc> it = classtree.baseinterfaces().iterator(); it.hasNext();) { // does subinterfacing as side-effect - implementingClasses((ClassDoc)it.next()); + implementingClasses(it.next()); } // Map methods, fields, constructors using a class. ClassDoc[] classes = root.classes(); @@ -279,12 +279,12 @@ public class ClassUseMapper { List<ClassDoc> impl = classtree.implementingclasses(cd); if (impl != null) { ret.addAll(impl); - for (Iterator it = impl.iterator(); it.hasNext();) { - ret.addAll(subclasses((ClassDoc)it.next())); + for (Iterator<ClassDoc> it = impl.iterator(); it.hasNext();) { + ret.addAll(subclasses(it.next())); } } - for (Iterator it = subinterfaces(cd).iterator(); it.hasNext();) { - ret.addAll(implementingClasses((ClassDoc)it.next())); + for (Iterator<ClassDoc> it = subinterfaces(cd).iterator(); it.hasNext();) { + ret.addAll(implementingClasses(it.next())); } addAll(classToImplementingClass, cd, ret); } @@ -328,8 +328,7 @@ public class ClassUseMapper { private <T> List<T> refList(Map<String,List<T>> map, ClassDoc cd) { List<T> list = map.get(cd.qualifiedName()); if (list == null) { - @SuppressWarnings("unchecked") - List<T> l = new ArrayList(); + List<T> l = new ArrayList<T>(); list = l; map.put(cd.qualifiedName(), list); } @@ -348,8 +347,7 @@ public class ClassUseMapper { private Set<ClassDoc> classSet(ClassDoc cd) { Set<ClassDoc> clsSet = classToClass.get(cd.qualifiedName()); if (clsSet == null) { - @SuppressWarnings("unchecked") - Set<ClassDoc> s = new TreeSet(); + Set<ClassDoc> s = new TreeSet<ClassDoc>(); clsSet = s; classToClass.put(cd.qualifiedName(), clsSet); } diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Group.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Group.java index d5c91f36861..56ca868876e 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Group.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Group.java @@ -152,7 +152,7 @@ public class Group { * * @return true if package name format found in the map, else false. */ - boolean foundGroupFormat(Map map, String pkgFormat) { + boolean foundGroupFormat(Map<String,?> map, String pkgFormat) { if (map.containsKey(pkgFormat)) { configuration.message.error("doclet.Same_package_name_used", pkgFormat); return true; @@ -239,7 +239,7 @@ public class Group { * Return the list of groups, in the same order as specified * on the command line. */ - public List getGroupList() { + public List<String> getGroupList() { return groupList; } } diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ImplementedMethods.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ImplementedMethods.java index 23798038fa9..5619512f20e 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ImplementedMethods.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ImplementedMethods.java @@ -86,9 +86,9 @@ public class ImplementedMethods { * from the array passed. */ private void buildImplementedMethodList(boolean sort) { - List intfacs = Util.getAllInterfaces(classdoc, configuration, sort); - for (Iterator iter = intfacs.iterator(); iter.hasNext(); ) { - Type interfaceType = (Type) iter.next(); + List<Type> intfacs = Util.getAllInterfaces(classdoc, configuration, sort); + for (Iterator<Type> iter = intfacs.iterator(); iter.hasNext(); ) { + Type interfaceType = iter.next(); MethodDoc found = Util.findMethod(interfaceType.asClassDoc(), method); if (found != null) { removeOverriddenMethod(found); diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/IndexBuilder.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/IndexBuilder.java index aae0385a107..1fe28ad1c5c 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/IndexBuilder.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/IndexBuilder.java @@ -114,7 +114,7 @@ public class IndexBuilder { this.noDeprecated = noDeprecated; this.classesOnly = classesOnly; buildIndexMap(configuration.root); - Set set = indexmap.keySet(); + Set<Character> set = indexmap.keySet(); elements = set.toArray(); Arrays.sort(elements); } @@ -215,7 +215,7 @@ public class IndexBuilder { * * @return Map index map. */ - public Map getIndexMap() { + public Map<Character,List<Doc>> getIndexMap() { return indexmap; } @@ -225,8 +225,8 @@ public class IndexBuilder { * @param index index Unicode character. * @return List member list for specific Unicode character. */ - public List getMemberList(Character index) { - return (List)indexmap.get(index); + public List<Doc> getMemberList(Character index) { + return indexmap.get(index); } /** diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java index 1b00c2b2f7d..9b7b668b6c0 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java @@ -88,10 +88,10 @@ public class Util { /** * Return the list of ProgramElementDoc objects as Array. */ - public static ProgramElementDoc[] toProgramElementDocArray(List list) { + public static ProgramElementDoc[] toProgramElementDocArray(List<ProgramElementDoc> list) { ProgramElementDoc[] pgmarr = new ProgramElementDoc[list.size()]; for (int i = 0; i < list.size(); i++) { - pgmarr[i] = (ProgramElementDoc)(list.get(i)); + pgmarr[i] = list.get(i); } return pgmarr; } @@ -416,9 +416,9 @@ public class Util { continue; } results.put(interfaceClassDoc, interfaceType); - List superInterfaces = getAllInterfaces(interfaceType, configuration, sort); - for (Iterator iter = superInterfaces.iterator(); iter.hasNext(); ) { - Type t = (Type) iter.next(); + List<Type> superInterfaces = getAllInterfaces(interfaceType, configuration, sort); + for (Iterator<Type> iter = superInterfaces.iterator(); iter.hasNext(); ) { + Type t = iter.next(); results.put(t.asClassDoc(), t); } } @@ -438,7 +438,7 @@ public class Util { return resultsList; } - public static List getAllInterfaces(Type type, Configuration configuration) { + public static List<Type> getAllInterfaces(Type type, Configuration configuration) { return getAllInterfaces(type, configuration, true); } @@ -480,9 +480,9 @@ public class Util { if (raw) interfaceType = interfaceType.asClassDoc(); results.put(interfaceClassDoc, interfaceType); - List superInterfaces = getAllInterfaces(interfaceType, configuration); - for (Iterator iter = superInterfaces.iterator(); iter.hasNext(); ) { - Type superInterface = (Type) iter.next(); + List<Type> superInterfaces = getAllInterfaces(interfaceType, configuration); + for (Iterator<Type> iter = superInterfaces.iterator(); iter.hasNext(); ) { + Type superInterface = iter.next(); results.put(superInterface.asClassDoc(), superInterface); } } @@ -495,8 +495,8 @@ public class Util { } - public static List<ProgramElementDoc> asList(ProgramElementDoc[] members) { - List<ProgramElementDoc> list = new ArrayList<ProgramElementDoc>(); + public static <T extends ProgramElementDoc> List<T> asList(T[] members) { + List<T> list = new ArrayList<T>(); for (int i = 0; i < members.length; i++) { list.add(members[i]); } diff --git a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java index 7f43884d598..f76d6651563 100644 --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java @@ -116,7 +116,7 @@ public class VisibleMemberMap { * * @return the list of visible classes in this map. */ - public List getVisibleClassesList() { + public List<ClassDoc> getVisibleClassesList() { sort(visibleClasses); return visibleClasses; } @@ -130,8 +130,8 @@ public class VisibleMemberMap { */ private List<ProgramElementDoc> getInheritedPackagePrivateMethods(Configuration configuration) { List<ProgramElementDoc> results = new ArrayList<ProgramElementDoc>(); - for (Iterator iter = visibleClasses.iterator(); iter.hasNext(); ) { - ClassDoc currentClass = (ClassDoc) iter.next(); + for (Iterator<ClassDoc> iter = visibleClasses.iterator(); iter.hasNext(); ) { + ClassDoc currentClass = iter.next(); if (currentClass != classdoc && currentClass.isPackagePrivate() && !Util.isLinkable(currentClass, configuration)) { @@ -203,10 +203,10 @@ public class VisibleMemberMap { } } - private void purgeMemberLevelMap(List list, String level) { + private void purgeMemberLevelMap(List<ProgramElementDoc> list, String level) { for (int i = 0; i < list.size(); i++) { - Object key = getMemberKey((ProgramElementDoc)list.get(i)); - Map memberLevelMap = (Map) memberNameMap.get(key); + Object key = getMemberKey(list.get(i)); + Map<ProgramElementDoc, String> memberLevelMap = memberNameMap.get(key); if (level.equals(memberLevelMap.get(list.get(i)))) memberLevelMap.remove(list.get(i)); } @@ -230,7 +230,7 @@ public class VisibleMemberMap { } public boolean isEqual(MethodDoc member) { - for (Iterator iter = members.iterator(); iter.hasNext(); ) { + for (Iterator<ProgramElementDoc> iter = members.iterator(); iter.hasNext(); ) { MethodDoc member2 = (MethodDoc) iter.next(); if (Util.executableMembersEqual(member, member2)) { members.add(member); @@ -438,9 +438,9 @@ public class VisibleMemberMap { return targetMembers.toArray(new AnnotationTypeElementDoc[]{}); } - private boolean found(List list, ProgramElementDoc elem) { + private boolean found(List<ProgramElementDoc> list, ProgramElementDoc elem) { for (int i = 0; i < list.size(); i++) { - ProgramElementDoc pgmelem = (ProgramElementDoc)list.get(i); + ProgramElementDoc pgmelem = list.get(i); if (Util.matches(pgmelem, elem)) { return true; } @@ -455,13 +455,13 @@ public class VisibleMemberMap { * level "111". */ private boolean isOverridden(ProgramElementDoc pgmdoc, String level) { - Map memberLevelMap = (Map) memberNameMap.get(getMemberKey(pgmdoc)); + Map<?,String> memberLevelMap = (Map<?,String>) memberNameMap.get(getMemberKey(pgmdoc)); if (memberLevelMap == null) return false; String mappedlevel = null; - Iterator iterator = memberLevelMap.values().iterator(); + Iterator<String> iterator = memberLevelMap.values().iterator(); while (iterator.hasNext()) { - mappedlevel = (String)(iterator.next()); + mappedlevel = iterator.next(); if (mappedlevel.equals(STARTLEVEL) || (level.startsWith(mappedlevel) && !level.equals(mappedlevel))) { @@ -482,7 +482,7 @@ public class VisibleMemberMap { } private ClassMember getClassMember(MethodDoc member) { - for (Iterator iter = memberNameMap.keySet().iterator(); iter.hasNext();) { + for (Iterator<?> iter = memberNameMap.keySet().iterator(); iter.hasNext();) { Object key = iter.next(); if (key instanceof String) { continue; diff --git a/langtools/src/share/classes/com/sun/tools/javac/Main.java b/langtools/src/share/classes/com/sun/tools/javac/Main.java index fab28bc5d16..a5b84f1e150 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/Main.java +++ b/langtools/src/share/classes/com/sun/tools/javac/Main.java @@ -56,7 +56,7 @@ public class Main { if (args.length > 0 && args[0].equals("-Xjdb")) { String[] newargs = new String[args.length + 2]; Class<?> c = Class.forName("com.sun.tools.example.debug.tty.TTY"); - Method method = c.getDeclaredMethod ("main", new Class[] {args.getClass()}); + Method method = c.getDeclaredMethod ("main", new Class<?>[] {args.getClass()}); method.setAccessible(true); System.arraycopy(args, 1, newargs, 3, args.length - 1); newargs[0] = "-connect"; diff --git a/langtools/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java b/langtools/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java index 65e3cf6f465..d8ccc0211fd 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java +++ b/langtools/src/share/classes/com/sun/tools/javac/file/JavacFileManager.java @@ -949,8 +949,8 @@ public class JavacFileManager implements StandardJavaFileManager { Iterable<? extends File> files) { ArrayList<RegularFileObject> result; - if (files instanceof Collection) - result = new ArrayList<RegularFileObject>(((Collection)files).size()); + if (files instanceof Collection<?>) + result = new ArrayList<RegularFileObject>(((Collection<?>)files).size()); else result = new ArrayList<RegularFileObject>(); for (File f: files) diff --git a/langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java b/langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java index 2637252e9e4..8a7f6508c4f 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java +++ b/langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java @@ -1114,7 +1114,7 @@ public class ZipFileIndex { writtenSoFar += dirNameBytesLen; // Write the number of files in the dir - List dirEntries = dirEntry.getEntriesAsCollection(); + List<Entry> dirEntries = dirEntry.getEntriesAsCollection(); raf.writeInt(dirEntries.size()); writtenSoFar += 4; diff --git a/langtools/src/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java b/langtools/src/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java index def2d98dd49..acd6d99d5ff 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java +++ b/langtools/src/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java @@ -215,15 +215,15 @@ public class AnnotationProxyMaker { } } - @SuppressWarnings("unchecked") + @SuppressWarnings({"unchecked", "rawtypes"}) public void visitEnum(Attribute.Enum e) { if (returnClass.isEnum()) { String constName = e.value.toString(); try { - value = Enum.valueOf((Class) returnClass, constName); + value = Enum.valueOf((Class)returnClass, constName); } catch (IllegalArgumentException ex) { value = new EnumConstantNotPresentExceptionProxy( - (Class) returnClass, constName); + (Class<Enum<?>>) returnClass, constName); } } else { value = null; // indicates a type mismatch diff --git a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java index 94944766e83..b6df9605228 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java +++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java @@ -1060,7 +1060,7 @@ public class JavacProcessingEnvironment implements ProcessingEnvironment, Closea next.put(Names.namesKey, names); } - DiagnosticListener dl = context.get(DiagnosticListener.class); + DiagnosticListener<?> dl = context.get(DiagnosticListener.class); if (dl != null) next.put(DiagnosticListener.class, dl); diff --git a/langtools/src/share/classes/com/sun/tools/javac/processing/ServiceProxy.java b/langtools/src/share/classes/com/sun/tools/javac/processing/ServiceProxy.java index c44bf626b4d..856fc6b9d7a 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/processing/ServiceProxy.java +++ b/langtools/src/share/classes/com/sun/tools/javac/processing/ServiceProxy.java @@ -55,12 +55,12 @@ class ServiceProxy { private static final String prefix = "META-INF/services/"; - private static void fail(Class service, String msg) + private static void fail(Class<?> service, String msg) throws ServiceConfigurationError { throw new ServiceConfigurationError(service.getName() + ": " + msg); } - private static void fail(Class service, URL u, int line, String msg) + private static void fail(Class<?> service, URL u, int line, String msg) throws ServiceConfigurationError { fail(service, u + ":" + line + ": " + msg); } @@ -81,7 +81,7 @@ class ServiceProxy { * If an I/O error occurs while reading from the given URL, or * if a configuration-file format error is detected */ - private static boolean parse(Class service, URL u) throws ServiceConfigurationError { + private static boolean parse(Class<?> service, URL u) throws ServiceConfigurationError { InputStream in = null; BufferedReader r = null; try { diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/Context.java b/langtools/src/share/classes/com/sun/tools/javac/util/Context.java index 428d089023e..7e69b410988 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/util/Context.java +++ b/langtools/src/share/classes/com/sun/tools/javac/util/Context.java @@ -116,7 +116,7 @@ public class Context { * We maintain the invariant that this table contains only * mappings of the form * Key<T> -> T or Key<T> -> Factory<T> */ - private Map<Key,Object> ht = new HashMap<Key,Object>(); + private Map<Key<?>,Object> ht = new HashMap<Key<?>,Object>(); /** Set the factory for the key in this context. */ public <T> void put(Key<T> key, Factory<T> fac) { @@ -128,11 +128,11 @@ public class Context { /** Set the value for the key in this context. */ public <T> void put(Key<T> key, T data) { - if (data instanceof Factory) + if (data instanceof Factory<?>) throw new AssertionError("T extends Context.Factory"); checkState(ht); Object old = ht.put(key, data); - if (old != null && !(old instanceof Factory) && old != data && data != null) + if (old != null && !(old instanceof Factory<?>) && old != data && data != null) throw new AssertionError("duplicate context value"); } @@ -140,10 +140,10 @@ public class Context { public <T> T get(Key<T> key) { checkState(ht); Object o = ht.get(key); - if (o instanceof Factory) { - Factory fac = (Factory)o; + if (o instanceof Factory<?>) { + Factory<?> fac = (Factory<?>)o; o = fac.make(); - if (o instanceof Factory) + if (o instanceof Factory<?>) throw new AssertionError("T extends Context.Factory"); assert ht.get(key) == o; } diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/List.java b/langtools/src/share/classes/com/sun/tools/javac/util/List.java index bae88d8003d..c3b36279a87 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/util/List.java +++ b/langtools/src/share/classes/com/sun/tools/javac/util/List.java @@ -71,9 +71,10 @@ public class List<A> extends AbstractCollection<A> implements java.util.List<A> */ @SuppressWarnings("unchecked") public static <A> List<A> nil() { - return EMPTY_LIST; + return (List<A>)EMPTY_LIST; } - private static List EMPTY_LIST = new List<Object>(null,null) { + + private static List<?> EMPTY_LIST = new List<Object>(null,null) { public List<Object> setTail(List<Object> tail) { throw new UnsupportedOperationException(); } @@ -318,7 +319,7 @@ public class List<A> extends AbstractCollection<A> implements java.util.List<A> /** Are the two lists the same? */ - public static boolean equals(List xs, List ys) { + public static boolean equals(List<?> xs, List<?> ys) { while (xs.tail != null && ys.tail != null) { if (xs.head == null) { if (ys.head != null) return false; @@ -368,7 +369,7 @@ public class List<A> extends AbstractCollection<A> implements java.util.List<A> return (List<T>)list; } - private static Iterator EMPTYITERATOR = new Iterator() { + private static Iterator<?> EMPTYITERATOR = new Iterator<Object>() { public boolean hasNext() { return false; } @@ -382,7 +383,7 @@ public class List<A> extends AbstractCollection<A> implements java.util.List<A> @SuppressWarnings("unchecked") private static <A> Iterator<A> emptyIterator() { - return EMPTYITERATOR; + return (Iterator<A>)EMPTYITERATOR; } @Override diff --git a/langtools/src/share/classes/com/sun/tools/javac/util/Pair.java b/langtools/src/share/classes/com/sun/tools/javac/util/Pair.java index c8d983a3aae..623e6d7dae4 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/util/Pair.java +++ b/langtools/src/share/classes/com/sun/tools/javac/util/Pair.java @@ -52,9 +52,9 @@ public class Pair<A, B> { public boolean equals(Object other) { return - other instanceof Pair && - equals(fst, ((Pair)other).fst) && - equals(snd, ((Pair)other).snd); + other instanceof Pair<?,?> && + equals(fst, ((Pair<?,?>)other).fst) && + equals(snd, ((Pair<?,?>)other).snd); } public int hashCode() { diff --git a/langtools/src/share/classes/com/sun/tools/javadoc/DocletInvoker.java b/langtools/src/share/classes/com/sun/tools/javadoc/DocletInvoker.java index 94c2ac5e3e9..698b3cfe965 100644 --- a/langtools/src/share/classes/com/sun/tools/javadoc/DocletInvoker.java +++ b/langtools/src/share/classes/com/sun/tools/javadoc/DocletInvoker.java @@ -88,7 +88,7 @@ public class DocletInvoker { appClassLoader = new URLClassLoader(urls, docletParentClassLoader); // attempt to find doclet - Class dc = null; + Class<?> dc = null; try { dc = appClassLoader.loadClass(docletClassName); } catch (ClassNotFoundException exc) { @@ -104,7 +104,7 @@ public class DocletInvoker { public boolean start(RootDoc root) { Object retVal; String methodName = "start"; - Class[] paramTypes = new Class[1]; + Class<?>[] paramTypes = new Class<?>[1]; Object[] params = new Object[1]; paramTypes[0] = RootDoc.class; params[0] = root; @@ -130,7 +130,7 @@ public class DocletInvoker { public int optionLength(String option) { Object retVal; String methodName = "optionLength"; - Class[] paramTypes = new Class[1]; + Class<?>[] paramTypes = new Class<?>[1]; Object[] params = new Object[1]; paramTypes[0] = option.getClass(); params[0] = option; @@ -157,7 +157,7 @@ public class DocletInvoker { String options[][] = optlist.toArray(new String[optlist.length()][]); String methodName = "validOptions"; DocErrorReporter reporter = messager; - Class[] paramTypes = new Class[2]; + Class<?>[] paramTypes = new Class<?>[2]; Object[] params = new Object[2]; paramTypes[0] = options.getClass(); paramTypes[1] = DocErrorReporter.class; @@ -185,7 +185,7 @@ public class DocletInvoker { try { Object retVal; String methodName = "languageVersion"; - Class[] paramTypes = new Class[0]; + Class<?>[] paramTypes = new Class<?>[0]; Object[] params = new Object[0]; try { retVal = invoke(methodName, JAVA_1_1, paramTypes, params); @@ -208,7 +208,7 @@ public class DocletInvoker { * Utility method for calling doclet functionality */ private Object invoke(String methodName, Object returnValueIfNonExistent, - Class[] paramTypes, Object[] params) + Class<?>[] paramTypes, Object[] params) throws DocletInvokeException { Method meth; try { diff --git a/langtools/src/share/classes/com/sun/tools/javah/Gen.java b/langtools/src/share/classes/com/sun/tools/javah/Gen.java index 6b25569cd78..3ab6f961299 100644 --- a/langtools/src/share/classes/com/sun/tools/javah/Gen.java +++ b/langtools/src/share/classes/com/sun/tools/javah/Gen.java @@ -326,7 +326,7 @@ public abstract class Gen { throws ClassNotFoundException { Vector<FieldDoc> fields = new Vector<FieldDoc>(); ClassDoc cd = null; - Stack s = new Stack(); + Stack<Object> s = new Stack<Object>(); cd = subclazz; while (true) { diff --git a/langtools/src/share/classes/com/sun/tools/javah/LLNI.java b/langtools/src/share/classes/com/sun/tools/javah/LLNI.java index f084ac2273f..8ce59a14e3f 100644 --- a/langtools/src/share/classes/com/sun/tools/javah/LLNI.java +++ b/langtools/src/share/classes/com/sun/tools/javah/LLNI.java @@ -39,7 +39,7 @@ public class LLNI extends Gen { protected final char pathChar = File.separatorChar; protected final char innerDelim = '$'; /* For inner classes */ - protected Hashtable doneHandleTypes; + protected Hashtable<Object, Object> doneHandleTypes; MemberDoc []fields; MemberDoc [] methods; private boolean doubleAlign; @@ -68,7 +68,7 @@ public class LLNI extends Gen { protected void generateDeclsForClass(PrintWriter pw, ClassDoc clazz, String cname) throws ClassNotFoundException { - doneHandleTypes = new Hashtable(); + doneHandleTypes = new Hashtable<Object, Object>(); /* The following handle types are predefined in "typedefs.h". Suppress inclusion in the output by generating them "into the blue" here. */ genHandleType(null, "java.lang.Class"); diff --git a/langtools/src/share/classes/com/sun/tools/javah/TypeSignature.java b/langtools/src/share/classes/com/sun/tools/javah/TypeSignature.java index 25297e9ba31..dde3747279d 100644 --- a/langtools/src/share/classes/com/sun/tools/javah/TypeSignature.java +++ b/langtools/src/share/classes/com/sun/tools/javah/TypeSignature.java @@ -74,7 +74,7 @@ public class TypeSignature{ String signature = null; //Java type signature. String typeSignature = null; //Internal type signature. - Vector params = new Vector(); //List of parameters. + Vector<Object> params = new Vector<Object>(); //List of parameters. String paramsig = null; //Java parameter signature. String paramJVMSig = null; //Internal parameter signature. String returnSig = null; //Java return type signature. diff --git a/langtools/src/share/classes/sun/tools/javap/FieldData.java b/langtools/src/share/classes/sun/tools/javap/FieldData.java index 11d0d59f6d0..94a099d0cc6 100644 --- a/langtools/src/share/classes/sun/tools/javap/FieldData.java +++ b/langtools/src/share/classes/sun/tools/javap/FieldData.java @@ -157,7 +157,7 @@ public class FieldData implements RuntimeConstants { /** * Returns list of attributes of field. */ - public Vector getAttributes(){ + public Vector<?> getAttributes(){ return attrs; } } diff --git a/langtools/src/share/classes/sun/tools/javap/JavapPrinter.java b/langtools/src/share/classes/sun/tools/javap/JavapPrinter.java index b68580c77b9..a587ddc5d15 100644 --- a/langtools/src/share/classes/sun/tools/javap/JavapPrinter.java +++ b/langtools/src/share/classes/sun/tools/javap/JavapPrinter.java @@ -175,7 +175,7 @@ public class JavapPrinter { /* print field attribute information. */ public void printFieldAttributes(FieldData field){ - Vector fieldattrs = field.getAttributes(); + Vector<?> fieldattrs = field.getAttributes(); for(int j = 0; j < fieldattrs.size(); j++){ String fieldattrname = ((AttrData)fieldattrs.elementAt(j)).getAttrName(); if(fieldattrname.equals("ConstantValue")){ @@ -256,8 +256,8 @@ public class JavapPrinter { * print method attribute information. */ public void printMethodAttributes(MethodData method){ - Vector methodattrs = method.getAttributes(); - Vector codeattrs = method.getCodeAttributes(); + Vector<?> methodattrs = method.getAttributes(); + Vector<?> codeattrs = method.getCodeAttributes(); for(int k = 0; k < methodattrs.size(); k++){ String methodattrname = ((AttrData)methodattrs.elementAt(k)).getAttrName(); if(methodattrname.equals("Code")){ @@ -519,7 +519,7 @@ public class JavapPrinter { * Print the exception table for this method code */ void printExceptionTable(MethodData method){//throws IOException - Vector exception_table = method.getexception_table(); + Vector<?> exception_table = method.getexception_table(); if (exception_table.size() > 0) { out.println(" Exception table:"); out.println(" from to target type"); @@ -546,7 +546,7 @@ public class JavapPrinter { */ public void printLineNumTable(MethodData method) { int numlines = method.getnumlines(); - Vector lin_num_tb = method.getlin_num_tb(); + Vector<?> lin_num_tb = method.getlin_num_tb(); if( lin_num_tb.size() > 0){ out.println(" LineNumberTable: "); for (int i=0; i<numlines; i++) { @@ -568,7 +568,7 @@ public class JavapPrinter { out.print(" "); out.println("Start Length Slot Name Signature"); } - Vector loc_var_tb = method.getloc_var_tb(); + Vector<?> loc_var_tb = method.getloc_var_tb(); for (int i=0; i<siz; i++) { LocVarData entry=(LocVarData)loc_var_tb.elementAt(i); diff --git a/langtools/src/share/classes/sun/tools/javap/MethodData.java b/langtools/src/share/classes/sun/tools/javap/MethodData.java index 4ff7f244140..75f702834cb 100644 --- a/langtools/src/share/classes/sun/tools/javap/MethodData.java +++ b/langtools/src/share/classes/sun/tools/javap/MethodData.java @@ -302,7 +302,7 @@ public class MethodData { /** * Return LineNumberTable */ - public Vector getlin_num_tb(){ + public Vector<?> getlin_num_tb(){ return lin_num_tb; } @@ -317,7 +317,7 @@ public class MethodData { /** * Return LocalVariableTable. */ - public Vector getloc_var_tb(){ + public Vector<?> getloc_var_tb(){ return loc_var_tb; } @@ -378,7 +378,7 @@ public class MethodData { /** * Return exception table in code attributre. */ - public Vector getexception_table(){ + public Vector<?> getexception_table(){ return exception_table; } @@ -386,7 +386,7 @@ public class MethodData { /** * Return method attributes. */ - public Vector getAttributes(){ + public Vector<?> getAttributes(){ return attrs; } @@ -394,7 +394,7 @@ public class MethodData { /** * Return code attributes. */ - public Vector getCodeAttributes(){ + public Vector<?> getCodeAttributes(){ return code_attrs; } From f6cd370370a41b314f4434b436c2319b2104b025 Mon Sep 17 00:00:00 2001 From: Maurizio Cimadamore <mcimadamore@openjdk.org> Date: Tue, 13 Jan 2009 13:28:20 +0000 Subject: [PATCH 243/267] 6665356: Cast not allowed when both qualifying type and inner class are parameterized Fixed parser and cats conversion in order to allow cast between generic inner classes Reviewed-by: jjg --- .../com/sun/tools/javac/code/Types.java | 15 ++-- .../sun/tools/javac/parser/JavacParser.java | 9 ++- .../tools/javac/cast/6665356/T6665356.java | 80 +++++++++++++++++++ .../tools/javac/cast/6665356/T6665356.out | 8 ++ .../javac/generics/rare/6665356/T6665356.java | 53 ++++++++++++ .../javac/generics/rare/6665356/T6665356.out | 5 ++ 6 files changed, 162 insertions(+), 8 deletions(-) create mode 100644 langtools/test/tools/javac/cast/6665356/T6665356.java create mode 100644 langtools/test/tools/javac/cast/6665356/T6665356.out create mode 100644 langtools/test/tools/javac/generics/rare/6665356/T6665356.java create mode 100644 langtools/test/tools/javac/generics/rare/6665356/T6665356.out diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java index ac168ee344d..87a5ab724a4 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java @@ -880,12 +880,12 @@ public class Types { if (warn != warnStack.head) { try { warnStack = warnStack.prepend(warn); - return isCastable.visit(t, s); + return isCastable.visit(t,s); } finally { warnStack = warnStack.tail; } } else { - return isCastable.visit(t, s); + return isCastable.visit(t,s); } } // where @@ -983,10 +983,10 @@ public class Types { if (highSub != null) { assert a.tsym == highSub.tsym && a.tsym == lowSub.tsym : a.tsym + " != " + highSub.tsym + " != " + lowSub.tsym; - if (!disjointTypes(aHigh.getTypeArguments(), highSub.getTypeArguments()) - && !disjointTypes(aHigh.getTypeArguments(), lowSub.getTypeArguments()) - && !disjointTypes(aLow.getTypeArguments(), highSub.getTypeArguments()) - && !disjointTypes(aLow.getTypeArguments(), lowSub.getTypeArguments())) { + if (!disjointTypes(aHigh.allparams(), highSub.allparams()) + && !disjointTypes(aHigh.allparams(), lowSub.allparams()) + && !disjointTypes(aLow.allparams(), highSub.allparams()) + && !disjointTypes(aLow.allparams(), lowSub.allparams())) { if (upcast ? giveWarning(a, highSub) || giveWarning(a, lowSub) : giveWarning(highSub, a) || giveWarning(lowSub, a)) warnStack.head.warnUnchecked(); @@ -1197,6 +1197,7 @@ public class Types { s = upperBound(s); if (s.tag == TYPEVAR) s = s.getUpperBound(); + return !isSubtype(t, s); } // </editor-fold> @@ -3189,7 +3190,7 @@ public class Types { private boolean giveWarning(Type from, Type to) { // To and from are (possibly different) parameterizations // of the same class or interface - return to.isParameterized() && !containsType(to.getTypeArguments(), from.getTypeArguments()); + return to.isParameterized() && !containsType(to.allparams(), from.allparams()); } private List<Type> superClosure(Type t, Type s) { diff --git a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java index e18633fb5fb..ef48f23984f 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java +++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java @@ -864,6 +864,12 @@ public class JavacParser implements Parser { t = F.at(pos1).TypeApply(t, args.toList()); checkGenerics(); t = bracketsOpt(toP(t)); + while (S.token() == DOT) { + S.nextToken(); + mode = TYPE; + t = toP(F.at(S.pos()).Select(t, ident())); + t = typeArgumentsOpt(t); + } } else if ((mode & EXPR) != 0) { mode = EXPR; t = F.at(pos1).Binary(op, t, term2Rest(t1, TreeInfo.shiftPrec)); @@ -871,7 +877,8 @@ public class JavacParser implements Parser { } else { accept(GT); } - } else { + } + else { t = termRest(term1Rest(term2Rest(t, TreeInfo.orPrec))); } accept(RPAREN); diff --git a/langtools/test/tools/javac/cast/6665356/T6665356.java b/langtools/test/tools/javac/cast/6665356/T6665356.java new file mode 100644 index 00000000000..f9db58fa760 --- /dev/null +++ b/langtools/test/tools/javac/cast/6665356/T6665356.java @@ -0,0 +1,80 @@ +/* + * 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. + * + * 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 + * @author Maurizio Cimadamore + * @bug 6665356 + * @summary Cast not allowed when both qualifying type and inner class are parameterized + * @compile/fail/ref=T6665356.out -XDrawDiagnostics T6665356.java + */ + +class T6665356 { + class Outer<S> { + class Inner<T> {} + } + + void cast1(Outer<Integer>.Inner<Long> p) { + Object o = (Outer<Integer>.Inner<Long>)p; + } + + void cast2(Outer<Integer>.Inner<Long> p) { + Object o = (Outer<? extends Number>.Inner<Long>)p; + } + + void cast3(Outer<Integer>.Inner<Long> p) { + Object o = (Outer<Integer>.Inner<? extends Number>)p; + } + + void cast4(Outer<Integer>.Inner<Long> p) { + Object o = (Outer<? extends Number>.Inner<? extends Number>)p; + } + + void cast5(Outer<Integer>.Inner<Long> p) { + Object o = (Outer<? super Number>.Inner<Long>)p; + } + + void cast6(Outer<Integer>.Inner<Long> p) { + Object o = (Outer<Integer>.Inner<? super Number>)p; + } + + void cast7(Outer<Integer>.Inner<Long> p) { + Object o = (Outer<? super Number>.Inner<? super Number>)p; + } + + void cast8(Outer<Integer>.Inner<Long> p) { + Object o = (Outer<? extends String>.Inner<Long>)p; + } + + void cast9(Outer<Integer>.Inner<Long> p) { + Object o = (Outer<Integer>.Inner<? extends String>)p; + } + + void cast10(Outer<Integer>.Inner<Long> p) { + Object o = (Outer<? super String>.Inner<Long>)p; + } + + void cast11(Outer<Integer>.Inner<Long> p) { + Object o = (Outer<Integer>.Inner<? super String>)p; + } +} \ No newline at end of file diff --git a/langtools/test/tools/javac/cast/6665356/T6665356.out b/langtools/test/tools/javac/cast/6665356/T6665356.out new file mode 100644 index 00000000000..029c66400a2 --- /dev/null +++ b/langtools/test/tools/javac/cast/6665356/T6665356.out @@ -0,0 +1,8 @@ +T6665356.java:54:55: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<? super java.lang.Number>.Inner<java.lang.Long> +T6665356.java:58:58: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<java.lang.Integer>.Inner<? super java.lang.Number> +T6665356.java:62:65: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<? super java.lang.Number>.Inner<? super java.lang.Number> +T6665356.java:66:57: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<? extends java.lang.String>.Inner<java.lang.Long> +T6665356.java:70:60: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<java.lang.Integer>.Inner<? extends java.lang.String> +T6665356.java:74:55: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<? super java.lang.String>.Inner<java.lang.Long> +T6665356.java:78:58: compiler.err.prob.found.req: (- compiler.misc.inconvertible.types), T6665356.Outer<java.lang.Integer>.Inner<java.lang.Long>, T6665356.Outer<java.lang.Integer>.Inner<? super java.lang.String> +7 errors \ No newline at end of file diff --git a/langtools/test/tools/javac/generics/rare/6665356/T6665356.java b/langtools/test/tools/javac/generics/rare/6665356/T6665356.java new file mode 100644 index 00000000000..8f0949fcba9 --- /dev/null +++ b/langtools/test/tools/javac/generics/rare/6665356/T6665356.java @@ -0,0 +1,53 @@ +/* + * 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. + * + * 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 + * @author Maurizio Cimadamore + * @bug 6665356 + * @summary Cast not allowed when both qualifying type and inner class are parameterized + * @compile/fail/ref=T6665356.out -XDrawDiagnostics T6665356.java + */ + +class T6665356 { + class Outer<S> { + class Inner<T> {} + } + + void test1() { + boolean b; + b = null instanceof Outer.Inner; + b = null instanceof Outer<?>.Inner; + b = null instanceof Outer.Inner<?>; + b = null instanceof Outer<?>.Inner<?>; + } + + void test2() { + boolean b; + Object o; + o = (Outer.Inner)null; + o = (Outer<?>.Inner)null; + o = (Outer.Inner<?>)null; + o = (Outer<?>.Inner<?>)null; + } +} \ No newline at end of file diff --git a/langtools/test/tools/javac/generics/rare/6665356/T6665356.out b/langtools/test/tools/javac/generics/rare/6665356/T6665356.out new file mode 100644 index 00000000000..de65356ccf1 --- /dev/null +++ b/langtools/test/tools/javac/generics/rare/6665356/T6665356.out @@ -0,0 +1,5 @@ +T6665356.java:40:37: compiler.err.improperly.formed.type.param.missing +T6665356.java:41:40: compiler.err.improperly.formed.type.inner.raw.param +T6665356.java:49:23: compiler.err.improperly.formed.type.param.missing +T6665356.java:50:25: compiler.err.improperly.formed.type.inner.raw.param +4 errors \ No newline at end of file From 9dff8d691f4f27651e2733255a44c161ddc946e4 Mon Sep 17 00:00:00 2001 From: Mark Mahieu <mark@twistedbanana.demon.co.uk> Date: Tue, 13 Jan 2009 13:28:42 +0000 Subject: [PATCH 244/267] 6723444: javac fails to substitute type variables into a constructor's throws clause Added constructor's actual type info to NewClass AST node Reviewed-by: jjg --- .../com/sun/tools/javac/comp/Attr.java | 11 ++- .../com/sun/tools/javac/comp/Flow.java | 27 ++++++- .../com/sun/tools/javac/tree/JCTree.java | 1 + .../javac/generics/6723444/T6723444.java | 80 +++++++++++++++++++ .../tools/javac/generics/6723444/T6723444.out | 13 +++ 5 files changed, 127 insertions(+), 5 deletions(-) create mode 100644 langtools/test/tools/javac/generics/6723444/T6723444.java create mode 100644 langtools/test/tools/javac/generics/6723444/T6723444.out diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java index 16661090a66..a7a4012bea8 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java @@ -1457,7 +1457,7 @@ public class Attr extends JCTree.Visitor { localEnv.info.varArgs = false; tree.constructor = rs.resolveConstructor( tree.pos(), localEnv, clazztype, argtypes, typeargtypes); - Type ctorType = checkMethod(clazztype, + tree.constructorType = checkMethod(clazztype, tree.constructor, localEnv, tree.args, @@ -1465,7 +1465,7 @@ public class Attr extends JCTree.Visitor { typeargtypes, localEnv.info.varArgs); if (localEnv.info.varArgs) - assert ctorType.isErroneous() || tree.varargsElement != null; + assert tree.constructorType.isErroneous() || tree.varargsElement != null; } if (cdef != null) { @@ -1527,6 +1527,13 @@ public class Attr extends JCTree.Visitor { typeargtypes, true, tree.varargsElement != null); assert sym.kind < AMBIGUOUS || tree.constructor.type.isErroneous(); tree.constructor = sym; + tree.constructorType = checkMethod(clazztype, + tree.constructor, + localEnv, + tree.args, + argtypes, + typeargtypes, + localEnv.info.varArgs); } if (tree.constructor != null && tree.constructor.kind == MTH) diff --git a/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java b/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java index f99f1604dc7..93a08fb8cf8 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java @@ -1136,11 +1136,32 @@ public class Flow extends TreeScanner { scanExpr(tree.encl); scanExprs(tree.args); // scan(tree.def); - for (List<Type> l = tree.constructor.type.getThrownTypes(); + for (List<Type> l = tree.constructorType.getThrownTypes(); l.nonEmpty(); - l = l.tail) + l = l.tail) { markThrown(tree, l.head); - scan(tree.def); + } + List<Type> caughtPrev = caught; + try { + // If the new class expression defines an anonymous class, + // analysis of the anonymous constructor may encounter thrown + // types which are unsubstituted type variables. + // However, since the constructor's actual thrown types have + // already been marked as thrown, it is safe to simply include + // each of the constructor's formal thrown types in the set of + // 'caught/declared to be thrown' types, for the duration of + // the class def analysis. + if (tree.def != null) + for (List<Type> l = tree.constructor.type.getThrownTypes(); + l.nonEmpty(); + l = l.tail) { + caught = chk.incl(l.head, caught); + } + scan(tree.def); + } + finally { + caught = caughtPrev; + } } public void visitNewArray(JCNewArray tree) { diff --git a/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java b/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java index 08ac9f84a9b..1509a2999b6 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java +++ b/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java @@ -1326,6 +1326,7 @@ public abstract class JCTree implements Tree, Cloneable, DiagnosticPosition { public JCClassDecl def; public Symbol constructor; public Type varargsElement; + public Type constructorType; protected JCNewClass(JCExpression encl, List<JCExpression> typeargs, JCExpression clazz, diff --git a/langtools/test/tools/javac/generics/6723444/T6723444.java b/langtools/test/tools/javac/generics/6723444/T6723444.java new file mode 100644 index 00000000000..4d32ba89c4e --- /dev/null +++ b/langtools/test/tools/javac/generics/6723444/T6723444.java @@ -0,0 +1,80 @@ +/* + * 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. + * + * 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 6723444 + * + * @summary javac fails to substitute type variables into a constructor's throws clause + * @author Mark Mahieu + * @compile/fail/ref=T6723444.out -XDstdout -XDrawDiagnostics T6723444.java + * + */ +public class T6723444 { + + static class Foo<X extends Throwable> { + Foo() throws X {} + } + + <X extends Throwable> T6723444() + throws X {} + + <X extends Throwable> T6723444(Foo<X> foo) + throws X {} + + <X1 extends Throwable, X2 extends Throwable> T6723444(Foo<X1> foo, int i) + throws X1, X2 {} + + public static void main(String[] args) throws Exception { + + // the following 8 statements should compile without error + + Foo<Exception> exFoo = new Foo<Exception>(); + exFoo = new Foo<Exception>() {}; + + new<Exception> T6723444(); + new<Exception> T6723444() {}; + new T6723444(exFoo); + new T6723444(exFoo) {}; + new<Exception, Exception> T6723444(exFoo, 1); + new<Exception, Exception> T6723444(exFoo, 1) {}; + + // the remaining statements should all raise an + // unreported exception error + + new T6723444(exFoo, 1); + new T6723444(exFoo, 1) {}; + + Foo<Throwable> thFoo = new Foo<Throwable>(); + thFoo = new Foo<Throwable>() {}; + + new<Throwable> T6723444(); + new<Throwable> T6723444() {}; + new T6723444(thFoo); + new T6723444(thFoo) {}; + new T6723444(thFoo, 1); + new T6723444(thFoo, 1) {}; + new<Throwable, Throwable> T6723444(thFoo, 1); + new<Throwable, Throwable> T6723444(thFoo, 1) {}; + } +} diff --git a/langtools/test/tools/javac/generics/6723444/T6723444.out b/langtools/test/tools/javac/generics/6723444/T6723444.out new file mode 100644 index 00000000000..3680a217237 --- /dev/null +++ b/langtools/test/tools/javac/generics/6723444/T6723444.out @@ -0,0 +1,13 @@ +T6723444.java:65:9: compiler.err.unreported.exception.need.to.catch.or.throw: X2 +T6723444.java:66:9: compiler.err.unreported.exception.need.to.catch.or.throw: X2 +T6723444.java:68:32: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable +T6723444.java:69:17: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable +T6723444.java:71:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable +T6723444.java:72:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable +T6723444.java:73:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable +T6723444.java:74:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable +T6723444.java:75:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable +T6723444.java:76:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable +T6723444.java:77:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable +T6723444.java:78:9: compiler.err.unreported.exception.need.to.catch.or.throw: java.lang.Throwable +12 errors \ No newline at end of file From 34719749c5359f1a0d34e1f5cafa1662d745e4d5 Mon Sep 17 00:00:00 2001 From: Maurizio Cimadamore <mcimadamore@openjdk.org> Date: Tue, 13 Jan 2009 13:31:35 +0000 Subject: [PATCH 245/267] 6558559: Extra "unchecked" diagnostic Fixed Types.sideCast in order to suppress redundant unchecked warnings Reviewed-by: jjg --- .../com/sun/tools/javac/code/Types.java | 2 +- .../tools/javac/cast/6558559/T6558559a.java | 40 +++++++++++++++++ .../tools/javac/cast/6558559/T6558559b.java | 43 +++++++++++++++++++ 3 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 langtools/test/tools/javac/cast/6558559/T6558559a.java create mode 100644 langtools/test/tools/javac/cast/6558559/T6558559b.java diff --git a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java index 87a5ab724a4..2a1de89d886 100644 --- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java @@ -3148,7 +3148,7 @@ public class Types { giveWarning = giveWarning || (reverse ? giveWarning(t2, t1) : giveWarning(t1, t2)); commonSupers = commonSupers.tail; } - if (giveWarning && !isReifiable(to)) + if (giveWarning && !isReifiable(reverse ? from : to)) warn.warnUnchecked(); if (!source.allowCovariantReturns()) // reject if there is a common method signature with diff --git a/langtools/test/tools/javac/cast/6558559/T6558559a.java b/langtools/test/tools/javac/cast/6558559/T6558559a.java new file mode 100644 index 00000000000..c440e422f8e --- /dev/null +++ b/langtools/test/tools/javac/cast/6558559/T6558559a.java @@ -0,0 +1,40 @@ +/* + * 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. + * + * 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 6558559 + * @summary Extra "unchecked" diagnostic + * @author Maurizio Cimadamore + * + * @compile T6558559a.java -Xlint:unchecked -Werror + */ + +class T6558559a { + interface A<T> {} + + static class B<T> {} + + A<?> x = null; + B<?> y = (B<?>)x; +} \ No newline at end of file diff --git a/langtools/test/tools/javac/cast/6558559/T6558559b.java b/langtools/test/tools/javac/cast/6558559/T6558559b.java new file mode 100644 index 00000000000..9fe99339228 --- /dev/null +++ b/langtools/test/tools/javac/cast/6558559/T6558559b.java @@ -0,0 +1,43 @@ +/* + * 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. + * + * 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 6558559 + * @summary Extra "unchecked" diagnostic + * @author Maurizio Cimadamore + * + * @compile T6558559b.java -Xlint:unchecked -Werror + */ + +import java.util.*; + +class T6558559b { + void test(List rawList, List<?> unboundList) { + Throwable t0 = (Throwable) Collections.emptyList(); + Throwable t1 = (Throwable) rawList; + Throwable t2 = (Throwable) unboundList; + Object o = unboundList; + Throwable t3 = (Throwable) o; + } +} \ No newline at end of file From 6a54f22ae0983767bd8d5ede15fe6a2b7c87b22c Mon Sep 17 00:00:00 2001 From: Tim Bell <tbell@openjdk.org> Date: Wed, 14 Jan 2009 21:35:03 -0800 Subject: [PATCH 246/267] 6754862: jdk/src/windows/bin/java_md.c: hardcoded reference to msvcr71.dll 6779412: VS2008 errors compiling jdk sources Update Makefiles to tolerate newer Visual Studio releases and runtimes. Reviewed-by: ohair --- jdk/make/com/sun/java/pack/Makefile | 4 +- jdk/make/common/Defs-windows.gmk | 49 ++++++++++++++++++--- jdk/make/common/Library.gmk | 6 +++ jdk/make/common/Program.gmk | 6 +++ jdk/make/common/shared/Compiler-msvc.gmk | 34 +++++++++------ jdk/make/common/shared/Defs-windows.gmk | 50 ++++++++++++++-------- jdk/make/common/shared/Sanity-Settings.gmk | 2 +- jdk/make/common/shared/Sanity.gmk | 10 ++--- jdk/make/java/main/java/Makefile | 4 +- jdk/make/java/main/javaw/Makefile | 3 +- jdk/make/java/redist/Makefile | 2 +- jdk/src/share/bin/main.c | 37 ++++++++++++++++ jdk/src/windows/bin/java_md.c | 11 ++++- 13 files changed, 168 insertions(+), 50 deletions(-) diff --git a/jdk/make/com/sun/java/pack/Makefile b/jdk/make/com/sun/java/pack/Makefile index c8b4e990984..afb84d36574 100644 --- a/jdk/make/com/sun/java/pack/Makefile +++ b/jdk/make/com/sun/java/pack/Makefile @@ -142,9 +142,11 @@ endif $(UNPACK_EXE): $(UNPACK_EXE_FILES_o) winres $(prep-target) $(LINKER) $(LDDFLAGS) $(UNPACK_EXE_FILES_o) $(RES) $(LIBCXX) $(LDOUTPUT)$(TEMPDIR)/unpack200$(EXE_SUFFIX) +ifdef MT + $(MT) /manifest $(TEMPDIR)/unpack200$(EXE_SUFFIX).manifest /outputresource:$(TEMPDIR)/unpack200$(EXE_SUFFIX);#1 +endif $(CP) $(TEMPDIR)/unpack200$(EXE_SUFFIX) $(UNPACK_EXE) - ifeq ($(PLATFORM), windows) $(RES):: $(VERSIONINFO_RESOURCE) $(prep-target) diff --git a/jdk/make/common/Defs-windows.gmk b/jdk/make/common/Defs-windows.gmk index 4ec2a0467a8..7b178497e12 100644 --- a/jdk/make/common/Defs-windows.gmk +++ b/jdk/make/common/Defs-windows.gmk @@ -68,11 +68,24 @@ PLATFORM_INCLUDE = $(INCLUDEDIR)/$(PLATFORM_INCLUDE_NAME) # The following DLL's are considered MS runtime libraries and should # not to be REBASEd, see deploy/make/common/Release.gmk. -# msvcrt.dll, msvcr71.dll: Microsoft runtimes +# msvcrt.dll, msvcrnn.dll [msvcr71 or msvcr80 or msvcr90] : Microsoft runtimes MS_RUNTIME_LIBRARIES = msvcrt.dll +MSVCRNN_DLL = ifeq ($(ARCH_DATA_MODEL), 32) ifeq ($(COMPILER_VERSION), VS2003) - MS_RUNTIME_LIBRARIES += msvcr71.dll + MSVCRNN_DLL = msvcr71.dll + MSVCPNN_DLL = msvcp71.dll + MS_RUNTIME_LIBRARIES += $(MSVCRNN_DLL) + endif + ifeq ($(COMPILER_VERSION), VS2005) + MSVCRNN_DLL = msvcr80.dll + MSVCPNN_DLL = msvcp80.dll + MS_RUNTIME_LIBRARIES += $(MSVCRNN_DLL) + endif + ifeq ($(COMPILER_VERSION), VS2008) + MSVCRNN_DLL = msvcr90.dll + MSVCPNN_DLL = msvcp90.dll + MS_RUNTIME_LIBRARIES += $(MSVCRNN_DLL) endif endif @@ -178,9 +191,22 @@ ifeq ($(CC_VERSION),msvc) CC_OPT/LOWER = -O1 endif endif + ifeq ($(COMPILER_VERSION), VS2008) + # Automatic precompiled header option to use (if COMPILE_APPROACH=batch) + AUTOMATIC_PCH_OPTION = + GX_OPTION = -EHsc + ifeq ($(ARCH_DATA_MODEL), 32) + CC_OPT/HIGHEST = -O2 + CC_OPT/HIGHER = -O1 + CC_OPT/LOWER = -O1 + else + CC_OPT/HIGHEST = -O2 + CC_OPT/HIGHER = -O1 + CC_OPT/LOWER = -O1 + endif + endif else # CC_VERSION - # GCC not supported, but left for historical reference... CC_OPT/NONE = CC_OPT/LOWER = -O2 @@ -200,10 +226,13 @@ CC_OPT = $(CC_OPT/$(OPTIMIZATION_LEVEL)) # -MTd Use static debug version (better than -MDd, no runtime issues) # -D_DEBUG Change use of malloc/free/etc to use special debug ones (-MTd) # -# NOTE: We also will use /D _STATIC_CPPLIB so we don't need msvcp71.dll +# NOTE: We also will use /D _STATIC_CPPLIB so we don't need msvcpnn.dll # +# If MS_RUNTIME_STATIC is requested, use -MT only with VS2003. ifeq ($(MS_RUNTIME_STATIC),true) - MS_RUNTIME_OPTION=-MT + ifeq ($(COMPILER_VERSION), VS2003) + MS_RUNTIME_OPTION=-MT + endif else MS_RUNTIME_OPTION=-MD endif @@ -238,7 +267,7 @@ ifeq ($(CC_VERSION),msvc) # -YX -Fp/.../foobar.pch Use precompiled headers (try someday?) # -nologo Don't print out startup message # /D _STATIC_CPPLIB - # Use static link for the C++ runtime (so msvcp71.dll not needed) + # Use static link for the C++ runtime (so msvcpnn.dll not needed) # CFLAGS_COMMON += -Zi -nologo CFLAGS_OPT = $(CC_OPT) @@ -277,8 +306,16 @@ ifeq ($(CC_VERSION),msvc) # Always add bufferoverflowU.lib to VS2005 link commands (pack uses LDDFLAGS) LFLAGS_VS2005 = $(BUFFEROVERFLOWLIB) + # VS2008 has bufferoverflow baked in: + LFLAGS_VS2008 = + # LFLAGS are the flags given to $(LINK) and used to build the actual DLL file BASELFLAGS = -nologo /opt:REF /incremental:no +ifdef MT + # VS2005, VS2008, and beyond: ask LINK to generate manifests for .dll & .exe + BASELFLAGS += /manifest +endif + LFLAGS = $(BASELFLAGS) $(LDEBUG) $(EXTRA_LFLAGS) $(LFLAGS_$(COMPILER_VERSION)) LDDFLAGS += $(LFLAGS_$(COMPILER_VERSION)) diff --git a/jdk/make/common/Library.gmk b/jdk/make/common/Library.gmk index 3e4318ecd23..0093c8e3a7e 100644 --- a/jdk/make/common/Library.gmk +++ b/jdk/make/common/Library.gmk @@ -179,6 +179,9 @@ else # LIBRARY # build it into $(OBJDIR) so that the other generated files get put # there, then copy just the DLL (and MAP file) to the requested directory. # +# In VS2005 or VS2008 the link command creates a .manifest file that we want +# to insert into the linked artifact so we do not need to track it separately. +# Use ";#2" for .dll and ";#1" for .exe in the MT command below: $(ACTUAL_LIBRARY):: $(OBJDIR)/$(LIBRARY).lcf @$(prep-target) @$(MKDIR) -p $(OBJDIR) @@ -186,6 +189,9 @@ $(ACTUAL_LIBRARY):: $(OBJDIR)/$(LIBRARY).lcf -map:$(OBJDIR)/$(LIBRARY).map \ $(LFLAGS) @$(OBJDIR)/$(LIBRARY).lcf \ $(OTHER_LCF) $(JAVALIB) $(LDLIBS) +ifdef MT + $(MT) /manifest $(OBJDIR)/$(@F).manifest /outputresource:$(OBJDIR)/$(@F);#2 +endif $(CP) $(OBJDIR)/$(@F) $@ $(CP) $(OBJDIR)/$(LIBRARY).map $(@D) $(CP) $(OBJDIR)/$(LIBRARY).pdb $(@D) diff --git a/jdk/make/common/Program.gmk b/jdk/make/common/Program.gmk index 85a5be3645e..22aa7f9dbd0 100644 --- a/jdk/make/common/Program.gmk +++ b/jdk/make/common/Program.gmk @@ -153,6 +153,9 @@ else STACK_SIZE=1048576 endif +# In VS2005 or VS2008 the link command creates a .manifest file that we want +# to insert into the linked artifact so we do not need to track it separately. +# Use ";#2" for .dll and ";#1" for .exe in the MT command below: $(OBJDIR)/$(PROGRAM)$(EXE_SUFFIX):: $(OBJDIR)/$(PROGRAM).lcf $(FILES_o) $(JLI_LCF) @$(prep-target) @set -- $?; \ @@ -160,6 +163,9 @@ $(OBJDIR)/$(PROGRAM)$(EXE_SUFFIX):: $(OBJDIR)/$(PROGRAM).lcf $(FILES_o) $(JLI_LC $(LINK) -out:$@ /STACK:$(STACK_SIZE) \ -map:$(OBJDIR)/$(PROGRAM).map $(LFLAGS) $(LDFLAGS) \ @$(OBJDIR)/$(PROGRAM).lcf $(LDLIBS) +ifdef MT + $(MT) /manifest $(OBJDIR)/$(PROGRAM).exe.manifest /outputresource:$@;#1 +endif else # PLATFORM diff --git a/jdk/make/common/shared/Compiler-msvc.gmk b/jdk/make/common/shared/Compiler-msvc.gmk index a4b62617810..d23529f3935 100644 --- a/jdk/make/common/shared/Compiler-msvc.gmk +++ b/jdk/make/common/shared/Compiler-msvc.gmk @@ -54,17 +54,10 @@ ifeq ($(PLATFORM), windows) ifeq ($(ARCH_DATA_MODEL), 32) LINK_VER := $(shell $(LINK) | $(HEAD) -n 1 | $(NAWK) '{print $$6}') CC_MAJORVER :=$(call MajorVersion,$(CC_VER)) - REQUIRED_CC_VER = 13.10.3077 - REQUIRED_LINK_VER = 7.10.3077 - ifeq ($(CC_MAJORVER), 12) - # This should be: CC_VER=12.00.8168 LINK_VER=6.00.8447 - COMPILER_NAME=Visual C++ 6.0 Professional + VC6-SP 3 - COMPILER_VERSION=VC6 - REBASE = $(COMPILER_PATH)rebase - MTL = $(COMPILER_PATH)midl - endif ifeq ($(CC_MAJORVER), 13) # This should be: CC_VER=13.10.3077 LINK_VER=7.10.3077 + REQUIRED_CC_VER = 13.10.3077 + REQUIRED_LINK_VER = 7.10.3077 COMPILER_NAME=Visual Studio .NET 2003 Professional C++ COMPILER_VERSION=VS2003 REBASE = $(COMPILER_PATH)../../Common7/Tools/Bin/rebase @@ -74,17 +67,34 @@ ifeq ($(PLATFORM), windows) endif endif ifeq ($(CC_MAJORVER), 14) - # This should be: CC_VER=14.00.0000 LINK_VER=8.00.0000 - # NOTE: This compiler has not been tried yet on 32bit systems - COMPILER_NAME=Visual Studio .NET 2005 + # This should be: CC_VER=14.00.50727.42 LINK_VER=8.00.50727.42 + REQUIRED_CC_VER = 14.00.50727.42 + REQUIRED_LINK_VER = 8.00.50727.42 + COMPILER_NAME=Visual Studio 8 COMPILER_VERSION=VS2005 REBASE = $(COMPILER_PATH)../../Common8/Tools/Bin/rebase MTL = $(COMPILER_PATH)../../Common8/Tools/Bin/midl + MT = $(MSDEVTOOLS_PATH)mt + ifndef COMPILER_PATH + COMPILER_PATH := $(error COMPILER_PATH cannot be empty here) + endif + endif + ifeq ($(CC_MAJORVER), 15) + # This should be: CC_VER=15.00.21022.08 LINK_VER=9.00.21022.08 + REQUIRED_CC_VER = 15.00.21022.08 + REQUIRED_LINK_VER = 9.00.21022.08 + COMPILER_NAME=Visual Studio 9 + COMPILER_VERSION=VS2008 + #rebase and midl moved out of Visual Studio into the SDK: + REBASE = $(MSDEVTOOLS_PATH)/rebase + MTL = $(MSDEVTOOLS_PATH)/midl.exe + MT = $(MSDEVTOOLS_PATH)mt ifndef COMPILER_PATH COMPILER_PATH := $(error COMPILER_PATH cannot be empty here) endif endif else + # else ARCH_DATA_MODEL is 64 LINK_VER := $(shell $(LINK) | $(HEAD) -n 1 | $(NAWK) '{print $$6}') CC_MAJORVER :=$(call MajorVersion,$(CC_VER)) CC_MINORVER :=$(call MinorVersion,$(CC_VER)) diff --git a/jdk/make/common/shared/Defs-windows.gmk b/jdk/make/common/shared/Defs-windows.gmk index 35fa8ce344f..1ceb017b2f9 100644 --- a/jdk/make/common/shared/Defs-windows.gmk +++ b/jdk/make/common/shared/Defs-windows.gmk @@ -74,7 +74,7 @@ override INCREMENTAL_BUILD = false # The ALT values should never really have spaces or use \. # Suspect these environment variables to have spaces and/or \ characters: # SYSTEMROOT, SystemRoot, WINDIR, windir, PROGRAMFILES, ProgramFiles, -# DXSDK_DIR, MSTOOLS, Mstools, MSSDK, MSSdk, VC71COMNTOOLS, +# DXSDK_DIR, MSTOOLS, Mstools, MSSDK, MSSdk, VCnnCOMNTOOLS, # MSVCDIR, MSVCDir. # So use $(subst \,/,) on them first adding quotes and placing them in # their own variable assigned with :=, then use FullPath. @@ -247,22 +247,36 @@ ifeq ($(ARCH_DATA_MODEL), 32) endif endif endif - ifneq ($(subst MSDev98,OLDOLDOLD,$(_msvc_dir)),$(_msvc_dir)) - _msvc_dir := - endif - # If we still don't have it, look for VS71COMNTOOLS, setup by installer? + # If we still don't have it, look for VSnnCOMNTOOLS (newest first), + # set by installer? ifeq ($(_msvc_dir),) + ifdef VS90COMNTOOLS # /Common/Tools directory, use ../../Vc + xVS90COMNTOOLS :="$(subst \,/,$(VS90COMNTOOLS))" + _vs90tools :=$(call FullPath,$(xVS90COMNTOOLS)) + endif + ifneq ($(_vs90tools),) + _msvc_dir :=$(_vs90tools)/../../Vc + _redist_sdk :=$(_msvc_dir)/../SDK/v3.5/Bin + endif + ifdef VS80COMNTOOLS # /Common/Tools directory, use ../../Vc + xVS80COMNTOOLS :="$(subst \,/,$(VS80COMNTOOLS))" + _vs80tools :=$(call FullPath,$(xVS80COMNTOOLS)) + endif + ifneq ($(_vs80tools),) + _msvc_dir :=$(_vs80tools)/../../Vc + _redist_sdk :=$(_msvc_dir)/../SDK/v2.0/Bin + endif ifdef VS71COMNTOOLS # /Common/Tools directory, use ../../Vc7 xVS71COMNTOOLS :="$(subst \,/,$(VS71COMNTOOLS))" _vs71tools :=$(call FullPath,$(xVS71COMNTOOLS)) endif ifneq ($(_vs71tools),) _msvc_dir :=$(_vs71tools)/../../Vc7 + _redist_sdk :=$(_vs71tools)/../.. endif endif ifneq ($(_msvc_dir),) _compiler_bin :=$(_msvc_dir)/Bin - _redist_sdk :=$(_msvc_dir)/../SDK/v1.1/Bin _ms_sdk :=$(_msvc_dir)/PlatformSDK endif endif @@ -410,8 +424,8 @@ _REDIST_SDK_EXISTS := $(shell \ else \ echo "false"; \ fi) -_REDIST71_SDK_EXISTS := $(shell \ - if [ -f "$(_redist_sdk)/msvcr71.dll" ]; then \ +_REDISTNN_SDK_EXISTS := $(shell \ + if [ -f "$(_redist_sdk)/$(MSVCRNN_DLL)" ]; then \ echo "true"; \ else \ echo "false"; \ @@ -435,20 +449,20 @@ ifeq ($(ARCH_DATA_MODEL), 32) MSVCRT_DLL_PATH:=$(call AltCheckSpaces,MSVCRT_DLL_PATH) MSVCRT_DLL_PATH:=$(call AltCheckValue,MSVCRT_DLL_PATH) - # MSVCR71_DLL_PATH: location of msvcr71.dll that will be re-distributed - ifdef ALT_MSVCR71_DLL_PATH - xALT_MSVCR71_DLL_PATH :="$(subst \,/,$(ALT_MSVCR71_DLL_PATH))" - MSVCR71_DLL_PATH :=$(call FullPath,$(xALT_MSVCR71_DLL_PATH)) + # MSVCRNN_DLL_PATH: location of msvcrnn.dll that will be re-distributed + ifdef ALT_MSVCRNN_DLL_PATH + xALT_MSVCRNN_DLL_PATH :="$(subst \,/,$(ALT_MSVCRNN_DLL_PATH))" + MSVCRNN_DLL_PATH :=$(call FullPath,$(xALT_MSVCRNN_DLL_PATH)) else - ifeq ($(_REDIST71_SDK_EXISTS), true) - xREDIST71_DIR :=$(_redist_sdk) + ifeq ($(_REDISTNN_SDK_EXISTS), true) + xREDISTNN_DIR :=$(_redist_sdk) else - xREDIST71_DIR :=$(_system_root)/system32 + xREDISTNN_DIR :=$(_system_root)/system32 endif - MSVCR71_DLL_PATH :=$(call FullPath,$(xREDIST71_DIR)) + MSVCRNN_DLL_PATH :=$(call FullPath,$(xREDISTNN_DIR)) endif - MSVCR71_DLL_PATH :=$(call AltCheckSpaces,MSVCR71_DLL_PATH) - MSVCR71_DLL_PATH:=$(call AltCheckValue,MSVCR71_DLL_PATH) + MSVCRNN_DLL_PATH :=$(call AltCheckSpaces,MSVCRNN_DLL_PATH) + MSVCRNN_DLL_PATH:=$(call AltCheckValue,MSVCRNN_DLL_PATH) else diff --git a/jdk/make/common/shared/Sanity-Settings.gmk b/jdk/make/common/shared/Sanity-Settings.gmk index 911327f5a88..f3ea2b35a79 100644 --- a/jdk/make/common/shared/Sanity-Settings.gmk +++ b/jdk/make/common/shared/Sanity-Settings.gmk @@ -98,7 +98,7 @@ endif ifeq ($(PLATFORM),windows) ALL_SETTINGS+=$(call addAltSetting,MSVCRT_DLL_PATH) ifeq ($(ARCH_DATA_MODEL), 32) - ALL_SETTINGS+=$(call addAltSetting,MSVCR71_DLL_PATH) + ALL_SETTINGS+=$(call addAltSetting,MSVCRNN_DLL_PATH) endif ALL_SETTINGS+=$(call addAltSetting,MSDEVTOOLS_PATH) endif diff --git a/jdk/make/common/shared/Sanity.gmk b/jdk/make/common/shared/Sanity.gmk index d0ced74ee33..997e848904a 100644 --- a/jdk/make/common/shared/Sanity.gmk +++ b/jdk/make/common/shared/Sanity.gmk @@ -835,15 +835,13 @@ ifeq ($(PLATFORM), windows) "" >> $(ERROR_FILE) ; \ fi ifeq ($(ARCH_DATA_MODEL), 32) - ifeq ($(COMPILER_VERSION), VS2003) - @if [ ! -r "$(MSVCR71_DLL_PATH)/msvcr71.dll" ]; then \ - $(ECHO) "ERROR: You do not have access to msvcr71.dll. \n" \ + @if [ ! -r "$(MSVCRNN_DLL_PATH)/$(MSVCRNN_DLL)" ]; then \ + $(ECHO) "ERROR: You do not have access to $(MSVCRNN_DLL). \n" \ " Please check your access to \n" \ - " $(MSVCR71_DLL_PATH) \n" \ - " and/or check your value of ALT_MSVCR71_DLL_PATH. \n" \ + " $(MSVCRNN_DLL_PATH) \n" \ + " and/or check your value of ALT_MSVCRNN_DLL_PATH. \n" \ "" >> $(ERROR_FILE) ; \ fi - endif endif endif diff --git a/jdk/make/java/main/java/Makefile b/jdk/make/java/main/java/Makefile index 140a3001f80..b4cf42f648f 100644 --- a/jdk/make/java/main/java/Makefile +++ b/jdk/make/java/main/java/Makefile @@ -28,11 +28,10 @@ PROGRAM = java PRODUCT = java # -# Statically link java to avoid the dependency on msvcr71.dll. This +# Statically link java to avoid the dependency on msvcrNN.dll. This # must be set before Defs.gmk is included. # MS_RUNTIME_STATIC = true - # # Statically link java to avoid the dependency on jli.dll. This # must be set before Program.gmk is included. @@ -44,6 +43,7 @@ include $(BUILDDIR)/common/Defs.gmk # Override the default version info with our own resource file (see 5106536) ifeq ($(PLATFORM), windows) LDLIBS_COMMON += user32.lib comctl32.lib + ifdef OPENJDK RC_FLAGS += -i "$(PLATFORM_SRC)/resource/icons" else diff --git a/jdk/make/java/main/javaw/Makefile b/jdk/make/java/main/javaw/Makefile index 1ed70daa87e..fb4479afad3 100644 --- a/jdk/make/java/main/javaw/Makefile +++ b/jdk/make/java/main/javaw/Makefile @@ -32,11 +32,10 @@ PROGRAM = javaw PRODUCT = java # -# Statically link javaw to avoid the dependency on msvcr71.dll. This +# Statically link javaw to avoid the dependency on msvcrNN.dll. This # must be set before Defs.gmk is included. # MS_RUNTIME_STATIC = true - # # Statically link javaw to avoid the dependency on jli.dll. This # must be set before Program.gmk is included. diff --git a/jdk/make/java/redist/Makefile b/jdk/make/java/redist/Makefile index 832cd62f1d6..159c247b3f3 100644 --- a/jdk/make/java/redist/Makefile +++ b/jdk/make/java/redist/Makefile @@ -109,7 +109,7 @@ IMPORT_LIST += $(MS_RUNTIME_LIBRARIES:%=$(BINDIR)/%) $(BINDIR)/msvcrt.dll: $(MSVCRT_DLL_PATH)/msvcrt.dll $(install-import-file) $(CHMOD) a+x $@ -$(BINDIR)/msvcr71.dll: $(MSVCR71_DLL_PATH)/msvcr71.dll +$(BINDIR)/$(MSVCRNN_DLL): $(MSVCRNN_DLL_PATH)/$(MSVCRNN_DLL) $(install-import-file) $(CHMOD) a+x $@ diff --git a/jdk/src/share/bin/main.c b/jdk/src/share/bin/main.c index df90e1101eb..9925235d455 100644 --- a/jdk/src/share/bin/main.c +++ b/jdk/src/share/bin/main.c @@ -32,6 +32,43 @@ #include "defines.h" +#ifdef _MSC_VER +#if _MSC_VER > 1400 + +/* + * When building for Microsoft Windows, main has a dependency on msvcr??.dll. + * + * When using Visual Studio 2005 or later, that must be recorded in + * the [java,javaw].exe.manifest file. + * + * Reference: + * C:/Program Files/Microsoft SDKs/Windows/v6.1/include/crtdefs.h + */ +#include <crtassem.h> +#ifdef _M_IX86 + +#pragma comment(linker,"/manifestdependency:\"type='win32' " \ + "name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".CRT' " \ + "version='" _CRT_ASSEMBLY_VERSION "' " \ + "processorArchitecture='x86' " \ + "publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"") + +#endif /* _M_IX86 */ + +//This may not be necessary yet for the Windows 64-bit build, but it +//will be when that build environment is updated. Need to test to see +//if it is harmless: +#ifdef _M_AMD64 + +#pragma comment(linker,"/manifestdependency:\"type='win32' " \ + "name='" __LIBRARIES_ASSEMBLY_NAME_PREFIX ".CRT' " \ + "version='" _CRT_ASSEMBLY_VERSION "' " \ + "processorArchitecture='amd64' " \ + "publicKeyToken='" _VC_ASSEMBLY_PUBLICKEYTOKEN "'\"") + +#endif /* _M_AMD64 */ +#endif /* _MSC_VER > 1400 */ +#endif /* _MSC_VER */ /* * Entry point. diff --git a/jdk/src/windows/bin/java_md.c b/jdk/src/windows/bin/java_md.c index 98ea77b3ed4..c468258b72b 100644 --- a/jdk/src/windows/bin/java_md.c +++ b/jdk/src/windows/bin/java_md.c @@ -41,7 +41,6 @@ #define JVM_DLL "jvm.dll" #define JAVA_DLL "java.dll" -#define CRT_DLL "msvcr71.dll" /* * Prototypes. @@ -206,7 +205,15 @@ LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn) * assumed to be present in the "JRE path" directory. If it is not found * there (or "JRE path" fails to resolve), skip the explicit load and let * nature take its course, which is likely to be a failure to execute. + * + * (NOTE: the above statement is only true for Visual Studio 2003 and + * msvcr71.dll.) */ +#ifdef _MSC_VER +#if _MSC_VER < 1400 +#define CRT_DLL "msvcr71.dll" +#endif +#ifdef CRT_DLL if (GetJREPath(crtpath, MAXPATHLEN)) { (void)JLI_StrCat(crtpath, "\\bin\\" CRT_DLL); /* Add crt dll */ JLI_TraceLauncher("CRT path is %s\n", crtpath); @@ -217,6 +224,8 @@ LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn) } } } +#endif /* CRT_DLL */ +#endif /* _MSC_VER */ /* Load the Java VM DLL */ if ((handle = LoadLibrary(jvmpath)) == 0) { From cb48ba0b84e860c82128139f38a124f2032d4f4a Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena <xdono@openjdk.org> Date: Thu, 15 Jan 2009 11:46:22 -0800 Subject: [PATCH 247/267] Added tag jdk7-b43 for changeset 2d231505b363 --- .hgtags-top-repo | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags-top-repo b/.hgtags-top-repo index 0ba997a6a9e..20804800c15 100644 --- a/.hgtags-top-repo +++ b/.hgtags-top-repo @@ -17,3 +17,4 @@ ab523b49de1fc73fefe6855ce1e0349bdbd7af29 jdk7-b39 44be42de6693063fb191989bf0e188de2fa51e7c jdk7-b40 541bdc5ad32fc33255944d0a044ad992f3d915e8 jdk7-b41 94052b87287303527125026fe4b2698cf867ea83 jdk7-b42 +848e684279d2ba42577d9621d5b2e5af3823d12d jdk7-b43 From 45da1acf72cbd387bfca343979b65382b64f0bb3 Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena <xdono@openjdk.org> Date: Thu, 15 Jan 2009 11:46:23 -0800 Subject: [PATCH 248/267] Added tag jdk7-b43 for changeset 3b2f390959e4 --- corba/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/corba/.hgtags b/corba/.hgtags index d10fcea0a24..35249197029 100644 --- a/corba/.hgtags +++ b/corba/.hgtags @@ -17,3 +17,4 @@ ef6af34d75a7b44e77083f1d4ee47631fa09d3b4 jdk7-b31 184e21992f47a8d730df1adc5b21a108f3125489 jdk7-b40 c90eeda9594ed2983403e2049aed8d503126c62e jdk7-b41 ccd6a16502e0650d91d85c4b86be05cbcd461a87 jdk7-b42 +9cd740d48a4855321d69f137a7109c00bcda76be jdk7-b43 From 58317112cf0e40d59af64079cfe88f368e953591 Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena <xdono@openjdk.org> Date: Thu, 15 Jan 2009 11:46:26 -0800 Subject: [PATCH 249/267] Added tag jdk7-b43 for changeset a0e6196f0e90 --- hotspot/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/hotspot/.hgtags b/hotspot/.hgtags index 2769cf0f79a..6cc68b5d373 100644 --- a/hotspot/.hgtags +++ b/hotspot/.hgtags @@ -17,3 +17,4 @@ d9bc824aa078573829bb66572af847e26e1bd12e jdk7-b38 81a0cbe3b28460ce836109934ece03db7afaf9cc jdk7-b40 f9d938ede1960d18cb7cf23c645b026519c1a678 jdk7-b41 ad8c8ca4ab0f4c86e74c061958f44a8f4a930f2c jdk7-b42 +fc6a5ae3fef5ebacfa896dbb3ae37715e388e282 jdk7-b43 From 52dd839b3e5fe911c4d8674f9430df2ad8a1706b Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena <xdono@openjdk.org> Date: Thu, 15 Jan 2009 11:46:30 -0800 Subject: [PATCH 250/267] Added tag jdk7-b43 for changeset 849b63af3c8c --- jaxp/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxp/.hgtags b/jaxp/.hgtags index 7c3480f9563..7fc0dc775eb 100644 --- a/jaxp/.hgtags +++ b/jaxp/.hgtags @@ -17,3 +17,4 @@ e9f750f0a3a00413a7b77028b2ecdabb7129ae32 jdk7-b38 54946f466e2c047c44c903f1bec400b685c2508e jdk7-b40 0758bd3e2852e4f931ba211cc4d48f589450eeb4 jdk7-b41 036e0dca841a5a17f784d15c86a9da88d2a6f1e6 jdk7-b42 +96fe28d4a9131e1a97bfe00f779e5626cd09c4d0 jdk7-b43 From fb9dbf3a8816bde2b8833c78ad434212824783d9 Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena <xdono@openjdk.org> Date: Thu, 15 Jan 2009 11:46:31 -0800 Subject: [PATCH 251/267] Added tag jdk7-b43 for changeset ff917d84bdf3 --- jaxws/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxws/.hgtags b/jaxws/.hgtags index e8f9d708fec..cd4d4fd0691 100644 --- a/jaxws/.hgtags +++ b/jaxws/.hgtags @@ -17,3 +17,4 @@ a2a6f9edf761934faf59ea60d7fe7178371302cd jdk7-b37 70a6ac6dd737fe45c2fadb57646195b2b4fe269d jdk7-b40 a8379d24aa03386610169cb0f4e4b8ed266a2e8d jdk7-b41 621c02d83abc850c170fb6726d57b19f1eaf5033 jdk7-b42 +1ad2f51564db6ca4c6d95760cf13fb083d3dec94 jdk7-b43 From 0de2dd962c4a1d39c226346031319397b144b7d9 Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena <xdono@openjdk.org> Date: Thu, 15 Jan 2009 11:46:36 -0800 Subject: [PATCH 252/267] Added tag jdk7-b43 for changeset ab58fd13ab49 --- jdk/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/.hgtags b/jdk/.hgtags index 0201a8973e0..d543838710c 100644 --- a/jdk/.hgtags +++ b/jdk/.hgtags @@ -17,3 +17,4 @@ cc5f810b5af8a3a83b0df5a29d9e24d7a0ff8086 jdk7-b38 2201dad60231a3c3e0346e3a0250d69ca3b71fd4 jdk7-b40 44941f893cea95ecdd5987b12e548069bd803849 jdk7-b41 3ef0bdfa7609f79d4f2ea621f30cf593a2e432ce jdk7-b42 +50c67678b0d180063ade199d398b67a54063fa7f jdk7-b43 From 0590d5d82236ecb18e6b60863473738b5c483f81 Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena <xdono@openjdk.org> Date: Thu, 15 Jan 2009 11:46:43 -0800 Subject: [PATCH 253/267] Added tag jdk7-b43 for changeset a02ba404f9c6 --- langtools/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/langtools/.hgtags b/langtools/.hgtags index 51e7a2f4bf8..93b7a70f518 100644 --- a/langtools/.hgtags +++ b/langtools/.hgtags @@ -17,3 +17,4 @@ eaf608c64fecf70f955dc9f29f94c055b183aeec jdk7-b30 32e30988324601d08b87989f0821d99aa8534511 jdk7-b40 ded6b40f558e8d19b3c17715b3d67ee001606645 jdk7-b41 5e5567c2db56a931cf07768218c20903d9828b5f jdk7-b42 +e2f8f6daee9decd5721d598dacf4d0b5915651df jdk7-b43 From 2bb798a3ff73ceb3090118ca97df37b9877734be Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena <xdono@openjdk.org> Date: Thu, 22 Jan 2009 14:41:57 -0800 Subject: [PATCH 254/267] Added tag jdk7-b44 for changeset 72a127c48637 --- .hgtags-top-repo | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags-top-repo b/.hgtags-top-repo index 20804800c15..45f6c86faf1 100644 --- a/.hgtags-top-repo +++ b/.hgtags-top-repo @@ -18,3 +18,4 @@ ab523b49de1fc73fefe6855ce1e0349bdbd7af29 jdk7-b39 541bdc5ad32fc33255944d0a044ad992f3d915e8 jdk7-b41 94052b87287303527125026fe4b2698cf867ea83 jdk7-b42 848e684279d2ba42577d9621d5b2e5af3823d12d jdk7-b43 +a395e3aac4744cc9033fcd819fad1239a45add52 jdk7-b44 From 2ec2e709fd2195e9684188c7fa9a40ac23f830ef Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena <xdono@openjdk.org> Date: Thu, 22 Jan 2009 14:41:58 -0800 Subject: [PATCH 255/267] Added tag jdk7-b44 for changeset 8a25de0ed498 --- corba/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/corba/.hgtags b/corba/.hgtags index 35249197029..a08aaca8282 100644 --- a/corba/.hgtags +++ b/corba/.hgtags @@ -18,3 +18,4 @@ ef6af34d75a7b44e77083f1d4ee47631fa09d3b4 jdk7-b31 c90eeda9594ed2983403e2049aed8d503126c62e jdk7-b41 ccd6a16502e0650d91d85c4b86be05cbcd461a87 jdk7-b42 9cd740d48a4855321d69f137a7109c00bcda76be jdk7-b43 +9803dac7254041b30ca65e3852d4c566b9757c3b jdk7-b44 From 9933a50bf394aa89d278e8409ccd3c0055791034 Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena <xdono@openjdk.org> Date: Thu, 22 Jan 2009 14:42:01 -0800 Subject: [PATCH 256/267] Added tag jdk7-b44 for changeset ec694d49c4be --- hotspot/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/hotspot/.hgtags b/hotspot/.hgtags index 6cc68b5d373..2b249bae719 100644 --- a/hotspot/.hgtags +++ b/hotspot/.hgtags @@ -18,3 +18,4 @@ d9bc824aa078573829bb66572af847e26e1bd12e jdk7-b38 f9d938ede1960d18cb7cf23c645b026519c1a678 jdk7-b41 ad8c8ca4ab0f4c86e74c061958f44a8f4a930f2c jdk7-b42 fc6a5ae3fef5ebacfa896dbb3ae37715e388e282 jdk7-b43 +809e899c638bd9b21836abf9d09ab2a30ff3900b jdk7-b44 From b398e5f4913c4e043a91e306534bb5621baa9036 Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena <xdono@openjdk.org> Date: Thu, 22 Jan 2009 14:42:06 -0800 Subject: [PATCH 257/267] Added tag jdk7-b44 for changeset 4c202c81d33f --- jaxp/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxp/.hgtags b/jaxp/.hgtags index 7fc0dc775eb..a195c0946ac 100644 --- a/jaxp/.hgtags +++ b/jaxp/.hgtags @@ -18,3 +18,4 @@ e9f750f0a3a00413a7b77028b2ecdabb7129ae32 jdk7-b38 0758bd3e2852e4f931ba211cc4d48f589450eeb4 jdk7-b41 036e0dca841a5a17f784d15c86a9da88d2a6f1e6 jdk7-b42 96fe28d4a9131e1a97bfe00f779e5626cd09c4d0 jdk7-b43 +b203df0741af3eb08687bc5eb798bac87363758d jdk7-b44 From 5669063091c0dc3648ef8d9c04eba9a25f5cfc5b Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena <xdono@openjdk.org> Date: Thu, 22 Jan 2009 14:42:07 -0800 Subject: [PATCH 258/267] Added tag jdk7-b44 for changeset 8a29755677e2 --- jaxws/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jaxws/.hgtags b/jaxws/.hgtags index cd4d4fd0691..541312fa826 100644 --- a/jaxws/.hgtags +++ b/jaxws/.hgtags @@ -18,3 +18,4 @@ a2a6f9edf761934faf59ea60d7fe7178371302cd jdk7-b37 a8379d24aa03386610169cb0f4e4b8ed266a2e8d jdk7-b41 621c02d83abc850c170fb6726d57b19f1eaf5033 jdk7-b42 1ad2f51564db6ca4c6d95760cf13fb083d3dec94 jdk7-b43 +344485a03674b6950a7a23d01a6efb8055afb6ec jdk7-b44 From 9f55075d21f7f8f89fdbe3ac3e6b887c55dcd9fc Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena <xdono@openjdk.org> Date: Thu, 22 Jan 2009 14:42:13 -0800 Subject: [PATCH 259/267] Added tag jdk7-b44 for changeset 4ce86f6829fb --- jdk/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/.hgtags b/jdk/.hgtags index d543838710c..4ab2cd9e5c0 100644 --- a/jdk/.hgtags +++ b/jdk/.hgtags @@ -18,3 +18,4 @@ cc5f810b5af8a3a83b0df5a29d9e24d7a0ff8086 jdk7-b38 44941f893cea95ecdd5987b12e548069bd803849 jdk7-b41 3ef0bdfa7609f79d4f2ea621f30cf593a2e432ce jdk7-b42 50c67678b0d180063ade199d398b67a54063fa7f jdk7-b43 +d8eb2738db6b148911177d9bcfe888109b7f2f71 jdk7-b44 From 3112e3e0657e93ad3f307093b183702a76c2c096 Mon Sep 17 00:00:00 2001 From: Xiomara Jayasena <xdono@openjdk.org> Date: Thu, 22 Jan 2009 14:42:22 -0800 Subject: [PATCH 260/267] Added tag jdk7-b44 for changeset 9d204be2281a --- langtools/.hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/langtools/.hgtags b/langtools/.hgtags index 93b7a70f518..8a9c92a42b0 100644 --- a/langtools/.hgtags +++ b/langtools/.hgtags @@ -18,3 +18,4 @@ eaf608c64fecf70f955dc9f29f94c055b183aeec jdk7-b30 ded6b40f558e8d19b3c17715b3d67ee001606645 jdk7-b41 5e5567c2db56a931cf07768218c20903d9828b5f jdk7-b42 e2f8f6daee9decd5721d598dacf4d0b5915651df jdk7-b43 +28f0b10d6c1afc106465c13b8c663a6afa4fb1a1 jdk7-b44 From 5475b9302f19b9c52178be4fe69355a0e365573e Mon Sep 17 00:00:00 2001 From: "J. Duke" <duke@openjdk.org> Date: Wed, 5 Jul 2017 16:42:40 +0200 Subject: [PATCH 261/267] Added tag jdk7-b38 for changeset a2879b2837f5 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index fc422fbdfda..17fe86ac316 100644 --- a/.hgtags +++ b/.hgtags @@ -12,3 +12,4 @@ a9f1805e3ba9ca520cad199d522c84af5433e85a jdk7-b32 6d909d5803e3a22850e6c4e5a75b888742ee7e20 jdk7-b35 d718a441936196b93d8bc9f084933af9a4c2a350 jdk7-b36 c2036bf76829c03b99108fffab52e20910a9be4f jdk7-b37 +a2879b2837f5a4c87e9542efe69ef138194af8ff jdk7-b38 From 9b96a6a54773a869dd29ecb6e4ea4077c38b1557 Mon Sep 17 00:00:00 2001 From: "J. Duke" <duke@openjdk.org> Date: Wed, 5 Jul 2017 16:43:18 +0200 Subject: [PATCH 262/267] Added tag jdk7-b39 for changeset 126f365cec6c --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 17fe86ac316..bdcf23a9579 100644 --- a/.hgtags +++ b/.hgtags @@ -13,3 +13,4 @@ a9f1805e3ba9ca520cad199d522c84af5433e85a jdk7-b32 d718a441936196b93d8bc9f084933af9a4c2a350 jdk7-b36 c2036bf76829c03b99108fffab52e20910a9be4f jdk7-b37 a2879b2837f5a4c87e9542efe69ef138194af8ff jdk7-b38 +126f365cec6c3c2c72de934fa1c64b5f082b55b5 jdk7-b39 From 6b1c37ee8c74b102d38cda186c84f29bd87be0ab Mon Sep 17 00:00:00 2001 From: "J. Duke" <duke@openjdk.org> Date: Wed, 5 Jul 2017 16:43:43 +0200 Subject: [PATCH 263/267] Added tag jdk7-b40 for changeset 3c53424bbe3b --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index bdcf23a9579..04640e3354d 100644 --- a/.hgtags +++ b/.hgtags @@ -14,3 +14,4 @@ d718a441936196b93d8bc9f084933af9a4c2a350 jdk7-b36 c2036bf76829c03b99108fffab52e20910a9be4f jdk7-b37 a2879b2837f5a4c87e9542efe69ef138194af8ff jdk7-b38 126f365cec6c3c2c72de934fa1c64b5f082b55b5 jdk7-b39 +3c53424bbe3bb77e01b468b4b0140deec33e11fc jdk7-b40 From 723644876623f583398c632a02dd9e474c054e60 Mon Sep 17 00:00:00 2001 From: "J. Duke" <duke@openjdk.org> Date: Wed, 5 Jul 2017 16:44:10 +0200 Subject: [PATCH 264/267] Added tag jdk7-b41 for changeset 3cb2a607c347 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 04640e3354d..74ffa4a5911 100644 --- a/.hgtags +++ b/.hgtags @@ -15,3 +15,4 @@ c2036bf76829c03b99108fffab52e20910a9be4f jdk7-b37 a2879b2837f5a4c87e9542efe69ef138194af8ff jdk7-b38 126f365cec6c3c2c72de934fa1c64b5f082b55b5 jdk7-b39 3c53424bbe3bb77e01b468b4b0140deec33e11fc jdk7-b40 +3cb2a607c347934f8e7e86f840a094c28b08d9ea jdk7-b41 From 34fa2378f9b7cb36228eb037e96e4788360b73fc Mon Sep 17 00:00:00 2001 From: "J. Duke" <duke@openjdk.org> Date: Wed, 5 Jul 2017 16:44:40 +0200 Subject: [PATCH 265/267] Added tag jdk7-b42 for changeset caf58ffa0845 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 74ffa4a5911..df602413e65 100644 --- a/.hgtags +++ b/.hgtags @@ -16,3 +16,4 @@ a2879b2837f5a4c87e9542efe69ef138194af8ff jdk7-b38 126f365cec6c3c2c72de934fa1c64b5f082b55b5 jdk7-b39 3c53424bbe3bb77e01b468b4b0140deec33e11fc jdk7-b40 3cb2a607c347934f8e7e86f840a094c28b08d9ea jdk7-b41 +caf58ffa084568990cbb3441f9ae188e36b31770 jdk7-b42 From 8fbcdf83c016d8941b8dbc43491dd384129ab5e1 Mon Sep 17 00:00:00 2001 From: "J. Duke" <duke@openjdk.org> Date: Wed, 5 Jul 2017 16:45:14 +0200 Subject: [PATCH 266/267] Added tag jdk7-b43 for changeset 41bd0a702bc8 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index df602413e65..fc041e46921 100644 --- a/.hgtags +++ b/.hgtags @@ -17,3 +17,4 @@ a2879b2837f5a4c87e9542efe69ef138194af8ff jdk7-b38 3c53424bbe3bb77e01b468b4b0140deec33e11fc jdk7-b40 3cb2a607c347934f8e7e86f840a094c28b08d9ea jdk7-b41 caf58ffa084568990cbb3441f9ae188e36b31770 jdk7-b42 +41bd0a702bc8ec6feebd725a63e7c3227f82ab11 jdk7-b43 From 69c61f7b1738f13ef162432b4d12a8dedae85af3 Mon Sep 17 00:00:00 2001 From: "J. Duke" <duke@openjdk.org> Date: Wed, 5 Jul 2017 16:45:39 +0200 Subject: [PATCH 267/267] Added tag jdk7-b44 for changeset 5843778bda89 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index fc041e46921..75a7d82083f 100644 --- a/.hgtags +++ b/.hgtags @@ -18,3 +18,4 @@ a2879b2837f5a4c87e9542efe69ef138194af8ff jdk7-b38 3cb2a607c347934f8e7e86f840a094c28b08d9ea jdk7-b41 caf58ffa084568990cbb3441f9ae188e36b31770 jdk7-b42 41bd0a702bc8ec6feebd725a63e7c3227f82ab11 jdk7-b43 +5843778bda89b1d5ac8e1aa05e26930ac90b3145 jdk7-b44