From 475df1c06a778fb921d70928c95eb6edfc553db0 Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Tue, 16 Oct 2018 11:27:21 +0200 Subject: [PATCH 01/66] 8210492: PLAB object promotion events report object sizes in words Properly scale values passed to the JFR event. Reviewed-by: phh, jcbeyler --- src/hotspot/share/gc/g1/g1ParScanThreadState.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp b/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp index 5dffc6ba8d6..517cba5e3cb 100644 --- a/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp +++ b/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp @@ -201,11 +201,11 @@ void G1ParScanThreadState::report_promotion_event(InCSetState const dest_state, HeapWord * const obj_ptr) const { PLAB* alloc_buf = _plab_allocator->alloc_buffer(dest_state); if (alloc_buf->contains(obj_ptr)) { - _g1h->_gc_tracer_stw->report_promotion_in_new_plab_event(old->klass(), word_sz, age, + _g1h->_gc_tracer_stw->report_promotion_in_new_plab_event(old->klass(), word_sz * HeapWordSize, age, dest_state.value() == InCSetState::Old, alloc_buf->word_sz()); } else { - _g1h->_gc_tracer_stw->report_promotion_outside_plab_event(old->klass(), word_sz, age, + _g1h->_gc_tracer_stw->report_promotion_outside_plab_event(old->klass(), word_sz * HeapWordSize, age, dest_state.value() == InCSetState::Old); } } From 7c3ce3aee09d967f7d7db66b505bfba11c4c7546 Mon Sep 17 00:00:00 2001 From: Robin Westberg Date: Tue, 16 Oct 2018 11:32:49 +0200 Subject: [PATCH 02/66] 8212004: Optional compile_commands.json field not compatible with older libclang Reviewed-by: erikj --- make/common/NativeCompilation.gmk | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/make/common/NativeCompilation.gmk b/make/common/NativeCompilation.gmk index 7b409256870..387fe469437 100644 --- a/make/common/NativeCompilation.gmk +++ b/make/common/NativeCompilation.gmk @@ -67,7 +67,6 @@ endef # Param 2: Working directory # Param 3: Source file # Param 4: Compile command -# Param 5: Object name ################################################################################ define WriteCompileCommandsFragment $(call LogInfo, Creating compile commands fragment for $(notdir $3)) @@ -76,8 +75,7 @@ define WriteCompileCommandsFragment "directory": "$(strip $2)"$(COMMA) \ "file": "$(strip $3)"$(COMMA) \ "command": "$(strip $(subst $(DQUOTE),\$(DQUOTE),$(subst \,\\,\ - $(subst $(FIXPATH),,$4))))"$(COMMA) \ - "output": "$(strip $5)" \ + $(subst $(FIXPATH),,$4))))" \ }$(COMMA), \ $1) endef @@ -331,7 +329,7 @@ define SetupCompileNativeFileBody $$($1_OBJ_JSON): $$($1_OBJ_DEPS) $$(call WriteCompileCommandsFragment, $$@, $$(PWD), $$($1_SRC_FILE), \ - $$($1_COMPILER) $$($1_COMPILE_OPTIONS), $$($1_OBJ)) + $$($1_COMPILER) $$($1_COMPILE_OPTIONS)) $$($1_OBJ): $$($1_OBJ_DEPS) | $$($$($1_BASE)_BUILD_INFO) $$(call LogInfo, Compiling $$($1_FILENAME) (for $$($$($1_BASE)_BASENAME))) @@ -744,7 +742,7 @@ define SetupNativeCompilationBody $$($1_PCH_FILE_JSON): $$($1_PRECOMPILED_HEADER) $$($1_COMPILE_VARDEPS_FILE) $$(call WriteCompileCommandsFragment, $$@, $$(PWD), $$<, \ - $$($1_PCH_COMMAND) $$< -o $$($1_PCH_FILE), $$($1_PCH_FILE)) + $$($1_PCH_COMMAND) $$< -o $$($1_PCH_FILE)) endif endif endif From 1e40cb40524729a5e055322d9d59affbbd43ef2b Mon Sep 17 00:00:00 2001 From: Daniel Fuchs Date: Tue, 16 Oct 2018 12:38:46 +0100 Subject: [PATCH 03/66] 8211960: broken links in java.util.logging Reviewed-by: mchung, chegar --- .../share/classes/java/util/logging/SimpleFormatter.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/java.logging/share/classes/java/util/logging/SimpleFormatter.java b/src/java.logging/share/classes/java/util/logging/SimpleFormatter.java index 2324940502e..640949db4d1 100644 --- a/src/java.logging/share/classes/java/util/logging/SimpleFormatter.java +++ b/src/java.logging/share/classes/java/util/logging/SimpleFormatter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,8 +38,7 @@ import jdk.internal.logger.SurrogateLogger; *

* * Configuration: - * The {@code SimpleFormatter} is initialized with the - * format string + * The {@code SimpleFormatter} is initialized with the format string * specified in the {@code java.util.logging.SimpleFormatter.format} * property to {@linkplain #format(LogRecord) format} the log messages. * This property can be defined @@ -69,8 +68,7 @@ public class SimpleFormatter extends Formatter { /** * Format the given LogRecord. *

- * The formatting can be customized by specifying the - * format string + * The formatting can be customized by specifying the format string * in the * {@code java.util.logging.SimpleFormatter.format} property. * The given {@code LogRecord} will be formatted as if by calling: From 5f2b11d3730586659d7977f3981a8132d571147c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20Lid=C3=A9n?= Date: Tue, 16 Oct 2018 13:43:04 +0200 Subject: [PATCH 04/66] 8212181: ZGC: Fix incorrect root iteration in ZHeapIterator Reviewed-by: eosterlund --- src/hotspot/share/gc/z/zHeapIterator.cpp | 65 +++++++++++------------- src/hotspot/share/gc/z/zHeapIterator.hpp | 8 +-- 2 files changed, 31 insertions(+), 42 deletions(-) diff --git a/src/hotspot/share/gc/z/zHeapIterator.cpp b/src/hotspot/share/gc/z/zHeapIterator.cpp index 749eb1062a4..2717a272b4a 100644 --- a/src/hotspot/share/gc/z/zHeapIterator.cpp +++ b/src/hotspot/share/gc/z/zHeapIterator.cpp @@ -29,7 +29,6 @@ #include "gc/z/zOop.inline.hpp" #include "gc/z/zRootsIterator.hpp" #include "memory/iterator.inline.hpp" -#include "oops/oop.inline.hpp" #include "utilities/bitMap.inline.hpp" #include "utilities/stack.inline.hpp" @@ -54,19 +53,18 @@ public: class ZHeapIteratorRootOopClosure : public ZRootsIteratorClosure { private: ZHeapIterator* const _iter; - ObjectClosure* const _cl; public: - ZHeapIteratorRootOopClosure(ZHeapIterator* iter, ObjectClosure* cl) : - _iter(iter), - _cl(cl) {} + ZHeapIteratorRootOopClosure(ZHeapIterator* iter) : + _iter(iter) {} virtual void do_oop(oop* p) { // Load barrier needed here for the same reason we - // need fixup_partial_loads() in ZHeap::mark_end() + // need fixup_partial_loads() in ZHeap::mark_end(). + // This barrier is also needed here in case we're + // treating the JVMTI weak tag map as strong roots. const oop obj = ZBarrier::load_barrier_on_oop_field(p); _iter->push(obj); - _iter->drain(_cl); } virtual void do_oop(narrowOop* p) { @@ -74,19 +72,13 @@ public: } }; -class ZHeapIteratorPushOopClosure : public BasicOopIterateClosure { +class ZHeapIteratorOopClosure : public BasicOopIterateClosure { private: ZHeapIterator* const _iter; const oop _base; const bool _visit_referents; -public: - ZHeapIteratorPushOopClosure(ZHeapIterator* iter, oop base) : - _iter(iter), - _base(base), - _visit_referents(iter->visit_referents()) {} - - oop load_oop(oop* p) { + oop load_oop(oop* p) const { if (_visit_referents) { return HeapAccess::oop_load_at(_base, _base->field_offset(p)); } else { @@ -94,6 +86,12 @@ public: } } +public: + ZHeapIteratorOopClosure(ZHeapIterator* iter, oop base, bool visit_referents) : + _iter(iter), + _base(base), + _visit_referents(visit_referents) {} + virtual ReferenceIterationMode reference_iteration_mode() { return _visit_referents ? DO_FIELDS : DO_FIELDS_EXCEPT_REFERENT; } @@ -126,11 +124,11 @@ ZHeapIterator::~ZHeapIterator() { } } -size_t ZHeapIterator::object_index_max() const { +static size_t object_index_max() { return ZPageSizeMin >> ZObjectAlignmentSmallShift; } -size_t ZHeapIterator::object_index(oop obj) const { +static size_t object_index(oop obj) { const uintptr_t addr = ZOop::to_address(obj); const uintptr_t offset = ZAddress::offset(addr); const uintptr_t mask = (1 << ZPageSizeMinShift) - 1; @@ -165,7 +163,20 @@ void ZHeapIterator::push(oop obj) { _visit_stack.push(obj); } -void ZHeapIterator::drain(ObjectClosure* cl) { +void ZHeapIterator::objects_do(ObjectClosure* cl) { + // Push roots onto stack + { + // Note that we also visit the JVMTI weak tag map as if they were + // strong roots to make sure we visit all tagged objects, even + // those that might now have become unreachable. If we didn't do + // this the user would have expected to see ObjectFree events for + // unreachable objects in the tag map. + ZRootsIterator roots; + ZHeapIteratorRootOopClosure root_cl(this); + roots.oops_do(&root_cl, true /* visit_jvmti_weak_export */); + } + + // Drain stack while (!_visit_stack.is_empty()) { const oop obj = _visit_stack.pop(); @@ -173,23 +184,7 @@ void ZHeapIterator::drain(ObjectClosure* cl) { cl->do_object(obj); // Push members to visit - ZHeapIteratorPushOopClosure push_cl(this, obj); + ZHeapIteratorOopClosure push_cl(this, obj, _visit_referents); obj->oop_iterate(&push_cl); } } - -bool ZHeapIterator::visit_referents() const { - return _visit_referents; -} - -void ZHeapIterator::objects_do(ObjectClosure* cl) { - ZHeapIteratorRootOopClosure root_cl(this, cl); - ZRootsIterator roots; - - // Follow roots. Note that we also visit the JVMTI weak tag map - // as if they were strong roots to make sure we visit all tagged - // objects, even those that might now have become unreachable. - // If we didn't do this the user would have expected to see - // ObjectFree events for unreachable objects in the tag map. - roots.oops_do(&root_cl, true /* visit_jvmti_weak_export */); -} diff --git a/src/hotspot/share/gc/z/zHeapIterator.hpp b/src/hotspot/share/gc/z/zHeapIterator.hpp index 5da99e32f2c..ad5014ff11c 100644 --- a/src/hotspot/share/gc/z/zHeapIterator.hpp +++ b/src/hotspot/share/gc/z/zHeapIterator.hpp @@ -33,7 +33,7 @@ class ZHeapIteratorBitMap; class ZHeapIterator : public StackObj { friend class ZHeapIteratorRootOopClosure; - friend class ZHeapIteratorPushOopClosure; + friend class ZHeapIteratorOopClosure; private: typedef ZAddressRangeMap ZVisitMap; @@ -44,14 +44,8 @@ private: ZVisitMap _visit_map; const bool _visit_referents; - size_t object_index_max() const; - size_t object_index(oop obj) const; ZHeapIteratorBitMap* object_map(oop obj); - void push(oop obj); - void drain(ObjectClosure* cl); - - bool visit_referents() const; public: ZHeapIterator(bool visit_referents); From 782fa608d24227c57712fdc77cce456edac453c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20=C3=96sterlund?= Date: Tue, 16 Oct 2018 13:14:18 +0200 Subject: [PATCH 05/66] 8210064: ZGC: Introduce ZConcurrentRootsIterator for scanning a subset of strong IN_NATIVE roots concurrently Reviewed-by: pliden, kbarrett --- .../share/classfile/classLoaderDataGraph.cpp | 8 +-- src/hotspot/share/gc/z/zCollectedHeap.cpp | 9 +++ src/hotspot/share/gc/z/zCollectedHeap.hpp | 3 + src/hotspot/share/gc/z/zDriver.cpp | 4 +- src/hotspot/share/gc/z/zHeap.cpp | 4 +- src/hotspot/share/gc/z/zHeap.hpp | 2 +- src/hotspot/share/gc/z/zHeapIterator.cpp | 2 + src/hotspot/share/gc/z/zMark.cpp | 35 ++++++++++- src/hotspot/share/gc/z/zMark.hpp | 2 +- src/hotspot/share/gc/z/zRootsIterator.cpp | 63 +++++++++++++------ src/hotspot/share/gc/z/zRootsIterator.hpp | 51 +++++++++------ src/hotspot/share/runtime/mutexLocker.cpp | 10 +++ src/hotspot/share/runtime/mutexLocker.hpp | 2 + 13 files changed, 146 insertions(+), 49 deletions(-) diff --git a/src/hotspot/share/classfile/classLoaderDataGraph.cpp b/src/hotspot/share/classfile/classLoaderDataGraph.cpp index 9340d03c4b0..b4bb29588c3 100644 --- a/src/hotspot/share/classfile/classLoaderDataGraph.cpp +++ b/src/hotspot/share/classfile/classLoaderDataGraph.cpp @@ -231,14 +231,14 @@ ClassLoaderData* ClassLoaderDataGraph::add(Handle loader, bool is_unsafe_anonymo } void ClassLoaderDataGraph::cld_do(CLDClosure* cl) { - assert_locked_or_safepoint(ClassLoaderDataGraph_lock); + assert_locked_or_safepoint_weak(ClassLoaderDataGraph_lock); for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->_next) { cl->do_cld(cld); } } void ClassLoaderDataGraph::cld_unloading_do(CLDClosure* cl) { - assert_locked_or_safepoint(ClassLoaderDataGraph_lock); + assert_locked_or_safepoint_weak(ClassLoaderDataGraph_lock); // Only walk the head until any clds not purged from prior unloading // (CMS doesn't purge right away). for (ClassLoaderData* cld = _unloading; cld != _saved_unloading; cld = cld->next()) { @@ -248,7 +248,7 @@ void ClassLoaderDataGraph::cld_unloading_do(CLDClosure* cl) { } void ClassLoaderDataGraph::roots_cld_do(CLDClosure* strong, CLDClosure* weak) { - assert_locked_or_safepoint(ClassLoaderDataGraph_lock); + assert_locked_or_safepoint_weak(ClassLoaderDataGraph_lock); for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->_next) { CLDClosure* closure = cld->keep_alive() ? strong : weak; if (closure != NULL) { @@ -258,7 +258,7 @@ void ClassLoaderDataGraph::roots_cld_do(CLDClosure* strong, CLDClosure* weak) { } void ClassLoaderDataGraph::always_strong_cld_do(CLDClosure* cl) { - assert_locked_or_safepoint(ClassLoaderDataGraph_lock); + assert_locked_or_safepoint_weak(ClassLoaderDataGraph_lock); if (ClassUnloading) { roots_cld_do(cl, NULL); } else { diff --git a/src/hotspot/share/gc/z/zCollectedHeap.cpp b/src/hotspot/share/gc/z/zCollectedHeap.cpp index 849e1b9c550..4815a625297 100644 --- a/src/hotspot/share/gc/z/zCollectedHeap.cpp +++ b/src/hotspot/share/gc/z/zCollectedHeap.cpp @@ -23,6 +23,7 @@ #include "precompiled.hpp" #include "gc/shared/gcHeapSummary.hpp" +#include "gc/shared/suspendibleThreadSet.hpp" #include "gc/z/zCollectedHeap.hpp" #include "gc/z/zGlobals.hpp" #include "gc/z/zHeap.inline.hpp" @@ -295,6 +296,14 @@ VirtualSpaceSummary ZCollectedHeap::create_heap_space_summary() { reserved_region().start() + max_capacity_in_words); } +void ZCollectedHeap::safepoint_synchronize_begin() { + SuspendibleThreadSet::synchronize(); +} + +void ZCollectedHeap::safepoint_synchronize_end() { + SuspendibleThreadSet::desynchronize(); +} + void ZCollectedHeap::prepare_for_verify() { // Does nothing } diff --git a/src/hotspot/share/gc/z/zCollectedHeap.hpp b/src/hotspot/share/gc/z/zCollectedHeap.hpp index f36f3f00433..0ada2f32ac0 100644 --- a/src/hotspot/share/gc/z/zCollectedHeap.hpp +++ b/src/hotspot/share/gc/z/zCollectedHeap.hpp @@ -117,6 +117,9 @@ public: virtual VirtualSpaceSummary create_heap_space_summary(); + virtual void safepoint_synchronize_begin(); + virtual void safepoint_synchronize_end(); + virtual void print_on(outputStream* st) const; virtual void print_on_error(outputStream* st) const; virtual void print_extended_on(outputStream* st) const; diff --git a/src/hotspot/share/gc/z/zDriver.cpp b/src/hotspot/share/gc/z/zDriver.cpp index a4353f6b6ec..11ad024e5db 100644 --- a/src/hotspot/share/gc/z/zDriver.cpp +++ b/src/hotspot/share/gc/z/zDriver.cpp @@ -336,7 +336,7 @@ void ZDriver::run_gc_cycle(GCCause::Cause cause) { // Phase 2: Concurrent Mark { ZStatTimer timer(ZPhaseConcurrentMark); - ZHeap::heap()->mark(); + ZHeap::heap()->mark(true /* initial */); } // Phase 3: Pause Mark End @@ -345,7 +345,7 @@ void ZDriver::run_gc_cycle(GCCause::Cause cause) { while (!vm_operation(&cl)) { // Phase 3.5: Concurrent Mark Continue ZStatTimer timer(ZPhaseConcurrentMarkContinue); - ZHeap::heap()->mark(); + ZHeap::heap()->mark(false /* initial */); } } diff --git a/src/hotspot/share/gc/z/zHeap.cpp b/src/hotspot/share/gc/z/zHeap.cpp index 5b5761ab0a6..fdd747e5c24 100644 --- a/src/hotspot/share/gc/z/zHeap.cpp +++ b/src/hotspot/share/gc/z/zHeap.cpp @@ -296,8 +296,8 @@ void ZHeap::mark_start() { ZStatHeap::set_at_mark_start(capacity(), used()); } -void ZHeap::mark() { - _mark.mark(); +void ZHeap::mark(bool initial) { + _mark.mark(initial); } void ZHeap::mark_flush_and_free(Thread* thread) { diff --git a/src/hotspot/share/gc/z/zHeap.hpp b/src/hotspot/share/gc/z/zHeap.hpp index 5ea4b36db46..c526427c76d 100644 --- a/src/hotspot/share/gc/z/zHeap.hpp +++ b/src/hotspot/share/gc/z/zHeap.hpp @@ -133,7 +133,7 @@ public: bool is_object_strongly_live(uintptr_t addr) const; template void mark_object(uintptr_t addr); void mark_start(); - void mark(); + void mark(bool initial); void mark_flush_and_free(Thread* thread); bool mark_end(); diff --git a/src/hotspot/share/gc/z/zHeapIterator.cpp b/src/hotspot/share/gc/z/zHeapIterator.cpp index 2717a272b4a..cc43ae25b62 100644 --- a/src/hotspot/share/gc/z/zHeapIterator.cpp +++ b/src/hotspot/share/gc/z/zHeapIterator.cpp @@ -172,8 +172,10 @@ void ZHeapIterator::objects_do(ObjectClosure* cl) { // this the user would have expected to see ObjectFree events for // unreachable objects in the tag map. ZRootsIterator roots; + ZConcurrentRootsIterator concurrent_roots(false /* marking */); ZHeapIteratorRootOopClosure root_cl(this); roots.oops_do(&root_cl, true /* visit_jvmti_weak_export */); + concurrent_roots.oops_do(&root_cl); } // Drain stack diff --git a/src/hotspot/share/gc/z/zMark.cpp b/src/hotspot/share/gc/z/zMark.cpp index c9467a1f79d..f713d0cc60c 100644 --- a/src/hotspot/share/gc/z/zMark.cpp +++ b/src/hotspot/share/gc/z/zMark.cpp @@ -615,6 +615,34 @@ void ZMark::work(uint64_t timeout_in_millis) { stacks->free(&_allocator); } +class ZMarkConcurrentRootsIteratorClosure : public ZRootsIteratorClosure { +public: + virtual void do_oop(oop* p) { + ZBarrier::mark_barrier_on_oop_field(p, false /* finalizable */); + } + + virtual void do_oop(narrowOop* p) { + ShouldNotReachHere(); + } +}; + + +class ZMarkConcurrentRootsTask : public ZTask { +private: + ZConcurrentRootsIterator _roots; + ZMarkConcurrentRootsIteratorClosure _cl; + +public: + ZMarkConcurrentRootsTask(ZMark* mark) : + ZTask("ZMarkConcurrentRootsTask"), + _roots(true /* marking */), + _cl() {} + + virtual void work() { + _roots.oops_do(&_cl); + } +}; + class ZMarkTask : public ZTask { private: ZMark* const _mark; @@ -637,7 +665,12 @@ public: } }; -void ZMark::mark() { +void ZMark::mark(bool initial) { + if (initial) { + ZMarkConcurrentRootsTask task(this); + _workers->run_concurrent(&task); + } + ZMarkTask task(this); _workers->run_concurrent(&task); } diff --git a/src/hotspot/share/gc/z/zMark.hpp b/src/hotspot/share/gc/z/zMark.hpp index 727d9d9dda0..727abc7b716 100644 --- a/src/hotspot/share/gc/z/zMark.hpp +++ b/src/hotspot/share/gc/z/zMark.hpp @@ -108,7 +108,7 @@ public: template void mark_object(uintptr_t addr); void start(); - void mark(); + void mark(bool initial); bool end(); void flush_and_free(); diff --git a/src/hotspot/share/gc/z/zRootsIterator.cpp b/src/hotspot/share/gc/z/zRootsIterator.cpp index 84ac2338182..c0855ca0fb0 100644 --- a/src/hotspot/share/gc/z/zRootsIterator.cpp +++ b/src/hotspot/share/gc/z/zRootsIterator.cpp @@ -28,6 +28,7 @@ #include "code/codeCache.hpp" #include "compiler/oopMap.hpp" #include "gc/shared/oopStorageParState.inline.hpp" +#include "gc/shared/suspendibleThreadSet.hpp" #include "gc/z/zGlobals.hpp" #include "gc/z/zNMethodTable.hpp" #include "gc/z/zOopClosures.inline.hpp" @@ -52,16 +53,20 @@ static const ZStatSubPhase ZSubPhasePauseRootsSetup("Pause Roots Setup"); static const ZStatSubPhase ZSubPhasePauseRoots("Pause Roots"); static const ZStatSubPhase ZSubPhasePauseRootsTeardown("Pause Roots Teardown"); static const ZStatSubPhase ZSubPhasePauseRootsUniverse("Pause Roots Universe"); -static const ZStatSubPhase ZSubPhasePauseRootsJNIHandles("Pause Roots JNIHandles"); static const ZStatSubPhase ZSubPhasePauseRootsObjectSynchronizer("Pause Roots ObjectSynchronizer"); static const ZStatSubPhase ZSubPhasePauseRootsManagement("Pause Roots Management"); static const ZStatSubPhase ZSubPhasePauseRootsJVMTIExport("Pause Roots JVMTIExport"); static const ZStatSubPhase ZSubPhasePauseRootsJVMTIWeakExport("Pause Roots JVMTIWeakExport"); static const ZStatSubPhase ZSubPhasePauseRootsSystemDictionary("Pause Roots SystemDictionary"); -static const ZStatSubPhase ZSubPhasePauseRootsClassLoaderDataGraph("Pause Roots ClassLoaderDataGraph"); static const ZStatSubPhase ZSubPhasePauseRootsThreads("Pause Roots Threads"); static const ZStatSubPhase ZSubPhasePauseRootsCodeCache("Pause Roots CodeCache"); +static const ZStatSubPhase ZSubPhaseConcurrentRootsSetup("Concurrent Roots Setup"); +static const ZStatSubPhase ZSubPhaseConcurrentRoots("Concurrent Roots"); +static const ZStatSubPhase ZSubPhaseConcurrentRootsTeardown("Concurrent Roots Teardown"); +static const ZStatSubPhase ZSubPhaseConcurrentRootsJNIHandles("Concurrent Roots JNIHandles"); +static const ZStatSubPhase ZSubPhaseConcurrentRootsClassLoaderDataGraph("Concurrent Roots ClassLoaderDataGraph"); + static const ZStatSubPhase ZSubPhasePauseWeakRootsSetup("Pause Weak Roots Setup"); static const ZStatSubPhase ZSubPhasePauseWeakRoots("Pause Weak Roots"); static const ZStatSubPhase ZSubPhasePauseWeakRootsTeardown("Pause Weak Roots Teardown"); @@ -128,21 +133,17 @@ void ZParallelWeakOopsDo::weak_oops_do(BoolObjectClosure* is_alive, ZRoots } ZRootsIterator::ZRootsIterator() : - _jni_handles_iter(JNIHandles::global_handles()), _universe(this), _object_synchronizer(this), _management(this), _jvmti_export(this), _jvmti_weak_export(this), _system_dictionary(this), - _jni_handles(this), - _class_loader_data_graph(this), _threads(this), _code_cache(this) { assert(SafepointSynchronize::is_at_safepoint(), "Should be at safepoint"); ZStatTimer timer(ZSubPhasePauseRootsSetup); Threads::change_thread_claim_parity(); - ClassLoaderDataGraph::clear_claimed_marks(); COMPILER2_PRESENT(DerivedPointerTable::clear()); CodeCache::gc_prologue(); ZNMethodTable::gc_prologue(); @@ -163,11 +164,6 @@ void ZRootsIterator::do_universe(ZRootsIteratorClosure* cl) { Universe::oops_do(cl); } -void ZRootsIterator::do_jni_handles(ZRootsIteratorClosure* cl) { - ZStatTimer timer(ZSubPhasePauseRootsJNIHandles); - _jni_handles_iter.oops_do(cl); -} - void ZRootsIterator::do_object_synchronizer(ZRootsIteratorClosure* cl) { ZStatTimer timer(ZSubPhasePauseRootsObjectSynchronizer); ObjectSynchronizer::oops_do(cl); @@ -194,12 +190,6 @@ void ZRootsIterator::do_system_dictionary(ZRootsIteratorClosure* cl) { SystemDictionary::oops_do(cl); } -void ZRootsIterator::do_class_loader_data_graph(ZRootsIteratorClosure* cl) { - ZStatTimer timer(ZSubPhasePauseRootsClassLoaderDataGraph); - CLDToOopClosure cld_cl(cl); - ClassLoaderDataGraph::cld_do(&cld_cl); -} - void ZRootsIterator::do_threads(ZRootsIteratorClosure* cl) { ZStatTimer timer(ZSubPhasePauseRootsThreads); ResourceMark rm; @@ -218,8 +208,6 @@ void ZRootsIterator::oops_do(ZRootsIteratorClosure* cl, bool visit_jvmti_weak_ex _management.oops_do(cl); _jvmti_export.oops_do(cl); _system_dictionary.oops_do(cl); - _jni_handles.oops_do(cl); - _class_loader_data_graph.oops_do(cl); _threads.oops_do(cl); _code_cache.oops_do(cl); if (visit_jvmti_weak_export) { @@ -227,6 +215,43 @@ void ZRootsIterator::oops_do(ZRootsIteratorClosure* cl, bool visit_jvmti_weak_ex } } +ZConcurrentRootsIterator::ZConcurrentRootsIterator(bool marking) : + _marking(marking), + _sts_joiner(marking /* active */), + _jni_handles_iter(JNIHandles::global_handles()), + _jni_handles(this), + _class_loader_data_graph(this) { + ZStatTimer timer(ZSubPhaseConcurrentRootsSetup); + if (_marking) { + ClassLoaderDataGraph_lock->lock(); + ClassLoaderDataGraph::clear_claimed_marks(); + } +} + +ZConcurrentRootsIterator::~ZConcurrentRootsIterator() { + ZStatTimer timer(ZSubPhaseConcurrentRootsTeardown); + if (_marking) { + ClassLoaderDataGraph_lock->unlock(); + } +} + +void ZConcurrentRootsIterator::do_jni_handles(ZRootsIteratorClosure* cl) { + ZStatTimer timer(ZSubPhaseConcurrentRootsJNIHandles); + _jni_handles_iter.oops_do(cl); +} + +void ZConcurrentRootsIterator::do_class_loader_data_graph(ZRootsIteratorClosure* cl) { + ZStatTimer timer(ZSubPhaseConcurrentRootsClassLoaderDataGraph); + CLDToOopClosure cld_cl(cl, _marking /* must_claim */); + ClassLoaderDataGraph::cld_do(&cld_cl); +} + +void ZConcurrentRootsIterator::oops_do(ZRootsIteratorClosure* cl) { + ZStatTimer timer(ZSubPhaseConcurrentRoots); + _jni_handles.oops_do(cl); + _class_loader_data_graph.oops_do(cl); +} + ZWeakRootsIterator::ZWeakRootsIterator() : _jvmti_weak_export(this), _jfr_weak(this) { diff --git a/src/hotspot/share/gc/z/zRootsIterator.hpp b/src/hotspot/share/gc/z/zRootsIterator.hpp index 8bf9ff760bd..45c8bd7c3f8 100644 --- a/src/hotspot/share/gc/z/zRootsIterator.hpp +++ b/src/hotspot/share/gc/z/zRootsIterator.hpp @@ -25,6 +25,7 @@ #define SHARE_GC_Z_ZROOTSITERATOR_HPP #include "gc/shared/oopStorageParState.hpp" +#include "gc/shared/suspendibleThreadSet.hpp" #include "memory/allocation.hpp" #include "memory/iterator.hpp" #include "runtime/thread.hpp" @@ -37,8 +38,7 @@ public: } }; -typedef OopStorage::ParState ZOopStorageIterator; -typedef OopStorage::ParState ZConcurrentOopStorageIterator; +typedef OopStorage::ParState ZOopStorageIterator; template class ZSerialOopsDo { @@ -86,29 +86,23 @@ public: class ZRootsIterator { private: - ZOopStorageIterator _jni_handles_iter; - void do_universe(ZRootsIteratorClosure* cl); - void do_jni_handles(ZRootsIteratorClosure* cl); void do_object_synchronizer(ZRootsIteratorClosure* cl); void do_management(ZRootsIteratorClosure* cl); void do_jvmti_export(ZRootsIteratorClosure* cl); void do_jvmti_weak_export(ZRootsIteratorClosure* cl); void do_system_dictionary(ZRootsIteratorClosure* cl); - void do_class_loader_data_graph(ZRootsIteratorClosure* cl); void do_threads(ZRootsIteratorClosure* cl); void do_code_cache(ZRootsIteratorClosure* cl); - ZSerialOopsDo _universe; - ZSerialOopsDo _object_synchronizer; - ZSerialOopsDo _management; - ZSerialOopsDo _jvmti_export; - ZSerialOopsDo _jvmti_weak_export; - ZSerialOopsDo _system_dictionary; - ZParallelOopsDo _jni_handles; - ZParallelOopsDo _class_loader_data_graph; - ZParallelOopsDo _threads; - ZParallelOopsDo _code_cache; + ZSerialOopsDo _universe; + ZSerialOopsDo _object_synchronizer; + ZSerialOopsDo _management; + ZSerialOopsDo _jvmti_export; + ZSerialOopsDo _jvmti_weak_export; + ZSerialOopsDo _system_dictionary; + ZParallelOopsDo _threads; + ZParallelOopsDo _code_cache; public: ZRootsIterator(); @@ -117,6 +111,25 @@ public: void oops_do(ZRootsIteratorClosure* cl, bool visit_jvmti_weak_export = false); }; +class ZConcurrentRootsIterator { +private: + const bool _marking; + SuspendibleThreadSetJoiner _sts_joiner; + ZOopStorageIterator _jni_handles_iter; + + void do_jni_handles(ZRootsIteratorClosure* cl); + void do_class_loader_data_graph(ZRootsIteratorClosure* cl); + + ZParallelOopsDo _jni_handles; + ZParallelOopsDo _class_loader_data_graph; + +public: + ZConcurrentRootsIterator(bool marking); + ~ZConcurrentRootsIterator(); + + void oops_do(ZRootsIteratorClosure* cl); +}; + class ZWeakRootsIterator { private: void do_jvmti_weak_export(BoolObjectClosure* is_alive, ZRootsIteratorClosure* cl); @@ -135,9 +148,9 @@ public: class ZConcurrentWeakRootsIterator { private: - ZConcurrentOopStorageIterator _vm_weak_handles_iter; - ZConcurrentOopStorageIterator _jni_weak_handles_iter; - ZConcurrentOopStorageIterator _string_table_iter; + ZOopStorageIterator _vm_weak_handles_iter; + ZOopStorageIterator _jni_weak_handles_iter; + ZOopStorageIterator _string_table_iter; void do_vm_weak_handles(ZRootsIteratorClosure* cl); void do_jni_weak_handles(ZRootsIteratorClosure* cl); diff --git a/src/hotspot/share/runtime/mutexLocker.cpp b/src/hotspot/share/runtime/mutexLocker.cpp index 59c524a8076..9253afd8d2d 100644 --- a/src/hotspot/share/runtime/mutexLocker.cpp +++ b/src/hotspot/share/runtime/mutexLocker.cpp @@ -166,6 +166,16 @@ void assert_locked_or_safepoint(const Monitor * lock) { fatal("must own lock %s", lock->name()); } +// a weaker assertion than the above +void assert_locked_or_safepoint_weak(const Monitor * lock) { + if (IgnoreLockingAssertions) return; + assert(lock != NULL, "Need non-NULL lock"); + if (lock->is_locked()) return; + if (SafepointSynchronize::is_at_safepoint()) return; + if (!Universe::is_fully_initialized()) return; + fatal("must own lock %s", lock->name()); +} + // a stronger assertion than the above void assert_lock_strong(const Monitor * lock) { if (IgnoreLockingAssertions) return; diff --git a/src/hotspot/share/runtime/mutexLocker.hpp b/src/hotspot/share/runtime/mutexLocker.hpp index 9a589b8179f..abfd401b01f 100644 --- a/src/hotspot/share/runtime/mutexLocker.hpp +++ b/src/hotspot/share/runtime/mutexLocker.hpp @@ -199,9 +199,11 @@ class MutexLocker: StackObj { // for debugging: check that we're already owning this lock (or are at a safepoint) #ifdef ASSERT void assert_locked_or_safepoint(const Monitor * lock); +void assert_locked_or_safepoint_weak(const Monitor * lock); void assert_lock_strong(const Monitor * lock); #else #define assert_locked_or_safepoint(lock) +#define assert_locked_or_safepoint_weak(lock) #define assert_lock_strong(lock) #endif From e39c5811b558e378a4d05ecea6be203a0524233e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20=C3=96sterlund?= Date: Tue, 16 Oct 2018 13:16:11 +0200 Subject: [PATCH 06/66] 8210330: Make CLD claiming allow multiple claim bits Reviewed-by: pliden, coleenp --- .../share/classfile/classLoaderData.cpp | 21 +++++++++------- .../share/classfile/classLoaderData.hpp | 24 +++++++++++++------ .../share/classfile/classLoaderDataGraph.cpp | 2 +- .../share/gc/cms/cmsOopClosures.inline.hpp | 3 +-- .../gc/cms/concurrentMarkSweepGeneration.cpp | 10 ++++---- .../share/gc/g1/g1FullGCAdjustTask.cpp | 2 +- src/hotspot/share/gc/g1/g1FullGCMarker.cpp | 3 ++- src/hotspot/share/gc/g1/g1HeapVerifier.cpp | 4 ++-- src/hotspot/share/gc/g1/g1OopClosures.cpp | 2 +- src/hotspot/share/gc/g1/g1OopClosures.hpp | 6 ++--- src/hotspot/share/gc/g1/g1RootClosures.cpp | 6 ++--- src/hotspot/share/gc/g1/g1SharedClosures.hpp | 4 ++-- src/hotspot/share/gc/parallel/pcTasks.cpp | 2 +- .../share/gc/parallel/psParallelCompact.cpp | 2 +- .../share/gc/serial/defNewGeneration.cpp | 2 +- src/hotspot/share/gc/serial/markSweep.cpp | 6 ++--- src/hotspot/share/gc/z/zRootsIterator.cpp | 2 +- .../leakprofiler/chains/rootSetClosure.cpp | 2 +- .../leakprofiler/checkpoint/rootResolver.cpp | 2 +- .../leakprofiler/utilities/saveRestore.cpp | 4 ++-- src/hotspot/share/memory/iterator.cpp | 2 +- src/hotspot/share/memory/iterator.hpp | 7 +++--- src/hotspot/share/memory/iterator.inline.hpp | 3 +-- 23 files changed, 68 insertions(+), 53 deletions(-) diff --git a/src/hotspot/share/classfile/classLoaderData.cpp b/src/hotspot/share/classfile/classLoaderData.cpp index 6311bbbc2a2..184b14f8177 100644 --- a/src/hotspot/share/classfile/classLoaderData.cpp +++ b/src/hotspot/share/classfile/classLoaderData.cpp @@ -139,7 +139,7 @@ ClassLoaderData::ClassLoaderData(Handle h_class_loader, bool is_unsafe_anonymous // it from being unloaded during parsing of the unsafe anonymous class. // The null-class-loader should always be kept alive. _keep_alive((is_unsafe_anonymous || h_class_loader.is_null()) ? 1 : 0), - _claimed(0), + _claim(0), _handles(), _klasses(NULL), _packages(NULL), _modules(NULL), _unnamed_module(NULL), _dictionary(NULL), _jmethod_ids(NULL), @@ -268,12 +268,17 @@ bool ClassLoaderData::ChunkedHandleList::owner_of(oop* oop_handle) { } #endif // PRODUCT -bool ClassLoaderData::claim() { - if (_claimed == 1) { - return false; +bool ClassLoaderData::try_claim(int claim) { + for (;;) { + int old_claim = Atomic::load(&_claim); + if ((old_claim & claim) == claim) { + return false; + } + int new_claim = old_claim | claim; + if (Atomic::cmpxchg(new_claim, &_claim, old_claim) == old_claim) { + return true; + } } - - return (int) Atomic::cmpxchg(1, &_claimed, 0) == 0; } // Unsafe anonymous classes have their own ClassLoaderData that is marked to keep alive @@ -295,8 +300,8 @@ void ClassLoaderData::dec_keep_alive() { } } -void ClassLoaderData::oops_do(OopClosure* f, bool must_claim, bool clear_mod_oops) { - if (must_claim && !claim()) { +void ClassLoaderData::oops_do(OopClosure* f, int claim_value, bool clear_mod_oops) { + if (claim_value != ClassLoaderData::_claim_none && !try_claim(claim_value)) { return; } diff --git a/src/hotspot/share/classfile/classLoaderData.hpp b/src/hotspot/share/classfile/classLoaderData.hpp index 15bdb32ee03..a36f2572837 100644 --- a/src/hotspot/share/classfile/classLoaderData.hpp +++ b/src/hotspot/share/classfile/classLoaderData.hpp @@ -128,9 +128,8 @@ class ClassLoaderData : public CHeapObj { // loader. _keep_alive does not need to be volatile or // atomic since there is one unique CLD per unsafe anonymous class. - volatile int _claimed; // true if claimed, for example during GC traces. - // To avoid applying oop closure more than once. - // Has to be an int because we cas it. + volatile int _claim; // non-zero if claimed, for example during GC traces. + // To avoid applying oop closure more than once. ChunkedHandleList _handles; // Handles to constant pool arrays, Modules, etc, which // have the same life cycle of the corresponding ClassLoader. @@ -200,11 +199,22 @@ class ClassLoaderData : public CHeapObj { Dictionary* create_dictionary(); void initialize_name(Handle class_loader); + public: // GC interface. - void clear_claimed() { _claimed = 0; } - bool claimed() const { return _claimed == 1; } - bool claim(); + + // The "claim" is typically used to check if oops_do needs to be applied on + // the CLD or not. Most GCs only perform strong marking during the marking phase. + enum { + _claim_none = 0, + _claim_finalizable = 2, + _claim_strong = 3 + }; + void clear_claim() { _claim = 0; } + bool claimed() const { return _claim != 0; } + bool try_claim(int claim); + int get_claim() const { return _claim; } + void set_claim(int claim) { _claim = claim; } // Computes if the CLD is alive or not. This is safe to call in concurrent // contexts. @@ -264,7 +274,7 @@ class ClassLoaderData : public CHeapObj { void initialize_holder(Handle holder); - void oops_do(OopClosure* f, bool must_claim, bool clear_modified_oops = false); + void oops_do(OopClosure* f, int claim_value, bool clear_modified_oops = false); void classes_do(KlassClosure* klass_closure); Klass* klasses() { return _klasses; } diff --git a/src/hotspot/share/classfile/classLoaderDataGraph.cpp b/src/hotspot/share/classfile/classLoaderDataGraph.cpp index b4bb29588c3..350570e4f10 100644 --- a/src/hotspot/share/classfile/classLoaderDataGraph.cpp +++ b/src/hotspot/share/classfile/classLoaderDataGraph.cpp @@ -48,7 +48,7 @@ volatile size_t ClassLoaderDataGraph::_num_instance_classes = 0; void ClassLoaderDataGraph::clear_claimed_marks() { for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->next()) { - cld->clear_claimed(); + cld->clear_claim(); } } diff --git a/src/hotspot/share/gc/cms/cmsOopClosures.inline.hpp b/src/hotspot/share/gc/cms/cmsOopClosures.inline.hpp index 3b839c7fa39..8f6a772cfa6 100644 --- a/src/hotspot/share/gc/cms/cmsOopClosures.inline.hpp +++ b/src/hotspot/share/gc/cms/cmsOopClosures.inline.hpp @@ -41,8 +41,7 @@ inline void MetadataVisitingOopsInGenClosure::do_klass(Klass* k) { } inline void MetadataVisitingOopsInGenClosure::do_cld(ClassLoaderData* cld) { - bool claim = true; // Must claim the class loader data before processing. - cld->oops_do(this, claim); + cld->oops_do(this, ClassLoaderData::_claim_strong); } // Decode the oop and call do_oop on it. diff --git a/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp b/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp index 86e8a9d8e8e..0996e8ce37d 100644 --- a/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp +++ b/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp @@ -2398,7 +2398,7 @@ class VerifyCLDOopsCLDClosure : public CLDClosure { public: VerifyCLDOopsCLDClosure(CMSBitMap* bitmap) : _oop_closure(bitmap) {} void do_cld(ClassLoaderData* cld) { - cld->oops_do(&_oop_closure, false, false); + cld->oops_do(&_oop_closure, ClassLoaderData::_claim_none, false); } }; @@ -2413,7 +2413,7 @@ void CMSCollector::verify_after_remark_work_2() { // Mark from roots one level into CMS MarkRefsIntoVerifyClosure notOlder(_span, verification_mark_bm(), markBitMap()); - CLDToOopClosure cld_closure(¬Older, true); + CLDToOopClosure cld_closure(¬Older, ClassLoaderData::_claim_strong); heap->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel. @@ -2886,7 +2886,7 @@ void CMSCollector::checkpointRootsInitialWork() { } } else { // The serial version. - CLDToOopClosure cld_closure(¬Older, true); + CLDToOopClosure cld_closure(¬Older, ClassLoaderData::_claim_strong); heap->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel. StrongRootsScope srs(1); @@ -4269,7 +4269,7 @@ void CMSParInitialMarkTask::work(uint worker_id) { _timer.reset(); _timer.start(); - CLDToOopClosure cld_closure(&par_mri_cl, true); + CLDToOopClosure cld_closure(&par_mri_cl, ClassLoaderData::_claim_strong); heap->cms_process_roots(_strong_roots_scope, false, // yg was scanned above @@ -4331,7 +4331,7 @@ class CMSParRemarkTask: public CMSParMarkTask { class RemarkCLDClosure : public CLDClosure { CLDToOopClosure _cm_closure; public: - RemarkCLDClosure(OopClosure* oop_closure) : _cm_closure(oop_closure) {} + RemarkCLDClosure(OopClosure* oop_closure) : _cm_closure(oop_closure, ClassLoaderData::_claim_strong) {} void do_cld(ClassLoaderData* cld) { // Check if we have modified any oops in the CLD during the concurrent marking. if (cld->has_accumulated_modified_oops()) { diff --git a/src/hotspot/share/gc/g1/g1FullGCAdjustTask.cpp b/src/hotspot/share/gc/g1/g1FullGCAdjustTask.cpp index 3abd7af88f9..24ce09bdb22 100644 --- a/src/hotspot/share/gc/g1/g1FullGCAdjustTask.cpp +++ b/src/hotspot/share/gc/g1/g1FullGCAdjustTask.cpp @@ -108,7 +108,7 @@ void G1FullGCAdjustTask::work(uint worker_id) { AlwaysTrueClosure always_alive; _weak_proc_task.work(worker_id, &always_alive, &_adjust); - CLDToOopClosure adjust_cld(&_adjust); + CLDToOopClosure adjust_cld(&_adjust, ClassLoaderData::_claim_strong); CodeBlobToOopClosure adjust_code(&_adjust, CodeBlobToOopClosure::FixRelocations); _root_processor.process_all_roots( &_adjust, diff --git a/src/hotspot/share/gc/g1/g1FullGCMarker.cpp b/src/hotspot/share/gc/g1/g1FullGCMarker.cpp index 452f1898115..7276d57eb76 100644 --- a/src/hotspot/share/gc/g1/g1FullGCMarker.cpp +++ b/src/hotspot/share/gc/g1/g1FullGCMarker.cpp @@ -23,6 +23,7 @@ */ #include "precompiled.hpp" +#include "classfile/classLoaderData.hpp" #include "gc/g1/g1FullGCMarker.inline.hpp" #include "gc/shared/referenceProcessor.hpp" #include "memory/iterator.inline.hpp" @@ -36,7 +37,7 @@ G1FullGCMarker::G1FullGCMarker(uint worker_id, PreservedMarks* preserved_stack, _mark_closure(worker_id, this, G1CollectedHeap::heap()->ref_processor_stw()), _verify_closure(VerifyOption_G1UseFullMarking), _stack_closure(this), - _cld_closure(mark_closure()) { + _cld_closure(mark_closure(), ClassLoaderData::_claim_strong) { _oop_stack.initialize(); _objarray_stack.initialize(); } diff --git a/src/hotspot/share/gc/g1/g1HeapVerifier.cpp b/src/hotspot/share/gc/g1/g1HeapVerifier.cpp index a316c7a34e1..78cbd73e5be 100644 --- a/src/hotspot/share/gc/g1/g1HeapVerifier.cpp +++ b/src/hotspot/share/gc/g1/g1HeapVerifier.cpp @@ -170,10 +170,10 @@ class VerifyCLDClosure: public CLDClosure { public: VerifyCLDClosure(G1CollectedHeap* g1h, OopClosure* cl) : _young_ref_counter_closure(g1h), _oop_closure(cl) {} void do_cld(ClassLoaderData* cld) { - cld->oops_do(_oop_closure, false); + cld->oops_do(_oop_closure, ClassLoaderData::_claim_none); _young_ref_counter_closure.reset_count(); - cld->oops_do(&_young_ref_counter_closure, false); + cld->oops_do(&_young_ref_counter_closure, ClassLoaderData::_claim_none); if (_young_ref_counter_closure.count() > 0) { guarantee(cld->has_modified_oops(), "CLD " PTR_FORMAT ", has young %d refs but is not dirty.", p2i(cld), _young_ref_counter_closure.count()); } diff --git a/src/hotspot/share/gc/g1/g1OopClosures.cpp b/src/hotspot/share/gc/g1/g1OopClosures.cpp index 258e0e12299..3724153f49d 100644 --- a/src/hotspot/share/gc/g1/g1OopClosures.cpp +++ b/src/hotspot/share/gc/g1/g1OopClosures.cpp @@ -52,7 +52,7 @@ void G1CLDScanClosure::do_cld(ClassLoaderData* cld) { // Clean the cld since we're going to scavenge all the metadata. // Clear modified oops only if this cld is claimed. - cld->oops_do(_closure, _must_claim, /*clear_modified_oops*/true); + cld->oops_do(_closure, _claim, /*clear_modified_oops*/true); _closure->set_scanned_cld(NULL); diff --git a/src/hotspot/share/gc/g1/g1OopClosures.hpp b/src/hotspot/share/gc/g1/g1OopClosures.hpp index 5e08e01c3ab..a15f870e6ec 100644 --- a/src/hotspot/share/gc/g1/g1OopClosures.hpp +++ b/src/hotspot/share/gc/g1/g1OopClosures.hpp @@ -160,12 +160,12 @@ public: class G1CLDScanClosure : public CLDClosure { G1ParCopyHelper* _closure; bool _process_only_dirty; - bool _must_claim; + int _claim; int _count; public: G1CLDScanClosure(G1ParCopyHelper* closure, - bool process_only_dirty, bool must_claim) - : _closure(closure), _process_only_dirty(process_only_dirty), _must_claim(must_claim), _count(0) {} + bool process_only_dirty, int claim_value) + : _closure(closure), _process_only_dirty(process_only_dirty), _claim(claim_value), _count(0) {} void do_cld(ClassLoaderData* cld); }; diff --git a/src/hotspot/share/gc/g1/g1RootClosures.cpp b/src/hotspot/share/gc/g1/g1RootClosures.cpp index 41f8c953242..70c01306628 100644 --- a/src/hotspot/share/gc/g1/g1RootClosures.cpp +++ b/src/hotspot/share/gc/g1/g1RootClosures.cpp @@ -35,7 +35,7 @@ public: G1EvacuationClosures(G1CollectedHeap* g1h, G1ParScanThreadState* pss, bool in_young_gc) : - _closures(g1h, pss, in_young_gc, /* must_claim_cld */ false) {} + _closures(g1h, pss, in_young_gc, /* cld_claim */ ClassLoaderData::_claim_none) {} OopClosure* weak_oops() { return &_closures._oops; } OopClosure* strong_oops() { return &_closures._oops; } @@ -73,8 +73,8 @@ class G1InitialMarkClosures : public G1EvacuationRootClosures { public: G1InitialMarkClosures(G1CollectedHeap* g1h, G1ParScanThreadState* pss) : - _strong(g1h, pss, /* process_only_dirty_klasses */ false, /* must_claim_cld */ true), - _weak(g1h, pss, /* process_only_dirty_klasses */ false, /* must_claim_cld */ true) {} + _strong(g1h, pss, /* process_only_dirty_klasses */ false, /* cld_claim */ ClassLoaderData::_claim_strong), + _weak(g1h, pss, /* process_only_dirty_klasses */ false, /* cld_claim */ ClassLoaderData::_claim_strong) {} OopClosure* weak_oops() { return &_weak._oops; } OopClosure* strong_oops() { return &_strong._oops; } diff --git a/src/hotspot/share/gc/g1/g1SharedClosures.hpp b/src/hotspot/share/gc/g1/g1SharedClosures.hpp index adb67b9ac98..972caf28a95 100644 --- a/src/hotspot/share/gc/g1/g1SharedClosures.hpp +++ b/src/hotspot/share/gc/g1/g1SharedClosures.hpp @@ -39,9 +39,9 @@ public: G1CLDScanClosure _clds; G1CodeBlobClosure _codeblobs; - G1SharedClosures(G1CollectedHeap* g1h, G1ParScanThreadState* pss, bool process_only_dirty, bool must_claim_cld) : + G1SharedClosures(G1CollectedHeap* g1h, G1ParScanThreadState* pss, bool process_only_dirty, int cld_claim) : _oops(g1h, pss), _oops_in_cld(g1h, pss), - _clds(&_oops_in_cld, process_only_dirty, must_claim_cld), + _clds(&_oops_in_cld, process_only_dirty, cld_claim), _codeblobs(&_oops) {} }; diff --git a/src/hotspot/share/gc/parallel/pcTasks.cpp b/src/hotspot/share/gc/parallel/pcTasks.cpp index 66d69dd74f6..656e4d7decc 100644 --- a/src/hotspot/share/gc/parallel/pcTasks.cpp +++ b/src/hotspot/share/gc/parallel/pcTasks.cpp @@ -110,7 +110,7 @@ void MarkFromRootsTask::do_it(GCTaskManager* manager, uint which) { break; case class_loader_data: { - CLDToOopClosure cld_closure(&mark_and_push_closure); + CLDToOopClosure cld_closure(&mark_and_push_closure, ClassLoaderData::_claim_strong); ClassLoaderDataGraph::always_strong_cld_do(&cld_closure); } break; diff --git a/src/hotspot/share/gc/parallel/psParallelCompact.cpp b/src/hotspot/share/gc/parallel/psParallelCompact.cpp index e98e572c4e3..a1c3ae19937 100644 --- a/src/hotspot/share/gc/parallel/psParallelCompact.cpp +++ b/src/hotspot/share/gc/parallel/psParallelCompact.cpp @@ -2213,7 +2213,7 @@ void PSParallelCompact::adjust_roots(ParCompactionManager* cm) { Management::oops_do(&oop_closure); JvmtiExport::oops_do(&oop_closure); SystemDictionary::oops_do(&oop_closure); - CLDToOopClosure cld_closure(&oop_closure); + CLDToOopClosure cld_closure(&oop_closure, ClassLoaderData::_claim_strong); ClassLoaderDataGraph::cld_do(&cld_closure); // Now adjust pointers in remaining weak roots. (All of which should diff --git a/src/hotspot/share/gc/serial/defNewGeneration.cpp b/src/hotspot/share/gc/serial/defNewGeneration.cpp index beb7f85248a..9939bf93c6e 100644 --- a/src/hotspot/share/gc/serial/defNewGeneration.cpp +++ b/src/hotspot/share/gc/serial/defNewGeneration.cpp @@ -137,7 +137,7 @@ void CLDScanClosure::do_cld(ClassLoaderData* cld) { _scavenge_closure->set_scanned_cld(cld); // Clean the cld since we're going to scavenge all the metadata. - cld->oops_do(_scavenge_closure, false, /*clear_modified_oops*/true); + cld->oops_do(_scavenge_closure, ClassLoaderData::_claim_none, /*clear_modified_oops*/true); _scavenge_closure->set_scanned_cld(NULL); } diff --git a/src/hotspot/share/gc/serial/markSweep.cpp b/src/hotspot/share/gc/serial/markSweep.cpp index fcc4f40ec3b..70ec7a997ef 100644 --- a/src/hotspot/share/gc/serial/markSweep.cpp +++ b/src/hotspot/share/gc/serial/markSweep.cpp @@ -58,9 +58,9 @@ SerialOldTracer* MarkSweep::_gc_tracer = NULL; MarkSweep::FollowRootClosure MarkSweep::follow_root_closure; -MarkAndPushClosure MarkSweep::mark_and_push_closure; -CLDToOopClosure MarkSweep::follow_cld_closure(&mark_and_push_closure); -CLDToOopClosure MarkSweep::adjust_cld_closure(&adjust_pointer_closure); +MarkAndPushClosure MarkSweep::mark_and_push_closure; +CLDToOopClosure MarkSweep::follow_cld_closure(&mark_and_push_closure, ClassLoaderData::_claim_strong); +CLDToOopClosure MarkSweep::adjust_cld_closure(&adjust_pointer_closure, ClassLoaderData::_claim_strong); template inline void MarkSweep::KeepAliveClosure::do_oop_work(T* p) { mark_and_push(p); diff --git a/src/hotspot/share/gc/z/zRootsIterator.cpp b/src/hotspot/share/gc/z/zRootsIterator.cpp index c0855ca0fb0..2ec8904e6bd 100644 --- a/src/hotspot/share/gc/z/zRootsIterator.cpp +++ b/src/hotspot/share/gc/z/zRootsIterator.cpp @@ -242,7 +242,7 @@ void ZConcurrentRootsIterator::do_jni_handles(ZRootsIteratorClosure* cl) { void ZConcurrentRootsIterator::do_class_loader_data_graph(ZRootsIteratorClosure* cl) { ZStatTimer timer(ZSubPhaseConcurrentRootsClassLoaderDataGraph); - CLDToOopClosure cld_cl(cl, _marking /* must_claim */); + CLDToOopClosure cld_cl(cl, _marking ? ClassLoaderData::_claim_strong : ClassLoaderData::_claim_none); ClassLoaderDataGraph::cld_do(&cld_cl); } diff --git a/src/hotspot/share/jfr/leakprofiler/chains/rootSetClosure.cpp b/src/hotspot/share/jfr/leakprofiler/chains/rootSetClosure.cpp index 1cec862143b..5f72d179d16 100644 --- a/src/hotspot/share/jfr/leakprofiler/chains/rootSetClosure.cpp +++ b/src/hotspot/share/jfr/leakprofiler/chains/rootSetClosure.cpp @@ -92,7 +92,7 @@ void RootSetClosure::process_roots(OopClosure* closure) { SaveRestoreCLDClaimBits save_restore_cld_claim_bits; RootSetClosureMarkScope mark_scope; - CLDToOopClosure cldt_closure(closure); + CLDToOopClosure cldt_closure(closure, ClassLoaderData::_claim_strong); ClassLoaderDataGraph::always_strong_cld_do(&cldt_closure); CodeBlobToOopClosure blobs(closure, false); Threads::oops_do(closure, &blobs); diff --git a/src/hotspot/share/jfr/leakprofiler/checkpoint/rootResolver.cpp b/src/hotspot/share/jfr/leakprofiler/checkpoint/rootResolver.cpp index b81745e392f..e349c2afffa 100644 --- a/src/hotspot/share/jfr/leakprofiler/checkpoint/rootResolver.cpp +++ b/src/hotspot/share/jfr/leakprofiler/checkpoint/rootResolver.cpp @@ -128,7 +128,7 @@ class ReferenceToRootClosure : public StackObj { bool ReferenceToRootClosure::do_cldg_roots() { assert(!complete(), "invariant"); ReferenceLocateClosure rlc(_callback, OldObjectRoot::_class_loader_data, OldObjectRoot::_type_undetermined, NULL); - CLDToOopClosure cldt_closure(&rlc); + CLDToOopClosure cldt_closure(&rlc, ClassLoaderData::_claim_strong); ClassLoaderDataGraph::always_strong_cld_do(&cldt_closure); return rlc.complete(); } diff --git a/src/hotspot/share/jfr/leakprofiler/utilities/saveRestore.cpp b/src/hotspot/share/jfr/leakprofiler/utilities/saveRestore.cpp index ec01d2de6fe..a24299ac191 100644 --- a/src/hotspot/share/jfr/leakprofiler/utilities/saveRestore.cpp +++ b/src/hotspot/share/jfr/leakprofiler/utilities/saveRestore.cpp @@ -69,12 +69,12 @@ CLDClaimContext::CLDClaimContext() : _cld(NULL) {} CLDClaimContext::CLDClaimContext(ClassLoaderData* cld) : _cld(cld) { assert(_cld->claimed(), "invariant"); - _cld->clear_claimed(); + _cld->clear_claim(); } CLDClaimContext::~CLDClaimContext() { if (_cld != NULL) { - _cld->claim(); + _cld->try_claim(ClassLoaderData::_claim_strong); assert(_cld->claimed(), "invariant"); } } diff --git a/src/hotspot/share/memory/iterator.cpp b/src/hotspot/share/memory/iterator.cpp index 84b8e82ba33..997efb10d1a 100644 --- a/src/hotspot/share/memory/iterator.cpp +++ b/src/hotspot/share/memory/iterator.cpp @@ -32,7 +32,7 @@ DoNothingClosure do_nothing_cl; void CLDToOopClosure::do_cld(ClassLoaderData* cld) { - cld->oops_do(_oop_closure, _must_claim_cld); + cld->oops_do(_oop_closure, _cld_claim); } void ObjectToOopClosure::do_object(oop obj) { diff --git a/src/hotspot/share/memory/iterator.hpp b/src/hotspot/share/memory/iterator.hpp index b5828eb1799..400a2837046 100644 --- a/src/hotspot/share/memory/iterator.hpp +++ b/src/hotspot/share/memory/iterator.hpp @@ -127,12 +127,13 @@ class CLDClosure : public Closure { class CLDToOopClosure : public CLDClosure { OopClosure* _oop_closure; - bool _must_claim_cld; + int _cld_claim; public: - CLDToOopClosure(OopClosure* oop_closure, bool must_claim_cld = true) : + CLDToOopClosure(OopClosure* oop_closure, + int cld_claim) : _oop_closure(oop_closure), - _must_claim_cld(must_claim_cld) {} + _cld_claim(cld_claim) {} void do_cld(ClassLoaderData* cld); }; diff --git a/src/hotspot/share/memory/iterator.inline.hpp b/src/hotspot/share/memory/iterator.inline.hpp index 03960854186..e57e78c1a7c 100644 --- a/src/hotspot/share/memory/iterator.inline.hpp +++ b/src/hotspot/share/memory/iterator.inline.hpp @@ -39,8 +39,7 @@ #include "utilities/debug.hpp" inline void MetadataVisitingOopIterateClosure::do_cld(ClassLoaderData* cld) { - bool claim = true; // Must claim the class loader data before processing. - cld->oops_do(this, claim); + cld->oops_do(this, ClassLoaderData::_claim_strong); } inline void MetadataVisitingOopIterateClosure::do_klass(Klass* k) { From 0192c14c9b3ba2573f6f1111d4e9be8a9bf06737 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20=C3=96sterlund?= Date: Tue, 16 Oct 2018 13:18:22 +0200 Subject: [PATCH 07/66] 8210498: nmethod entry barriers Reviewed-by: kvn, pliden --- .../gc/shared/barrierSetNMethod_aarch64.cpp | 40 +++++ .../arm/gc/shared/barrierSetNMethod_arm.cpp | 40 +++++ .../ppc/gc/shared/barrierSetNMethod_ppc.cpp | 40 +++++ .../s390/gc/shared/barrierSetNMethod_s390.cpp | 40 +++++ .../gc/shared/barrierSetNMethod_sparc.cpp | 40 +++++ src/hotspot/cpu/x86/c1_MacroAssembler_x86.cpp | 5 + .../x86/gc/shared/barrierSetAssembler_x86.cpp | 21 +++ .../x86/gc/shared/barrierSetAssembler_x86.hpp | 2 + .../x86/gc/shared/barrierSetNMethod_x86.cpp | 155 ++++++++++++++++++ src/hotspot/cpu/x86/macroAssembler_x86.cpp | 6 +- src/hotspot/cpu/x86/macroAssembler_x86.hpp | 2 +- src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp | 3 + src/hotspot/cpu/x86/stubGenerator_x86_64.cpp | 83 ++++++++++ src/hotspot/cpu/x86/stubRoutines_x86.hpp | 6 + src/hotspot/cpu/x86/stubRoutines_x86_64.cpp | 1 + src/hotspot/cpu/x86/x86_64.ad | 11 +- .../zero/gc/shared/barrierSetNMethod_zero.cpp | 40 +++++ src/hotspot/share/code/codeBlob.hpp | 1 + .../share/gc/epsilon/epsilonBarrierSet.cpp | 1 + src/hotspot/share/gc/shared/barrierSet.hpp | 10 +- .../share/gc/shared/barrierSetNMethod.cpp | 87 ++++++++++ .../share/gc/shared/barrierSetNMethod.hpp | 52 ++++++ .../share/gc/shared/modRefBarrierSet.hpp | 1 + src/hotspot/share/gc/z/zBarrierSet.cpp | 1 + .../share/interpreter/interpreterRuntime.cpp | 15 ++ 25 files changed, 699 insertions(+), 4 deletions(-) create mode 100644 src/hotspot/cpu/aarch64/gc/shared/barrierSetNMethod_aarch64.cpp create mode 100644 src/hotspot/cpu/arm/gc/shared/barrierSetNMethod_arm.cpp create mode 100644 src/hotspot/cpu/ppc/gc/shared/barrierSetNMethod_ppc.cpp create mode 100644 src/hotspot/cpu/s390/gc/shared/barrierSetNMethod_s390.cpp create mode 100644 src/hotspot/cpu/sparc/gc/shared/barrierSetNMethod_sparc.cpp create mode 100644 src/hotspot/cpu/x86/gc/shared/barrierSetNMethod_x86.cpp create mode 100644 src/hotspot/cpu/zero/gc/shared/barrierSetNMethod_zero.cpp create mode 100644 src/hotspot/share/gc/shared/barrierSetNMethod.cpp create mode 100644 src/hotspot/share/gc/shared/barrierSetNMethod.hpp diff --git a/src/hotspot/cpu/aarch64/gc/shared/barrierSetNMethod_aarch64.cpp b/src/hotspot/cpu/aarch64/gc/shared/barrierSetNMethod_aarch64.cpp new file mode 100644 index 00000000000..a0361ddc2f4 --- /dev/null +++ b/src/hotspot/cpu/aarch64/gc/shared/barrierSetNMethod_aarch64.cpp @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#include "precompiled.hpp" +#include "gc/shared/barrierSetNMethod.hpp" +#include "utilities/debug.hpp" + +void BarrierSetNMethod::deoptimize(nmethod* nm, address* return_address_ptr) { + ShouldNotReachHere(); +} + +void BarrierSetNMethod::disarm(nmethod* nm) { + ShouldNotReachHere(); +} + +bool BarrierSetNMethod::is_armed(nmethod* nm) { + ShouldNotReachHere(); + return false; +} diff --git a/src/hotspot/cpu/arm/gc/shared/barrierSetNMethod_arm.cpp b/src/hotspot/cpu/arm/gc/shared/barrierSetNMethod_arm.cpp new file mode 100644 index 00000000000..a0361ddc2f4 --- /dev/null +++ b/src/hotspot/cpu/arm/gc/shared/barrierSetNMethod_arm.cpp @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#include "precompiled.hpp" +#include "gc/shared/barrierSetNMethod.hpp" +#include "utilities/debug.hpp" + +void BarrierSetNMethod::deoptimize(nmethod* nm, address* return_address_ptr) { + ShouldNotReachHere(); +} + +void BarrierSetNMethod::disarm(nmethod* nm) { + ShouldNotReachHere(); +} + +bool BarrierSetNMethod::is_armed(nmethod* nm) { + ShouldNotReachHere(); + return false; +} diff --git a/src/hotspot/cpu/ppc/gc/shared/barrierSetNMethod_ppc.cpp b/src/hotspot/cpu/ppc/gc/shared/barrierSetNMethod_ppc.cpp new file mode 100644 index 00000000000..a0361ddc2f4 --- /dev/null +++ b/src/hotspot/cpu/ppc/gc/shared/barrierSetNMethod_ppc.cpp @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#include "precompiled.hpp" +#include "gc/shared/barrierSetNMethod.hpp" +#include "utilities/debug.hpp" + +void BarrierSetNMethod::deoptimize(nmethod* nm, address* return_address_ptr) { + ShouldNotReachHere(); +} + +void BarrierSetNMethod::disarm(nmethod* nm) { + ShouldNotReachHere(); +} + +bool BarrierSetNMethod::is_armed(nmethod* nm) { + ShouldNotReachHere(); + return false; +} diff --git a/src/hotspot/cpu/s390/gc/shared/barrierSetNMethod_s390.cpp b/src/hotspot/cpu/s390/gc/shared/barrierSetNMethod_s390.cpp new file mode 100644 index 00000000000..a0361ddc2f4 --- /dev/null +++ b/src/hotspot/cpu/s390/gc/shared/barrierSetNMethod_s390.cpp @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#include "precompiled.hpp" +#include "gc/shared/barrierSetNMethod.hpp" +#include "utilities/debug.hpp" + +void BarrierSetNMethod::deoptimize(nmethod* nm, address* return_address_ptr) { + ShouldNotReachHere(); +} + +void BarrierSetNMethod::disarm(nmethod* nm) { + ShouldNotReachHere(); +} + +bool BarrierSetNMethod::is_armed(nmethod* nm) { + ShouldNotReachHere(); + return false; +} diff --git a/src/hotspot/cpu/sparc/gc/shared/barrierSetNMethod_sparc.cpp b/src/hotspot/cpu/sparc/gc/shared/barrierSetNMethod_sparc.cpp new file mode 100644 index 00000000000..a0361ddc2f4 --- /dev/null +++ b/src/hotspot/cpu/sparc/gc/shared/barrierSetNMethod_sparc.cpp @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#include "precompiled.hpp" +#include "gc/shared/barrierSetNMethod.hpp" +#include "utilities/debug.hpp" + +void BarrierSetNMethod::deoptimize(nmethod* nm, address* return_address_ptr) { + ShouldNotReachHere(); +} + +void BarrierSetNMethod::disarm(nmethod* nm) { + ShouldNotReachHere(); +} + +bool BarrierSetNMethod::is_armed(nmethod* nm) { + ShouldNotReachHere(); + return false; +} diff --git a/src/hotspot/cpu/x86/c1_MacroAssembler_x86.cpp b/src/hotspot/cpu/x86/c1_MacroAssembler_x86.cpp index b9a03b4a11c..72f91ee7b5c 100644 --- a/src/hotspot/cpu/x86/c1_MacroAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/c1_MacroAssembler_x86.cpp @@ -26,6 +26,8 @@ #include "c1/c1_MacroAssembler.hpp" #include "c1/c1_Runtime1.hpp" #include "classfile/systemDictionary.hpp" +#include "gc/shared/barrierSet.hpp" +#include "gc/shared/barrierSetAssembler.hpp" #include "gc/shared/collectedHeap.hpp" #include "interpreter/interpreter.hpp" #include "oops/arrayOop.hpp" @@ -330,6 +332,9 @@ void C1_MacroAssembler::build_frame(int frame_size_in_bytes, int bang_size_in_by } #endif // TIERED decrement(rsp, frame_size_in_bytes); // does not emit code for frame_size == 0 + + BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler(); + bs->nmethod_entry_barrier(this); } diff --git a/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp b/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp index 9205f003bd1..be9e927b3af 100644 --- a/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp @@ -23,7 +23,9 @@ */ #include "precompiled.hpp" +#include "gc/shared/barrierSet.hpp" #include "gc/shared/barrierSetAssembler.hpp" +#include "gc/shared/barrierSetNMethod.hpp" #include "gc/shared/collectedHeap.hpp" #include "interpreter/interp_masm.hpp" #include "runtime/jniHandles.hpp" @@ -322,3 +324,22 @@ void BarrierSetAssembler::incr_allocated_bytes(MacroAssembler* masm, Register th __ adcl(Address(thread, in_bytes(JavaThread::allocated_bytes_offset())+4), 0); #endif } + +void BarrierSetAssembler::nmethod_entry_barrier(MacroAssembler* masm) { + BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod(); + if (bs_nm == NULL) { + return; + } +#ifndef _LP64 + ShouldNotReachHere(); +#else + Label continuation; + Register thread = LP64_ONLY(r15_thread); + Address disarmed_addr(thread, in_bytes(bs_nm->thread_disarmed_offset())); + __ align(8); + __ cmpl(disarmed_addr, 0); + __ jcc(Assembler::equal, continuation); + __ call(RuntimeAddress(StubRoutines::x86::method_entry_barrier())); + __ bind(continuation); +#endif +} diff --git a/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.hpp b/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.hpp index 89588532b9f..f832d6e6db1 100644 --- a/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.hpp +++ b/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.hpp @@ -83,6 +83,8 @@ public: Label& slow_case); virtual void barrier_stubs_init() {} + + virtual void nmethod_entry_barrier(MacroAssembler* masm); }; #endif // CPU_X86_GC_SHARED_BARRIERSETASSEMBLER_X86_HPP diff --git a/src/hotspot/cpu/x86/gc/shared/barrierSetNMethod_x86.cpp b/src/hotspot/cpu/x86/gc/shared/barrierSetNMethod_x86.cpp new file mode 100644 index 00000000000..a38b6a254e9 --- /dev/null +++ b/src/hotspot/cpu/x86/gc/shared/barrierSetNMethod_x86.cpp @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#include "precompiled.hpp" +#include "code/codeCache.hpp" +#include "code/nativeInst.hpp" +#include "gc/shared/barrierSetNMethod.hpp" +#include "logging/log.hpp" +#include "memory/resourceArea.hpp" +#include "runtime/sharedRuntime.hpp" +#include "runtime/thread.hpp" +#include "utilities/align.hpp" +#include "utilities/debug.hpp" + +class NativeNMethodCmpBarrier: public NativeInstruction { +public: + enum Intel_specific_constants { + instruction_code = 0x81, + instruction_size = 8, + imm_offset = 4, + instruction_rex_prefix = Assembler::REX | Assembler::REX_B, + instruction_modrm = 0x7f // [r15 + offset] + }; + + address instruction_address() const { return addr_at(0); } + address immediate_address() const { return addr_at(imm_offset); } + + jint get_immedate() const { return int_at(imm_offset); } + void set_immediate(jint imm) { set_int_at(imm_offset, imm); } + void verify() const; +}; + +void NativeNMethodCmpBarrier::verify() const { + if (((uintptr_t) instruction_address()) & 0x7) { + fatal("Not properly aligned"); + } + + int prefix = ubyte_at(0); + if (prefix != instruction_rex_prefix) { + tty->print_cr("Addr: " INTPTR_FORMAT " Prefix: 0x%x", p2i(instruction_address()), + prefix); + fatal("not a cmp barrier"); + } + + int inst = ubyte_at(1); + if (inst != instruction_code) { + tty->print_cr("Addr: " INTPTR_FORMAT " Code: 0x%x", p2i(instruction_address()), + inst); + fatal("not a cmp barrier"); + } + + int modrm = ubyte_at(2); + if (modrm != instruction_modrm) { + tty->print_cr("Addr: " INTPTR_FORMAT " mod/rm: 0x%x", p2i(instruction_address()), + modrm); + fatal("not a cmp barrier"); + } +} + +void BarrierSetNMethod::deoptimize(nmethod* nm, address* return_address_ptr) { + /* + * [ callers frame ] + * [ callers return address ] <- callers rsp + * [ callers rbp ] <- callers rbp + * [ callers frame slots ] + * [ return_address ] <- return_address_ptr + * [ cookie ] <- used to write the new rsp (callers rsp) + * [ stub rbp ] + * [ stub stuff ] + */ + + address* stub_rbp = return_address_ptr - 2; + address* callers_rsp = return_address_ptr + nm->frame_size(); /* points to callers return_address now */ + address* callers_rbp = callers_rsp - 1; // 1 to move to the callers return address, 1 more to move to the rbp + address* cookie = return_address_ptr - 1; + + LogTarget(Trace, nmethod, barrier) out; + if (out.is_enabled()) { + Thread* thread = Thread::current(); + assert(thread->is_Java_thread(), "must be JavaThread"); + JavaThread* jth = (JavaThread*) thread; + ResourceMark mark; + log_trace(nmethod, barrier)("deoptimize(nmethod: %p, return_addr: %p, osr: %d, thread: %p(%s), making rsp: %p) -> %p", + nm, (address *) return_address_ptr, nm->is_osr_method(), jth, + jth->get_thread_name(), callers_rsp, nm->verified_entry_point()); + } + + assert(nm->frame_size() >= 3, "invariant"); + assert(*cookie == (address) -1, "invariant"); + + // Preserve caller rbp. + *stub_rbp = *callers_rbp; + + // At the cookie address put the callers rsp. + *cookie = (address) callers_rsp; // should point to the return address + + // In the slot that used to be the callers rbp we put the address that our stub needs to jump to at the end. + // Overwriting the caller rbp should be okay since our stub rbp has the same value. + address* jmp_addr_ptr = callers_rbp; + *jmp_addr_ptr = SharedRuntime::get_handle_wrong_method_stub(); +} + +// This is the offset of the entry barrier from where the frame is completed. +// If any code changes between the end of the verified entry where the entry +// barrier resides, and the completion of the frame, then +// NativeNMethodCmpBarrier::verify() will immediately complain when it does +// not find the expected native instruction at this offset, which needs updating. +// Note that this offset is invariant of PreserveFramePointer. +static const int entry_barrier_offset = -19; + +static NativeNMethodCmpBarrier* native_nmethod_barrier(nmethod* nm) { + address barrier_address = nm->code_begin() + nm->frame_complete_offset() + entry_barrier_offset; + NativeNMethodCmpBarrier* barrier = reinterpret_cast(barrier_address); + debug_only(barrier->verify()); + return barrier; +} + +void BarrierSetNMethod::disarm(nmethod* nm) { + if (!supports_entry_barrier(nm)) { + return; + } + + NativeNMethodCmpBarrier* cmp = native_nmethod_barrier(nm); + cmp->set_immediate(disarmed_value()); +} + +bool BarrierSetNMethod::is_armed(nmethod* nm) { + if (!supports_entry_barrier(nm)) { + return false; + } + + NativeNMethodCmpBarrier* cmp = native_nmethod_barrier(nm); + return (disarmed_value() != cmp->get_immedate()); +} diff --git a/src/hotspot/cpu/x86/macroAssembler_x86.cpp b/src/hotspot/cpu/x86/macroAssembler_x86.cpp index 8bfc9a6e068..2ab361d88b8 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86.cpp @@ -5453,7 +5453,7 @@ void MacroAssembler::reinit_heapbase() { #endif // _LP64 // C2 compiled method's prolog code. -void MacroAssembler::verified_entry(int framesize, int stack_bang_size, bool fp_mode_24b) { +void MacroAssembler::verified_entry(int framesize, int stack_bang_size, bool fp_mode_24b, bool is_stub) { // WARNING: Initial instruction MUST be 5 bytes or longer so that // NativeJump::patch_verified_entry will be able to patch out the entry @@ -5535,6 +5535,10 @@ void MacroAssembler::verified_entry(int framesize, int stack_bang_size, bool fp_ } #endif + if (!is_stub) { + BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler(); + bs->nmethod_entry_barrier(this); + } } // clear memory of size 'cnt' qwords, starting at 'base' using XMM/YMM registers diff --git a/src/hotspot/cpu/x86/macroAssembler_x86.hpp b/src/hotspot/cpu/x86/macroAssembler_x86.hpp index 81367c1f379..433f1ca5903 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86.hpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86.hpp @@ -1588,7 +1588,7 @@ public: void movl2ptr(Register dst, Register src) { LP64_ONLY(movslq(dst, src)) NOT_LP64(if (dst != src) movl(dst, src)); } // C2 compiled method's prolog code. - void verified_entry(int framesize, int stack_bang_size, bool fp_mode_24b); + void verified_entry(int framesize, int stack_bang_size, bool fp_mode_24b, bool is_stub); // clear memory of size 'cnt' qwords, starting at 'base'; // if 'is_large' is set, do not try to produce short loop diff --git a/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp b/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp index bc098ffdafe..955ce2cd207 100644 --- a/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp +++ b/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp @@ -2160,6 +2160,9 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm, // -2 because return address is already present and so is saved rbp __ subptr(rsp, stack_size - 2*wordSize); + BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler(); + bs->nmethod_entry_barrier(masm); + // Frame is now completed as far as size and linkage. int frame_complete = ((intptr_t)__ pc()) - start; diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp index 05946a182f6..4500bc51125 100644 --- a/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp +++ b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp @@ -28,6 +28,7 @@ #include "ci/ciUtilities.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/barrierSetAssembler.hpp" +#include "gc/shared/barrierSetNMethod.hpp" #include "interpreter/interpreter.hpp" #include "nativeInst_x86.hpp" #include "oops/instanceOop.hpp" @@ -5194,6 +5195,83 @@ address generate_cipherBlockChaining_decryptVectorAESCrypt() { return start; } + address generate_method_entry_barrier() { + __ align(CodeEntryAlignment); + StubCodeMark mark(this, "StubRoutines", "nmethod_entry_barrier"); + + Label deoptimize_label; + + address start = __ pc(); + + __ push(-1); // cookie, this is used for writing the new rsp when deoptimizing + + BLOCK_COMMENT("Entry:"); + __ enter(); // save rbp + + // save c_rarg0, because we want to use that value. + // We could do without it but then we depend on the number of slots used by pusha + __ push(c_rarg0); + + __ lea(c_rarg0, Address(rsp, wordSize * 3)); // 1 for cookie, 1 for rbp, 1 for c_rarg0 - this should be the return address + + __ pusha(); + + // The method may have floats as arguments, and we must spill them before calling + // the VM runtime. + assert(Argument::n_float_register_parameters_j == 8, "Assumption"); + const int xmm_size = wordSize * 2; + const int xmm_spill_size = xmm_size * Argument::n_float_register_parameters_j; + __ subptr(rsp, xmm_spill_size); + __ movdqu(Address(rsp, xmm_size * 7), xmm7); + __ movdqu(Address(rsp, xmm_size * 6), xmm6); + __ movdqu(Address(rsp, xmm_size * 5), xmm5); + __ movdqu(Address(rsp, xmm_size * 4), xmm4); + __ movdqu(Address(rsp, xmm_size * 3), xmm3); + __ movdqu(Address(rsp, xmm_size * 2), xmm2); + __ movdqu(Address(rsp, xmm_size * 1), xmm1); + __ movdqu(Address(rsp, xmm_size * 0), xmm0); + + __ call_VM_leaf(CAST_FROM_FN_PTR(address, static_cast(BarrierSetNMethod::nmethod_stub_entry_barrier)), 1); + + __ movdqu(xmm0, Address(rsp, xmm_size * 0)); + __ movdqu(xmm1, Address(rsp, xmm_size * 1)); + __ movdqu(xmm2, Address(rsp, xmm_size * 2)); + __ movdqu(xmm3, Address(rsp, xmm_size * 3)); + __ movdqu(xmm4, Address(rsp, xmm_size * 4)); + __ movdqu(xmm5, Address(rsp, xmm_size * 5)); + __ movdqu(xmm6, Address(rsp, xmm_size * 6)); + __ movdqu(xmm7, Address(rsp, xmm_size * 7)); + __ addptr(rsp, xmm_spill_size); + + __ cmpl(rax, 1); // 1 means deoptimize + __ jcc(Assembler::equal, deoptimize_label); + + __ popa(); + __ pop(c_rarg0); + + __ leave(); + + __ addptr(rsp, 1 * wordSize); // cookie + __ ret(0); + + + __ BIND(deoptimize_label); + + __ popa(); + __ pop(c_rarg0); + + __ leave(); + + // this can be taken out, but is good for verification purposes. getting a SIGSEGV + // here while still having a correct stack is valuable + __ testptr(rsp, Address(rsp, 0)); + + __ movptr(rsp, Address(rsp, 0)); // new rsp was written in the barrier + __ jmp(Address(rsp, -1 * wordSize)); // jmp target should be callers verified_entry_point + + return start; + } + /** * Arguments: * @@ -5831,6 +5909,11 @@ address generate_cipherBlockChaining_decryptVectorAESCrypt() { generate_safefetch("SafeFetchN", sizeof(intptr_t), &StubRoutines::_safefetchN_entry, &StubRoutines::_safefetchN_fault_pc, &StubRoutines::_safefetchN_continuation_pc); + + BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod(); + if (bs_nm != NULL) { + StubRoutines::x86::_method_entry_barrier = generate_method_entry_barrier(); + } #ifdef COMPILER2 if (UseMultiplyToLenIntrinsic) { StubRoutines::_multiplyToLen = generate_multiplyToLen(); diff --git a/src/hotspot/cpu/x86/stubRoutines_x86.hpp b/src/hotspot/cpu/x86/stubRoutines_x86.hpp index 8648c10928a..251f26bdad2 100644 --- a/src/hotspot/cpu/x86/stubRoutines_x86.hpp +++ b/src/hotspot/cpu/x86/stubRoutines_x86.hpp @@ -55,8 +55,14 @@ class x86 { static address _double_sign_mask; static address _double_sign_flip; + static address _method_entry_barrier; + public: + static address method_entry_barrier() { + return _method_entry_barrier; + } + static address get_previous_fp_entry() { return _get_previous_fp_entry; } diff --git a/src/hotspot/cpu/x86/stubRoutines_x86_64.cpp b/src/hotspot/cpu/x86/stubRoutines_x86_64.cpp index bf539083e90..b2821321630 100644 --- a/src/hotspot/cpu/x86/stubRoutines_x86_64.cpp +++ b/src/hotspot/cpu/x86/stubRoutines_x86_64.cpp @@ -42,3 +42,4 @@ address StubRoutines::x86::_float_sign_mask = NULL; address StubRoutines::x86::_float_sign_flip = NULL; address StubRoutines::x86::_double_sign_mask = NULL; address StubRoutines::x86::_double_sign_flip = NULL; +address StubRoutines::x86::_method_entry_barrier = NULL; diff --git a/src/hotspot/cpu/x86/x86_64.ad b/src/hotspot/cpu/x86/x86_64.ad index 0e211cb9947..10558e6142d 100644 --- a/src/hotspot/cpu/x86/x86_64.ad +++ b/src/hotspot/cpu/x86/x86_64.ad @@ -890,6 +890,15 @@ void MachPrologNode::format(PhaseRegAlloc* ra_, outputStream* st) const { st->print("# stack alignment check"); #endif } + if (C->stub_function() != NULL && BarrierSet::barrier_set()->barrier_set_nmethod() != NULL) { + st->print("\n\t"); + st->print("cmpl [r15_thread + #disarmed_offset], #disarmed_value\t"); + st->print("\n\t"); + st->print("je fast_entry\t"); + st->print("\n\t"); + st->print("call #nmethod_entry_barrier_stub\t"); + st->print("\n\tfast_entry:"); + } st->cr(); } #endif @@ -901,7 +910,7 @@ void MachPrologNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const { int framesize = C->frame_size_in_bytes(); int bangsize = C->bang_size_in_bytes(); - __ verified_entry(framesize, C->need_stack_bang(bangsize)?bangsize:0, false); + __ verified_entry(framesize, C->need_stack_bang(bangsize)?bangsize:0, false, C->stub_function() != NULL); C->set_frame_complete(cbuf.insts_size()); diff --git a/src/hotspot/cpu/zero/gc/shared/barrierSetNMethod_zero.cpp b/src/hotspot/cpu/zero/gc/shared/barrierSetNMethod_zero.cpp new file mode 100644 index 00000000000..a0361ddc2f4 --- /dev/null +++ b/src/hotspot/cpu/zero/gc/shared/barrierSetNMethod_zero.cpp @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#include "precompiled.hpp" +#include "gc/shared/barrierSetNMethod.hpp" +#include "utilities/debug.hpp" + +void BarrierSetNMethod::deoptimize(nmethod* nm, address* return_address_ptr) { + ShouldNotReachHere(); +} + +void BarrierSetNMethod::disarm(nmethod* nm) { + ShouldNotReachHere(); +} + +bool BarrierSetNMethod::is_armed(nmethod* nm) { + ShouldNotReachHere(); + return false; +} diff --git a/src/hotspot/share/code/codeBlob.hpp b/src/hotspot/share/code/codeBlob.hpp index df657716649..e6fa033c8c3 100644 --- a/src/hotspot/share/code/codeBlob.hpp +++ b/src/hotspot/share/code/codeBlob.hpp @@ -186,6 +186,7 @@ public: bool contains(address addr) const { return content_begin() <= addr && addr < content_end(); } bool is_frame_complete_at(address addr) const { return _frame_complete_offset != CodeOffsets::frame_never_safe && code_contains(addr) && addr >= code_begin() + _frame_complete_offset; } + int frame_complete_offset() const { return _frame_complete_offset; } // CodeCache support: really only used by the nmethods, but in order to get // asserts and certain bookkeeping to work in the CodeCache they are defined diff --git a/src/hotspot/share/gc/epsilon/epsilonBarrierSet.cpp b/src/hotspot/share/gc/epsilon/epsilonBarrierSet.cpp index e53297828e0..8aed198eaaf 100644 --- a/src/hotspot/share/gc/epsilon/epsilonBarrierSet.cpp +++ b/src/hotspot/share/gc/epsilon/epsilonBarrierSet.cpp @@ -40,6 +40,7 @@ EpsilonBarrierSet::EpsilonBarrierSet() : BarrierSet( make_barrier_set_assembler(), make_barrier_set_c1(), make_barrier_set_c2(), + NULL /* barrier_set_nmethod */, BarrierSet::FakeRtti(BarrierSet::EpsilonBarrierSet)) {}; void EpsilonBarrierSet::on_thread_create(Thread *thread) { diff --git a/src/hotspot/share/gc/shared/barrierSet.hpp b/src/hotspot/share/gc/shared/barrierSet.hpp index 9780dceb2d7..0d4eab6a529 100644 --- a/src/hotspot/share/gc/shared/barrierSet.hpp +++ b/src/hotspot/share/gc/shared/barrierSet.hpp @@ -36,6 +36,7 @@ class BarrierSetAssembler; class BarrierSetC1; class BarrierSetC2; +class BarrierSetNMethod; class JavaThread; // This class provides the interface between a barrier implementation and @@ -72,6 +73,7 @@ private: BarrierSetAssembler* _barrier_set_assembler; BarrierSetC1* _barrier_set_c1; BarrierSetC2* _barrier_set_c2; + BarrierSetNMethod* _barrier_set_nmethod; public: // Metafunction mapping a class derived from BarrierSet to the @@ -95,11 +97,13 @@ protected: BarrierSet(BarrierSetAssembler* barrier_set_assembler, BarrierSetC1* barrier_set_c1, BarrierSetC2* barrier_set_c2, + BarrierSetNMethod* barrier_set_nmethod, const FakeRtti& fake_rtti) : _fake_rtti(fake_rtti), _barrier_set_assembler(barrier_set_assembler), _barrier_set_c1(barrier_set_c1), - _barrier_set_c2(barrier_set_c2) {} + _barrier_set_c2(barrier_set_c2), + _barrier_set_nmethod(barrier_set_nmethod) {} ~BarrierSet() { } template @@ -156,6 +160,10 @@ public: return _barrier_set_c2; } + BarrierSetNMethod* barrier_set_nmethod() { + return _barrier_set_nmethod; + } + // The AccessBarrier of a BarrierSet subclass is called by the Access API // (cf. oops/access.hpp) to perform decorated accesses. GC implementations // may override these default access operations by declaring an diff --git a/src/hotspot/share/gc/shared/barrierSetNMethod.cpp b/src/hotspot/share/gc/shared/barrierSetNMethod.cpp new file mode 100644 index 00000000000..79ec9deba73 --- /dev/null +++ b/src/hotspot/share/gc/shared/barrierSetNMethod.cpp @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#include "precompiled.hpp" +#include "code/codeCache.hpp" +#include "code/nmethod.hpp" +#include "gc/shared/barrierSet.hpp" +#include "gc/shared/barrierSetNMethod.hpp" +#include "logging/log.hpp" +#include "runtime/thread.hpp" +#include "utilities/debug.hpp" + +int BarrierSetNMethod::disarmed_value() const { + char* disarmed_addr = reinterpret_cast(Thread::current()); + disarmed_addr += in_bytes(thread_disarmed_offset()); + return *reinterpret_cast(disarmed_addr); +} + +bool BarrierSetNMethod::supports_entry_barrier(nmethod* nm) { + if (nm->method()->is_method_handle_intrinsic()) { + return false; + } + + if (!nm->is_native_method() && !nm->is_compiled_by_c2() && !nm->is_compiled_by_c1()) { + return false; + } + + return true; +} + +int BarrierSetNMethod::nmethod_stub_entry_barrier(address* return_address_ptr) { + address return_address = *return_address_ptr; + CodeBlob* cb = CodeCache::find_blob(return_address); + assert(cb != NULL, "invariant"); + + nmethod* nm = cb->as_nmethod(); + BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod(); + + if (!bs_nm->is_armed(nm)) { + return 0; + } + + assert(!nm->is_osr_method(), "Should not reach here"); + // Called upon first entry after being armed + bool may_enter = bs_nm->nmethod_entry_barrier(nm); + if (!may_enter) { + log_trace(nmethod, barrier)("Deoptimizing nmethod: " PTR_FORMAT, p2i(nm)); + bs_nm->deoptimize(nm, return_address_ptr); + } + return may_enter ? 0 : 1; +} + +bool BarrierSetNMethod::nmethod_osr_entry_barrier(nmethod* nm) { + // This check depends on the invariant that all nmethods that are deoptimized / made not entrant + // are NOT disarmed. + // This invariant is important because a method can be deoptimized after the method have been + // resolved / looked up by OSR by another thread. By not deoptimizing them we guarantee that + // a deoptimized method will always hit the barrier and come to the same conclusion - deoptimize + if (!is_armed(nm)) { + return true; + } + + assert(nm->is_osr_method(), "Should not reach here"); + log_trace(nmethod, barrier)("Running osr nmethod entry barrier: " PTR_FORMAT, p2i(nm)); + return nmethod_entry_barrier(nm); +} diff --git a/src/hotspot/share/gc/shared/barrierSetNMethod.hpp b/src/hotspot/share/gc/shared/barrierSetNMethod.hpp new file mode 100644 index 00000000000..d27a86d1045 --- /dev/null +++ b/src/hotspot/share/gc/shared/barrierSetNMethod.hpp @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#ifndef SHARE_CODE_NMETHOD_BARRIER_HPP +#define SHARE_CODE_NMETHOD_BARRIER_HPP + +#include "memory/allocation.hpp" +#include "utilities/globalDefinitions.hpp" +#include "utilities/sizes.hpp" + +class nmethod; + +class BarrierSetNMethod: public CHeapObj { + bool supports_entry_barrier(nmethod* nm); + void deoptimize(nmethod* nm, address* return_addr_ptr); + +protected: + virtual int disarmed_value() const; + virtual bool nmethod_entry_barrier(nmethod* nm) = 0; + +public: + virtual ByteSize thread_disarmed_offset() const = 0; + + static int nmethod_stub_entry_barrier(address* return_address_ptr); + bool nmethod_osr_entry_barrier(nmethod* nm); + bool is_armed(nmethod* nm); + void disarm(nmethod* nm); +}; + + +#endif // SHARE_CODE_NMETHOD_BARRIER_HPP diff --git a/src/hotspot/share/gc/shared/modRefBarrierSet.hpp b/src/hotspot/share/gc/shared/modRefBarrierSet.hpp index 72b6fd4c197..95b9aa01e5d 100644 --- a/src/hotspot/share/gc/shared/modRefBarrierSet.hpp +++ b/src/hotspot/share/gc/shared/modRefBarrierSet.hpp @@ -39,6 +39,7 @@ protected: : BarrierSet(barrier_set_assembler, barrier_set_c1, barrier_set_c2, + NULL /* barrier_set_nmethod */, fake_rtti.add_tag(BarrierSet::ModRef)) { } ~ModRefBarrierSet() { } diff --git a/src/hotspot/share/gc/z/zBarrierSet.cpp b/src/hotspot/share/gc/z/zBarrierSet.cpp index 26cfb411e7e..7cb83ae31d0 100644 --- a/src/hotspot/share/gc/z/zBarrierSet.cpp +++ b/src/hotspot/share/gc/z/zBarrierSet.cpp @@ -43,6 +43,7 @@ ZBarrierSet::ZBarrierSet() : BarrierSet(make_barrier_set_assembler(), make_barrier_set_c1(), make_barrier_set_c2(), + NULL /* barrier_set_nmethod */, BarrierSet::FakeRtti(BarrierSet::ZBarrierSet)) {} ZBarrierSetAssembler* ZBarrierSet::assembler() { diff --git a/src/hotspot/share/interpreter/interpreterRuntime.cpp b/src/hotspot/share/interpreter/interpreterRuntime.cpp index c6d71b6b5f5..c98821c9b47 100644 --- a/src/hotspot/share/interpreter/interpreterRuntime.cpp +++ b/src/hotspot/share/interpreter/interpreterRuntime.cpp @@ -29,6 +29,7 @@ #include "code/codeCache.hpp" #include "compiler/compileBroker.hpp" #include "compiler/disassembler.hpp" +#include "gc/shared/barrierSetNMethod.hpp" #include "gc/shared/collectedHeap.hpp" #include "interpreter/interpreter.hpp" #include "interpreter/interpreterRuntime.hpp" @@ -1045,6 +1046,13 @@ nmethod* InterpreterRuntime::frequency_counter_overflow(JavaThread* thread, addr Method* method = last_frame.method(); int bci = method->bci_from(last_frame.bcp()); nm = method->lookup_osr_nmethod_for(bci, CompLevel_none, false); + BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod(); + if (nm != NULL && bs_nm != NULL) { + // in case the transition passed a safepoint we need to barrier this again + if (!bs_nm->nmethod_osr_entry_barrier(nm)) { + nm = NULL; + } + } } if (nm != NULL && thread->is_interp_only_mode()) { // Normally we never get an nm if is_interp_only_mode() is true, because @@ -1081,6 +1089,13 @@ IRT_ENTRY(nmethod*, nmethod* osr_nm = CompilationPolicy::policy()->event(method, method, branch_bci, bci, CompLevel_none, NULL, thread); assert(!HAS_PENDING_EXCEPTION, "Event handler should not throw any exceptions"); + BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod(); + if (osr_nm != NULL && bs_nm != NULL) { + if (!bs_nm->nmethod_osr_entry_barrier(osr_nm)) { + osr_nm = NULL; + } + } + if (osr_nm != NULL) { // We may need to do on-stack replacement which requires that no // monitors in the activation are biased because their From 6b83ac96ab95851ca3d55d8dc3a4e3219170deaa Mon Sep 17 00:00:00 2001 From: Tobias Hartmann Date: Tue, 16 Oct 2018 14:17:19 +0200 Subject: [PATCH 08/66] 8210215: C2 should optimize trichotomy calculations Ideal transformation to optimize trichotomic comparisons. Reviewed-by: kvn, jrose --- src/hotspot/share/opto/cfgnode.cpp | 143 +- src/hotspot/share/opto/cfgnode.hpp | 1 + src/hotspot/share/opto/subnode.cpp | 18 + src/hotspot/share/opto/subnode.hpp | 3 +- .../codegen/TestTrichotomyExpressions.java | 2519 +++++++++++++++++ 5 files changed, 2682 insertions(+), 2 deletions(-) create mode 100644 test/hotspot/jtreg/compiler/codegen/TestTrichotomyExpressions.java diff --git a/src/hotspot/share/opto/cfgnode.cpp b/src/hotspot/share/opto/cfgnode.cpp index eec31934e4e..d5ee3b0b84f 100644 --- a/src/hotspot/share/opto/cfgnode.cpp +++ b/src/hotspot/share/opto/cfgnode.cpp @@ -714,10 +714,151 @@ Node *RegionNode::Ideal(PhaseGVN *phase, bool can_reshape) { } } + if (can_reshape) { + modified |= optimize_trichotomy(phase->is_IterGVN()); + } + return modified ? this : NULL; } - +//------------------------------optimize_trichotomy-------------------------- +// Optimize nested comparisons of the following kind: +// +// int compare(int a, int b) { +// return (a < b) ? -1 : (a == b) ? 0 : 1; +// } +// +// Shape 1: +// if (compare(a, b) == 1) { ... } -> if (a > b) { ... } +// +// Shape 2: +// if (compare(a, b) == 0) { ... } -> if (a == b) { ... } +// +// Above code leads to the following IR shapes where both Ifs compare the +// same value and two out of three region inputs idx1 and idx2 map to +// the same value and control flow. +// +// (1) If (2) If +// / \ / \ +// Proj Proj Proj Proj +// | \ | \ +// | If | If If +// | / \ | / \ / \ +// | Proj Proj | Proj Proj ==> Proj Proj +// | / / \ | / | / +// Region / \ | / | / +// \ / \ | / | / +// Region Region Region +// +// The method returns true if 'this' is modified and false otherwise. +bool RegionNode::optimize_trichotomy(PhaseIterGVN* igvn) { + int idx1 = 1, idx2 = 2; + Node* region = NULL; + if (req() == 3 && in(1) != NULL && in(2) != NULL) { + // Shape 1: Check if one of the inputs is a region that merges two control + // inputs and has no other users (especially no Phi users). + region = in(1)->isa_Region() ? in(1) : in(2)->isa_Region(); + if (region == NULL || region->outcnt() != 2 || region->req() != 3) { + return false; // No suitable region input found + } + } else if (req() == 4) { + // Shape 2: Check if two control inputs map to the same value of the unique phi + // user and treat these as if they would come from another region (shape (1)). + PhiNode* phi = has_unique_phi(); + if (phi == NULL) { + return false; // No unique phi user + } + if (phi->in(idx1) != phi->in(idx2)) { + idx2 = 3; + if (phi->in(idx1) != phi->in(idx2)) { + idx1 = 2; + if (phi->in(idx1) != phi->in(idx2)) { + return false; // No equal phi inputs found + } + } + } + assert(phi->in(idx1) == phi->in(idx2), "must be"); // Region is merging same value + region = this; + } + if (region == NULL || region->in(idx1) == NULL || region->in(idx2) == NULL) { + return false; // Region does not merge two control inputs + } + // At this point we know that region->in(idx1) and region->(idx2) map to the same + // value and control flow. Now search for ifs that feed into these region inputs. + ProjNode* proj1 = region->in(idx1)->isa_Proj(); + ProjNode* proj2 = region->in(idx2)->isa_Proj(); + if (proj1 == NULL || proj1->outcnt() != 1 || + proj2 == NULL || proj2->outcnt() != 1) { + return false; // No projection inputs with region as unique user found + } + assert(proj1 != proj2, "should be different projections"); + IfNode* iff1 = proj1->in(0)->isa_If(); + IfNode* iff2 = proj2->in(0)->isa_If(); + if (iff1 == NULL || iff1->outcnt() != 2 || + iff2 == NULL || iff2->outcnt() != 2) { + return false; // No ifs found + } + if (iff1 == iff2) { + igvn->add_users_to_worklist(iff1); // Make sure dead if is eliminated + igvn->replace_input_of(region, idx1, iff1->in(0)); + igvn->replace_input_of(region, idx2, igvn->C->top()); + return (region == this); // Remove useless if (both projections map to the same control/value) + } + BoolNode* bol1 = iff1->in(1)->isa_Bool(); + BoolNode* bol2 = iff2->in(1)->isa_Bool(); + if (bol1 == NULL || bol2 == NULL) { + return false; // No bool inputs found + } + Node* cmp1 = bol1->in(1); + Node* cmp2 = bol2->in(1); + bool commute = false; + if (!cmp1->is_Cmp() || !cmp2->is_Cmp()) { + return false; // No comparison + } else if (cmp1->Opcode() == Op_CmpF || cmp1->Opcode() == Op_CmpD || + cmp2->Opcode() == Op_CmpF || cmp2->Opcode() == Op_CmpD || + cmp1->Opcode() == Op_CmpP || cmp1->Opcode() == Op_CmpN || + cmp2->Opcode() == Op_CmpP || cmp2->Opcode() == Op_CmpN) { + // Floats and pointers don't exactly obey trichotomy. To be on the safe side, don't transform their tests. + return false; + } else if (cmp1 != cmp2) { + if (cmp1->in(1) == cmp2->in(2) && + cmp1->in(2) == cmp2->in(1)) { + commute = true; // Same but swapped inputs, commute the test + } else { + return false; // Ifs are not comparing the same values + } + } + proj1 = proj1->other_if_proj(); + proj2 = proj2->other_if_proj(); + if (!((proj1->unique_ctrl_out() == iff2 && + proj2->unique_ctrl_out() == this) || + (proj2->unique_ctrl_out() == iff1 && + proj1->unique_ctrl_out() == this))) { + return false; // Ifs are not connected through other projs + } + // Found 'iff -> proj -> iff -> proj -> this' shape where all other projs are merged + // through 'region' and map to the same value. Merge the boolean tests and replace + // the ifs by a single comparison. + BoolTest test1 = (proj1->_con == 1) ? bol1->_test : bol1->_test.negate(); + BoolTest test2 = (proj2->_con == 1) ? bol2->_test : bol2->_test.negate(); + test1 = commute ? test1.commute() : test1; + // After possibly commuting test1, if we can merge test1 & test2, then proj2/iff2/bol2 are the nodes to refine. + BoolTest::mask res = test1.merge(test2); + if (res == BoolTest::illegal) { + return false; // Unable to merge tests + } + // Adjust iff1 to always pass (only iff2 will remain) + igvn->replace_input_of(iff1, 1, igvn->intcon(proj1->_con)); + if (res == BoolTest::never) { + // Merged test is always false, adjust iff2 to always fail + igvn->replace_input_of(iff2, 1, igvn->intcon(1 - proj2->_con)); + } else { + // Replace bool input of iff2 with merged test + BoolNode* new_bol = new BoolNode(bol2->in(1), res); + igvn->replace_input_of(iff2, 1, igvn->transform((proj2->_con == 1) ? new_bol : new_bol->negate(igvn))); + } + return false; +} const RegMask &RegionNode::out_RegMask() const { return RegMask::Empty; diff --git a/src/hotspot/share/opto/cfgnode.hpp b/src/hotspot/share/opto/cfgnode.hpp index 80b8fb29e64..356f0e30ed9 100644 --- a/src/hotspot/share/opto/cfgnode.hpp +++ b/src/hotspot/share/opto/cfgnode.hpp @@ -96,6 +96,7 @@ public: virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); virtual const RegMask &out_RegMask() const; bool try_clean_mem_phi(PhaseGVN *phase); + bool optimize_trichotomy(PhaseIterGVN* igvn); }; //------------------------------JProjNode-------------------------------------- diff --git a/src/hotspot/share/opto/subnode.cpp b/src/hotspot/share/opto/subnode.cpp index cddb893b759..657b7145d0a 100644 --- a/src/hotspot/share/opto/subnode.cpp +++ b/src/hotspot/share/opto/subnode.cpp @@ -1252,6 +1252,24 @@ void BoolTest::dump_on(outputStream *st) const { st->print("%s", msg[_test]); } +// Returns the logical AND of two tests (or 'never' if both tests can never be true). +// For example, a test for 'le' followed by a test for 'lt' is equivalent with 'lt'. +BoolTest::mask BoolTest::merge(BoolTest other) const { + const mask res[illegal+1][illegal+1] = { + // eq, gt, of, lt, ne, le, nof, ge, never, illegal + {eq, never, illegal, never, never, eq, illegal, eq, never, illegal}, // eq + {never, gt, illegal, never, gt, never, illegal, gt, never, illegal}, // gt + {illegal, illegal, illegal, illegal, illegal, illegal, illegal, illegal, never, illegal}, // of + {never, never, illegal, lt, lt, lt, illegal, never, never, illegal}, // lt + {never, gt, illegal, lt, ne, lt, illegal, gt, never, illegal}, // ne + {eq, never, illegal, lt, lt, le, illegal, eq, never, illegal}, // le + {illegal, illegal, illegal, illegal, illegal, illegal, illegal, illegal, never, illegal}, // nof + {eq, gt, illegal, never, gt, eq, illegal, ge, never, illegal}, // ge + {never, never, never, never, never, never, never, never, never, illegal}, // never + {illegal, illegal, illegal, illegal, illegal, illegal, illegal, illegal, illegal, illegal}}; // illegal + return res[_test][other._test]; +} + //============================================================================= uint BoolNode::hash() const { return (Node::hash() << 3)|(_test._test+1); } uint BoolNode::size_of() const { return sizeof(BoolNode); } diff --git a/src/hotspot/share/opto/subnode.hpp b/src/hotspot/share/opto/subnode.hpp index 75489ce4d3f..61813ad1ad5 100644 --- a/src/hotspot/share/opto/subnode.hpp +++ b/src/hotspot/share/opto/subnode.hpp @@ -280,7 +280,7 @@ public: // We pick the values as 3 bits; the low order 2 bits we compare against the // condition codes, the high bit flips the sense of the result. struct BoolTest { - enum mask { eq = 0, ne = 4, le = 5, ge = 7, lt = 3, gt = 1, overflow = 2, no_overflow = 6, illegal = 8 }; + enum mask { eq = 0, ne = 4, le = 5, ge = 7, lt = 3, gt = 1, overflow = 2, no_overflow = 6, never = 8, illegal = 9 }; mask _test; BoolTest( mask btm ) : _test(btm) {} const Type *cc2logical( const Type *CC ) const; @@ -293,6 +293,7 @@ struct BoolTest { bool is_less( ) const { return _test == BoolTest::lt || _test == BoolTest::le; } bool is_greater( ) const { return _test == BoolTest::gt || _test == BoolTest::ge; } void dump_on(outputStream *st) const; + mask merge(BoolTest other) const; }; //------------------------------BoolNode--------------------------------------- diff --git a/test/hotspot/jtreg/compiler/codegen/TestTrichotomyExpressions.java b/test/hotspot/jtreg/compiler/codegen/TestTrichotomyExpressions.java new file mode 100644 index 00000000000..d3aa36cc037 --- /dev/null +++ b/test/hotspot/jtreg/compiler/codegen/TestTrichotomyExpressions.java @@ -0,0 +1,2519 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8210215 + * @summary Test that C2 correctly optimizes trichotomy expressions. + * @library /test/lib + * @run main/othervm -XX:-TieredCompilation -Xbatch + * -XX:CompileCommand=dontinline,compiler.codegen.TestTrichotomyExpressions::test* + * compiler.codegen.TestTrichotomyExpressions + * @run main/othervm -XX:-TieredCompilation -Xcomp + * -XX:CompileCommand=dontinline,compiler.codegen.TestTrichotomyExpressions::test* + * compiler.codegen.TestTrichotomyExpressions + */ + +package compiler.codegen; + +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.util.Random; + +import jdk.test.lib.Asserts; +import jdk.test.lib.Utils; + +enum Operation { SMALLER, SMALLER_EQUAL, EQUAL, GREATER_EQUAL, GREATER, ALWAYS_FALSE } + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +@interface Test { + Operation op(); +} + +public class TestTrichotomyExpressions { + + public static int compare1(int a, int b) { + return (a < b) ? -1 : (a == b) ? 0 : 1; + } + + public static int compare2(int a, int b) { + return (a < b) ? -1 : (a <= b) ? 0 : 1; + } + + public static int compare3(int a, int b) { + return (a < b) ? -1 : (a > b) ? 1 : 0; + } + + public static int compare4(int a, int b) { + return (a < b) ? -1 : (a != b) ? 1 : 0; + } + + public static int compare5(int a, int b) { + return (a > b) ? 1 : (a < b) ? -1 : 0; + } + + public static int compare6(int a, int b) { + return (a > b) ? 1 : (a == b) ? 0 : -1; + } + + public static int compare7(int a, int b) { + return (a > b) ? 1 : (a >= b) ? 0 : -1; + } + + public static int compare8(int a, int b) { + return (a > b) ? 1 : (a != b) ? -1 : 0; + } + + public static int compare9(int a, int b) { + return (a == b) ? 0 : (a < b) ? -1 : 1; + } + + public static int compare10(int a, int b) { + return (a == b) ? 0 : (a <= b) ? -1 : 1; + } + + public static int compare11(int a, int b) { + return (a == b) ? 0 : (a > b) ? 1 : -1; + } + + public static int compare12(int a, int b) { + return (a == b) ? 0 : (a >= b) ? 1 : -1; + } + + public static int compare13(int a, int b) { + return (a <= b) ? ((a == b) ? 0 : -1) : 1; + } + + public static int compare14(int a, int b) { + return (a <= b) ? ((a < b) ? -1 : 0) : 1; + } + + public static int compare15(int a, int b) { + return (a <= b) ? ((a >= b) ? 0 : -1) : 1; + } + + public static int compare16(int a, int b) { + return (a <= b) ? ((a != b) ? -1 : 0) : 1; + } + + public static int compare17(int a, int b) { + return (a >= b) ? ((a <= b) ? 0 : 1) : -1; + } + + public static int compare18(int a, int b) { + return (a >= b) ? ((a == b) ? 0 : 1) : -1; + } + + public static int compare19(int a, int b) { + return (a >= b) ? ((a > b) ? 1 : 0) : -1; + } + + public static int compare20(int a, int b) { + return (a >= b) ? ((a != b) ? 1 : 0) : -1; + } + + public static int compare21(int a, int b) { + return (a != b) ? ((a < b) ? -1 : 1) : 0; + } + + public static int compare22(int a, int b) { + return (a != b) ? ((a <= b) ? -1 : 1) : 0; + } + + public static int compare23(int a, int b) { + return (a != b) ? ((a > b) ? 1 : -1) : 0; + } + + public static int compare24(int a, int b) { + return (a != b) ? ((a >= b) ? 1 : -1) : 0; + } + + public static int compare25(int a, int b) { + return (a < b) ? -1 : (b == a) ? 0 : 1; + } + + public static int compare26(int a, int b) { + return (a < b) ? -1 : (b >= a) ? 0 : 1; + } + + public static int compare27(int a, int b) { + return (a < b) ? -1 : (b < a) ? 1 : 0; + } + + public static int compare28(int a, int b) { + return (a < b) ? -1 : (b != a) ? 1 : 0; + } + + public static int compare29(int a, int b) { + return (a > b) ? 1 : (b > a) ? -1 : 0; + } + + public static int compare30(int a, int b) { + return (a > b) ? 1 : (b == a) ? 0 : -1; + } + + public static int compare31(int a, int b) { + return (a > b) ? 1 : (b <= a) ? 0 : -1; + } + + public static int compare32(int a, int b) { + return (a > b) ? 1 : (b != a) ? -1 : 0; + } + + public static int compare33(int a, int b) { + return (a == b) ? 0 : (b > a) ? -1 : 1; + } + + public static int compare34(int a, int b) { + return (a == b) ? 0 : (b >= a) ? -1 : 1; + } + + public static int compare35(int a, int b) { + return (a == b) ? 0 : (b < a) ? 1 : -1; + } + + public static int compare36(int a, int b) { + return (a == b) ? 0 : (b <= a) ? 1 : -1; + } + + public static int compare37(int a, int b) { + return (a <= b) ? ((b == a) ? 0 : -1) : 1; + } + + public static int compare38(int a, int b) { + return (a <= b) ? ((b > a) ? -1 : 0) : 1; + } + + public static int compare39(int a, int b) { + return (a <= b) ? ((b <= a) ? 0 : -1) : 1; + } + + public static int compare40(int a, int b) { + return (a <= b) ? ((b != a) ? -1 : 0) : 1; + } + + public static int compare41(int a, int b) { + return (a >= b) ? ((b >= a) ? 0 : 1) : -1; + } + + public static int compare42(int a, int b) { + return (a >= b) ? ((b == a) ? 0 : 1) : -1; + } + + public static int compare43(int a, int b) { + return (a >= b) ? ((b < a) ? 1 : 0) : -1; + } + + public static int compare44(int a, int b) { + return (a >= b) ? ((b != a) ? 1 : 0) : -1; + } + + public static int compare45(int a, int b) { + return (a != b) ? ((b > a) ? -1 : 1) : 0; + } + + public static int compare46(int a, int b) { + return (a != b) ? ((b >= a) ? -1 : 1) : 0; + } + + public static int compare47(int a, int b) { + return (a != b) ? ((b < a) ? 1 : -1) : 0; + } + + public static int compare48(int a, int b) { + return (a != b) ? ((b <= a) ? 1 : -1) : 0; + } + + + public static int compareAlwaysFalse1(int a, int b) { + return (a >= b) ? 1 : (a > b) ? 2 : -1; + } + + public static int compareAlwaysFalse2(int a, int b) { + return (a <= b) ? 1 : (a < b) ? 2 : -1; + } + + public static int compareAlwaysFalse3(int a, int b) { + return (a == b) ? 1 : (a == b) ? 2 : -1; + } + + public static int compareAlwaysFalse4(int a, int b) { + return (a != b) ? 1 : (a < b) ? 2 : -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller1(int a, int b) { + return compare1(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller2(int a, int b) { + return compare1(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller3(int a, int b) { + return compare1(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller4(int a, int b) { + return compare2(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller5(int a, int b) { + return compare2(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller6(int a, int b) { + return compare2(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller7(int a, int b) { + return compare3(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller8(int a, int b) { + return compare3(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller9(int a, int b) { + return compare3(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller10(int a, int b) { + return compare4(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller11(int a, int b) { + return compare4(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller12(int a, int b) { + return compare4(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller13(int a, int b) { + return compare5(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller14(int a, int b) { + return compare5(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller15(int a, int b) { + return compare5(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller16(int a, int b) { + return compare6(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller17(int a, int b) { + return compare6(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller18(int a, int b) { + return compare6(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller19(int a, int b) { + return compare7(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller20(int a, int b) { + return compare7(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller21(int a, int b) { + return compare7(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller22(int a, int b) { + return compare8(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller23(int a, int b) { + return compare8(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller24(int a, int b) { + return compare8(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller25(int a, int b) { + return compare9(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller26(int a, int b) { + return compare9(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller27(int a, int b) { + return compare9(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller28(int a, int b) { + return compare10(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller29(int a, int b) { + return compare10(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller30(int a, int b) { + return compare10(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller31(int a, int b) { + return compare11(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller32(int a, int b) { + return compare11(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller33(int a, int b) { + return compare11(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller34(int a, int b) { + return compare12(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller35(int a, int b) { + return compare12(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller36(int a, int b) { + return compare12(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller37(int a, int b) { + return compare13(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller38(int a, int b) { + return compare13(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller39(int a, int b) { + return compare13(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller40(int a, int b) { + return compare14(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller41(int a, int b) { + return compare14(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller42(int a, int b) { + return compare14(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller43(int a, int b) { + return compare15(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller44(int a, int b) { + return compare15(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller45(int a, int b) { + return compare15(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller46(int a, int b) { + return compare16(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller47(int a, int b) { + return compare16(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller48(int a, int b) { + return compare16(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller49(int a, int b) { + return compare17(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller50(int a, int b) { + return compare17(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller51(int a, int b) { + return compare17(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller52(int a, int b) { + return compare18(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller53(int a, int b) { + return compare18(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller54(int a, int b) { + return compare18(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller55(int a, int b) { + return compare19(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller56(int a, int b) { + return compare19(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller57(int a, int b) { + return compare19(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller58(int a, int b) { + return compare20(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller59(int a, int b) { + return compare20(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller60(int a, int b) { + return compare20(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller61(int a, int b) { + return compare21(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller62(int a, int b) { + return compare21(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller63(int a, int b) { + return compare21(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller64(int a, int b) { + return compare22(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller65(int a, int b) { + return compare22(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller66(int a, int b) { + return compare22(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller67(int a, int b) { + return compare23(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller68(int a, int b) { + return compare23(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller69(int a, int b) { + return compare23(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller70(int a, int b) { + return compare24(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller71(int a, int b) { + return compare24(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller72(int a, int b) { + return compare24(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller73(int a, int b) { + return compare25(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller74(int a, int b) { + return compare25(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller75(int a, int b) { + return compare25(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller76(int a, int b) { + return compare26(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller77(int a, int b) { + return compare26(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller78(int a, int b) { + return compare26(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller79(int a, int b) { + return compare27(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller80(int a, int b) { + return compare27(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller81(int a, int b) { + return compare27(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller82(int a, int b) { + return compare28(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller83(int a, int b) { + return compare28(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller84(int a, int b) { + return compare28(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller85(int a, int b) { + return compare29(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller86(int a, int b) { + return compare29(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller87(int a, int b) { + return compare29(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller88(int a, int b) { + return compare30(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller89(int a, int b) { + return compare30(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller90(int a, int b) { + return compare30(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller91(int a, int b) { + return compare31(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller92(int a, int b) { + return compare31(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller93(int a, int b) { + return compare31(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller94(int a, int b) { + return compare32(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller95(int a, int b) { + return compare32(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller96(int a, int b) { + return compare32(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller97(int a, int b) { + return compare33(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller98(int a, int b) { + return compare33(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller99(int a, int b) { + return compare33(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller100(int a, int b) { + return compare34(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller101(int a, int b) { + return compare34(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller102(int a, int b) { + return compare34(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller103(int a, int b) { + return compare35(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller104(int a, int b) { + return compare35(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller105(int a, int b) { + return compare35(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller106(int a, int b) { + return compare36(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller107(int a, int b) { + return compare36(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller108(int a, int b) { + return compare36(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller109(int a, int b) { + return compare37(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller110(int a, int b) { + return compare37(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller111(int a, int b) { + return compare37(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller112(int a, int b) { + return compare38(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller113(int a, int b) { + return compare38(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller114(int a, int b) { + return compare38(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller115(int a, int b) { + return compare39(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller116(int a, int b) { + return compare39(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller117(int a, int b) { + return compare39(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller118(int a, int b) { + return compare40(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller119(int a, int b) { + return compare40(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller120(int a, int b) { + return compare40(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller121(int a, int b) { + return compare41(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller122(int a, int b) { + return compare41(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller123(int a, int b) { + return compare41(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller124(int a, int b) { + return compare42(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller125(int a, int b) { + return compare42(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller126(int a, int b) { + return compare42(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller127(int a, int b) { + return compare43(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller128(int a, int b) { + return compare43(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller129(int a, int b) { + return compare43(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller130(int a, int b) { + return compare44(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller131(int a, int b) { + return compare44(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller132(int a, int b) { + return compare44(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller133(int a, int b) { + return compare45(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller134(int a, int b) { + return compare45(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller135(int a, int b) { + return compare45(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller136(int a, int b) { + return compare46(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller137(int a, int b) { + return compare46(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller138(int a, int b) { + return compare46(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller139(int a, int b) { + return compare47(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller140(int a, int b) { + return compare47(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller141(int a, int b) { + return compare47(a, b) <= -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller142(int a, int b) { + return compare48(a, b) == -1; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller143(int a, int b) { + return compare48(a, b) < 0; + } + + @Test(op = Operation.SMALLER) + public static boolean testSmaller144(int a, int b) { + return compare48(a, b) <= -1; + } + + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual1(int a, int b) { + return compare1(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual2(int a, int b) { + return compare2(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual3(int a, int b) { + return compare3(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual4(int a, int b) { + return compare4(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual5(int a, int b) { + return compare5(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual6(int a, int b) { + return compare6(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual7(int a, int b) { + return compare7(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual8(int a, int b) { + return compare8(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual9(int a, int b) { + return compare9(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual10(int a, int b) { + return compare10(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual11(int a, int b) { + return compare11(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual12(int a, int b) { + return compare12(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual13(int a, int b) { + return compare13(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual14(int a, int b) { + return compare14(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual15(int a, int b) { + return compare15(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual16(int a, int b) { + return compare16(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual17(int a, int b) { + return compare17(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual18(int a, int b) { + return compare18(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual19(int a, int b) { + return compare19(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual20(int a, int b) { + return compare20(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual21(int a, int b) { + return compare21(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual22(int a, int b) { + return compare22(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual23(int a, int b) { + return compare23(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual24(int a, int b) { + return compare24(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual25(int a, int b) { + return compare2(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual26(int a, int b) { + return compare26(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual27(int a, int b) { + return compare27(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual28(int a, int b) { + return compare28(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual29(int a, int b) { + return compare29(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual30(int a, int b) { + return compare30(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual31(int a, int b) { + return compare31(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual32(int a, int b) { + return compare32(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual33(int a, int b) { + return compare33(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual34(int a, int b) { + return compare34(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual35(int a, int b) { + return compare35(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual36(int a, int b) { + return compare36(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual37(int a, int b) { + return compare37(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual38(int a, int b) { + return compare38(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual39(int a, int b) { + return compare39(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual40(int a, int b) { + return compare40(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual41(int a, int b) { + return compare41(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual42(int a, int b) { + return compare42(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual43(int a, int b) { + return compare43(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual44(int a, int b) { + return compare44(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual45(int a, int b) { + return compare45(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual46(int a, int b) { + return compare46(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual47(int a, int b) { + return compare47(a, b) <= 0; + } + + @Test(op = Operation.SMALLER_EQUAL) + public static boolean testSmallerEqual48(int a, int b) { + return compare48(a, b) <= 0; + } + + + @Test(op = Operation.EQUAL) + public static boolean testEqual1(int a, int b) { + return compare1(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual2(int a, int b) { + return compare2(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual3(int a, int b) { + return compare3(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual4(int a, int b) { + return compare4(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual5(int a, int b) { + return compare5(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual6(int a, int b) { + return compare6(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual7(int a, int b) { + return compare7(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual8(int a, int b) { + return compare8(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual9(int a, int b) { + return compare9(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual10(int a, int b) { + return compare10(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual11(int a, int b) { + return compare11(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual12(int a, int b) { + return compare12(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual13(int a, int b) { + return compare13(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual14(int a, int b) { + return compare14(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual15(int a, int b) { + return compare15(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual16(int a, int b) { + return compare16(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual17(int a, int b) { + return compare17(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual18(int a, int b) { + return compare18(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual19(int a, int b) { + return compare19(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual20(int a, int b) { + return compare20(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual21(int a, int b) { + return compare21(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual22(int a, int b) { + return compare22(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual23(int a, int b) { + return compare23(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual24(int a, int b) { + return compare24(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual25(int a, int b) { + return compare25(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual26(int a, int b) { + return compare26(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual27(int a, int b) { + return compare27(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual28(int a, int b) { + return compare28(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual29(int a, int b) { + return compare29(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual30(int a, int b) { + return compare30(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual31(int a, int b) { + return compare31(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual32(int a, int b) { + return compare32(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual33(int a, int b) { + return compare33(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual34(int a, int b) { + return compare34(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual35(int a, int b) { + return compare35(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual36(int a, int b) { + return compare36(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual37(int a, int b) { + return compare37(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual38(int a, int b) { + return compare38(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual39(int a, int b) { + return compare39(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual40(int a, int b) { + return compare40(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual41(int a, int b) { + return compare41(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual42(int a, int b) { + return compare42(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual43(int a, int b) { + return compare43(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual44(int a, int b) { + return compare44(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual45(int a, int b) { + return compare45(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual46(int a, int b) { + return compare46(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual47(int a, int b) { + return compare47(a, b) == 0; + } + + @Test(op = Operation.EQUAL) + public static boolean testEqual48(int a, int b) { + return compare48(a, b) == 0; + } + + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual1(int a, int b) { + return compare1(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual2(int a, int b) { + return compare2(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual3(int a, int b) { + return compare3(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual4(int a, int b) { + return compare4(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual5(int a, int b) { + return compare5(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual6(int a, int b) { + return compare6(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual7(int a, int b) { + return compare7(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual8(int a, int b) { + return compare8(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual9(int a, int b) { + return compare9(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual10(int a, int b) { + return compare10(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual11(int a, int b) { + return compare11(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual12(int a, int b) { + return compare12(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual13(int a, int b) { + return compare13(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual14(int a, int b) { + return compare14(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual15(int a, int b) { + return compare15(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual16(int a, int b) { + return compare16(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual17(int a, int b) { + return compare17(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual18(int a, int b) { + return compare18(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual19(int a, int b) { + return compare19(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual20(int a, int b) { + return compare20(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual21(int a, int b) { + return compare21(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual22(int a, int b) { + return compare22(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual23(int a, int b) { + return compare23(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual24(int a, int b) { + return compare24(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual25(int a, int b) { + return compare25(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual26(int a, int b) { + return compare26(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual27(int a, int b) { + return compare27(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual28(int a, int b) { + return compare28(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual29(int a, int b) { + return compare29(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual30(int a, int b) { + return compare30(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual31(int a, int b) { + return compare31(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual32(int a, int b) { + return compare32(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual33(int a, int b) { + return compare33(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual34(int a, int b) { + return compare34(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual35(int a, int b) { + return compare35(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual36(int a, int b) { + return compare36(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual37(int a, int b) { + return compare37(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual38(int a, int b) { + return compare38(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual39(int a, int b) { + return compare39(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual40(int a, int b) { + return compare40(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual41(int a, int b) { + return compare41(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual42(int a, int b) { + return compare42(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual43(int a, int b) { + return compare43(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual44(int a, int b) { + return compare44(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual45(int a, int b) { + return compare45(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual46(int a, int b) { + return compare46(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual47(int a, int b) { + return compare47(a, b) >= 0; + } + + @Test(op = Operation.GREATER_EQUAL) + public static boolean testGreaterEqual48(int a, int b) { + return compare48(a, b) >= 0; + } + + + @Test(op = Operation.GREATER) + public static boolean testGreater1(int a, int b) { + return compare1(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater2(int a, int b) { + return compare1(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater3(int a, int b) { + return compare1(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater4(int a, int b) { + return compare2(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater5(int a, int b) { + return compare2(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater6(int a, int b) { + return compare2(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater7(int a, int b) { + return compare3(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater8(int a, int b) { + return compare3(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater9(int a, int b) { + return compare3(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater10(int a, int b) { + return compare4(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater11(int a, int b) { + return compare4(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater12(int a, int b) { + return compare4(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater13(int a, int b) { + return compare5(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater14(int a, int b) { + return compare5(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater15(int a, int b) { + return compare5(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater16(int a, int b) { + return compare6(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater17(int a, int b) { + return compare6(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater18(int a, int b) { + return compare6(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater19(int a, int b) { + return compare7(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater20(int a, int b) { + return compare7(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater21(int a, int b) { + return compare7(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater22(int a, int b) { + return compare8(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater23(int a, int b) { + return compare8(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater24(int a, int b) { + return compare8(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater25(int a, int b) { + return compare9(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater26(int a, int b) { + return compare9(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater27(int a, int b) { + return compare9(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater28(int a, int b) { + return compare10(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater29(int a, int b) { + return compare10(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater30(int a, int b) { + return compare10(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater31(int a, int b) { + return compare11(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater32(int a, int b) { + return compare11(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater33(int a, int b) { + return compare11(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater34(int a, int b) { + return compare12(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater35(int a, int b) { + return compare12(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater36(int a, int b) { + return compare12(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater37(int a, int b) { + return compare13(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater38(int a, int b) { + return compare13(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater39(int a, int b) { + return compare13(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater40(int a, int b) { + return compare14(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater41(int a, int b) { + return compare14(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater42(int a, int b) { + return compare14(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater43(int a, int b) { + return compare15(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater44(int a, int b) { + return compare15(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater45(int a, int b) { + return compare15(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater46(int a, int b) { + return compare16(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater47(int a, int b) { + return compare16(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater48(int a, int b) { + return compare16(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater49(int a, int b) { + return compare17(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater50(int a, int b) { + return compare17(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater51(int a, int b) { + return compare17(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater52(int a, int b) { + return compare18(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater53(int a, int b) { + return compare18(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater54(int a, int b) { + return compare18(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater55(int a, int b) { + return compare19(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater56(int a, int b) { + return compare19(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater57(int a, int b) { + return compare19(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater58(int a, int b) { + return compare20(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater59(int a, int b) { + return compare20(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater60(int a, int b) { + return compare20(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater61(int a, int b) { + return compare21(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater62(int a, int b) { + return compare21(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater63(int a, int b) { + return compare21(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater64(int a, int b) { + return compare22(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater65(int a, int b) { + return compare22(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater66(int a, int b) { + return compare22(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater67(int a, int b) { + return compare23(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater68(int a, int b) { + return compare23(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater69(int a, int b) { + return compare23(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater70(int a, int b) { + return compare24(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater71(int a, int b) { + return compare24(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater72(int a, int b) { + return compare24(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater73(int a, int b) { + return compare25(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater74(int a, int b) { + return compare25(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater75(int a, int b) { + return compare25(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater76(int a, int b) { + return compare26(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater77(int a, int b) { + return compare26(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater78(int a, int b) { + return compare26(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater79(int a, int b) { + return compare27(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater80(int a, int b) { + return compare27(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater81(int a, int b) { + return compare27(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater82(int a, int b) { + return compare28(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater83(int a, int b) { + return compare28(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater84(int a, int b) { + return compare28(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater85(int a, int b) { + return compare29(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater86(int a, int b) { + return compare29(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater87(int a, int b) { + return compare29(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater88(int a, int b) { + return compare30(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater89(int a, int b) { + return compare30(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater90(int a, int b) { + return compare30(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater91(int a, int b) { + return compare31(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater92(int a, int b) { + return compare31(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater93(int a, int b) { + return compare31(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater94(int a, int b) { + return compare32(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater95(int a, int b) { + return compare32(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater96(int a, int b) { + return compare32(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater97(int a, int b) { + return compare33(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater98(int a, int b) { + return compare33(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater99(int a, int b) { + return compare33(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater100(int a, int b) { + return compare34(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater101(int a, int b) { + return compare34(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater102(int a, int b) { + return compare34(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater103(int a, int b) { + return compare35(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater104(int a, int b) { + return compare35(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater105(int a, int b) { + return compare35(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater106(int a, int b) { + return compare36(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater107(int a, int b) { + return compare36(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater108(int a, int b) { + return compare36(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater109(int a, int b) { + return compare37(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater110(int a, int b) { + return compare37(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater111(int a, int b) { + return compare37(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater112(int a, int b) { + return compare38(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater113(int a, int b) { + return compare38(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater114(int a, int b) { + return compare38(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater115(int a, int b) { + return compare39(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater116(int a, int b) { + return compare39(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater117(int a, int b) { + return compare39(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater118(int a, int b) { + return compare40(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater119(int a, int b) { + return compare40(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater120(int a, int b) { + return compare40(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater121(int a, int b) { + return compare41(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater122(int a, int b) { + return compare41(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater123(int a, int b) { + return compare41(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater124(int a, int b) { + return compare42(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater125(int a, int b) { + return compare42(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater126(int a, int b) { + return compare42(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater127(int a, int b) { + return compare43(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater128(int a, int b) { + return compare43(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater129(int a, int b) { + return compare43(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater130(int a, int b) { + return compare44(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater131(int a, int b) { + return compare44(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater132(int a, int b) { + return compare44(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater133(int a, int b) { + return compare45(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater134(int a, int b) { + return compare45(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater135(int a, int b) { + return compare45(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater136(int a, int b) { + return compare46(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater137(int a, int b) { + return compare46(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater138(int a, int b) { + return compare46(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater139(int a, int b) { + return compare47(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater140(int a, int b) { + return compare47(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater141(int a, int b) { + return compare47(a, b) >= 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater142(int a, int b) { + return compare48(a, b) == 1; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater143(int a, int b) { + return compare48(a, b) > 0; + } + + @Test(op = Operation.GREATER) + public static boolean testGreater144(int a, int b) { + return compare48(a, b) >= 1; + } + + + @Test(op = Operation.ALWAYS_FALSE) + public static boolean testAlwaysFalse1(int a, int b) { + return compareAlwaysFalse1(a, b) == 2; + } + + @Test(op = Operation.ALWAYS_FALSE) + public static boolean testAlwaysFalse2(int a, int b) { + return compareAlwaysFalse1(a, b) > 1; + } + + @Test(op = Operation.ALWAYS_FALSE) + public static boolean testAlwaysFalse3(int a, int b) { + return compareAlwaysFalse1(a, b) >= 2; + } + + @Test(op = Operation.ALWAYS_FALSE) + public static boolean testAlwaysFalse4(int a, int b) { + return compareAlwaysFalse2(a, b) == 2; + } + + @Test(op = Operation.ALWAYS_FALSE) + public static boolean testAlwaysFalse5(int a, int b) { + return compareAlwaysFalse2(a, b) > 1; + } + + @Test(op = Operation.ALWAYS_FALSE) + public static boolean testAlwaysFalse6(int a, int b) { + return compareAlwaysFalse2(a, b) >= 2; + } + + @Test(op = Operation.ALWAYS_FALSE) + public static boolean testAlwaysFalse7(int a, int b) { + return compareAlwaysFalse3(a, b) == 2; + } + + @Test(op = Operation.ALWAYS_FALSE) + public static boolean testAlwaysFalse8(int a, int b) { + return compareAlwaysFalse3(a, b) > 1; + } + + @Test(op = Operation.ALWAYS_FALSE) + public static boolean testAlwaysFalse9(int a, int b) { + return compareAlwaysFalse3(a, b) >= 2; + } + + @Test(op = Operation.ALWAYS_FALSE) + public static boolean testAlwaysFalse10(int a, int b) { + return compareAlwaysFalse4(a, b) == 2; + } + + @Test(op = Operation.ALWAYS_FALSE) + public static boolean testAlwaysFalse11(int a, int b) { + return compareAlwaysFalse4(a, b) > 1; + } + + @Test(op = Operation.ALWAYS_FALSE) + public static boolean testAlwaysFalse12(int a, int b) { + return compareAlwaysFalse4(a, b) >= 2; + } + + public static void main(String[] args) throws Exception { + Random rand = Utils.getRandomInstance(); + for (int i = 0; i < 20_000; ++i) { + int low = rand.nextInt(); + int high = rand.nextInt(); + if (low == high) { + --low; + } + if (low > high) { + int tmp = low; + low = high; + high = tmp; + } + for (Method m : TestTrichotomyExpressions.class.getMethods()) { + if (m.isAnnotationPresent(Test.class)) { + Operation op = m.getAnnotation(Test.class).op(); + boolean result = (boolean)m.invoke(null, low, low); + Asserts.assertEquals(result, (op == Operation.EQUAL || op == Operation.SMALLER_EQUAL || op == Operation.GREATER_EQUAL) ? true : false, m + " failed"); + result = (boolean)m.invoke(null, low, high); + Asserts.assertEquals(result, (op == Operation.SMALLER || op == Operation.SMALLER_EQUAL) ? true : false, m + " failed"); + result = (boolean)m.invoke(null, high, low); + Asserts.assertEquals(result, (op == Operation.GREATER || op == Operation.GREATER_EQUAL) ? true : false, m + " failed"); + } + } + } + } +} From bfb6aa4821fe83a743b19fd503098935e0060b1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20Walln=C3=B6fer?= Date: Tue, 16 Oct 2018 15:05:03 +0200 Subject: [PATCH 09/66] 8210683: Search result display order reversed for overloaded entries Reviewed-by: jjg --- .../internal/doclets/toolkit/util/Utils.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java index 60fc099ab7f..0213d08f747 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java @@ -30,6 +30,8 @@ import java.lang.ref.SoftReference; import java.net.URI; import java.text.CollationKey; import java.text.Collator; +import java.text.ParseException; +import java.text.RuleBasedCollator; import java.util.*; import java.util.AbstractMap.SimpleEntry; import java.util.Map.Entry; @@ -1588,7 +1590,7 @@ public class Utils { private final Collator instance; private final int MAX_SIZE = 1000; private DocCollator(Locale locale, int strength) { - instance = Collator.getInstance(locale); + instance = createCollator(locale); instance.setStrength(strength); keys = new LinkedHashMap(MAX_SIZE + 1, 0.75f, true) { @@ -1607,6 +1609,21 @@ public class Utils { public int compare(String s1, String s2) { return getKey(s1).compareTo(getKey(s2)); } + + private Collator createCollator(Locale locale) { + Collator baseCollator = Collator.getInstance(locale); + if (baseCollator instanceof RuleBasedCollator) { + // Extend collator to sort signatures with additional args and var-args in a well-defined order: + // () < (int) < (int, int) < (int...) + try { + return new RuleBasedCollator(((RuleBasedCollator) baseCollator).getRules() + + "& ')' < ',' < '.','['"); + } catch (ParseException e) { + throw new RuntimeException(e); + } + } + return baseCollator; + } } private Comparator moduleComparator = null; From 6a7fdffe3b4d0f3a48da28e152ef495e59b88706 Mon Sep 17 00:00:00 2001 From: Bob Vandette Date: Tue, 16 Oct 2018 09:54:28 -0400 Subject: [PATCH 10/66] 8211740: [AOT] -XX:AOTLibrary doesn't accept windows path Reviewed-by: kvn, iignatyev --- src/hotspot/share/aot/aotLoader.cpp | 8 +++++++- .../jtreg/compiler/aot/cli/MultipleAOTLibraryTest.java | 8 ++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/hotspot/share/aot/aotLoader.cpp b/src/hotspot/share/aot/aotLoader.cpp index 289d18b5356..d08b8e1cf37 100644 --- a/src/hotspot/share/aot/aotLoader.cpp +++ b/src/hotspot/share/aot/aotLoader.cpp @@ -137,6 +137,12 @@ void AOTLoader::initialize() { return; } +#ifdef _WINDOWS + const char pathSep = ';'; +#else + const char pathSep = ':'; +#endif + // Scan the AOTLibrary option. if (AOTLibrary != NULL) { const int len = (int)strlen(AOTLibrary); @@ -147,7 +153,7 @@ void AOTLoader::initialize() { char* end = cp + len; while (cp < end) { const char* name = cp; - while ((*cp) != '\0' && (*cp) != '\n' && (*cp) != ',' && (*cp) != ':' && (*cp) != ';') cp++; + while ((*cp) != '\0' && (*cp) != '\n' && (*cp) != ',' && (*cp) != pathSep) cp++; cp[0] = '\0'; // Terminate name cp++; load_library(name, true); diff --git a/test/hotspot/jtreg/compiler/aot/cli/MultipleAOTLibraryTest.java b/test/hotspot/jtreg/compiler/aot/cli/MultipleAOTLibraryTest.java index e6f3f8783c5..7ed60d39810 100644 --- a/test/hotspot/jtreg/compiler/aot/cli/MultipleAOTLibraryTest.java +++ b/test/hotspot/jtreg/compiler/aot/cli/MultipleAOTLibraryTest.java @@ -54,6 +54,7 @@ package compiler.aot.cli; import compiler.aot.HelloWorldPrinter; +import java.io.File; import java.util.Arrays; import jdk.test.lib.process.ExitCode; import jdk.test.lib.cli.CommandLineOptionTest; @@ -75,8 +76,11 @@ public final class MultipleAOTLibraryTest { boolean addTestVMOptions = true; String[] allArgs = Arrays.copyOf(args, args.length + 4); allArgs[args.length] = "-XX:AOTLibrary=" - + "./libMultipleAOTLibraryTest1.so:" - + "./libMultipleAOTLibraryTest2.so"; + + "." + File.separator + + "libMultipleAOTLibraryTest1.so" + + File.pathSeparator + + "." + File.separator + + "libMultipleAOTLibraryTest2.so"; allArgs[args.length + 1] = "-XX:+PrintAOT"; allArgs[args.length + 2] = "-XX:+UseAOT"; allArgs[args.length + 3] = HelloWorldPrinter.class.getName(); From 4fe37df932971da6ab6fc6587e0f4765a628526c Mon Sep 17 00:00:00 2001 From: Brian Burkhalter Date: Tue, 16 Oct 2018 07:49:08 -0700 Subject: [PATCH 11/66] 8212212: (bf) Incorrect path to stream preprocessor source in java.nio Buffer test scripts Reviewed-by: alanb --- test/jdk/java/nio/Buffer/genBasic.sh | 4 ++-- test/jdk/java/nio/Buffer/genCopyDirectMemory.sh | 4 ++-- test/jdk/java/nio/Buffer/genOrder.sh | 5 ++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/test/jdk/java/nio/Buffer/genBasic.sh b/test/jdk/java/nio/Buffer/genBasic.sh index 1090476807c..2fd00e8d0db 100644 --- a/test/jdk/java/nio/Buffer/genBasic.sh +++ b/test/jdk/java/nio/Buffer/genBasic.sh @@ -1,7 +1,7 @@ #! /bin/sh # -# Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. # 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,7 @@ # questions. # -javac -d . ../../../../make/src/classes/build/tools/spp/Spp.java +javac -d . ../../../../../make/jdk/src/classes/build/tools/spp/Spp.java gen() { java build.tools.spp.Spp -K$1 -Dtype=$1 -DType=$2 -DFulltype=$3 Basic$2.java diff --git a/test/jdk/java/nio/Buffer/genCopyDirectMemory.sh b/test/jdk/java/nio/Buffer/genCopyDirectMemory.sh index 64c51e52904..e2190295a51 100644 --- a/test/jdk/java/nio/Buffer/genCopyDirectMemory.sh +++ b/test/jdk/java/nio/Buffer/genCopyDirectMemory.sh @@ -1,7 +1,7 @@ #! /bin/sh # -# Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. # 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,7 @@ # questions. # -javac -d . ../../../../make/src/classes/build/tools/spp/Spp.java > Spp.java +javac -d . ../../../../../make/jdk/src/classes/build/tools/spp/Spp.java > Spp.java gen() { java build.tools.spp.Spp -K$1 -Dtype=$1 -DType=$2 -DFulltype=$3CopyDirect$2Memory.java diff --git a/test/jdk/java/nio/Buffer/genOrder.sh b/test/jdk/java/nio/Buffer/genOrder.sh index 96473c9c8b3..f505e4d17b6 100644 --- a/test/jdk/java/nio/Buffer/genOrder.sh +++ b/test/jdk/java/nio/Buffer/genOrder.sh @@ -1,7 +1,7 @@ #! /bin/sh # -# Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. # 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,8 +23,7 @@ # questions. # -javac -d . ../../../../make/src/classes/build/tools/spp/Spp.java > Spp.java - +javac -d . ../../../../../make/jdk/src/classes/build/tools/spp/Spp.java > Spp.java gen() { java build.tools.spp.Spp -K$1 -Dtype=$1 -DType=$2 -DFulltype=$3Order$2.java } From 794d864feb3ef103bedc60b571b07d0a9650ab2d Mon Sep 17 00:00:00 2001 From: Harold Seigel Date: Tue, 16 Oct 2018 11:08:46 -0400 Subject: [PATCH 12/66] 7041262: VM_Version should be called instead of Abstract_VM_Version so that overriding works Change calls to Abstract_VM_Version methods to be calls to VM_Version methods. Reviewed-by: coleenp, kbarrett, dholmes --- src/hotspot/cpu/arm/vm_version_arm_32.cpp | 17 ----------------- src/hotspot/share/classfile/classLoader.cpp | 2 +- src/hotspot/share/gc/cms/cmsArguments.cpp | 3 ++- src/hotspot/share/gc/g1/g1Arguments.cpp | 2 +- .../share/gc/parallel/parallelArguments.cpp | 3 ++- src/hotspot/share/gc/z/zInitialize.cpp | 4 ++-- src/hotspot/share/prims/jvm.cpp | 4 ++-- src/hotspot/share/runtime/thread.cpp | 6 +++--- src/hotspot/share/runtime/vm_version.hpp | 4 ++-- .../share/services/diagnosticCommand.cpp | 4 ++-- src/hotspot/share/services/runtimeService.cpp | 4 ++-- src/hotspot/share/utilities/vmError.cpp | 16 ++++++++-------- 12 files changed, 27 insertions(+), 42 deletions(-) diff --git a/src/hotspot/cpu/arm/vm_version_arm_32.cpp b/src/hotspot/cpu/arm/vm_version_arm_32.cpp index df0fb2ecfda..904554a8f6a 100644 --- a/src/hotspot/cpu/arm/vm_version_arm_32.cpp +++ b/src/hotspot/cpu/arm/vm_version_arm_32.cpp @@ -318,20 +318,3 @@ bool VM_Version::use_biased_locking() { // return (!os::is_MP() && (arm_arch() > 5)) ? false : true; } - -#define EXP - -// Temporary override for experimental features -// Copied from Abstract_VM_Version -const char* VM_Version::vm_info_string() { - switch (Arguments::mode()) { - case Arguments::_int: - return UseSharedSpaces ? "interpreted mode, sharing" EXP : "interpreted mode" EXP; - case Arguments::_mixed: - return UseSharedSpaces ? "mixed mode, sharing" EXP : "mixed mode" EXP; - case Arguments::_comp: - return UseSharedSpaces ? "compiled mode, sharing" EXP : "compiled mode" EXP; - }; - ShouldNotReachHere(); - return ""; -} diff --git a/src/hotspot/share/classfile/classLoader.cpp b/src/hotspot/share/classfile/classLoader.cpp index 5656b952031..bd36f7bbc51 100644 --- a/src/hotspot/share/classfile/classLoader.cpp +++ b/src/hotspot/share/classfile/classLoader.cpp @@ -163,7 +163,7 @@ static const char* get_jimage_version_string() { static char version_string[10] = ""; if (version_string[0] == '\0') { jio_snprintf(version_string, sizeof(version_string), "%d.%d", - Abstract_VM_Version::vm_major_version(), Abstract_VM_Version::vm_minor_version()); + VM_Version::vm_major_version(), VM_Version::vm_minor_version()); } return (const char*)version_string; } diff --git a/src/hotspot/share/gc/cms/cmsArguments.cpp b/src/hotspot/share/gc/cms/cmsArguments.cpp index 0b061c81aab..af731582bc6 100644 --- a/src/hotspot/share/gc/cms/cmsArguments.cpp +++ b/src/hotspot/share/gc/cms/cmsArguments.cpp @@ -1,4 +1,5 @@ /* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, Red Hat, Inc. and/or its affiliates. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -45,7 +46,7 @@ void CMSArguments::set_parnew_gc_flags() { assert(UseConcMarkSweepGC, "CMS is expected to be on here"); if (FLAG_IS_DEFAULT(ParallelGCThreads)) { - FLAG_SET_DEFAULT(ParallelGCThreads, Abstract_VM_Version::parallel_worker_threads()); + FLAG_SET_DEFAULT(ParallelGCThreads, VM_Version::parallel_worker_threads()); assert(ParallelGCThreads > 0, "We should always have at least one thread by default"); } else if (ParallelGCThreads == 0) { jio_fprintf(defaultStream::error_stream(), diff --git a/src/hotspot/share/gc/g1/g1Arguments.cpp b/src/hotspot/share/gc/g1/g1Arguments.cpp index 19791d4244f..f2e52818789 100644 --- a/src/hotspot/share/gc/g1/g1Arguments.cpp +++ b/src/hotspot/share/gc/g1/g1Arguments.cpp @@ -75,7 +75,7 @@ void G1Arguments::parse_verification_type(const char* type) { void G1Arguments::initialize() { GCArguments::initialize(); assert(UseG1GC, "Error"); - FLAG_SET_DEFAULT(ParallelGCThreads, Abstract_VM_Version::parallel_worker_threads()); + FLAG_SET_DEFAULT(ParallelGCThreads, VM_Version::parallel_worker_threads()); if (ParallelGCThreads == 0) { assert(!FLAG_IS_DEFAULT(ParallelGCThreads), "The default value for ParallelGCThreads should not be 0."); vm_exit_during_initialization("The flag -XX:+UseG1GC can not be combined with -XX:ParallelGCThreads=0", NULL); diff --git a/src/hotspot/share/gc/parallel/parallelArguments.cpp b/src/hotspot/share/gc/parallel/parallelArguments.cpp index 2a0a348c8ef..73201eecfe9 100644 --- a/src/hotspot/share/gc/parallel/parallelArguments.cpp +++ b/src/hotspot/share/gc/parallel/parallelArguments.cpp @@ -1,4 +1,5 @@ /* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, Red Hat, Inc. and/or its affiliates. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -50,7 +51,7 @@ void ParallelArguments::initialize() { // If no heap maximum was requested explicitly, use some reasonable fraction // of the physical memory, up to a maximum of 1GB. FLAG_SET_DEFAULT(ParallelGCThreads, - Abstract_VM_Version::parallel_worker_threads()); + VM_Version::parallel_worker_threads()); if (ParallelGCThreads == 0) { jio_fprintf(defaultStream::error_stream(), "The Parallel GC can not be combined with -XX:ParallelGCThreads=0\n"); diff --git a/src/hotspot/share/gc/z/zInitialize.cpp b/src/hotspot/share/gc/z/zInitialize.cpp index 31314fd90d9..b2656f1a11c 100644 --- a/src/hotspot/share/gc/z/zInitialize.cpp +++ b/src/hotspot/share/gc/z/zInitialize.cpp @@ -38,8 +38,8 @@ ZInitialize::ZInitialize(ZBarrierSet* barrier_set) { log_info(gc, init)("Initializing %s", ZGCName); log_info(gc, init)("Version: %s (%s)", - Abstract_VM_Version::vm_release(), - Abstract_VM_Version::jdk_debug_level()); + VM_Version::vm_release(), + VM_Version::jdk_debug_level()); // Early initialization ZAddressMasks::initialize(); diff --git a/src/hotspot/share/prims/jvm.cpp b/src/hotspot/share/prims/jvm.cpp index 9b577fda315..779f2c785c4 100644 --- a/src/hotspot/share/prims/jvm.cpp +++ b/src/hotspot/share/prims/jvm.cpp @@ -3736,8 +3736,8 @@ JVM_ENTRY(void, JVM_GetVersionInfo(JNIEnv* env, jvm_version_info* info, size_t i { memset(info, 0, info_size); - info->jvm_version = Abstract_VM_Version::jvm_version(); - info->patch_version = Abstract_VM_Version::vm_patch_version(); + info->jvm_version = VM_Version::jvm_version(); + info->patch_version = VM_Version::vm_patch_version(); // when we add a new capability in the jvm_version_info struct, we should also // consider to expose this new capability in the sun.rt.jvmCapabilities jvmstat diff --git a/src/hotspot/share/runtime/thread.cpp b/src/hotspot/share/runtime/thread.cpp index ed30d3dfbab..3d4ba5171e8 100644 --- a/src/hotspot/share/runtime/thread.cpp +++ b/src/hotspot/share/runtime/thread.cpp @@ -4569,9 +4569,9 @@ void Threads::print_on(outputStream* st, bool print_stacks, st->print_raw_cr(os::local_time_string(buf, sizeof(buf))); st->print_cr("Full thread dump %s (%s %s):", - Abstract_VM_Version::vm_name(), - Abstract_VM_Version::vm_release(), - Abstract_VM_Version::vm_info_string()); + VM_Version::vm_name(), + VM_Version::vm_release(), + VM_Version::vm_info_string()); st->cr(); #if INCLUDE_SERVICES diff --git a/src/hotspot/share/runtime/vm_version.hpp b/src/hotspot/share/runtime/vm_version.hpp index e0f89ea958c..c7b5779c8d2 100644 --- a/src/hotspot/share/runtime/vm_version.hpp +++ b/src/hotspot/share/runtime/vm_version.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -69,7 +69,7 @@ class Abstract_VM_Version: AllStatic { // occurred. Examines a variety of the hardware capabilities of // the platform to determine which features can be used to execute the // program. - static void initialize(); + static void initialize() { } // This allows for early initialization of VM_Version information // that may be needed later in the initialization sequence but before diff --git a/src/hotspot/share/services/diagnosticCommand.cpp b/src/hotspot/share/services/diagnosticCommand.cpp index 03d19465136..d94dc13c3f9 100644 --- a/src/hotspot/share/services/diagnosticCommand.cpp +++ b/src/hotspot/share/services/diagnosticCommand.cpp @@ -213,8 +213,8 @@ int HelpDCmd::num_arguments() { } void VersionDCmd::execute(DCmdSource source, TRAPS) { - output()->print_cr("%s version %s", Abstract_VM_Version::vm_name(), - Abstract_VM_Version::vm_release()); + output()->print_cr("%s version %s", VM_Version::vm_name(), + VM_Version::vm_release()); JDK_Version jdk_version = JDK_Version::current(); if (jdk_version.patch_version() > 0) { output()->print_cr("JDK %d.%d.%d.%d", jdk_version.major_version(), diff --git a/src/hotspot/share/services/runtimeService.cpp b/src/hotspot/share/services/runtimeService.cpp index 48f14646303..30dcdf41a19 100644 --- a/src/hotspot/share/services/runtimeService.cpp +++ b/src/hotspot/share/services/runtimeService.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -66,7 +66,7 @@ void RuntimeService::init() { // create performance counters for jvm_version and its capabilities PerfDataManager::create_constant(SUN_RT, "jvmVersion", PerfData::U_None, - (jlong) Abstract_VM_Version::jvm_version(), CHECK); + (jlong) VM_Version::jvm_version(), CHECK); // The capabilities counter is a binary representation of the VM capabilities in string. // This string respresentation simplifies the implementation of the client side diff --git a/src/hotspot/share/utilities/vmError.cpp b/src/hotspot/share/utilities/vmError.cpp index aee76fd228f..061ebef5ea5 100644 --- a/src/hotspot/share/utilities/vmError.cpp +++ b/src/hotspot/share/utilities/vmError.cpp @@ -319,18 +319,18 @@ static void report_vm_version(outputStream* st, char* buf, int buflen) { JDK_Version::runtime_name() : ""; const char* runtime_version = JDK_Version::runtime_version() != NULL ? JDK_Version::runtime_version() : ""; - const char* jdk_debug_level = Abstract_VM_Version::printable_jdk_debug_level() != NULL ? - Abstract_VM_Version::printable_jdk_debug_level() : ""; + const char* jdk_debug_level = VM_Version::printable_jdk_debug_level() != NULL ? + VM_Version::printable_jdk_debug_level() : ""; st->print_cr("# JRE version: %s (%s) (%sbuild %s)", runtime_name, buf, jdk_debug_level, runtime_version); // This is the long version with some default settings added st->print_cr("# Java VM: %s (%s%s, %s%s%s%s%s, %s, %s)", - Abstract_VM_Version::vm_name(), + VM_Version::vm_name(), jdk_debug_level, - Abstract_VM_Version::vm_release(), - Abstract_VM_Version::vm_info_string(), + VM_Version::vm_release(), + VM_Version::vm_info_string(), TieredCompilation ? ", tiered" : "", #if INCLUDE_JVMCI EnableJVMCI ? ", jvmci" : "", @@ -340,7 +340,7 @@ static void report_vm_version(outputStream* st, char* buf, int buflen) { #endif UseCompressedOops ? ", compressed oops" : "", GCConfig::hs_err_name(), - Abstract_VM_Version::vm_platform_string() + VM_Version::vm_platform_string() ); } @@ -1007,7 +1007,7 @@ void VMError::report(outputStream* st, bool _verbose) { STEP("printing internal vm info") if (_verbose) { - st->print_cr("vm_info: %s", Abstract_VM_Version::internal_vm_info_string()); + st->print_cr("vm_info: %s", VM_Version::internal_vm_info_string()); st->cr(); } @@ -1170,7 +1170,7 @@ void VMError::print_vm_info(outputStream* st) { // STEP("printing internal vm info") - st->print_cr("vm_info: %s", Abstract_VM_Version::internal_vm_info_string()); + st->print_cr("vm_info: %s", VM_Version::internal_vm_info_string()); st->cr(); // print a defined marker to show that error handling finished correctly. From 8dd0b1f061c910b10a43cfc455216327b0e82590 Mon Sep 17 00:00:00 2001 From: Roger Riggs Date: Tue, 16 Oct 2018 10:55:28 -0400 Subject: [PATCH 13/66] 8192939: Remove Finalize methods from FileInputStream and FileOutputStream Reviewed-by: alanb, iris, mchung --- .../classes/java/io/FileInputStream.java | 91 +---------------- .../classes/java/io/FileOutputStream.java | 99 +------------------ .../UnreferencedFISClosesFd.java | 75 ++++---------- .../UnreferencedFOSClosesFd.java | 82 +++++---------- 4 files changed, 48 insertions(+), 299 deletions(-) diff --git a/src/java.base/share/classes/java/io/FileInputStream.java b/src/java.base/share/classes/java/io/FileInputStream.java index a2ab728ab9b..0d5dca8a1a0 100644 --- a/src/java.base/share/classes/java/io/FileInputStream.java +++ b/src/java.base/share/classes/java/io/FileInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -79,8 +79,6 @@ class FileInputStream extends InputStream private volatile boolean closed; - private final Object altFinalizer; - /** * Creates a FileInputStream by * opening a connection to an actual file, @@ -155,10 +153,7 @@ class FileInputStream extends InputStream fd.attach(this); path = name; open(name); - altFinalizer = getFinalizer(this); - if (altFinalizer == null) { - FileCleanable.register(fd); // open set the fd, register the cleanup - } + FileCleanable.register(fd); // open set the fd, register the cleanup } /** @@ -195,7 +190,6 @@ class FileInputStream extends InputStream } fd = fdObj; path = null; - altFinalizer = null; /* * FileDescriptor is being shared by streams. @@ -438,85 +432,4 @@ class FileInputStream extends InputStream static { initIDs(); } - - /** - * Ensures that the {@link #close} method of this file input stream is - * called when there are no more references to it. - * The {@link #finalize} method does not call {@link #close} directly. - * - * @apiNote - * To release resources used by this stream {@link #close} should be called - * directly or by try-with-resources. - * - * @implSpec - * If this FileInputStream has been subclassed and the {@link #close} - * method has been overridden, the {@link #close} method will be - * called when the FileInputStream is unreachable. - * Otherwise, it is implementation specific how the resource cleanup described in - * {@link #close} is performed. - * - * @deprecated The {@code finalize} method has been deprecated and will be removed. - * Subclasses that override {@code finalize} in order to perform cleanup - * should be modified to use alternative cleanup mechanisms and - * to remove the overriding {@code finalize} method. - * When overriding the {@code finalize} method, its implementation must explicitly - * ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}. - * See the specification for {@link Object#finalize()} for further - * information about migration options. - * - * @exception IOException if an I/O error occurs. - * @see java.io.FileInputStream#close() - */ - @Deprecated(since="9", forRemoval = true) - protected void finalize() throws IOException { - } - - /* - * Returns a finalizer object if the FIS needs a finalizer; otherwise null. - * If the FIS has a close method; it needs an AltFinalizer. - */ - private static Object getFinalizer(FileInputStream fis) { - Class clazz = fis.getClass(); - while (clazz != FileInputStream.class) { - try { - clazz.getDeclaredMethod("close"); - return new AltFinalizer(fis); - } catch (NoSuchMethodException nsme) { - // ignore - } - clazz = clazz.getSuperclass(); - } - return null; - } - /** - * Class to call {@code FileInputStream.close} when finalized. - * If finalization of the stream is needed, an instance is created - * in its constructor(s). When the set of instances - * related to the stream is unreachable, the AltFinalizer performs - * the needed call to the stream's {@code close} method. - */ - static class AltFinalizer { - private final FileInputStream fis; - - AltFinalizer(FileInputStream fis) { - this.fis = fis; - } - - @Override - @SuppressWarnings("deprecation") - protected final void finalize() { - try { - if ((fis.fd != null) && (fis.fd != FileDescriptor.in)) { - /* if fd is shared, the references in FileDescriptor - * will ensure that finalizer is only called when - * safe to do so. All references using the fd have - * become unreachable. We can call close() - */ - fis.close(); - } - } catch (IOException ioe) { - // ignore - } - } - } } diff --git a/src/java.base/share/classes/java/io/FileOutputStream.java b/src/java.base/share/classes/java/io/FileOutputStream.java index 569f5269b13..4c741a1bd32 100644 --- a/src/java.base/share/classes/java/io/FileOutputStream.java +++ b/src/java.base/share/classes/java/io/FileOutputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -95,8 +95,6 @@ class FileOutputStream extends OutputStream private volatile boolean closed; - private final Object altFinalizer; - /** * Creates a file output stream to write to the file with the * specified name. A new FileDescriptor object is @@ -235,10 +233,7 @@ class FileOutputStream extends OutputStream this.path = name; open(name, append); - altFinalizer = getFinalizer(this); - if (altFinalizer == null) { - FileCleanable.register(fd); // open sets the fd, register the cleanup - } + FileCleanable.register(fd); // open sets the fd, register the cleanup } /** @@ -274,7 +269,6 @@ class FileOutputStream extends OutputStream } this.fd = fdObj; this.path = null; - this.altFinalizer = null; fd.attach(this); } @@ -457,98 +451,9 @@ class FileOutputStream extends OutputStream return fc; } - /** - * Cleans up the connection to the file, and ensures that the - * {@link #close} method of this file output stream is - * called when there are no more references to this stream. - * The {@link #finalize} method does not call {@link #close} directly. - * - * @apiNote - * To release resources used by this stream {@link #close} should be called - * directly or by try-with-resources. - * - * @implSpec - * If this FileOutputStream has been subclassed and the {@link #close} - * method has been overridden, the {@link #close} method will be - * called when the FileOutputStream is unreachable. - * Otherwise, it is implementation specific how the resource cleanup described in - * {@link #close} is performed. - * - * @deprecated The {@code finalize} method has been deprecated and will be removed. - * Subclasses that override {@code finalize} in order to perform cleanup - * should be modified to use alternative cleanup mechanisms and - * to remove the overriding {@code finalize} method. - * When overriding the {@code finalize} method, its implementation must explicitly - * ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}. - * See the specification for {@link Object#finalize()} for further - * information about migration options. - * - * @exception IOException if an I/O error occurs. - * @see java.io.FileInputStream#close() - */ - @Deprecated(since="9", forRemoval = true) - protected void finalize() throws IOException { - } - private static native void initIDs(); static { initIDs(); } - - /* - * Returns a finalizer object if the FOS needs a finalizer; otherwise null. - * If the FOS has a close method; it needs an AltFinalizer. - */ - private static Object getFinalizer(FileOutputStream fos) { - Class clazz = fos.getClass(); - while (clazz != FileOutputStream.class) { - try { - clazz.getDeclaredMethod("close"); - return new AltFinalizer(fos); - } catch (NoSuchMethodException nsme) { - // ignore - } - clazz = clazz.getSuperclass(); - } - return null; - } - - /** - * Class to call {@code FileOutputStream.close} when finalized. - * If finalization of the stream is needed, an instance is created - * in its constructor(s). When the set of instances - * related to the stream is unreachable, the AltFinalizer performs - * the needed call to the stream's {@code close} method. - */ - static class AltFinalizer { - private final FileOutputStream fos; - - AltFinalizer(FileOutputStream fos) { - this.fos = fos; - } - - @Override - @SuppressWarnings("deprecation") - protected final void finalize() { - try { - if (fos.fd != null) { - if (fos.fd == FileDescriptor.out || fos.fd == FileDescriptor.err) { - // Subclass may override flush; otherwise it is no-op - fos.flush(); - } else { - /* if fd is shared, the references in FileDescriptor - * will ensure that finalizer is only called when - * safe to do so. All references using the fd have - * become unreachable. We can call close() - */ - fos.close(); - } - } - } catch (IOException ioe) { - // ignore - } - } - } - } diff --git a/test/jdk/java/io/FileInputStream/UnreferencedFISClosesFd.java b/test/jdk/java/io/FileInputStream/UnreferencedFISClosesFd.java index 28ab8ee8ae4..ac5d6c6a329 100644 --- a/test/jdk/java/io/FileInputStream/UnreferencedFISClosesFd.java +++ b/test/jdk/java/io/FileInputStream/UnreferencedFISClosesFd.java @@ -62,15 +62,11 @@ import jdk.test.lib.util.FileUtils; */ public class UnreferencedFISClosesFd { - enum CleanupType { - CLOSE, // Cleanup is handled via calling close - CLEANER} // Cleanup is handled via Cleaner - static final String FILE_NAME = "empty.txt"; /** * Subclass w/ no overrides; not finalize or close. - * Cleanup should be via the Cleaner (not close). + * Cleanup should be via the Cleaner. */ public static class StreamOverrides extends FileInputStream { @@ -88,7 +84,7 @@ public class UnreferencedFISClosesFd { /** * Subclass overrides close. - * Cleanup should be via AltFinalizer calling close(). + * Cleanup should be via the Cleaner. */ public static class StreamOverridesClose extends StreamOverrides { @@ -104,7 +100,7 @@ public class UnreferencedFISClosesFd { /** * Subclass overrides finalize. - * Cleanup should be via the Cleaner (not close). + * Cleanup should be via the Cleaner. */ public static class StreamOverridesFinalize extends StreamOverrides { @@ -113,7 +109,7 @@ public class UnreferencedFISClosesFd { } @SuppressWarnings({"deprecation","removal"}) - protected void finalize() throws IOException { + protected void finalize() throws IOException, Throwable { super.finalize(); } } @@ -129,7 +125,7 @@ public class UnreferencedFISClosesFd { } @SuppressWarnings({"deprecation","removal"}) - protected void finalize() throws IOException { + protected void finalize() throws IOException, Throwable { super.finalize(); } } @@ -149,15 +145,15 @@ public class UnreferencedFISClosesFd { long fdCount0 = getFdCount(); int failCount = 0; - failCount += test(new FileInputStream(name), CleanupType.CLEANER); + failCount += test(new FileInputStream(name)); - failCount += test(new StreamOverrides(name), CleanupType.CLEANER); + failCount += test(new StreamOverrides(name)); - failCount += test(new StreamOverridesClose(name), CleanupType.CLOSE); + failCount += test(new StreamOverridesClose(name)); - failCount += test(new StreamOverridesFinalize(name), CleanupType.CLEANER); + failCount += test(new StreamOverridesFinalize(name)); - failCount += test(new StreamOverridesFinalizeClose(name), CleanupType.CLOSE); + failCount += test(new StreamOverridesFinalizeClose(name)); if (failCount > 0) { throw new AssertionError("Failed test count: " + failCount); @@ -180,7 +176,7 @@ public class UnreferencedFISClosesFd { : -1L; } - private static int test(FileInputStream fis, CleanupType cleanType) throws Exception { + private static int test(FileInputStream fis) throws Exception { try { System.out.printf("%nTesting %s%n", fis.getClass().getName()); @@ -199,36 +195,19 @@ public class UnreferencedFISClosesFd { fdField.setAccessible(true); int ffd = fdField.getInt(fd); - Field altFinalizerField = FileInputStream.class.getDeclaredField("altFinalizer"); - altFinalizerField.setAccessible(true); - Object altFinalizer = altFinalizerField.get(fis); - if ((altFinalizer != null) ^ (cleanType == CleanupType.CLOSE)) { - throw new RuntimeException("Unexpected AltFinalizer: " + altFinalizer - + ", for " + cleanType); - } - Field cleanupField = FileDescriptor.class.getDeclaredField("cleanup"); cleanupField.setAccessible(true); Object cleanup = cleanupField.get(fd); - System.out.printf(" cleanup: %s, alt: %s, ffd: %d, cf: %s%n", - cleanup, altFinalizer, ffd, cleanupField); - if ((cleanup != null) ^ (cleanType == CleanupType.CLEANER)) { - throw new Exception("unexpected cleanup: " - + cleanup + ", for " + cleanType); - } - if (cleanup != null) { - WeakReference cleanupWeak = new WeakReference<>(cleanup, queue); - pending.add(cleanupWeak); - System.out.printf(" fdWeak: %s%n msWeak: %s%n cleanupWeak: %s%n", - fdWeak, msWeak, cleanupWeak); - } - if (altFinalizer != null) { - WeakReference altFinalizerWeak = new WeakReference<>(altFinalizer, queue); - pending.add(altFinalizerWeak); - System.out.printf(" fdWeak: %s%n msWeak: %s%n altFinalizerWeak: %s%n", - fdWeak, msWeak, altFinalizerWeak); + System.out.printf(" cleanup: %s, ffd: %d, cf: %s%n", cleanup, ffd, cleanupField); + if (cleanup == null) { + throw new RuntimeException("cleanup should not be null"); } + WeakReference cleanupWeak = new WeakReference<>(cleanup, queue); + pending.add(cleanupWeak); + System.out.printf(" fdWeak: %s%n msWeak: %s%n cleanupWeak: %s%n", + fdWeak, msWeak, cleanupWeak); + AtomicInteger closeCounter = fis instanceof StreamOverrides ? ((StreamOverrides)fis).closeCounter() : null; @@ -243,28 +222,16 @@ public class UnreferencedFISClosesFd { fis = null; fd = null; cleanup = null; - altFinalizer = null; System.gc(); // attempt to reclaim them } } Reference.reachabilityFence(fd); Reference.reachabilityFence(fis); Reference.reachabilityFence(cleanup); - Reference.reachabilityFence(altFinalizer); // Confirm the correct number of calls to close depending on the cleanup type - switch (cleanType) { - case CLEANER: - if (closeCounter != null && closeCounter.get() > 0) { - throw new RuntimeException("Close should not have been called: count: " - + closeCounter); - } - break; - case CLOSE: - if (closeCounter == null || closeCounter.get() == 0) { - throw new RuntimeException("Close should have been called: count: 0"); - } - break; + if (closeCounter != null && closeCounter.get() > 0) { + throw new RuntimeException("Close should not have been called: count: " + closeCounter); } } catch (Exception ex) { ex.printStackTrace(System.out); diff --git a/test/jdk/java/io/FileOutputStream/UnreferencedFOSClosesFd.java b/test/jdk/java/io/FileOutputStream/UnreferencedFOSClosesFd.java index c4a90c3dfb6..3ff817085bd 100644 --- a/test/jdk/java/io/FileOutputStream/UnreferencedFOSClosesFd.java +++ b/test/jdk/java/io/FileOutputStream/UnreferencedFOSClosesFd.java @@ -28,8 +28,7 @@ * @library /test/lib * @build jdk.test.lib.util.FileUtils UnreferencedFOSClosesFd * @bug 6524062 - * @summary Test to ensure that FOS.finalize() invokes the close() method as per - * the specification. + * @summary Test to ensure that the fd is closed if left unreferenced * @run main/othervm UnreferencedFOSClosesFd */ import java.io.File; @@ -54,15 +53,11 @@ import jdk.test.lib.util.FileUtils; public class UnreferencedFOSClosesFd { - enum CleanupType { - CLOSE, // Cleanup is handled via calling close - CLEANER} // Cleanup is handled via Cleaner - static final String FILE_NAME = "empty.txt"; /** - * Subclass w/ no overrides; not finalize or close. - * Cleanup should be via the Cleaner (not close). + * Subclass w/ no overrides; not close. + * Cleanup should be via the Cleaner. */ public static class StreamOverrides extends FileOutputStream { @@ -96,7 +91,7 @@ public class UnreferencedFOSClosesFd { /** * Subclass overrides finalize and close. - * Cleanup should be via the Cleaner (not close). + * Cleanup should be via the Cleaner. */ public static class StreamOverridesFinalize extends StreamOverrides { @@ -105,14 +100,14 @@ public class UnreferencedFOSClosesFd { } @SuppressWarnings({"deprecation","removal"}) - protected void finalize() throws IOException { + protected void finalize() throws IOException, Throwable { super.finalize(); } } /** * Subclass overrides finalize and close. - * Cleanup should be via AltFinalizer calling close(). + * Cleanup should be via the Cleaner. */ public static class StreamOverridesFinalizeClose extends StreamOverridesClose { @@ -121,7 +116,7 @@ public class UnreferencedFOSClosesFd { } @SuppressWarnings({"deprecation","removal"}) - protected void finalize() throws IOException { + protected void finalize() throws IOException, Throwable { super.finalize(); } } @@ -131,8 +126,6 @@ public class UnreferencedFOSClosesFd { */ public static void main(String argv[]) throws Exception { - - File inFile = new File(System.getProperty("test.dir", "."), FILE_NAME); inFile.createNewFile(); inFile.deleteOnExit(); @@ -143,15 +136,15 @@ public class UnreferencedFOSClosesFd { long fdCount0 = getFdCount(); int failCount = 0; - failCount += test(new FileOutputStream(name), CleanupType.CLEANER); + failCount += test(new FileOutputStream(name)); - failCount += test(new StreamOverrides(name), CleanupType.CLEANER); + failCount += test(new StreamOverrides(name)); - failCount += test(new StreamOverridesClose(name), CleanupType.CLOSE); + failCount += test(new StreamOverridesClose(name)); - failCount += test(new StreamOverridesFinalize(name), CleanupType.CLEANER); + failCount += test(new StreamOverridesFinalize(name)); - failCount += test(new StreamOverridesFinalizeClose(name), CleanupType.CLOSE); + failCount += test(new StreamOverridesFinalizeClose(name)); if (failCount > 0) { throw new AssertionError("Failed test count: " + failCount); @@ -174,7 +167,7 @@ public class UnreferencedFOSClosesFd { : -1L; } - private static int test(FileOutputStream fos, CleanupType cleanType) throws Exception { + private static int test(FileOutputStream fos) throws Exception { try { System.out.printf("%nTesting %s%n", fos.getClass().getName()); @@ -193,36 +186,19 @@ public class UnreferencedFOSClosesFd { fdField.setAccessible(true); int ffd = fdField.getInt(fd); - Field altFinalizerField = FileOutputStream.class.getDeclaredField("altFinalizer"); - altFinalizerField.setAccessible(true); - Object altFinalizer = altFinalizerField.get(fos); - if ((altFinalizer != null) ^ (cleanType == CleanupType.CLOSE)) { - throw new RuntimeException("Unexpected AltFinalizer: " + altFinalizer - + ", for " + cleanType); - } - Field cleanupField = FileDescriptor.class.getDeclaredField("cleanup"); cleanupField.setAccessible(true); Object cleanup = cleanupField.get(fd); - System.out.printf(" cleanup: %s, alt: %s, ffd: %d, cf: %s%n", - cleanup, altFinalizer, ffd, cleanupField); - if ((cleanup != null) ^ (cleanType == CleanupType.CLEANER)) { - throw new Exception("unexpected cleanup: " - + cleanup + ", for " + cleanType); - } - if (cleanup != null) { - WeakReference cleanupWeak = new WeakReference<>(cleanup, queue); - pending.add(cleanupWeak); - System.out.printf(" fdWeak: %s%n msWeak: %s%n cleanupWeak: %s%n", - fdWeak, msWeak, cleanupWeak); - } - if (altFinalizer != null) { - WeakReference altFinalizerWeak = new WeakReference<>(altFinalizer, queue); - pending.add(altFinalizerWeak); - System.out.printf(" fdWeak: %s%n msWeak: %s%n altFinalizerWeak: %s%n", - fdWeak, msWeak, altFinalizerWeak); + System.out.printf(" cleanup: %s, ffd: %d, cf: %s%n", cleanup, ffd, cleanupField); + if (cleanup == null) { + throw new RuntimeException("cleanup should not be null"); } + WeakReference cleanupWeak = new WeakReference<>(cleanup, queue); + pending.add(cleanupWeak); + System.out.printf(" fdWeak: %s%n msWeak: %s%n cleanupWeak: %s%n", + fdWeak, msWeak, cleanupWeak); + AtomicInteger closeCounter = fos instanceof StreamOverrides ? ((StreamOverrides) fos).closeCounter() : null; @@ -237,28 +213,16 @@ public class UnreferencedFOSClosesFd { fos = null; fd = null; cleanup = null; - altFinalizer = null; System.gc(); // attempt to reclaim them } } Reference.reachabilityFence(fd); Reference.reachabilityFence(fos); Reference.reachabilityFence(cleanup); - Reference.reachabilityFence(altFinalizer); // Confirm the correct number of calls to close depending on the cleanup type - switch (cleanType) { - case CLEANER: - if (closeCounter != null && closeCounter.get() > 0) { - throw new RuntimeException("Close should not have been called: count: " - + closeCounter); - } - break; - case CLOSE: - if (closeCounter == null || closeCounter.get() == 0) { - throw new RuntimeException("Close should have been called: count: 0"); - } - break; + if (closeCounter != null && closeCounter.get() > 0) { + throw new RuntimeException("Close should not have been called: count: " + closeCounter); } } catch (Exception ex) { ex.printStackTrace(System.out); From b6e77e428544c910ff09b92a6733c31c55304874 Mon Sep 17 00:00:00 2001 From: Aleksey Shipilev Date: Tue, 16 Oct 2018 17:43:30 +0200 Subject: [PATCH 14/66] 8212177: Epsilon alignment adjustments can overflow max TLAB size Reviewed-by: pliden, tschatzl --- src/hotspot/share/gc/epsilon/epsilonHeap.cpp | 12 ++++- .../hotspot/jtreg/gc/epsilon/TestMaxTLAB.java | 50 +++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 test/hotspot/jtreg/gc/epsilon/TestMaxTLAB.java diff --git a/src/hotspot/share/gc/epsilon/epsilonHeap.cpp b/src/hotspot/share/gc/epsilon/epsilonHeap.cpp index 42f681f3c62..3a4cbcbf377 100644 --- a/src/hotspot/share/gc/epsilon/epsilonHeap.cpp +++ b/src/hotspot/share/gc/epsilon/epsilonHeap.cpp @@ -47,7 +47,7 @@ jint EpsilonHeap::initialize() { _space->initialize(committed_region, /* clear_space = */ true, /* mangle_space = */ true); // Precompute hot fields - _max_tlab_size = MIN2(CollectedHeap::max_tlab_size(), EpsilonMaxTLABSize / HeapWordSize); + _max_tlab_size = MIN2(CollectedHeap::max_tlab_size(), align_object_size(EpsilonMaxTLABSize / HeapWordSize)); _step_counter_update = MIN2(max_byte_size / 16, EpsilonUpdateCountersStep); _step_heap_print = (EpsilonPrintHeapSteps == 0) ? SIZE_MAX : (max_byte_size / EpsilonPrintHeapSteps); _decay_time_ns = (int64_t) EpsilonTLABDecayTime * NANOSECS_PER_MILLISEC; @@ -217,6 +217,16 @@ HeapWord* EpsilonHeap::allocate_new_tlab(size_t min_size, // Always honor alignment size = align_up(size, MinObjAlignment); + // Check that adjustments did not break local and global invariants + assert(is_object_aligned(size), + "Size honors object alignment: " SIZE_FORMAT, size); + assert(min_size <= size, + "Size honors min size: " SIZE_FORMAT " <= " SIZE_FORMAT, min_size, size); + assert(size <= _max_tlab_size, + "Size honors max size: " SIZE_FORMAT " <= " SIZE_FORMAT, size, _max_tlab_size); + assert(size <= CollectedHeap::max_tlab_size(), + "Size honors global max size: " SIZE_FORMAT " <= " SIZE_FORMAT, size, CollectedHeap::max_tlab_size()); + if (log_is_enabled(Trace, gc)) { ResourceMark rm; log_trace(gc)("TLAB size for \"%s\" (Requested: " SIZE_FORMAT "K, Min: " SIZE_FORMAT diff --git a/test/hotspot/jtreg/gc/epsilon/TestMaxTLAB.java b/test/hotspot/jtreg/gc/epsilon/TestMaxTLAB.java new file mode 100644 index 00000000000..db5e8319621 --- /dev/null +++ b/test/hotspot/jtreg/gc/epsilon/TestMaxTLAB.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2018, Red Hat, Inc. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test TestMaxTLAB + * @key gc + * @requires vm.gc.Epsilon & !vm.graal.enabled + * @summary Check EpsilonMaxTLAB options + * @bug 8212177 + * + * @run main/othervm -XX:+UnlockExperimentalVMOptions -Xmx128m -XX:+UseEpsilonGC -XX:EpsilonMaxTLABSize=1 TestMaxTLAB + * @run main/othervm -XX:+UnlockExperimentalVMOptions -Xmx128m -XX:+UseEpsilonGC -XX:EpsilonMaxTLABSize=1K TestMaxTLAB + * @run main/othervm -XX:+UnlockExperimentalVMOptions -Xmx128m -XX:+UseEpsilonGC -XX:EpsilonMaxTLABSize=1M TestMaxTLAB + * @run main/othervm -XX:+UnlockExperimentalVMOptions -Xmx128m -XX:+UseEpsilonGC -XX:EpsilonMaxTLABSize=12345 TestMaxTLAB + * + * @run main/othervm -XX:+UnlockExperimentalVMOptions -Xmx128m -XX:+UseEpsilonGC -XX:EpsilonMaxTLABSize=1 -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=16 TestMaxTLAB + * @run main/othervm -XX:+UnlockExperimentalVMOptions -Xmx128m -XX:+UseEpsilonGC -XX:EpsilonMaxTLABSize=1K -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=16 TestMaxTLAB + * @run main/othervm -XX:+UnlockExperimentalVMOptions -Xmx128m -XX:+UseEpsilonGC -XX:EpsilonMaxTLABSize=1M -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=16 TestMaxTLAB + * @run main/othervm -XX:+UnlockExperimentalVMOptions -Xmx128m -XX:+UseEpsilonGC -XX:EpsilonMaxTLABSize=12345 -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=16 TestMaxTLAB + */ + +public class TestMaxTLAB { + static Object sink; + + public static void main(String[] args) throws Exception { + for (int c = 0; c < 1000; c++) { + sink = new byte[c]; + } + } +} From 180a8773fb938bb0500684cc95852590f085d287 Mon Sep 17 00:00:00 2001 From: Jamil Nimeh Date: Tue, 16 Oct 2018 11:24:41 -0700 Subject: [PATCH 15/66] 8211866: TLS 1.3 CertificateRequest message sometimes offers disallowed signature algorithms Reviewed-by: xuelei --- .../sun/security/ssl/CertSignAlgsExtension.java | 12 +++++------- .../security/ssl/SignatureAlgorithmsExtension.java | 12 +++++------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/java.base/share/classes/sun/security/ssl/CertSignAlgsExtension.java b/src/java.base/share/classes/sun/security/ssl/CertSignAlgsExtension.java index 6b87b72cc20..ba94f0695cd 100644 --- a/src/java.base/share/classes/sun/security/ssl/CertSignAlgsExtension.java +++ b/src/java.base/share/classes/sun/security/ssl/CertSignAlgsExtension.java @@ -243,18 +243,16 @@ final class CertSignAlgsExtension { } // Produce the extension. - if (shc.localSupportedSignAlgs == null) { - shc.localSupportedSignAlgs = + List sigAlgs = SignatureScheme.getSupportedAlgorithms( - shc.algorithmConstraints, shc.activeProtocols); - } + shc.algorithmConstraints, + List.of(shc.negotiatedProtocol)); - int vectorLen = SignatureScheme.sizeInRecord() * - shc.localSupportedSignAlgs.size(); + int vectorLen = SignatureScheme.sizeInRecord() * sigAlgs.size(); byte[] extData = new byte[vectorLen + 2]; ByteBuffer m = ByteBuffer.wrap(extData); Record.putInt16(m, vectorLen); - for (SignatureScheme ss : shc.localSupportedSignAlgs) { + for (SignatureScheme ss : sigAlgs) { Record.putInt16(m, ss.id); } diff --git a/src/java.base/share/classes/sun/security/ssl/SignatureAlgorithmsExtension.java b/src/java.base/share/classes/sun/security/ssl/SignatureAlgorithmsExtension.java index ed6a9bab151..6e48134b1d1 100644 --- a/src/java.base/share/classes/sun/security/ssl/SignatureAlgorithmsExtension.java +++ b/src/java.base/share/classes/sun/security/ssl/SignatureAlgorithmsExtension.java @@ -410,18 +410,16 @@ final class SignatureAlgorithmsExtension { } // Produce the extension. - if (shc.localSupportedSignAlgs == null) { - shc.localSupportedSignAlgs = + List sigAlgs = SignatureScheme.getSupportedAlgorithms( - shc.algorithmConstraints, shc.activeProtocols); - } + shc.algorithmConstraints, + List.of(shc.negotiatedProtocol)); - int vectorLen = SignatureScheme.sizeInRecord() * - shc.localSupportedSignAlgs.size(); + int vectorLen = SignatureScheme.sizeInRecord() * sigAlgs.size(); byte[] extData = new byte[vectorLen + 2]; ByteBuffer m = ByteBuffer.wrap(extData); Record.putInt16(m, vectorLen); - for (SignatureScheme ss : shc.localSupportedSignAlgs) { + for (SignatureScheme ss : sigAlgs) { Record.putInt16(m, ss.id); } From a9b4ac9c37d742885130da7792aa125653421e79 Mon Sep 17 00:00:00 2001 From: Mandy Chung Date: Tue, 16 Oct 2018 11:47:33 -0700 Subject: [PATCH 16/66] 8212197: OpenDataException thrown when constructing CompositeData for StackTraceElement Reviewed-by: alanb --- .../management/StackTraceElementCompositeData.java | 8 +++++--- .../CompatibilityTest.java | 13 ++++++++++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/java.management/share/classes/sun/management/StackTraceElementCompositeData.java b/src/java.management/share/classes/sun/management/StackTraceElementCompositeData.java index 3212c06d435..2a2b096bded 100644 --- a/src/java.management/share/classes/sun/management/StackTraceElementCompositeData.java +++ b/src/java.management/share/classes/sun/management/StackTraceElementCompositeData.java @@ -78,14 +78,16 @@ public class StackTraceElementCompositeData extends LazyCompositeData { // CONTENTS OF THIS ARRAY MUST BE SYNCHRONIZED WITH // STACK_TRACE_ELEMENT_ATTRIBUTES! final Object[] stackTraceElementItemValues = { - ste.getClassLoaderName(), - ste.getModuleName(), - ste.getModuleVersion(), + // JDK 5 attributes ste.getClassName(), ste.getMethodName(), ste.getFileName(), ste.getLineNumber(), ste.isNativeMethod(), + // JDK 9 attributes + ste.getClassLoaderName(), + ste.getModuleName(), + ste.getModuleVersion(), }; try { return new CompositeDataSupport(STACK_TRACE_ELEMENT_COMPOSITE_TYPE, diff --git a/test/jdk/sun/management/StackTraceElementCompositeData/CompatibilityTest.java b/test/jdk/sun/management/StackTraceElementCompositeData/CompatibilityTest.java index 13eeef9e673..e773fee99eb 100644 --- a/test/jdk/sun/management/StackTraceElementCompositeData/CompatibilityTest.java +++ b/test/jdk/sun/management/StackTraceElementCompositeData/CompatibilityTest.java @@ -36,7 +36,7 @@ import static org.testng.Assert.*; /* * @test - * @bug 8139587 + * @bug 8139587 8212197 * @modules java.management/sun.management * @summary Check backward compatibility of StackTraceElementCompositeData * @author Jaroslav Bachorik @@ -154,5 +154,16 @@ public class CompatibilityTest { assertEquals(ste.isNativeMethod(), false); assertEquals(ste.getLineNumber(), 123); } + + @Test + public void testCompositeData() throws Exception { + StackTraceElement ste = new StackTraceElement("app", + "m", "1.0", + "p.MyClass", "myMethod", + "MyClass.java", 123); + CompositeData cd = StackTraceElementCompositeData.toCompositeData(ste); + StackTraceElement ste1 = StackTraceElementCompositeData.from(cd); + assertEquals(ste, ste1); + } } From a40d0a0ee1d6bb5306b7b71ec05a63c4a639f6d1 Mon Sep 17 00:00:00 2001 From: Jamil Nimeh Date: Tue, 16 Oct 2018 12:05:57 -0700 Subject: [PATCH 17/66] 8210989: RSASSA-PSS certificate cannot be selected for client auth on TLSv1.2 Reviewed-by: xuelei --- .../sun/security/ssl/CertificateRequest.java | 107 ++++++++++++------ .../sun/security/ssl/HandshakeContext.java | 4 + .../sun/security/ssl/X509Authentication.java | 8 +- 3 files changed, 84 insertions(+), 35 deletions(-) diff --git a/src/java.base/share/classes/sun/security/ssl/CertificateRequest.java b/src/java.base/share/classes/sun/security/ssl/CertificateRequest.java index c385cc4dd74..14f76107ca4 100644 --- a/src/java.base/share/classes/sun/security/ssl/CertificateRequest.java +++ b/src/java.base/share/classes/sun/security/ssl/CertificateRequest.java @@ -31,7 +31,9 @@ import java.security.PrivateKey; import java.security.cert.X509Certificate; import java.text.MessageFormat; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; +import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Locale; @@ -675,45 +677,86 @@ final class CertificateRequest { chc.peerRequestedSignatureSchemes = sss; chc.peerRequestedCertSignSchemes = sss; // use the same schemes chc.handshakeSession.setPeerSupportedSignatureAlgorithms(sss); + chc.peerSupportedAuthorities = crm.getAuthorities(); - X509ExtendedKeyManager km = chc.sslContext.getX509KeyManager(); - String clientAlias = null; - if (chc.conContext.transport instanceof SSLSocketImpl) { - clientAlias = km.chooseClientAlias(crm.getKeyTypes(), - crm.getAuthorities(), (SSLSocket)chc.conContext.transport); - } else if (chc.conContext.transport instanceof SSLEngineImpl) { - clientAlias = km.chooseEngineClientAlias(crm.getKeyTypes(), - crm.getAuthorities(), (SSLEngine)chc.conContext.transport); - } - - if (clientAlias == null) { - if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { - SSLLogger.warning("No available client authentication"); - } + // For TLS 1.2, we no longer use the certificate_types field + // from the CertificateRequest message to directly determine + // the SSLPossession. Instead, the choosePossession method + // will use the accepted signature schemes in the message to + // determine the set of acceptable certificate types to select from. + SSLPossession pos = choosePossession(chc); + if (pos == null) { return; } - PrivateKey clientPrivateKey = km.getPrivateKey(clientAlias); - if (clientPrivateKey == null) { - if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { - SSLLogger.warning("No available client private key"); - } - return; - } - - X509Certificate[] clientCerts = km.getCertificateChain(clientAlias); - if ((clientCerts == null) || (clientCerts.length == 0)) { - if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { - SSLLogger.warning("No available client certificate"); - } - return; - } - - chc.handshakePossessions.add( - new X509Possession(clientPrivateKey, clientCerts)); + chc.handshakePossessions.add(pos); chc.handshakeProducers.put(SSLHandshake.CERTIFICATE_VERIFY.id, SSLHandshake.CERTIFICATE_VERIFY); } + + private static SSLPossession choosePossession(HandshakeContext hc) + throws IOException { + if (hc.peerRequestedCertSignSchemes == null || + hc.peerRequestedCertSignSchemes.isEmpty()) { + if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { + SSLLogger.warning("No signature and hash algorithms " + + "in CertificateRequest"); + } + return null; + } + + Collection checkedKeyTypes = new HashSet<>(); + for (SignatureScheme ss : hc.peerRequestedCertSignSchemes) { + if (checkedKeyTypes.contains(ss.keyAlgorithm)) { + if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { + SSLLogger.warning( + "Unsupported authentication scheme: " + ss.name); + } + continue; + } + + // Don't select a signature scheme unless we will be able to + // produce a CertificateVerify message later + if (SignatureScheme.getPreferableAlgorithm( + hc.peerRequestedSignatureSchemes, + ss, hc.negotiatedProtocol) == null) { + + if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { + SSLLogger.warning( + "Unable to produce CertificateVerify for " + + "signature scheme: " + ss.name); + } + checkedKeyTypes.add(ss.keyAlgorithm); + continue; + } + + SSLAuthentication ka = X509Authentication.valueOf(ss); + if (ka == null) { + if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { + SSLLogger.warning( + "Unsupported authentication scheme: " + ss.name); + } + checkedKeyTypes.add(ss.keyAlgorithm); + continue; + } + + SSLPossession pos = ka.createPossession(hc); + if (pos == null) { + if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { + SSLLogger.warning( + "Unavailable authentication scheme: " + ss.name); + } + continue; + } + + return pos; + } + + if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { + SSLLogger.warning("No available authentication scheme"); + } + return null; + } } /** diff --git a/src/java.base/share/classes/sun/security/ssl/HandshakeContext.java b/src/java.base/share/classes/sun/security/ssl/HandshakeContext.java index e1f8830460d..fd7b7784a5a 100644 --- a/src/java.base/share/classes/sun/security/ssl/HandshakeContext.java +++ b/src/java.base/share/classes/sun/security/ssl/HandshakeContext.java @@ -43,6 +43,7 @@ import java.util.Queue; import javax.crypto.SecretKey; import javax.net.ssl.SNIServerName; import javax.net.ssl.SSLHandshakeException; +import javax.security.auth.x500.X500Principal; import sun.security.ssl.SupportedGroupsExtension.NamedGroup; import sun.security.ssl.SupportedGroupsExtension.NamedGroupType; import static sun.security.ssl.SupportedGroupsExtension.NamedGroupType.*; @@ -136,6 +137,9 @@ abstract class HandshakeContext implements ConnectionContext { List peerRequestedSignatureSchemes; List peerRequestedCertSignSchemes; + // Known authorities + X500Principal[] peerSupportedAuthorities = null; + // SupportedGroups List clientRequestedNamedGroups; diff --git a/src/java.base/share/classes/sun/security/ssl/X509Authentication.java b/src/java.base/share/classes/sun/security/ssl/X509Authentication.java index 23702e1fbf8..e3bf2aa08b8 100644 --- a/src/java.base/share/classes/sun/security/ssl/X509Authentication.java +++ b/src/java.base/share/classes/sun/security/ssl/X509Authentication.java @@ -170,7 +170,7 @@ enum X509Authentication implements SSLAuthentication { return null; } - // Used by TLS 1.3 only. + // Used by TLS 1.2 and TLS 1.3. private SSLPossession createClientPossession( ClientHandshakeContext chc, String keyType) { X509ExtendedKeyManager km = chc.sslContext.getX509KeyManager(); @@ -178,11 +178,13 @@ enum X509Authentication implements SSLAuthentication { if (chc.conContext.transport instanceof SSLSocketImpl) { clientAlias = km.chooseClientAlias( new String[] { keyType }, - null, (SSLSocket)chc.conContext.transport); + chc.peerSupportedAuthorities, + (SSLSocket)chc.conContext.transport); } else if (chc.conContext.transport instanceof SSLEngineImpl) { clientAlias = km.chooseEngineClientAlias( new String[] { keyType }, - null, (SSLEngine)chc.conContext.transport); + chc.peerSupportedAuthorities, + (SSLEngine)chc.conContext.transport); } if (clientAlias == null) { From dfcc6b38784ee139397473673651083fa7ca8fa7 Mon Sep 17 00:00:00 2001 From: David Holmes Date: Tue, 16 Oct 2018 19:07:47 -0400 Subject: [PATCH 18/66] 8211909: JDWP Transport Listener: dt_socket thread crash Reviewed-by: dcubed, dsamersoff --- src/hotspot/share/prims/jvmtiEnv.cpp | 40 ++++++++++++---------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/src/hotspot/share/prims/jvmtiEnv.cpp b/src/hotspot/share/prims/jvmtiEnv.cpp index 73be60f1d66..3cb08a6ec9c 100644 --- a/src/hotspot/share/prims/jvmtiEnv.cpp +++ b/src/hotspot/share/prims/jvmtiEnv.cpp @@ -919,7 +919,7 @@ JvmtiEnv::GetAllThreads(jint* threads_count_ptr, jthread** threads_ptr) { thread_objs = NEW_RESOURCE_ARRAY(Handle, nthreads); NULL_CHECK(thread_objs, JVMTI_ERROR_OUT_OF_MEMORY); - for (int i=0; i < nthreads; i++) { + for (int i = 0; i < nthreads; i++) { thread_objs[i] = Handle(tle.get_threadObj(i)); } @@ -1144,16 +1144,14 @@ JvmtiEnv::GetThreadInfo(jthread thread, jvmtiThreadInfo* info_ptr) { Handle context_class_loader; bool is_daemon; - { MutexLocker mu(Threads_lock); + name = Handle(current_thread, java_lang_Thread::name(thread_obj())); + priority = java_lang_Thread::priority(thread_obj()); + thread_group = Handle(current_thread, java_lang_Thread::threadGroup(thread_obj())); + is_daemon = java_lang_Thread::is_daemon(thread_obj()); - name = Handle(current_thread, java_lang_Thread::name(thread_obj())); - priority = java_lang_Thread::priority(thread_obj()); - thread_group = Handle(current_thread, java_lang_Thread::threadGroup(thread_obj())); - is_daemon = java_lang_Thread::is_daemon(thread_obj()); + oop loader = java_lang_Thread::context_class_loader(thread_obj()); + context_class_loader = Handle(current_thread, loader); - oop loader = java_lang_Thread::context_class_loader(thread_obj()); - context_class_loader = Handle(current_thread, loader); - } { const char *n; if (name() != NULL) { @@ -1402,13 +1400,10 @@ JvmtiEnv::GetThreadGroupInfo(jthreadGroup group, jvmtiThreadGroupInfo* info_ptr) bool is_daemon; ThreadPriority max_priority; - { MutexLocker mu(Threads_lock); - - name = java_lang_ThreadGroup::name(group_obj()); - parent_group = Handle(current_thread, java_lang_ThreadGroup::parent(group_obj())); - is_daemon = java_lang_ThreadGroup::is_daemon(group_obj()); - max_priority = java_lang_ThreadGroup::maxPriority(group_obj()); - } + name = java_lang_ThreadGroup::name(group_obj()); + parent_group = Handle(current_thread, java_lang_ThreadGroup::parent(group_obj())); + is_daemon = java_lang_ThreadGroup::is_daemon(group_obj()); + max_priority = java_lang_ThreadGroup::maxPriority(group_obj()); info_ptr->is_daemon = is_daemon; info_ptr->max_priority = max_priority; @@ -1448,7 +1443,7 @@ JvmtiEnv::GetThreadGroupChildren(jthreadGroup group, jint* thread_count_ptr, jth Handle group_hdl(current_thread, group_obj); { // Cannot allow thread or group counts to change. - MutexLocker mu(Threads_lock); + ObjectLocker ol(group_hdl, current_thread); nthreads = java_lang_ThreadGroup::nthreads(group_hdl()); ngroups = java_lang_ThreadGroup::ngroups(group_hdl()); @@ -1458,7 +1453,7 @@ JvmtiEnv::GetThreadGroupChildren(jthreadGroup group, jint* thread_count_ptr, jth objArrayOop threads = java_lang_ThreadGroup::threads(group_hdl()); assert(nthreads <= threads->length(), "too many threads"); thread_objs = NEW_RESOURCE_ARRAY(Handle,nthreads); - for (int i=0, j=0; iobj_at(i); assert(thread_obj != NULL, "thread_obj is NULL"); JavaThread *java_thread = NULL; @@ -1490,15 +1485,14 @@ JvmtiEnv::GetThreadGroupChildren(jthreadGroup group, jint* thread_count_ptr, jth objArrayOop groups = java_lang_ThreadGroup::groups(group_hdl()); assert(ngroups <= groups->length(), "too many groups"); group_objs = NEW_RESOURCE_ARRAY(Handle,ngroups); - for (int i=0; iobj_at(i); assert(group_obj != NULL, "group_obj != NULL"); group_objs[i] = Handle(current_thread, group_obj); } } - } + } // ThreadGroup unlocked here - // have to make global handles outside of Threads_lock *group_count_ptr = ngroups; *thread_count_ptr = nthreads; *threads_ptr = new_jthreadArray(nthreads, thread_objs); @@ -3246,7 +3240,7 @@ JvmtiEnv::DestroyRawMonitor(JvmtiRawMonitor * rmonitor) { // objects that are locked. int r; intptr_t recursion = rmonitor->recursions(); - for (intptr_t i=0; i <= recursion; i++) { + for (intptr_t i = 0; i <= recursion; i++) { r = rmonitor->raw_exit(thread); assert(r == ObjectMonitor::OM_OK, "raw_exit should have worked"); if (r != ObjectMonitor::OM_OK) { // robustness @@ -3676,7 +3670,7 @@ JvmtiEnv::GetSystemProperties(jint* count_ptr, char*** property_ptr) { strcpy(*tmp_value, key); } else { // clean up previously allocated memory. - for (int j=0; j Date: Thu, 8 Mar 2018 14:04:39 +0800 Subject: [PATCH 19/66] 8196897: Improve PRNG support Reviewed-by: valeriep, mullan, igerasim --- src/jdk.crypto.mscapi/windows/native/libsunmscapi/security.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/jdk.crypto.mscapi/windows/native/libsunmscapi/security.cpp b/src/jdk.crypto.mscapi/windows/native/libsunmscapi/security.cpp index 35e8bbf8756..1497a554456 100644 --- a/src/jdk.crypto.mscapi/windows/native/libsunmscapi/security.cpp +++ b/src/jdk.crypto.mscapi/windows/native/libsunmscapi/security.cpp @@ -311,6 +311,9 @@ JNIEXPORT jbyteArray JNICALL Java_sun_security_mscapi_PRNG_generateSeed } result = env->NewByteArray(length); + if (result == NULL) { + __leave; + } env->SetByteArrayRegion(result, 0, length, (jbyte*) pbData); } else { // length == 0 From 02876bfcebb0ae06ad295053093ad3e9c67162b9 Mon Sep 17 00:00:00 2001 From: Xueming Shen Date: Wed, 28 Mar 2018 08:42:45 -0700 Subject: [PATCH 20/66] 8197881: Better StringBuilder support Reviewed-by: rriggs --- .../share/classes/java/lang/AbstractStringBuilder.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/java.base/share/classes/java/lang/AbstractStringBuilder.java b/src/java.base/share/classes/java/lang/AbstractStringBuilder.java index 2ef3e532567..2af6f1723f3 100644 --- a/src/java.base/share/classes/java/lang/AbstractStringBuilder.java +++ b/src/java.base/share/classes/java/lang/AbstractStringBuilder.java @@ -69,10 +69,13 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence { */ int count; + private static final byte[] EMPTYVALUE = new byte[0]; + /** * This no-arg constructor is necessary for serialization of subclasses. */ AbstractStringBuilder() { + value = EMPTYVALUE; } /** From 627e310ba58e24035d4b7323dcc3bb61fea05e0c Mon Sep 17 00:00:00 2001 From: Vyom Tewari Date: Fri, 30 Mar 2018 08:37:31 +0530 Subject: [PATCH 21/66] 8199110: Address Internet Addresses Reviewed-by: chegar, rriggs, igerasim, skoivu, rhalade --- .../share/classes/java/net/InetAddress.java | 10 +++++++--- .../classes/java/net/NetworkInterface.java | 18 +++++++++++++++--- .../unix/native/libnet/NetworkInterface.c | 11 +++++++++-- 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/java.base/share/classes/java/net/InetAddress.java b/src/java.base/share/classes/java/net/InetAddress.java index 0eee46f8054..907de3c15ee 100644 --- a/src/java.base/share/classes/java/net/InetAddress.java +++ b/src/java.base/share/classes/java/net/InetAddress.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,6 +35,7 @@ import java.io.FileNotFoundException; import java.io.ObjectStreamException; import java.io.ObjectStreamField; import java.io.IOException; +import java.io.InvalidObjectException; import java.io.ObjectInputStream; import java.io.ObjectInputStream.GetField; import java.io.ObjectOutputStream; @@ -1727,8 +1728,11 @@ class InetAddress implements java.io.Serializable { } GetField gf = s.readFields(); String host = (String)gf.get("hostName", null); - int address= gf.get("address", 0); - int family= gf.get("family", 0); + int address = gf.get("address", 0); + int family = gf.get("family", 0); + if (family != IPv4 && family != IPv6) { + throw new InvalidObjectException("invalid address family type: " + family); + } InetAddressHolder h = new InetAddressHolder(host, address, family); UNSAFE.putObject(this, FIELDS_OFFSET, h); } diff --git a/src/java.base/share/classes/java/net/NetworkInterface.java b/src/java.base/share/classes/java/net/NetworkInterface.java index 66141af44fa..b4e40d34780 100644 --- a/src/java.base/share/classes/java/net/NetworkInterface.java +++ b/src/java.base/share/classes/java/net/NetworkInterface.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -321,8 +321,20 @@ public final class NetworkInterface { if (addr == null) { throw new NullPointerException(); } - if (!(addr instanceof Inet4Address || addr instanceof Inet6Address)) { - throw new IllegalArgumentException ("invalid address type"); + if (addr instanceof Inet4Address) { + Inet4Address inet4Address = (Inet4Address) addr; + if (inet4Address.holder.family != InetAddress.IPv4) { + throw new IllegalArgumentException("invalid family type: " + + inet4Address.holder.family); + } + } else if (addr instanceof Inet6Address) { + Inet6Address inet6Address = (Inet6Address) addr; + if (inet6Address.holder.family != InetAddress.IPv6) { + throw new IllegalArgumentException("invalid family type: " + + inet6Address.holder.family); + } + } else { + throw new IllegalArgumentException("invalid address type: " + addr); } return getByInetAddress0(addr); } diff --git a/src/java.base/unix/native/libnet/NetworkInterface.c b/src/java.base/unix/native/libnet/NetworkInterface.c index 9ec82393d96..de15109fbf0 100644 --- a/src/java.base/unix/native/libnet/NetworkInterface.c +++ b/src/java.base/unix/native/libnet/NetworkInterface.c @@ -331,9 +331,16 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByInetAddress0 netif *ifs, *curr; jobject obj = NULL; jboolean match = JNI_FALSE; - int family = (getInetAddress_family(env, iaObj) == java_net_InetAddress_IPv4) ? - AF_INET : AF_INET6; + int family = getInetAddress_family(env, iaObj); JNU_CHECK_EXCEPTION_RETURN(env, NULL); + + if (family == java_net_InetAddress_IPv4) { + family = AF_INET; + } else if (family == java_net_InetAddress_IPv6) { + family = AF_INET6; + } else { + return NULL; // Invalid family + } ifs = enumInterfaces(env); if (ifs == NULL) { return NULL; From cd8e70a35c4285bb6f7d6e0cd9ef33d48dcae9ef Mon Sep 17 00:00:00 2001 From: Xueming Shen Date: Wed, 4 Apr 2018 13:55:30 -0700 Subject: [PATCH 22/66] 8199172: Improve jar attribute checks Reviewed-by: psandoz, alanb --- .../share/classes/java/util/jar/JarFile.java | 30 +++++-------------- .../jar/JarFile/mrjar/MultiReleaseJarAPI.java | 24 +++++++++++---- .../util/jar/CreateMultiReleaseTestJars.java | 10 +++++-- 3 files changed, 34 insertions(+), 30 deletions(-) diff --git a/src/java.base/share/classes/java/util/jar/JarFile.java b/src/java.base/share/classes/java/util/jar/JarFile.java index 0acfc189abf..165a63674d5 100644 --- a/src/java.base/share/classes/java/util/jar/JarFile.java +++ b/src/java.base/share/classes/java/util/jar/JarFile.java @@ -1011,29 +1011,13 @@ class JarFile extends ZipFile { int i = match(MULTIRELEASE_CHARS, b, MULTIRELEASE_LASTOCC, MULTIRELEASE_OPTOSFT); if (i != -1) { - i += MULTIRELEASE_CHARS.length; - if (i < b.length) { - byte c = b[i++]; - // Check that the value is followed by a newline - // and does not have a continuation - if (c == '\n' && - (i == b.length || b[i] != ' ')) { - isMultiRelease = true; - } else if (c == '\r') { - if (i == b.length) { - isMultiRelease = true; - } else { - c = b[i++]; - if (c == '\n') { - if (i == b.length || b[i] != ' ') { - isMultiRelease = true; - } - } else if (c != ' ') { - isMultiRelease = true; - } - } - } - } + // Read the main attributes of the manifest + byte[] lbuf = new byte[512]; + Attributes attr = new Attributes(); + attr.read(new Manifest.FastInputStream( + new ByteArrayInputStream(b)), lbuf); + isMultiRelease = Boolean.parseBoolean( + attr.getValue(Attributes.Name.MULTI_RELEASE)); } } } diff --git a/test/jdk/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java b/test/jdk/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java index 3299f674adb..46ba359e8b2 100644 --- a/test/jdk/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java +++ b/test/jdk/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. * 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,7 @@ /* * @test - * @bug 8132734 8144062 8165723 + * @bug 8132734 8144062 8165723 8199172 * @summary Test the extended API and the aliasing additions in JarFile that * support multi-release jar files * @library /lib/testlibrary/java/util/jar /test/lib @@ -100,16 +100,30 @@ public class MultiReleaseJarAPI { testCustomMultiReleaseValue("true", true); testCustomMultiReleaseValue("true\r\nOther: value", true); testCustomMultiReleaseValue("true\nOther: value", true); - testCustomMultiReleaseValue("true\rOther: value", true); + // JDK-8200530: '\r' support in Manifest/Attributes will be addressed separately + // testCustomMultiReleaseValue("true\rOther: value", true); testCustomMultiReleaseValue("false", false); testCustomMultiReleaseValue(" true", false); testCustomMultiReleaseValue("true ", false); - testCustomMultiReleaseValue("true\n ", false); - testCustomMultiReleaseValue("true\r ", false); testCustomMultiReleaseValue("true\n true", false); + + // JDK-8200530: '\r' support in Manifest/Attributes will be addressed separately + testCustomMultiReleaseValue("true\r true", false); testCustomMultiReleaseValue("true\r\n true", false); + // "Multi-Release: true/false" not in main attributes + testCustomMultiReleaseValue("\r\n\r\nName: test\r\nMulti-Release: true\r\n", + false); + testCustomMultiReleaseValue("\n\nName: entryname\nMulti-Release: true\n", + false); + testCustomMultiReleaseValue("EndOfMainAttr: whatever\r\n" + + "\r\nName: entryname\r\nMulti-Release: true\r\n", + false); + testCustomMultiReleaseValue("EndOfMainAttr: whatever\r\n" + + "\nName: entryname\nMulti-Release: true\n", + false); + // generate "random" Strings to use as extra attributes, and // verify that Multi-Release: true is always properly matched for (int i = 0; i < 100; i++) { diff --git a/test/jdk/lib/testlibrary/java/util/jar/CreateMultiReleaseTestJars.java b/test/jdk/lib/testlibrary/java/util/jar/CreateMultiReleaseTestJars.java index e989baeddbb..57317e7edcd 100644 --- a/test/jdk/lib/testlibrary/java/util/jar/CreateMultiReleaseTestJars.java +++ b/test/jdk/lib/testlibrary/java/util/jar/CreateMultiReleaseTestJars.java @@ -142,6 +142,12 @@ public class CreateMultiReleaseTestJars { } public void buildSignedMultiReleaseJar() throws Exception { + buildSignedMultiReleaseJar("multi-release.jar", "signed-multi-release.jar"); + } + + public void buildSignedMultiReleaseJar(String multiReleaseJar, + String signedMultiReleaseJar) throws Exception + { String testsrc = System.getProperty("test.src","."); String testdir = findTestDir(testsrc); String keystore = testdir + "/sun/security/tools/jarsigner/JarSigning.keystore"; @@ -155,8 +161,8 @@ public class CreateMultiReleaseTestJars { CertPath cp = CertificateFactory.getInstance("X.509") .generateCertPath(Arrays.asList(ks.getCertificateChain("b"))); JarSigner js = new JarSigner.Builder(pkb, cp).build(); - try (ZipFile in = new ZipFile("multi-release.jar"); - FileOutputStream os = new FileOutputStream("signed-multi-release.jar")) + try (ZipFile in = new ZipFile(multiReleaseJar); + FileOutputStream os = new FileOutputStream(signedMultiReleaseJar)) { js.sign(in, os); } From a58b68027bc6a2c44bbf60f07f43f6d884f83245 Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Tue, 17 Apr 2018 15:55:49 +0800 Subject: [PATCH 23/66] 8194534: Manifest better support Reviewed-by: mchung, igerasim --- .../classes/java/net/URLClassLoader.java | 10 +++-- .../share/classes/java/util/jar/JarFile.java | 2 +- .../classes/java/util/jar/JarVerifier.java | 22 +++++++++- .../java/util/jar/JavaUtilJarAccessImpl.java | 7 +++- .../share/classes/java/util/jar/Manifest.java | 40 ++++++++++++++++--- .../internal/loader/BuiltinClassLoader.java | 15 ++++--- .../jdk/internal/misc/JavaUtilJarAccess.java | 5 ++- test/lib/jdk/test/lib/util/JarUtils.java | 22 ++++++++++ 8 files changed, 105 insertions(+), 18 deletions(-) diff --git a/src/java.base/share/classes/java/net/URLClassLoader.java b/src/java.base/share/classes/java/net/URLClassLoader.java index 6d9ebf40ad9..daf941d63e9 100644 --- a/src/java.base/share/classes/java/net/URLClassLoader.java +++ b/src/java.base/share/classes/java/net/URLClassLoader.java @@ -535,13 +535,13 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { * @spec JPMS */ protected Package definePackage(String name, Manifest man, URL url) { - String path = name.replace('.', '/').concat("/"); String specTitle = null, specVersion = null, specVendor = null; String implTitle = null, implVersion = null, implVendor = null; String sealed = null; URL sealBase = null; - Attributes attr = man.getAttributes(path); + Attributes attr = SharedSecrets.javaUtilJarAccess() + .getTrustedAttributes(man, name.replace('.', '/').concat("/")); if (attr != null) { specTitle = attr.getValue(Name.SPECIFICATION_TITLE); specVersion = attr.getValue(Name.SPECIFICATION_VERSION); @@ -585,10 +585,12 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { /* * Returns true if the specified package name is sealed according to the * given manifest. + * + * @throws SecurityException if the package name is untrusted in the manifest */ private boolean isSealed(String name, Manifest man) { - String path = name.replace('.', '/').concat("/"); - Attributes attr = man.getAttributes(path); + Attributes attr = SharedSecrets.javaUtilJarAccess() + .getTrustedAttributes(man, name.replace('.', '/').concat("/")); String sealed = null; if (attr != null) { sealed = attr.getValue(Name.SEALED); diff --git a/src/java.base/share/classes/java/util/jar/JarFile.java b/src/java.base/share/classes/java/util/jar/JarFile.java index 165a63674d5..856e78ccee4 100644 --- a/src/java.base/share/classes/java/util/jar/JarFile.java +++ b/src/java.base/share/classes/java/util/jar/JarFile.java @@ -417,10 +417,10 @@ class JarFile extends ZipFile { if (manEntry != null) { if (verify) { byte[] b = getBytes(manEntry); - man = new Manifest(new ByteArrayInputStream(b), getName()); if (!jvInitialized) { jv = new JarVerifier(b); } + man = new Manifest(jv, new ByteArrayInputStream(b), getName()); } else { man = new Manifest(super.getInputStream(manEntry), getName()); } diff --git a/src/java.base/share/classes/java/util/jar/JarVerifier.java b/src/java.base/share/classes/java/util/jar/JarVerifier.java index 3681f5bec29..bda21d8e2d9 100644 --- a/src/java.base/share/classes/java/util/jar/JarVerifier.java +++ b/src/java.base/share/classes/java/util/jar/JarVerifier.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -866,4 +866,24 @@ class JarVerifier { static CodeSource getUnsignedCS(URL url) { return new VerifierCodeSource(null, url, (java.security.cert.Certificate[]) null); } + + /** + * Returns whether the name is trusted. Used by + * {@link Manifest#getTrustedAttributes(String)}. + */ + boolean isTrustedManifestEntry(String name) { + // How many signers? MANIFEST.MF is always verified + CodeSigner[] forMan = verifiedSigners.get(JarFile.MANIFEST_NAME); + if (forMan == null) { + return true; + } + // Check sigFileSigners first, because we are mainly dealing with + // non-file entries which will stay in sigFileSigners forever. + CodeSigner[] forName = sigFileSigners.get(name); + if (forName == null) { + forName = verifiedSigners.get(name); + } + // Returns trusted if all signers sign the entry + return forName != null && forName.length == forMan.length; + } } diff --git a/src/java.base/share/classes/java/util/jar/JavaUtilJarAccessImpl.java b/src/java.base/share/classes/java/util/jar/JavaUtilJarAccessImpl.java index 0844b9171d1..f1097d4153f 100644 --- a/src/java.base/share/classes/java/util/jar/JavaUtilJarAccessImpl.java +++ b/src/java.base/share/classes/java/util/jar/JavaUtilJarAccessImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -60,4 +60,9 @@ class JavaUtilJarAccessImpl implements JavaUtilJarAccess { public List getManifestDigests(JarFile jar) { return jar.getManifestDigests(); } + + public Attributes getTrustedAttributes(Manifest man, String name) { + return man.getTrustedAttributes(name); + } + } diff --git a/src/java.base/share/classes/java/util/jar/Manifest.java b/src/java.base/share/classes/java/util/jar/Manifest.java index 384da5c622f..90d8ecea044 100644 --- a/src/java.base/share/classes/java/util/jar/Manifest.java +++ b/src/java.base/share/classes/java/util/jar/Manifest.java @@ -50,10 +50,13 @@ import sun.security.util.SecurityProperties; public class Manifest implements Cloneable { // manifest main attributes - private Attributes attr = new Attributes(); + private final Attributes attr = new Attributes(); // manifest entries - private Map entries = new HashMap<>(); + private final Map entries = new HashMap<>(); + + // associated JarVerifier, not null when called by JarFile::getManifest. + private final JarVerifier jv; // name of the corresponding jar archive if available. private final String jarFilename; @@ -63,6 +66,7 @@ public class Manifest implements Cloneable { */ public Manifest() { jarFilename = null; + jv = null; } /** @@ -72,8 +76,7 @@ public class Manifest implements Cloneable { * @throws IOException if an I/O error has occurred */ public Manifest(InputStream is) throws IOException { - this(); - read(is); + this(null, is, null); } /** @@ -84,8 +87,17 @@ public class Manifest implements Cloneable { * @throws IOException if an I/O error has occured */ Manifest(InputStream is, String jarFilename) throws IOException { + this(null, is, jarFilename); + } + + /** + * Constructs a new Manifest from the specified input stream + * and associates it with a JarVerifier. + */ + Manifest(JarVerifier jv, InputStream is, String jarFilename) throws IOException { read(is); this.jarFilename = jarFilename; + this.jv = jv; } /** @@ -94,9 +106,10 @@ public class Manifest implements Cloneable { * @param man the Manifest to copy */ public Manifest(Manifest man) { - this(); attr.putAll(man.getMainAttributes()); entries.putAll(man.getEntries()); + jarFilename = null; + jv = man.jv; } /** @@ -146,6 +159,23 @@ public class Manifest implements Cloneable { return getEntries().get(name); } + /** + * Returns the Attributes for the specified entry name, if trusted. + * + * @param name entry name + * @return returns the same result as {@link #getAttributes(String)} + * @throws SecurityException if the associated jar is signed but this entry + * has been modified after signing (i.e. the section in the manifest + * does not exist in SF files of all signers). + */ + Attributes getTrustedAttributes(String name) { + Attributes result = getAttributes(name); + if (result != null && jv != null && ! jv.isTrustedManifestEntry(name)) { + throw new SecurityException("Untrusted manifest entry: " + name); + } + return result; + } + /** * Clears the main Attributes as well as the entries in this Manifest. */ diff --git a/src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java b/src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java index bb62cf8291f..5421e14975d 100644 --- a/src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java +++ b/src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -60,6 +60,7 @@ import java.util.jar.Attributes; import java.util.jar.Manifest; import java.util.stream.Stream; +import jdk.internal.misc.SharedSecrets; import jdk.internal.misc.VM; import jdk.internal.module.ModulePatcher.PatchedModuleReader; import jdk.internal.module.Resources; @@ -862,7 +863,8 @@ public class BuiltinClassLoader * Manifest are used to get the package version and sealing information. * * @throws IllegalArgumentException if the package name duplicates an - * existing package either in this class loader or one of its ancestors + * existing package either in this class loader or one of its ancestors + * @throws SecurityException if the package name is untrusted in the manifest */ private Package definePackage(String pn, Manifest man, URL url) { String specTitle = null; @@ -875,7 +877,8 @@ public class BuiltinClassLoader URL sealBase = null; if (man != null) { - Attributes attr = man.getAttributes(pn.replace('.', '/').concat("/")); + Attributes attr = SharedSecrets.javaUtilJarAccess() + .getTrustedAttributes(man, pn.replace('.', '/').concat("/")); if (attr != null) { specTitle = attr.getValue(Attributes.Name.SPECIFICATION_TITLE); specVersion = attr.getValue(Attributes.Name.SPECIFICATION_VERSION); @@ -921,10 +924,12 @@ public class BuiltinClassLoader /** * Returns {@code true} if the specified package name is sealed according to * the given manifest. + * + * @throws SecurityException if the package name is untrusted in the manifest */ private boolean isSealed(String pn, Manifest man) { - String path = pn.replace('.', '/').concat("/"); - Attributes attr = man.getAttributes(path); + Attributes attr = SharedSecrets.javaUtilJarAccess() + .getTrustedAttributes(man, pn.replace('.', '/').concat("/")); String sealed = null; if (attr != null) sealed = attr.getValue(Attributes.Name.SEALED); diff --git a/src/java.base/share/classes/jdk/internal/misc/JavaUtilJarAccess.java b/src/java.base/share/classes/jdk/internal/misc/JavaUtilJarAccess.java index bf59351dee6..c6d1e015e50 100644 --- a/src/java.base/share/classes/jdk/internal/misc/JavaUtilJarAccess.java +++ b/src/java.base/share/classes/jdk/internal/misc/JavaUtilJarAccess.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,8 +30,10 @@ import java.net.URL; import java.security.CodeSource; import java.util.Enumeration; import java.util.List; +import java.util.jar.Attributes; import java.util.jar.JarEntry; import java.util.jar.JarFile; +import java.util.jar.Manifest; public interface JavaUtilJarAccess { public boolean jarFileHasClassPathAttribute(JarFile jar) throws IOException; @@ -41,4 +43,5 @@ public interface JavaUtilJarAccess { public Enumeration entries2(JarFile jar); public void setEagerValidation(JarFile jar, boolean eager); public List getManifestDigests(JarFile jar); + public Attributes getTrustedAttributes(Manifest man, String name); } diff --git a/test/lib/jdk/test/lib/util/JarUtils.java b/test/lib/jdk/test/lib/util/JarUtils.java index 6e89b2090fc..9fe4dbbedbc 100644 --- a/test/lib/jdk/test/lib/util/JarUtils.java +++ b/test/lib/jdk/test/lib/util/JarUtils.java @@ -23,6 +23,7 @@ package jdk.test.lib.util; +import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; @@ -271,6 +272,11 @@ public final class JarUtils { changes = new HashMap<>(changes); System.out.printf("Creating %s from %s...\n", dest, src); + + if (dest.equals(src)) { + throw new IOException("src and dest cannot be the same"); + } + try (JarOutputStream jos = new JarOutputStream( new FileOutputStream(dest))) { @@ -298,6 +304,22 @@ public final class JarUtils { System.out.println(); } + /** + * Update the Manifest inside a jar. + * + * @param src the original jar file name + * @param dest the new jar file name + * @param man the Manifest + * + * @throws IOException + */ + public static void updateManifest(String src, String dest, Manifest man) + throws IOException { + ByteArrayOutputStream bout = new ByteArrayOutputStream(); + man.write(bout); + updateJar(src, dest, Map.of(JarFile.MANIFEST_NAME, bout.toByteArray())); + } + private static void updateEntry(JarOutputStream jos, String name, Object content) throws IOException { if (content instanceof Boolean) { From d45e830907a04e07670303e22e97be976e057f58 Mon Sep 17 00:00:00 2001 From: Adam Petcher Date: Mon, 23 Apr 2018 12:01:46 -0400 Subject: [PATCH 24/66] 8201756: Improve cipher inputs Clarify spec of CipherInputStream in Javadoc comments Reviewed-by: ascarpino --- .../share/classes/javax/crypto/CipherInputStream.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/java.base/share/classes/javax/crypto/CipherInputStream.java b/src/java.base/share/classes/javax/crypto/CipherInputStream.java index 60d6f1a1859..c304252bdb0 100644 --- a/src/java.base/share/classes/javax/crypto/CipherInputStream.java +++ b/src/java.base/share/classes/javax/crypto/CipherInputStream.java @@ -50,6 +50,13 @@ import javax.crypto.IllegalBlockSizeException; * that are not thrown by its ancestor classes. In particular, the * skip method skips, and the available * method counts only data that have been processed by the encapsulated Cipher. + * This class may catch BadPaddingException and other exceptions thrown by + * failed integrity checks during decryption. These exceptions are not + * re-thrown, so the client may not be informed that integrity checks + * failed. Because of this behavior, this class may not be suitable + * for use with decryption in an authenticated mode of operation (e.g. GCM). + * Applications that require authenticated encryption can use the Cipher API + * directly as an alternative to using this class. * *

It is crucial for a programmer using this class not to use * methods that are not defined or overridden in this class (such as a From 41c52b261c3baadec0325495513257d42cb3628b Mon Sep 17 00:00:00 2001 From: Phil Race Date: Mon, 23 Apr 2018 16:15:26 -0700 Subject: [PATCH 25/66] 8200648: Make midi code more sound Reviewed-by: serb, mschoene, rhalade --- .../native/libjsound/PLATFORM_API_WinOS_MidiIn.cpp | 4 +++- .../native/libjsound/PLATFORM_API_WinOS_MidiOut.c | 10 +++++++--- .../native/libjsound/PLATFORM_API_WinOS_Ports.c | 6 +++--- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiIn.cpp b/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiIn.cpp index bb99c98ca3f..3db6ce2e53a 100644 --- a/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiIn.cpp +++ b/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiIn.cpp @@ -252,7 +252,7 @@ INT32 MIDI_IN_GetNumDevices() { } INT32 getMidiInCaps(INT32 deviceID, MIDIINCAPSW* caps, INT32* err) { - (*err) = midiInGetDevCapsW(deviceID, caps, sizeof(MIDIINCAPS)); + (*err) = midiInGetDevCapsW(deviceID, caps, sizeof(MIDIINCAPSW)); return ((*err) == MMSYSERR_NOERROR); } @@ -260,6 +260,7 @@ INT32 MIDI_IN_GetDeviceName(INT32 deviceID, char *name, UINT32 nameLength) { MIDIINCAPSW midiInCaps; INT32 err; + memset(&midiInCaps, 0, sizeof(midiInCaps)); if (getMidiInCaps(deviceID, &midiInCaps, &err)) { UnicodeToUTF8AndCopy(name, midiInCaps.szPname, nameLength); return MIDI_SUCCESS; @@ -284,6 +285,7 @@ INT32 MIDI_IN_GetDeviceVersion(INT32 deviceID, char *name, UINT32 nameLength) { MIDIINCAPSW midiInCaps; INT32 err = MIDI_NOT_SUPPORTED; + memset(&midiInCaps, 0, sizeof(midiInCaps)); if (getMidiInCaps(deviceID, &midiInCaps, &err) && (nameLength>7)) { sprintf(name, "%d.%d", (midiInCaps.vDriverVersion & 0xFF00) >> 8, midiInCaps.vDriverVersion & 0xFF); return MIDI_SUCCESS; diff --git a/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiOut.c b/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiOut.c index 80799d03c38..1eee22b594c 100644 --- a/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiOut.c +++ b/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiOut.c @@ -70,12 +70,13 @@ INT32 MIDI_OUT_GetNumDevices() { INT32 getMidiOutCaps(INT32 deviceID, MIDIOUTCAPSW* caps, INT32* err) { + UINT_PTR id; if (deviceID == 0) { - deviceID = MIDI_MAPPER; + id = MIDI_MAPPER; } else { - deviceID--; + id = (UINT_PTR)(deviceID-1); } - (*err) = (INT32) midiOutGetDevCapsW(deviceID, caps, sizeof(MIDIOUTCAPS)); + (*err) = (INT32) midiOutGetDevCapsW(id, caps, sizeof(MIDIOUTCAPSW)); return ((*err) == MMSYSERR_NOERROR); } @@ -84,6 +85,7 @@ INT32 MIDI_OUT_GetDeviceName(INT32 deviceID, char *name, UINT32 nameLength) { MIDIOUTCAPSW midiOutCaps; INT32 err; + memset(&midiOutCaps, 0, sizeof(midiOutCaps)); if (getMidiOutCaps(deviceID, &midiOutCaps, &err)) { UnicodeToUTF8AndCopy(name, midiOutCaps.szPname, nameLength); return MIDI_SUCCESS; @@ -103,6 +105,7 @@ INT32 MIDI_OUT_GetDeviceDescription(INT32 deviceID, char *name, UINT32 nameLengt char *desc; INT32 err; + memset(&midiOutCaps, 0, sizeof(midiOutCaps)); if (getMidiOutCaps(deviceID, &midiOutCaps, &err)) { int tech = (int)midiOutCaps.wTechnology; switch(tech) { @@ -139,6 +142,7 @@ INT32 MIDI_OUT_GetDeviceVersion(INT32 deviceID, char *name, UINT32 nameLength) { MIDIOUTCAPSW midiOutCaps; INT32 err; + memset(&midiOutCaps, 0, sizeof(midiOutCaps)); if (getMidiOutCaps(deviceID, &midiOutCaps, &err) && nameLength>7) { sprintf(name, "%d.%d", (midiOutCaps.vDriverVersion & 0xFF00) >> 8, midiOutCaps.vDriverVersion & 0xFF); return MIDI_SUCCESS; diff --git a/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_Ports.c b/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_Ports.c index 5276d890388..c0c26b28f71 100644 --- a/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_Ports.c +++ b/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_Ports.c @@ -357,7 +357,7 @@ int lineHasControls(HMIXER handle, MIXERLINE* line, MIXERLINECONTROLS* controls) INT32 PORT_GetPortMixerDescription(INT32 mixerIndex, PortMixerDescription* description) { MIXERCAPSW mixerCaps; - if (mixerGetDevCapsW(mixerIndex, &mixerCaps, sizeof(MIXERCAPS)) == MMSYSERR_NOERROR) { + if (mixerGetDevCapsW(mixerIndex, &mixerCaps, sizeof(MIXERCAPSW)) == MMSYSERR_NOERROR) { UnicodeToUTF8AndCopy(description->name, mixerCaps.szPname, PORT_STRING_LENGTH); sprintf(description->version, "%d.%d", (mixerCaps.vDriverVersion & 0xFF00) >> 8, mixerCaps.vDriverVersion & 0xFF); strncpy(description->description, "Port Mixer", PORT_STRING_LENGTH-1); @@ -368,9 +368,9 @@ INT32 PORT_GetPortMixerDescription(INT32 mixerIndex, PortMixerDescription* descr int getDestinationCount(HMIXER handle) { int ret = 0; - MIXERCAPS mixerCaps; + MIXERCAPSW mixerCaps; - if (mixerGetDevCaps((UINT_PTR) handle, &mixerCaps, sizeof(MIXERCAPS)) == MMSYSERR_NOERROR) { + if (mixerGetDevCapsW((UINT_PTR) handle, &mixerCaps, sizeof(MIXERCAPSW)) == MMSYSERR_NOERROR) { ret = mixerCaps.cDestinations; } return ret; From 6c0cc8929b85698843c07f79e9df492ade034330 Mon Sep 17 00:00:00 2001 From: Harold Seigel Date: Mon, 14 May 2018 09:05:20 -0400 Subject: [PATCH 26/66] 8199226: Improve field accesses Reviewed-by: acorn, ahgross, rhalade --- .../share/interpreter/linkResolver.cpp | 100 +++++++++--------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/src/hotspot/share/interpreter/linkResolver.cpp b/src/hotspot/share/interpreter/linkResolver.cpp index e48479ba80a..1ec525959d9 100644 --- a/src/hotspot/share/interpreter/linkResolver.cpp +++ b/src/hotspot/share/interpreter/linkResolver.cpp @@ -974,68 +974,68 @@ void LinkResolver::resolve_field(fieldDescriptor& fd, THROW_MSG(vmSymbols::java_lang_NoSuchFieldError(), field->as_C_string()); } - if (!link_info.check_access()) - // Access checking may be turned off when calling from within the VM. - return; - - // check access + // Access checking may be turned off when calling from within the VM. Klass* current_klass = link_info.current_klass(); - check_field_accessability(current_klass, resolved_klass, sel_klass, fd, CHECK); + if (link_info.check_access()) { - // check for errors - if (is_static != fd.is_static()) { - ResourceMark rm(THREAD); - char msg[200]; - jio_snprintf(msg, sizeof(msg), "Expected %s field %s.%s", is_static ? "static" : "non-static", resolved_klass->external_name(), fd.name()->as_C_string()); - THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), msg); - } + // check access + check_field_accessability(current_klass, resolved_klass, sel_klass, fd, CHECK); - // A final field can be modified only - // (1) by methods declared in the class declaring the field and - // (2) by the method (in case of a static field) - // or by the method (in case of an instance field). - if (is_put && fd.access_flags().is_final()) { - ResourceMark rm(THREAD); - stringStream ss; - - if (sel_klass != current_klass) { - ss.print("Update to %s final field %s.%s attempted from a different class (%s) than the field's declaring class", - is_static ? "static" : "non-static", resolved_klass->external_name(), fd.name()->as_C_string(), - current_klass->external_name()); - THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), ss.as_string()); + // check for errors + if (is_static != fd.is_static()) { + ResourceMark rm(THREAD); + char msg[200]; + jio_snprintf(msg, sizeof(msg), "Expected %s field %s.%s", is_static ? "static" : "non-static", resolved_klass->external_name(), fd.name()->as_C_string()); + THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), msg); } - if (fd.constants()->pool_holder()->major_version() >= 53) { - methodHandle m = link_info.current_method(); - assert(!m.is_null(), "information about the current method must be available for 'put' bytecodes"); - bool is_initialized_static_final_update = (byte == Bytecodes::_putstatic && - fd.is_static() && - !m()->is_static_initializer()); - bool is_initialized_instance_final_update = ((byte == Bytecodes::_putfield || byte == Bytecodes::_nofast_putfield) && - !fd.is_static() && - !m->is_object_initializer()); + // A final field can be modified only + // (1) by methods declared in the class declaring the field and + // (2) by the method (in case of a static field) + // or by the method (in case of an instance field). + if (is_put && fd.access_flags().is_final()) { + ResourceMark rm(THREAD); + stringStream ss; - if (is_initialized_static_final_update || is_initialized_instance_final_update) { - ss.print("Update to %s final field %s.%s attempted from a different method (%s) than the initializer method %s ", + if (sel_klass != current_klass) { + ss.print("Update to %s final field %s.%s attempted from a different class (%s) than the field's declaring class", is_static ? "static" : "non-static", resolved_klass->external_name(), fd.name()->as_C_string(), - m()->name()->as_C_string(), - is_static ? "" : ""); + current_klass->external_name()); THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), ss.as_string()); } + + if (fd.constants()->pool_holder()->major_version() >= 53) { + methodHandle m = link_info.current_method(); + assert(!m.is_null(), "information about the current method must be available for 'put' bytecodes"); + bool is_initialized_static_final_update = (byte == Bytecodes::_putstatic && + fd.is_static() && + !m()->is_static_initializer()); + bool is_initialized_instance_final_update = ((byte == Bytecodes::_putfield || byte == Bytecodes::_nofast_putfield) && + !fd.is_static() && + !m->is_object_initializer()); + + if (is_initialized_static_final_update || is_initialized_instance_final_update) { + ss.print("Update to %s final field %s.%s attempted from a different method (%s) than the initializer method %s ", + is_static ? "static" : "non-static", resolved_klass->external_name(), fd.name()->as_C_string(), + m()->name()->as_C_string(), + is_static ? "" : ""); + THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), ss.as_string()); + } + } + } + + // initialize resolved_klass if necessary + // note 1: the klass which declared the field must be initialized (i.e, sel_klass) + // according to the newest JVM spec (5.5, p.170) - was bug (gri 7/28/99) + // + // note 2: we don't want to force initialization if we are just checking + // if the field access is legal; e.g., during compilation + if (is_static && initialize_class) { + sel_klass->initialize(CHECK); } } - // initialize resolved_klass if necessary - // note 1: the klass which declared the field must be initialized (i.e, sel_klass) - // according to the newest JVM spec (5.5, p.170) - was bug (gri 7/28/99) - // - // note 2: we don't want to force initialization if we are just checking - // if the field access is legal; e.g., during compilation - if (is_static && initialize_class) { - sel_klass->initialize(CHECK); - } - - if (sel_klass != current_klass) { + if ((sel_klass != current_klass) && (current_klass != NULL)) { check_field_loader_constraints(field, sig, current_klass, sel_klass, CHECK); } From b2ca521a028c9d42c768060e05af0228b803f5c0 Mon Sep 17 00:00:00 2001 From: Athijegannathan Sundararajan Date: Fri, 18 May 2018 13:34:42 +0530 Subject: [PATCH 27/66] 8202936: Improve script engine support Reviewed-by: jlaskey, ahgross, rhalade --- .../jdk/nashorn/internal/objects/Global.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java index 384fab70026..75558cb9000 100644 --- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java +++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1601,13 +1601,14 @@ public final class Global extends Scope { } } - switch (nameStr) { - case "context": + if ("context".equals(nameStr)) { return sctxt; - case "engine": - return global.engine; - default: - break; + } else if ("engine".equals(nameStr)) { + // expose "engine" variable only when there is no security manager + // or when no class filter is set. + if (System.getSecurityManager() == null || global.getClassFilter() == null) { + return global.engine; + } } if (self == UNDEFINED) { From a6eacc52e06fbffd27e9d2cbeb43874f7c0a48b3 Mon Sep 17 00:00:00 2001 From: Brent Christian Date: Tue, 29 May 2018 10:27:45 -0700 Subject: [PATCH 28/66] 8195874: Improve jar specification adherence Also reviewed by Chris Ries Reviewed-by: alanb, mchung, rriggs --- .../jdk/internal/loader/URLClassPath.java | 55 ++++++++++++++++++- 1 file changed, 52 insertions(+), 3 deletions(-) diff --git a/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java b/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java index 65462f3990b..cbd3d0680d0 100644 --- a/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java +++ b/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,6 +34,7 @@ import java.io.InputStream; import java.net.HttpURLConnection; import java.net.JarURLConnection; import java.net.MalformedURLException; +import java.net.URI; import java.net.URL; import java.net.URLConnection; import java.net.URLStreamHandler; @@ -88,6 +89,8 @@ public class URLClassPath { private static final boolean DEBUG; private static final boolean DISABLE_JAR_CHECKING; private static final boolean DISABLE_ACC_CHECKING; + private static final boolean DISABLE_CP_URL_CHECK; + private static final boolean DEBUG_CP_URL_CHECK; static { Properties props = GetPropertyAction.privilegedGetProperties(); @@ -98,6 +101,12 @@ public class URLClassPath { p = props.getProperty("jdk.net.URLClassPath.disableRestrictedPermissions"); DISABLE_ACC_CHECKING = p != null ? p.equals("true") || p.equals("") : false; + + // This property will be removed in a later release + p = props.getProperty("jdk.net.URLClassPath.disableClassPathURLCheck"); + + DISABLE_CP_URL_CHECK = p != null ? p.equals("true") || p.isEmpty() : false; + DEBUG_CP_URL_CHECK = "debug".equals(p); } /* The original search path of URLs. */ @@ -1081,11 +1090,51 @@ public class URLClassPath { int i = 0; while (st.hasMoreTokens()) { String path = st.nextToken(); - urls[i] = new URL(base, path); - i++; + URL url = DISABLE_CP_URL_CHECK ? new URL(base, path) : safeResolve(base, path); + if (url != null) { + urls[i] = url; + i++; + } + } + if (i == 0) { + urls = null; + } else if (i != urls.length) { + // Truncate nulls from end of array + urls = Arrays.copyOf(urls, i); } return urls; } + + /* + * Return a URL for the given path resolved against the base URL, or + * null if the resulting URL is invalid. + */ + static URL safeResolve(URL base, String path) { + String child = path.replace(File.separatorChar, '/'); + try { + if (!URI.create(child).isAbsolute()) { + URL url = new URL(base, child); + if (base.getProtocol().equalsIgnoreCase("file")) { + return url; + } else { + String bp = base.getPath(); + String urlp = url.getPath(); + int pos = bp.lastIndexOf('/'); + if (pos == -1) { + pos = bp.length() - 1; + } + if (urlp.regionMatches(0, bp, 0, pos + 1) + && urlp.indexOf("..", pos) == -1) { + return url; + } + } + } + } catch (MalformedURLException | IllegalArgumentException e) {} + if (DEBUG_CP_URL_CHECK) { + System.err.println("Class-Path entry: \"" + path + "\" ignored in JAR file " + base); + } + return null; + } } /* From 309ace52859d889f8c0f27adeb161c646d9b4a51 Mon Sep 17 00:00:00 2001 From: Vyom Tewari Date: Fri, 8 Jun 2018 15:56:23 +0530 Subject: [PATCH 29/66] 8199177: Enhance JNDI lookups Reviewed-by: michaelm, robm, skoivu, rhalade, chegar, rriggs, ahgross --- .../sun/naming/internal/VersionHelper.java | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/src/java.naming/share/classes/com/sun/naming/internal/VersionHelper.java b/src/java.naming/share/classes/com/sun/naming/internal/VersionHelper.java index 43dbc075138..d71f6fa0ff2 100644 --- a/src/java.naming/share/classes/com/sun/naming/internal/VersionHelper.java +++ b/src/java.naming/share/classes/com/sun/naming/internal/VersionHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -53,6 +53,20 @@ import java.util.*; public final class VersionHelper { private static final VersionHelper helper = new VersionHelper(); + /** + * Determines whether classes may be loaded from an arbitrary URL code base. + */ + private static final boolean TRUST_URL_CODE_BASE; + + static { + // System property to control whether classes may be loaded from an + // arbitrary URL code base + PrivilegedAction act + = () -> System.getProperty("com.sun.jndi.ldap.object.trustURLCodebase", "false"); + String trust = AccessController.doPrivileged(act); + TRUST_URL_CODE_BASE = "true".equalsIgnoreCase(trust); + } + final static String[] PROPS = new String[]{ javax.naming.Context.INITIAL_CONTEXT_FACTORY, javax.naming.Context.OBJECT_FACTORIES, @@ -88,12 +102,14 @@ public final class VersionHelper { */ public Class loadClass(String className, String codebase) throws ClassNotFoundException, MalformedURLException { - - ClassLoader parent = getContextClassLoader(); - ClassLoader cl = - URLClassLoader.newInstance(getUrlArray(codebase), parent); - - return loadClass(className, cl); + if (TRUST_URL_CODE_BASE) { + ClassLoader parent = getContextClassLoader(); + ClassLoader cl + = URLClassLoader.newInstance(getUrlArray(codebase), parent); + return loadClass(className, cl); + } else { + return null; + } } /** From e8fc5de2ab8da0f77e6e427c37ff09de2e7be027 Mon Sep 17 00:00:00 2001 From: Joe Wang Date: Fri, 15 Jun 2018 14:19:51 -0700 Subject: [PATCH 30/66] 8204497: Better formatting of decimals Reviewed-by: rriggs, lancea, dfuchs, mschoene --- .../internal/jaxp/datatype/XMLGregorianCalendarImpl.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/datatype/XMLGregorianCalendarImpl.java b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/datatype/XMLGregorianCalendarImpl.java index 7a9df09b486..68e44a142b6 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/datatype/XMLGregorianCalendarImpl.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/datatype/XMLGregorianCalendarImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -190,6 +190,7 @@ import jdk.xml.internal.SecuritySupport; * @author Sunitha Reddy * @see javax.xml.datatype.Duration * @since 1.5 + * @LastModified: June 2018 */ public class XMLGregorianCalendarImpl @@ -2755,7 +2756,7 @@ public class XMLGregorianCalendarImpl if ((fractional.compareTo(DECIMAL_ZERO) < 0) || (fractional.compareTo(DECIMAL_ONE) > 0)) { throw new IllegalArgumentException(DatatypeMessageFormatter.formatMessage(null, - "InvalidFractional", new Object[]{fractional})); + "InvalidFractional", new Object[]{fractional.toString()})); } } this.fractionalSecond = fractional; From d686431d7860277201d7b7a8d3e572afa9fdf4d6 Mon Sep 17 00:00:00 2001 From: Ivan Gerasimov Date: Wed, 20 Jun 2018 18:02:22 -0700 Subject: [PATCH 31/66] 8204667: Resources not freed on exception Reviewed-by: skoivu, chegar --- .../unix/native/libnet/NetworkInterface.c | 5 ++- .../windows/native/libnet/NetworkInterface.c | 12 +++++- .../native/libnet/NetworkInterface_winXP.c | 42 ++++++++++++------- 3 files changed, 42 insertions(+), 17 deletions(-) diff --git a/src/java.base/unix/native/libnet/NetworkInterface.c b/src/java.base/unix/native/libnet/NetworkInterface.c index de15109fbf0..c619d363fd1 100644 --- a/src/java.base/unix/native/libnet/NetworkInterface.c +++ b/src/java.base/unix/native/libnet/NetworkInterface.c @@ -358,7 +358,9 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByInetAddress0 int address1 = htonl( ((struct sockaddr_in *)addrP->addr)->sin_addr.s_addr); int address2 = getInetAddress_addr(env, iaObj); - JNU_CHECK_EXCEPTION_RETURN(env, NULL); + if ((*env)->ExceptionCheck(env)) { + goto cleanup; + } if (address1 == address2) { match = JNI_TRUE; break; @@ -404,6 +406,7 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByInetAddress0 obj = createNetworkInterface(env, curr); } +cleanup: // release the interface list freeif(ifs); diff --git a/src/java.base/windows/native/libnet/NetworkInterface.c b/src/java.base/windows/native/libnet/NetworkInterface.c index 2d1d6170f45..fff0dcc0cfa 100644 --- a/src/java.base/windows/native/libnet/NetworkInterface.c +++ b/src/java.base/windows/native/libnet/NetworkInterface.c @@ -280,6 +280,7 @@ int enumInterfaces(JNIEnv *env, netif **netifPP) if (curr->name == NULL || curr->displayName == NULL) { if (curr->name) free(curr->name); if (curr->displayName) free(curr->displayName); + free(curr); curr = NULL; } } @@ -586,7 +587,10 @@ jobject createNetworkInterface /* default ctor will set family to AF_INET */ setInetAddress_addr(env, iaObj, ntohl(addrs->addr.sa4.sin_addr.s_addr)); - JNU_CHECK_EXCEPTION_RETURN(env, NULL); + if ((*env)->ExceptionCheck(env)) { + free_netaddr(netaddrP); + return NULL; + } if (addrs->mask != -1) { ibObj = (*env)->NewObject(env, ni_ibcls, ni_ibctrID); if (ibObj == NULL) { @@ -600,7 +604,10 @@ jobject createNetworkInterface return NULL; } setInetAddress_addr(env, ia2Obj, ntohl(addrs->brdcast.sa4.sin_addr.s_addr)); - JNU_CHECK_EXCEPTION_RETURN(env, NULL); + if ((*env)->ExceptionCheck(env)) { + free_netaddr(netaddrP); + return NULL; + } (*env)->SetObjectField(env, ibObj, ni_ibbroadcastID, ia2Obj); (*env)->SetShortField(env, ibObj, ni_ibmaskID, addrs->mask); (*env)->SetObjectArrayElement(env, bindsArr, bind_index++, ibObj); @@ -611,6 +618,7 @@ jobject createNetworkInterface if (iaObj) { jboolean ret = setInet6Address_ipaddress(env, iaObj, (jbyte *)&(addrs->addr.sa6.sin6_addr.s6_addr)); if (ret == JNI_FALSE) { + free_netaddr(netaddrP); return NULL; } diff --git a/src/java.base/windows/native/libnet/NetworkInterface_winXP.c b/src/java.base/windows/native/libnet/NetworkInterface_winXP.c index 92fb11e7faa..15a3c9539f7 100644 --- a/src/java.base/windows/native/libnet/NetworkInterface_winXP.c +++ b/src/java.base/windows/native/libnet/NetworkInterface_winXP.c @@ -521,8 +521,9 @@ static jobject createNetworkInterfaceXP(JNIEnv *env, netif *ifs) jobjectArray addrArr, bindsArr, childArr; netaddr *addrs; jint addr_index; - int netaddrCount=ifs->naddrs; - netaddr *netaddrP=ifs->addrs; + int netaddrCount = ifs->naddrs; + netaddr *netaddrP = ifs->addrs; + netaddr *netaddrPToFree = NULL; jint bind_index; /* @@ -553,21 +554,23 @@ static jobject createNetworkInterfaceXP(JNIEnv *env, netif *ifs) * Note that 0 is a valid number of addresses. */ if (netaddrCount < 0) { - netaddrCount = enumAddresses_win(env, ifs, &netaddrP); + netaddrCount = enumAddresses_win(env, ifs, &netaddrPToFree); if (netaddrCount == -1) { return NULL; } + netaddrP = netaddrPToFree; } addrArr = (*env)->NewObjectArray(env, netaddrCount, ia_class, NULL); if (addrArr == NULL) { + free_netaddr(netaddrPToFree); return NULL; } bindsArr = (*env)->NewObjectArray(env, netaddrCount, ni_ibcls, NULL); if (bindsArr == NULL) { - free_netaddr(netaddrP); - return NULL; + free_netaddr(netaddrPToFree); + return NULL; } addrs = netaddrP; @@ -579,25 +582,32 @@ static jobject createNetworkInterfaceXP(JNIEnv *env, netif *ifs) if (addrs->addr.sa.sa_family == AF_INET) { iaObj = (*env)->NewObject(env, ia4_class, ia4_ctrID); if (iaObj == NULL) { + free_netaddr(netaddrPToFree); return NULL; } /* default ctor will set family to AF_INET */ setInetAddress_addr(env, iaObj, ntohl(addrs->addr.sa4.sin_addr.s_addr)); - JNU_CHECK_EXCEPTION_RETURN(env, NULL); + if ((*env)->ExceptionCheck(env)) { + free_netaddr(netaddrPToFree); + return NULL; + } ibObj = (*env)->NewObject(env, ni_ibcls, ni_ibctrID); if (ibObj == NULL) { - free_netaddr(netaddrP); - return NULL; + free_netaddr(netaddrPToFree); + return NULL; } (*env)->SetObjectField(env, ibObj, ni_ibaddressID, iaObj); ia2Obj = (*env)->NewObject(env, ia4_class, ia4_ctrID); if (ia2Obj == NULL) { - free_netaddr(netaddrP); - return NULL; + free_netaddr(netaddrPToFree); + return NULL; } setInetAddress_addr(env, ia2Obj, ntohl(addrs->brdcast.sa4.sin_addr.s_addr)); - JNU_CHECK_EXCEPTION_RETURN(env, NULL); + if ((*env)->ExceptionCheck(env)) { + free_netaddr(netaddrPToFree); + return NULL; + } (*env)->SetObjectField(env, ibObj, ni_ibbroadcastID, ia2Obj); (*env)->SetShortField(env, ibObj, ni_ibmaskID, addrs->mask); (*env)->SetObjectArrayElement(env, bindsArr, bind_index++, ibObj); @@ -606,10 +616,12 @@ static jobject createNetworkInterfaceXP(JNIEnv *env, netif *ifs) jboolean ret; iaObj = (*env)->NewObject(env, ia6_class, ia6_ctrID); if (iaObj == NULL) { + free_netaddr(netaddrPToFree); return NULL; } ret = setInet6Address_ipaddress(env, iaObj, (jbyte *)&(addrs->addr.sa6.sin6_addr.s6_addr)); if (ret == JNI_FALSE) { + free_netaddr(netaddrPToFree); return NULL; } scope = addrs->addr.sa6.sin6_scope_id; @@ -619,8 +631,8 @@ static jobject createNetworkInterfaceXP(JNIEnv *env, netif *ifs) } ibObj = (*env)->NewObject(env, ni_ibcls, ni_ibctrID); if (ibObj == NULL) { - free_netaddr(netaddrP); - return NULL; + free_netaddr(netaddrPToFree); + return NULL; } (*env)->SetObjectField(env, ibObj, ni_ibaddressID, iaObj); (*env)->SetShortField(env, ibObj, ni_ibmaskID, addrs->mask); @@ -633,6 +645,8 @@ static jobject createNetworkInterfaceXP(JNIEnv *env, netif *ifs) (*env)->SetObjectField(env, netifObj, ni_addrsID, addrArr); (*env)->SetObjectField(env, netifObj, ni_bindsID, bindsArr); + free_netaddr(netaddrPToFree); + /* * Windows doesn't have virtual interfaces, so child array * is always empty. @@ -672,7 +686,7 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByName0_XP } /* if found create a NetworkInterface */ - if (curr != NULL) {; + if (curr != NULL) { netifObj = createNetworkInterfaceXP(env, curr); } From c8f1daa9eb5e7054e4e0a7fd8008f40fb5c97536 Mon Sep 17 00:00:00 2001 From: Krishna Addepalli Date: Fri, 29 Jun 2018 10:28:05 +0530 Subject: [PATCH 32/66] 8194546: Choosier FileManagers Reviewed-by: serb, prr, rhalade, skoivu --- .../sun/awt/shell/Win32ShellFolder2.java | 4 +++- .../awt/shell/Win32ShellFolderManager2.java | 21 +++++++++++++------ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java b/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java index aef3ccfbcfd..64817438eba 100644 --- a/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java +++ b/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java @@ -736,7 +736,7 @@ final class Win32ShellFolder2 extends ShellFolder { } try { - return invoke(new Callable() { + File[] files = invoke(new Callable() { public File[] call() throws InterruptedException { if (!isDirectory()) { return null; @@ -791,6 +791,8 @@ final class Win32ShellFolder2 extends ShellFolder { : list.toArray(new ShellFolder[list.size()]); } }, InterruptedException.class); + + return Win32ShellFolderManager2.checkFiles(files); } catch (InterruptedException e) { return new File[0]; } diff --git a/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java b/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java index 2e10fb6784d..5e30f36d7df 100644 --- a/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java +++ b/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -387,21 +387,30 @@ final class Win32ShellFolderManager2 extends ShellFolderManager { return null; } - private File checkFile(File file) { + private static File checkFile(File file) { SecurityManager sm = System.getSecurityManager(); return (sm == null || file == null) ? file : checkFile(file, sm); } - private File checkFile(File file, SecurityManager sm) { + private static File checkFile(File file, SecurityManager sm) { try { sm.checkRead(file.getPath()); + + if (file instanceof Win32ShellFolder2) { + Win32ShellFolder2 f = (Win32ShellFolder2)file; + if (f.isLink()) { + Win32ShellFolder2 link = (Win32ShellFolder2)f.getLinkLocation(); + if (link != null) + sm.checkRead(link.getPath()); + } + } return file; } catch (SecurityException se) { return null; } } - private File[] checkFiles(File[] files) { + static File[] checkFiles(File[] files) { SecurityManager sm = System.getSecurityManager(); if (sm == null || files == null || files.length == 0) { return files; @@ -409,7 +418,7 @@ final class Win32ShellFolderManager2 extends ShellFolderManager { return checkFiles(Arrays.stream(files), sm); } - private File[] checkFiles(List files) { + private static File[] checkFiles(List files) { SecurityManager sm = System.getSecurityManager(); if (sm == null || files.isEmpty()) { return files.toArray(new File[files.size()]); @@ -417,7 +426,7 @@ final class Win32ShellFolderManager2 extends ShellFolderManager { return checkFiles(files.stream(), sm); } - private File[] checkFiles(Stream filesStream, SecurityManager sm) { + private static File[] checkFiles(Stream filesStream, SecurityManager sm) { return filesStream.filter((file) -> checkFile(file, sm) != null) .toArray(File[]::new); } From c29276cc0d81b6349bfaf848bf2e6c0f08f0fa7a Mon Sep 17 00:00:00 2001 From: Chris Hegarty Date: Tue, 10 Jul 2018 08:20:13 +0100 Subject: [PATCH 33/66] 8196902: Better HTTP Redirection Reviewed-by: dfuchs --- .../www/protocol/http/HttpURLConnection.java | 53 ++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java b/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java index 7fb8321b5d2..23d3ae0e2ec 100644 --- a/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java +++ b/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -2725,6 +2725,8 @@ public class HttpURLConnection extends java.net.HttpURLConnection { // doesn't know about proxy. useProxyResponseCode = true; } else { + final URL prevURL = url; + // maintain previous headers, just change the name // of the file we're getting url = locUrl; @@ -2753,6 +2755,14 @@ public class HttpURLConnection extends java.net.HttpURLConnection { poster = null; if (!checkReuseConnection()) connect(); + + if (!sameDestination(prevURL, url)) { + // Ensures pre-redirect user-set cookie will not be reset. + // CookieHandler, if any, will be queried to determine + // cookies for redirected URL, if any. + userCookies = null; + userCookies2 = null; + } } else { if (!checkReuseConnection()) connect(); @@ -2775,11 +2785,52 @@ public class HttpURLConnection extends java.net.HttpURLConnection { } requests.set("Host", host); } + + if (!sameDestination(prevURL, url)) { + // Redirecting to a different destination will drop any + // security-sensitive headers, regardless of whether + // they are user-set or not. CookieHandler, if any, will be + // queried to determine cookies for redirected URL, if any. + userCookies = null; + userCookies2 = null; + requests.remove("Cookie"); + requests.remove("Cookie2"); + requests.remove("Authorization"); + + // check for preemptive authorization + AuthenticationInfo sauth = + AuthenticationInfo.getServerAuth(url, getAuthenticatorKey()); + if (sauth != null && sauth.supportsPreemptiveAuthorization() ) { + // Sets "Authorization" + requests.setIfNotSet(sauth.getHeaderName(), sauth.getHeaderValue(url,method)); + currentServerCredentials = sauth; + } + } } } return true; } + /* Returns true iff the given URLs have the same host and effective port. */ + private static boolean sameDestination(URL firstURL, URL secondURL) { + assert firstURL.getProtocol().equalsIgnoreCase(secondURL.getProtocol()): + "protocols not equal: " + firstURL + " - " + secondURL; + + if (!firstURL.getHost().equalsIgnoreCase(secondURL.getHost())) + return false; + + int firstPort = firstURL.getPort(); + if (firstPort == -1) + firstPort = firstURL.getDefaultPort(); + int secondPort = secondURL.getPort(); + if (secondPort == -1) + secondPort = secondURL.getDefaultPort(); + if (firstPort != secondPort) + return false; + + return true; + } + /* dummy byte buffer for reading off socket prior to closing */ byte[] cdata = new byte [128]; From 1c4396ebaea22d0f49de1fdd5e2419f42026b337 Mon Sep 17 00:00:00 2001 From: Adam Petcher Date: Mon, 30 Jul 2018 13:53:30 -0400 Subject: [PATCH 34/66] 8208209: Improve TLS connection stability again Reviewed-by: xuelei --- .../classes/sun/security/ssl/ClientHello.java | 35 +++++++++++++++++++ .../security/ssl/PreSharedKeyExtension.java | 22 ++++++++++-- .../sun/security/ssl/SSLSessionImpl.java | 10 ++++++ 3 files changed, 65 insertions(+), 2 deletions(-) diff --git a/src/java.base/share/classes/sun/security/ssl/ClientHello.java b/src/java.base/share/classes/sun/security/ssl/ClientHello.java index fdd39eb1f55..ba4456207b2 100644 --- a/src/java.base/share/classes/sun/security/ssl/ClientHello.java +++ b/src/java.base/share/classes/sun/security/ssl/ClientHello.java @@ -35,6 +35,7 @@ import java.util.Collections; import java.util.LinkedList; import java.util.List; import java.util.Locale; +import java.util.Objects; import javax.net.ssl.SSLException; import javax.net.ssl.SSLHandshakeException; import javax.net.ssl.SSLPeerUnverifiedException; @@ -510,6 +511,23 @@ final class ClientHello { } } + // ensure that the endpoint identification algorithm matches the + // one in the session + String identityAlg = chc.sslConfig.identificationProtocol; + if (session != null && identityAlg != null) { + String sessionIdentityAlg = + session.getIdentificationProtocol(); + if (!Objects.equals(identityAlg, sessionIdentityAlg)) { + if (SSLLogger.isOn && + SSLLogger.isOn("ssl,handshake,verbose")) { + SSLLogger.finest("Can't resume, endpoint id" + + " algorithm does not match, requested: " + + identityAlg + ", cached: " + sessionIdentityAlg); + } + session = null; + } + } + if (session != null) { if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake,verbose")) { SSLLogger.finest("Try resuming session", session); @@ -1011,6 +1029,23 @@ final class ClientHello { } } + // ensure that the endpoint identification algorithm matches the + // one in the session + String identityAlg = shc.sslConfig.identificationProtocol; + if (resumingSession && identityAlg != null) { + String sessionIdentityAlg = + previous.getIdentificationProtocol(); + if (!Objects.equals(identityAlg, sessionIdentityAlg)) { + if (SSLLogger.isOn && + SSLLogger.isOn("ssl,handshake,verbose")) { + SSLLogger.finest("Can't resume, endpoint id" + + " algorithm does not match, requested: " + + identityAlg + ", cached: " + sessionIdentityAlg); + } + resumingSession = false; + } + } + // So far so good. Note that the handshake extensions may reset // the resuming options later. shc.isResumption = resumingSession; diff --git a/src/java.base/share/classes/sun/security/ssl/PreSharedKeyExtension.java b/src/java.base/share/classes/sun/security/ssl/PreSharedKeyExtension.java index 400a64e89b5..510c68e317b 100644 --- a/src/java.base/share/classes/sun/security/ssl/PreSharedKeyExtension.java +++ b/src/java.base/share/classes/sun/security/ssl/PreSharedKeyExtension.java @@ -32,6 +32,7 @@ import java.util.List; import java.util.ArrayList; import java.util.Locale; import java.util.Arrays; +import java.util.Objects; import java.util.Optional; import java.util.Collection; import javax.crypto.Mac; @@ -170,7 +171,7 @@ final class PreSharedKeyExtension { int getIdsEncodedLength() { int idEncodedLength = 0; - for (PskIdentity curId : identities) { + for(PskIdentity curId : identities) { idEncodedLength += curId.getEncodedLength(); } @@ -193,7 +194,7 @@ final class PreSharedKeyExtension { byte[] buffer = new byte[encodedLength]; ByteBuffer m = ByteBuffer.wrap(buffer); Record.putInt16(m, idsEncodedLength); - for (PskIdentity curId : identities) { + for(PskIdentity curId : identities) { curId.writeEncoded(m); } Record.putInt16(m, bindersEncodedLength); @@ -443,6 +444,23 @@ final class PreSharedKeyExtension { } } + // ensure that the endpoint identification algorithm matches the + // one in the session + String identityAlg = shc.sslConfig.identificationProtocol; + if (result && identityAlg != null) { + String sessionIdentityAlg = s.getIdentificationProtocol(); + if (!Objects.equals(identityAlg, sessionIdentityAlg)) { + if (SSLLogger.isOn && + SSLLogger.isOn("ssl,handshake,verbose")) { + + SSLLogger.finest("Can't resume, endpoint id" + + " algorithm does not match, requested: " + + identityAlg + ", cached: " + sessionIdentityAlg); + } + result = false; + } + } + // Ensure cipher suite can be negotiated if (result && (!shc.isNegotiable(s.getSuite()) || !clientHello.cipherSuites.contains(s.getSuite()))) { diff --git a/src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java b/src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java index a49a78be157..7de0a3eeccc 100644 --- a/src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java +++ b/src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java @@ -132,6 +132,10 @@ final class SSLSessionImpl extends ExtendedSSLSession { // Counter used to create unique nonces in NewSessionTicket private BigInteger ticketNonceCounter = BigInteger.ONE; + // The endpoint identification algorithm used to check certificates + // in this session. + private final String identificationProtocol; + /* * Create a new non-rejoinable session, using the default (null) * cipher spec. This constructor returns a session which could @@ -149,6 +153,7 @@ final class SSLSessionImpl extends ExtendedSSLSession { this.requestedServerNames = Collections.emptyList(); this.useExtendedMasterSecret = false; this.creationTime = System.currentTimeMillis(); + this.identificationProtocol = null; } /* @@ -198,6 +203,7 @@ final class SSLSessionImpl extends ExtendedSSLSession { (!hc.negotiatedProtocol.useTLS13PlusSpec()); } this.creationTime = creationTime; + this.identificationProtocol = hc.sslConfig.identificationProtocol; if (SSLLogger.isOn && SSLLogger.isOn("session")) { SSLLogger.finest("Session initialized: " + this); @@ -259,6 +265,10 @@ final class SSLSessionImpl extends ExtendedSSLSession { return ticketAgeAdd; } + String getIdentificationProtocol() { + return this.identificationProtocol; + } + /* * Get the PSK identity. Take care not to use it in multiple connections. */ From 61d19ee8926ad59fdd506911e8f5f848dd2d3bed Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Wed, 8 Aug 2018 08:05:43 +0800 Subject: [PATCH 35/66] 8208754: The fix for JDK-8194534 needs updates Reviewed-by: alanb, igerasim, rhalade, mullan --- src/java.base/share/classes/java/util/jar/JarFile.java | 2 +- .../share/classes/java/util/jar/JavaUtilJarAccessImpl.java | 3 +++ src/java.base/share/classes/java/util/jar/Manifest.java | 4 ++++ .../share/classes/jdk/internal/loader/URLClassPath.java | 6 ++++-- .../share/classes/jdk/internal/misc/JavaUtilJarAccess.java | 1 + 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/java.base/share/classes/java/util/jar/JarFile.java b/src/java.base/share/classes/java/util/jar/JarFile.java index 856e78ccee4..0342233af7e 100644 --- a/src/java.base/share/classes/java/util/jar/JarFile.java +++ b/src/java.base/share/classes/java/util/jar/JarFile.java @@ -1025,7 +1025,7 @@ class JarFile extends ZipFile { } } - private synchronized void ensureInitialization() { + synchronized void ensureInitialization() { try { maybeInstantiateVerifier(); } catch (IOException e) { diff --git a/src/java.base/share/classes/java/util/jar/JavaUtilJarAccessImpl.java b/src/java.base/share/classes/java/util/jar/JavaUtilJarAccessImpl.java index f1097d4153f..c13aedb016a 100644 --- a/src/java.base/share/classes/java/util/jar/JavaUtilJarAccessImpl.java +++ b/src/java.base/share/classes/java/util/jar/JavaUtilJarAccessImpl.java @@ -65,4 +65,7 @@ class JavaUtilJarAccessImpl implements JavaUtilJarAccess { return man.getTrustedAttributes(name); } + public void ensureInitialization(JarFile jar) { + jar.ensureInitialization(); + } } diff --git a/src/java.base/share/classes/java/util/jar/Manifest.java b/src/java.base/share/classes/java/util/jar/Manifest.java index 90d8ecea044..0362ad13165 100644 --- a/src/java.base/share/classes/java/util/jar/Manifest.java +++ b/src/java.base/share/classes/java/util/jar/Manifest.java @@ -169,6 +169,10 @@ public class Manifest implements Cloneable { * does not exist in SF files of all signers). */ Attributes getTrustedAttributes(String name) { + // Note: Before the verification of MANIFEST.MF/.SF/.RSA files is done, + // jv.isTrustedManifestEntry() isn't able to detect MANIFEST.MF change. + // Users of this method should call SharedSecrets.javaUtilJarAccess() + // .ensureInitialization() first. Attributes result = getAttributes(name); if (result != null && jv != null && ! jv.isTrustedManifestEntry(name)) { throw new SecurityException("Untrusted manifest entry: " + name); diff --git a/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java b/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java index cbd3d0680d0..f6ac8eda1c1 100644 --- a/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java +++ b/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java @@ -866,8 +866,10 @@ public class URLClassPath { { return jar.getInputStream(entry); } public int getContentLength() { return (int)entry.getSize(); } - public Manifest getManifest() throws IOException - { return jar.getManifest(); }; + public Manifest getManifest() throws IOException { + SharedSecrets.javaUtilJarAccess().ensureInitialization(jar); + return jar.getManifest(); + } public Certificate[] getCertificates() { return entry.getCertificates(); }; public CodeSigner[] getCodeSigners() diff --git a/src/java.base/share/classes/jdk/internal/misc/JavaUtilJarAccess.java b/src/java.base/share/classes/jdk/internal/misc/JavaUtilJarAccess.java index c6d1e015e50..984c952111c 100644 --- a/src/java.base/share/classes/jdk/internal/misc/JavaUtilJarAccess.java +++ b/src/java.base/share/classes/jdk/internal/misc/JavaUtilJarAccess.java @@ -44,4 +44,5 @@ public interface JavaUtilJarAccess { public void setEagerValidation(JarFile jar, boolean eager); public List getManifestDigests(JarFile jar); public Attributes getTrustedAttributes(Manifest man, String name); + public void ensureInitialization(JarFile jar); } From 6a9241a6a6782b67c09ff59d7867c6dba9d6694f Mon Sep 17 00:00:00 2001 From: Brent Christian Date: Fri, 5 Oct 2018 15:12:37 -0700 Subject: [PATCH 36/66] 8211731: Reconsider default option for ClassPathURLCheck change done in JDK-8195874 Reviewed-by: alanb, mchung --- .../share/classes/jdk/internal/loader/URLClassPath.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java b/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java index f6ac8eda1c1..4bda10c668c 100644 --- a/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java +++ b/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java @@ -103,7 +103,7 @@ public class URLClassPath { DISABLE_ACC_CHECKING = p != null ? p.equals("true") || p.equals("") : false; // This property will be removed in a later release - p = props.getProperty("jdk.net.URLClassPath.disableClassPathURLCheck"); + p = props.getProperty("jdk.net.URLClassPath.disableClassPathURLCheck", "true"); DISABLE_CP_URL_CHECK = p != null ? p.equals("true") || p.isEmpty() : false; DEBUG_CP_URL_CHECK = "debug".equals(p); From 05f0d11553277f907d179124da54a594b2b6119b Mon Sep 17 00:00:00 2001 From: Ying Zhou Date: Wed, 17 Oct 2018 16:37:41 +0800 Subject: [PATCH 37/66] 8210403: Refactor java.util.Locale:i18n shell tests to plain java tests Reviewed-by: naoto --- test/jdk/java/util/Locale/LocaleCategory.java | 43 +- test/jdk/java/util/Locale/LocaleCategory.sh | 104 ----- test/jdk/java/util/Locale/LocaleProviders.sh | 370 ------------------ .../java/util/Locale/LocaleProvidersRun.java | 170 ++++++++ .../java.util.spi.TimeZoneNameProvider | 2 + .../util/Locale/providersrc/spi/src/tznp.java | 39 ++ .../providersrc/spi/src/tznp8013086.java | 43 ++ 7 files changed, 286 insertions(+), 485 deletions(-) delete mode 100644 test/jdk/java/util/Locale/LocaleCategory.sh delete mode 100644 test/jdk/java/util/Locale/LocaleProviders.sh create mode 100644 test/jdk/java/util/Locale/LocaleProvidersRun.java create mode 100644 test/jdk/java/util/Locale/providersrc/spi/dest/META-INF/services/java.util.spi.TimeZoneNameProvider create mode 100644 test/jdk/java/util/Locale/providersrc/spi/src/tznp.java create mode 100644 test/jdk/java/util/Locale/providersrc/spi/src/tznp8013086.java diff --git a/test/jdk/java/util/Locale/LocaleCategory.java b/test/jdk/java/util/Locale/LocaleCategory.java index f9392f4a132..ed63203916a 100644 --- a/test/jdk/java/util/Locale/LocaleCategory.java +++ b/test/jdk/java/util/Locale/LocaleCategory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -20,13 +20,29 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + +/* + * @test + * @bug 4700857 6997928 7079486 + * @summary tests for Locale.getDefault(Locale.Category) and + * Locale.setDefault(Locale.Category, Locale) + * @library /java/text/testlib + * @build TestUtils LocaleCategory + * @comment test user.xxx.display user.xxx.format properties + * @run main/othervm -Duser.language.display=ja + * -Duser.language.format=zh LocaleCategory + * @comment test user.xxx properties overriding user.xxx.display/format + * @run main/othervm -Duser.language=en + * -Duser.language.display=ja + * -Duser.language.format=zh LocaleCategory + */ + import java.util.Locale; public class LocaleCategory { private static Locale base = null; private static Locale disp = null; private static Locale fmt = null; - private static String enc = null; public static void main(String[] args) { Locale reservedLocale = Locale.getDefault(); @@ -37,7 +53,6 @@ public class LocaleCategory { try { Locale.Builder builder = new Locale.Builder(); - base = builder.setLanguage(System.getProperty("user.language", "")) .setScript(System.getProperty("user.script", "")) .setRegion(System.getProperty("user.country", "")) @@ -68,32 +83,37 @@ public class LocaleCategory { } } - static void checkDefault() { + private static void checkDefault() { if (!base.equals(Locale.getDefault()) || !disp.equals(Locale.getDefault(Locale.Category.DISPLAY)) || !fmt.equals(Locale.getDefault(Locale.Category.FORMAT))) { - throw new RuntimeException("Some of the return values from getDefault() do not agree with the locale derived from \"user.xxxx\" system properties"); + throw new RuntimeException("Some of the return values from " + + "getDefault() do not agree with the locale derived " + + "from \"user.xxxx\" system properties"); } } - static void testGetSetDefault() { + private static void testGetSetDefault() { try { Locale.setDefault(null, null); - throw new RuntimeException("setDefault(null, null) should throw a NullPointerException"); + throw new RuntimeException("setDefault(null, null) should throw a " + + "NullPointerException"); } catch (NullPointerException npe) {} Locale.setDefault(Locale.CHINA); if (!Locale.CHINA.equals(Locale.getDefault(Locale.Category.DISPLAY)) || !Locale.CHINA.equals(Locale.getDefault(Locale.Category.FORMAT))) { - throw new RuntimeException("setDefault() should set all default locales for all categories"); + throw new RuntimeException("setDefault() should set all default " + + "locales for all categories"); } } - static void testBug7079486() { + private static void testBug7079486() { Locale zh_Hans_CN = Locale.forLanguageTag("zh-Hans-CN"); // make sure JRE has zh_Hans_CN localized string - if (zh_Hans_CN.getDisplayScript(Locale.US).equals(zh_Hans_CN.getDisplayScript(zh_Hans_CN))) { + if (zh_Hans_CN.getDisplayScript(Locale.US) + .equals(zh_Hans_CN.getDisplayScript(zh_Hans_CN))) { return; } @@ -104,7 +124,8 @@ public class LocaleCategory { String zh_script = zh_Hans_CN.getDisplayScript(); if (en_script.equals(zh_script)) { - throw new RuntimeException("Locale.getDisplayScript() (no args) does not honor default DISPLAY locale"); + throw new RuntimeException("Locale.getDisplayScript() (no args) " + + "does not honor default DISPLAY locale"); } } } diff --git a/test/jdk/java/util/Locale/LocaleCategory.sh b/test/jdk/java/util/Locale/LocaleCategory.sh deleted file mode 100644 index a613b079b11..00000000000 --- a/test/jdk/java/util/Locale/LocaleCategory.sh +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# -# @test -# @bug 4700857 6997928 7079486 -# @summary tests for Locale.getDefault(Locale.Category) and -# Locale.setDefault(Locale.Category, Locale) -# @library /java/text/testlib -# @build LocaleCategory TestUtils -# @run shell/timeout=600 LocaleCategory.sh - -if [ "${TESTSRC}" = "" ] -then - echo "TESTSRC not set. Test cannot execute. Failed." - exit 1 -fi -echo "TESTSRC=${TESTSRC}" -if [ "${TESTJAVA}" = "" ] -then - echo "TESTJAVA not set. Test cannot execute. Failed." - exit 1 -fi -echo "TESTJAVA=${TESTJAVA}" -if [ "${TESTCLASSES}" = "" ] -then - echo "TESTCLASSES not set. Test cannot execute. Failed." - exit 1 -fi - -echo "TESTCLASSES=${TESTCLASSES}" -echo "TESTCLASSPATH=${TESTCLASSPATH}" -echo "CLASSPATH=${CLASSPATH}" - -# set platform-dependent variables -OS=`uname -s` -case "$OS" in - SunOS | Linux | *BSD | Darwin | AIX ) - PS=":" - FS="/" - ;; - Windows* | CYGWIN* ) - PS=";" - FS="\\" - ;; - * ) - echo "Unrecognized system!" - exit 1; - ;; -esac - -# test user.xxx.display user.xxx.format properties - -# run -RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath ${TESTCLASSPATH} -Duser.language.display=ja -Duser.language.format=zh LocaleCategory" - -echo ${RUNCMD} -${RUNCMD} -result=$? - -if [ $result -eq 0 ] -then - echo "Execution successful" -else - echo "Execution of the test case failed." -fi - -# test user.xxx properties overriding user.xxx.display/format - -# run -RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath ${TESTCLASSPATH} -Duser.language=en -Duser.language.display=ja -Duser.language.format=zh LocaleCategory" - -echo ${RUNCMD} -${RUNCMD} -result=$? - -if [ $result -eq 0 ] -then - echo "Execution successful" -else - echo "Execution of the test case failed." -fi - -exit $result diff --git a/test/jdk/java/util/Locale/LocaleProviders.sh b/test/jdk/java/util/Locale/LocaleProviders.sh deleted file mode 100644 index cb8a7c6b9fd..00000000000 --- a/test/jdk/java/util/Locale/LocaleProviders.sh +++ /dev/null @@ -1,370 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# -# @test -# @bug 6336885 7196799 7197573 7198834 8000245 8000615 8001440 8008577 -# 8010666 8013086 8013233 8013903 8015960 8028771 8054482 8062006 -# 8150432 -# @summary tests for "java.locale.providers" system property -# @modules java.base/sun.util.locale -# java.base/sun.util.locale.provider -# @compile LocaleProviders.java -# @run shell/timeout=600 LocaleProviders.sh - -if [ "${TESTSRC}" = "" ] -then - echo "TESTSRC not set. Test cannot execute. Failed." - exit 1 -fi -echo "TESTSRC=${TESTSRC}" -if [ "${TESTJAVA}" = "" ] -then - echo "TESTJAVA not set. Test cannot execute. Failed." - exit 1 -fi -if [ "${COMPILEJAVA}" = "" ] -then - COMPILEJAVA="${TESTJAVA}" -fi -echo "TESTJAVA=${TESTJAVA}" -if [ "${TESTCLASSES}" = "" ] -then - echo "TESTCLASSES not set. Test cannot execute. Failed." - exit 1 -fi -echo "TESTCLASSES=${TESTCLASSES}" -echo "CLASSPATH=${CLASSPATH}" - -# set platform-dependent variables -OS=`uname -s` -case "$OS" in - SunOS | Linux | *BSD | Darwin | AIX ) - PS=":" - FS="/" - ;; - Windows* | CYGWIN* ) - PS=";" - FS="\\" - ;; - * ) - echo "Unrecognized system!" - exit 1; - ;; -esac - -# create SPI implementations -mk() { - d=`dirname $1` - if [ ! -d $d ]; then mkdir -p $d; fi - cat - >$1 -} - -SPIDIR=${TESTCLASSES}${FS}spi -rm -rf ${SPIDIR} -mk ${SPIDIR}${FS}src${FS}tznp.java << EOF -import java.util.spi.TimeZoneNameProvider; -import java.util.Locale; - -public class tznp extends TimeZoneNameProvider { - public String getDisplayName(String ID, boolean daylight, int style, Locale locale) { - return "tznp"; - } - - public Locale[] getAvailableLocales() { - Locale[] locales = {Locale.US}; - return locales; - } -} -EOF -mk ${SPIDIR}${FS}src${FS}tznp8013086.java << EOF -import java.util.spi.TimeZoneNameProvider; -import java.util.Locale; -import java.util.TimeZone; - -public class tznp8013086 extends TimeZoneNameProvider { - public String getDisplayName(String ID, boolean daylight, int style, Locale locale) { - if (!daylight && style==TimeZone.LONG) { - return "tznp8013086"; - } else { - return null; - } - } - - public Locale[] getAvailableLocales() { - Locale[] locales = {Locale.JAPAN}; - return locales; - } -} -EOF -mk ${SPIDIR}${FS}dest${FS}META-INF${FS}services${FS}java.util.spi.TimeZoneNameProvider << EOF -tznp -tznp8013086 -EOF - -EXTRAOPTS="--add-exports java.base/sun.util.locale=ALL-UNNAMED \ - --add-exports java.base/sun.util.locale.provider=ALL-UNNAMED" - -${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${SPIDIR}${FS}dest \ - ${SPIDIR}${FS}src${FS}tznp.java \ - ${SPIDIR}${FS}src${FS}tznp8013086.java -${COMPILEJAVA}${FS}bin${FS}jar ${TESTTOOLVMOPTS} cvf ${SPIDIR}${FS}tznp.jar -C ${SPIDIR}${FS}dest . - -# get the platform default locales -PLATDEF=`${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} ${EXTRAOPTS} -classpath ${TESTCLASSES} LocaleProviders getPlatformLocale display` -DEFLANG=`echo ${PLATDEF} | sed -e "s/,.*//"` -DEFCTRY=`echo ${PLATDEF} | sed -e "s/.*,//"` -echo "DEFLANG=${DEFLANG}" -echo "DEFCTRY=${DEFCTRY}" -PLATDEF=`${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} ${EXTRAOPTS} -classpath ${TESTCLASSES} LocaleProviders getPlatformLocale format` -DEFFMTLANG=`echo ${PLATDEF} | sed -e "s/,.*//"` -DEFFMTCTRY=`echo ${PLATDEF} | sed -e "s/.*,//"` -echo "DEFFMTLANG=${DEFFMTLANG}" -echo "DEFFMTCTRY=${DEFFMTCTRY}" - -runTest() -{ - RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} ${EXTRAOPTS} -classpath ${TESTCLASSES}${PS}${SPICLASSES} -Djava.locale.providers=$PREFLIST LocaleProviders $METHODNAME $PARAM1 $PARAM2 $PARAM3" - echo ${RUNCMD} - ${RUNCMD} - result=$? - if [ $result -eq 0 ] - then - echo "Execution successful" - else - echo "Execution of the test case failed." - exit $result - fi -} - -# testing HOST is selected for the default locale, if specified on Windows or MacOSX -METHODNAME=adapterTest -PREFLIST=HOST,JRE -case "$OS" in - Windows_NT* ) - WINVER=`uname -r` - if [ "${WINVER}" = "5" ] - then - PARAM1=JRE - else - PARAM1=HOST - fi - ;; - CYGWIN_NT-6* | CYGWIN_NT-10* | Darwin ) - PARAM1=HOST - ;; - * ) - PARAM1=JRE - ;; -esac -PARAM2=${DEFLANG} -PARAM3=${DEFCTRY} -runTest - -# testing HOST is NOT selected for the non-default locale, if specified -METHODNAME=adapterTest -PREFLIST=HOST,JRE -PARAM1=JRE -# Try to find the locale JRE supports which is not the platform default (HOST supports that one) -if [ "${DEFLANG}" != "en" ] && [ "${DEFFMTLANG}" != "en" ]; then - PARAM2=en - PARAM3=US -elif [ "${DEFLANG}" != "ja" ] && [ "${DEFFMTLANG}" != "ja" ]; then - PARAM2=ja - PARAM3=JP -else - PARAM2=zh - PARAM3=CN -fi -SPICLASSES= -runTest - -# testing SPI is NOT selected, as there is none. -METHODNAME=adapterTest -PREFLIST=SPI,JRE -PARAM1=JRE -PARAM2=en -PARAM3=US -SPICLASSES= -runTest -PREFLIST=SPI,COMPAT -runTest - -# testing the order, variaton #1. This assumes en_GB DateFormat data are available both in JRE & CLDR -METHODNAME=adapterTest -PREFLIST=CLDR,JRE -PARAM1=CLDR -PARAM2=en -PARAM3=GB -SPICLASSES= -runTest -PREFLIST=CLDR,COMPAT -runTest - -# testing the order, variaton #2. This assumes en_GB DateFormat data are available both in JRE & CLDR -METHODNAME=adapterTest -PREFLIST=JRE,CLDR -PARAM1=JRE -PARAM2=en -PARAM3=GB -SPICLASSES= -runTest -PREFLIST=COMPAT,CLDR -runTest - -# testing the order, variaton #3 for non-existent locale in JRE assuming "haw" is not in JRE. -METHODNAME=adapterTest -PREFLIST=JRE,CLDR -PARAM1=CLDR -PARAM2=haw -PARAM3= -SPICLASSES= -runTest -PREFLIST=COMPAT,CLDR -runTest - -# testing the order, variaton #4 for the bug 7196799. CLDR's "zh" data should be used in "zh_CN" -METHODNAME=adapterTest -PREFLIST=CLDR -PARAM1=CLDR -PARAM2=zh -PARAM3=CN -SPICLASSES= -runTest - -# testing FALLBACK provider. SPI and invalid one cases. -METHODNAME=adapterTest -PREFLIST=SPI -PARAM1=FALLBACK -PARAM2=en -PARAM3=US -SPICLASSES= -runTest -PREFLIST=FOO -PARAM1=CLDR -PARAM2=en -PARAM3=US -SPICLASSES= -runTest -PREFLIST=BAR,SPI -PARAM1=FALLBACK -PARAM2=en -PARAM3=US -SPICLASSES= -runTest - -# testing 7198834 fix. Only works on Windows Vista or upper. -METHODNAME=bug7198834Test -PREFLIST=HOST -PARAM1= -PARAM2= -PARAM3= -SPICLASSES= -runTest - -# testing 8000245 fix. -METHODNAME=tzNameTest -PREFLIST=JRE -PARAM1=Europe/Moscow -PARAM2= -PARAM3= -SPICLASSES=${SPIDIR} -runTest -PREFLIST=COMPAT -runTest - -# testing 8000615 fix. -METHODNAME=tzNameTest -PREFLIST=JRE -PARAM1=America/Los_Angeles -PARAM2= -PARAM3= -SPICLASSES=${SPIDIR} -runTest -PREFLIST=COMPAT -runTest - -# testing 8001440 fix. -METHODNAME=bug8001440Test -PREFLIST=CLDR -PARAM1= -PARAM2= -PARAM3= -SPICLASSES= -runTest - -# testing 8010666 fix. -if [ "${DEFLANG}" = "en" ] -then - METHODNAME=bug8010666Test - PREFLIST=HOST - PARAM1= - PARAM2= - PARAM3= - SPICLASSES= - runTest -fi - -# testing 8013086 fix. -METHODNAME=bug8013086Test -PREFLIST=JRE,SPI -PARAM1=ja -PARAM2=JP -PARAM3= -SPICLASSES=${SPIDIR} -runTest -PREFLIST=COMPAT,SPI -runTest - -# testing 8013903 fix. (Windows only) -METHODNAME=bug8013903Test -PREFLIST=HOST,JRE -PARAM1= -PARAM2= -PARAM3= -SPICLASSES= -runTest -PREFLIST=HOST -runTest -PREFLIST=HOST,COMPAT -runTest - -# testing 8027289 fix, if the platform format default is zh_CN -# this assumes Windows' currency symbol for zh_CN is \u00A5, the yen -# (yuan) sign. -if [ "${DEFFMTLANG}" = "zh" ] && [ "${DEFFMTCTRY}" = "CN" ]; then - METHODNAME=bug8027289Test - PREFLIST=JRE,HOST - PARAM1=FFE5 - PARAM2= - PARAM3= - SPICLASSES= - runTest - PREFLIST=COMPAT,HOST - runTest - PREFLIST=HOST - PARAM1=00A5 - runTest -fi - -exit $result diff --git a/test/jdk/java/util/Locale/LocaleProvidersRun.java b/test/jdk/java/util/Locale/LocaleProvidersRun.java new file mode 100644 index 00000000000..dc8aead183b --- /dev/null +++ b/test/jdk/java/util/Locale/LocaleProvidersRun.java @@ -0,0 +1,170 @@ +/* + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 6336885 7196799 7197573 7198834 8000245 8000615 8001440 8008577 + * 8010666 8013086 8013233 8013903 8015960 8028771 8054482 8062006 + * 8150432 + * @summary tests for "java.locale.providers" system property + * @library /test/lib + * @build LocaleProviders + * providersrc.spi.src.tznp + * providersrc.spi.src.tznp8013086 + * @modules java.base/sun.util.locale + * java.base/sun.util.locale.provider + * @run main LocaleProvidersRun + */ + +import java.util.Locale; + +import jdk.test.lib.JDKToolLauncher; +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.Utils; + +public class LocaleProvidersRun { + public static void main(String[] args) throws Throwable { + //get the platform default locales + Locale platDefLoc = Locale.getDefault(Locale.Category.DISPLAY); + String defLang = platDefLoc.getLanguage(); + String defCtry = platDefLoc.getCountry(); + System.out.println("DEFLANG = " + defLang); + System.out.println("DEFCTRY = " + defCtry); + + Locale platDefFormat = Locale.getDefault(Locale.Category.FORMAT); + String defFmtLang = platDefFormat.getLanguage(); + String defFmtCtry = platDefFormat.getCountry(); + System.out.println("DEFFMTLANG = " + defFmtLang); + System.out.println("DEFFMTCTRY = " + defFmtCtry); + + //Run Test + //testing HOST is selected for the default locale, + // if specified on Windows or MacOSX + String osName = System.getProperty("os.name"); + String param1 = "JRE"; + if(osName.startsWith("Windows") || osName.startsWith("Mac")) { + param1 = "HOST"; + } + testRun("HOST,JRE", "adapterTest", param1, defLang, defCtry); + + //testing HOST is NOT selected for the non-default locale, if specified + //Try to find the locale JRE supports which is not the platform default + // (HOST supports that one) + String param2; + String param3; + if (!defLang.equals("en") && !defFmtLang.equals("en")){ + param2 = "en"; + param3 = "US"; + } else if(!defLang.equals("ja") && !defFmtLang.equals("ja")){ + param2 = "ja"; + param3 = "JP"; + } else { + param2 = "zh"; + param3 = "CN"; + } + testRun("HOST,JRE", "adapterTest", "JRE", param2, param3); + + //testing SPI is NOT selected, as there is none. + testRun("SPI,JRE", "adapterTest", "JRE", "en", "US"); + testRun("SPI,COMPAT", "adapterTest", "JRE", "en", "US"); + + //testing the order, variant #1. This assumes en_GB DateFormat data are + // available both in JRE & CLDR + testRun("CLDR,JRE", "adapterTest", "CLDR", "en", "GB"); + testRun("CLDR,COMPAT", "adapterTest", "CLDR", "en", "GB"); + + //testing the order, variant #2. This assumes en_GB DateFormat data are + // available both in JRE & CLDR + testRun("JRE,CLDR", "adapterTest", "JRE", "en", "GB"); + testRun("COMPAT,CLDR", "adapterTest", "JRE", "en", "GB"); + + //testing the order, variant #3 for non-existent locale in JRE + // assuming "haw" is not in JRE. + testRun("JRE,CLDR", "adapterTest", "CLDR", "haw", ""); + testRun("COMPAT,CLDR", "adapterTest", "CLDR", "haw", ""); + + //testing the order, variant #4 for the bug 7196799. CLDR's "zh" data + // should be used in "zh_CN" + testRun("CLDR", "adapterTest", "CLDR", "zh", "CN"); + + //testing FALLBACK provider. SPI and invalid one cases. + testRun("SPI", "adapterTest", "FALLBACK", "en", "US"); + testRun("FOO", "adapterTest", "CLDR", "en", "US"); + testRun("BAR,SPI", "adapterTest", "FALLBACK", "en", "US"); + + //testing 7198834 fix. + testRun("HOST", "bug7198834Test", "", "", ""); + + //testing 8000245 fix. + testRun("JRE", "tzNameTest", "Europe/Moscow", "", ""); + testRun("COMPAT", "tzNameTest", "Europe/Moscow", "", ""); + + //testing 8000615 fix. + testRun("JRE", "tzNameTest", "America/Los_Angeles", "", ""); + testRun("COMPAT", "tzNameTest", "America/Los_Angeles", "", ""); + + //testing 8001440 fix. + testRun("CLDR", "bug8001440Test", "", "", ""); + + //testing 8010666 fix. + if (defLang.equals("en")) { + testRun("HOST", "bug8010666Test", "", "", ""); + } + + //testing 8013086 fix. + testRun("JRE,SPI", "bug8013086Test", "ja", "JP", ""); + testRun("COMPAT,SPI", "bug8013086Test", "ja", "JP", ""); + + //testing 8013903 fix. (Windows only) + testRun("HOST,JRE", "bug8013903Test", "", "", ""); + testRun("HOST", "bug8013903Test", "", "", ""); + testRun("HOST,COMPAT", "bug8013903Test", "", "", ""); + + //testing 8027289 fix, if the platform format default is zh_CN + // this assumes Windows' currency symbol for zh_CN is \u00A5, the yen + // (yuan) sign. + if (!defLang.equals("en") && !defCtry.equals("CN")){ + testRun("JRE,HOST", "bug8027289Test", "FFE5", "", ""); + testRun("COMPAT,HOST", "bug8027289Test", "FFE5", "", ""); + testRun("HOST", "bug8027289Test", "00A5", "", ""); + } + } + + private static void testRun(String prefList, String methodName, + String param1, String param2, String param3) throws Throwable{ + JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("java"); + launcher.addToolArg("-cp") + .addToolArg(Utils.TEST_CLASS_PATH) + .addToolArg("-Djava.locale.providers=" + prefList) + .addToolArg("LocaleProviders") + .addToolArg(methodName) + .addToolArg(param1) + .addToolArg(param2) + .addToolArg(param3); + int exitCode = ProcessTools.executeCommand(launcher.getCommand()) + .getExitValue(); + if (exitCode != 0) { + throw new RuntimeException("Unexpected exit code: " + exitCode); + } + } +} diff --git a/test/jdk/java/util/Locale/providersrc/spi/dest/META-INF/services/java.util.spi.TimeZoneNameProvider b/test/jdk/java/util/Locale/providersrc/spi/dest/META-INF/services/java.util.spi.TimeZoneNameProvider new file mode 100644 index 00000000000..0bfef7bab9c --- /dev/null +++ b/test/jdk/java/util/Locale/providersrc/spi/dest/META-INF/services/java.util.spi.TimeZoneNameProvider @@ -0,0 +1,2 @@ +tznp +tznp8013086 diff --git a/test/jdk/java/util/Locale/providersrc/spi/src/tznp.java b/test/jdk/java/util/Locale/providersrc/spi/src/tznp.java new file mode 100644 index 00000000000..5b2cad7396f --- /dev/null +++ b/test/jdk/java/util/Locale/providersrc/spi/src/tznp.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package providersrc.spi.src; + +import java.util.spi.TimeZoneNameProvider; +import java.util.Locale; + +public class tznp extends TimeZoneNameProvider { + public String getDisplayName(String ID, boolean daylight, int style, + Locale locale) { + return "tznp"; + } + + public Locale[] getAvailableLocales() { + Locale[] locales = {Locale.US}; + return locales; + } +} diff --git a/test/jdk/java/util/Locale/providersrc/spi/src/tznp8013086.java b/test/jdk/java/util/Locale/providersrc/spi/src/tznp8013086.java new file mode 100644 index 00000000000..5b029739306 --- /dev/null +++ b/test/jdk/java/util/Locale/providersrc/spi/src/tznp8013086.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package providersrc.spi.src; +import java.util.spi.TimeZoneNameProvider; +import java.util.Locale; +import java.util.TimeZone; + +public class tznp8013086 extends TimeZoneNameProvider { + public String getDisplayName(String ID, boolean daylight, int style, + Locale locale) { + if (!daylight && style == TimeZone.LONG) { + return "tznp8013086"; + } else { + return null; + } + } + + public Locale[] getAvailableLocales() { + Locale[] locales = {Locale.JAPAN}; + return locales; + } +} From 4e1c5102153c690c6c6e5a3b192477187910827e Mon Sep 17 00:00:00 2001 From: Priya Lakshmi Muthuswamy Date: Wed, 17 Oct 2018 15:28:36 +0530 Subject: [PATCH 38/66] 8211901: javadoc generates broken links on deprecated items page Reviewed-by: jjg --- .../internal/doclets/toolkit/util/Utils.java | 2 +- .../toolkit/util/VisibleMemberTable.java | 4 +- .../TestOverriddenDeprecatedMethods.java | 64 +++++++++++++++++++ .../testOverriddenMethods/pkg1/BaseClass.java | 18 ++++++ .../testOverriddenMethods/pkg1/SubClass.java | 18 ++++++ 5 files changed, 103 insertions(+), 3 deletions(-) create mode 100644 test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestOverriddenDeprecatedMethods.java diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java index 0213d08f747..2c050a2758b 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java @@ -1485,7 +1485,7 @@ public class Utils { return false; } - if (!getBlockTags(m).isEmpty()) + if (!getBlockTags(m).isEmpty() || isDeprecated(m)) return false; List fullBody = getFullBody(m); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/VisibleMemberTable.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/VisibleMemberTable.java index 774c68a00dc..6e4e2016cf2 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/VisibleMemberTable.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/VisibleMemberTable.java @@ -248,7 +248,7 @@ public class VisibleMemberTable { * @param e the method to check * @return the overridden method or null */ - public ExecutableElement getsimplyOverriddenMethod(ExecutableElement e) { + public ExecutableElement getSimplyOverriddenMethod(ExecutableElement e) { ensureInitialized(); OverridingMethodInfo found = overriddenMethodTable.get(e); @@ -869,7 +869,7 @@ public class VisibleMemberTable { public List getImplementedMethods(ExecutableElement method) { ImplementedMethods imf = getImplementedMethodsFinder(method); return imf.getImplementedMethods().stream() - .filter(m -> getsimplyOverriddenMethod(m) == null) + .filter(m -> getSimplyOverriddenMethod(m) == null) .collect(Collectors.toList()); } diff --git a/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestOverriddenDeprecatedMethods.java b/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestOverriddenDeprecatedMethods.java new file mode 100644 index 00000000000..fc459e641cd --- /dev/null +++ b/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestOverriddenDeprecatedMethods.java @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8211901 + * @summary javadoc generates broken links on deprecated items page + * @library ../lib + * @modules jdk.javadoc/jdk.javadoc.internal.tool + * @build JavadocTester + * @run main TestOverriddenDeprecatedMethods + */ + +public class TestOverriddenDeprecatedMethods extends JavadocTester { + + public static void main(String args[]) throws Exception { + TestOverriddenDeprecatedMethods tester = new TestOverriddenDeprecatedMethods(); + tester.runTests(); + } + + @Test + void test() { + javadoc("-d", "out-deprecated", + "-sourcepath", testSrc, + "--override-methods","summary", + "pkg1"); + + checkExit(Exit.OK); + + checkOrder("pkg1/SubClass.html", + "Method Summary", + "Methods declared in class pkg1." + + "BaseClass", + "func3"); + + checkOrder("pkg1/SubClass.html", + "Method Detail", + "@Deprecated\npublic void func1()", + "
Deprecated.
", + "@Deprecated\npublic void func2()", + "
Deprecated.
", + "
deprecated with comments
"); + } +} diff --git a/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/pkg1/BaseClass.java b/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/pkg1/BaseClass.java index 241345cedb0..12f68753ef1 100644 --- a/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/pkg1/BaseClass.java +++ b/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/pkg1/BaseClass.java @@ -50,4 +50,22 @@ public class BaseClass { */ public void overridenMethodWithDocsToCopy() {} + /** + * @deprecated func1 deprecated + */ + @Deprecated + public void func1() {} + + /** + * @deprecated func2 deprecated + */ + @Deprecated + public void func2() {} + + /** + * @deprecated func3 deprecated + */ + @Deprecated + public void func3() {} + } diff --git a/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/pkg1/SubClass.java b/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/pkg1/SubClass.java index 5698fe985f9..e6146849ed4 100644 --- a/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/pkg1/SubClass.java +++ b/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/pkg1/SubClass.java @@ -48,4 +48,22 @@ public class SubClass extends BaseClass { public void privateMethod() {} public void overridenMethodWithDocsToCopy() {} + + /** + * {@inheritDoc} + */ + @Deprecated + public void func1() {} + + /** + * deprecated with comments + */ + @Deprecated + public void func2() {} + + /** + * {@inheritDoc} + */ + public void func3() {} + } From b1c0737ad56c2d9f5127531a8696ad304584f1e0 Mon Sep 17 00:00:00 2001 From: Claes Redestad Date: Wed, 17 Oct 2018 14:19:21 +0200 Subject: [PATCH 39/66] 8212201: Classlist build tool should be built for the target JDK version Reviewed-by: erikj, ihse --- make/CompileToolsJdk.gmk | 1 + make/GenerateLinkOptData.gmk | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/make/CompileToolsJdk.gmk b/make/CompileToolsJdk.gmk index 14966405ed1..cd4034d51f6 100644 --- a/make/CompileToolsJdk.gmk +++ b/make/CompileToolsJdk.gmk @@ -46,6 +46,7 @@ $(eval $(call SetupJavaCompilation,BUILD_TOOLS_JDK, \ SETUP := GENERATE_OLDBYTECODE, \ SRC := $(BUILD_TOOLS_SRC_DIRS), \ EXCLUDES := \ + build/tools/classlist \ build/tools/deps \ build/tools/docs \ build/tools/jigsaw \ diff --git a/make/GenerateLinkOptData.gmk b/make/GenerateLinkOptData.gmk index 7358589e6f3..cd7db160cd3 100644 --- a/make/GenerateLinkOptData.gmk +++ b/make/GenerateLinkOptData.gmk @@ -31,15 +31,17 @@ default: all include $(SPEC) include MakeBase.gmk -include JarArchive.gmk +include SetupJavaCompilers.gmk ################################################################################ # Create a jar with our generator class. Using a jar is intentional since it # will load more classes -$(eval $(call SetupJarArchive, CLASSLIST_JAR, \ - SRCS := $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes, \ +$(eval $(call SetupJavaCompilation, CLASSLIST_JAR, \ + SETUP := GENERATE_JDKBYTECODE, \ + SRC := $(TOPDIR)/make/jdk/src/classes, \ INCLUDES := build/tools/classlist, \ + BIN := $(BUILDTOOLS_OUTPUTDIR)/classlist_classes, \ JAR := $(SUPPORT_OUTPUTDIR)/classlist.jar, \ )) From da989adeb78d34eac8cd5b6f2fa06b022bccf006 Mon Sep 17 00:00:00 2001 From: John Jiang Date: Wed, 17 Oct 2018 22:06:55 +0800 Subject: [PATCH 40/66] 8212562: To remove lib/security from test/jdk/TEST.groups Remove lib/security from test group jdk_security3 Reviewed-by: coffeys --- test/jdk/TEST.groups | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/jdk/TEST.groups b/test/jdk/TEST.groups index ca0d786050d..c68abb1c700 100644 --- a/test/jdk/TEST.groups +++ b/test/jdk/TEST.groups @@ -218,8 +218,7 @@ jdk_security3 = \ -sun/security/krb5 \ -sun/security/jgss \ javax/net \ - com/sun/net/ssl \ - lib/security + com/sun/net/ssl jdk_security4 = \ com/sun/security/jgss \ From b3b41df70fb5ec3187d165786b3c8ad2d4b4012b Mon Sep 17 00:00:00 2001 From: Claes Redestad Date: Wed, 17 Oct 2018 17:35:26 +0200 Subject: [PATCH 41/66] 8212597: Optimize String concatenation setup when using primitive operands Reviewed-by: shade --- .../build/tools/classlist/HelloClasslist.java | 9 +++ .../classes/java/lang/StringConcatHelper.java | 55 ------------------- .../java/lang/invoke/StringConcatFactory.java | 53 ++++++++++++------ 3 files changed, 45 insertions(+), 72 deletions(-) diff --git a/make/jdk/src/classes/build/tools/classlist/HelloClasslist.java b/make/jdk/src/classes/build/tools/classlist/HelloClasslist.java index e32b8d77766..7bef5556af8 100644 --- a/make/jdk/src/classes/build/tools/classlist/HelloClasslist.java +++ b/make/jdk/src/classes/build/tools/classlist/HelloClasslist.java @@ -66,6 +66,15 @@ public class HelloClasslist { Stream.of(helloWorld.split(",")) .forEach(System.out::println); + // Common concatenation patterns + String const_I = "string" + args.length; + String const_S = "string" + String.valueOf(args.length); + String S_const = String.valueOf(args.length) + "string"; + String S_S = String.valueOf(args.length) + String.valueOf(args.length); + String const_J = "string" + System.currentTimeMillis(); + String I_const = args.length + "string"; + String J_const = System.currentTimeMillis() + "string"; + String newDate = DateTimeFormatter.ISO_LOCAL_DATE_TIME.format( LocalDateTime.now(ZoneId.of("GMT"))); diff --git a/src/java.base/share/classes/java/lang/StringConcatHelper.java b/src/java.base/share/classes/java/lang/StringConcatHelper.java index 159d657a2e9..cae184701e1 100644 --- a/src/java.base/share/classes/java/lang/StringConcatHelper.java +++ b/src/java.base/share/classes/java/lang/StringConcatHelper.java @@ -138,61 +138,6 @@ final class StringConcatHelper { return (byte)(current | value.coder()); } - /** - * Mix coder into current coder - * @param current current coder - * @param value value to mix in - * @return new coder - */ - static byte mixCoder(byte current, boolean value) { - // Booleans are represented with Latin1 - return current; - } - - /** - * Mix coder into current coder - * @param current current coder - * @param value value to mix in - * @return new coder - */ - static byte mixCoder(byte current, byte value) { - // Bytes are represented with Latin1 - return current; - } - - /** - * Mix coder into current coder - * @param current current coder - * @param value value to mix in - * @return new coder - */ - static byte mixCoder(byte current, short value) { - // Shorts are represented with Latin1 - return current; - } - - /** - * Mix coder into current coder - * @param current current coder - * @param value value to mix in - * @return new coder - */ - static byte mixCoder(byte current, int value) { - // Ints are represented with Latin1 - return current; - } - - /** - * Mix coder into current coder - * @param current current coder - * @param value value to mix in - * @return new coder - */ - static byte mixCoder(byte current, long value) { - // Longs are represented with Latin1 - return current; - } - /** * Prepends the stringly representation of boolean value into buffer, * given the coder and final index. Index is measured in chars, not in bytes! diff --git a/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java b/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java index 0192f1651fc..23352af0f5d 100644 --- a/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java +++ b/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java @@ -1588,28 +1588,47 @@ public final class StringConcatFactory { Class argClass = ptypes[ac]; MethodHandle lm = lengthMixer(argClass); - MethodHandle cm = coderMixer(argClass); - // Read this bottom up: + // Read these bottom up: - // 4. Drop old index and coder, producing ("new-index", "new-coder", ) - mh = MethodHandles.dropArguments(mh, 2, int.class, byte.class); + if (argClass.isPrimitive() && argClass != char.class) { - // 3. Compute "new-index", producing ("new-index", "new-coder", "old-index", "old-coder", ) - // Length mixer needs old index, plus the appropriate argument - mh = MethodHandles.foldArguments(mh, 0, lm, - 2, // old-index - 4 + ac // selected argument - ); + // 3. Drop old index, producing ("new-index", "coder", ) + mh = MethodHandles.dropArguments(mh, 1, int.class); - // 2. Compute "new-coder", producing ("new-coder", "old-index", "old-coder", ) - // Coder mixer needs old coder, plus the appropriate argument. - mh = MethodHandles.foldArguments(mh, 0, cm, - 2, // old-coder - 3 + ac // selected argument - ); + // 2. Compute "new-index", producing ("new-index", "old-index", "coder", ) + // Length mixer needs old index, plus the appropriate argument + mh = MethodHandles.foldArguments(mh, 0, lm, + 1, // old-index + 3 + ac // selected argument + ); + + // 1. The mh shape here is ("old-index", "coder", ); we don't need to recalculate + // the coder for non-char primitive arguments + + } else { + MethodHandle cm = coderMixer(argClass); + + // 4. Drop old index and coder, producing ("new-index", "new-coder", ) + mh = MethodHandles.dropArguments(mh, 2, int.class, byte.class); + + // 3. Compute "new-index", producing ("new-index", "new-coder", "old-index", "old-coder", ) + // Length mixer needs old index, plus the appropriate argument + mh = MethodHandles.foldArguments(mh, 0, lm, + 2, // old-index + 4 + ac // selected argument + ); + + // 2. Compute "new-coder", producing ("new-coder", "old-index", "old-coder", ) + // Coder mixer needs old coder, plus the appropriate argument. + mh = MethodHandles.foldArguments(mh, 0, cm, + 2, // old-coder + 3 + ac // selected argument + ); + + // 1. The mh shape here is ("old-index", "old-coder", ) + } - // 1. The mh shape here is ("old-index", "old-coder", ) break; default: throw new StringConcatException("Unhandled tag: " + el.getTag()); From 98fe69f3a25523c9af9e657a948dd282a4b2492f Mon Sep 17 00:00:00 2001 From: Aleksey Shipilev Date: Wed, 17 Oct 2018 18:31:48 +0200 Subject: [PATCH 42/66] 8212608: Minimal VM build failure after JDK-8210498 (nmethod entry barriers) Reviewed-by: eosterlund --- src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp b/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp index 955ce2cd207..466c84581d1 100644 --- a/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp +++ b/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp @@ -34,6 +34,8 @@ #include "code/vtableStubs.hpp" #include "gc/shared/collectedHeap.hpp" #include "gc/shared/gcLocker.hpp" +#include "gc/shared/barrierSet.hpp" +#include "gc/shared/barrierSetAssembler.hpp" #include "interpreter/interpreter.hpp" #include "logging/log.hpp" #include "memory/resourceArea.hpp" From 89d9a60caa689f630973520658675a517514e87e Mon Sep 17 00:00:00 2001 From: Roman Kennke Date: Wed, 17 Oct 2018 22:26:41 +0200 Subject: [PATCH 43/66] 8212186: JVMTI lacks a few GC barriers/hooks Reviewed-by: eosterlund, shade --- src/hotspot/share/prims/jvmtiExport.cpp | 2 +- src/hotspot/share/prims/jvmtiTagMap.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/hotspot/share/prims/jvmtiExport.cpp b/src/hotspot/share/prims/jvmtiExport.cpp index 9ffd420198c..07f381e1c48 100644 --- a/src/hotspot/share/prims/jvmtiExport.cpp +++ b/src/hotspot/share/prims/jvmtiExport.cpp @@ -1044,7 +1044,7 @@ class JvmtiObjectAllocEventMark : public JvmtiClassEventMark { public: JvmtiObjectAllocEventMark(JavaThread *thread, oop obj) : JvmtiClassEventMark(thread, oop_to_klass(obj)) { _jobj = (jobject)to_jobject(obj); - _size = obj->size() * wordSize; + _size = Universe::heap()->obj_size(obj) * wordSize; }; jobject jni_jobject() { return _jobj; } jlong size() { return _size; } diff --git a/src/hotspot/share/prims/jvmtiTagMap.cpp b/src/hotspot/share/prims/jvmtiTagMap.cpp index 7696dd9aa05..3bdf03a37b6 100644 --- a/src/hotspot/share/prims/jvmtiTagMap.cpp +++ b/src/hotspot/share/prims/jvmtiTagMap.cpp @@ -105,7 +105,7 @@ class JvmtiTagHashmapEntry : public CHeapObj { } inline bool equals(oop object) { - return object == object_peek(); + return oopDesc::equals(object, object_peek()); } inline JvmtiTagHashmapEntry* next() const { return _next; } @@ -186,6 +186,7 @@ class JvmtiTagHashmap : public CHeapObj { // shift right to get better distribution (as these bits will be zero // with aligned addresses) + key = Access<>::resolve(key); unsigned int addr = (unsigned int)(cast_from_oop(key)); #ifdef _LP64 return (addr >> 3) % size; From b3d9f93363d5464be58fbfbe20e24f8724e15bfe Mon Sep 17 00:00:00 2001 From: Aleksey Shipilev Date: Wed, 17 Oct 2018 22:42:31 +0200 Subject: [PATCH 44/66] 8212616: x86_32 build failures after JDK-8210498 (nmethod entry barriers) Reviewed-by: kvn, eosterlund --- src/hotspot/cpu/x86/x86_32.ad | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hotspot/cpu/x86/x86_32.ad b/src/hotspot/cpu/x86/x86_32.ad index 7c6515f14fb..a296e1b76aa 100644 --- a/src/hotspot/cpu/x86/x86_32.ad +++ b/src/hotspot/cpu/x86/x86_32.ad @@ -619,7 +619,7 @@ void MachPrologNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const { int framesize = C->frame_size_in_bytes(); int bangsize = C->bang_size_in_bytes(); - __ verified_entry(framesize, C->need_stack_bang(bangsize)?bangsize:0, C->in_24_bit_fp_mode()); + __ verified_entry(framesize, C->need_stack_bang(bangsize)?bangsize:0, C->in_24_bit_fp_mode(), C->stub_function() != NULL); C->set_frame_complete(cbuf.insts_size()); From 00f3bbe51b2f6cb670a213f5c18796e38552c9d1 Mon Sep 17 00:00:00 2001 From: Aleksey Shipilev Date: Wed, 17 Oct 2018 22:47:59 +0200 Subject: [PATCH 45/66] 8212617: ARM32 build failures after JDK-7041262 (VM_Version should be called instead of Abstract_VM_Version so that overriding works) Reviewed-by: hseigel --- src/hotspot/cpu/arm/vm_version_arm.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/hotspot/cpu/arm/vm_version_arm.hpp b/src/hotspot/cpu/arm/vm_version_arm.hpp index e2770f03345..889ff7058a9 100644 --- a/src/hotspot/cpu/arm/vm_version_arm.hpp +++ b/src/hotspot/cpu/arm/vm_version_arm.hpp @@ -110,7 +110,6 @@ class VM_Version: public Abstract_VM_Version { static bool supports_kuser_cmpxchg64() { return _kuser_helper_version >= KUSER_VERSION_CMPXCHG64; } // Override Abstract_VM_Version implementation static bool use_biased_locking(); - static const char* vm_info_string(); static bool has_vfp() { return (_features & vfp_m) != 0; } static bool has_vfp3_32() { return (_features & vfp3_32_m) != 0; } From ab0baf86f72bdded643fd680b2dfcc192490997b Mon Sep 17 00:00:00 2001 From: Jesper Wilhelmsson Date: Thu, 18 Oct 2018 00:50:14 +0200 Subject: [PATCH 46/66] Added tag jdk-12+16 for changeset 199658d1ef86 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 0fd57b33348..bed6dcf27f1 100644 --- a/.hgtags +++ b/.hgtags @@ -518,3 +518,4 @@ f0f5d23449d31f1b3580c8a73313918cafeaefd7 jdk-12+11 8897e41b327c0a5601c6ba2bba5d07f15a3ffc91 jdk-12+14 6f04692c7d5137ee34a6bd94c0c8a6c9219cb127 jdk-12+14 f8626bcc169813a4b2a15880386b952719d1d6d1 jdk-12+15 +199658d1ef860cdc17055b4fd3e94b057f292fe9 jdk-12+16 From 75489d717e03291d0b6969d3732e6489f8a883ce Mon Sep 17 00:00:00 2001 From: John Jiang Date: Thu, 18 Oct 2018 07:56:55 +0800 Subject: [PATCH 47/66] 8210632: Add key exchange algorithm to javax/net/ssl/TLSCommon/CipherSuite.java Javax/net/ssl/TLSCommon/CipherSuite.java supports key exchange algorithms Reviewed-by: xuelei --- .../javax/net/ssl/TLSCommon/CipherSuite.java | 204 +++++++++--------- .../net/ssl/TLSCommon/KeyExAlgorithm.java | 44 ++++ 2 files changed, 149 insertions(+), 99 deletions(-) create mode 100644 test/jdk/javax/net/ssl/TLSCommon/KeyExAlgorithm.java diff --git a/test/jdk/javax/net/ssl/TLSCommon/CipherSuite.java b/test/jdk/javax/net/ssl/TLSCommon/CipherSuite.java index 54497753c90..144e735ca21 100644 --- a/test/jdk/javax/net/ssl/TLSCommon/CipherSuite.java +++ b/test/jdk/javax/net/ssl/TLSCommon/CipherSuite.java @@ -21,210 +21,216 @@ * questions. */ +/* + * SSL/TLS cipher suites. + */ public enum CipherSuite { - TLS_AES_256_GCM_SHA384( - 0x1302, Protocol.TLSV1_3, Protocol.TLSV1_3), - TLS_AES_128_GCM_SHA256( - 0x1301, Protocol.TLSV1_3, Protocol.TLSV1_3), - TLS_CHACHA20_POLY1305_SHA256( - 0x1303, Protocol.TLSV1_3, Protocol.TLSV1_3), TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256( - 0xCCAA, Protocol.TLSV1_2, Protocol.TLSV1_2), + 0xCCAA, KeyExAlgorithm.DHE_RSA, Protocol.TLSV1_2, Protocol.TLSV1_2), TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256( - 0xCCA9, Protocol.TLSV1_2, Protocol.TLSV1_2), + 0xCCA9, KeyExAlgorithm.ECDHE_ECDSA, Protocol.TLSV1_2, Protocol.TLSV1_2), TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256( - 0xCCA8, Protocol.TLSV1_2, Protocol.TLSV1_2), + 0xCCA8, KeyExAlgorithm.ECDHE_RSA, Protocol.TLSV1_2, Protocol.TLSV1_2), TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384( - 0xC032, Protocol.TLSV1_2, Protocol.TLSV1_2), + 0xC032, KeyExAlgorithm.ECDH_RSA, Protocol.TLSV1_2, Protocol.TLSV1_2), TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256( - 0xC031, Protocol.TLSV1_2, Protocol.TLSV1_2), + 0xC031, KeyExAlgorithm.ECDH_RSA, Protocol.TLSV1_2, Protocol.TLSV1_2), TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384( - 0xC030, Protocol.TLSV1_2, Protocol.TLSV1_2), + 0xC030, KeyExAlgorithm.ECDHE_RSA, Protocol.TLSV1_2, Protocol.TLSV1_2), TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256( - 0xC02F, Protocol.TLSV1_2, Protocol.TLSV1_2), + 0xC02F, KeyExAlgorithm.ECDHE_RSA, Protocol.TLSV1_2, Protocol.TLSV1_2), TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384( - 0xC02E, Protocol.TLSV1_2, Protocol.TLSV1_2), + 0xC02E, KeyExAlgorithm.ECDH_ECDSA, Protocol.TLSV1_2, Protocol.TLSV1_2), TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256( - 0xC02D, Protocol.TLSV1_2, Protocol.TLSV1_2), + 0xC02D, KeyExAlgorithm.ECDH_ECDSA, Protocol.TLSV1_2, Protocol.TLSV1_2), TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384( - 0xC02C, Protocol.TLSV1_2, Protocol.TLSV1_2), + 0xC02C, KeyExAlgorithm.ECDHE_ECDSA, Protocol.TLSV1_2, Protocol.TLSV1_2), TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256( - 0xC02B, Protocol.TLSV1_2, Protocol.TLSV1_2), + 0xC02B, KeyExAlgorithm.ECDHE_ECDSA, Protocol.TLSV1_2, Protocol.TLSV1_2), TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384( - 0xC02A, Protocol.TLSV1_2, Protocol.TLSV1_2), + 0xC02A, KeyExAlgorithm.ECDH_RSA, Protocol.TLSV1_2, Protocol.TLSV1_2), TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256( - 0xC029, Protocol.TLSV1_2, Protocol.TLSV1_2), + 0xC029, KeyExAlgorithm.ECDH_RSA, Protocol.TLSV1_2, Protocol.TLSV1_2), TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384( - 0xC028, Protocol.TLSV1_2, Protocol.TLSV1_2), + 0xC028, KeyExAlgorithm.ECDHE_RSA, Protocol.TLSV1_2, Protocol.TLSV1_2), TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256( - 0xC027, Protocol.TLSV1_2, Protocol.TLSV1_2), + 0xC027, KeyExAlgorithm.ECDHE_RSA, Protocol.TLSV1_2, Protocol.TLSV1_2), TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384( - 0xC026, Protocol.TLSV1_2, Protocol.TLSV1_2), + 0xC026, KeyExAlgorithm.ECDH_ECDSA, Protocol.TLSV1_2, Protocol.TLSV1_2), TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA( - 0xC025, Protocol.SSLV3, Protocol.TLSV1_2), + 0xC025, KeyExAlgorithm.ECDH_ECDSA, Protocol.SSLV3, Protocol.TLSV1_2), TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256( - 0xC025, Protocol.TLSV1_2, Protocol.TLSV1_2), + 0xC025, KeyExAlgorithm.ECDH_ECDSA, Protocol.TLSV1_2, Protocol.TLSV1_2), TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384( - 0xC024, Protocol.TLSV1_2, Protocol.TLSV1_2), + 0xC024, KeyExAlgorithm.ECDHE_ECDSA, Protocol.TLSV1_2, Protocol.TLSV1_2), TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256( - 0xC023, Protocol.TLSV1_2, Protocol.TLSV1_2), + 0xC023, KeyExAlgorithm.ECDHE_ECDSA, Protocol.TLSV1_2, Protocol.TLSV1_2), TLS_ECDH_anon_WITH_AES_256_CBC_SHA( - 0xC019, Protocol.SSLV3, Protocol.TLSV1_2), + 0xC019, KeyExAlgorithm.ECDH_ANON, Protocol.SSLV3, Protocol.TLSV1_2), TLS_ECDH_anon_WITH_AES_128_CBC_SHA( - 0xC018, Protocol.SSLV3, Protocol.TLSV1_2), + 0xC018, KeyExAlgorithm.ECDH_ANON, Protocol.SSLV3, Protocol.TLSV1_2), TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA( - 0xC017, Protocol.SSLV3, Protocol.TLSV1_2), + 0xC017, KeyExAlgorithm.ECDH_ANON, Protocol.SSLV3, Protocol.TLSV1_2), TLS_ECDH_anon_WITH_RC4_128_SHA( - 0xC016, Protocol.SSLV3, Protocol.TLSV1_2), + 0xC016, KeyExAlgorithm.ECDH_ANON, Protocol.SSLV3, Protocol.TLSV1_2), TLS_ECDH_anon_WITH_NULL_SHA( - 0xC015, Protocol.SSLV3, Protocol.TLSV1_2), + 0xC015, KeyExAlgorithm.ECDH_ANON, Protocol.SSLV3, Protocol.TLSV1_2), TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA( - 0xC014, Protocol.SSLV3, Protocol.TLSV1_2), + 0xC014, KeyExAlgorithm.ECDHE_RSA, Protocol.SSLV3, Protocol.TLSV1_2), TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA( - 0xC013, Protocol.SSLV3, Protocol.TLSV1_2), + 0xC013, KeyExAlgorithm.ECDHE_RSA, Protocol.SSLV3, Protocol.TLSV1_2), TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA( - 0xC012, Protocol.SSLV3, Protocol.TLSV1_2), + 0xC012, KeyExAlgorithm.ECDHE_RSA, Protocol.SSLV3, Protocol.TLSV1_2), TLS_ECDHE_RSA_WITH_RC4_128_SHA( - 0xC011, Protocol.SSLV3, Protocol.TLSV1_2), + 0xC011, KeyExAlgorithm.ECDHE_RSA, Protocol.SSLV3, Protocol.TLSV1_2), TLS_ECDHE_RSA_WITH_NULL_SHA( - 0xC010, Protocol.SSLV3, Protocol.TLSV1_2), + 0xC010, KeyExAlgorithm.ECDHE_RSA, Protocol.SSLV3, Protocol.TLSV1_2), TLS_ECDH_RSA_WITH_AES_256_CBC_SHA( - 0xC00F, Protocol.SSLV3, Protocol.TLSV1_2), + 0xC00F, KeyExAlgorithm.ECDH_RSA, Protocol.SSLV3, Protocol.TLSV1_2), TLS_ECDH_RSA_WITH_AES_128_CBC_SHA( - 0xC00E, Protocol.SSLV3, Protocol.TLSV1_2), + 0xC00E, KeyExAlgorithm.ECDH_RSA, Protocol.SSLV3, Protocol.TLSV1_2), TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA( - 0xC00D, Protocol.SSLV3, Protocol.TLSV1_2), + 0xC00D, KeyExAlgorithm.ECDH_RSA, Protocol.SSLV3, Protocol.TLSV1_2), TLS_ECDH_RSA_WITH_RC4_128_SHA( - 0xC00C, Protocol.SSLV3, Protocol.TLSV1_2), + 0xC00C, KeyExAlgorithm.ECDH_RSA, Protocol.SSLV3, Protocol.TLSV1_2), TLS_ECDH_RSA_WITH_NULL_SHA( - 0xC00B, Protocol.SSLV3, Protocol.TLSV1_2), + 0xC00B, KeyExAlgorithm.ECDH_RSA, Protocol.SSLV3, Protocol.TLSV1_2), TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA( - 0xC00A, Protocol.SSLV3, Protocol.TLSV1_2), + 0xC00A, KeyExAlgorithm.ECDHE_ECDSA, Protocol.SSLV3, Protocol.TLSV1_2), TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA( - 0xC009, Protocol.SSLV3, Protocol.TLSV1_2), + 0xC009, KeyExAlgorithm.ECDHE_ECDSA, Protocol.SSLV3, Protocol.TLSV1_2), TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA( - 0xC008, Protocol.SSLV3, Protocol.TLSV1_2), + 0xC008, KeyExAlgorithm.ECDHE_ECDSA, Protocol.SSLV3, Protocol.TLSV1_2), TLS_ECDHE_ECDSA_WITH_RC4_128_SHA( - 0xC007, Protocol.SSLV3, Protocol.TLSV1_2), + 0xC007, KeyExAlgorithm.ECDHE_ECDSA, Protocol.SSLV3, Protocol.TLSV1_2), TLS_ECDHE_ECDSA_WITH_NULL_SHA( - 0xC006, Protocol.SSLV3, Protocol.TLSV1_2), + 0xC006, KeyExAlgorithm.ECDHE_ECDSA, Protocol.SSLV3, Protocol.TLSV1_2), TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA( - 0xC003, Protocol.SSLV3, Protocol.TLSV1_2), + 0xC003, KeyExAlgorithm.ECDH_ECDSA, Protocol.SSLV3, Protocol.TLSV1_2), TLS_ECDH_ECDSA_WITH_RC4_128_SHA( - 0xC002, Protocol.SSLV3, Protocol.TLSV1_2), + 0xC002, KeyExAlgorithm.ECDH_ECDSA, Protocol.SSLV3, Protocol.TLSV1_2), TLS_ECDH_ECDSA_WITH_NULL_SHA( - 0xC001, Protocol.SSLV3, Protocol.TLSV1_2), + 0xC001, KeyExAlgorithm.ECDH_ECDSA, Protocol.SSLV3, Protocol.TLSV1_2), TLS_EMPTY_RENEGOTIATION_INFO_SCSV( - 0x00FF, Protocol.SSLV3, Protocol.TLSV1_2), + 0x00FF, KeyExAlgorithm.SCSV, Protocol.SSLV3, Protocol.TLSV1_2), + TLS_AES_256_GCM_SHA384( + 0x1302, null, Protocol.TLSV1_3, Protocol.TLSV1_3), + TLS_AES_128_GCM_SHA256( + 0x1301, null, Protocol.TLSV1_3, Protocol.TLSV1_3), + TLS_CHACHA20_POLY1305_SHA256( + 0x1303, null, Protocol.TLSV1_3, Protocol.TLSV1_3), TLS_DH_anon_WITH_AES_256_GCM_SHA384( - 0x00A7, Protocol.TLSV1_2, Protocol.TLSV1_2), + 0x00A7, KeyExAlgorithm.DH_ANON, Protocol.TLSV1_2, Protocol.TLSV1_2), TLS_DH_anon_WITH_AES_128_GCM_SHA256( - 0x00A6, Protocol.TLSV1_2, Protocol.TLSV1_2), + 0x00A6, KeyExAlgorithm.DH_ANON, Protocol.TLSV1_2, Protocol.TLSV1_2), TLS_DHE_DSS_WITH_AES_256_GCM_SHA384( - 0x00A3, Protocol.TLSV1_2, Protocol.TLSV1_2), + 0x00A3, KeyExAlgorithm.DHE_DSS, Protocol.TLSV1_2, Protocol.TLSV1_2), TLS_DHE_DSS_WITH_AES_128_GCM_SHA256( - 0x00A2, Protocol.TLSV1_2, Protocol.TLSV1_2), + 0x00A2, KeyExAlgorithm.DHE_DSS, Protocol.TLSV1_2, Protocol.TLSV1_2), TLS_DHE_RSA_WITH_AES_256_GCM_SHA384( - 0x009F, Protocol.TLSV1_2, Protocol.TLSV1_2), + 0x009F, KeyExAlgorithm.DHE_RSA, Protocol.TLSV1_2, Protocol.TLSV1_2), TLS_DHE_RSA_WITH_AES_128_GCM_SHA256( - 0x009E, Protocol.TLSV1_2, Protocol.TLSV1_2), + 0x009E, KeyExAlgorithm.DHE_RSA, Protocol.TLSV1_2, Protocol.TLSV1_2), TLS_RSA_WITH_AES_256_GCM_SHA384( - 0x009D, Protocol.TLSV1_2, Protocol.TLSV1_2), + 0x009D, KeyExAlgorithm.RSA, Protocol.TLSV1_2, Protocol.TLSV1_2), TLS_RSA_WITH_AES_128_GCM_SHA256( - 0x009C, Protocol.TLSV1_2, Protocol.TLSV1_2), + 0x009C, KeyExAlgorithm.RSA, Protocol.TLSV1_2, Protocol.TLSV1_2), TLS_DH_anon_WITH_AES_256_CBC_SHA256( - 0x006D, Protocol.TLSV1_2, Protocol.TLSV1_2), + 0x006D, KeyExAlgorithm.DH_ANON, Protocol.TLSV1_2, Protocol.TLSV1_2), TLS_DH_anon_WITH_AES_128_CBC_SHA256( - 0x006C, Protocol.TLSV1_2, Protocol.TLSV1_2), + 0x006C, KeyExAlgorithm.DH_ANON, Protocol.TLSV1_2, Protocol.TLSV1_2), TLS_DHE_RSA_WITH_AES_256_CBC_SHA256( - 0x006B, Protocol.TLSV1_2, Protocol.TLSV1_2), + 0x006B, KeyExAlgorithm.DHE_RSA, Protocol.TLSV1_2, Protocol.TLSV1_2), TLS_DHE_DSS_WITH_AES_256_CBC_SHA256( - 0x006A, Protocol.TLSV1_2, Protocol.TLSV1_2), + 0x006A, KeyExAlgorithm.DHE_DSS, Protocol.TLSV1_2, Protocol.TLSV1_2), TLS_DHE_RSA_WITH_AES_128_CBC_SHA256( - 0x0067, Protocol.TLSV1_2, Protocol.TLSV1_2), + 0x0067, KeyExAlgorithm.DHE_RSA, Protocol.TLSV1_2, Protocol.TLSV1_2), TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA( - 0x004C, Protocol.TLSV1, Protocol.TLSV1_2), + 0x004C, KeyExAlgorithm.ECDH_ECDSA, Protocol.TLSV1, Protocol.TLSV1_2), TLS_DHE_DSS_WITH_AES_128_CBC_SHA256( - 0x0040, Protocol.TLSV1_2, Protocol.TLSV1_2), + 0x0040, KeyExAlgorithm.DHE_DSS, Protocol.TLSV1_2, Protocol.TLSV1_2), TLS_RSA_WITH_AES_256_CBC_SHA256( - 0x003D, Protocol.TLSV1_2, Protocol.TLSV1_2), + 0x003D, KeyExAlgorithm.RSA, Protocol.TLSV1_2, Protocol.TLSV1_2), TLS_RSA_WITH_AES_128_CBC_SHA256( - 0x003C, Protocol.TLSV1_2, Protocol.TLSV1_2), + 0x003C, KeyExAlgorithm.RSA, Protocol.TLSV1_2, Protocol.TLSV1_2), TLS_RSA_WITH_NULL_SHA256( - 0x003B, Protocol.TLSV1_2, Protocol.TLSV1_2), + 0x003B, KeyExAlgorithm.RSA, Protocol.TLSV1_2, Protocol.TLSV1_2), TLS_DH_anon_WITH_AES_256_CBC_SHA( - 0x003A, Protocol.SSLV3, Protocol.TLSV1_2), + 0x003A, KeyExAlgorithm.DH_ANON, Protocol.SSLV3, Protocol.TLSV1_2), TLS_DHE_RSA_WITH_AES_256_CBC_SHA( - 0x0039, Protocol.TLSV1, Protocol.TLSV1_2), + 0x0039, KeyExAlgorithm.DHE_RSA, Protocol.TLSV1, Protocol.TLSV1_2), TLS_DHE_DSS_WITH_AES_256_CBC_SHA( - 0x0038, Protocol.TLSV1_2, Protocol.TLSV1_2), + 0x0038, KeyExAlgorithm.DHE_DSS, Protocol.TLSV1_2, Protocol.TLSV1_2), TLS_RSA_WITH_AES_256_CBC_SHA( - 0x0035, Protocol.SSLV3, Protocol.TLSV1_2), + 0x0035, KeyExAlgorithm.RSA, Protocol.SSLV3, Protocol.TLSV1_2), TLS_DH_anon_WITH_AES_128_CBC_SHA( - 0x0034, Protocol.SSLV3, Protocol.TLSV1_2), + 0x0034, KeyExAlgorithm.DH_ANON, Protocol.SSLV3, Protocol.TLSV1_2), TLS_DHE_RSA_WITH_AES_128_CBC_SHA( - 0x0033, Protocol.SSLV3, Protocol.TLSV1_2), + 0x0033, KeyExAlgorithm.DHE_RSA, Protocol.SSLV3, Protocol.TLSV1_2), TLS_DHE_DSS_WITH_AES_128_CBC_SHA( - 0x0032, Protocol.TLSV1_2, Protocol.TLSV1_2), + 0x0032, KeyExAlgorithm.DHE_DSS, Protocol.TLSV1_2, Protocol.TLSV1_2), TLS_RSA_WITH_AES_128_CBC_SHA( - 0x002F, Protocol.SSLV3, Protocol.TLSV1_2), + 0x002F, KeyExAlgorithm.RSA, Protocol.SSLV3, Protocol.TLSV1_2), TLS_KRB5_WITH_3DES_EDE_CBC_MD5( - 0x0023, Protocol.SSLV3, Protocol.TLSV1_2), + 0x0023, KeyExAlgorithm.KRB5, Protocol.SSLV3, Protocol.TLSV1_2), TLS_KRB5_WITH_DES_CBC_MD5( - 0x0022, Protocol.SSLV3, Protocol.TLSV1_1), + 0x0022,KeyExAlgorithm.KRB5, Protocol.SSLV3, Protocol.TLSV1_1), TLS_KRB5_WITH_3DES_EDE_CBC_SHA( - 0x001F, Protocol.SSLV3, Protocol.TLSV1_2), + 0x001F, KeyExAlgorithm.KRB5, Protocol.SSLV3, Protocol.TLSV1_2), TLS_KRB5_WITH_DES_CBC_SHA( - 0x001E, Protocol.SSLV3, Protocol.TLSV1_2), + 0x001E, KeyExAlgorithm.KRB5, Protocol.SSLV3, Protocol.TLSV1_2), SSL_DH_anon_WITH_3DES_EDE_CBC_SHA( - 0x001B, Protocol.SSLV3, Protocol.TLSV1_2), + 0x001B, KeyExAlgorithm.DH_ANON, Protocol.SSLV3, Protocol.TLSV1_2), SSL_DH_anon_WITH_DES_CBC_SHA( - 0x001A, Protocol.SSLV3, Protocol.TLSV1_1), + 0x001A, KeyExAlgorithm.DH_ANON, Protocol.SSLV3, Protocol.TLSV1_1), SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA( - 0x0019, Protocol.SSLV3, Protocol.TLSV1), + 0x0019, KeyExAlgorithm.DH_ANON_EXPORT, Protocol.SSLV3, Protocol.TLSV1), SSL_DH_anon_WITH_RC4_128_MD5( - 0x0018, Protocol.SSLV3, Protocol.TLSV1_2), + 0x0018, KeyExAlgorithm.DH_ANON, Protocol.SSLV3, Protocol.TLSV1_2), SSL_DH_anon_EXPORT_WITH_RC4_40_MD5( - 0x0017, Protocol.SSLV3, Protocol.TLSV1), + 0x0017, KeyExAlgorithm.DH_ANON_EXPORT, Protocol.SSLV3, Protocol.TLSV1), SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA( - 0x0016, Protocol.SSLV3, Protocol.TLSV1_2), + 0x0016, KeyExAlgorithm.DHE_RSA, Protocol.SSLV3, Protocol.TLSV1_2), SSL_DHE_RSA_WITH_DES_CBC_SHA( - 0x0015, Protocol.SSLV3, Protocol.TLSV1_1), + 0x0015, KeyExAlgorithm.DHE_RSA, Protocol.SSLV3, Protocol.TLSV1_1), SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA( - 0x0014, Protocol.SSLV3, Protocol.TLSV1), + 0x0014, KeyExAlgorithm.DHE_RSA_EXPORT, Protocol.SSLV3, Protocol.TLSV1), SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA( - 0x0013, Protocol.SSLV3, Protocol.TLSV1_2), + 0x0013, KeyExAlgorithm.DHE_DSS, Protocol.SSLV3, Protocol.TLSV1_2), SSL_DHE_DSS_WITH_DES_CBC_SHA( - 0x0012, Protocol.SSLV3, Protocol.TLSV1_1), + 0x0012, KeyExAlgorithm.DHE_DSS, Protocol.SSLV3, Protocol.TLSV1_1), SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA( - 0x0011, Protocol.SSLV3, Protocol.TLSV1), + 0x0011, KeyExAlgorithm.DHE_DSS_EXPORT, Protocol.SSLV3, Protocol.TLSV1), SSL_RSA_WITH_3DES_EDE_CBC_SHA( - 0x000A, Protocol.SSLV3, Protocol.TLSV1_2), + 0x000A, KeyExAlgorithm.RSA, Protocol.SSLV3, Protocol.TLSV1_2), SSL_RSA_WITH_DES_CBC_SHA( - 0x0009, Protocol.SSLV3, Protocol.TLSV1_1), + 0x0009, KeyExAlgorithm.RSA, Protocol.SSLV3, Protocol.TLSV1_1), SSL_RSA_EXPORT_WITH_DES40_CBC_SHA( - 0x0008, Protocol.SSLV3, Protocol.TLSV1), + 0x0008, KeyExAlgorithm.RSA_EXPORT, Protocol.SSLV3, Protocol.TLSV1), SSL_RSA_WITH_RC4_128_SHA( - 0x0005, Protocol.SSLV3, Protocol.TLSV1_2), + 0x0005, KeyExAlgorithm.RSA, Protocol.SSLV3, Protocol.TLSV1_2), SSL_RSA_WITH_RC4_128_MD5( - 0x0004, Protocol.SSLV3, Protocol.TLSV1_2), + 0x0004, KeyExAlgorithm.RSA, Protocol.SSLV3, Protocol.TLSV1_2), SSL_RSA_EXPORT_WITH_RC4_40_MD5( - 0x0003, Protocol.SSLV3, Protocol.TLSV1), + 0x0003, KeyExAlgorithm.RSA_EXPORT, Protocol.SSLV3, Protocol.TLSV1), SSL_RSA_WITH_NULL_SHA( - 0x0002, Protocol.SSLV3, Protocol.TLSV1_2), + 0x0002, KeyExAlgorithm.RSA, Protocol.SSLV3, Protocol.TLSV1_2), SSL_RSA_WITH_NULL_MD5( - 0x0001, Protocol.SSLV3, Protocol.TLSV1_2); + 0x0001, KeyExAlgorithm.RSA, Protocol.SSLV3, Protocol.TLSV1_2); public final int id; + public final KeyExAlgorithm keyExAlgorithm; public final Protocol startProtocol; public final Protocol endProtocol; private CipherSuite( int id, + KeyExAlgorithm keyExAlgorithm, Protocol startProtocol, Protocol endProtocol) { this.id = id; + this.keyExAlgorithm = keyExAlgorithm; this.startProtocol = startProtocol; this.endProtocol = endProtocol; } diff --git a/test/jdk/javax/net/ssl/TLSCommon/KeyExAlgorithm.java b/test/jdk/javax/net/ssl/TLSCommon/KeyExAlgorithm.java new file mode 100644 index 00000000000..fea98880b75 --- /dev/null +++ b/test/jdk/javax/net/ssl/TLSCommon/KeyExAlgorithm.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * Key exchange algorithms. + */ +public enum KeyExAlgorithm { + + DH_ANON, + DH_ANON_EXPORT, + DHE_DSS, + DHE_DSS_EXPORT, + DHE_RSA, + DHE_RSA_EXPORT, + ECDH_ANON, + ECDH_ECDSA, + ECDH_RSA, + ECDHE_ECDSA, + ECDHE_RSA, + KRB5, + RSA, + RSA_EXPORT, + SCSV +} From d63acb557ce9ed296afb612a22e06a7e13a11d77 Mon Sep 17 00:00:00 2001 From: Jean Christophe Beyler Date: Wed, 17 Oct 2018 21:28:11 -0700 Subject: [PATCH 48/66] 8211899: Remove the NSK_CPP_STUB macros from vmTestbase for jvmti/scenarios/[E-M] Remove the NSK_CPP_STUB macros from tests Reviewed-by: amenkov, phh, sspitsyn --- .../events/EM02/em02t006/em02t006.cpp | 26 ++- .../events/EM02/em02t007/em02t007.cpp | 50 ++---- .../events/EM02/em02t008/em02t008.cpp | 52 ++---- .../events/EM02/em02t009/em02t009.cpp | 50 ++---- .../events/EM02/em02t010/em02t010.cpp | 39 ++--- .../events/EM02/em02t011/em02t011.cpp | 33 ++-- .../events/EM02/em02t012/em02t012.cpp | 38 ++--- .../events/EM04/em04t001/em04t001.cpp | 13 +- .../events/EM05/em05t001/em05t001.cpp | 25 +-- .../events/EM05/em05t002/em05t002.cpp | 24 +-- .../events/EM06/em06t001/em06t001.cpp | 31 ++-- .../events/EM07/em07t001/em07t001.cpp | 18 +-- .../events/EM07/em07t002/em07t002.cpp | 37 ++--- .../extension/EX03/ex03t001/ex03t001.cpp | 42 ++--- .../GF01/gf01t001/gf01t001.cpp | 24 +-- .../GF04/gf04t001/gf04t001.cpp | 39 ++--- .../GF06/gf06t001/gf06t001.cpp | 15 +- .../GF08/gf08t001/gf08t001.cpp | 3 +- .../GF08/gf08t002/gf08t002.cpp | 3 +- .../GF08/gf08t003/gf08t003.cpp | 3 +- .../hotswap/HS103/hs103t002/hs103t002.cpp | 30 ++-- .../hotswap/HS104/hs104t002/hs104t002.cpp | 9 +- .../hotswap/HS201/hs201t001/hs201t001.cpp | 148 ++++++------------ .../hotswap/HS201/hs201t002/hs201t002.cpp | 148 ++++++------------ .../hotswap/HS201/hs201t003/hs201t003.cpp | 55 +++---- .../hotswap/HS203/hs203t003/hs203t003.cpp | 34 ++-- .../hotswap/HS203/hs203t004/hs203t004.cpp | 46 +++--- .../hotswap/HS204/hs204t001/hs204t001.cpp | 20 +-- .../hotswap/HS204/hs204t003/hs204t003.cpp | 48 +++--- .../hotswap/HS301/hs301t001/hs301t001.cpp | 13 +- .../hotswap/HS301/hs301t002/hs301t002.cpp | 7 +- .../hotswap/HS301/hs301t003/hs301t003.cpp | 12 +- .../hotswap/HS301/hs301t004/hs301t004.cpp | 12 +- .../JI01/ji01t001/ji01t001.cpp | 133 ++-------------- .../JI06/ji06t001/ji06t001.cpp | 9 +- .../multienv/MA02/ma02t001/ma02t001.cpp | 6 +- .../multienv/MA02/ma02t001/ma02t001a.cpp | 6 +- .../multienv/MA03/ma03t001/ma03t001.cpp | 9 +- .../multienv/MA04/ma04t001/ma04t001.cpp | 31 ++-- .../multienv/MA04/ma04t001/ma04t001a.cpp | 31 ++-- .../multienv/MA04/ma04t002/ma04t002.cpp | 74 +++++---- .../multienv/MA04/ma04t002/ma04t002a.cpp | 72 ++++----- .../multienv/MA04/ma04t003/ma04t003.cpp | 25 ++- .../multienv/MA04/ma04t003/ma04t003a.cpp | 25 ++- .../multienv/MA05/ma05t001/ma05t001.cpp | 55 +++---- .../multienv/MA05/ma05t001/ma05t001a.cpp | 57 +++---- .../multienv/MA06/ma06t001/ma06t001.cpp | 21 +-- .../multienv/MA06/ma06t001/ma06t001a.cpp | 21 +-- .../multienv/MA07/ma07t001/ma07t001.cpp | 6 +- .../multienv/MA07/ma07t001/ma07t001a.cpp | 6 +- 50 files changed, 597 insertions(+), 1137 deletions(-) diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t006/em02t006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t006/em02t006.cpp index 4eca9ec921d..40d3ecea4bd 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t006/em02t006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t006/em02t006.cpp @@ -57,7 +57,7 @@ JNIEXPORT jboolean JNICALL Java_nsk_jvmti_scenarios_events_EM02_em02t006_setTag(JNIEnv *env, jobject o, jobject object, jlong tag) { - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, object, tag))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetTag(object, tag))) { NSK_COMPLAIN0("TEST FAILED: unable to set tag for a tested object\n"); return NSK_FALSE; } @@ -148,12 +148,12 @@ int checkEvents(int step) { static void changeCount(jvmtiEvent event, int *currentCounts) { - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, syncLock))) + if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(syncLock))) nsk_jvmti_setFailStatus(); currentCounts[event - JVMTI_MIN_EVENT_TYPE_VAL]++; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, syncLock))) + if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(syncLock))) nsk_jvmti_setFailStatus(); } @@ -173,8 +173,7 @@ cbVMDeath(jvmtiEnv* jvmti, JNIEnv* jni_env) { if (!checkEvents(STEP_NUMBER)) nsk_jvmti_setFailStatus(); - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2(DestroyRawMonitor, jvmti, syncLock))) + if (!NSK_JVMTI_VERIFY(jvmti->DestroyRawMonitor(syncLock))) nsk_jvmti_setFailStatus(); } @@ -329,16 +328,13 @@ static int enableEvent(jvmtiEvent event) { if (nsk_jvmti_isOptionalEvent(event) && (event != JVMTI_EVENT_OBJECT_FREE)) { if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, - NSK_CPP_STUB4(SetEventNotificationMode, jvmti, - JVMTI_ENABLE, event, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return NSK_FALSE; } } else { - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB4(SetEventNotificationMode, jvmti, - JVMTI_ENABLE, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return NSK_FALSE; @@ -431,10 +427,7 @@ setCallBacks(int step) { break; } - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(SetEventCallbacks, jvmti, - &eventCallbacks, - sizeof(eventCallbacks)))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) return NSK_FALSE; return NSK_TRUE; @@ -495,8 +488,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) return JNI_ERR; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(CreateRawMonitor, jvmti, "_syncLock", &syncLock))) { + if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { nsk_jvmti_setFailStatus(); return JNI_ERR; } @@ -507,7 +499,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { caps.can_tag_objects = 1; caps.can_generate_object_free_events = 1; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) + if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t007/em02t007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t007/em02t007.cpp index ba9fc136c6d..9afb751bd82 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t007/em02t007.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t007/em02t007.cpp @@ -133,12 +133,12 @@ int checkEvents(int step) { static void changeCount(jvmtiEvent event, int *currentCounts) { - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, syncLock))) + if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(syncLock))) nsk_jvmti_setFailStatus(); currentCounts[event - JVMTI_MIN_EVENT_TYPE_VAL]++; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, syncLock))) + if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(syncLock))) nsk_jvmti_setFailStatus(); } @@ -158,8 +158,7 @@ cbVMDeath(jvmtiEnv* jvmti, JNIEnv* jni_env) { if (!checkEvents(STEP_NUMBER)) nsk_jvmti_setFailStatus(); - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2(DestroyRawMonitor, jvmti, syncLock))) + if (!NSK_JVMTI_VERIFY(jvmti->DestroyRawMonitor(syncLock))) nsk_jvmti_setFailStatus(); } @@ -184,9 +183,7 @@ cbSingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, char *sign; char *genc; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB5( - GetMethodName, jvmti_env, method, &name, &sign, &genc))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sign, &genc))) { nsk_jvmti_setFailStatus(); return; } @@ -197,17 +194,14 @@ cbSingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, changeCount(JVMTI_EVENT_SINGLE_STEP, &eventCount[0]); } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*)name))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)name))) { nsk_jvmti_setFailStatus(); } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*)sign))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)sign))) { nsk_jvmti_setFailStatus(); } if (genc != NULL) - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*)genc))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)genc))) { nsk_jvmti_setFailStatus(); } } @@ -219,9 +213,7 @@ cbNewSingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, char *sign; char *genc; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB5( - GetMethodName, jvmti_env, method, &name, &sign, &genc))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sign, &genc))) { nsk_jvmti_setFailStatus(); return; } @@ -232,17 +224,14 @@ cbNewSingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, changeCount(JVMTI_EVENT_SINGLE_STEP, &newEventCount[0]); } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*)name))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)name))) { nsk_jvmti_setFailStatus(); } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*)sign))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)sign))) { nsk_jvmti_setFailStatus(); } if (genc != NULL) - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*)genc))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)genc))) { nsk_jvmti_setFailStatus(); } } @@ -368,16 +357,13 @@ static int enableEvent(jvmtiEvent event) { if (nsk_jvmti_isOptionalEvent(event) && (event != JVMTI_EVENT_SINGLE_STEP)) { if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, - NSK_CPP_STUB4(SetEventNotificationMode, jvmti, - JVMTI_ENABLE, event, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return NSK_FALSE; } } else { - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB4(SetEventNotificationMode, jvmti, - JVMTI_ENABLE, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return NSK_FALSE; @@ -477,10 +463,7 @@ setCallBacks(int step) { break; } - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(SetEventCallbacks, jvmti, - &eventCallbacks, - sizeof(eventCallbacks)))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) return NSK_FALSE; return NSK_TRUE; @@ -541,8 +524,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) return JNI_ERR; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(CreateRawMonitor, jvmti, "_syncLock", &syncLock))) { + if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { nsk_jvmti_setFailStatus(); return JNI_ERR; } @@ -552,7 +534,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { memset(&caps, 0, sizeof(caps)); caps.can_generate_single_step_events = 1; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) + if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t008/em02t008.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t008/em02t008.cpp index d1d6e041d1d..51a29f81182 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t008/em02t008.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t008/em02t008.cpp @@ -132,12 +132,12 @@ int checkEvents(int step) { static void changeCount(jvmtiEvent event, int *currentCounts) { - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, syncLock))) + if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(syncLock))) nsk_jvmti_setFailStatus(); currentCounts[event - JVMTI_MIN_EVENT_TYPE_VAL]++; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, syncLock))) + if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(syncLock))) nsk_jvmti_setFailStatus(); } @@ -157,8 +157,7 @@ cbVMDeath(jvmtiEnv* jvmti, JNIEnv* jni_env) { if (!checkEvents(STEP_NUMBER)) nsk_jvmti_setFailStatus(); - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2(DestroyRawMonitor, jvmti, syncLock))) + if (!NSK_JVMTI_VERIFY(jvmti->DestroyRawMonitor(syncLock))) nsk_jvmti_setFailStatus(); } @@ -170,9 +169,7 @@ cbException(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, jvmtiThreadInfo info_ptr; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3( - GetThreadInfo, jvmti_env, thread, &info_ptr))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetThreadInfo(thread, &info_ptr))) { nsk_jvmti_setFailStatus(); return; } @@ -183,8 +180,7 @@ cbException(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, changeCount(JVMTI_EVENT_EXCEPTION, &eventCount[0]); } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*)info_ptr.name))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)info_ptr.name))) { nsk_jvmti_setFailStatus(); } } @@ -196,9 +192,7 @@ cbNewException(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, jvmtiThreadInfo info_ptr; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3( - GetThreadInfo, jvmti_env, thread, &info_ptr))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetThreadInfo(thread, &info_ptr))) { nsk_jvmti_setFailStatus(); return; } @@ -209,8 +203,7 @@ cbNewException(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, changeCount(JVMTI_EVENT_EXCEPTION, &newEventCount[0]); } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*)info_ptr.name))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)info_ptr.name))) { nsk_jvmti_setFailStatus(); } } @@ -221,9 +214,7 @@ cbExceptionCatch(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, jvmtiThreadInfo info_ptr; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3( - GetThreadInfo, jvmti_env, thread, &info_ptr))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetThreadInfo(thread, &info_ptr))) { nsk_jvmti_setFailStatus(); return; } @@ -234,8 +225,7 @@ cbExceptionCatch(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, changeCount(JVMTI_EVENT_EXCEPTION_CATCH, &eventCount[0]); } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*)info_ptr.name))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)info_ptr.name))) { nsk_jvmti_setFailStatus(); } } @@ -246,9 +236,7 @@ cbNewExceptionCatch(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, jvmtiThreadInfo info_ptr; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3( - GetThreadInfo, jvmti_env, thread, &info_ptr))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetThreadInfo(thread, &info_ptr))) { nsk_jvmti_setFailStatus(); return; } @@ -259,8 +247,7 @@ cbNewExceptionCatch(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, changeCount(JVMTI_EVENT_EXCEPTION_CATCH, &newEventCount[0]); } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*)info_ptr.name))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)info_ptr.name))) { nsk_jvmti_setFailStatus(); } } @@ -390,16 +377,13 @@ static int enableEvent(jvmtiEvent event) { && (event != JVMTI_EVENT_EXCEPTION) && (event != JVMTI_EVENT_EXCEPTION_CATCH)) { if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, - NSK_CPP_STUB4(SetEventNotificationMode, jvmti, - JVMTI_ENABLE, event, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return NSK_FALSE; } } else { - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB4(SetEventNotificationMode, jvmti, - JVMTI_ENABLE, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return NSK_FALSE; @@ -493,10 +477,7 @@ setCallBacks(int step) { break; } - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(SetEventCallbacks, jvmti, - &eventCallbacks, - sizeof(eventCallbacks)))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) return NSK_FALSE; return NSK_TRUE; @@ -555,8 +536,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) return JNI_ERR; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(CreateRawMonitor, jvmti, "_syncLock", &syncLock))) { + if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { nsk_jvmti_setFailStatus(); return JNI_ERR; } @@ -566,7 +546,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { memset(&caps, 0, sizeof(caps)); caps.can_generate_exception_events = 1; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) + if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t009/em02t009.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t009/em02t009.cpp index 5087a51eed7..979386ee212 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t009/em02t009.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t009/em02t009.cpp @@ -143,12 +143,12 @@ int checkEvents(int step) { static void changeCount(jvmtiEvent event, int *currentCounts) { - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, syncLock))) + if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(syncLock))) nsk_jvmti_setFailStatus(); currentCounts[event - JVMTI_MIN_EVENT_TYPE_VAL]++; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, syncLock))) + if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(syncLock))) nsk_jvmti_setFailStatus(); } @@ -168,8 +168,7 @@ cbVMDeath(jvmtiEnv* jvmti, JNIEnv* jni_env) { if (!checkEvents(STEP_NUMBER)) nsk_jvmti_setFailStatus(); - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2(DestroyRawMonitor, jvmti, syncLock))) + if (!NSK_JVMTI_VERIFY(jvmti->DestroyRawMonitor(syncLock))) nsk_jvmti_setFailStatus(); } @@ -229,9 +228,7 @@ void handler1(jvmtiEnv *jvmti_env, jvmtiEvent event, jmethodID method) { char *sign; char *genc; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB5( - GetMethodName, jvmti_env, method, &name, &sign, &genc))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sign, &genc))) { nsk_jvmti_setFailStatus(); return; } @@ -240,17 +237,14 @@ void handler1(jvmtiEnv *jvmti_env, jvmtiEvent event, jmethodID method) { changeCount(event, &eventCount[0]); } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*)name))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)name))) { nsk_jvmti_setFailStatus(); } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*)sign))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)sign))) { nsk_jvmti_setFailStatus(); } if (genc != NULL) - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*)genc))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)genc))) { nsk_jvmti_setFailStatus(); } } @@ -276,9 +270,7 @@ void handler2(jvmtiEnv *jvmti_env, jvmtiEvent event, jmethodID method) { char *sign; char *genc; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB5( - GetMethodName, jvmti_env, method, &name, &sign, &genc))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sign, &genc))) { nsk_jvmti_setFailStatus(); return; } @@ -287,17 +279,14 @@ void handler2(jvmtiEnv *jvmti_env, jvmtiEvent event, jmethodID method) { changeCount(event, &newEventCount[0]); } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*)name))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)name))) { nsk_jvmti_setFailStatus(); } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*)sign))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)sign))) { nsk_jvmti_setFailStatus(); } if (genc != NULL) - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*)genc))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)genc))) { nsk_jvmti_setFailStatus(); } } @@ -395,16 +384,13 @@ static int enableEvent(jvmtiEvent event) { && (event != JVMTI_EVENT_METHOD_ENTRY) && (event != JVMTI_EVENT_METHOD_EXIT)) { if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, - NSK_CPP_STUB4(SetEventNotificationMode, jvmti, - JVMTI_ENABLE, event, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return NSK_FALSE; } } else { - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB4(SetEventNotificationMode, jvmti, - JVMTI_ENABLE, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return NSK_FALSE; @@ -498,10 +484,7 @@ setCallBacks(int step) { break; } - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(SetEventCallbacks, jvmti, - &eventCallbacks, - sizeof(eventCallbacks)))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) return NSK_FALSE; return NSK_TRUE; @@ -560,8 +543,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) return JNI_ERR; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(CreateRawMonitor, jvmti, "_syncLock", &syncLock))) { + if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { nsk_jvmti_setFailStatus(); return JNI_ERR; } @@ -572,7 +554,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { caps.can_generate_method_entry_events = 1; caps.can_generate_method_exit_events = 1; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) + if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t010/em02t010.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t010/em02t010.cpp index ac12b95dcb2..baea21338d3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t010/em02t010.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t010/em02t010.cpp @@ -148,12 +148,12 @@ int checkEvents(int step) { static void changeCount(jvmtiEvent event, int *currentCounts) { - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, syncLock))) + if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(syncLock))) nsk_jvmti_setFailStatus(); currentCounts[event - JVMTI_MIN_EVENT_TYPE_VAL]++; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, syncLock))) + if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(syncLock))) nsk_jvmti_setFailStatus(); } @@ -173,8 +173,7 @@ cbVMDeath(jvmtiEnv* jvmti, JNIEnv* jni_env) { if (!checkEvents(STEP_NUMBER)) nsk_jvmti_setFailStatus(); - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2(DestroyRawMonitor, jvmti, syncLock))) + if (!NSK_JVMTI_VERIFY(jvmti->DestroyRawMonitor(syncLock))) nsk_jvmti_setFailStatus(); } @@ -340,16 +339,13 @@ static int enableEvent(jvmtiEvent event) { && (event != JVMTI_EVENT_FIELD_MODIFICATION) && (event != JVMTI_EVENT_FIELD_ACCESS)) { if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, - NSK_CPP_STUB4(SetEventNotificationMode, jvmti, - JVMTI_ENABLE, event, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return NSK_FALSE; } } else { - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB4(SetEventNotificationMode, jvmti, - JVMTI_ENABLE, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return NSK_FALSE; @@ -443,10 +439,7 @@ setCallBacks(int step) { break; } - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(SetEventCallbacks, jvmti, - &eventCallbacks, - sizeof(eventCallbacks)))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) return NSK_FALSE; return NSK_TRUE; @@ -466,26 +459,21 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { if (!nsk_jvmti_waitForSync(timeout)) return; - if (!NSK_JNI_VERIFY(agentJNI, (cls = - NSK_CPP_STUB2(FindClass, agentJNI, CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(agentJNI, (cls = agentJNI->FindClass(CLASS_NAME)) != NULL)) return; if (!NSK_JNI_VERIFY(agentJNI, (field_accID = - NSK_CPP_STUB4(GetStaticFieldID, agentJNI, cls, FIELD_ACC_NAME, - "I")) != NULL)) + agentJNI->GetStaticFieldID(cls, FIELD_ACC_NAME, "I")) != NULL)) return; if (!NSK_JNI_VERIFY(agentJNI, (field_modID = - NSK_CPP_STUB4(GetStaticFieldID, agentJNI, cls, FIELD_MOD_NAME, - "I")) != NULL)) + agentJNI->GetStaticFieldID(cls, FIELD_MOD_NAME, "I")) != NULL)) return; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(SetFieldModificationWatch, jvmti, cls, field_modID))) + if (!NSK_JVMTI_VERIFY(jvmti->SetFieldModificationWatch(cls, field_modID))) return; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(SetFieldAccessWatch, jvmti, cls, field_accID))) + if (!NSK_JVMTI_VERIFY(jvmti->SetFieldAccessWatch(cls, field_accID))) return; if (!nsk_jvmti_resumeSync()) @@ -536,8 +524,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) return JNI_ERR; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(CreateRawMonitor, jvmti, "_syncLock", &syncLock))) { + if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { nsk_jvmti_setFailStatus(); return JNI_ERR; } @@ -548,7 +535,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { caps.can_generate_field_modification_events = 1; caps.can_generate_field_access_events = 1; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) + if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t011/em02t011.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t011/em02t011.cpp index 47a1da2ac74..a145db72100 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t011/em02t011.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t011/em02t011.cpp @@ -144,12 +144,12 @@ int checkEvents(int step) { static void changeCount(jvmtiEvent event, int *currentCounts) { - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, syncLock))) + if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(syncLock))) nsk_jvmti_setFailStatus(); currentCounts[event - JVMTI_MIN_EVENT_TYPE_VAL]++; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, syncLock))) + if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(syncLock))) nsk_jvmti_setFailStatus(); } @@ -169,8 +169,7 @@ cbVMDeath(jvmtiEnv* jvmti, JNIEnv* jni_env) { if (!checkEvents(STEP_NUMBER)) nsk_jvmti_setFailStatus(); - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2(DestroyRawMonitor, jvmti, syncLock))) + if (!NSK_JVMTI_VERIFY(jvmti->DestroyRawMonitor(syncLock))) nsk_jvmti_setFailStatus(); } @@ -326,16 +325,13 @@ static int enableEvent(jvmtiEvent event) { if (nsk_jvmti_isOptionalEvent(event) && (event != JVMTI_EVENT_BREAKPOINT)) { if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, - NSK_CPP_STUB4(SetEventNotificationMode, jvmti, - JVMTI_ENABLE, event, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return NSK_FALSE; } } else { - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB4(SetEventNotificationMode, jvmti, - JVMTI_ENABLE, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return NSK_FALSE; @@ -428,10 +424,7 @@ setCallBacks(int step) { break; } - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(SetEventCallbacks, jvmti, - &eventCallbacks, - sizeof(eventCallbacks)))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) return NSK_FALSE; return NSK_TRUE; @@ -451,17 +444,14 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { if (!nsk_jvmti_waitForSync(timeout)) return; - if (!NSK_JNI_VERIFY(agentJNI, (cls = - NSK_CPP_STUB2(FindClass, agentJNI, CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(agentJNI, (cls = agentJNI->FindClass(CLASS_NAME)) != NULL)) return; if (!NSK_JNI_VERIFY(agentJNI, (methodID = - NSK_CPP_STUB4(GetStaticMethodID, agentJNI, cls, METHOD_NAME, - "()I")) != NULL)) + agentJNI->GetStaticMethodID(cls, METHOD_NAME, "()I")) != NULL)) return; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(SetBreakpoint, jvmti, methodID, 0))) + if (!NSK_JVMTI_VERIFY(jvmti->SetBreakpoint(methodID, 0))) return; if (!nsk_jvmti_resumeSync()) @@ -512,8 +502,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) return JNI_ERR; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(CreateRawMonitor, jvmti, "_syncLock", &syncLock))) { + if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { nsk_jvmti_setFailStatus(); return JNI_ERR; } @@ -523,7 +512,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { memset(&caps, 0, sizeof(caps)); caps.can_generate_breakpoint_events = 1; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) + if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t012/em02t012.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t012/em02t012.cpp index 50f0c586b0b..185ae70bf31 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t012/em02t012.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t012/em02t012.cpp @@ -52,8 +52,7 @@ Java_nsk_jvmti_scenarios_events_EM02_em02t012_setThread(JNIEnv *jni_env, jobject o, jthread thrd) { /* make thread accessable for a long time */ - NSK_JNI_VERIFY(jni_env, (testedThread = - NSK_CPP_STUB2(NewGlobalRef, jni_env, thrd)) != NULL); + NSK_JNI_VERIFY(jni_env, (testedThread = jni_env->NewGlobalRef(thrd)) != NULL); } static void @@ -151,12 +150,12 @@ int checkEvents(int step) { static void changeCount(jvmtiEvent event, int *currentCounts) { - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, syncLock))) + if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(syncLock))) nsk_jvmti_setFailStatus(); currentCounts[event - JVMTI_MIN_EVENT_TYPE_VAL]++; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, syncLock))) + if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(syncLock))) nsk_jvmti_setFailStatus(); } @@ -176,8 +175,7 @@ cbVMDeath(jvmtiEnv* jvmti, JNIEnv* jni_env) { if (!checkEvents(STEP_NUMBER)) nsk_jvmti_setFailStatus(); - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2(DestroyRawMonitor, jvmti, syncLock))) + if (!NSK_JVMTI_VERIFY(jvmti->DestroyRawMonitor(syncLock))) nsk_jvmti_setFailStatus(); } @@ -331,16 +329,13 @@ static int enableEvent(jvmtiEvent event) { if (nsk_jvmti_isOptionalEvent(event) && (event != JVMTI_EVENT_FRAME_POP)) { if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, - NSK_CPP_STUB4(SetEventNotificationMode, jvmti, - JVMTI_ENABLE, event, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return NSK_FALSE; } } else { - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB4(SetEventNotificationMode, jvmti, - JVMTI_ENABLE, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return NSK_FALSE; @@ -433,10 +428,7 @@ setCallBacks(int step) { break; } - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(SetEventCallbacks, jvmti, - &eventCallbacks, - sizeof(eventCallbacks)))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) return NSK_FALSE; return NSK_TRUE; @@ -455,18 +447,15 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { if (!nsk_jvmti_waitForSync(timeout)) return; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2(SuspendThread, jvmti, testedThread))) + if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(testedThread))) return; for (j = 2; j < 1002; j++) { - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(NotifyFramePop, jvmti, testedThread, j))) + if (!NSK_JVMTI_VERIFY(jvmti->NotifyFramePop(testedThread, j))) return; } - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2(ResumeThread, jvmti, testedThread))) + if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(testedThread))) return; if (!nsk_jvmti_resumeSync()) @@ -489,7 +478,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { return; } - NSK_CPP_STUB2(DeleteGlobalRef, agentJNI, testedThread); + agentJNI->DeleteGlobalRef(testedThread); } /* ============================================================================= */ @@ -516,8 +505,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) return JNI_ERR; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(CreateRawMonitor, jvmti, "_syncLock", &syncLock))) { + if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { nsk_jvmti_setFailStatus(); return JNI_ERR; } @@ -528,7 +516,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { caps.can_suspend = 1; caps.can_generate_frame_pop_events = 1; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) + if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM04/em04t001/em04t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM04/em04t001/em04t001.cpp index a2f4e46d2cd..7c4318f9589 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM04/em04t001/em04t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM04/em04t001/em04t001.cpp @@ -111,9 +111,7 @@ cbDynamicCodeGenerated2(jvmtiEnv *jvmti_env, const char *name, static int enableEvent(jvmtiEventMode enable, jvmtiEvent event) { - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB4(SetEventNotificationMode, jvmti, enable, - event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, event, NULL))) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -129,10 +127,7 @@ int setCallBacks(int stage) { eventCallbacks.DynamicCodeGenerated = (stage == 1) ? cbDynamicCodeGenerated1 : cbDynamicCodeGenerated2; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(SetEventCallbacks, jvmti, - &eventCallbacks, - sizeof(eventCallbacks)))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) return NSK_FALSE; return NSK_TRUE; @@ -153,9 +148,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { return; } - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2(GenerateEvents, jvmti, - JVMTI_EVENT_DYNAMIC_CODE_GENERATED))) + if (!NSK_JVMTI_VERIFY(jvmti->GenerateEvents(JVMTI_EVENT_DYNAMIC_CODE_GENERATED))) nsk_jvmti_setFailStatus(); { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t001/em05t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t001/em05t001.cpp index 760b84b6698..0d36a5c9840 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t001/em05t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t001/em05t001.cpp @@ -127,9 +127,7 @@ static int enableEvents(jvmtiEventMode enable) { int i; for (i = 0; i < EVENTS_COUNT; i++) { - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB4(SetEventNotificationMode, jvmti, enable, - eventsList[i], NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, eventsList[i], NULL))) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -156,28 +154,24 @@ static int prepare() { methodsDesc[i].unloadEvents = 0; } - if (!NSK_JNI_VERIFY(jni, (debugeeClass = - NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (threadFieldID = - NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass, - THREAD_FIELD_NAME, THREAD_FIELD_SIG)) != NULL)) + jni->GetStaticFieldID(debugeeClass, THREAD_FIELD_NAME, THREAD_FIELD_SIG)) != NULL)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (thread = (jthread) - NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass, threadFieldID)) != NULL)) + jni->GetStaticObjectField(debugeeClass, threadFieldID)) != NULL)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (threadClass = - NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (threadClass = jni->GetObjectClass(thread)) != NULL)) return NSK_FALSE; NSK_DISPLAY0("Find tested methods:\n"); for (i = 0; i < METHODS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (methodsDesc[i].method = - NSK_CPP_STUB4(GetMethodID, jni, threadClass, - methodsDesc[i].methodName, methodsDesc[i].methodSig)) != NULL)) + jni->GetMethodID(threadClass, methodsDesc[i].methodName, methodsDesc[i].methodSig)) != NULL)) return NSK_FALSE; NSK_DISPLAY3(" method #%d (%s): 0x%p\n", i, methodsDesc[i].methodName, (void*)methodsDesc[i].method); @@ -327,8 +321,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiCapabilities caps; memset(&caps, 0, sizeof(caps)); caps.can_generate_compiled_method_load_events = 1; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) + if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) return JNI_ERR; } @@ -337,9 +330,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { memset(&eventCallbacks, 0, sizeof(eventCallbacks)); eventCallbacks.CompiledMethodLoad = callbackCompiledMethodLoad; eventCallbacks.CompiledMethodUnload = callbackCompiledMethodUnload; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(SetEventCallbacks, jvmti, - &eventCallbacks, sizeof(eventCallbacks)))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t002/em05t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t002/em05t002.cpp index 1e6ddf0d85a..2566651dab2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t002/em05t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t002/em05t002.cpp @@ -152,8 +152,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { * Generate tested events (COMPILED_METHOD_LOAD only). */ static int generateEvents() { - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2(GenerateEvents, jvmti, JVMTI_EVENT_COMPILED_METHOD_LOAD))) { + if (!NSK_JVMTI_VERIFY(jvmti->GenerateEvents(JVMTI_EVENT_COMPILED_METHOD_LOAD))) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -183,28 +182,24 @@ static int prepare() { } } - if (!NSK_JNI_VERIFY(jni, (debugeeClass = - NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (threadFieldID = - NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass, - THREAD_FIELD_NAME, THREAD_FIELD_SIG)) != NULL)) + jni->GetStaticFieldID(debugeeClass, THREAD_FIELD_NAME, THREAD_FIELD_SIG)) != NULL)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (thread = (jthread) - NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass, threadFieldID)) != NULL)) + jni->GetStaticObjectField(debugeeClass, threadFieldID)) != NULL)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (threadClass = - NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (threadClass = jni->GetObjectClass(thread)) != NULL)) return NSK_FALSE; NSK_DISPLAY0("Find tested methods:\n"); for (i = 0; i < METHODS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (methodsDesc[i].method = - NSK_CPP_STUB4(GetMethodID, jni, threadClass, - methodsDesc[i].methodName, methodsDesc[i].methodSig)) != NULL)) + jni->GetMethodID(threadClass, methodsDesc[i].methodName, methodsDesc[i].methodSig)) != NULL)) return NSK_FALSE; NSK_DISPLAY3(" method #%d (%s): 0x%p\n", i, methodsDesc[i].methodName, (void*)methodsDesc[i].method); @@ -395,8 +390,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiCapabilities caps; memset(&caps, 0, sizeof(caps)); caps.can_generate_compiled_method_load_events = 1; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) + if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) return JNI_ERR; } @@ -405,9 +399,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { memset(&eventCallbacks, 0, sizeof(eventCallbacks)); eventCallbacks.CompiledMethodLoad = callbackCompiledMethodLoad; eventCallbacks.CompiledMethodUnload = callbackCompiledMethodUnload; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(SetEventCallbacks, jvmti, - &eventCallbacks, sizeof(eventCallbacks)))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM06/em06t001/em06t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM06/em06t001/em06t001.cpp index 2920cbff1c6..e52f45dd10d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM06/em06t001/em06t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM06/em06t001/em06t001.cpp @@ -60,26 +60,24 @@ handler(jvmtiEvent event, jvmtiEnv* jvmti, JNIEnv* jni_env, jstring jclassName; const char *className; - if (!NSK_JNI_VERIFY(jni_env, (classObject = - NSK_CPP_STUB2(GetObjectClass, jni_env, klass)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (classObject = jni_env->GetObjectClass(klass)) != NULL)) { nsk_jvmti_setFailStatus(); return; } if (!NSK_JNI_VERIFY(jni_env, (methodID = - NSK_CPP_STUB4(GetMethodID, jni_env, classObject, - "getName", "()Ljava/lang/String;")) != NULL)) { + jni_env->GetMethodID(classObject, "getName", "()Ljava/lang/String;")) != NULL)) { nsk_jvmti_setFailStatus(); return; } - jclassName = (jstring) NSK_CPP_STUB3(CallObjectMethod, jni_env, klass, methodID); + jclassName = (jstring) jni_env->CallObjectMethod(klass, methodID); - className = NSK_CPP_STUB3(GetStringUTFChars, jni_env, jclassName, 0); + className = jni_env->GetStringUTFChars(jclassName, 0); if ( className != NULL && (strcmp(className, EXPECTED_CLASS_NAME)==0) ) { - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, syncLock))) + if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(syncLock))) nsk_jvmti_setFailStatus(); switch (event) { @@ -92,12 +90,12 @@ handler(jvmtiEvent event, jvmtiEnv* jvmti, JNIEnv* jni_env, nsk_jvmti_setFailStatus(); } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, syncLock))) + if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(syncLock))) nsk_jvmti_setFailStatus(); } - NSK_CPP_STUB3(ReleaseStringUTFChars, jni_env, jclassName, className); + jni_env->ReleaseStringUTFChars(jclassName, className); } JNIEXPORT void JNICALL @@ -116,9 +114,7 @@ cbClassPrepare(jvmtiEnv* jvmti, JNIEnv* jni_env, jthread thread, jclass klass) { static int enableEvent(jvmtiEventMode enable, jvmtiEvent event) { - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB4(SetEventNotificationMode, jvmti, enable, - event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, event, NULL))) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -171,10 +167,7 @@ setCallBacks() { eventCallbacks.ClassLoad = cbClassLoad; eventCallbacks.ClassPrepare = cbClassPrepare; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(SetEventCallbacks, jvmti, - &eventCallbacks, - sizeof(eventCallbacks)))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) return NSK_FALSE; return NSK_TRUE; @@ -186,8 +179,7 @@ setCallBacks() { static void JNICALL agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(CreateRawMonitor, jvmti, "_syncLock", &syncLock))) { + if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { nsk_jvmti_setFailStatus(); return; } @@ -230,8 +222,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { if (!nsk_jvmti_resumeSync()) return; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2(DestroyRawMonitor, jvmti, syncLock))) + if (!NSK_JVMTI_VERIFY(jvmti->DestroyRawMonitor(syncLock))) nsk_jvmti_setFailStatus(); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t001/em07t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t001/em07t001.cpp index 1c66a29753e..4aa814611d9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t001/em07t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t001/em07t001.cpp @@ -64,12 +64,12 @@ void showEventStatistics() { void changeCount(jvmtiEvent event) { - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, syncLock))) + if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(syncLock))) nsk_jvmti_setFailStatus(); eventCount[event - JVMTI_MIN_EVENT_TYPE_VAL]++; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, syncLock))) + if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(syncLock))) nsk_jvmti_setFailStatus(); } @@ -87,8 +87,7 @@ JNIEXPORT void JNICALL cbVMDeath(jvmtiEnv* jvmti, JNIEnv* jni_env) { changeCount(JVMTI_EVENT_VM_DEATH); - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2(DestroyRawMonitor, jvmti, syncLock))) + if (!NSK_JVMTI_VERIFY(jvmti->DestroyRawMonitor(syncLock))) nsk_jvmti_setFailStatus(); } @@ -234,8 +233,7 @@ int enableOptionalEvents(jvmtiEnv *jvmti) { jvmtiEvent event = (jvmtiEvent)(i + JVMTI_MIN_EVENT_TYPE_VAL); if (nsk_jvmti_isOptionalEvent(event)) if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, - NSK_CPP_STUB4(SetEventNotificationMode, jvmti, - JVMTI_ENABLE, event, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); result = NSK_FALSE; @@ -309,10 +307,7 @@ static int setCallBacks(jvmtiEnv *jvmti) { eventCallbacks.ObjectFree = cbObjectFree; eventCallbacks.VMObjectAlloc = cbVMObjectAlloc; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(SetEventCallbacks, jvmti, - &eventCallbacks, - sizeof(eventCallbacks)))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) return NSK_FALSE; return NSK_TRUE; @@ -363,8 +358,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) return JNI_ERR; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(CreateRawMonitor, jvmti, "_syncLock", &syncLock))) { + if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { nsk_jvmti_setFailStatus(); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t002/em07t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t002/em07t002.cpp index 8ba450eeef2..77d8db6a073 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t002/em07t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t002/em07t002.cpp @@ -63,9 +63,7 @@ cbCompiledMethodLoad(jvmtiEnv *jvmti_env, jmethodID method, jint code_size, char *sign; char *genc; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB5( - GetMethodName, jvmti_env, method, &name, &sign, &genc))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sign, &genc))) { nsk_jvmti_setFailStatus(); return; } @@ -86,28 +84,25 @@ cbCompiledMethodLoad(jvmtiEnv *jvmti_env, jmethodID method, jint code_size, NSK_DISPLAY0(">>>JVMTI_EVENT_COMPILED_METHOD_LOAD received for\n"); NSK_DISPLAY1("\t\tmethod: %s\n", rec->name); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, syncLock))) + if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(syncLock))) nsk_jvmti_setFailStatus(); methodLoadCount++; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, syncLock))) + if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(syncLock))) nsk_jvmti_setFailStatus(); } } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*)name))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)name))) { nsk_jvmti_setFailStatus(); } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*)sign))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)sign))) { nsk_jvmti_setFailStatus(); } if (genc != NULL) - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*)genc))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)genc))) { nsk_jvmti_setFailStatus(); } } @@ -127,12 +122,12 @@ cbCompiledMethodUnload(jvmtiEnv *jvmti_env, jmethodID method, NSK_DISPLAY0(">>>JVMTI_EVENT_COMPILED_METHOD_UNLOAD received for\n"); NSK_DISPLAY1("\t\tmethod: %s\n", rec->name); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, syncLock))) + if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(syncLock))) nsk_jvmti_setFailStatus(); methodUnloadCount++; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, syncLock))) + if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(syncLock))) nsk_jvmti_setFailStatus(); free(rec); @@ -148,9 +143,7 @@ cbCompiledMethodUnload(jvmtiEnv *jvmti_env, jmethodID method, static int enableEvent(jvmtiEventMode enable, jvmtiEvent event) { - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB4(SetEventNotificationMode, jvmti, enable, - event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, event, NULL))) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -191,9 +184,7 @@ setCallBacks() { eventCallbacks.CompiledMethodLoad = cbCompiledMethodLoad; eventCallbacks.CompiledMethodUnload = cbCompiledMethodUnload; - return NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, - &eventCallbacks, - sizeof(eventCallbacks))); + return NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))); } /* ============================================================================= */ @@ -230,8 +221,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { } - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2(DestroyRawMonitor, jvmti, syncLock))) + if (!NSK_JVMTI_VERIFY(jvmti->DestroyRawMonitor(syncLock))) nsk_jvmti_setFailStatus(); } @@ -260,8 +250,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) return JNI_ERR; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(CreateRawMonitor, jvmti, "_syncLock", &syncLock))) { + if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { nsk_jvmti_setFailStatus(); return JNI_ERR; } @@ -274,7 +263,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { memset(&caps, 0, sizeof(caps)); caps.can_generate_compiled_method_load_events = 1; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) + if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/extension/EX03/ex03t001/ex03t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/extension/EX03/ex03t001/ex03t001.cpp index ef27d27874c..e4032c74e29 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/extension/EX03/ex03t001/ex03t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/extension/EX03/ex03t001/ex03t001.cpp @@ -61,16 +61,13 @@ ClassUnload(jvmtiEnv jvmti_env, JNIEnv *jni_env, jthread thread, jclass klass, . } /* Notify main agent thread */ - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2(RawMonitorEnter, jvmti, eventMon))) { + if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(eventMon))) { nsk_jvmti_setFailStatus(); } - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2(RawMonitorNotify, jvmti, eventMon))) { + if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorNotify(eventMon))) { nsk_jvmti_setFailStatus(); } - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2(RawMonitorExit, jvmti, eventMon))) { + if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(eventMon))) { nsk_jvmti_setFailStatus(); } } @@ -84,8 +81,7 @@ jboolean isClassUnloadingEnabled() { NSK_DISPLAY0("Get extension functions list\n"); - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(GetExtensionFunctions, jvmti, &extCount, &extList))) { + if (!NSK_JVMTI_VERIFY(jvmti->GetExtensionFunctions(&extCount, &extList))) { nsk_jvmti_setFailStatus(); return JNI_FALSE; } @@ -117,8 +113,7 @@ jboolean enableClassUnloadEvent (jboolean enable) { jboolean found = JNI_FALSE; NSK_DISPLAY0("Get extension events list\n"); - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(GetExtensionEvents, jvmti, &extCount, &extList))) { + if (!NSK_JVMTI_VERIFY(jvmti->GetExtensionEvents(&extCount, &extList))) { nsk_jvmti_setFailStatus(); return JNI_FALSE; } @@ -128,8 +123,8 @@ jboolean enableClassUnloadEvent (jboolean enable) { found = JNI_TRUE; if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(SetExtensionEventCallback, jvmti, extList[i].extension_event_index, - enable ? (jvmtiExtensionEvent)ClassUnload : NULL ))) { + jvmti->SetExtensionEventCallback(extList[i].extension_event_index, + enable ? (jvmtiExtensionEvent)ClassUnload : NULL ))) { nsk_jvmti_setFailStatus(); return JNI_FALSE; } @@ -175,16 +170,13 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { break; /* Wait for notifying from event's thread */ - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2(RawMonitorEnter, jvmti, eventMon))) { + if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(eventMon))) { nsk_jvmti_setFailStatus(); } - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(RawMonitorWait, jvmti, eventMon, timeout))) { + if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorWait(eventMon, timeout))) { nsk_jvmti_setFailStatus(); } - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2(RawMonitorExit, jvmti, eventMon))) { + if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(eventMon))) { nsk_jvmti_setFailStatus(); } @@ -202,16 +194,13 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; /* Wait during 10 secs for notifying from event's thread */ - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2(RawMonitorEnter, jvmti, eventMon))) { + if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(eventMon))) { nsk_jvmti_setFailStatus(); } - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(RawMonitorWait, jvmti, eventMon, 10000))) { + if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorWait(eventMon, 10000))) { nsk_jvmti_setFailStatus(); } - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2(RawMonitorExit, jvmti, eventMon))) { + if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(eventMon))) { nsk_jvmti_setFailStatus(); } @@ -230,7 +219,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } while (0); - NSK_TRACE(NSK_CPP_STUB2(DestroyRawMonitor, jvmti, eventMon)); + NSK_TRACE(jvmti->DestroyRawMonitor(eventMon)); NSK_DISPLAY0("Let debugee to finish\n"); if (!NSK_VERIFY(nsk_jvmti_resumeSync())) @@ -262,8 +251,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) return JNI_ERR; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(CreateRawMonitor, jvmti, "eventMon", &eventMon))) { + if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("eventMon", &eventMon))) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF01/gf01t001/gf01t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF01/gf01t001/gf01t001.cpp index 904ab9945a3..430f8b27160 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF01/gf01t001/gf01t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF01/gf01t001/gf01t001.cpp @@ -77,8 +77,7 @@ static void checkProps(jvmtiEnv *jvmti_env, const char *stepMsg) { NSK_DISPLAY1("%s: Getting system property keys ...\n", stepMsg); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetSystemProperties, - jvmti_env, &count, &propKeys))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetSystemProperties(&count, &propKeys))) { result = STATUS_FAILED; return; } @@ -94,8 +93,7 @@ static void checkProps(jvmtiEnv *jvmti_env, const char *stepMsg) { for (i=0; i< count; i++) { NSK_DISPLAY2("%d) getting property for the key \"%s\":\n", i+1, propKeys[i]); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetSystemProperty, - jvmti_env, (const char*) propKeys[i], &prop))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetSystemProperty((const char*) propKeys[i], &prop))) { result = STATUS_FAILED; return; } @@ -105,23 +103,20 @@ static void checkProps(jvmtiEnv *jvmti_env, const char *stepMsg) { foundProps += findProp(propKeys[i]); NSK_DISPLAY0("\tdeallocating system property\n"); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*) prop))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) prop))) { result = STATUS_FAILED; return; } NSK_DISPLAY0("\tdeallocating the system property key\n\n"); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*) propKeys[i]))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) propKeys[i]))) { result = STATUS_FAILED; return; } } /* NSK_DISPLAY0("Deallocating the property key array ...\n"); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*) &propKeys))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) &propKeys))) { result = STATUS_FAILED; return; }*/ @@ -185,17 +180,14 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { (void) memset(&callbacks, 0, sizeof(callbacks)); callbacks.VMInit = &VMInit; callbacks.VMDeath = &VMDeath; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, - jvmti, &callbacks, sizeof(callbacks)))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks)))) return JNI_ERR; NSK_DISPLAY0("setting event callbacks done\nenabling events ...\n"); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode, - jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode, - jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL))) return JNI_ERR; NSK_DISPLAY0("enabling events done\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF04/gf04t001/gf04t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF04/gf04t001/gf04t001.cpp index 95624854c44..a2937f86155 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF04/gf04t001/gf04t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF04/gf04t001/gf04t001.cpp @@ -52,8 +52,7 @@ static int addSegment(jvmtiEnv* jvmti, const char segment[], const char where[]) void* storage = NULL; NSK_DISPLAY1("Add segment: %s\n", segment); - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2(AddToBootstrapClassLoaderSearch, jvmti, segment))) { + if (!NSK_JVMTI_VERIFY(jvmti->AddToBootstrapClassLoaderSearch(segment))) { return NSK_FALSE; } NSK_DISPLAY0(" ... added\n"); @@ -62,17 +61,13 @@ static int addSegment(jvmtiEnv* jvmti, const char segment[], const char where[]) } static void setupLock(jvmtiEnv *jvmti_env, JNIEnv *jni_env) { - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, - jvmti_env, countLock))) - NSK_CPP_STUB2(FatalError, jni_env, - "failed to enter a raw monitor\n"); + if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorEnter(countLock))) + jni_env->FatalError("failed to enter a raw monitor\n"); } static void setoffLock(jvmtiEnv *jvmti_env, JNIEnv *jni_env) { - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, - jvmti_env, countLock))) - NSK_CPP_STUB2(FatalError, jni_env, - "failed to exit a raw monitor\n"); + if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorExit(countLock))) + jni_env->FatalError("failed to exit a raw monitor\n"); } JNIEXPORT jint JNICALL @@ -93,8 +88,7 @@ ClassLoad(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thread, jclass klass) { setupLock(jvmti_env, env); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature, - jvmti_env, klass, &sig, &generic))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &sig, &generic))) { result = STATUS_FAILED; } @@ -103,8 +97,7 @@ ClassLoad(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thread, jclass klass) { sig); classLoadReceived = JNI_TRUE; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode, - jvmti_env, JVMTI_DISABLE, JVMTI_EVENT_CLASS_LOAD, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_LOAD, NULL))) { result = STATUS_FAILED; } else { NSK_DISPLAY0("ClassLoad event disabled\n"); @@ -121,8 +114,7 @@ ClassPrepare(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thread, jclass klass) { setupLock(jvmti_env, env); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature, - jvmti_env, klass, &sig, &generic))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &sig, &generic))) { result = STATUS_FAILED; } @@ -131,8 +123,7 @@ ClassPrepare(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thread, jclass klass) { sig); classPrepareReceived = JNI_TRUE; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode, - jvmti_env, JVMTI_DISABLE, JVMTI_EVENT_CLASS_PREPARE, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_PREPARE, NULL))) { result = STATUS_FAILED; } else { NSK_DISPLAY0("ClassPrepare event disabled\n"); @@ -172,8 +163,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor, - jvmti, "eventLock", &countLock))) + if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("eventLock", &countLock))) return JNI_ERR; NSK_DISPLAY0("Add bootstrap class load segment in Agent_OnLoad()\n"); @@ -189,22 +179,19 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { memset(&callbacks, 0, sizeof(callbacks)); callbacks.ClassLoad = &ClassLoad; callbacks.ClassPrepare = &ClassPrepare; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(SetEventCallbacks, jvmti, &callbacks, size))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, size))) { return JNI_ERR; } } NSK_DISPLAY0(" ... set\n"); NSK_DISPLAY0("Enabling events: \n"); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode, - jvmti, JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL))) { return JNI_ERR; } else { NSK_DISPLAY0(" ... ClassLoad enabled\n"); } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode, - jvmti, JVMTI_ENABLE, JVMTI_EVENT_CLASS_PREPARE, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_PREPARE, NULL))) { return JNI_ERR; } else { NSK_DISPLAY0(" ... ClassPrepare enabled\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF06/gf06t001/gf06t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF06/gf06t001/gf06t001.cpp index 676bd776bd1..355f30c51c6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF06/gf06t001/gf06t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF06/gf06t001/gf06t001.cpp @@ -75,8 +75,7 @@ static int checkEnvStorage(jvmtiEnv* jvmti, const char where[]) { void* storage = NULL; NSK_DISPLAY0("Calling GetEnvironmentLocalStorage():"); - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2(GetEnvironmentLocalStorage, jvmti, &storage))) { + if (!NSK_JVMTI_VERIFY(jvmti->GetEnvironmentLocalStorage(&storage))) { return NSK_FALSE; } NSK_DISPLAY1(" ... got storage: 0x%p\n", (void*)storage); @@ -115,9 +114,9 @@ jthread getEnvThread(JNIEnv *env) { jmethodID cid; jthread res; - thrClass = NSK_CPP_STUB2(FindClass, env, "java/lang/Thread"); - cid = NSK_CPP_STUB4(GetMethodID, env, thrClass, "", "()V"); - res = NSK_CPP_STUB3(NewObject, env, thrClass, cid); + thrClass = env->FindClass("java/lang/Thread"); + cid = env->GetMethodID(thrClass, "", "()V"); + res = env->NewObject(thrClass, cid); return res; } @@ -193,8 +192,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } NSK_DISPLAY1("Set local storage in JVM_OnLoad() for first JVMTI env: 0x%p\n", (void*)initialStorage); - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2(SetEnvironmentLocalStorage, jvmti_1, initialStorage))) { + if (!NSK_JVMTI_VERIFY(jvmti_1->SetEnvironmentLocalStorage(initialStorage))) { return JNI_ERR; } NSK_DISPLAY0(" ... ok\n"); @@ -212,8 +210,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { eventCallbacks.VMInit = callbackVMInit; eventCallbacks.VMDeath = callbackVMDeath; if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(SetEventCallbacks, jvmti_2, - &eventCallbacks, sizeof(eventCallbacks)))) { + jvmti_2->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t001/gf08t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t001/gf08t001.cpp index c01a20f2286..d5d830e6d9b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t001/gf08t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t001/gf08t001.cpp @@ -70,8 +70,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { setVerboseMode = nsk_jvmti_findOptionStringValue("setVerboseMode", NULL); if (strcmp(setVerboseMode, "y") == 0 || strcmp(setVerboseMode, "yes") == 0) { - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(SetVerboseFlag, jvmti, JVMTI_VERBOSE_GC, JNI_TRUE))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetVerboseFlag(JVMTI_VERBOSE_GC, JNI_TRUE))) { return JNI_ERR; } else { NSK_DISPLAY0("JVMTI_VERBOSE_GC mode has been set.\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t002/gf08t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t002/gf08t002.cpp index 4d907133c53..4b2455a4f46 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t002/gf08t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t002/gf08t002.cpp @@ -70,8 +70,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { setVerboseMode = nsk_jvmti_findOptionStringValue("setVerboseMode", NULL); if (strcmp(setVerboseMode, "y") == 0 || strcmp(setVerboseMode, "yes") == 0) { - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(SetVerboseFlag, jvmti, JVMTI_VERBOSE_CLASS, JNI_TRUE))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetVerboseFlag(JVMTI_VERBOSE_CLASS, JNI_TRUE))) { return JNI_ERR; } else { NSK_DISPLAY0("JVMTI_VERBOSE_CLASS mode has been set.\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t003/gf08t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t003/gf08t003.cpp index f87e33acffc..ee6e7bf9f73 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t003/gf08t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t003/gf08t003.cpp @@ -70,8 +70,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { setVerboseMode = nsk_jvmti_findOptionStringValue("setVerboseMode", NULL); if (strcmp(setVerboseMode, "y") == 0 || strcmp(setVerboseMode, "yes") == 0) { - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(SetVerboseFlag, jvmti, JVMTI_VERBOSE_JNI, JNI_TRUE))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetVerboseFlag(JVMTI_VERBOSE_JNI, JNI_TRUE))) { return JNI_ERR; } else { NSK_DISPLAY0("JVMTI_VERBOSE_JNI mode has been set.\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS103/hs103t002/hs103t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS103/hs103t002/hs103t002.cpp index fb8bde3641d..3616ee25e52 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS103/hs103t002/hs103t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS103/hs103t002/hs103t002.cpp @@ -57,19 +57,15 @@ JNIEXPORT void JNICALL doRedefineInNativeThread(jvmtiEnv * jvmti, testClass = jni->FindClass(MAIN_CLASS); if (!NSK_JNI_VERIFY(jni, ( - setRedefinitionFailed = NSK_CPP_STUB4(GetStaticMethodID, jni, - testClass, "setRedefinitionFailed", "()V")) != NULL)) + setRedefinitionFailed = jni->GetStaticMethodID(testClass, "setRedefinitionFailed", "()V")) != NULL)) { - NSK_CPP_STUB2(FatalError, jni, - "TEST FAILED: while getting setRedefinitionFailed()\n"); + jni->FatalError("TEST FAILED: while getting setRedefinitionFailed()\n"); } if (!NSK_JNI_VERIFY(jni, ( - setRedefinitionDone = NSK_CPP_STUB4(GetStaticMethodID, jni, - testClass, "setRedefinitionDone", "()V")) != NULL)) + setRedefinitionDone = jni->GetStaticMethodID(testClass, "setRedefinitionDone", "()V")) != NULL)) { - NSK_CPP_STUB2(FatalError, jni, - "TEST FAILED: while getting setRedefinitionDone()\n"); + jni->FatalError("TEST FAILED: while getting setRedefinitionDone()\n"); } nsk_printf("doRedefineInNativeThread\n"); @@ -82,20 +78,16 @@ JNIEXPORT void JNICALL doRedefineInNativeThread(jvmtiEnv * jvmti, } else { nsk_printf("\nMyClass :: Failed to redefine ..\n"); - if (!NSK_JNI_VERIFY_VOID(jni, NSK_CPP_STUB3(CallStaticVoidMethod, jni, - testClass, setRedefinitionFailed))) + if (!NSK_JNI_VERIFY_VOID(jni, jni->CallStaticVoidMethod(testClass, setRedefinitionFailed))) { - NSK_CPP_STUB2(FatalError, jni, - "TEST FAILED: while calling setRedefinitionFailed()\n"); + jni->FatalError("TEST FAILED: while calling setRedefinitionFailed()\n"); } } } - if (!NSK_JNI_VERIFY_VOID(jni, NSK_CPP_STUB3(CallStaticVoidMethod, jni, - testClass, setRedefinitionDone))) + if (!NSK_JNI_VERIFY_VOID(jni, jni->CallStaticVoidMethod(testClass, setRedefinitionDone))) { - NSK_CPP_STUB2(FatalError, jni, - "TEST FAILED: while calling setRedefinitionDone()\n"); + jni->FatalError("TEST FAILED: while calling setRedefinitionDone()\n"); } nsk_printf(" All 30 redefinitions are done..\n"); @@ -150,10 +142,8 @@ Java_nsk_jvmti_scenarios_hotswap_HS103_hs103t002_hs103t002_startAgentThread(JNIE name = jni->NewStringUTF(threadName); clas = jni->FindClass("java/lang/Thread"); - if (!NSK_JNI_VERIFY(jni, (method = NSK_CPP_STUB4(GetMethodID, - jni, clas, "","(Ljava/lang/String;)V")) != NULL)) { - NSK_CPP_STUB2(FatalError, jni, - "failed to get ID for the java method\n"); + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(clas, "", "(Ljava/lang/String;)V")) != NULL)) { + jni->FatalError("failed to get ID for the java method\n"); } thread = (jthread) jni->NewObject(clas,method,name); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t002/hs104t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t002/hs104t002.cpp index 975a4e41d19..feac4530985 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t002/hs104t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t002/hs104t002.cpp @@ -49,8 +49,7 @@ JNIEXPORT jint JNI_OnLoad_hs104t002(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *vm, char *options, void *reserved){ - if ( ! NSK_VERIFY ( JNI_OK == NSK_CPP_STUB3(GetEnv, vm, - (void **)&jvmti, JVMTI_VERSION_1_1) ) ) { + if ( ! NSK_VERIFY ( JNI_OK == vm->GetEnv((void **)&jvmti, JVMTI_VERSION_1_1) ) ) { nsk_printf("#error Agent :: Could not load JVMTI interface.\n"); return JNI_ERR; } else { @@ -61,8 +60,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved){ } memset(&caps, 0, sizeof(caps)); caps.can_redefine_classes = 1; - if (! NSK_JVMTI_VERIFY ( NSK_CPP_STUB2(AddCapabilities, jvmti, - &caps) )) { + if (! NSK_JVMTI_VERIFY ( jvmti->AddCapabilities(&caps) )) { nsk_printf("#error Agent :: occured while adding capabilities.\n"); return JNI_ERR; } @@ -76,8 +74,7 @@ Java_nsk_jvmti_scenarios_hotswap_HS104_hs104t002_hs104t002_redefineClasses( jclass cla; char fileName[512]; - if ( ! NSK_JNI_VERIFY(jni, ( cla = NSK_CPP_STUB2(FindClass, - jni, SEARCH_NAME) ) != NULL ) ) { + if ( ! NSK_JNI_VERIFY(jni, ( cla = jni->FindClass(SEARCH_NAME) ) != NULL ) ) { nsk_printf(" Agent :: Failed to get class.\n"); nsk_jvmti_agentFailed(); return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t001/hs201t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t001/hs201t001.cpp index 706dbb4fccf..9b6a1f03cda 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t001/hs201t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t001/hs201t001.cpp @@ -64,15 +64,12 @@ void setCurrentStep(JNIEnv* jni_env, int value) { jfieldID fld; if (!NSK_JNI_VERIFY(jni_env, (fld = - NSK_CPP_STUB4(GetStaticFieldID, jni_env, testClass, "currentStep", "I")) != NULL)) { - NSK_CPP_STUB2(FatalError, jni_env, - "TEST FAILED: while getting currentStep fieldID\n"); + jni_env->GetStaticFieldID(testClass, "currentStep", "I")) != NULL)) { + jni_env->FatalError("TEST FAILED: while getting currentStep fieldID\n"); } - if (!NSK_JNI_VERIFY_VOID(jni_env, - NSK_CPP_STUB4(SetStaticIntField, jni_env, testClass, fld, value))) { - NSK_CPP_STUB2(FatalError, jni_env, - "TEST FAILED: while setting value of currentStep fieldID\n"); + if (!NSK_JNI_VERIFY_VOID(jni_env, jni_env->SetStaticIntField(testClass, fld, value))) { + jni_env->FatalError("TEST FAILED: while setting value of currentStep fieldID\n"); } } @@ -81,9 +78,7 @@ void setCurrentStep(JNIEnv* jni_env, int value) { void enableEvent(jvmtiEnv *jvmti_env, jvmtiEvent event, jthread thread) { - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB4(SetEventNotificationMode, jvmti_env, JVMTI_ENABLE, - event, thread))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, event, thread))) { NSK_COMPLAIN1("TEST FAILED: enabling %s\n", TranslateEvent(event)); nsk_jvmti_setFailStatus(); } @@ -93,9 +88,7 @@ void enableEvent(jvmtiEnv *jvmti_env, jvmtiEvent event, jthread thread) { void disableEvent(jvmtiEnv *jvmti_env, jvmtiEvent event, jthread thread) { - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB4(SetEventNotificationMode, jvmti_env, JVMTI_DISABLE, - event, thread))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, event, thread))) { NSK_COMPLAIN1("TEST FAILED: disabling %s\n", TranslateEvent(event)); nsk_jvmti_setFailStatus(); } @@ -109,9 +102,7 @@ void redefineClass(jvmtiEnv *jvmti_env, jclass klass) { char *className; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB4(GetClassSignature, jvmti_env, klass, - &className, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, NULL))) { nsk_jvmti_setFailStatus(); return; } @@ -127,15 +118,13 @@ void redefineClass(jvmtiEnv *jvmti_env, jclass klass) { classDef.class_bytes = newClassBytes; NSK_DISPLAY1("\tredefining class %s\n", className); - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(RedefineClasses, jvmti_env, 1, &classDef))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->RedefineClasses(1, &classDef))) { NSK_COMPLAIN1("TEST FAILED: while redefining class %s\n", className); nsk_jvmti_setFailStatus(); return; } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*)className))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)className))) { nsk_jvmti_setFailStatus(); } @@ -163,8 +152,8 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { if (!nsk_jvmti_waitForSync(timeout)) return; - NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testClass)); - NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedThread)); + NSK_TRACE(jni->DeleteGlobalRef(testClass)); + NSK_TRACE(jni->DeleteGlobalRef(testedThread)); NSK_DISPLAY0("Let debuggee to finish\n"); if (!nsk_jvmti_resumeSync()) @@ -176,15 +165,11 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { void setBreakPoint(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jclass klass) { jmethodID mid; - if (!NSK_JNI_VERIFY(jni_env, (mid = NSK_CPP_STUB4(GetMethodID, - jni_env, klass, METHOD_NAME, METHOD_SIG)) != NULL)) - NSK_CPP_STUB2(FatalError, jni_env, - "[agent] failed to get ID for the java method\n"); + if (!NSK_JNI_VERIFY(jni_env, (mid = jni_env->GetMethodID(klass, METHOD_NAME, METHOD_SIG)) != NULL)) + jni_env->FatalError("[agent] failed to get ID for the java method\n"); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetBreakpoint, - jvmti_env, mid, 1))) - NSK_CPP_STUB2(FatalError, jni_env, - "[agent] failed to set breakpoint\n"); + if (!NSK_JVMTI_VERIFY(jvmti_env->SetBreakpoint(mid, 1))) + jni_env->FatalError("[agent] failed to set breakpoint\n"); } /* ============================================================================= */ @@ -200,9 +185,7 @@ callbackClassLoad(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, char *className; char *generic; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB4(GetClassSignature, jvmti_env, klass, - &className, &generic))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, &generic))) { nsk_jvmti_setFailStatus(); return; } @@ -215,14 +198,12 @@ callbackClassLoad(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, setBreakPoint(jvmti_env, jni_env, klass); } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*)className))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)className))) { nsk_jvmti_setFailStatus(); } if (generic != NULL) - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*)generic))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)generic))) { nsk_jvmti_setFailStatus(); } } @@ -253,8 +234,7 @@ callbackSingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, char *methodName; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName, - jvmti_env, method, &methodName, NULL, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &methodName, NULL, NULL))) { NSK_COMPLAIN0("TEST FAILED: unable to get method name during Breakpoint callback\n\n"); } @@ -262,13 +242,11 @@ callbackSingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, char *declaringClassName; jclass declaringClass; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetMethodDeclaringClass, - jvmti_env, method, &declaringClass))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodDeclaringClass(method, &declaringClass))) { NSK_COMPLAIN0("TEST FAILED: unable to get method name during Breakpoint callback\n\n"); } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature, - jvmti_env, declaringClass, &declaringClassName, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(declaringClass, &declaringClassName, NULL))) { NSK_COMPLAIN0("TEST FAILED: unable to get method name during Breakpoint callback\n\n"); } @@ -292,8 +270,7 @@ callbackSingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, NSK_DISPLAY1("\n\n>>>> Checking if redefined method is obsolete\n", testStep); - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(IsMethodObsolete, jvmti, method, &is_obsolete))) { + if (!NSK_JVMTI_VERIFY(jvmti->IsMethodObsolete(method, &is_obsolete))) { NSK_COMPLAIN0("TEST FAILED: unable to check method to be obsolete\n"); nsk_jvmti_setFailStatus(); return; @@ -326,15 +303,13 @@ callbackSingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*) declaringClassName))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) declaringClassName))) { NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory pointed to method name\n\n"); } } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*) methodName))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) methodName))) { NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory pointed to method name\n\n"); } @@ -362,8 +337,7 @@ callbackException(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, className, getThreadName(jni_env, thread)); testStep++; - if (!NSK_JNI_VERIFY(jni_env, (klass = - NSK_CPP_STUB2(GetObjectClass, jni_env, exception)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != NULL)) { nsk_jvmti_setFailStatus(); return; } @@ -394,8 +368,7 @@ callbackExceptionCatch(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, className, getThreadName(jni_env, thread)); testStep++; - if (!NSK_JNI_VERIFY(jni_env, (klass = - NSK_CPP_STUB2(GetObjectClass, jni_env, exception)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != NULL)) { nsk_jvmti_setFailStatus(); return; } @@ -435,8 +408,7 @@ int readNewBytecode(jvmtiEnv* jvmti, int testcase) { newClassSize = ftell(bytecode); rewind(bytecode); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(Allocate, jvmti, - newClassSize, &newClassBytes))) { + if (!NSK_JVMTI_VERIFY(jvmti->Allocate(newClassSize, &newClassBytes))) { NSK_COMPLAIN0("buffer couldn't be allocated\n"); return NSK_FALSE; } @@ -460,27 +432,24 @@ const char* getThreadName(JNIEnv* jni_env, jthread thread) { strcpy(chbuffer, ""); - if (!NSK_JNI_VERIFY(jni_env, (klass = - NSK_CPP_STUB2(GetObjectClass, jni_env, thread)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(thread)) != NULL)) { nsk_jvmti_setFailStatus(); return chbuffer; } if (!NSK_JNI_VERIFY(jni_env, (methodID = - NSK_CPP_STUB4(GetMethodID, jni_env, klass, - "getName", "()Ljava/lang/String;")) != NULL)) { + jni_env->GetMethodID(klass, "getName", "()Ljava/lang/String;")) != NULL)) { nsk_jvmti_setFailStatus(); return chbuffer; } - jthreadName = (jstring) NSK_CPP_STUB3(CallObjectMethod, jni_env, thread, - methodID); + jthreadName = (jstring) jni_env->CallObjectMethod(thread, methodID); - threadName = NSK_CPP_STUB3(GetStringUTFChars, jni_env, jthreadName, 0); + threadName = jni_env->GetStringUTFChars(jthreadName, 0); strcpy(chbuffer, threadName); - NSK_CPP_STUB3(ReleaseStringUTFChars, jni_env, jthreadName, threadName); + jni_env->ReleaseStringUTFChars(jthreadName, threadName); return chbuffer; } @@ -495,29 +464,24 @@ const char* getClassName(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jobject object) { strcpy(chbuffer, ""); - if (!NSK_JNI_VERIFY(jni_env, (klass = - NSK_CPP_STUB2(GetObjectClass, jni_env, object)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(object)) != NULL)) { nsk_jvmti_setFailStatus(); return chbuffer; } - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB4(GetClassSignature, jvmti_env, klass, - &className, &generic))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, &generic))) { nsk_jvmti_setFailStatus(); return chbuffer; } strcpy(chbuffer, className); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*)className))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)className))) { nsk_jvmti_setFailStatus(); } if (generic != NULL) - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*)generic))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)generic))) { nsk_jvmti_setFailStatus(); } @@ -535,8 +499,7 @@ int getLocalVariableValue(jvmtiEnv *jvmti_env, jthread thread, jint value = -1; /* getting local variable table*/ - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetLocalVariableTable, - jvmti_env, method, &entryCount, &table))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetLocalVariableTable(method, &entryCount, &table))) { NSK_COMPLAIN0("TEST FAILED: unable to get local variable table\n\n"); } @@ -545,8 +508,7 @@ int getLocalVariableValue(jvmtiEnv *jvmti_env, jthread thread, for (i = 0; i < entryCount; i++) { if (strcmp(table[i].name, LOCAL_VARIABLE_NAME) == 0) { - error = NSK_CPP_STUB5(GetLocalInt, jvmti_env, thread, 0, - table[i].slot, &value); + error = jvmti_env->GetLocalInt(thread, 0, table[i].slot, &value); if (!NSK_VERIFY(error == JVMTI_ERROR_NONE || error == JVMTI_ERROR_INVALID_SLOT)) NSK_COMPLAIN0("TEST FAILED: unable to get local variable table\n\n"); @@ -555,20 +517,17 @@ int getLocalVariableValue(jvmtiEnv *jvmti_env, jthread thread, for (i = 0; i < entryCount; i++) { - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*)table[i].name))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)table[i].name))) { NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory pointed to method name\n\n"); } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*)table[i].signature))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)table[i].signature))) { NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory pointed to method signature\n\n"); } } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*)table))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)table))) { NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory pointed to local variable table\n\n"); } @@ -583,12 +542,10 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_scenarios_hotswap_HS201_hs201t001_setThread(JNIEnv *env, jclass cls, jthread thread) { - if (!NSK_JNI_VERIFY(env, (testClass = (jclass) - NSK_CPP_STUB2(NewGlobalRef, env, cls)) != NULL)) + if (!NSK_JNI_VERIFY(env, (testClass = (jclass) env->NewGlobalRef(cls)) != NULL)) nsk_jvmti_setFailStatus(); - if (!NSK_JNI_VERIFY(env, (testedThread = - NSK_CPP_STUB2(NewGlobalRef, env, thread)) != NULL)) + if (!NSK_JNI_VERIFY(env, (testedThread = env->NewGlobalRef(thread)) != NULL)) nsk_jvmti_setFailStatus(); } @@ -602,8 +559,7 @@ Java_nsk_jvmti_scenarios_hotswap_HS201_hs201t001_resumeThread(JNIEnv *env, NSK_DISPLAY0("\tresuming thread...\n"); disableEvent(jvmti, JVMTI_EVENT_SINGLE_STEP, thread); - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2(ResumeThread, jvmti, thread))) { + if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(thread))) { NSK_COMPLAIN0("TEST FAILED: unable to resume the thread\n"); nsk_jvmti_setFailStatus(); return JNI_FALSE; @@ -621,8 +577,7 @@ Java_nsk_jvmti_scenarios_hotswap_HS201_hs201t001_suspendThread(JNIEnv *env, NSK_DISPLAY0("\tsuspending thread...\n"); disableEvent(jvmti, JVMTI_EVENT_SINGLE_STEP, thread); - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2(SuspendThread, jvmti, thread))) { + if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(thread))) { NSK_COMPLAIN0("TEST FAILED: unable to suspend the thread\n"); nsk_jvmti_setFailStatus(); return JNI_FALSE; @@ -638,16 +593,14 @@ Java_nsk_jvmti_scenarios_hotswap_HS201_hs201t001_popFrame(JNIEnv *env, jclass cls, jthread thread) { NSK_DISPLAY0("\tpopping frame...\n"); - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2(PopFrame, jvmti, thread))) { + if (!NSK_JVMTI_VERIFY(jvmti->PopFrame(thread))) { NSK_COMPLAIN0("TEST FAILED: unable to pop the currently executed frame\n"); nsk_jvmti_setFailStatus(); return JNI_FALSE; } NSK_DISPLAY0("\tresuming thread...\n"); - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2(ResumeThread, jvmti, thread))) { + if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(thread))) { NSK_COMPLAIN0("TEST FAILED: unable to resume the thread\n"); nsk_jvmti_setFailStatus(); return NSK_FALSE; @@ -696,8 +649,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { caps.can_pop_frame = 1; caps.can_suspend = 1; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) + if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) return JNI_ERR; } @@ -709,9 +661,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { eventCallbacks.ExceptionCatch = callbackExceptionCatch; eventCallbacks.Breakpoint = callbackBreakpoint; eventCallbacks.SingleStep = callbackSingleStep; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(SetEventCallbacks, jvmti, - &eventCallbacks, sizeof(eventCallbacks)))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t002/hs201t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t002/hs201t002.cpp index 71bb11a4e75..a8aa4b98b0b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t002/hs201t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t002/hs201t002.cpp @@ -64,15 +64,12 @@ void setCurrentStep(JNIEnv* jni_env, int value) { jfieldID fld; if (!NSK_JNI_VERIFY(jni_env, (fld = - NSK_CPP_STUB4(GetStaticFieldID, jni_env, testClass, "currentStep", "I")) != NULL)) { - NSK_CPP_STUB2(FatalError, jni_env, - "TEST FAILED: while getting currentStep fieldID\n"); + jni_env->GetStaticFieldID(testClass, "currentStep", "I")) != NULL)) { + jni_env->FatalError("TEST FAILED: while getting currentStep fieldID\n"); } - if (!NSK_JNI_VERIFY_VOID(jni_env, - NSK_CPP_STUB4(SetStaticIntField, jni_env, testClass, fld, value))) { - NSK_CPP_STUB2(FatalError, jni_env, - "TEST FAILED: while setting value of currentStep fieldID\n"); + if (!NSK_JNI_VERIFY_VOID(jni_env, jni_env->SetStaticIntField(testClass, fld, value))) { + jni_env->FatalError("TEST FAILED: while setting value of currentStep fieldID\n"); } } @@ -81,9 +78,7 @@ void setCurrentStep(JNIEnv* jni_env, int value) { void enableEvent(jvmtiEnv *jvmti_env, jvmtiEvent event, jthread thread) { - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB4(SetEventNotificationMode, jvmti_env, JVMTI_ENABLE, - event, thread))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, event, thread))) { NSK_COMPLAIN1("TEST FAILED: enabling %s\n", TranslateEvent(event)); nsk_jvmti_setFailStatus(); } @@ -93,9 +88,7 @@ void enableEvent(jvmtiEnv *jvmti_env, jvmtiEvent event, jthread thread) { void disableEvent(jvmtiEnv *jvmti_env, jvmtiEvent event, jthread thread) { - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB4(SetEventNotificationMode, jvmti_env, JVMTI_DISABLE, - event, thread))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, event, thread))) { NSK_COMPLAIN1("TEST FAILED: disabling %s\n", TranslateEvent(event)); nsk_jvmti_setFailStatus(); } @@ -109,9 +102,7 @@ void redefineClass(jvmtiEnv *jvmti_env, jclass klass) { char *className; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB4(GetClassSignature, jvmti_env, klass, - &className, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, NULL))) { nsk_jvmti_setFailStatus(); return; } @@ -127,15 +118,13 @@ void redefineClass(jvmtiEnv *jvmti_env, jclass klass) { classDef.class_bytes = newClassBytes; NSK_DISPLAY1("\tredefining class %s\n", className); - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(RedefineClasses, jvmti_env, 1, &classDef))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->RedefineClasses(1, &classDef))) { NSK_COMPLAIN1("TEST FAILED: while redefining class %s\n", className); nsk_jvmti_setFailStatus(); return; } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*)className))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)className))) { nsk_jvmti_setFailStatus(); } @@ -163,8 +152,8 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { if (!nsk_jvmti_waitForSync(timeout)) return; - NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testClass)); - NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedThread)); + NSK_TRACE(jni->DeleteGlobalRef(testClass)); + NSK_TRACE(jni->DeleteGlobalRef(testedThread)); NSK_DISPLAY0("Let debuggee to finish\n"); if (!nsk_jvmti_resumeSync()) @@ -176,15 +165,11 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { void setBreakPoint(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jclass klass) { jmethodID mid; - if (!NSK_JNI_VERIFY(jni_env, (mid = NSK_CPP_STUB4(GetMethodID, - jni_env, klass, METHOD_NAME, METHOD_SIG)) != NULL)) - NSK_CPP_STUB2(FatalError, jni_env, - "[agent] failed to get ID for the java method\n"); + if (!NSK_JNI_VERIFY(jni_env, (mid = jni_env->GetMethodID(klass, METHOD_NAME, METHOD_SIG)) != NULL)) + jni_env->FatalError("[agent] failed to get ID for the java method\n"); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetBreakpoint, - jvmti_env, mid, 1))) - NSK_CPP_STUB2(FatalError, jni_env, - "[agent] failed to set breakpoint\n"); + if (!NSK_JVMTI_VERIFY(jvmti_env->SetBreakpoint(mid, 1))) + jni_env->FatalError("[agent] failed to set breakpoint\n"); } /* ============================================================================= */ @@ -200,9 +185,7 @@ callbackClassLoad(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, char *className; char *generic; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB4(GetClassSignature, jvmti_env, klass, - &className, &generic))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, &generic))) { nsk_jvmti_setFailStatus(); return; } @@ -215,14 +198,12 @@ callbackClassLoad(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, setBreakPoint(jvmti_env, jni_env, klass); } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*)className))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)className))) { nsk_jvmti_setFailStatus(); } if (generic != NULL) - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*)generic))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)generic))) { nsk_jvmti_setFailStatus(); } } @@ -253,8 +234,7 @@ callbackSingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, char *methodName; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName, - jvmti_env, method, &methodName, NULL, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &methodName, NULL, NULL))) { NSK_COMPLAIN0("TEST FAILED: unable to get method name during Breakpoint callback\n\n"); } @@ -262,13 +242,11 @@ callbackSingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, char *declaringClassName; jclass declaringClass; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetMethodDeclaringClass, - jvmti_env, method, &declaringClass))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodDeclaringClass(method, &declaringClass))) { NSK_COMPLAIN0("TEST FAILED: unable to get method name during Breakpoint callback\n\n"); } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature, - jvmti_env, declaringClass, &declaringClassName, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(declaringClass, &declaringClassName, NULL))) { NSK_COMPLAIN0("TEST FAILED: unable to get method name during Breakpoint callback\n\n"); } @@ -292,8 +270,7 @@ callbackSingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, NSK_DISPLAY1("\n\n>>>> Checking if redefined method is not obsolete\n", testStep); - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(IsMethodObsolete, jvmti, method, &is_obsolete))) { + if (!NSK_JVMTI_VERIFY(jvmti->IsMethodObsolete(method, &is_obsolete))) { NSK_COMPLAIN0("TEST FAILED: unable to check method to be obsolete\n"); nsk_jvmti_setFailStatus(); return; @@ -326,15 +303,13 @@ callbackSingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*) declaringClassName))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) declaringClassName))) { NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory pointed to method name\n\n"); } } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*) methodName))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) methodName))) { NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory pointed to method name\n\n"); } @@ -362,8 +337,7 @@ callbackException(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, className, getThreadName(jni_env, thread)); testStep++; - if (!NSK_JNI_VERIFY(jni_env, (klass = - NSK_CPP_STUB2(GetObjectClass, jni_env, exception)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != NULL)) { nsk_jvmti_setFailStatus(); return; } @@ -394,8 +368,7 @@ callbackExceptionCatch(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, className, getThreadName(jni_env, thread)); testStep++; - if (!NSK_JNI_VERIFY(jni_env, (klass = - NSK_CPP_STUB2(GetObjectClass, jni_env, exception)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != NULL)) { nsk_jvmti_setFailStatus(); return; } @@ -435,8 +408,7 @@ int readNewBytecode(jvmtiEnv* jvmti) { newClassSize = ftell(bytecode); rewind(bytecode); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(Allocate, jvmti, - newClassSize, &newClassBytes))) { + if (!NSK_JVMTI_VERIFY(jvmti->Allocate(newClassSize, &newClassBytes))) { NSK_COMPLAIN0("buffer couldn't be allocated\n"); return NSK_FALSE; } @@ -460,27 +432,24 @@ const char* getThreadName(JNIEnv* jni_env, jthread thread) { strcpy(chbuffer, ""); - if (!NSK_JNI_VERIFY(jni_env, (klass = - NSK_CPP_STUB2(GetObjectClass, jni_env, thread)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(thread)) != NULL)) { nsk_jvmti_setFailStatus(); return chbuffer; } if (!NSK_JNI_VERIFY(jni_env, (methodID = - NSK_CPP_STUB4(GetMethodID, jni_env, klass, - "getName", "()Ljava/lang/String;")) != NULL)) { + jni_env->GetMethodID(klass, "getName", "()Ljava/lang/String;")) != NULL)) { nsk_jvmti_setFailStatus(); return chbuffer; } - jthreadName = (jstring) NSK_CPP_STUB3(CallObjectMethod, jni_env, thread, - methodID); + jthreadName = (jstring) jni_env->CallObjectMethod(thread, methodID); - threadName = NSK_CPP_STUB3(GetStringUTFChars, jni_env, jthreadName, 0); + threadName = jni_env->GetStringUTFChars(jthreadName, 0); strcpy(chbuffer, threadName); - NSK_CPP_STUB3(ReleaseStringUTFChars, jni_env, jthreadName, threadName); + jni_env->ReleaseStringUTFChars(jthreadName, threadName); return chbuffer; } @@ -495,29 +464,24 @@ const char* getClassName(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jobject object) { strcpy(chbuffer, ""); - if (!NSK_JNI_VERIFY(jni_env, (klass = - NSK_CPP_STUB2(GetObjectClass, jni_env, object)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(object)) != NULL)) { nsk_jvmti_setFailStatus(); return chbuffer; } - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB4(GetClassSignature, jvmti_env, klass, - &className, &generic))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, &generic))) { nsk_jvmti_setFailStatus(); return chbuffer; } strcpy(chbuffer, className); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*)className))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)className))) { nsk_jvmti_setFailStatus(); } if (generic != NULL) - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*)generic))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)generic))) { nsk_jvmti_setFailStatus(); } @@ -535,8 +499,7 @@ int getLocalVariableValue(jvmtiEnv *jvmti_env, jthread thread, jint value = -1; /* getting local variable table*/ - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetLocalVariableTable, - jvmti_env, method, &entryCount, &table))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetLocalVariableTable(method, &entryCount, &table))) { NSK_COMPLAIN0("TEST FAILED: unable to get local variable table\n\n"); } @@ -545,8 +508,7 @@ int getLocalVariableValue(jvmtiEnv *jvmti_env, jthread thread, for (i = 0; i < entryCount; i++) { if (strcmp(table[i].name, LOCAL_VARIABLE_NAME) == 0) { - error = NSK_CPP_STUB5(GetLocalInt, jvmti_env, thread, 0, - table[i].slot, &value); + error = jvmti_env->GetLocalInt(thread, 0, table[i].slot, &value); if (!NSK_VERIFY(error == JVMTI_ERROR_NONE || error == JVMTI_ERROR_INVALID_SLOT)) NSK_COMPLAIN0("TEST FAILED: unable to get local variable table\n\n"); @@ -555,20 +517,17 @@ int getLocalVariableValue(jvmtiEnv *jvmti_env, jthread thread, for (i = 0; i < entryCount; i++) { - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*)table[i].name))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)table[i].name))) { NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory pointed to method name\n\n"); } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*)table[i].signature))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)table[i].signature))) { NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory pointed to method signature\n\n"); } } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*)table))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)table))) { NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory pointed to local variable table\n\n"); } @@ -583,12 +542,10 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_scenarios_hotswap_HS201_hs201t002_setThread(JNIEnv *env, jclass cls, jthread thread) { - if (!NSK_JNI_VERIFY(env, (testClass = (jclass) - NSK_CPP_STUB2(NewGlobalRef, env, cls)) != NULL)) + if (!NSK_JNI_VERIFY(env, (testClass = (jclass) env->NewGlobalRef(cls)) != NULL)) nsk_jvmti_setFailStatus(); - if (!NSK_JNI_VERIFY(env, (testedThread = - NSK_CPP_STUB2(NewGlobalRef, env, thread)) != NULL)) + if (!NSK_JNI_VERIFY(env, (testedThread = env->NewGlobalRef(thread)) != NULL)) nsk_jvmti_setFailStatus(); } @@ -602,8 +559,7 @@ Java_nsk_jvmti_scenarios_hotswap_HS201_hs201t002_resumeThread(JNIEnv *env, NSK_DISPLAY0("\tresuming thread...\n"); disableEvent(jvmti, JVMTI_EVENT_SINGLE_STEP, thread); - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2(ResumeThread, jvmti, thread))) { + if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(thread))) { NSK_COMPLAIN0("TEST FAILED: unable to resume the thread\n"); nsk_jvmti_setFailStatus(); return NSK_FALSE; @@ -621,8 +577,7 @@ Java_nsk_jvmti_scenarios_hotswap_HS201_hs201t002_suspendThread(JNIEnv *env, NSK_DISPLAY0("\tsuspending thread...\n"); disableEvent(jvmti, JVMTI_EVENT_SINGLE_STEP, thread); - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2(SuspendThread, jvmti, thread))) { + if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(thread))) { NSK_COMPLAIN0("TEST FAILED: unable to suspend the thread\n"); nsk_jvmti_setFailStatus(); return NSK_FALSE; @@ -638,16 +593,14 @@ Java_nsk_jvmti_scenarios_hotswap_HS201_hs201t002_popFrame(JNIEnv *env, jclass cls, jthread thread) { NSK_DISPLAY0("\tpopping frame...\n"); - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2(PopFrame, jvmti, thread))) { + if (!NSK_JVMTI_VERIFY(jvmti->PopFrame(thread))) { NSK_COMPLAIN0("TEST FAILED: unable to pop the currently executed frame\n"); nsk_jvmti_setFailStatus(); return NSK_FALSE; } NSK_DISPLAY0("\tresuming thread...\n"); - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2(ResumeThread, jvmti, thread))) { + if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(thread))) { NSK_COMPLAIN0("TEST FAILED: unable to resume the thread\n"); nsk_jvmti_setFailStatus(); return NSK_FALSE; @@ -696,8 +649,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { caps.can_pop_frame = 1; caps.can_suspend = 1; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) + if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) return JNI_ERR; } @@ -709,9 +661,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { eventCallbacks.ExceptionCatch = callbackExceptionCatch; eventCallbacks.Breakpoint = callbackBreakpoint; eventCallbacks.SingleStep = callbackSingleStep; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(SetEventCallbacks, jvmti, - &eventCallbacks, sizeof(eventCallbacks)))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t003/hs201t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t003/hs201t003.cpp index 8dadff6a6b9..77b5e509229 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t003/hs201t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t003/hs201t003.cpp @@ -63,9 +63,9 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_scenarios_hotswap_HS201_hs201t003_storeCla (JNIEnv *jni_env, jclass cls, jbyteArray classBytes) { jboolean isCopy; - bytesCount = NSK_CPP_STUB2(GetArrayLength, jni_env, classBytes); + bytesCount = jni_env->GetArrayLength(classBytes); clsBytes = - NSK_CPP_STUB3(GetByteArrayElements, jni_env, classBytes, &isCopy); + jni_env->GetByteArrayElements(classBytes, &isCopy); } static int expectedMeth(jvmtiEnv *jvmti_env, const char *event, @@ -74,8 +74,7 @@ static int expectedMeth(jvmtiEnv *jvmti_env, const char *event, char *sig; int methFound = 0; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName, - jvmti_env, method, &name, &sig, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sig, NULL))) { nsk_jvmti_setFailStatus(); return 0; } @@ -90,11 +89,9 @@ static int expectedMeth(jvmtiEnv *jvmti_env, const char *event, else methFound = 0; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*) name))) + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) name))) nsk_jvmti_setFailStatus(); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*) sig))) + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) sig))) nsk_jvmti_setFailStatus(); return methFound; @@ -106,13 +103,11 @@ static void doHotSwap(jvmtiEnv *jvmti_env, char *cls_sig; jvmtiClassDefinition classDef; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetMethodDeclaringClass, - jvmti_env, tMethodID, &decl_cls))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodDeclaringClass(tMethodID, &decl_cls))) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature, - jvmti_env, decl_cls, &cls_sig, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(decl_cls, &cls_sig, NULL))) { nsk_jvmti_setFailStatus(); return; } @@ -120,8 +115,7 @@ static void doHotSwap(jvmtiEnv *jvmti_env, NSK_DISPLAY2("[%s] tested method class signature: \"%s\"\n\n", event, cls_sig); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*) cls_sig))) + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) cls_sig))) nsk_jvmti_setFailStatus(); /* fill the structure jvmtiClassDefinition */ @@ -133,8 +127,7 @@ static void doHotSwap(jvmtiEnv *jvmti_env, "[%s] >>>>> Invoke RedefineClasses():\n" "\tnew class byte count=%d\n", event, classDef.class_byte_count); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(RedefineClasses, - jvmti, 1, &classDef))) { + if (!NSK_JVMTI_VERIFY(jvmti->RedefineClasses(1, &classDef))) { nsk_jvmti_setFailStatus(); return; } @@ -150,16 +143,14 @@ static void doChecks(jvmtiEnv *jvmti_env, jint methBytesCount; /* number of bytes of a method */ unsigned char *methBytes; /* bytes defining a method */ - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName, - jvmti_env, tMethodID, &name, &sig, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(tMethodID, &name, &sig, NULL))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY4("[%s] method ID=0x%p name=\"%s\" signature=\"%s\"\n", event, (void*) tMethodID, name, sig); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetBytecodes, - jvmti_env, tMethodID, &methBytesCount, &methBytes))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetBytecodes(tMethodID, &methBytesCount, &methBytes))) { nsk_jvmti_setFailStatus(); return; } @@ -167,12 +158,10 @@ static void doChecks(jvmtiEnv *jvmti_env, "[%s] method bytes count=%d\n" "\tbytes count of the redefined method=%d\n", event, methBytesCount, redefMethBytesCount); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*) methBytes))) + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) methBytes))) nsk_jvmti_setFailStatus(); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(IsMethodObsolete, - jvmti_env, tMethodID, &isObsolete))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->IsMethodObsolete(tMethodID, &isObsolete))) { nsk_jvmti_setFailStatus(); return; } @@ -197,20 +186,17 @@ void JNICALL MethodEntry(jvmtiEnv *jvmti_env, JNIEnv *env, if (expectedMeth(jvmti_env, "MethodEntry", method, expHSMethod, expHSSignature)==1) { - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetBytecodes, - jvmti_env, method, &redefMethBytesCount, &redefMethBytes))) + if (!NSK_JVMTI_VERIFY(jvmti_env->GetBytecodes(method, &redefMethBytesCount, &redefMethBytes))) nsk_jvmti_setFailStatus(); else { NSK_DISPLAY2("[MethodEntry] thread=0x%p method bytes count=%d\n", thr, redefMethBytesCount); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(NotifyFramePop, - jvmti_env, thr, 0))) + if (!NSK_JVMTI_VERIFY(jvmti_env->NotifyFramePop(thr, 0))) nsk_jvmti_setFailStatus(); } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode, - jvmti_env, JVMTI_DISABLE, JVMTI_EVENT_METHOD_ENTRY, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_METHOD_ENTRY, NULL))) nsk_jvmti_setFailStatus(); } } @@ -277,8 +263,7 @@ agentProc(jvmtiEnv* jvmti_env, JNIEnv* jni_env, void* arg) { return; /* deallocating used memory */ - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, - jvmti_env, (unsigned char*) redefMethBytes))) + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) redefMethBytes))) nsk_jvmti_setFailStatus(); NSK_DISPLAY0("agentProc: final resuming of the debuggee ...\n\n"); @@ -324,8 +309,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { caps.can_generate_method_exit_events = 1; caps.can_generate_frame_pop_events = 1; caps.can_redefine_classes = 1; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, - jvmti, &caps))) + if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) return JNI_ERR; /* set event callback */ @@ -335,8 +319,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { callbacks.MethodEntry = &MethodEntry; callbacks.MethodExit = &MethodExit; callbacks.FramePop = &FramePop; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, - jvmti, &callbacks, sizeof(callbacks)))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks)))) return JNI_ERR; NSK_DISPLAY0("setting event callbacks done\nenabling events ...\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/hs203t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/hs203t003.cpp index 24383f510cc..421f3b76d3e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/hs203t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/hs203t003.cpp @@ -60,20 +60,17 @@ JNIEXPORT void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, redefineNumber=0; className=NULL; generic=NULL; - if ( ! NSK_JVMTI_VERIFY ( NSK_CPP_STUB4(GetClassSignature, - jvmti_env, klass, &className, &generic) ) ) { + if ( ! NSK_JVMTI_VERIFY ( jvmti_env->GetClassSignature(klass, &className, &generic) ) ) { nsk_printf("#error Agent :: while getting classname Signature.\n"); nsk_jvmti_agentFailed(); } else { if (strcmp(className,CLASS_NAME) == 0) { jfieldID field; /* get the field id and set watch on that .*/ - if (! NSK_JNI_VERIFY(jni, (field = NSK_CPP_STUB4(GetFieldID, - jni, klass, FIELDNAME, TYPE)) != NULL) ) { + if (! NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, FIELDNAME, TYPE)) != NULL) ) { nsk_printf(" Agent :: (*JNI)->GetFieldID(jni, ... ) returns `null`.\n"); nsk_jvmti_agentFailed(); - } else if ( ! NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetFieldAccessWatch, - jvmti_env, klass, field) ) ) { + } else if ( ! NSK_JVMTI_VERIFY(jvmti_env->SetFieldAccessWatch(klass, field) ) ) { nsk_printf("#error Agent :: occured while jvmti->SetFieldAccessWatch(... ) .\n"); nsk_jvmti_agentFailed(); } @@ -96,7 +93,7 @@ JNIEXPORT void JNICALL callbackFieldAccess(jvmtiEnv *jvmti_env, return; } redefineNumber=0; - if (! NSK_JNI_VERIFY(jni, (clas = NSK_CPP_STUB2(FindClass, jni, SEARCH_NAME)) != NULL) ) { + if (! NSK_JNI_VERIFY(jni, (clas = jni->FindClass(SEARCH_NAME)) != NULL) ) { nsk_printf(" Agent :: (*JNI)->FindClass(jni, %s) returns `null`.\n",SEARCH_NAME); nsk_jvmti_agentFailed(); } else { @@ -109,7 +106,7 @@ JNIEXPORT void JNICALL callbackFieldAccess(jvmtiEnv *jvmti_env, nsk_printf(" Agent :: Redefined.\n"); nsk_printf(" Agent :: Suspendeding thread.\n"); /* pop the current working frame. */ - if ( ! NSK_JVMTI_VERIFY( NSK_CPP_STUB2(SuspendThread, jvmti_env, thread) ) ) { + if ( ! NSK_JVMTI_VERIFY(jvmti_env->SuspendThread(thread) ) ) { nsk_printf("#error Agent :: occured suspending Thread.\n"); nsk_jvmti_agentFailed(); } else { @@ -131,8 +128,7 @@ JNIEXPORT jint JNI_OnLoad_hs203t003(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { - if ( ! NSK_VERIFY ( JNI_OK == NSK_CPP_STUB3(GetEnv, vm, - (void **)&jvmti, JVMTI_VERSION_1_1) ) ) { + if ( ! NSK_VERIFY ( JNI_OK == vm->GetEnv((void **)&jvmti, JVMTI_VERSION_1_1) ) ) { nsk_printf(" Agent :: Could not load JVMTI interface.\n"); return JNI_ERR; } else { @@ -148,16 +144,14 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { caps.can_pop_frame=1; caps.can_generate_all_class_hook_events=1; caps.can_generate_field_access_events=1; - if (! NSK_JVMTI_VERIFY ( NSK_CPP_STUB2(AddCapabilities, jvmti, &caps) )) { + if (! NSK_JVMTI_VERIFY ( jvmti->AddCapabilities(&caps) ) ) { nsk_printf("#error Agent :: while adding capabilities.\n"); return JNI_ERR; } memset(&eventCallbacks, 0, sizeof(eventCallbacks)); eventCallbacks.ClassPrepare =callbackClassPrepare; eventCallbacks.FieldAccess= callbackFieldAccess; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(SetEventCallbacks, jvmti, - &eventCallbacks, sizeof(eventCallbacks)))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) { nsk_printf("#error Agent :: while setting event callbacks.\n"); return JNI_ERR; } @@ -181,7 +175,7 @@ Java_nsk_jvmti_scenarios_hotswap_HS203_hs203t003_hs203t003_isSuspended(JNIEnv * jboolean retvalue; jint state; retvalue = JNI_FALSE; - if ( ! NSK_JVMTI_VERIFY( NSK_CPP_STUB3(GetThreadState, jvmti, thread, &state) ) ) { + if ( ! NSK_JVMTI_VERIFY( jvmti->GetThreadState(thread, &state) ) ) { nsk_printf(" Agent :: Error while getting thread state.\n"); nsk_jvmti_agentFailed(); } else { @@ -199,18 +193,18 @@ Java_nsk_jvmti_scenarios_hotswap_HS203_hs203t003_hs203t003_popThreadFrame(JNIEnv jboolean retvalue; jint state; retvalue = JNI_FALSE; - if ( ! NSK_JVMTI_VERIFY( NSK_CPP_STUB3(GetThreadState, jvmti, thread, &state) ) ) { + if ( ! NSK_JVMTI_VERIFY( jvmti->GetThreadState(thread, &state) ) ) { nsk_printf(" Agent :: Error while getting thread state.\n"); nsk_jvmti_agentFailed(); } else { if ( state & JVMTI_THREAD_STATE_SUSPENDED) { - if ( ! NSK_JVMTI_VERIFY ( NSK_CPP_STUB2( PopFrame, jvmti, thread) ) ) { + if ( ! NSK_JVMTI_VERIFY ( jvmti->PopFrame(thread) ) ) { nsk_printf("#error Agent :: while poping thread's frame.\n"); nsk_jvmti_agentFailed(); } else { nsk_printf(" Agent :: poped thread frame.\n"); - if ( ! NSK_JVMTI_VERIFY ( NSK_CPP_STUB4 (SetEventNotificationMode, jvmti, - JVMTI_DISABLE, JVMTI_EVENT_FIELD_ACCESS, NULL) ) ) { + if ( ! NSK_JVMTI_VERIFY ( + jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_FIELD_ACCESS, NULL) ) ) { nsk_printf("#error Agent :: failed to disable notification JVMTI_EVENT_FIELD ACCESS.\n"); nsk_jvmti_agentFailed(); } else { @@ -232,7 +226,7 @@ Java_nsk_jvmti_scenarios_hotswap_HS203_hs203t003_hs203t003_resumeThread(JNIEnv * jthread thread) { jboolean retvalue; retvalue = JNI_FALSE; - if ( !NSK_JVMTI_VERIFY( NSK_CPP_STUB2 ( ResumeThread, jvmti, thread)) ) { + if ( !NSK_JVMTI_VERIFY( jvmti->ResumeThread(thread) ) ) { nsk_printf("#error Agent :: while resuming thread.\n"); nsk_jvmti_agentFailed(); } else { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t004/hs203t004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t004/hs203t004.cpp index 203519021ee..9f9e99a169d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t004/hs203t004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t004/hs203t004.cpp @@ -45,23 +45,21 @@ JNIEXPORT void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, char * className; className=NULL; - if (!NSK_JVMTI_VERIFY (NSK_CPP_STUB4(GetClassSignature, - jvmti_env, klass, &className, NULL) ) ) { + if (!NSK_JVMTI_VERIFY (jvmti_env->GetClassSignature(klass, &className, NULL) ) ) { NSK_COMPLAIN0("#error Agent :: while getting classname.\n"); nsk_jvmti_agentFailed(); } else { if (strcmp(className, CLASS_NAME) == 0) { - if (nsk_jvmti_enableNotification(jvmti_env, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL) == NSK_TRUE ) { + if (nsk_jvmti_enableNotification(jvmti_env, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL) == NSK_TRUE) { NSK_DISPLAY0(" Agent :: notification enabled for COMPILED_METHOD_LOAD.\n"); - if ( ! NSK_JVMTI_VERIFY ( NSK_CPP_STUB2(GenerateEvents, jvmti_env, - JVMTI_EVENT_COMPILED_METHOD_LOAD ) )) { + if ( ! NSK_JVMTI_VERIFY ( jvmti_env->GenerateEvents(JVMTI_EVENT_COMPILED_METHOD_LOAD) ) ) { NSK_COMPLAIN0("#error Agent :: occured while enabling compiled method events.\n"); nsk_jvmti_agentFailed(); } } } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char *)className))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char *)className))) { NSK_COMPLAIN1("#error Agent :: failed to Deallocate className = %s.", className); nsk_jvmti_agentFailed(); } @@ -78,8 +76,7 @@ JNIEXPORT void JNICALL callbackCompiledMethodLoad(jvmtiEnv *jvmti_env, const void* compile_info) { jclass threadClass; if (redefineNumber == 0) { - if ( ! NSK_JVMTI_VERIFY ( NSK_CPP_STUB3(GetMethodDeclaringClass, - jvmti_env, method, &threadClass) ) ) { + if ( ! NSK_JVMTI_VERIFY ( jvmti_env->GetMethodDeclaringClass(method, &threadClass) ) ) { NSK_COMPLAIN0("#error Agent :: while geting the declaring class.\n"); nsk_jvmti_agentFailed(); } else { @@ -89,15 +86,13 @@ JNIEXPORT void JNICALL callbackCompiledMethodLoad(jvmtiEnv *jvmti_env, className = NULL; methodName = NULL; - if ( ! NSK_JVMTI_VERIFY (NSK_CPP_STUB4(GetClassSignature, - jvmti_env, threadClass, &className, NULL) ) ) { + if ( ! NSK_JVMTI_VERIFY (jvmti_env->GetClassSignature(threadClass, &className, NULL) ) ) { NSK_COMPLAIN0("#error Agent :: while getting classname.\n"); nsk_jvmti_agentFailed(); return; } - if ( ! NSK_JVMTI_VERIFY (NSK_CPP_STUB5(GetMethodName, - jvmti_env, method, &methodName, NULL, NULL) ) ) { + if ( ! NSK_JVMTI_VERIFY (jvmti_env->GetMethodName(method, &methodName, NULL, NULL) ) ) { NSK_COMPLAIN0("#error Agent :: while getting methodname.\n"); nsk_jvmti_agentFailed(); return; @@ -121,13 +116,13 @@ JNIEXPORT void JNICALL callbackCompiledMethodLoad(jvmtiEnv *jvmti_env, } if ( className != NULL ) { - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char *)className))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char *)className))) { NSK_COMPLAIN1("#error Agent :: failed to Deallocate className = %s.", className); nsk_jvmti_agentFailed(); } } if ( methodName != NULL ) { - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char *)methodName))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char *)methodName))) { NSK_COMPLAIN1("#error Agent :: failed to Deallocate methodName = %s.", methodName); nsk_jvmti_agentFailed(); } @@ -149,8 +144,7 @@ JNIEXPORT jint JNI_OnLoad_hs203t004(JavaVM *jvm, char *options, void *reserved) #endif jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { redefineNumber=0; - if ( ! NSK_VERIFY ( JNI_OK == NSK_CPP_STUB3(GetEnv, vm, - (void **)&jvmti, JVMTI_VERSION_1_1) ) ) { + if ( ! NSK_VERIFY ( JNI_OK == vm->GetEnv((void **)&jvmti, JVMTI_VERSION_1_1) ) ) { NSK_DISPLAY0("#error Agent :: Could not load JVMTI interface.\n"); return JNI_ERR; } else { @@ -166,16 +160,14 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { caps.can_pop_frame = 1; caps.can_generate_all_class_hook_events = 1; caps.can_generate_compiled_method_load_events = 1; - if (! NSK_JVMTI_VERIFY ( NSK_CPP_STUB2(AddCapabilities, jvmti, &caps) )) { + if (! NSK_JVMTI_VERIFY ( jvmti->AddCapabilities(&caps) ) ) { NSK_DISPLAY0("#error Agent :: occured while adding capabilities.\n"); return JNI_ERR; } memset(&eventCallbacks, 0, sizeof(eventCallbacks)); eventCallbacks.ClassPrepare =callbackClassPrepare; eventCallbacks.CompiledMethodLoad=callbackCompiledMethodLoad; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(SetEventCallbacks, jvmti, - &eventCallbacks, sizeof(eventCallbacks)))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) { NSK_COMPLAIN0("#error Agent :: occured while setting event callback.\n"); return JNI_ERR; } @@ -194,7 +186,7 @@ Java_nsk_jvmti_scenarios_hotswap_HS203_hs203t004_hs203t004_suspendThread(JNIEnv jobject clas, jthread thread) { NSK_DISPLAY0(" Agent :: Suspending Thread.\n"); - if ( NSK_JVMTI_VERIFY( NSK_CPP_STUB2(SuspendThread, jvmti, thread) ) ) { + if ( NSK_JVMTI_VERIFY( jvmti->SuspendThread(thread) ) ) { NSK_DISPLAY0(" Agent :: Succeded in suspending.\n"); } else { NSK_COMPLAIN0("#error Agent :: occured while suspending thread.\n"); @@ -211,18 +203,18 @@ Java_nsk_jvmti_scenarios_hotswap_HS203_hs203t004_hs203t004_popThreadFrame(JNIEnv NSK_DISPLAY0(" Agent :: nsk.jvmti.scenarios.hotswap.HS203.hs203t004.popThreadFrame(... ).\n"); retvalue = JNI_FALSE; - if ( ! NSK_JVMTI_VERIFY ( NSK_CPP_STUB3(GetThreadState, jvmti, - thread, &state) ) ) { + if ( ! NSK_JVMTI_VERIFY (jvmti->GetThreadState(thread, &state) ) ) { NSK_COMPLAIN0("#error Agent :: while getting thread's state.\n"); nsk_jvmti_agentFailed(); } else { if ( state & JVMTI_THREAD_STATE_SUSPENDED) { - if ( ! NSK_JVMTI_VERIFY( NSK_CPP_STUB2(PopFrame, jvmti, thread) ) ){ + if ( ! NSK_JVMTI_VERIFY( jvmti->PopFrame(thread) ) ) { NSK_DISPLAY0("#error Agent :: occured while poping thread's frame.\n"); nsk_jvmti_agentFailed(); } else { - if ( NSK_JVMTI_VERIFY( NSK_CPP_STUB4(SetEventNotificationMode, jvmti, - JVMTI_DISABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL) ) ) { + if ( NSK_JVMTI_VERIFY( + jvmti->SetEventNotificationMode(JVMTI_DISABLE, + JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL) ) ) { NSK_DISPLAY0(" Agent :: Disabled JVMTI_EVENT_COMPILED_METHOD_LOAD.\n"); retvalue = JNI_TRUE; } else { @@ -245,7 +237,7 @@ Java_nsk_jvmti_scenarios_hotswap_HS203_hs203t004_hs203t004_resumeThread(JNIEnv * jboolean retvalue; retvalue = JNI_FALSE; - if ( NSK_JVMTI_VERIFY ( NSK_CPP_STUB2(ResumeThread, jvmti, thread))) { + if ( NSK_JVMTI_VERIFY (jvmti->ResumeThread(thread))) { NSK_DISPLAY0(" Agent :: Thread resumed.\n"); retvalue= JNI_TRUE; } else { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t001/hs204t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t001/hs204t001.cpp index 8c9ced37565..457213cd7b4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t001/hs204t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t001/hs204t001.cpp @@ -51,7 +51,7 @@ static jint newClassSize; char *getClassName(jvmtiEnv *jvmti, jclass klass) { char * className; char * generic; - if( !NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature, jvmti, klass, &className, &generic))) { + if( !NSK_JVMTI_VERIFY(jvmti->GetClassSignature(klass, &className, &generic))) { nsk_jvmti_setFailStatus(); } return className; @@ -75,7 +75,7 @@ callbackClassLoad(jvmtiEnv *jvmti_env, } else { NSK_COMPLAIN0("\nMyClass :: Failed to redefine ..\n"); } - /* if( (myTestClass =NSK_CPP_STUB2(NewGlobalRef,jni_env, klass)) == NULL) { + /* if ( (myTestClass = jni_env->NewGlobalRef(klass) ) == NULL) { NSK_COMPLAIN0("Failed to create global ref..."); } */ @@ -100,7 +100,7 @@ callbackClassPrepare(jvmtiEnv *jvmti_env, } else { NSK_COMPLAIN0("\nMyClass :: Failed to redefine ..\n"); } - if( (myTestClass = (jclass) NSK_CPP_STUB2(NewGlobalRef,jni_env, klass)) == NULL) { + if( (myTestClass = (jclass) jni_env->NewGlobalRef(klass)) == NULL) { NSK_COMPLAIN0("Failed to create global ref..."); } } @@ -240,9 +240,9 @@ Java_nsk_jvmti_scenarios_hotswap_HS204_hs204t001_hs204t001_setThread(JNIEnv * en jclass klass, jobject thread) { NSK_DISPLAY0(" Inside the setThread Method"); - if (!NSK_JNI_VERIFY(env, (testClass =(jclass) NSK_CPP_STUB2(NewGlobalRef, env, klass)) != NULL)) + if (!NSK_JNI_VERIFY(env, (testClass = (jclass) env->NewGlobalRef(klass)) != NULL)) nsk_jvmti_setFailStatus(); - if (!NSK_JNI_VERIFY(env, (testedThread =NSK_CPP_STUB2(NewGlobalRef, env, thread)) != NULL)) + if (!NSK_JNI_VERIFY(env, (testedThread = env->NewGlobalRef(thread)) != NULL)) nsk_jvmti_setFailStatus(); } @@ -252,12 +252,12 @@ Java_nsk_jvmti_scenarios_hotswap_HS204_hs204t001_hs204t001_suspendThread(JNIEnv jobject thread) { jint state; NSK_DISPLAY0("---suspend thread .. \n"); - if (NSK_CPP_STUB3(GetThreadState,jvmti,thread, &state) == JVMTI_ERROR_NONE) { + if (jvmti->GetThreadState(thread, &state) == JVMTI_ERROR_NONE) { NSK_DISPLAY0(" No Errors in finding state of the thread.\n"); if (state & JVMTI_THREAD_STATE_ALIVE) { NSK_DISPLAY0(" Thread state is alive .. So can be suspend should be possible ..\n"); nsk_jvmti_disableNotification(jvmti, JVMTI_EVENT_SINGLE_STEP, thread); - if (!NSK_JVMTI_VERIFY( NSK_CPP_STUB2(SuspendThread, jvmti, thread))) { + if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(thread))) { NSK_COMPLAIN0("TEST FAILED: unable to suspend the thread \n"); nsk_jvmti_setFailStatus(); return NSK_FALSE; @@ -278,11 +278,11 @@ Java_nsk_jvmti_scenarios_hotswap_HS204_hs204t001_hs204t001_popFrame(JNIEnv * env jthread thread) { jint state; NSK_DISPLAY0("Inside pop_Frame method.....\n"); - if (NSK_CPP_STUB3(GetThreadState,jvmti,thread, &state) == JVMTI_ERROR_NONE) { + if (jvmti->GetThreadState(thread, &state) == JVMTI_ERROR_NONE) { NSK_DISPLAY0(" Got the state of thread \n"); if ( state & JVMTI_THREAD_STATE_SUSPENDED) { NSK_DISPLAY0(" Thread is already in suspended mode..\n"); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(PopFrame, jvmti, thread))) { + if (!NSK_JVMTI_VERIFY(jvmti->PopFrame(thread))) { NSK_COMPLAIN0(" TEST FAILED: UNABLE TO POP FRAME \n"); nsk_jvmti_setFailStatus(); return NSK_FALSE; @@ -290,7 +290,7 @@ Java_nsk_jvmti_scenarios_hotswap_HS204_hs204t001_hs204t001_popFrame(JNIEnv * env NSK_DISPLAY0(" Poped frame safely.."); } /* We should resume that thread for next execution.. */ - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(ResumeThread, jvmti, thread))) { + if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(thread))) { NSK_COMPLAIN0(" TEST FAILED: UNABLE TO Resume thread \n"); nsk_jvmti_setFailStatus(); return NSK_FALSE; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t003/hs204t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t003/hs204t003.cpp index 2917d4df196..bc9cbcee5c3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t003/hs204t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t003/hs204t003.cpp @@ -51,27 +51,24 @@ JNIEXPORT void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, className = NULL; generic = NULL; redefineNumber=0; - if ( !NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature, jvmti_env, - klass, &className, &generic)) ) { + if ( !NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, &generic)) ) { NSK_DISPLAY0(" Agent :: Failed get class signature.\n"); nsk_jvmti_agentFailed(); } else { if( (strcmp(className, CLASS_NAME) == 0 ) ) { jfieldID fieldId; - if ( ! NSK_JNI_VERIFY(jni, (fieldId = NSK_CPP_STUB4(GetStaticFieldID, - jni, klass, FIELDNAME, TYPE) ) != NULL ) ) { + if ( ! NSK_JNI_VERIFY(jni, (fieldId = jni->GetStaticFieldID(klass, FIELDNAME, TYPE) ) != NULL ) ) { NSK_DISPLAY0(" Agent :: Failed to get FieldId.\n"); nsk_jvmti_agentFailed(); } else { - if ( ! NSK_JVMTI_VERIFY( NSK_CPP_STUB3(SetFieldAccessWatch, - jvmti_env, klass, fieldId) ) ) { + if ( ! NSK_JVMTI_VERIFY(jvmti_env->SetFieldAccessWatch(klass, fieldId) ) ) { NSK_DISPLAY0(" Agent :: Failed to set watch point on a field.\n"); nsk_jvmti_agentFailed(); } else { nsk_jvmti_enableNotification(jvmti_env, JVMTI_EVENT_FIELD_ACCESS, NULL); if (! NSK_JNI_VERIFY(jni, ( watchFieldClass = (jclass) - NSK_CPP_STUB2(NewGlobalRef, jni, klass) ) + jni->NewGlobalRef(klass) ) != NULL ) ) { NSK_DISPLAY0(" Agent :: Failed to get global reference for class.\n"); nsk_jvmti_agentFailed(); @@ -84,14 +81,14 @@ JNIEXPORT void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, } if ( className != NULL ) { - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char *)className))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char *)className))) { NSK_DISPLAY1(" Agent :: #error failed to Deallocate className = %s.", className); nsk_jvmti_agentFailed(); } } if ( generic != NULL ) { - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char *)generic))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char *)generic))) { NSK_DISPLAY1(" Agent :: #error failed to Deallocate class signature = %s.", generic); nsk_jvmti_agentFailed(); } @@ -116,8 +113,7 @@ JNIEXPORT void JNICALL callbackFieldAccess(jvmtiEnv *jvmti_env, if (redefineNumber != 0 ) { return; } - if ( ! NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature, jvmti_env, - field_klass, &className, &generic)) ) { + if ( ! NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(field_klass, &className, &generic)) ) { NSK_DISPLAY0(" Agent :: Failed get class signature.\n"); nsk_jvmti_agentFailed(); } else { @@ -133,13 +129,13 @@ JNIEXPORT void JNICALL callbackFieldAccess(jvmtiEnv *jvmti_env, nsk_jvmti_agentFailed(); } NSK_DISPLAY0(" Agent :: Before attempting thread suspend.\n"); - if ( ! NSK_JVMTI_VERIFY( NSK_CPP_STUB3(GetThreadInfo, jvmti_env, thread , &info)) ) { + if ( ! NSK_JVMTI_VERIFY(jvmti_env->GetThreadInfo(thread, &info))) { NSK_DISPLAY0(" Agent :: error getting thread info "); nsk_jvmti_agentFailed(); } else { NSK_DISPLAY1(" Agent :: Thread Name = %s .\n", info.name); } - if ( ! NSK_JVMTI_VERIFY( NSK_CPP_STUB2(SuspendThread, jvmti_env, thread)) ) { + if ( ! NSK_JVMTI_VERIFY(jvmti_env->SuspendThread(thread))) { NSK_DISPLAY0(" Agent :: Failed to suspend thread.\n"); nsk_jvmti_agentFailed(); } @@ -147,14 +143,14 @@ JNIEXPORT void JNICALL callbackFieldAccess(jvmtiEnv *jvmti_env, } if ( className != NULL ) { - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char *)className))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char *)className))) { NSK_DISPLAY1(" Agent :: #error failed to Deallocate className = %s.", className); nsk_jvmti_agentFailed(); } } if ( generic != NULL ) { - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char *)generic))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char *)generic))) { NSK_DISPLAY1(" Agent :: #error failed to Deallocate class signature = %s.", generic); nsk_jvmti_agentFailed(); } @@ -173,8 +169,7 @@ JNIEXPORT jint JNI_OnLoad_hs204t003(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { - if ( ! NSK_VERIFY ( JNI_OK == NSK_CPP_STUB3(GetEnv, vm, - (void **)&jvmti, JVMTI_VERSION_1_1) ) ) { + if ( ! NSK_VERIFY ( JNI_OK == vm->GetEnv((void **)&jvmti, JVMTI_VERSION_1_1) ) ) { NSK_DISPLAY0("Agent :: Could not load JVMTI interface \n"); return JNI_ERR; } else { @@ -189,15 +184,14 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { caps.can_generate_field_access_events = 1; caps.can_pop_frame = 1; caps.can_suspend = 1; - if ( ! NSK_JVMTI_VERIFY(NSK_CPP_STUB2( AddCapabilities, jvmti, &caps)) ) { + if ( ! NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)) ) { NSK_DISPLAY0(" Agent :: Failed add required capabilities\n."); return JNI_ERR; } memset(&eventCallbacks, 0, sizeof(eventCallbacks)); eventCallbacks.ClassPrepare = callbackClassPrepare; eventCallbacks.FieldAccess = callbackFieldAccess; - if (!NSK_JVMTI_VERIFY( NSK_CPP_STUB3(SetEventCallbacks, jvmti, - &eventCallbacks, sizeof(eventCallbacks) ) ) ) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks) ) ) ) { NSK_DISPLAY0(" Agent :: Error occured while setting event call back \n"); return JNI_ERR; } @@ -213,28 +207,26 @@ Java_nsk_jvmti_scenarios_hotswap_HS204_hs204t003_hs204t003_popFrame(JNIEnv * jni jboolean retvalue; jint state; retvalue = JNI_FALSE; - if (! NSK_JVMTI_VERIFY( NSK_CPP_STUB3(GetThreadState, jvmti, thread, &state)) ){ + if (! NSK_JVMTI_VERIFY(jvmti->GetThreadState(thread, &state))) { NSK_DISPLAY0(" Agent :: Error getting thread state.\n"); nsk_jvmti_agentFailed(); } else { if ( state & JVMTI_THREAD_STATE_SUSPENDED) { NSK_DISPLAY0(" Agent :: Thread state = JVMTI_THREAD_STATE_SUSPENDED.\n"); - if ( ! NSK_JVMTI_VERIFY ( NSK_CPP_STUB2(PopFrame, jvmti, thread) ) ) { + if ( ! NSK_JVMTI_VERIFY ( jvmti->PopFrame(thread) ) ) { NSK_DISPLAY0("#error Agent :: Jvmti failed to do popFrame.\n"); nsk_jvmti_agentFailed(); } else { - if ( ! NSK_JVMTI_VERIFY ( NSK_CPP_STUB2(ResumeThread, jvmti, thread)) ) { + if ( ! NSK_JVMTI_VERIFY ( jvmti->ResumeThread(thread) ) ) { NSK_DISPLAY0(" Agent :: Error occured in resuming a thread.\n"); nsk_jvmti_agentFailed(); } else { - jfieldID fieldId; - if ( ! NSK_JNI_VERIFY(jni, (fieldId = NSK_CPP_STUB4(GetStaticFieldID, - jni, watchFieldClass, FIELDNAME, TYPE) ) != NULL ) ) { + jfieldID fieldId = jni->GetStaticFieldID(watchFieldClass, FIELDNAME, TYPE); + if ( ! NSK_JNI_VERIFY(jni, fieldId != NULL ) ) { NSK_DISPLAY0(" Agent :: Failed to get FieldId before droping watchers.\n"); nsk_jvmti_agentFailed(); } else { - if ( ! NSK_JVMTI_VERIFY ( NSK_CPP_STUB3(ClearFieldAccessWatch, - jvmti, watchFieldClass, fieldId)) ) { + if ( ! NSK_JVMTI_VERIFY ( jvmti->ClearFieldAccessWatch(watchFieldClass, fieldId) ) ) { NSK_DISPLAY0(" Agent :: failed to drop field watces.\n"); nsk_jvmti_agentFailed(); } else { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t001/hs301t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t001/hs301t001.cpp index 9fa1a5300b7..465a3c17565 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t001/hs301t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t001/hs301t001.cpp @@ -49,8 +49,7 @@ JNIEXPORT jint JNI_OnLoad_hs301t001(JavaVM *jvm, char *options, void *reserved) #endif jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf("Agent:: Agent_OnLoad .\n"); - if ( ! NSK_VERIFY ( JNI_OK == NSK_CPP_STUB3(GetEnv, vm, - (void **)&jvmti, JVMTI_VERSION_1_1) ) ) { + if ( ! NSK_VERIFY ( JNI_OK == vm->GetEnv((void **)&jvmti, JVMTI_VERSION_1_1) ) ) { nsk_printf("Agent:: Could not load JVMTI interface.\n"); return JNI_ERR; } else { @@ -62,14 +61,12 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { } memset(&caps, 0, sizeof(caps)); caps.can_redefine_classes = 1; - if (! NSK_JVMTI_VERIFY ( NSK_CPP_STUB2(AddCapabilities, jvmti, &caps) )) { + if (! NSK_JVMTI_VERIFY ( jvmti->AddCapabilities(&caps) )) { nsk_printf(" Agent:: Error occured while adding capabilities.\n"); return JNI_ERR; } memset(&eventCallbacks, 0, sizeof(eventCallbacks)); - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(SetEventCallbacks, jvmti, - &eventCallbacks, sizeof(eventCallbacks)))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) { nsk_printf(" Agent:: Error occured while setting event call back.\n"); return JNI_ERR; } @@ -86,8 +83,8 @@ Java_nsk_jvmti_scenarios_hotswap_HS301_hs301t001_hs301t001_redefine(JNIEnv * jni redefineNumber=0; - //cls= NSK_CPP_STUB2(FindClass, jni, SEARCH_NAME); - if (! NSK_JNI_VERIFY(jni, (cls = NSK_CPP_STUB2(FindClass, jni, SEARCH_NAME)) != NULL) ) { + cls = jni->FindClass(SEARCH_NAME); + if (! NSK_JNI_VERIFY(jni, cls != NULL) ) { nsk_printf("Agent:: (*JNI)->FindClass(jni, %s) returns `null`.\n",SEARCH_NAME); return NSK_FALSE; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t002/hs301t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t002/hs301t002.cpp index 4347ee27d64..742bd36b719 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t002/hs301t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t002/hs301t002.cpp @@ -52,8 +52,7 @@ JNIEXPORT jint JNI_OnLoad_hs301t002(JavaVM *jvm, char *options, void *reserved) #endif jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: VM Started.\n"); - if ( ! NSK_VERIFY ( JNI_OK == NSK_CPP_STUB3(GetEnv, vm, - (void **)&jvmti, JVMTI_VERSION_1_1) ) ) { + if ( ! NSK_VERIFY ( JNI_OK == vm->GetEnv((void **)&jvmti, JVMTI_VERSION_1_1) ) ) { nsk_printf(" Agent ::Agent failed to get jvmti env.\n"); return JNI_ERR; } else { @@ -64,7 +63,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { } memset(&caps, 0, sizeof(caps)); caps.can_redefine_classes = 1; - if ( ! NSK_JVMTI_VERIFY ( NSK_CPP_STUB2(AddCapabilities, jvmti, &caps) ) ) { + if ( ! NSK_JVMTI_VERIFY ( jvmti->AddCapabilities(&caps) ) ) { nsk_printf(" Agent:: Error occured while adding capabilities.\n"); return JNI_ERR; } @@ -85,7 +84,7 @@ Java_nsk_jvmti_scenarios_hotswap_HS301_hs301t002_hs301t002_redefine(JNIEnv * jni redefineNumber=0; ret = JNI_FALSE; - if (!NSK_JNI_VERIFY(jni, (cls = NSK_CPP_STUB2(FindClass, jni, SEARCH_NAME)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(SEARCH_NAME)) != NULL)) { nsk_printf("Agent:: (*JNI)->FindClass(jni, %s) returns `null`.\n", SEARCH_NAME); return NSK_FALSE; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t003/hs301t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t003/hs301t003.cpp index 0ffb54483c2..d0fe53d5244 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t003/hs301t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t003/hs301t003.cpp @@ -36,8 +36,7 @@ void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, jclass klass) { char * className; char * generic; - if ( ! NSK_JVMTI_VERIFY ( NSK_CPP_STUB4(GetClassSignature, - jvmti_env, klass, &className, &generic) ) ) { + if ( ! NSK_JVMTI_VERIFY ( jvmti_env->GetClassSignature(klass, &className, &generic) ) ) { nsk_printf(" Agent:: Error while getting ClassFileName Signature "); } else { if (strcmp(className, CLASS_NAME ) == 0) { @@ -70,8 +69,7 @@ JNIEXPORT jint JNI_OnLoad_hs301t003(JavaVM *jvm, char *options, void *reserved) jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { jvmtiEnv * jvmti; nsk_printf("Agent:: Agent_OnLoad.\n"); - if ( ! NSK_VERIFY ( JNI_OK == NSK_CPP_STUB3(GetEnv, vm, - (void **)&jvmti, JVMTI_VERSION_1_1) ) ) { + if ( ! NSK_VERIFY ( JNI_OK == vm->GetEnv((void **)&jvmti, JVMTI_VERSION_1_1) ) ) { nsk_printf("Agent:: Could not load JVMTI interface.\n"); return JNI_ERR; } else { @@ -84,15 +82,13 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { memset(&caps, 0, sizeof(caps)); caps.can_redefine_classes = 1; caps.can_generate_all_class_hook_events=1; - if (! NSK_JVMTI_VERIFY ( NSK_CPP_STUB2(AddCapabilities, jvmti, &caps) )) { + if (! NSK_JVMTI_VERIFY ( jvmti->AddCapabilities(&caps) ) ) { nsk_printf(" Agent:: Error occured while adding capabilities.\n"); return JNI_ERR; } memset(&eventCallbacks, 0, sizeof(eventCallbacks)); eventCallbacks.ClassPrepare = &callbackClassPrepare; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(SetEventCallbacks, jvmti, - &eventCallbacks, sizeof(eventCallbacks)))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) { nsk_printf(" Agent:: Error occured while setting event call back.\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t004/hs301t004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t004/hs301t004.cpp index 6999d31bf43..806986f870c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t004/hs301t004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t004/hs301t004.cpp @@ -37,8 +37,7 @@ void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, char * className; char * generic; int redefineNumber=0; - if (! NSK_JVMTI_VERIFY( NSK_CPP_STUB4(GetClassSignature, - jvmti_env, klass, &className, &generic)) ) { + if (! NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, &generic)) ) { nsk_printf(" Agent :: Error occured in getting class signature.\n"); return; } else { @@ -71,8 +70,7 @@ JNIEXPORT jint JNI_OnLoad_hs301t004(JavaVM *jvm, char *options, void *reserved) jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { jvmtiEnv * jvmti; nsk_printf("Agent:: VM Started.\n"); - if (! NSK_VERIFY ( JNI_OK == NSK_CPP_STUB3(GetEnv, - vm, (void **)&jvmti, JVMTI_VERSION_1_1) ) ) { + if (! NSK_VERIFY ( JNI_OK == vm->GetEnv((void **)&jvmti, JVMTI_VERSION_1_1) ) ) { nsk_printf("Agent:: Could not load JVMTI interface \n"); return JNI_ERR; } else { @@ -85,15 +83,13 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { memset(&caps, 0, sizeof(caps)); caps.can_redefine_classes = 1; caps.can_generate_all_class_hook_events=1; - if ( ! NSK_JVMTI_VERIFY ( NSK_CPP_STUB2(AddCapabilities, - jvmti, &caps) )) { + if ( ! NSK_JVMTI_VERIFY (jvmti->AddCapabilities(&caps) )) { nsk_printf(" Agent:: Error occured while adding capabilities.\n"); return JNI_ERR; } memset(&eventCallbacks, 0, sizeof(eventCallbacks)); eventCallbacks.ClassPrepare = &callbackClassPrepare; - if ( ! NSK_JVMTI_VERIFY( NSK_CPP_STUB3(SetEventCallbacks, - jvmti, &eventCallbacks, sizeof(eventCallbacks)) ) ) { + if ( ! NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)) ) ) { nsk_printf(" Agent:: Error occured while setting event call back \n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI01/ji01t001/ji01t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI01/ji01t001/ji01t001.cpp index 8b5864a39de..515506c8ce4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI01/ji01t001/ji01t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI01/ji01t001/ji01t001.cpp @@ -70,14 +70,7 @@ jclass JNICALL MyFindClass(JNIEnv *env, const char *name) { static jvmtiPhase getVMPhase(jvmtiEnv *jvmti) { jvmtiPhase phase; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2( - GetPhase - , jvmti - , &phase - ) - ) - ) + if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase))) exit(NSK_STATUS_FAILED); return phase; @@ -89,14 +82,8 @@ static void doRedirect(jvmtiEnv *jvmti, jvmtiPhase phase) { NSK_DISPLAY0("doRedirect: obtaining the JNI function table ...\n"); // Store original function table - if (!NSK_VERIFY( - (err = NSK_CPP_STUB2( - GetJNIFunctionTable - , jvmti - , &orig_jni_functions - )) == JVMTI_ERROR_NONE || phase != JVMTI_PHASE_LIVE - ) - ) + err = jvmti->GetJNIFunctionTable(&orig_jni_functions); + if (!NSK_VERIFY((err == JVMTI_ERROR_NONE || phase != JVMTI_PHASE_LIVE))) { NSK_COMPLAIN2("TEST FAILED: failed to get original JNI function table during %s: %s\n" , TranslatePhase(phase) @@ -116,13 +103,7 @@ static void doRedirect(jvmtiEnv *jvmti, jvmtiPhase phase) { // Get a duplicate of the function table for future modification if (!NSK_VERIFY( - (err = NSK_CPP_STUB2( - GetJNIFunctionTable - , jvmti - , &redir_jni_functions - )) == JVMTI_ERROR_NONE || phase != JVMTI_PHASE_LIVE - ) - ) + (err = jvmti->GetJNIFunctionTable(&redir_jni_functions)) == JVMTI_ERROR_NONE || phase != JVMTI_PHASE_LIVE)) { NSK_COMPLAIN2("TEST FAILED: failed to get JNI function table for interception during %s: %s\n" , TranslatePhase(phase) @@ -148,13 +129,7 @@ static void doRedirect(jvmtiEnv *jvmti, jvmtiPhase phase) { // Set new JNI function table if (!NSK_VERIFY( - (err = NSK_CPP_STUB2( - SetJNIFunctionTable - , jvmti - , redir_jni_functions - )) == JVMTI_ERROR_NONE || phase != JVMTI_PHASE_LIVE - ) - ) + (err = jvmti->SetJNIFunctionTable(redir_jni_functions)) == JVMTI_ERROR_NONE || phase != JVMTI_PHASE_LIVE)) { NSK_COMPLAIN2("TEST FAILED: failed to set redirected JNI function table during %s: %s\n" , TranslatePhase(phase) @@ -178,14 +153,7 @@ static void doRestore(jvmtiEnv *jvmti) { NSK_DISPLAY0("doRestore: restoring the original JNI function table ...\n"); // Set new JNI function table - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2( - SetJNIFunctionTable - , jvmti - , orig_jni_functions - ) - ) - ) + if (!NSK_JVMTI_VERIFY(jvmti->SetJNIFunctionTable(orig_jni_functions))) { NSK_COMPLAIN0("TEST FAILED: failed to restore original JNI function table\n"); @@ -198,14 +166,7 @@ static void doRestore(jvmtiEnv *jvmti) { /* ====================================================================== */ static void lock(jvmtiEnv *jvmti) { - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2( - RawMonitorEnter - , jvmti - , eventLock - ) - ) - ) + if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(eventLock))) { result = NSK_STATUS_FAILED; exit(NSK_STATUS_FAILED); @@ -214,14 +175,7 @@ static void lock(jvmtiEnv *jvmti) { /* ====================================================================== */ static void unlock(jvmtiEnv *jvmti) { - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2( - RawMonitorExit - , jvmti - , eventLock - ) - ) - ) + if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(eventLock))) { result = NSK_STATUS_FAILED; exit(NSK_STATUS_FAILED); @@ -239,15 +193,11 @@ static void checkCall(JNIEnv *env jclass cls; NSK_TRACE( - (cls = NSK_CPP_STUB2( - FindClass - , env - , classSig - )) + (cls = env->FindClass(classSig)) ); NSK_TRACE( - NSK_CPP_STUB1(ExceptionClear, env) + env->ExceptionClear() ); // The check should pass if the actual number of invocations is not less that the expected number (fnd_calls >= exFndCalls). @@ -329,15 +279,7 @@ VMDeath(jvmtiEnv *jvmti, JNIEnv *env) { (void) memset(&callbacks, 0, sizeof(callbacks)); - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3( - SetEventCallbacks - , jvmti - , &callbacks - , sizeof(callbacks) - ) - ) - ) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks)))) result = NSK_STATUS_FAILED; NSK_TRACE(unlock(jvmti)); @@ -373,28 +315,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; - if (!NSK_VERIFY( - NSK_CPP_STUB3( - GetEnv - , jvm - , (void **) &jvmti - , JVMTI_VERSION_1_1 - ) == JNI_OK - && jvmti != NULL - ) - ) + if (!NSK_VERIFY(jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1) == JNI_OK && jvmti != NULL)) return JNI_ERR; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3( - CreateRawMonitor - , jvmti - , "_event_lock" - , &eventLock - ) - ) - ) + if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_event_lock", &eventLock))) return JNI_ERR; NSK_DISPLAY1("a) Trying to intercept JNI functions during %s phase ...\n" @@ -409,43 +334,17 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { callbacks.VMInit = &VMInit; callbacks.VMDeath = &VMDeath; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3( - SetEventCallbacks - , jvmti - , &callbacks - , sizeof(callbacks) - ) - ) - ) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks)))) return JNI_ERR; NSK_DISPLAY0("Event callbacks are set\nEnabling events...\n"); - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB4( - SetEventNotificationMode - , jvmti - , JVMTI_ENABLE - , JVMTI_EVENT_VM_INIT - , NULL - ) - ) - ) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB4( - SetEventNotificationMode - , jvmti - , JVMTI_ENABLE - , JVMTI_EVENT_VM_DEATH - , NULL - ) - ) - ) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) return JNI_ERR; NSK_DISPLAY0("Events are enabled\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/ji06t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/ji06t001.cpp index 71303726493..743de7a2e29 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/ji06t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/ji06t001.cpp @@ -81,14 +81,12 @@ static jniNativeInterface *redir_jni_functions = NULL; static volatile int monent_calls = 0; static void lock() { - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, - jvmti, countLock))) + if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(countLock))) exit(STATUS_FAILED); } static void unlock() { - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, - jvmti, countLock))) + if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(countLock))) exit(STATUS_FAILED); } @@ -482,8 +480,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { vm = jvm; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor, - jvmti, "_counter_lock", &countLock))) + if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_counter_lock", &countLock))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001.cpp index 6b2b81a4a5e..464a8186b51 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001.cpp @@ -114,12 +114,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode, - jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode, - jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001a.cpp index 30a60445c1f..2d850db5d8c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001a.cpp @@ -114,12 +114,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode, - jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode, - jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA03/ma03t001/ma03t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA03/ma03t001/ma03t001.cpp index 27e75a042c8..cb10b246b30 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA03/ma03t001/ma03t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA03/ma03t001/ma03t001.cpp @@ -126,16 +126,13 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode, - jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode, - jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode, - jvmti, JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001.cpp index f6be4c5243d..937daddbd39 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001.cpp @@ -53,22 +53,18 @@ static int prepare(JNIEnv* jni) { NSK_DISPLAY0("Obtain tested object from a static field of debugee class\n"); NSK_DISPLAY1("Find class: %s\n", CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (cls = - NSK_CPP_STUB2(FindClass, jni, CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(CLASS_NAME)) != NULL)) return NSK_FALSE; NSK_DISPLAY2("Find field: %s:%s\n", FIELD_NAME, FIELD_SIGNATURE); if (!NSK_JNI_VERIFY(jni, (fid = - NSK_CPP_STUB4(GetStaticFieldID, jni, cls, - FIELD_NAME, FIELD_SIGNATURE)) != NULL)) + jni->GetStaticFieldID(cls, FIELD_NAME, FIELD_SIGNATURE)) != NULL)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedObject = - NSK_CPP_STUB3(GetStaticObjectField, jni, cls, fid)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedObject = jni->GetStaticObjectField(cls, fid)) != NULL)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedObject = - NSK_CPP_STUB2(NewGlobalRef, jni, testedObject)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != NULL)) return NSK_FALSE; return NSK_TRUE; @@ -91,7 +87,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY0("Testcase #1: check that testedObject is not tagged \n"); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetTag, jvmti, testedObject, &tag))) { + if (!NSK_JVMTI_VERIFY(jvmti->GetTag(testedObject, &tag))) { nsk_jvmti_setFailStatus(); return; } @@ -101,8 +97,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { jlong_to_string(tag, buffer)); nsk_jvmti_setFailStatus(); } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, testedObject, - SAMPLE_TAG))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetTag(testedObject, SAMPLE_TAG))) { nsk_jvmti_setFailStatus(); return; } @@ -112,7 +107,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; NSK_DISPLAY0("Testcase #2: check that testedObject is tagged correctly\n"); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetTag, jvmti, testedObject, &tag))) { + if (!NSK_JVMTI_VERIFY(jvmti->GetTag(testedObject, &tag))) { nsk_jvmti_setFailStatus(); return; } @@ -133,7 +128,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; NSK_DISPLAY0("Testcase #3: check that testedObject is tagged correctly\n"); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetTag, jvmti, testedObject, &tag))) { + if (!NSK_JVMTI_VERIFY(jvmti->GetTag(testedObject, &tag))) { nsk_jvmti_setFailStatus(); return; } @@ -148,7 +143,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } nsk_jvmti_setFailStatus(); } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, testedObject, (jlong)0))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetTag(testedObject, (jlong)0))) { nsk_jvmti_setFailStatus(); return; } @@ -158,7 +153,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; NSK_DISPLAY0("Testcase #4: check that testedObject is not tagged \n"); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetTag, jvmti, testedObject, &tag))) { + if (!NSK_JVMTI_VERIFY(jvmti->GetTag(testedObject, &tag))) { nsk_jvmti_setFailStatus(); return; } @@ -174,7 +169,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; NSK_DISPLAY0("Testcase #5: check that testedObject is not tagged\n"); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetTag, jvmti, testedObject, &tag))) { + if (!NSK_JVMTI_VERIFY(jvmti->GetTag(testedObject, &tag))) { nsk_jvmti_setFailStatus(); return; } @@ -184,7 +179,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { jlong_to_string(tag, buffer)); nsk_jvmti_setFailStatus(); } - NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedObject)); + NSK_TRACE(jni->DeleteGlobalRef(testedObject)); if (!nsk_jvmti_resumeSync()) return; @@ -222,7 +217,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { memset(&caps, 0, sizeof(caps)); caps.can_tag_objects = 1; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) { + if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001a.cpp index 258a6923506..cbc5bc9054f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001a.cpp @@ -53,22 +53,18 @@ static int prepare(JNIEnv* jni) { NSK_DISPLAY0("Obtain tested object from a static field of debugee class\n"); NSK_DISPLAY1("Find class: %s\n", CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (cls = - NSK_CPP_STUB2(FindClass, jni, CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(CLASS_NAME)) != NULL)) return NSK_FALSE; NSK_DISPLAY2("Find field: %s:%s\n", FIELD_NAME, FIELD_SIGNATURE); if (!NSK_JNI_VERIFY(jni, (fid = - NSK_CPP_STUB4(GetStaticFieldID, jni, cls, - FIELD_NAME, FIELD_SIGNATURE)) != NULL)) + jni->GetStaticFieldID(cls, FIELD_NAME, FIELD_SIGNATURE)) != NULL)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedObject = - NSK_CPP_STUB3(GetStaticObjectField, jni, cls, fid)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedObject = jni->GetStaticObjectField(cls, fid)) != NULL)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedObject = - NSK_CPP_STUB2(NewGlobalRef, jni, testedObject)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != NULL)) return NSK_FALSE; return NSK_TRUE; @@ -91,7 +87,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY0("Testcase #1: check that testedObject is not tagged\n"); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetTag, jvmti, testedObject, &tag))) { + if (!NSK_JVMTI_VERIFY(jvmti->GetTag(testedObject, &tag))) { nsk_jvmti_setFailStatus(); return; } @@ -107,7 +103,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; NSK_DISPLAY0("Testcase #2: check that testedObject is not tagged\n"); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetTag, jvmti, testedObject, &tag))) { + if (!NSK_JVMTI_VERIFY(jvmti->GetTag(testedObject, &tag))) { nsk_jvmti_setFailStatus(); return; } @@ -117,8 +113,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { jlong_to_string(tag, buffer)); nsk_jvmti_setFailStatus(); } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, testedObject, - SAMPLE_TAG))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetTag(testedObject, SAMPLE_TAG))) { nsk_jvmti_setFailStatus(); return; } @@ -128,7 +123,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; NSK_DISPLAY0("Testcase #3: check that testedObject is tagged correctly\n"); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetTag, jvmti, testedObject, &tag))) { + if (!NSK_JVMTI_VERIFY(jvmti->GetTag(testedObject, &tag))) { nsk_jvmti_setFailStatus(); return; } @@ -149,7 +144,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; NSK_DISPLAY0("Testcase #4: check that testedObject is tagged correctly\n"); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetTag, jvmti, testedObject, &tag))) { + if (!NSK_JVMTI_VERIFY(jvmti->GetTag(testedObject, &tag))) { nsk_jvmti_setFailStatus(); return; } @@ -164,7 +159,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } nsk_jvmti_setFailStatus(); } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, testedObject, (jlong)0))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetTag(testedObject, (jlong)0))) { nsk_jvmti_setFailStatus(); return; } @@ -174,7 +169,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; NSK_DISPLAY0("Testcase #5: check that testedObject is not tagged\n"); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetTag, jvmti, testedObject, &tag))) { + if (!NSK_JVMTI_VERIFY(jvmti->GetTag(testedObject, &tag))) { nsk_jvmti_setFailStatus(); return; } @@ -184,7 +179,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { jlong_to_string(tag, buffer)); nsk_jvmti_setFailStatus(); } - NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedObject)); + NSK_TRACE(jni->DeleteGlobalRef(testedObject)); if (!nsk_jvmti_resumeSync()) return; @@ -222,7 +217,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { memset(&caps, 0, sizeof(caps)); caps.can_tag_objects = 1; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) { + if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002.cpp index cdd7988adaf..2091ef57ca6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002.cpp @@ -81,33 +81,28 @@ static int prepare(JNIEnv* jni) { NSK_DISPLAY0("Obtain tested object from a static field of debugee class\n"); NSK_DISPLAY1("Find class: %s\n", CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (testedClass = - NSK_CPP_STUB2(FindClass, jni, CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedClass = jni->FindClass(CLASS_NAME)) != NULL)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass) - NSK_CPP_STUB2(NewGlobalRef, jni, testedClass)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass) jni->NewGlobalRef(testedClass)) != NULL)) return NSK_FALSE; NSK_DISPLAY2("Find field: %s:%s\n", FIELD_NAME, FIELD_SIGNATURE); if (!NSK_JNI_VERIFY(jni, (fid = - NSK_CPP_STUB4(GetStaticFieldID, jni, testedClass, - FIELD_NAME, FIELD_SIGNATURE)) != NULL)) + jni->GetStaticFieldID(testedClass, FIELD_NAME, FIELD_SIGNATURE)) != NULL)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedObject = - NSK_CPP_STUB3(GetStaticObjectField, jni, testedClass, fid)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedObject = jni->GetStaticObjectField(testedClass, fid)) != NULL)) return NSK_FALSE; NSK_DISPLAY2("Find class instance: %s:%s\n", INSTANCE_NAME, INSTANCE_SIGNATURE); if (!NSK_JNI_VERIFY(jni, (fid = - NSK_CPP_STUB4(GetStaticFieldID, jni, testedClass, - INSTANCE_NAME, INSTANCE_SIGNATURE)) != NULL)) + jni->GetStaticFieldID(testedClass, INSTANCE_NAME, INSTANCE_SIGNATURE)) != NULL)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (testedInstance = - NSK_CPP_STUB3(GetStaticObjectField, jni, testedClass, fid)) != NULL)) + jni->GetStaticObjectField(testedClass, fid)) != NULL)) return NSK_FALSE; return NSK_TRUE; @@ -131,8 +126,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0("Testcase #1: check that there are no tagged objects\n"); ObjectsCount = 0; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(IterateOverHeap, jvmti, - JVMTI_HEAP_OBJECT_EITHER, heap_object_callback, &dummy))) { + if (!NSK_JVMTI_VERIFY(jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_EITHER, heap_object_callback, &dummy))) { nsk_jvmti_setFailStatus(); return; } @@ -144,8 +138,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } ObjectsCount = 0; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(IterateOverHeap, jvmti, - JVMTI_HEAP_OBJECT_TAGGED, heap_object_callback, &dummy))) { + if (!NSK_JVMTI_VERIFY(jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, heap_object_callback, &dummy))) { nsk_jvmti_setFailStatus(); return; } @@ -157,8 +150,10 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } ObjectsCount = 0; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti, - testedClass, JVMTI_HEAP_OBJECT_EITHER, heap_object_callback, &dummy))) { + if (!NSK_JVMTI_VERIFY(jvmti->IterateOverInstancesOfClass(testedClass, + JVMTI_HEAP_OBJECT_EITHER, + heap_object_callback, + &dummy))) { nsk_jvmti_setFailStatus(); return; } @@ -170,8 +165,10 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } ObjectsCount = 0; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti, - testedClass, JVMTI_HEAP_OBJECT_TAGGED, heap_object_callback, &dummy))) { + if (!NSK_JVMTI_VERIFY(jvmti->IterateOverInstancesOfClass(testedClass, + JVMTI_HEAP_OBJECT_TAGGED, + heap_object_callback, + &dummy))) { nsk_jvmti_setFailStatus(); return; } @@ -182,8 +179,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { nsk_jvmti_setFailStatus(); } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, testedObject, - SAMPLE_TAG))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetTag(testedObject, SAMPLE_TAG))) { nsk_jvmti_setFailStatus(); return; } @@ -197,8 +193,8 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0("Testcase #2: check that there is only one object tagged\n"); ObjectsCount = 0; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(IterateOverHeap, jvmti, - JVMTI_HEAP_OBJECT_EITHER, heap_object_callback, &dummy))) { + if (!NSK_JVMTI_VERIFY( + jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_EITHER, heap_object_callback, &dummy))) { nsk_jvmti_setFailStatus(); return; } @@ -209,8 +205,8 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } ObjectsCount = 0; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(IterateOverHeap, jvmti, - JVMTI_HEAP_OBJECT_TAGGED, heap_object_callback, &dummy))) { + if (!NSK_JVMTI_VERIFY( + jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, heap_object_callback, &dummy))) { nsk_jvmti_setFailStatus(); return; } @@ -221,8 +217,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } ObjectsCount = 0; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(IterateOverHeap, jvmti, - JVMTI_HEAP_OBJECT_UNTAGGED, heap_object_callback, &dummy))) { + if (!NSK_JVMTI_VERIFY(jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_UNTAGGED, heap_object_callback, &dummy))) { nsk_jvmti_setFailStatus(); return; } @@ -233,8 +228,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { nsk_jvmti_setFailStatus(); } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, testedInstance, - SAMPLE_TAG))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetTag(testedInstance, SAMPLE_TAG))) { nsk_jvmti_setFailStatus(); return; } @@ -248,8 +242,10 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0("Testcase #3: check that there is only one class object tagged\n"); ObjectsCount = 0; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti, - testedClass, JVMTI_HEAP_OBJECT_EITHER, heap_object_callback, &dummy))) { + if (!NSK_JVMTI_VERIFY(jvmti->IterateOverInstancesOfClass(testedClass, + JVMTI_HEAP_OBJECT_EITHER, + heap_object_callback, + &dummy))) { nsk_jvmti_setFailStatus(); return; } @@ -261,8 +257,10 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } ObjectsCount = 0; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti, - testedClass, JVMTI_HEAP_OBJECT_EITHER, heap_object_callback, &dummy))) { + if (!NSK_JVMTI_VERIFY(jvmti->IterateOverInstancesOfClass(testedClass, + JVMTI_HEAP_OBJECT_EITHER, + heap_object_callback, + &dummy))) { nsk_jvmti_setFailStatus(); return; } @@ -274,8 +272,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } ObjectsCount = 0; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(IterateOverHeap, jvmti, - JVMTI_HEAP_OBJECT_UNTAGGED, heap_object_callback, &dummy))) { + if (!NSK_JVMTI_VERIFY(jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_UNTAGGED, heap_object_callback, &dummy))) { nsk_jvmti_setFailStatus(); return; } @@ -287,7 +284,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } - NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedClass)); + NSK_TRACE(jni->DeleteGlobalRef(testedClass)); if (!nsk_jvmti_resumeSync()) return; @@ -326,7 +323,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { memset(&caps, 0, sizeof(caps)); caps.can_tag_objects = 1; caps.can_generate_object_free_events = 1; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) { + if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) { return JNI_ERR; } @@ -337,8 +334,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode, - jvmti, JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002a.cpp index f5cca055ff4..cd639c1fd78 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002a.cpp @@ -81,33 +81,28 @@ static int prepare(JNIEnv* jni) { NSK_DISPLAY0("Obtain tested object from a static field of debugee class\n"); NSK_DISPLAY1("Find class: %s\n", CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (testedClass = - NSK_CPP_STUB2(FindClass, jni, CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedClass = jni->FindClass(CLASS_NAME)) != NULL)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass) - NSK_CPP_STUB2(NewGlobalRef, jni, testedClass)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass) jni->NewGlobalRef(testedClass)) != NULL)) return NSK_FALSE; NSK_DISPLAY2("Find field: %s:%s\n", FIELD_NAME, FIELD_SIGNATURE); if (!NSK_JNI_VERIFY(jni, (fid = - NSK_CPP_STUB4(GetStaticFieldID, jni, testedClass, - FIELD_NAME, FIELD_SIGNATURE)) != NULL)) + jni->GetStaticFieldID(testedClass, FIELD_NAME, FIELD_SIGNATURE)) != NULL)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedObject = - NSK_CPP_STUB3(GetStaticObjectField, jni, testedClass, fid)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedObject = jni->GetStaticObjectField(testedClass, fid)) != NULL)) return NSK_FALSE; NSK_DISPLAY2("Find class instance: %s:%s\n", INSTANCE_NAME, INSTANCE_SIGNATURE); if (!NSK_JNI_VERIFY(jni, (fid = - NSK_CPP_STUB4(GetStaticFieldID, jni, testedClass, - INSTANCE_NAME, INSTANCE_SIGNATURE)) != NULL)) + jni->GetStaticFieldID(testedClass, INSTANCE_NAME, INSTANCE_SIGNATURE)) != NULL)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (testedInstance = - NSK_CPP_STUB3(GetStaticObjectField, jni, testedClass, fid)) != NULL)) + jni->GetStaticObjectField(testedClass, fid)) != NULL)) return NSK_FALSE; return NSK_TRUE; @@ -131,8 +126,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0("Testcase #1: check that there are no tagged objects\n"); ObjectsCount = 0; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(IterateOverHeap, jvmti, - JVMTI_HEAP_OBJECT_EITHER, heap_object_callback, &dummy))) { + if (!NSK_JVMTI_VERIFY(jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_EITHER, heap_object_callback, &dummy))) { nsk_jvmti_setFailStatus(); return; } @@ -144,8 +138,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } ObjectsCount = 0; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(IterateOverHeap, jvmti, - JVMTI_HEAP_OBJECT_TAGGED, heap_object_callback, &dummy))) { + if (!NSK_JVMTI_VERIFY(jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, heap_object_callback, &dummy))) { nsk_jvmti_setFailStatus(); return; } @@ -157,8 +150,10 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } ObjectsCount = 0; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti, - testedClass, JVMTI_HEAP_OBJECT_EITHER, heap_object_callback, &dummy))) { + if (!NSK_JVMTI_VERIFY(jvmti->IterateOverInstancesOfClass(testedClass, + JVMTI_HEAP_OBJECT_EITHER, + heap_object_callback, + &dummy))) { nsk_jvmti_setFailStatus(); return; } @@ -170,8 +165,10 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } ObjectsCount = 0; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti, - testedClass, JVMTI_HEAP_OBJECT_EITHER, heap_object_callback, &dummy))) { + if (!NSK_JVMTI_VERIFY(jvmti->IterateOverInstancesOfClass(testedClass, + JVMTI_HEAP_OBJECT_EITHER, + heap_object_callback, + &dummy))) { nsk_jvmti_setFailStatus(); return; } @@ -182,8 +179,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { nsk_jvmti_setFailStatus(); } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, testedObject, - SAMPLE_TAG))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetTag(testedObject, SAMPLE_TAG))) { nsk_jvmti_setFailStatus(); return; } @@ -197,8 +193,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0("Testcase #2: check that there is only one object tagged\n"); ObjectsCount = 0; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(IterateOverHeap, jvmti, - JVMTI_HEAP_OBJECT_EITHER, heap_object_callback, &dummy))) { + if (!NSK_JVMTI_VERIFY(jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_EITHER, heap_object_callback, &dummy))) { nsk_jvmti_setFailStatus(); return; } @@ -209,8 +204,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } ObjectsCount = 0; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(IterateOverHeap, jvmti, - JVMTI_HEAP_OBJECT_TAGGED, heap_object_callback, &dummy))) { + if (!NSK_JVMTI_VERIFY(jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, heap_object_callback, &dummy))) { nsk_jvmti_setFailStatus(); return; } @@ -221,8 +215,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } ObjectsCount = 0; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(IterateOverHeap, jvmti, - JVMTI_HEAP_OBJECT_UNTAGGED, heap_object_callback, &dummy))) { + if (!NSK_JVMTI_VERIFY(jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_UNTAGGED, heap_object_callback, &dummy))) { nsk_jvmti_setFailStatus(); return; } @@ -233,8 +226,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { nsk_jvmti_setFailStatus(); } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, testedInstance, - SAMPLE_TAG))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetTag(testedInstance, SAMPLE_TAG))) { nsk_jvmti_setFailStatus(); return; } @@ -248,8 +240,10 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0("Testcase #3: check that there is only one class object tagged\n"); ObjectsCount = 0; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti, - testedClass, JVMTI_HEAP_OBJECT_EITHER, heap_object_callback, &dummy))) { + if (!NSK_JVMTI_VERIFY(jvmti->IterateOverInstancesOfClass(testedClass, + JVMTI_HEAP_OBJECT_EITHER, + heap_object_callback, + &dummy))) { nsk_jvmti_setFailStatus(); return; } @@ -261,8 +255,10 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } ObjectsCount = 0; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti, - testedClass, JVMTI_HEAP_OBJECT_EITHER, heap_object_callback, &dummy))) { + if (!NSK_JVMTI_VERIFY(jvmti->IterateOverInstancesOfClass(testedClass, + JVMTI_HEAP_OBJECT_EITHER, + heap_object_callback, + &dummy))) { nsk_jvmti_setFailStatus(); return; } @@ -274,8 +270,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } ObjectsCount = 0; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(IterateOverHeap, jvmti, - JVMTI_HEAP_OBJECT_UNTAGGED, heap_object_callback, &dummy))) { + if (!NSK_JVMTI_VERIFY(jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_UNTAGGED, heap_object_callback, &dummy))) { nsk_jvmti_setFailStatus(); return; } @@ -287,7 +282,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } - NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedClass)); + NSK_TRACE(jni->DeleteGlobalRef(testedClass)); if (!nsk_jvmti_resumeSync()) return; @@ -326,7 +321,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { memset(&caps, 0, sizeof(caps)); caps.can_tag_objects = 1; caps.can_generate_object_free_events = 1; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) { + if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) { return JNI_ERR; } @@ -337,8 +332,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode, - jvmti, JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003.cpp index 888adbd0071..af2922e055b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003.cpp @@ -88,22 +88,18 @@ static int prepare(JNIEnv* jni) { NSK_DISPLAY0("Obtain tested object from a static field of debugee class\n"); NSK_DISPLAY1("Find class: %s\n", CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (cls = - NSK_CPP_STUB2(FindClass, jni, CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(CLASS_NAME)) != NULL)) return NSK_FALSE; NSK_DISPLAY2("Find field: %s:%s\n", FIELD_NAME, FIELD_SIGNATURE); if (!NSK_JNI_VERIFY(jni, (fid = - NSK_CPP_STUB4(GetStaticFieldID, jni, cls, - FIELD_NAME, FIELD_SIGNATURE)) != NULL)) + jni->GetStaticFieldID(cls, FIELD_NAME, FIELD_SIGNATURE)) != NULL)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedObject = - NSK_CPP_STUB3(GetStaticObjectField, jni, cls, fid)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedObject = jni->GetStaticObjectField(cls, fid)) != NULL)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedObject = - NSK_CPP_STUB2(NewGlobalRef, jni, testedObject)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != NULL)) return NSK_FALSE; return NSK_TRUE; @@ -124,13 +120,12 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY0("Set tag on testedObject\n"); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, testedObject, - SAMPLE_TAG))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetTag(testedObject, SAMPLE_TAG))) { nsk_jvmti_setFailStatus(); return; } - NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedObject)); + NSK_TRACE(jni->DeleteGlobalRef(testedObject)); if (!nsk_jvmti_resumeSync()) return; @@ -169,7 +164,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { memset(&caps, 0, sizeof(caps)); caps.can_tag_objects = 1; caps.can_generate_object_free_events = 1; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) { + if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) { return JNI_ERR; } @@ -182,12 +177,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode, - jvmti, JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode, - jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003a.cpp index b07881c5367..3df2bf2c0b9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003a.cpp @@ -88,22 +88,18 @@ static int prepare(JNIEnv* jni) { NSK_DISPLAY0("Obtain tested object from a static field of debugee class\n"); NSK_DISPLAY1("Find class: %s\n", CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (cls = - NSK_CPP_STUB2(FindClass, jni, CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(CLASS_NAME)) != NULL)) return NSK_FALSE; NSK_DISPLAY2("Find field: %s:%s\n", FIELD_NAME, FIELD_SIGNATURE); if (!NSK_JNI_VERIFY(jni, (fid = - NSK_CPP_STUB4(GetStaticFieldID, jni, cls, - FIELD_NAME, FIELD_SIGNATURE)) != NULL)) + jni->GetStaticFieldID(cls, FIELD_NAME, FIELD_SIGNATURE)) != NULL)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedObject = - NSK_CPP_STUB3(GetStaticObjectField, jni, cls, fid)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedObject = jni->GetStaticObjectField(cls, fid)) != NULL)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedObject = - NSK_CPP_STUB2(NewGlobalRef, jni, testedObject)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != NULL)) return NSK_FALSE; return NSK_TRUE; @@ -124,13 +120,12 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY0("Set tag on testedObject\n"); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, testedObject, - SAMPLE_TAG))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetTag(testedObject, SAMPLE_TAG))) { nsk_jvmti_setFailStatus(); return; } - NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedObject)); + NSK_TRACE(jni->DeleteGlobalRef(testedObject)); if (!nsk_jvmti_resumeSync()) return; @@ -169,7 +164,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { memset(&caps, 0, sizeof(caps)); caps.can_tag_objects = 1; caps.can_generate_object_free_events = 1; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) { + if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) { return JNI_ERR; } @@ -182,12 +177,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode, - jvmti, JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode, - jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001.cpp index 7b225e44b02..0cc873a9c51 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001.cpp @@ -54,17 +54,16 @@ Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *jni_env, char *signature = NULL; BreakpointEventsCount++; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName, - jvmti_env, method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { nsk_jvmti_setFailStatus(); } NSK_DISPLAY2("Breakpoint event: %s%s\n", name, signature); if (name != NULL) - NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)name); + jvmti_env->Deallocate((unsigned char*)name); if (signature != NULL) - NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)signature); + jvmti_env->Deallocate((unsigned char*)signature); switch(BreakpointEventsCount) { case 1: @@ -85,8 +84,7 @@ Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *jni_env, break; } - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(NotifyFramePop, jvmti_env, thread, 0))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->NotifyFramePop(thread, 0))) { nsk_jvmti_setFailStatus(); } } @@ -99,8 +97,7 @@ FramePop(jvmtiEnv *jvmti_env, JNIEnv *jni_env, char *signature = NULL; FramePopEventsCount++; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName, - jvmti_env, method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { nsk_jvmti_setFailStatus(); return; } @@ -108,9 +105,9 @@ FramePop(jvmtiEnv *jvmti_env, JNIEnv *jni_env, NSK_DISPLAY2("FramePop event: %s%s\n", name, signature); if (name != NULL) - NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)name); + jvmti_env->Deallocate((unsigned char*)name); if (signature != NULL) - NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)signature); + jvmti_env->Deallocate((unsigned char*)signature); } /* ========================================================================== */ @@ -126,8 +123,7 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY0("Prepare: find tested thread\n"); /* get all live threads */ - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads))) + if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) @@ -139,8 +135,7 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { return NSK_FALSE; /* get thread information */ - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info))) + if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info))) return NSK_FALSE; NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); @@ -151,15 +146,13 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { } if (info.name != NULL) { - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2( - Deallocate, jvmti, (unsigned char*)info.name))) + if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)info.name))) return NSK_FALSE; } } /* deallocate threads list */ - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads))) + if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads))) return NSK_FALSE; if (thread == NULL) { @@ -167,29 +160,24 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { return NSK_FALSE; } - if (!NSK_JNI_VERIFY(jni, (thread = - NSK_CPP_STUB2(NewGlobalRef, jni, thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL)) return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = - NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) return NSK_FALSE; /* get tested thread method 'checkPoint' */ - if (!NSK_JNI_VERIFY(jni, (method = NSK_CPP_STUB4( - GetMethodID, jni, klass, "checkPoint", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "checkPoint", "()V")) != NULL)) return NSK_FALSE; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetBreakpoint, jvmti, method, 0))) + if (!NSK_JVMTI_VERIFY(jvmti->SetBreakpoint(method, 0))) return NSK_FALSE; /* enable events */ - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode, - jvmti, JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL))) return NSK_FALSE; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode, - jvmti, JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, NULL))) return NSK_FALSE; return NSK_TRUE; @@ -224,12 +212,11 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { nsk_jvmti_setFailStatus(); } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode, - jvmti, JVMTI_DISABLE, JVMTI_EVENT_FRAME_POP, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_FRAME_POP, NULL))) nsk_jvmti_setFailStatus(); - NSK_TRACE(NSK_CPP_STUB3(ClearBreakpoint, jvmti, method, 0)); - NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, thread)); + NSK_TRACE(jvmti->ClearBreakpoint(method, 0)); + NSK_TRACE(jni->DeleteGlobalRef(thread)); if (!nsk_jvmti_resumeSync()) return; @@ -268,7 +255,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { memset(&caps, 0, sizeof(caps)); caps.can_generate_breakpoint_events = 1; caps.can_generate_frame_pop_events = 1; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) + if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) return JNI_ERR; if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001a.cpp index 49d622d32fd..937cd2c4ee2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001a.cpp @@ -57,8 +57,7 @@ MethodEntry(jvmtiEnv *jvmti_env, JNIEnv *jni_env, return; MethodEntryEventsCount++; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName, - jvmti_env, method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { nsk_jvmti_setFailStatus(); return; } @@ -66,15 +65,14 @@ MethodEntry(jvmtiEnv *jvmti_env, JNIEnv *jni_env, NSK_DISPLAY2("MethodEntry event: %s%s\n", name, signature); if (name != NULL) - NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)name); + jvmti_env->Deallocate((unsigned char*)name); if (signature != NULL) - NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)signature); + jvmti_env->Deallocate((unsigned char*)signature); switch(MethodEntryEventsCount) { case 1: NSK_DISPLAY0("Testcase #1: FramePop in both agents\n"); - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(NotifyFramePop, jvmti_env, thread, 0))) + if (!NSK_JVMTI_VERIFY(jvmti_env->NotifyFramePop(thread, 0))) nsk_jvmti_setFailStatus(); break; @@ -84,11 +82,9 @@ MethodEntry(jvmtiEnv *jvmti_env, JNIEnv *jni_env, case 3: NSK_DISPLAY0("Testcase #3: FramePop disabled in 2nd agent\n"); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode, - jvmti_env, JVMTI_DISABLE, JVMTI_EVENT_FRAME_POP, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_FRAME_POP, NULL))) nsk_jvmti_setFailStatus(); - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(NotifyFramePop, jvmti_env, thread, 0))) + if (!NSK_JVMTI_VERIFY(jvmti_env->NotifyFramePop(thread, 0))) nsk_jvmti_setFailStatus(); break; @@ -107,8 +103,7 @@ FramePop(jvmtiEnv *jvmti_env, JNIEnv *jni_env, char *signature = NULL; FramePopEventsCount++; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName, - jvmti_env, method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { nsk_jvmti_setFailStatus(); return; } @@ -116,9 +111,9 @@ FramePop(jvmtiEnv *jvmti_env, JNIEnv *jni_env, NSK_DISPLAY2("FramePop event: %s%s\n", name, signature); if (name != NULL) - NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)name); + jvmti_env->Deallocate((unsigned char*)name); if (signature != NULL) - NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)signature); + jvmti_env->Deallocate((unsigned char*)signature); switch(MethodEntryEventsCount) { case 1: @@ -155,8 +150,7 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY0("Prepare: find tested thread\n"); /* get all live threads */ - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads))) + if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) @@ -168,8 +162,7 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { return NSK_FALSE; /* get thread information */ - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info))) + if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info))) return NSK_FALSE; NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); @@ -180,15 +173,13 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { } if (info.name != NULL) { - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2( - Deallocate, jvmti, (unsigned char*)info.name))) + if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)info.name))) return NSK_FALSE; } } /* deallocate threads list */ - if (!NSK_JVMTI_VERIFY( - NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads))) + if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads))) return NSK_FALSE; if (thread == NULL) { @@ -196,26 +187,21 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { return NSK_FALSE; } - if (!NSK_JNI_VERIFY(jni, (thread = - NSK_CPP_STUB2(NewGlobalRef, jni, thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL)) return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = - NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) return NSK_FALSE; /* get tested thread method 'checkPoint' */ - if (!NSK_JNI_VERIFY(jni, (midCheckPoint = NSK_CPP_STUB4( - GetMethodID, jni, klass, "checkPoint", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (midCheckPoint = jni->GetMethodID(klass, "checkPoint", "()V")) != NULL)) return NSK_FALSE; /* enable events */ - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode, - jvmti, JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, NULL))) return NSK_FALSE; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode, - jvmti, JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, NULL))) return NSK_FALSE; return NSK_TRUE; @@ -246,9 +232,8 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { nsk_jvmti_setFailStatus(); } - NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, thread)); - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode, - jvmti, JVMTI_DISABLE, JVMTI_EVENT_METHOD_ENTRY, NULL))) + NSK_TRACE(jni->DeleteGlobalRef(thread)); + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_METHOD_ENTRY, NULL))) nsk_jvmti_setFailStatus(); if (!nsk_jvmti_resumeSync()) @@ -288,7 +273,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { memset(&caps, 0, sizeof(caps)); caps.can_generate_method_entry_events = 1; caps.can_generate_frame_pop_events = 1; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) + if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) return JNI_ERR; if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001.cpp index 168e64363eb..812d8e09ab9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001.cpp @@ -65,8 +65,7 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *jni_env, if (class_being_redefined == NULL) { /* sent by class load */ - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(Allocate, - jvmti_env, class_data_len, &klass_bytes))) + if (!NSK_JVMTI_VERIFY(jvmti_env->Allocate(class_data_len, &klass_bytes))) nsk_jvmti_setFailStatus(); else { memcpy(klass_bytes, class_data, class_data_len); @@ -94,12 +93,10 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *jni_env, static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY1("Find class: %s\n", CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (testedClass = - NSK_CPP_STUB2(FindClass, jni, CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedClass = jni->FindClass(CLASS_NAME)) != NULL)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass) - NSK_CPP_STUB2(NewGlobalRef, jni, testedClass)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass) jni->NewGlobalRef(testedClass)) != NULL)) return NSK_FALSE; return NSK_TRUE; @@ -126,7 +123,7 @@ static int redefine(jvmtiEnv* jvmti, jint value) { class_def.klass = testedClass; class_def.class_byte_count = klass_byte_count; class_def.class_bytes = klass_bytes; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &class_def))) + if (!NSK_JVMTI_VERIFY(jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; return NSK_TRUE; @@ -181,11 +178,10 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { nsk_jvmti_setFailStatus(); } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode, - jvmti, JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) nsk_jvmti_setFailStatus(); - NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedClass)); + NSK_TRACE(jni->DeleteGlobalRef(testedClass)); if (!nsk_jvmti_resumeSync()) return; @@ -223,7 +219,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { memset(&caps, 0, sizeof(caps)); caps.can_redefine_classes = 1; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) + if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) return JNI_ERR; if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) @@ -234,8 +230,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode, - jvmti, JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001a.cpp index 63c39260ffb..9d97aa5f2cb 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001a.cpp @@ -65,8 +65,7 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *jni_env, if (class_being_redefined == NULL) { /* sent by class load */ - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(Allocate, - jvmti_env, class_data_len, &klass_bytes))) + if (!NSK_JVMTI_VERIFY(jvmti_env->Allocate(class_data_len, &klass_bytes))) nsk_jvmti_setFailStatus(); else { memcpy(klass_bytes, class_data, class_data_len); @@ -94,12 +93,10 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *jni_env, static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY1("Find class: %s\n", CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (testedClass = - NSK_CPP_STUB2(FindClass, jni, CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedClass = jni->FindClass(CLASS_NAME)) != NULL)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass) - NSK_CPP_STUB2(NewGlobalRef, jni, testedClass)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass) jni->NewGlobalRef(testedClass)) != NULL)) return NSK_FALSE; return NSK_TRUE; @@ -126,7 +123,7 @@ static int redefine(jvmtiEnv* jvmti, jint value) { class_def.klass = testedClass; class_def.class_byte_count = klass_byte_count; class_def.class_bytes = klass_bytes; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &class_def))) + if (!NSK_JVMTI_VERIFY(jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; return NSK_TRUE; @@ -181,11 +178,10 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { nsk_jvmti_setFailStatus(); } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode, - jvmti, JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) nsk_jvmti_setFailStatus(); - NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedClass)); + NSK_TRACE(jni->DeleteGlobalRef(testedClass)); if (!nsk_jvmti_resumeSync()) return; @@ -223,7 +219,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { memset(&caps, 0, sizeof(caps)); caps.can_redefine_classes = 1; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) + if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) return JNI_ERR; if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) @@ -234,8 +230,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode, - jvmti, JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001.cpp index 43ede76927b..0fa045ead94 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001.cpp @@ -71,8 +71,7 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *jni_env, return; } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(Allocate, - jvmti_env, class_data_len, &klass_bytes))) + if (!NSK_JVMTI_VERIFY(jvmti_env->Allocate(class_data_len, &klass_bytes))) nsk_jvmti_setFailStatus(); else { @@ -174,8 +173,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode, - jvmti, JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001a.cpp index 3fd98b61ede..fe5965ba627 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001a.cpp @@ -71,8 +71,7 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *jni_env, return; } - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(Allocate, - jvmti_env, class_data_len, &klass_bytes))) + if (!NSK_JVMTI_VERIFY(jvmti_env->Allocate(class_data_len, &klass_bytes))) nsk_jvmti_setFailStatus(); else { @@ -175,8 +174,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode, - jvmti, JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) return JNI_ERR; return JNI_OK; From c86ba29693652c64aecfad318cece58ba734e12e Mon Sep 17 00:00:00 2001 From: Ioi Lam Date: Wed, 17 Oct 2018 21:51:00 -0700 Subject: [PATCH 49/66] 8212612: Add documentation about Arguments::_exit_hook Reviewed-by: hseigel, dlong, dholmes --- src/hotspot/share/runtime/arguments.cpp | 3 +++ src/hotspot/share/runtime/arguments.hpp | 2 +- src/java.base/share/native/include/jni.h | 16 +++++++++++++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp index 6347b287358..2b6b19a8593 100644 --- a/src/hotspot/share/runtime/arguments.cpp +++ b/src/hotspot/share/runtime/arguments.cpp @@ -106,6 +106,9 @@ char* Arguments::SharedArchivePath = NULL; AgentLibraryList Arguments::_libraryList; AgentLibraryList Arguments::_agentList; +// These are not set by the JDK's built-in launchers, but they can be set by +// programs that embed the JVM using JNI_CreateJavaVM. See comments around +// JavaVMOption in jni.h. abort_hook_t Arguments::_abort_hook = NULL; exit_hook_t Arguments::_exit_hook = NULL; vfprintf_hook_t Arguments::_vfprintf_hook = NULL; diff --git a/src/hotspot/share/runtime/arguments.hpp b/src/hotspot/share/runtime/arguments.hpp index 3bb983e6cd0..afc918dd0d3 100644 --- a/src/hotspot/share/runtime/arguments.hpp +++ b/src/hotspot/share/runtime/arguments.hpp @@ -36,7 +36,7 @@ // Arguments parses the command line and recognizes options -// Invocation API hook typedefs (these should really be defined in jni.hpp) +// Invocation API hook typedefs (these should really be defined in jni.h) extern "C" { typedef void (JNICALL *abort_hook_t)(void); typedef void (JNICALL *exit_hook_t)(jint code); diff --git a/src/java.base/share/native/include/jni.h b/src/java.base/share/native/include/jni.h index e15503f4d4f..aa0cdf5c242 100644 --- a/src/java.base/share/native/include/jni.h +++ b/src/java.base/share/native/include/jni.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1871,6 +1871,20 @@ struct JNIEnv_ { #endif /* __cplusplus */ }; +/* + * optionString may be any option accepted by the JVM, or one of the + * following: + * + * -D= Set a system property. + * -verbose[:class|gc|jni] Enable verbose output, comma-separated. E.g. + * "-verbose:class" or "-verbose:gc,class" + * Standard names include: gc, class, and jni. + * All nonstandard (VM-specific) names must begin + * with "X". + * vfprintf extraInfo is a pointer to the vfprintf hook. + * exit extraInfo is a pointer to the exit hook. + * abort extraInfo is a pointer to the abort hook. + */ typedef struct JavaVMOption { char *optionString; void *extraInfo; From 10b754ee85400eff2e4d222066159dbaf7680c1f Mon Sep 17 00:00:00 2001 From: Magnus Ihse Bursie Date: Thu, 18 Oct 2018 09:19:29 +0200 Subject: [PATCH 50/66] 8212587: equals in MakeBase does not handle empty strings correctly Reviewed-by: erikj --- make/common/MakeBase.gmk | 7 +++++-- test/make/TestMakeBase.gmk | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/make/common/MakeBase.gmk b/make/common/MakeBase.gmk index 170c3ed0da0..de479e353ca 100644 --- a/make/common/MakeBase.gmk +++ b/make/common/MakeBase.gmk @@ -656,8 +656,11 @@ dups = \ # String equals equals = \ - $(and $(findstring $(strip $1),$(strip $2)),\ - $(findstring $(strip $2),$(strip $1))) + $(if $(strip $1)$(strip $2),$(strip \ + $(and $(findstring $(strip $1),$(strip $2)),\ + $(findstring $(strip $2),$(strip $1)))), \ + true \ + ) # Remove a whole list of prefixes # $1 - List of prefixes diff --git a/test/make/TestMakeBase.gmk b/test/make/TestMakeBase.gmk index 8610eac36d5..26b6cdad9ce 100644 --- a/test/make/TestMakeBase.gmk +++ b/test/make/TestMakeBase.gmk @@ -1,5 +1,5 @@ # -# Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -93,6 +93,7 @@ $(eval $(call TestNotContaining,foo bar,baz)) EQUALS_VALUE1 := value1$(SPACE) EQUALS_VALUE2 := value2 +EQUALS_EMPTY := ifneq ($(call equals, $(EQUALS_VALUE1), $(EQUALS_VALUE2)), ) $(error The strings >$(EQUALS_VALUE1)< and >$(EQUALS_VALUE2)< are equal) @@ -102,6 +103,18 @@ ifeq ($(call equals, $(EQUALS_VALUE1), $(EQUALS_VALUE1)), ) $(error The strings >$(EQUALS_VALUE1)< and >$(EQUALS_VALUE1)< are not equal) endif +ifeq ($(call equals, $(EQUALS_EMPTY), $(EQUALS_EMPTY)), ) + $(error The strings >$(EQUALS_EMPTY)< and >$(EQUALS_EMPTY)< are not equal) +endif + +ifneq ($(call equals, $(EQUALS_EMPTY), $(EQUALS_VALUE2)), ) + $(error The strings >$(EQUALS_EMPTY)< and >$(EQUALS_VALUE2)< are equal) +endif + +ifneq ($(call equals, $(EQUALS_VALUE2), $(EQUALS_EMPTY)), ) + $(error The strings >$(EQUALS_VALUE2)< and >$(EQUALS_EMPTY)< are equal) +endif + ################################################################################ # Test remove-prefixes From 3c2c6bce0249c0674951338afbc7a310e2b36912 Mon Sep 17 00:00:00 2001 From: Dora Zhou Date: Thu, 18 Oct 2018 00:56:38 -0700 Subject: [PATCH 51/66] 8210406: Refactor java.util.PluggableLocale:i18n shell tests to plain java tests Reviewed-by: naoto --- .../BreakIteratorProviderTest.java | 38 +++-- .../BreakIteratorProviderTest.sh | 28 ---- .../CalendarDataProviderTest.java | 25 +-- .../CalendarDataProviderTest.sh | 28 ---- .../CalendarNameProviderTest.java | 36 ++++- .../CalendarNameProviderTest.sh | 27 ---- .../util/PluggableLocale/ClasspathTest.java | 20 ++- .../util/PluggableLocale/ClasspathTest.sh | 28 ---- .../PluggableLocale/CollatorProviderTest.java | 38 ++++- .../PluggableLocale/CollatorProviderTest.sh | 28 ---- .../CurrencyNameProviderTest.java | 40 +++-- .../CurrencyNameProviderTest.sh | 28 ---- .../DateFormatProviderTest.java | 39 ++++- .../PluggableLocale/DateFormatProviderTest.sh | 28 ---- .../DateFormatSymbolsProviderTest.java | 35 ++++- .../DateFormatSymbolsProviderTest.sh | 28 ---- .../DecimalFormatSymbolsProviderTest.java | 31 +++- .../DecimalFormatSymbolsProviderTest.sh | 28 ---- .../jdk/java/util/PluggableLocale/ExecTest.sh | 145 ------------------ .../util/PluggableLocale/GenericTest.java | 66 +++++--- .../java/util/PluggableLocale/GenericTest.sh | 28 ---- .../LocaleNameProviderTest.java | 34 ++-- .../PluggableLocale/LocaleNameProviderTest.sh | 28 ---- .../NumberFormatProviderTest.java | 34 +++- .../NumberFormatProviderTest.sh | 28 ---- .../util/PluggableLocale/PermissionTest.java | 64 ++++++-- .../util/PluggableLocale/PermissionTest.sh | 31 ---- .../TimeZoneNameProviderTest.java | 38 ++++- .../TimeZoneNameProviderTest.sh | 28 ---- .../java/util/PluggableLocale/barprovider.jar | Bin 15507 -> 0 bytes .../java/util/PluggableLocale/dummy.policy | 0 .../java/util/PluggableLocale/fooprovider.jar | Bin 16866 -> 0 bytes .../util/PluggableLocale/providersrc/Makefile | 78 ---------- .../java.util.spi.CalendarDataProvider | 0 .../java.util.spi.CalendarNameProvider | 0 .../java.util.spi.CurrencyNameProvider | 0 .../java.util.spi.LocaleNameProvider | 0 .../java.util.spi.TimeZoneNameProvider | 0 .../com/bar}/CalendarDataProviderImpl.java | 0 .../com/bar}/CalendarNameProviderImpl.java | 0 .../com/bar}/CurrencyNameProviderImpl.java | 0 .../com/bar}/CurrencyNameProviderImpl2.java | 0 .../bar}/GenericTimeZoneNameProviderImpl.java | 0 .../com/bar}/LocaleNameProviderImpl.java | 0 .../com/bar}/LocaleNames.properties | 0 .../com/bar}/LocaleNames_ja.properties | 0 .../bar}/LocaleNames_ja_JP_kyoto.properties | 0 .../bar}/LocaleNames_ja_JP_osaka.properties | 0 .../com/bar}/LocaleNames_xx.properties | 0 .../com/bar}/TimeZoneNameProviderImpl.java | 0 .../{ => foobarutils/com/foobar}/Utils.java | 0 .../java.text.spi.BreakIteratorProvider | 0 .../services}/java.text.spi.CollatorProvider | 0 .../java.text.spi.DateFormatProvider | 0 .../java.text.spi.DateFormatSymbolsProvider | 0 ...java.text.spi.DecimalFormatSymbolsProvider | 0 .../java.text.spi.NumberFormatProvider | 0 .../com/foo}/BreakIteratorProviderImpl.java | 0 .../com/foo}/CollatorProviderImpl.java | 0 .../com/foo}/DateFormatProviderImpl.java | 0 .../foo}/DateFormatSymbolsProviderImpl.java | 0 .../DecimalFormatSymbolsProviderImpl.java | 0 .../com/foo}/FooDateFormat.java | 0 .../com/foo}/FooNumberFormat.java | 0 .../com/foo}/NumberFormatProviderImpl.java | 0 65 files changed, 402 insertions(+), 753 deletions(-) delete mode 100644 test/jdk/java/util/PluggableLocale/BreakIteratorProviderTest.sh delete mode 100644 test/jdk/java/util/PluggableLocale/CalendarDataProviderTest.sh delete mode 100644 test/jdk/java/util/PluggableLocale/CalendarNameProviderTest.sh delete mode 100644 test/jdk/java/util/PluggableLocale/ClasspathTest.sh delete mode 100644 test/jdk/java/util/PluggableLocale/CollatorProviderTest.sh delete mode 100644 test/jdk/java/util/PluggableLocale/CurrencyNameProviderTest.sh delete mode 100644 test/jdk/java/util/PluggableLocale/DateFormatProviderTest.sh delete mode 100644 test/jdk/java/util/PluggableLocale/DateFormatSymbolsProviderTest.sh delete mode 100644 test/jdk/java/util/PluggableLocale/DecimalFormatSymbolsProviderTest.sh delete mode 100644 test/jdk/java/util/PluggableLocale/ExecTest.sh delete mode 100644 test/jdk/java/util/PluggableLocale/GenericTest.sh delete mode 100644 test/jdk/java/util/PluggableLocale/LocaleNameProviderTest.sh delete mode 100644 test/jdk/java/util/PluggableLocale/NumberFormatProviderTest.sh delete mode 100644 test/jdk/java/util/PluggableLocale/PermissionTest.sh delete mode 100644 test/jdk/java/util/PluggableLocale/TimeZoneNameProviderTest.sh delete mode 100644 test/jdk/java/util/PluggableLocale/barprovider.jar create mode 100644 test/jdk/java/util/PluggableLocale/dummy.policy delete mode 100644 test/jdk/java/util/PluggableLocale/fooprovider.jar delete mode 100644 test/jdk/java/util/PluggableLocale/providersrc/Makefile rename test/jdk/java/util/PluggableLocale/providersrc/{ => barprovider/META-INF/services}/java.util.spi.CalendarDataProvider (100%) rename test/jdk/java/util/PluggableLocale/providersrc/{ => barprovider/META-INF/services}/java.util.spi.CalendarNameProvider (100%) rename test/jdk/java/util/PluggableLocale/providersrc/{ => barprovider/META-INF/services}/java.util.spi.CurrencyNameProvider (100%) rename test/jdk/java/util/PluggableLocale/providersrc/{ => barprovider/META-INF/services}/java.util.spi.LocaleNameProvider (100%) rename test/jdk/java/util/PluggableLocale/providersrc/{ => barprovider/META-INF/services}/java.util.spi.TimeZoneNameProvider (100%) rename test/jdk/java/util/PluggableLocale/providersrc/{ => barprovider/com/bar}/CalendarDataProviderImpl.java (100%) rename test/jdk/java/util/PluggableLocale/providersrc/{ => barprovider/com/bar}/CalendarNameProviderImpl.java (100%) rename test/jdk/java/util/PluggableLocale/providersrc/{ => barprovider/com/bar}/CurrencyNameProviderImpl.java (100%) rename test/jdk/java/util/PluggableLocale/providersrc/{ => barprovider/com/bar}/CurrencyNameProviderImpl2.java (100%) rename test/jdk/java/util/PluggableLocale/providersrc/{ => barprovider/com/bar}/GenericTimeZoneNameProviderImpl.java (100%) rename test/jdk/java/util/PluggableLocale/providersrc/{ => barprovider/com/bar}/LocaleNameProviderImpl.java (100%) rename test/jdk/java/util/PluggableLocale/providersrc/{ => barprovider/com/bar}/LocaleNames.properties (100%) rename test/jdk/java/util/PluggableLocale/providersrc/{ => barprovider/com/bar}/LocaleNames_ja.properties (100%) rename test/jdk/java/util/PluggableLocale/providersrc/{ => barprovider/com/bar}/LocaleNames_ja_JP_kyoto.properties (100%) rename test/jdk/java/util/PluggableLocale/providersrc/{ => barprovider/com/bar}/LocaleNames_ja_JP_osaka.properties (100%) rename test/jdk/java/util/PluggableLocale/providersrc/{ => barprovider/com/bar}/LocaleNames_xx.properties (100%) rename test/jdk/java/util/PluggableLocale/providersrc/{ => barprovider/com/bar}/TimeZoneNameProviderImpl.java (100%) rename test/jdk/java/util/PluggableLocale/providersrc/{ => foobarutils/com/foobar}/Utils.java (100%) rename test/jdk/java/util/PluggableLocale/providersrc/{ => fooprovider/META-INF/services}/java.text.spi.BreakIteratorProvider (100%) rename test/jdk/java/util/PluggableLocale/providersrc/{ => fooprovider/META-INF/services}/java.text.spi.CollatorProvider (100%) rename test/jdk/java/util/PluggableLocale/providersrc/{ => fooprovider/META-INF/services}/java.text.spi.DateFormatProvider (100%) rename test/jdk/java/util/PluggableLocale/providersrc/{ => fooprovider/META-INF/services}/java.text.spi.DateFormatSymbolsProvider (100%) rename test/jdk/java/util/PluggableLocale/providersrc/{ => fooprovider/META-INF/services}/java.text.spi.DecimalFormatSymbolsProvider (100%) rename test/jdk/java/util/PluggableLocale/providersrc/{ => fooprovider/META-INF/services}/java.text.spi.NumberFormatProvider (100%) rename test/jdk/java/util/PluggableLocale/providersrc/{ => fooprovider/com/foo}/BreakIteratorProviderImpl.java (100%) rename test/jdk/java/util/PluggableLocale/providersrc/{ => fooprovider/com/foo}/CollatorProviderImpl.java (100%) rename test/jdk/java/util/PluggableLocale/providersrc/{ => fooprovider/com/foo}/DateFormatProviderImpl.java (100%) rename test/jdk/java/util/PluggableLocale/providersrc/{ => fooprovider/com/foo}/DateFormatSymbolsProviderImpl.java (100%) rename test/jdk/java/util/PluggableLocale/providersrc/{ => fooprovider/com/foo}/DecimalFormatSymbolsProviderImpl.java (100%) rename test/jdk/java/util/PluggableLocale/providersrc/{ => fooprovider/com/foo}/FooDateFormat.java (100%) rename test/jdk/java/util/PluggableLocale/providersrc/{ => fooprovider/com/foo}/FooNumberFormat.java (100%) rename test/jdk/java/util/PluggableLocale/providersrc/{ => fooprovider/com/foo}/NumberFormatProviderImpl.java (100%) diff --git a/test/jdk/java/util/PluggableLocale/BreakIteratorProviderTest.java b/test/jdk/java/util/PluggableLocale/BreakIteratorProviderTest.java index 13848d91774..13c7af7af3d 100644 --- a/test/jdk/java/util/PluggableLocale/BreakIteratorProviderTest.java +++ b/test/jdk/java/util/PluggableLocale/BreakIteratorProviderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -20,27 +20,41 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + /* - * + * @test + * @bug 4052440 8062588 8165804 8210406 + * @summary BreakIteratorProvider tests + * @library providersrc/foobarutils + * providersrc/fooprovider + * @modules java.base/sun.util.locale.provider + * java.base/sun.util.resources + * @build com.foobar.Utils + * com.foo.* + * @run main/othervm -Djava.locale.providers=JRE,SPI BreakIteratorProviderTest */ -import java.text.*; -import java.util.*; -import sun.util.locale.provider.*; +import java.text.BreakIterator; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Locale; +import java.util.ResourceBundle; +import java.util.Set; + +import com.foo.BreakIteratorProviderImpl; + +import sun.util.locale.provider.LocaleProviderAdapter; +import sun.util.locale.provider.ResourceBundleBasedAdapter; public class BreakIteratorProviderTest extends ProviderTest { - com.foo.BreakIteratorProviderImpl bip = new com.foo.BreakIteratorProviderImpl(); + BreakIteratorProviderImpl bip = new BreakIteratorProviderImpl(); List availloc = Arrays.asList(BreakIterator.getAvailableLocales()); List providerloc = Arrays.asList(bip.getAvailableLocales()); List jreloc = Arrays.asList(LocaleProviderAdapter.forJRE().getAvailableLocales()); List jreimplloc = Arrays.asList(LocaleProviderAdapter.forJRE().getBreakIteratorProvider().getAvailableLocales()); - private static final int CHARACTER_INDEX = 0; - private static final int WORD_INDEX = 1; - private static final int LINE_INDEX = 2; - private static final int SENTENCE_INDEX = 3; - public static void main(String[] s) { new BreakIteratorProviderTest(); } @@ -98,4 +112,4 @@ public class BreakIteratorProviderTest extends ProviderTest { } } } -} +} \ No newline at end of file diff --git a/test/jdk/java/util/PluggableLocale/BreakIteratorProviderTest.sh b/test/jdk/java/util/PluggableLocale/BreakIteratorProviderTest.sh deleted file mode 100644 index aeeb8e8fe03..00000000000 --- a/test/jdk/java/util/PluggableLocale/BreakIteratorProviderTest.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# -# @test -# @bug 4052440 8062588 8165804 -# @summary BreakIteratorProvider tests -# @run shell ExecTest.sh foo BreakIteratorProviderTest diff --git a/test/jdk/java/util/PluggableLocale/CalendarDataProviderTest.java b/test/jdk/java/util/PluggableLocale/CalendarDataProviderTest.java index 1ef683b300f..f35aff3c89a 100644 --- a/test/jdk/java/util/PluggableLocale/CalendarDataProviderTest.java +++ b/test/jdk/java/util/PluggableLocale/CalendarDataProviderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -20,16 +20,22 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + /* - * + * @test + * @bug 7058207 8000986 8062588 8210406 + * @summary CalendarDataProvider tests + * @library providersrc/foobarutils + * providersrc/barprovider + * @build com.foobar.Utils + * com.bar.* + * @run main/othervm -Djava.locale.providers=JRE,SPI CalendarDataProviderTest */ -import java.text.*; -import java.util.*; -import static java.util.Calendar.*; -import sun.util.locale.provider.*; -import sun.util.resources.*; -import com.bar.CalendarDataProviderImpl; +import java.util.Calendar; +import java.util.Locale; + +import static java.util.Calendar.WEDNESDAY; /** * Test case for CalendarDataProvider. @@ -51,7 +57,6 @@ public class CalendarDataProviderTest { void test() { Locale kids = new Locale("ja", "JP", "kids"); // test provider's supported locale Calendar kcal = Calendar.getInstance(kids); - Calendar jcal = Calendar.getInstance(Locale.JAPAN); // check the week parameters checkResult("firstDayOfWeek", kcal.getFirstDayOfWeek(), WEDNESDAY); @@ -64,4 +69,4 @@ public class CalendarDataProviderTest { throw new RuntimeException(s); } } -} +} \ No newline at end of file diff --git a/test/jdk/java/util/PluggableLocale/CalendarDataProviderTest.sh b/test/jdk/java/util/PluggableLocale/CalendarDataProviderTest.sh deleted file mode 100644 index 186f0b4b8f1..00000000000 --- a/test/jdk/java/util/PluggableLocale/CalendarDataProviderTest.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# -# @test -# @bug 7058207 8000986 8062588 -# @summary CalendarDataProvider tests -# @run shell ExecTest.sh bar CalendarDataProviderTest diff --git a/test/jdk/java/util/PluggableLocale/CalendarNameProviderTest.java b/test/jdk/java/util/PluggableLocale/CalendarNameProviderTest.java index 4910f1596fe..317d857bc40 100644 --- a/test/jdk/java/util/PluggableLocale/CalendarNameProviderTest.java +++ b/test/jdk/java/util/PluggableLocale/CalendarNameProviderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -20,17 +20,37 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + /* - * + * @test + * @bug 8000986 8062588 8210406 + * @summary CalendarNameProvider tests + * @library providersrc/foobarutils + * providersrc/barprovider + * @build com.foobar.Utils + * com.bar.* + * @run main/othervm -Djava.locale.providers=JRE,SPI CalendarNameProviderTest */ -import java.text.*; -import java.util.*; -import static java.util.Calendar.*; -import sun.util.locale.provider.*; -import sun.util.resources.*; +import java.util.Calendar; +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; + import com.bar.CalendarNameProviderImpl; +import static java.util.Calendar.ALL_STYLES; +import static java.util.Calendar.DAY_OF_MONTH; +import static java.util.Calendar.DAY_OF_WEEK; +import static java.util.Calendar.DECEMBER; +import static java.util.Calendar.HOUR_OF_DAY; +import static java.util.Calendar.JANUARY; +import static java.util.Calendar.LONG_STANDALONE; +import static java.util.Calendar.MONTH; +import static java.util.Calendar.SATURDAY; +import static java.util.Calendar.SHORT_STANDALONE; +import static java.util.Calendar.SUNDAY; + /** * Test case for CalendarNameProvider. * @@ -101,4 +121,4 @@ public class CalendarNameProviderTest { throw new RuntimeException(s); } } -} +} \ No newline at end of file diff --git a/test/jdk/java/util/PluggableLocale/CalendarNameProviderTest.sh b/test/jdk/java/util/PluggableLocale/CalendarNameProviderTest.sh deleted file mode 100644 index 8883c31871b..00000000000 --- a/test/jdk/java/util/PluggableLocale/CalendarNameProviderTest.sh +++ /dev/null @@ -1,27 +0,0 @@ -# -# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# - -# @test -# @bug 8000986 8062588 -# @summary CalendarNameProvider tests -# @run shell ExecTest.sh bar CalendarNameProviderTest diff --git a/test/jdk/java/util/PluggableLocale/ClasspathTest.java b/test/jdk/java/util/PluggableLocale/ClasspathTest.java index 54df0491250..302d1eb3a49 100644 --- a/test/jdk/java/util/PluggableLocale/ClasspathTest.java +++ b/test/jdk/java/util/PluggableLocale/ClasspathTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -20,13 +20,21 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + /* - * + * @test + * @bug 6388652 8062588 8210406 + * @summary Checks whether providers can be loaded from classpath. + * @library providersrc/foobarutils + * providersrc/barprovider + * @build com.foobar.Utils + * com.bar.* + * @run main/othervm -Djava.locale.providers=JRE,SPI ClasspathTest */ -import java.text.*; -import java.util.*; -import sun.util.resources.*; +import java.util.Arrays; +import java.util.List; +import java.util.Locale; public class ClasspathTest { @@ -45,4 +53,4 @@ public class ClasspathTest { throw new RuntimeException("LSS providers were NOT loaded from the class path."); } } -} +} \ No newline at end of file diff --git a/test/jdk/java/util/PluggableLocale/ClasspathTest.sh b/test/jdk/java/util/PluggableLocale/ClasspathTest.sh deleted file mode 100644 index f19d1f928dd..00000000000 --- a/test/jdk/java/util/PluggableLocale/ClasspathTest.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# -# @test -# @bug 6388652 8062588 -# @summary Checks whether providers can be loaded from classpath. -# @run shell ExecTest.sh bar ClasspathTest diff --git a/test/jdk/java/util/PluggableLocale/CollatorProviderTest.java b/test/jdk/java/util/PluggableLocale/CollatorProviderTest.java index 10611d324dd..fe0ad25029e 100644 --- a/test/jdk/java/util/PluggableLocale/CollatorProviderTest.java +++ b/test/jdk/java/util/PluggableLocale/CollatorProviderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -20,18 +20,40 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + /* - * + * @test + * @bug 4052440 8062588 8210406 + * @summary CollatorProvider tests + * @library providersrc/foobarutils + * providersrc/fooprovider + * @modules java.base/sun.util.locale.provider + * java.base/sun.util.resources + * @build com.foobar.Utils + * com.foo.* + * @run main/othervm -Djava.locale.providers=JRE,SPI CollatorProviderTest */ -import java.text.*; -import java.util.*; -import sun.util.locale.provider.*; -import sun.util.resources.*; +import java.text.Collator; +import java.text.ParseException; +import java.text.RuleBasedCollator; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Locale; +import java.util.MissingResourceException; +import java.util.ResourceBundle; +import java.util.Set; + +import com.foo.CollatorProviderImpl; + +import sun.util.locale.provider.AvailableLanguageTags; +import sun.util.locale.provider.LocaleProviderAdapter; +import sun.util.locale.provider.ResourceBundleBasedAdapter; public class CollatorProviderTest extends ProviderTest { - com.foo.CollatorProviderImpl cp = new com.foo.CollatorProviderImpl(); + CollatorProviderImpl cp = new CollatorProviderImpl(); List availloc = Arrays.asList(Collator.getAvailableLocales()); List providerloc = Arrays.asList(cp.getAvailableLocales()); List jreloc = Arrays.asList(LocaleProviderAdapter.forJRE().getAvailableLocales()); @@ -94,4 +116,4 @@ public class CollatorProviderTest extends ProviderTest { checkValidity(target, jresResult, providersResult, result, jreSupportsLocale); } } -} +} \ No newline at end of file diff --git a/test/jdk/java/util/PluggableLocale/CollatorProviderTest.sh b/test/jdk/java/util/PluggableLocale/CollatorProviderTest.sh deleted file mode 100644 index 01b6fa6191b..00000000000 --- a/test/jdk/java/util/PluggableLocale/CollatorProviderTest.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# -# @test -# @bug 4052440 8062588 -# @summary CollatorProvider tests -# @run shell ExecTest.sh foo CollatorProviderTest diff --git a/test/jdk/java/util/PluggableLocale/CurrencyNameProviderTest.java b/test/jdk/java/util/PluggableLocale/CurrencyNameProviderTest.java index 724b92bc471..dc281c75dbe 100644 --- a/test/jdk/java/util/PluggableLocale/CurrencyNameProviderTest.java +++ b/test/jdk/java/util/PluggableLocale/CurrencyNameProviderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -20,14 +20,36 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + /* - * + * @test + * @bug 4052440 7199750 8000997 8062588 8210406 + * @summary CurrencyNameProvider tests + * @library providersrc/foobarutils + * providersrc/barprovider + * @modules java.base/sun.util.locale.provider + * java.base/sun.util.resources + * @build com.foobar.Utils + * com.bar.* + * @run main/othervm -Djava.locale.providers=JRE,SPI CurrencyNameProviderTest */ -import java.text.*; -import java.util.*; -import sun.util.locale.provider.*; -import sun.util.resources.*; +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Currency; +import java.util.List; +import java.util.Locale; +import java.util.MissingResourceException; + +import com.bar.CurrencyNameProviderImpl; +import com.bar.CurrencyNameProviderImpl2; + +import sun.util.locale.provider.LocaleProviderAdapter; +import sun.util.locale.provider.ResourceBundleBasedAdapter; +import sun.util.resources.OpenListResourceBundle; public class CurrencyNameProviderTest extends ProviderTest { @@ -47,8 +69,8 @@ public class CurrencyNameProviderTest extends ProviderTest { } void test1() { - com.bar.CurrencyNameProviderImpl cnp = new com.bar.CurrencyNameProviderImpl(); - com.bar.CurrencyNameProviderImpl2 cnp2 = new com.bar.CurrencyNameProviderImpl2(); + CurrencyNameProviderImpl cnp = new CurrencyNameProviderImpl(); + CurrencyNameProviderImpl2 cnp2 = new CurrencyNameProviderImpl2(); Locale[] availloc = Locale.getAvailableLocales(); Locale[] testloc = availloc.clone(); List jreimplloc = Arrays.asList(LocaleProviderAdapter.forJRE().getCurrencyNameProvider().getAvailableLocales()); @@ -163,4 +185,4 @@ public class CurrencyNameProviderTest extends ProviderTest { Locale.setDefault(defloc); } } -} +} \ No newline at end of file diff --git a/test/jdk/java/util/PluggableLocale/CurrencyNameProviderTest.sh b/test/jdk/java/util/PluggableLocale/CurrencyNameProviderTest.sh deleted file mode 100644 index 2684767ce94..00000000000 --- a/test/jdk/java/util/PluggableLocale/CurrencyNameProviderTest.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# -# @test -# @bug 4052440 7199750 8000997 8062588 -# @summary CurrencyNameProvider tests -# @run shell ExecTest.sh bar CurrencyNameProviderTest diff --git a/test/jdk/java/util/PluggableLocale/DateFormatProviderTest.java b/test/jdk/java/util/PluggableLocale/DateFormatProviderTest.java index 22e3411edfa..d199be4772d 100644 --- a/test/jdk/java/util/PluggableLocale/DateFormatProviderTest.java +++ b/test/jdk/java/util/PluggableLocale/DateFormatProviderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -20,18 +20,41 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + /* - * + * @test + * @bug 4052440 7003643 8062588 8210406 + * @summary DateFormatProvider tests + * @library providersrc/foobarutils + * providersrc/fooprovider + * @modules java.base/sun.util.locale.provider + * java.base/sun.util.resources + * @build com.foobar.Utils + * com.foo.* + * @run main/othervm -Djava.locale.providers=JRE,SPI DateFormatProviderTest */ -import java.text.*; -import java.util.*; -import sun.util.locale.provider.*; -import sun.util.resources.*; +import java.text.DateFormat; +import java.text.Format; +import java.text.MessageFormat; +import java.text.SimpleDateFormat; +import java.util.Arrays; +import java.util.Calendar; +import java.util.HashSet; +import java.util.List; +import java.util.Locale; +import java.util.MissingResourceException; +import java.util.ResourceBundle; +import java.util.Set; + +import com.foo.DateFormatProviderImpl; + +import sun.util.locale.provider.LocaleProviderAdapter; +import sun.util.locale.provider.ResourceBundleBasedAdapter; public class DateFormatProviderTest extends ProviderTest { - com.foo.DateFormatProviderImpl dfp = new com.foo.DateFormatProviderImpl(); + DateFormatProviderImpl dfp = new DateFormatProviderImpl(); List availloc = Arrays.asList(DateFormat.getAvailableLocales()); List providerloc = Arrays.asList(dfp.getAvailableLocales()); List jreloc = Arrays.asList(LocaleProviderAdapter.forJRE().getAvailableLocales()); @@ -181,4 +204,4 @@ public class DateFormatProviderTest extends ProviderTest { } } } -} +} \ No newline at end of file diff --git a/test/jdk/java/util/PluggableLocale/DateFormatProviderTest.sh b/test/jdk/java/util/PluggableLocale/DateFormatProviderTest.sh deleted file mode 100644 index 0d1be46b6d0..00000000000 --- a/test/jdk/java/util/PluggableLocale/DateFormatProviderTest.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# -# @test -# @bug 4052440 7003643 8062588 -# @summary DateFormatProvider tests -# @run shell ExecTest.sh foo DateFormatProviderTest diff --git a/test/jdk/java/util/PluggableLocale/DateFormatSymbolsProviderTest.java b/test/jdk/java/util/PluggableLocale/DateFormatSymbolsProviderTest.java index 553f00a2ea6..a7803b01d28 100644 --- a/test/jdk/java/util/PluggableLocale/DateFormatSymbolsProviderTest.java +++ b/test/jdk/java/util/PluggableLocale/DateFormatSymbolsProviderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -20,18 +20,37 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + /* - * + * @test + * @bug 4052440 7200341 8062588 8210406 + * @summary DateFormatSymbolsProvider tests + * @library providersrc/foobarutils + * providersrc/fooprovider + * @modules java.base/sun.util.locale.provider + * java.base/sun.util.resources + * @build com.foobar.Utils + * com.foo.* + * @run main/othervm -Djava.locale.providers=JRE,SPI DateFormatSymbolsProviderTest */ -import java.text.*; -import java.util.*; -import sun.util.locale.provider.*; -import sun.util.resources.*; +import java.text.DateFormatSymbols; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Locale; +import java.util.MissingResourceException; +import java.util.ResourceBundle; +import java.util.Set; + +import com.foo.DateFormatSymbolsProviderImpl; + +import sun.util.locale.provider.LocaleProviderAdapter; +import sun.util.locale.provider.ResourceBundleBasedAdapter; public class DateFormatSymbolsProviderTest extends ProviderTest { - com.foo.DateFormatSymbolsProviderImpl dfsp = new com.foo.DateFormatSymbolsProviderImpl(); + DateFormatSymbolsProviderImpl dfsp = new DateFormatSymbolsProviderImpl(); List availloc = Arrays.asList(DateFormatSymbols.getAvailableLocales()); List providerloc = Arrays.asList(dfsp.getAvailableLocales()); List jreloc = Arrays.asList(LocaleProviderAdapter.forJRE().getAvailableLocales()); @@ -137,4 +156,4 @@ public class DateFormatSymbolsProviderTest extends ProviderTest { } } } -} +} \ No newline at end of file diff --git a/test/jdk/java/util/PluggableLocale/DateFormatSymbolsProviderTest.sh b/test/jdk/java/util/PluggableLocale/DateFormatSymbolsProviderTest.sh deleted file mode 100644 index e4191f01eaf..00000000000 --- a/test/jdk/java/util/PluggableLocale/DateFormatSymbolsProviderTest.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# -# @test -# @bug 4052440 7200341 8062588 -# @summary DateFormatSymbolsProvider tests -# @run shell ExecTest.sh foo DateFormatSymbolsProviderTest diff --git a/test/jdk/java/util/PluggableLocale/DecimalFormatSymbolsProviderTest.java b/test/jdk/java/util/PluggableLocale/DecimalFormatSymbolsProviderTest.java index af5a25e80aa..8e51f025acd 100644 --- a/test/jdk/java/util/PluggableLocale/DecimalFormatSymbolsProviderTest.java +++ b/test/jdk/java/util/PluggableLocale/DecimalFormatSymbolsProviderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -20,18 +20,33 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + /* - * + * @test + * @bug 4052440 8062588 8210406 + * @summary DecimalFormatSymbolsProvider tests + * @library providersrc/foobarutils + * providersrc/fooprovider + * @modules java.base/sun.util.locale.provider + * @build com.foobar.Utils + * com.foo.* + * @run main/othervm -Djava.locale.providers=JRE,SPI DecimalFormatSymbolsProviderTest */ -import java.text.*; -import java.util.*; -import sun.util.locale.provider.*; -import sun.util.resources.*; +import java.text.DecimalFormatSymbols; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Locale; +import java.util.Set; + +import com.foo.DecimalFormatSymbolsProviderImpl; + +import sun.util.locale.provider.LocaleProviderAdapter; public class DecimalFormatSymbolsProviderTest extends ProviderTest { - com.foo.DecimalFormatSymbolsProviderImpl dfsp = new com.foo.DecimalFormatSymbolsProviderImpl(); + DecimalFormatSymbolsProviderImpl dfsp = new DecimalFormatSymbolsProviderImpl(); List availloc = Arrays.asList(DecimalFormatSymbols.getAvailableLocales()); List providerloc = Arrays.asList(dfsp.getAvailableLocales()); List jreloc = Arrays.asList(LocaleProviderAdapter.forJRE().getAvailableLocales()); @@ -92,4 +107,4 @@ public class DecimalFormatSymbolsProviderTest extends ProviderTest { } } } -} +} \ No newline at end of file diff --git a/test/jdk/java/util/PluggableLocale/DecimalFormatSymbolsProviderTest.sh b/test/jdk/java/util/PluggableLocale/DecimalFormatSymbolsProviderTest.sh deleted file mode 100644 index e4dc5864768..00000000000 --- a/test/jdk/java/util/PluggableLocale/DecimalFormatSymbolsProviderTest.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# -# @test -# @bug 4052440 8062588 -# @summary DecimalFormatSymbolsProvider tests -# @run shell ExecTest.sh foo DecimalFormatSymbolsProviderTest diff --git a/test/jdk/java/util/PluggableLocale/ExecTest.sh b/test/jdk/java/util/PluggableLocale/ExecTest.sh deleted file mode 100644 index 7c7df1ceec2..00000000000 --- a/test/jdk/java/util/PluggableLocale/ExecTest.sh +++ /dev/null @@ -1,145 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# -# -# -# This script is the actual launcher of each locale service provider test. -# fooprovider.jar contains localized object providers and barprovider.jar -# contains localized name providers. This way, we can test providers that -# can relate to each other (such as, DateFormatSymbolsProvider and -# TimeZoneNameProvider) separately. -# -# Parameters: -# providersToTest: [foo|bar|foobar] -# java class name: -# java security policy file: (Optional. Installs security manager if exists) - -if [ "${TESTSRC}" = "" ] -then - echo "TESTSRC not set. Test cannot execute. Failed." - exit 1 -fi -echo "TESTSRC=${TESTSRC}" -if [ "${TESTJAVA}" = "" ] -then - echo "TESTJAVA not set. Test cannot execute. Failed." - exit 1 -fi -if [ "${COMPILEJAVA}" = "" ] -then - COMPILEJAVA="${TESTJAVA}" -fi -echo "TESTJAVA=${TESTJAVA}" -if [ "${TESTCLASSES}" = "" ] -then - echo "TESTCLASSES not set. Test cannot execute. Failed." - exit 1 -fi -echo "TESTCLASSES=${TESTCLASSES}" -echo "CLASSPATH=${CLASSPATH}" - -# set platform-dependent variables -OS=`uname -s` -case "$OS" in - SunOS | Linux | Darwin | AIX ) - PS=":" - FS="/" - ;; - Windows* | CYGWIN* ) - PS=";" - FS="\\" - ;; - * ) - echo "Unrecognized system!" - exit 1; - ;; -esac - -case "$1" in - "foo" ) - cp ${TESTSRC}${FS}fooprovider.jar ${TESTCLASSES} - CLASSPATHARG=".${PS}${TESTSRC}${PS}${TESTSRC}${FS}fooprovider.jar" - ;; - "bar" ) - cp ${TESTSRC}${FS}barprovider.jar ${TESTCLASSES} - CLASSPATHARG=".${PS}${TESTSRC}${PS}${TESTSRC}${FS}barprovider.jar" - ;; - "foobar" ) - cp ${TESTSRC}${FS}fooprovider.jar ${TESTCLASSES} - cp ${TESTSRC}${FS}barprovider.jar ${TESTCLASSES} - CLASSPATHARG=".${PS}${TESTSRC}${PS}${TESTSRC}${FS}fooprovider.jar${PS}${TESTSRC}${PS}${TESTSRC}${FS}barprovider.jar" - ;; -esac - - -EXTRA_OPTS="--add-exports java.base/sun.util.locale.provider=ALL-UNNAMED \ - --add-exports java.base/sun.util.resources=ALL-UNNAMED" - -# compile -cp ${TESTSRC}${FS}ProviderTest.java . -cp ${TESTSRC}${FS}$2.java . -COMPILE="${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} ${EXTRA_OPTS} \ - -XDignore.symbol.file -d . -classpath ${CLASSPATHARG} $2.java" -echo ${COMPILE} -${COMPILE} -result=$? - -if [ $result -eq 0 ] -then - echo "Compilation of the test case was successful." -else - echo "Compilation of the test case failed." - # Cleanup - rm -f ${TESTCLASSES}${FS}$2*.class - rm -f ${TESTCLASSES}${FS}fooprovider.jar - rm -f ${TESTCLASSES}${FS}barprovider.jar - exit $result -fi - -# security options -if [ "$3" != "" ] -then - SECURITYOPTS="-Djava.security.manager -Djava.security.policy=${TESTSRC}${FS}$3" -fi - -# run -RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} ${EXTRA_OPTS} ${SECURITYOPTS} -classpath ${CLASSPATHARG} -Djava.locale.providers=JRE,SPI $2 " - -echo ${RUNCMD} -${RUNCMD} -result=$? - -if [ $result -eq 0 ] -then - echo "Execution successful" -else - echo "Execution of the test case failed." -fi - -# Cleanup -rm -f ${TESTCLASSES}${FS}$2*.class -rm -f ${TESTCLASSES}${FS}fooprovider.jar -rm -f ${TESTCLASSES}${FS}barprovider.jar - -exit $result diff --git a/test/jdk/java/util/PluggableLocale/GenericTest.java b/test/jdk/java/util/PluggableLocale/GenericTest.java index eee0f95ff3a..fe41db1972e 100644 --- a/test/jdk/java/util/PluggableLocale/GenericTest.java +++ b/test/jdk/java/util/PluggableLocale/GenericTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -20,30 +20,58 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + /* - * + * @test + * @bug 4052440 8062588 8210406 + * @summary Generic tests for the pluggable locales feature + * @library providersrc/foobarutils + * providersrc/barprovider + * providersrc/fooprovider + * @modules java.base/sun.util.locale.provider + * @build com.foobar.Utils + * com.bar.* + * com.foo.* + * @run main/othervm -Djava.locale.providers=JRE,SPI GenericTest */ -import java.text.*; -import java.util.*; -import sun.util.locale.provider.*; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Locale; +import java.util.Set; + +import com.bar.CalendarDataProviderImpl; +import com.bar.CalendarNameProviderImpl; +import com.bar.CurrencyNameProviderImpl; +import com.bar.CurrencyNameProviderImpl2; +import com.bar.GenericTimeZoneNameProviderImpl; +import com.bar.LocaleNameProviderImpl; +import com.bar.TimeZoneNameProviderImpl; +import com.foo.BreakIteratorProviderImpl; +import com.foo.CollatorProviderImpl; +import com.foo.DateFormatProviderImpl; +import com.foo.DateFormatSymbolsProviderImpl; +import com.foo.DecimalFormatSymbolsProviderImpl; +import com.foo.NumberFormatProviderImpl; + +import sun.util.locale.provider.LocaleProviderAdapter; public class GenericTest { // test providers - com.foo.BreakIteratorProviderImpl breakIP = new com.foo.BreakIteratorProviderImpl(); - com.foo.CollatorProviderImpl collatorP = new com.foo.CollatorProviderImpl(); - com.foo.DateFormatProviderImpl dateFP = new com.foo.DateFormatProviderImpl(); - com.foo.DateFormatSymbolsProviderImpl dateFSP = new com.foo.DateFormatSymbolsProviderImpl(); - com.foo.DecimalFormatSymbolsProviderImpl decimalFSP = new com.foo.DecimalFormatSymbolsProviderImpl(); - com.foo.NumberFormatProviderImpl numberFP = new com.foo.NumberFormatProviderImpl(); - com.bar.CurrencyNameProviderImpl currencyNP = new com.bar.CurrencyNameProviderImpl(); - com.bar.CurrencyNameProviderImpl2 currencyNP2 = new com.bar.CurrencyNameProviderImpl2(); - com.bar.LocaleNameProviderImpl localeNP = new com.bar.LocaleNameProviderImpl(); - com.bar.TimeZoneNameProviderImpl tzNP = new com.bar.TimeZoneNameProviderImpl(); - com.bar.GenericTimeZoneNameProviderImpl tzGenNP = new com.bar.GenericTimeZoneNameProviderImpl(); - com.bar.CalendarDataProviderImpl calDataP = new com.bar.CalendarDataProviderImpl(); - com.bar.CalendarNameProviderImpl calNameP = new com.bar.CalendarNameProviderImpl(); + BreakIteratorProviderImpl breakIP = new BreakIteratorProviderImpl(); + CollatorProviderImpl collatorP = new CollatorProviderImpl(); + DateFormatProviderImpl dateFP = new DateFormatProviderImpl(); + DateFormatSymbolsProviderImpl dateFSP = new DateFormatSymbolsProviderImpl(); + DecimalFormatSymbolsProviderImpl decimalFSP = new DecimalFormatSymbolsProviderImpl(); + NumberFormatProviderImpl numberFP = new NumberFormatProviderImpl(); + CurrencyNameProviderImpl currencyNP = new CurrencyNameProviderImpl(); + CurrencyNameProviderImpl2 currencyNP2 = new CurrencyNameProviderImpl2(); + LocaleNameProviderImpl localeNP = new LocaleNameProviderImpl(); + TimeZoneNameProviderImpl tzNP = new TimeZoneNameProviderImpl(); + GenericTimeZoneNameProviderImpl tzGenNP = new GenericTimeZoneNameProviderImpl(); + CalendarDataProviderImpl calDataP = new CalendarDataProviderImpl(); + CalendarNameProviderImpl calNameP = new CalendarNameProviderImpl(); public static void main(String[] s) { new GenericTest(); @@ -108,4 +136,4 @@ public class GenericTest { s2.addAll(s1); return s2.toString(); } -} +} \ No newline at end of file diff --git a/test/jdk/java/util/PluggableLocale/GenericTest.sh b/test/jdk/java/util/PluggableLocale/GenericTest.sh deleted file mode 100644 index d1906e1c61f..00000000000 --- a/test/jdk/java/util/PluggableLocale/GenericTest.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# -# @test -# @bug 4052440 8062588 -# @summary Generic tests for the pluggable locales feature -# @run shell ExecTest.sh foobar GenericTest diff --git a/test/jdk/java/util/PluggableLocale/LocaleNameProviderTest.java b/test/jdk/java/util/PluggableLocale/LocaleNameProviderTest.java index 837a72d5910..8ed72427e3a 100644 --- a/test/jdk/java/util/PluggableLocale/LocaleNameProviderTest.java +++ b/test/jdk/java/util/PluggableLocale/LocaleNameProviderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -20,14 +20,30 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + /* - * + * @test + * @bug 4052440 8000273 8062588 8210406 + * @summary LocaleNameProvider tests + * @library providersrc/foobarutils + * providersrc/barprovider + * @modules java.base/sun.util.locale.provider + * java.base/sun.util.resources + * @build com.foobar.Utils + * com.bar.* + * @run main/othervm -Djava.locale.providers=JRE,SPI LocaleNameProviderTest */ -import java.text.*; -import java.util.*; -import sun.util.locale.provider.*; -import sun.util.resources.*; +import java.util.Arrays; +import java.util.List; +import java.util.Locale; +import java.util.MissingResourceException; + +import com.bar.LocaleNameProviderImpl; + +import sun.util.locale.provider.LocaleProviderAdapter; +import sun.util.locale.provider.ResourceBundleBasedAdapter; +import sun.util.resources.OpenListResourceBundle; public class LocaleNameProviderTest extends ProviderTest { @@ -41,7 +57,7 @@ public class LocaleNameProviderTest extends ProviderTest { } void checkAvailLocValidityTest() { - com.bar.LocaleNameProviderImpl lnp = new com.bar.LocaleNameProviderImpl(); + LocaleNameProviderImpl lnp = new LocaleNameProviderImpl(); Locale[] availloc = Locale.getAvailableLocales(); Locale[] testloc = availloc.clone(); List jreimplloc = Arrays.asList(LocaleProviderAdapter.forJRE().getLocaleNameProvider().getAvailableLocales()); @@ -121,10 +137,10 @@ public class LocaleNameProviderTest extends ProviderTest { if (YY_suffix.getVariant().equals(retVrnt)) { System.out.println(message); return; -} + } message = "variantFallbackTest() failed. Returned variant: "+retVrnt; } throw new RuntimeException(message); } -} +} \ No newline at end of file diff --git a/test/jdk/java/util/PluggableLocale/LocaleNameProviderTest.sh b/test/jdk/java/util/PluggableLocale/LocaleNameProviderTest.sh deleted file mode 100644 index 3619533c0a3..00000000000 --- a/test/jdk/java/util/PluggableLocale/LocaleNameProviderTest.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# -# @test -# @bug 4052440 8000273 8062588 -# @summary LocaleNameProvider tests -# @run shell ExecTest.sh bar LocaleNameProviderTest diff --git a/test/jdk/java/util/PluggableLocale/NumberFormatProviderTest.java b/test/jdk/java/util/PluggableLocale/NumberFormatProviderTest.java index 68f49052d07..12f60e5b2f9 100644 --- a/test/jdk/java/util/PluggableLocale/NumberFormatProviderTest.java +++ b/test/jdk/java/util/PluggableLocale/NumberFormatProviderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -20,20 +20,38 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + /* - * + * @test + * @bug 4052440 7003643 8062588 8210406 + * @summary NumberFormatProvider tests + * @library providersrc/foobarutils + * providersrc/fooprovider + * @modules java.base/sun.util.locale.provider + * @build com.foobar.Utils + * com.foo.* + * @run main/othervm -Djava.locale.providers=JRE,SPI NumberFormatProviderTest */ -import java.text.*; -import java.util.*; -import sun.util.locale.provider.*; -import sun.util.resources.*; +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.text.MessageFormat; +import java.text.NumberFormat; +import java.util.Arrays; +import java.util.Currency; +import java.util.HashSet; +import java.util.List; +import java.util.Locale; +import java.util.Set; import com.foo.FooNumberFormat; +import com.foo.NumberFormatProviderImpl; + +import sun.util.locale.provider.LocaleProviderAdapter; public class NumberFormatProviderTest extends ProviderTest { - com.foo.NumberFormatProviderImpl nfp = new com.foo.NumberFormatProviderImpl(); + NumberFormatProviderImpl nfp = new NumberFormatProviderImpl(); List availloc = Arrays.asList(NumberFormat.getAvailableLocales()); List providerloc = Arrays.asList(nfp.getAvailableLocales()); List jreloc = Arrays.asList(LocaleProviderAdapter.forJRE().getAvailableLocales()); @@ -201,4 +219,4 @@ public class NumberFormatProviderTest extends ProviderTest { } } } -} +} \ No newline at end of file diff --git a/test/jdk/java/util/PluggableLocale/NumberFormatProviderTest.sh b/test/jdk/java/util/PluggableLocale/NumberFormatProviderTest.sh deleted file mode 100644 index e38b9563deb..00000000000 --- a/test/jdk/java/util/PluggableLocale/NumberFormatProviderTest.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# -# @test -# @bug 4052440 7003643 8062588 -# @summary NumberFormatProvider tests -# @run shell ExecTest.sh foo NumberFormatProviderTest diff --git a/test/jdk/java/util/PluggableLocale/PermissionTest.java b/test/jdk/java/util/PluggableLocale/PermissionTest.java index c70c5d195cb..33231f16861 100644 --- a/test/jdk/java/util/PluggableLocale/PermissionTest.java +++ b/test/jdk/java/util/PluggableLocale/PermissionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -20,25 +20,59 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + /* - * + * @test + * @bug 8075545 8210406 + * @summary Check whether RuntimePermission("localeServiceProvider") is + * handled correctly. + * @library providersrc/foobarutils + * providersrc/barprovider + * providersrc/fooprovider + * @build com.foobar.Utils + * com.bar.* + * com.foo.* + * @run main/othervm PermissionTest + * @run main/othervm/fail/java.security.policy=dummy.policy + * -Djava.security.manager + * -Djava.locale.providers=JRE,SPI + * PermissionTest + * @run main/othervm/java.security.policy=localeServiceProvider.policy + * -Djava.security.manager + * -Djava.locale.providers=JRE,SPI + * PermissionTest */ + +import com.bar.CalendarDataProviderImpl; +import com.bar.CalendarNameProviderImpl; +import com.bar.CurrencyNameProviderImpl; +import com.bar.CurrencyNameProviderImpl2; +import com.bar.GenericTimeZoneNameProviderImpl; +import com.bar.LocaleNameProviderImpl; +import com.bar.TimeZoneNameProviderImpl; +import com.foo.BreakIteratorProviderImpl; +import com.foo.CollatorProviderImpl; +import com.foo.DateFormatProviderImpl; +import com.foo.DateFormatSymbolsProviderImpl; +import com.foo.DecimalFormatSymbolsProviderImpl; +import com.foo.NumberFormatProviderImpl; + public class PermissionTest{ // Make sure provider impls can be instantiated under a security manager.ZZ - com.foo.BreakIteratorProviderImpl breakIP = new com.foo.BreakIteratorProviderImpl(); - com.foo.CollatorProviderImpl collatorP = new com.foo.CollatorProviderImpl(); - com.foo.DateFormatProviderImpl dateFP = new com.foo.DateFormatProviderImpl(); - com.foo.DateFormatSymbolsProviderImpl dateFSP = new com.foo.DateFormatSymbolsProviderImpl(); - com.foo.DecimalFormatSymbolsProviderImpl decimalFSP = new com.foo.DecimalFormatSymbolsProviderImpl(); - com.foo.NumberFormatProviderImpl numberFP = new com.foo.NumberFormatProviderImpl(); - com.bar.CurrencyNameProviderImpl currencyNP = new com.bar.CurrencyNameProviderImpl(); - com.bar.CurrencyNameProviderImpl2 currencyNP2 = new com.bar.CurrencyNameProviderImpl2(); - com.bar.LocaleNameProviderImpl localeNP = new com.bar.LocaleNameProviderImpl(); - com.bar.TimeZoneNameProviderImpl tzNP = new com.bar.TimeZoneNameProviderImpl(); - com.bar.GenericTimeZoneNameProviderImpl tzGenNP = new com.bar.GenericTimeZoneNameProviderImpl(); - com.bar.CalendarDataProviderImpl calDataP = new com.bar.CalendarDataProviderImpl(); - com.bar.CalendarNameProviderImpl calNameP = new com.bar.CalendarNameProviderImpl(); + BreakIteratorProviderImpl breakIP = new BreakIteratorProviderImpl(); + CollatorProviderImpl collatorP = new CollatorProviderImpl(); + DateFormatProviderImpl dateFP = new DateFormatProviderImpl(); + DateFormatSymbolsProviderImpl dateFSP = new DateFormatSymbolsProviderImpl(); + DecimalFormatSymbolsProviderImpl decimalFSP = new DecimalFormatSymbolsProviderImpl(); + NumberFormatProviderImpl numberFP = new NumberFormatProviderImpl(); + CurrencyNameProviderImpl currencyNP = new CurrencyNameProviderImpl(); + CurrencyNameProviderImpl2 currencyNP2 = new CurrencyNameProviderImpl2(); + LocaleNameProviderImpl localeNP = new LocaleNameProviderImpl(); + TimeZoneNameProviderImpl tzNP = new TimeZoneNameProviderImpl(); + GenericTimeZoneNameProviderImpl tzGenNP = new GenericTimeZoneNameProviderImpl(); + CalendarDataProviderImpl calDataP = new CalendarDataProviderImpl(); + CalendarNameProviderImpl calNameP = new CalendarNameProviderImpl(); public static void main(String[] s) { new PermissionTest(); diff --git a/test/jdk/java/util/PluggableLocale/PermissionTest.sh b/test/jdk/java/util/PluggableLocale/PermissionTest.sh deleted file mode 100644 index 50a42f1ff3e..00000000000 --- a/test/jdk/java/util/PluggableLocale/PermissionTest.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# -# @test -# @bug 8075545 -# @summary Check whether RuntimePermission("localeServiceProvider") is -# handled correctly -# @run shell ExecTest.sh foobar PermissionTest -# @run shell/fail ExecTest.sh foobar PermissionTest dummy -# @run shell ExecTest.sh foobar PermissionTest localeServiceProvider.policy diff --git a/test/jdk/java/util/PluggableLocale/TimeZoneNameProviderTest.java b/test/jdk/java/util/PluggableLocale/TimeZoneNameProviderTest.java index 8eab9947dd7..d71b33edab3 100644 --- a/test/jdk/java/util/PluggableLocale/TimeZoneNameProviderTest.java +++ b/test/jdk/java/util/PluggableLocale/TimeZoneNameProviderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -20,19 +20,41 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + /* - * + * @test + * @bug 4052440 8003267 8062588 8210406 + * @summary TimeZoneNameProvider tests + * @library providersrc/foobarutils + * providersrc/barprovider + * @modules java.base/sun.util.locale.provider + * java.base/sun.util.resources + * @build com.foobar.Utils + * com.bar.* + * @run main/othervm -Djava.locale.providers=JRE,SPI TimeZoneNameProviderTest */ -import java.text.*; +import java.text.DateFormatSymbols; +import java.text.ParseException; +import java.text.SimpleDateFormat; import java.time.format.TextStyle; -import java.util.*; -import sun.util.locale.provider.*; -import sun.util.resources.*; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import java.util.Locale; +import java.util.MissingResourceException; +import java.util.TimeZone; + +import com.bar.TimeZoneNameProviderImpl; + +import sun.util.locale.provider.LocaleProviderAdapter; +import sun.util.locale.provider.ResourceBundleBasedAdapter; +import sun.util.resources.OpenListResourceBundle; public class TimeZoneNameProviderTest extends ProviderTest { - com.bar.TimeZoneNameProviderImpl tznp = new com.bar.TimeZoneNameProviderImpl(); + TimeZoneNameProviderImpl tznp = new TimeZoneNameProviderImpl(); public static void main(String[] s) { new TimeZoneNameProviderTest(); @@ -248,4 +270,4 @@ public class TimeZoneNameProviderTest extends ProviderTest { throw new RuntimeException("Generic name fallback failed. got: "+generic); } } -} +} \ No newline at end of file diff --git a/test/jdk/java/util/PluggableLocale/TimeZoneNameProviderTest.sh b/test/jdk/java/util/PluggableLocale/TimeZoneNameProviderTest.sh deleted file mode 100644 index f80874b68fe..00000000000 --- a/test/jdk/java/util/PluggableLocale/TimeZoneNameProviderTest.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# -# @test -# @bug 4052440 8003267 8062588 -# @summary TimeZoneNameProvider tests -# @run shell ExecTest.sh bar TimeZoneNameProviderTest diff --git a/test/jdk/java/util/PluggableLocale/barprovider.jar b/test/jdk/java/util/PluggableLocale/barprovider.jar deleted file mode 100644 index 3a6f37a94588c36bed0fc0c8cc7e29aea3dfb2fb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15507 zcmbt*1yr3$5-uUQyL)ig;O_439-NCi!QI{6-8BSv*AU#@0t5ntJlNUUki41MedjfY zbM8I2|LUs0tE#K2>ywjw4T1s$0RaJI5bVhh^kP5)fdEMhEAi8a%ZSiD4g&$b29lEm zhj^X={O@UUfBP`X(~SQ-EX^+?E+VX`L@O!T3K2A!TFuB!-N>mGMsz zB%$6vi_lUA!Pa<>AhaxCsTiIweIjamGvCs_vC|H~_~>IpG~vL4@>L3s2n_gI4&E2p zhPk3PIrbB^x%|5m&k?t}yk+(vViagnY;V?ZrXYU|#yiFB<#Ej`6XCmx!bFEB zy#a?fiIXkYe`5cix8Q#g!O_mn*xJzbr3e9|3{X#c1UkuGgkV$|s6(ij6R*P$Fe)X| z46y{ayKmNPIv@D4h97i+9xQ#`Y!#uDdk&m}nC6(BXzidk1KETJN$; zF|Te&OySMSn^(``B%F4pSv`qT@^5ke+An}S{c31q^)FBG*E61d-SZ3seY=0~7kDpb z{WK|iT3b6CTVp#1Gh_P*#VPY8dK6FiD}1=Cg4cBRwT_1IJk2FD$pwJwj07&qMy)V% z1=1nF_nS65#XH7EpO_ejvzEPdcgK(^5|g`6*cZ!eS_$~{ust@f6nZ3vx|FWPu^~*m z4mHHOaGDH-6buHd>6h*7H|LVypDLD515eckGv#B}-ZFg0G)$~)QvXs-{$RxzX78;^ z9gA~mglUK;c$UPhMBMs#%?PqOwXEteobP*PxK7CT{gcplawtRT$yFSNCPV!&o|p zYV!h0b{F}Ug1DP{NH1#UZSX^;)>lr@EibCKSbu!x6r`nj>m5y%Cgyvhi+GeU2So&> z`p=sb!?o{}Ep5o>SyE5Gg?uCm>5+#5CdCV+Sa1)B0=(6f^KeL_jx&I^f-ucQDPtom z8@hxzBF}@fOq372Ce`^Q<7G1i}Qs)N{!i(tvZw~r(b zZYNU^Ac`l()j|>BMGyQux0=^~hdmvEW~L zC2=cTOGa8lOMQF$4@#PfGja%zGB%Jk1ZW8Iy}m>gO?JpWzzTdQ)aVuTimnop#~{sf9*$9J9Awo}4x%*?T?S-Qjj(yd|k8R0-1DPnZny zf_#mEf`Cp>Oz58+tnU?R%P`!R>`#Cff{}ENfsDgLVIUzS&{-dhiC9OJDHg0JBc#yT z{vI?iySC~bhv1Bpc~a#?ZrQ;_e2St2OBX`wJj_^z@%cy%O<<>QOCF<^tXW{I3bm2) zeM9Wr&~&`&3Nd`|Tx?U%B+-DmNW~k6yXCmd( z4HC#Ai*TL>0K-t&53swMb2$AYG&o5p3a>Daf>L z`CQds*uF7DBgx`~0cK9Uu%k>VOC}%iBh5m(eLs~1S+GvaUR2YZ;Zte-v2TJ}*;#1l zsnRzkH92+eFFSS?ta@LDMXzlnEuk~6*6OEz2=-l|^EDBy9PmdU6GUW%Yr4yJ^0;=o z6ANb6gc-#P#AlxvzguVW5LF%wB5t$&82<1c=)s|bc$?zkdl7_(&;X`y3X?x083NHJ z!{J>NA@0^^$Zp;{qU(WoY(ix0x1tc<-w|@ewh&8v?63O~x6C|sKGT+hUq#I4;WKVx z^dp#vjq8I@gd5;)xvVQ6C23*@tKR%DO(Jlb={*e@umBT}z3jF2`9z~_M5geA@^#9k z)+_c~*qHDi;X?To(>P}AU1JWUwv|nG-=RI`n6{L^x(IErJsVvx!AEg|*FZq-VE<%v zq%V!`-y!A8P~h3<{;;_W6-^stQIyC2)$7UyQb0OJ?E8=w5KA!zD~cpGNLU#Gm~l{~ zSkj#6h&sSqOQ$inh+)l`(ys*y1*LQ+&`QDrrAic51^!44S0xE|theZ>l-!1#tfu_R z-))_CN7L;)F2~rJ9*?q2KfYq~i}ii8pE#M<>1WLgx0UOAGgY>ZG>vped_@&KMPvBh zo6eqLP*}vrp9%_7Dn7~2JOuoRk!C`D zf&Tn(cq1u_U;~ZraQ`$I$Jea2i$hXtx9cYdk4JA{sK=_wtWtzUSu!B!$jxAK-DKxr z1N&2skznIUL|J3isfw^PLc10U(pqPF)+5MBG5qUUWZzz^ugnHYj@YMiSB_)mmyB4* zWa&_29Ddh#OhGAe>C4DT{kENKcx1wpFl6L3Aa=YeN-%)K;%q8LqqMSc=AdiDws-iW z;dF%ZOH%APp`W+ZL|Un0?a+0_kG*1xrn$G${SNi*CPi-KNg~~=Bka2+O6iD?Vq6;% zE}b=j)HCYk)y=G#L(K?6pnU|+JK={L&M@#E!`LD{<`<2)wvCc|ka6lg#D^~Z`XAM;7 z6h^<^jyBferD#sujYqa_EftFh;4JwX16)|eWO)ul3k14qGd4w3PA)V!lVUS>yP!dR z$IcTa@sDXg9I6+Ze?99xY}Iut4-L(sIQ@Ku$O?jtE!y#+3M1eB;VYIpd6QUo!R3BG zWqk0=B`y6LOnYf=8iT1^$b9#T77v2#M~byOsG5gvYG-s-+k+h%KWN&6AL!Bsz(M<< z>;kee;A3o|PV_ib6B=eR5mJWu2gMiSnfdDR9pN3DAuQGSW}TDrD6z{&;Y1i%E#)0E0?b~ z1%oX~C`UyG^SuhfBfz=DCh#E=vIJPuSgM5r%pOlH4@8Pf6 z0twZ8lmjC<1|w+)i?4>B`z*$|EH%Oryk>WPRVfZ|@Q>jmn}d=)6)U4bl)C zZhChD!CIATT>EBO;dOmb^Stg(jlFuYs=TyL$4%Ug6W~mptb>~#MimQ%D z8-5#&wwAC#{a%4`nj50xg~JG~kD$+vcHqPm85I-=s2B2|94*ZYM=NSKR$IDAqpg6V2Hz6@-`(h!{k%E4NB6$Xe zQeA#*DB;Bz=&k}Fid}-JQA%7Y7eeb~%2E``D)c>*8rx-QRmZj3j?`eD6@&0C>X*0+ zT9?$PpD_dXMXV35k&HjvX$5XCnG~zdQ*b^4`^CR)#N6In%^aJo*^NKB)}XLaZE{&H zNHFU9ngkM)oSDU=w=aP$t=3yHc`?iMtjsjW?+ybQ@- zm4ohy)jE}zgRG6UOJB87h+!OUyl*{Qt!1x8lwC{sJv*>SZSou@3?`(X7K2DwM&B`x zpCUaAfhB-s_0?L@hxna@QLd`gA5$arEQ}cGEEG-L-=Z+7)U>++nt))haU~&f?%oJDdqym{#Ij7yaxrPz|x24`?K(CCPI{ zZ>93^HW-bSlV#PxkSBoqG?}rpN6AG+kMy$Mbxz7Mpi#pq;&h%Me8v~pF%*i#iYD#j z#DIw*5jp^u!WYEi4S0AZ@5IbOdX4`^L)22|G~r{;8O*Q@Zt1FBs7sa921*4!AyXGF zWV0g@RR|9`o_O%K6!vRr_iSme&ruSc)}M-{vr|8 zb#Zx_i^j=YJmsPRYtZ-b;CIu$N$e}F48wTKvt}@6IF_a)QK2LYxuNmmc3MB~wOc4W zF_$`fds}a2*!Lv%*fK=Gy>M@6(GsGS>XX!aOGzCv7^we{JALo zaNtzw)uLTwAgv=c!&Jm0lr+)kscCvN8U`gs>x@H%Qb z_lt_m3k0p2fj(eUfux&xOq4fw>2b_T%_M4Z*z8nZD($Wbox&!K@!>BLfw$UA}6C$UX3iGA2nP>5M&p^9)hJ36{k%fWYjPBOFo3X z;61&pmAAqV+E~HEnhz}C3bTy(MmMnv%a9H-%o(A42`;0h!W|_L3FVD0QlUiZ%1hX# z*A+RA0F)}?7G833y=ncFuY$I>(P(v`b7W16jAf1ViENkU8U-Z6(kWzWWT4V|by85} ztbH7GGmvsn7f}wumzlCmCemM9&ZQ`WphYs_1<$D+D>xplUBtI^5-9ff+p)-y$}H-5 z>2bI3n>uM_A+62&Bg-ix6LCSuTG3)7(Pi8pZU{mgK?}pZuzK8AN?5;s1FQ9U%OhYz zf=giY$gvpAmr_ZFSXrdhdsRndL((u|EV$gl*e}w|GOoyght#V&WA*^JW6v~DBqh_e zAi)SJi}+gpwdhEAl+CNn+`=TwU4*O(p`A4_&yvCjT|aUCKI!(zF&i;tnpXmSTy{-% z^b=;zf4 z74D8enWzjQwXItKY|UJqyN+rK=7`^3>RTz`ClGNM?3xvPDySAn;Sx3*MHo)_6~70c zN2=!?E;#(<>?xQcZ;kr_mzW+JwMX*(>IeKKx4Qz8h3Fw1pGW8b2o1DCeJGpk1QsKy z$r$zpkqav;2$NNzQ{(ZlL>>fb8apLD2@pT?Dt@$;ksdoxcyhTKs9ZPA3m7ym!5qZM zV&)`Zt>|2H_fF<19BPrII^pw}=+O8Dv`Nc;4!`5sC z&BDbjXpVEQ1-ccZ$9t3|lveFvWp!}eM;tr_)f6Q@54`DMy!f88DI~>#f?U`DhyUG$ zgRI>do!Zv{RsnH>S}e&+KwfbdPe?}!SB<6}BUc$GAY=_(4Bx=n}lrZO~!1`7;n zop9GT#&F`|ghzN%+{s#;c{#>!NF{y@He_TK9*k5r%KB)ie)WZ@*WY1p+N8jxE!Mps z52ZN~FwP~()nzfiSC8wh%Q|*aj0$AScRV&pyTeXfFYK@rL2iRC;9<$^~KI2s~@+^_Wa`8>pRwGJNPi9>QMb; z2V?(e2Y;0fzPw;~5uGTESkLgGaBp!Pr^fGs=JRF4f^NR253`mllOQJ~8e~SLD0vT> z$|lHMVyN1v7~*ZvC76p;9L$0bx-8x;Xcm*)m(pT7&TW4-=W+jd0R7%^`7HoU6-{rm zGz7K$aPXiQquE4ntkV&hVtEpvD4MWgd0Db`+V}|ATCu&B2G*^farPtGLFo{CEK{wdNizFx0ac zwU?(bpQDkvKIc^481pKqH({tO>lxj+y!&wk890nzwa=GHnP1bUvpz%BSITlSy7ky; zeG}LnQBvnV_wkbqj)Zsh1#kFVALT6XE9Ust+%;5gpLL>H(- zP4;(=7)Cc`^KB?4$`W{QuBk6l2(reHT(=;gGvFt8M|9t`a~*U%AU|smDC_0p=_?>0 z(Wjci-xu-z*^}DX>s#pm?n(I&JSJ4jq! z39PzZb?CyYT0E}g8T9ZN~+!Qw#%-OTeFarhBM{x_$7>e1zVl$$9aL(5SV z=EKW=lVR^(kEEdUH-~o%A3FmX^m^wDaus=ed23Odm80K2Yuhz=*-?|(A~r(FiJ3Xo zx>p15;IJBwj4Y|xvc#mnlXlZd8wFYUZXmTh5fkP3ef<#%J1!mD`0bf6k}A9!MV}=0 z>QcT&=?Tp_jz2TpZ0O7@#xGTAj=|&zW&=K6Nqkb4l3&mi@BR0BIVlR1;Fcw=AYf$i znm<@Ce4qVb*H#_=A+M@hNMuui0!DJ|!VR(Ls6)3Qy2NU1e_J?tPQe5L9i`Su@3?FK zGwu})HiP^fc;(5rlA}mVcTSXIM`OBRK5Ugl09EGnhVRz~i;7S4Z>h7l>PL2xM?H`3<^M}1YT)EDJjOtu}JmEfyYXTDdg*zmDo|pC4`{~ z%TE!>s%fDZ`^a|OvbO5cWO>XNY_86PjG?*=vYVcrE!}(EFOz=!et#(qGy)ik*h8S~ zsrz&)g02JDQf@CKDAxE|y)PQ5DT)Wty3$RFn^Jad znI|jkk=u-0edS7UvAk6Q-(s4G)>5p(O))T28?}T|#LX<|j5zmdT#n^2({$kbuz{sU zNHM(n5-VJ0eys>I3ZK%-&5KH9H!ayJv}$nkMkuy`d6pD__DJ)Y$Xs%<7`6HiVw(XabihvxJK4ux{!nwgrY4h$`16u9a zuZf3Rs396(R`~N+F{kE_sGVer@Maoku+Fz}#SODM6eSz`k){gLSNz^uUS(ripm-d1 zL5x%0j`~diWb{^NuPUaB=kr9;;TpXiL4f3%V0v-y zL}8opQk-MAJ(!!UJjB_S4xM$O-^Qk0;&}vAsZX;~Z}@^wMg7*Ai& zIy?cy9`}1p8%u9q8^H&X!NE+LSVGu9Im;}5Z6xSZO>_DoeWy*0xPS&{GNAl+pgtc@ zzNB8MnSC`c1-$fbK0tCqlUEyZ?GaEclo`3q#g5oS3zK%dHjzFW@@^>d9OPcXjHa=n z^3A6f-*LCb#VLV4^7%o(hIfc+b`uQ;KQg`E#4Vbt9mSob>DHE}i zgv(8LgiFIHMYJf<^>x@6(Qq~Grqpt(>r*2H z`kbM-bhf|IdX!d}+8X2Ws#?f*NMWbkyfew(XU#562ENmyfkTm?lMiofQjIA5qF~&M zm{T)|ajdqHF@&Cw}dOy3D-7h-^=o z9V3>OV_1oVO?$+gsl8H#!?bOrtojArzAMDh>ml~YOS$7bTQ-v@KEQNmM^8;&N6DzF zldBwJp0gLOgMzzEwL==khgUPjxI*l!qBL-Ep8hI_F5=aSKJd%SgkJKKBCr9J&cc$tpD|Ir z`5z(obgy`o4J=F)tzH`e5;POAiy;=P6t^-quHC2x7??2Z9&A)o8fWV9aRvmtqAg(H z!K*q|Hd7h>uLcfq2ZB7>hecWljkLxNhYg|)RU+iCo|$3J^=cY7JJ z?N?>&2%X^)EHZH%WZUyTS zgh7{vZnfn7eBdDMl4j#RUF5un{iopTm+<{>ZczWY%&AbeP()V6@PcbOCe#LoRj5YA zu9+2znJrF8`}97$7pO%3vzSd)UY(MT9XeQE^>TZVD z5n?CpWuxehhfwuA*Gt_>h0h`&-Dkq7!&zY8W!q)9wq4#W=^ zB!k7f(@b+-?;r2a34^!elY0R3p)ABPRYan(P!vf-Wok|w>?~eo^4JVamAt)sJ(Fc# zDe%-^MJ`F=Te$hEJR^s(n|&!RasUXImKDQQK(|$y6B1`b!UV?Ea?K>6pej_0*zns1 z0qa^v>E?vq$%NX3gJj@X*)BXgN4LzBvQRp_tF zCMq?4dR30?U9)fLn zvV|nkxiGZ?U05e8Kcet(xgIvw?}K1!lWlm}KdqMdMU~O7cdq!I=u*lPw`KjfJ-W>D zE~7$X8^%c}m7Rxznq$%Avn+~K$w}2#zbx0v#28B{%R_=w8!X@0~d>PZ9FVUc;eJNGt{xW^THf zx#(nk<9##*DM7mqW)zu(%wlhl7we3x*KiGja~H(nhbZ}z*gzD1OC2;g&00; zHO8zXm`6F7od2eUUM0-R7}DgaK#Pj*Du^Fk7>mR53AihF6l8k3X7(PYr=L2wKR0I zJ}9W89E%OvC`}LvUG0=@PdQom^rBq`l5+K@PD6x&E}|7J1SponpB zWBFF;Jwf!DqY(JZBA4VV@27j2BBq6tVxIww{08j4el}ie^$3jzWa!it#yDp0VHe%x!)Q!Y|B-@ zQK(`Gi`-}p`N`R&@wa*42(8Srz2fFW)Rq#i|Y~M5zo~m1g`Nk>SPt~of_NKB% z12}Y9p(pTYC?Hipnh{y%rDE(uy+BZs?OL=@5RL=awt<`MkGF%03 zh_5ZyGynxw#ZqsDuF3?qc(7wXeH*gQEZqPCuaA5xt0>H*9kA+Pgn| zeG1>3V!`0dlubNMa!B6e6zNI-6_OqA?l`VgJFlE*5|xn%*PZ=eRj#c}5uG;Y>;F`_ znis?SnxFEr<$uh}i2t(M`)3F0&l*>P%91^@G0G25v)C1Dbd6~=u@+`6sDl6%1gd&e zw;VnO*aDwTJI6HZ8LOtn>Nbi9)^^?VyKMMd`1O5g-#B`wcy!bBjV`jR3_!o=S~>s& zfA-QUwy@Bri`c!xe%!g^GUI;tac#{DUXPb2W-@ZayndrtXdPo9QWB#J^3?=Xuowb8 zwLyH9Je-UjJ!w~zB2p>?EfMJk^SG^nK(BfS51GKms69?PI)J}d_*D`y2tcCO7;-{z zM^AxIt5b;ucZw|;Ee3(%jliCUiSTF$J)4B;*c*yYlxTzV66jKE`q`|gQKZiaP7Zlg z2K~x{N5;iY&Tm>z=w~ZX2;kNt4?^+}^JyaVO&6Wk%sqqlgFnj39*z?Rmf9YH_&E=z z=k_!pa+e6tT*jq3YGg16D`rimzw%-yyWF!1?6N<%B%~o79r}8s zy_i3}GTHE8Na*aar=lzXV?N;uHsv7S(D<<@O^!xe`b%=W%eOih3xi0kENo@P$~V@@ zRdPDyoG=Eu%jC^;eWUfL3z3J*i_)%|xrgmSYe*6 zujH;-(%Oakov5y zg>s$~9(B&pqrzAm26I@NP8KM4K+0L5ia>=`M+DisXZtzJl=TLRQB?s7TWLs8d+#IkM^Cj01?ZgH`)iSeR0!^-JL9Q;o zb*4&Nyev?gREPOJSFD&v%Qv=~Wyjc)VwBvvR;J77rTu2Myw6PE4g~T{{Phhftot-D zrO1k0qRYhH5zl_`D(3k%uC})tggbGoaJXp6!i2*L1sV1*k5NXjWwlM%p67h!PVHf; z&Lsq+mK^)kZhidVVgs4w{f;m`6n<$xV_wFF6JCfX4g&d`5O5DNtux(+DGYpdkQ-!E z=!$R^T}`-S3jvHwqJ8HSP6(&11K<5!-{PCMTusBooDg`OUA{(4rTfqjRwuaZN(sSQ-aYJ0@xzA-#+tePjJFipK>G2XjfG*@IYa z)Z&91d_GejTCZbwFMtBmK7wvsbFXHzPDTrF!FtTEZe2Ru`*l#ydkY@|V(}PDNrjGh zvJc3+q`vacej=&_UggEMb;F@j#5Oq27wn8 z;MJh_U%@C;!zCGK=#Gq|dvp5=@gZ1#c>u$!pUo@B`|U>oLTU7KPTJUxk^BoJJUyg| z=Ak6b$1V_%S3w{+Xp?6Gk9qmC^TW~|ci`tPGLRVABHinD*E9%yynBZaYdPvAtr2ok zId`AY6g?z+AuQpKA&y6LND6P04zy`$ny*fAx*3EWEU_=@v zZMcQEk2|urKmWyYju_OZ`aQ>qEzT&f`^#_8?=j0krb0FdP{QjCl+GFW`~8|jAo)o_ zQ=kZ;So|?IeTj{T{r34JL^MPK39GZQTjLDROKM=j%=(t6F*u-Gb5K`SYE8H|cd*ns zES+s8>T%liRGR69=DOj$`878r~Azl|h*Vha2k+e1Y+f18;k(a+ptq*!gusTw%k z+&8H*T?Xc?6=puJ4WrqNlXwpwsyF0N5!zS^ecm;2WnL7J=S%BA)f_?nI>H7_9n?9R zBpJ#CpxVVfO3@tUiU|#c7V}04D)F4JOOTq$LA$(zOwb#!I4(JZkg;i5F7WxiQ{ ztUSrNK6J*2l0DH{3Da#Hc^7wVGt!K~zcf{mfG$ZD(kly#N(&~vsB+M(&jEJ8&9l_f zR&oz40dlVSWIKY!%G)z7v3%FiHMRUC@kC@QICVldg(>@kLkkeT3N-qLyZy<#RS3bd zM|j6=7*j>ocxA8glibEL7gJGj;vU7+dvla7j1>#A-T`pZM&bIPdcw_mrrRz2E}rPl zNlE5)%%DlquamalWpcbW=Ui}UxI3KBC4&T{CeLUdcyh${oI;MLQ&v8Tq<&1ciySUy4&3AeaqQhaBkC+|LUsnt{x|8dWu(K{uQsh0!9J)6$th8)4#?u5bD?Q zA7s-rEJ{xD*GFHXlAd8uKL_{I$NxO~0u=R30Sf5JQvU|M^pnEiOA0TrOg}kz1_Hf= z2tA`vevaFxkN@G|KhOVnY|~2_pI3MZ;(3M|{Tv^jE~)<83O}1u{tWwmr~eXR^Q#1& zPrLHp=>Lh%df7_*`wA~1FTbw9_ms)~*A@PvzVrJEFHtDJu7LQYPycO&zq+z`Ug7Wb z7LGX-r`8mj6JoR%|Ut(W=e=9E=qn|Mc zKga1)_WUOY{{?~YJJFX-fX`*PpTqF!i2Dyw{Xal^FV*5_zVSQFmpxa{?SntZD8f&g z|5G#J@1$S0#XMI9evTUCpQK;B&tF@(ekb>`yWsf-_~$TtI=BCn{w2A;?yUKp?#nyp zU*9SK^C#UujqR^H6@I7r^6u_eUhA-b()_=9{r&Fxce*c2w7>HD@kwLk|iZY;Js6bFqP(UFe=0ZR(2pR|sNKQ;uh)zmgoZa=28I${dyZ~+jKLz2z`TWlhXVOgN%Huh?;W?18p6HECqQS zmwFsX`tkQk6c`|&NAZ5u1No&WP9~177RDw{41X^=^Ix{NG;}qjcQ$c%rgyTppcgfC zHW9aTv@vv6bhLA|cw^#dGspzv&j=?twx|M@bwDL*e+na{5=9!_q;z&Mt$Tm#JKv!H zN+G_KM;A>i+e#@%|g}O^hvU46T3HK*htx$j;j7zlx|0G9d&# zDUz-7+Q?R3iRiuBF7(1O6bVmBxRAZqcs}U$>5b3KLtsOAR_swoSGYxBl(Ye~H~DM( zzGY|kGMZ2dG4-U*h=PuY170Ny$Z0i6Djsg_5X#q9+7c6SgNOS*yM0CX=dev~=lAGPB8H(LEMDZi*BHz))XB>1S(hf*kjtGp7-A~c`SBwREp3J*%LlUJXZ z(Eat@$Guv@Lt>Y!LrUCqbjdO>^iBaV8hp$wU;MA1R|4b}1|s-PdEE0CIQPhll5n%> zI%!`^-wc-!Wh@T1?Y>dIKbz8V19?(NDQ0WI@=@I2e^iL^UnnGEXKiihZ0GpjsWFLS zLhvVq19H(S(2S>MFKrhH$b7;JfVxoU0uq0IqPfG~%6#5wCx1&}wgVA!4Pfp`qg z;>|7UvqRK@B`(#T4taCN@?w-q?5xvpdhZ&2&ogvX@6cpsLNT614_)ws)qNDq;~zz5 z{THIkyVw|+IR4KP`5jq&rSFo`aSN4GBWM82P#UhXD3D|G9Q)fNM}4nq3EkqqpB+$U zrK?kxfu(eE1R~<6WyvepY@O|1mt4QA*mi0R(x@>0)Cx<5CSgYN4yuWLIMU*)Y4a|Z zA`ygdI%`t)!ey9AD1D<4S*0Lwx181%faZU9ItMIhK)= z$px;U*{)T??tY0gs)I7OBDe46O)~B4GDl#|lGj2w`dJ`uMXr*b-0ry`!-n^cZEpfD zgOWs)6oW*n#;X>z^heZ{*>6TlY(suq?WGq0HsePbgZ`t%UmG{D$8U}8Y<@Fmf8FBA zU_Z4mwX^#NqeuLr)vvIVvaz?OH?}r(a*9@4bV5->eOUB9Fm3Y&4orl-ZsH$<_7PaI_h^sZ4Mfx}U{k==m6WSDKKU?1%B+*qwD4;GQhV2{(kt zWTrbEac#K`^XXr1UJCg6A}k|+OlFMuLb)WY-i2CH$Qgl1<{g~nj|E(h3??fbwoLtf zLu}Atzb~uhbMGk#dchS~q>iI*7qTrBW!ROfa1>2yOLsw7Cb4b!>-ex6*`6(8RisK{ zTi7e%o>bzG$R~|qJRq#VWFhaG^0CN8_AgekZCKz(7+E4+HCfK3Ao7hyOZLytN=(&Q z#73B^sCP&-yP4Z9LJXK2yIy59(r|a@i*=8uVmBrnE=)?3OBtyx4x9vW&R-ld!%?V! zD&P^HwQqQ4sFBaVsUt|VjO6{WV`6GEG08hm)D0@8KvSzfvwQ#EH)6oo1p~9k`rAGj z4cbA7%Jdc-{+#5@$K_cZaWS_|E0#%7U8W;H^<@WiVIbpLsCNILBa( zS`2qtGAcD%moQ@vYG-7-8NYPEfm$(73#r9Mk*lM83ywk^9w>A8iAfu>#y0{!vfSog{uS<0ATGSRydBu&cEyxE$j!eo$VzIKcho+*0)8?XM6GTQ zUzYCryuS10d0*o5o^g=gzNf*J=E$^AlWXSd8E~a@nrUJQy6&>C(7R$X+pgxi9Mn)D|sH1BzxM4O2E`Ydc#J|Q63%8iDH^1O>z zgsr`UZ2~9zaL)KCr~TF!<9&_s29!l#|JO_QTbkZ9L3}4p(cTrTC}Qa|W>RlKg?qGd z`2_Yzt1}8G#0h(;=5Va9NJX%B0YF~in!#Z0G|PPC%RaAKZb2~Imxw)f(3^#DA5>Q` zaMgn5In`A~+8WeiXh^>9@o*}scGq43MkKuNiyWmrf=(5X2-kwKRpk?_9Yf%f>VuV+ zNRt<=(nP=bd-98YDDFJr5jgp6qnPoz27o`>9v;ZwJ+HrZMMz&5mH+jap3O?N+IJNk zHPm~0sacr}bR8J9fQ+W5OjKc1nkN6r2C`SAui)Q?Xt_u=IT$8Je;KFZhwkRgKIu&V z$T@hmE*pCCB?3VSYcCV=9w&YEAuq=B(A0vuD0_?v(Q733DC>05Y2?GtjS&KTAa|@3 z3?UtBVW3(sq)syER5G2DE)}*I7%J)_CZcGs6>-@vus$5&+_SDwfW3l)tc)b9(C18C zI|ouO)Al0WjkJw46eFE3wiwht-aeO@W-eR%_U;q^gr8pIW|Rcay$371WMB@1a1d`DksDy&bW z{NDSE@~K6{5p)j%NRV1$@nTaK2tHdR*Hpn(x0H+=L+@0eitc)5KK$g5MsBowiv#$c zdpRurEcUDeuf$D9rfM-4rJDK>Y1AQYPjQ;hj^Kp~MJFp_?d#o|XOjKb$NbKgB6EXp z?J`U`Ei)PwLyT__SI6sY6`2VFqBPxM3lFO^ zS1p>?tx|ai-Aifu3_njxHW=tIU`)rxnS*@eCsE5`_|J%XKHb96-SDh-LsBxc(pH?M zOOAS{lev6Z!p5sGv*>M*{ZUo5-^T4~-MQ{!v!`v;p`OY2g&ybO>e1^{Ogc zb#)GEg6gq;_33GwfGGV#ET7~?1)9peDTeNo4=Ck+32^swl1VV0c$hYeU*6}TcWab; z^lXMr>?$|L!bvYL1E#P(c^Flr!)WDTzkmud@R;XT7kEPi-krhRbr-Eo%+UPhIm z^kTzsn|Leq?J{guX>nV}B@ckz-W2k15`njz8M~R#<-#t=F27v6YX0~l#bNutHPYt( z{1n04OYkS7hgY*h@GBG62hndh`_~7mu$XT#loI;v1J)zcK6%u6u3Uq{TQ75TDY`wN zbfi4I{f_F8PR=DnTN0*UhtMGe$8~!cPhXIt1A55rmb`*VXLEQTCwHQgjsA6HmRGwK z_aj&hGQzjuMNxMzft67d=#jD9A8gKqV%1qBa~#%P{6e$6z7nd6o0z_=68iDvzPXYD z!tyOmqZzU-Zjwo{Uu_({u=*0HMo8{7we1?tW0-Sfe1jlh_GMev=_3-`plJyxf^T_S zNc%Q0YEZgdlmYVbmAwuh2z5%|?nT*Cty@;e)m!IYSnT>BnugU#A$MC{q)6ODJo$-5 z35gF*k4CKT(M9_E;~?h?Bleg6;FBFA6}Pkd)0hA8ml6hSCj?PL9;C(r?D=v7#Ta>V z=2}^VNMHlR!Pw;q#ZYl!uL*%26QuSM+za00QNp6rzCNa<-3B3gzYOe7*<&~1$du}S znw#$Q(P=m<{pXMK2{RxL!_0o;MPXnx&{X(Iu!xn97?U-y)(u{klem;q3uEIxo59L$ z`Qw+38SXyi*<{%qPBXd5e|ap^li*kSUFpB_g9|KYlbl!oQby*!LtwxY;)dCNyWFOSQ7@n$xj z0aK@W?*P1tHE;3CK{XPNEAmOr1(&#Ub==L!B) zm>C~oDIwPWwnWk5KCGM_QP`EMu}p!w;m8Z8L3aGvK0<4?CO`+d8Cyd@kd>d<4RwN3 zF58&?IL$-BV3q2FQ<}iAb}?E*%WWHhH`9r8`3BsAf2)75K43w=1#}lHOKt|`NF_^w zFZ6WB^Q|+VobFfqkI*h$pqI=mB_k&htqB2Ma=JsKm+U}aFjyvpe&$-%wr%5?K9cN{2-CcjM8^-ay@^XRyq?Cqz zk+0AVoi%xaDc?KBFl-UeLJUf5CI%rEBB~d6&mjF^h{mu});T~-LR@H+i^9dgOztSO zUJwx#;edt$GifnDsHKtkeOcYBrQsciG$W(?p(s^O)x;&m(CWV(LCf1q1+_%_%GL7;RNM!L~?MGTO?U z?v$~laJ*hv$a&+neo?`a!^Os7Ib0iSKO@0PN&?YuiA|v^05P=aU6Y?nB~XaXVL&=- ze42%9>!IGv-#X|hl2YZs&5=U0a%FWpV-Q;@zcj~)4LI$u-orA>XEcHTR(CZ0z_%%n zWxEXBP!6zOhN;2k47P$X$U~BY$T$H6+!50eLy96qG(@mQG>{Y<*u||424-&%GcUS; z)~<#GWV#OtQYb^TinfZygyW`Sxk}iTm}zf}v#)dJBV@76v4@;`R5He~>CPC5b}9O}wLF(?~~+PCq?W_tol*eeUk|J;O3+Xv*mL-2?>j2r4k~4a_!e#D1RT>KB=WKORNnv5^Y(Lcd;D_rh;- zjCIe(N;$t16Y15TEx(m=1y@)JQ<(U=B8-w)A8vD~$k5u{&n;2PlAw3Kv*+PV<~dcW zF|a*Fw=+fP6L3bq!?y`rbSde_Bbysjq7ih~b&Z}~BY6!_=!iUO7bUpdSu;61q1#y# zx^|O%px-%S_KQ7plX~z?yWcUtc8|LUt@D*E&Kd*2RrU3K265mN4(>b>x*co8LoG^bI$DPBjd>@`GB_5L4HSl z8d{`JcBhqgpKkv2Pdv?zQYYR7{*?)i<5R@~g{!l0=Ifr6vv9(@*rJEcVAqJL?%{vnX~?B5rwYpcwwzq((~41SdwRzzhZNz~c7 zxyhbd5>6Ez0AOMZo{pOwZHTuq1gl$@X72q!o_-s^UlQwMc%9M(H=M+Nplx zTb98q7#_|Q*>pFQZ)^Xj>qxVgYwT^GfB+x3J@BRInPC<57UOVFaM)hhse5W4JQ8pe zwB$R7gz(EW$%td)2*XmbvsLm~EYs7EVeH}aT?$!(3kkJBl!C|Wo7B(*R_(~WjCcXUh4IIuStfFgvSm$&c`aga{= zntwTZA^D+0iFw5dTdsciKD^avorJ1yJc@U|*-DfLffJBFE2APEf6?e^6O@>sS^r9t zbx5)hckuOQMT$zbXnxrxKZyeU%%?C@^I=LzJ4)}!AiIS@r92y{A;nUew^5cu)L7Z9 zcpg*X??vBl(1Wh}5u@6sO_&N(z|AW~(SFl|n=m?ip@%bV0|duxixFu51@;VY7m zkrgAvrurQ)VWv2o0PAa&P89hVzs^+ygYIfEG~$FhF>uya ztd7p)5#aRk<8uF?L6HNRn*L|1xK7E!IvSlpMIgiOGr8vpP zwf^F;o&b)HH*u-cE`UK)s34SI+~>^aOvu0vdI;GNosr==t9qcXd<-DZvokvfo~YCIOk}PgTIfFSsJ6~Uf#LH z%*)^7{njiXyv05@ey59un`w01N!Q;zGj=vQQ2lVTwQS76``Hw8h_n#38!FH}blg6= zE5;DjIIV}%lqrDcEOeQE2R;7Ne6a0XhAWOak0{5Lj_so$LDxo99~qhpn&XZy`XnkXna7TZ zof|B{Ty4=ytolOsD0DX(L~Ryu$V0$AJ0WN=pGAn?+Z#i*rHT>ARD`}dCU~-LDd1^9 zfsfXW9r~ZFoB02Sb$jyqMgPJA{>L**vQj`1LJj$z-yk#K2zjCm+_GH<9_(_@9QwamJNCVqUqYZV8IGT9k34&YLFi0|{(;xpih zsNT6RQOD4G=@nv{-fhL?IOq=OJH9D4a^QNk3O?PJ_vqrTwKIY!Nq@ujTEb2Fh&?OM zy|>{3xfO%sI9`eEi0aeYf<$7SLYqq0Ovw1HEYnP{=VwaIyKBRJcb2>!#O&VZvZq)Bcx%8o{x}<<0cSNeVYfOlFB|&Nff$mBdOW; z?Vx+WKm+Kgd9Dge-#*Qx-&gh8cvC#8b^}x#{eiP64|gAfG<~F-aG_J4RUAmkG)VKs zP@5RL| zltqZ`ChFey+CaLM5(~W5Uxr1@FqdLwy55at&Ph*^k={#W_?|A`F~DUu_ucQ~9nibr zWXe`16k%c*f&`@Cc;(WDKuvHbqQS}xC3}s|z(6r@8KMQ_woI6@y)nI`^@bYN z8jaFpj{2tsA{?D{o6Odv)3vV!Dv}3MytoL>w1?&O+?yK2*fRHv6kSIiN_Ch0+wdE2 zmcO5Fp;cDv8=E&u@99SK;CFvAsT^AUsFv_;on1sj=*Rec>TO<2{xSaL1@_)4MZyRs zvGRILQi`_8wt|jLhH!{0-M2$J%vH0%;iF#0!|VZAbh+VT`3js4{TX7PebItT&=`$A;2$;B5cd|N_->EfGbRQVWZMpkP2fyl{%TkQOAu( zC>l+KYw#j2?OXjeI9Yl{Es*$ ze}UtdApY+)>a$}StzqScGK02g9L;OY#3^dlLjgZJ`8L z+SuM%l4$DaPvrUVNkvi_8mF{!r`F1;`~j@&bTnVI?nbMo8m}>~-|CN@#UJu`&V`}* zaa}GsU3{p&Y}s0(xx4f8`w91ne(=T|S#JBY6oLE-(wLWOr*Xku4dVBp8iR#UQgUxa z!>jEa)i`DQxzJ?EGDa~TvcU$%6h!QCkW8e{=;Snmm%YSXhClc@DWROi!G>X2NCvAA zw~hgU6d9v2r_{cAtD)36XAaIny<%tr$cqhuGSoTBCk+ty|#emGnP~ zG(g0sJO1OWWban|sQc((+OQ#Xj=@$M7?+U(Ch{RRBa3)d96pC5$u&T1WH)K$3`*DN zHL6GmUFUEsF*vt!|3;LoBl|A1ykoRY=luI@u~g$h&XrZjn*$v!H$eYaKp{mbZ?tUqTu`n&RBe!_-)|4L502Yfb8>vdxpmm7QnECS} z>Y!l@_FGl9Q&jlf0k&^UbMVi%AcPGg^WhJz`>gBrDUqVAp)HfNk zI36w(^q{#&nzyOvpH$7T1_ zk&trbV&~Cer}X7CT8h#`$7lM^b=;GPRx@O@QyIwBx>C5e-VJ}@)vQ5C?aqrI*`q4# z4}i|5b-4hy>*%#)Xfnb|9r?N1X8YEwV1VK*ptc2n*CZfvzeZ$v&osQUMrp(}dN4Rx zF&o^rRGS+EGG+OQvNl2kuT3YxD$wP0R5=!ys%8XdIFH}B1a_ymISDrkrbnDu8fHyg zePkyld++`5ZvD?IiyLe4WqFtd%hixGoh3@$JPKy?NE6)(W-lol8w7fiQyNQK5B!)P zNn&VHv!BO5WDjf$2iPVX_a>8q9km0?%xE1k*Lc~T0!N|)2errT6%E2qjg(|=U)N_; zPC~eBv34Y~r)$_TVxxUO#XrK@4L@O=_JY{Uj^1$R?t2&B;o^D{u6{KUJObub;SRlU zA=IoJ>oYsD_2BQm;1IVa!nW3pOHhvGm$;UbaiUa160Q-}6q^HYP1dwj4I5X}(m``= zfun2Ye}RclEi^B!_>&vEhF%CiKYG<2`lp%a2kTP4&^f64eNfSF4K8kr{#(o!dZGIV z7rrodT~2t>Hj5|0I@WfA;fui;P)M^4K;L~mtSWh9(W-w;$-s{mOY(p(h%r~Kelo^m^FFN9 z7Wu8srjpXNj1@%rCB4b2?#HZ-N6LruNN3hE8R4A|Y$BMl<{^eo3_Iilhn4I}MzFlPMLCEFuk)>g>wevv+SCwID zuNUa0n)l3AxoLvc204ZlK`-^3OwkY2aK52!mM8&aX+MlBEJ(B>dGqbfcE`On11Tq z0^N0Al*kS8w)>%b{|6k{?J$b=N?KtaQF96r$MYJ?kSm3WPT^hR30u#OgTr;Vd&DO%64T*!koxh$*B;@YyhxfC zyYK(Rtp9fl&Q@R4z!5`zfQSA@Mq8{~*4U(KE(IO@>L&kn;4Dxt1gO}AGN|Pu>AbUH zJ&qfP}-$1$$JAuY6Gf_lu2z1imQk?-&amYbXJ zzXgWAUyTKgk!ST{QmpyvbO!sof$5xghbkdC@XI^?pr?Qqz-H=wKQROd!2&*VNWZ)@ z7fW!efdvp5srSes5nPRhB!#t*V{eIhQ?8N>U(d#BUy1q?KZb8fh-rj3xb0y3e~v{z zC6>U#9iWtO)o|_xTWp|FXnrk~TQrSZ4awIsZZ(>xro%}l6Pv)A+eCq7jYh?jizOY5 zDyUQnA$Q}*|Ax@L@&Rb|_@F3-1+~C`+CYj&Rxioac2RDR*|QR*=P;ei8mTUxJqoZY)yKRBY9@Kw?eY#+KBlV(G>#RNBzlIdwc^N?nz~_^OjuyR zf=@V3?kkppfs#{zL+5s_BFrKWuLS~02qVeBi99@P11@tNvImf*ud<|F`~tDC(NT#L zSyWF-s%cxft^&~`$tH+KKK5ud=u#u4XRdka!vbhl@YO5kF2H16>RcW=r$5|G0&CL< zSXc8_4Qo_7=>t?@oaAa(aJ%Dm{c5N$@VF&x0}TQ|!G}icweekry!bP+s?B9-)Yl=f zit2b(xuDuIA_eXJXlBa$xnP8;P*q6=ULj03S=zx@DnpL>Tv_da?_Of8iuF~QHu1fN zjruWNu?Fm7KET2Oa!%KX-Tm$1oxY)x-rkwfolbBdWSe$@!(mFPA}PmG)!JuZyf#&e zr67C2$>%S#vep?wHEtN^xROj7^`+rY;UR0iR~HxBub_qnIO0Aa26IU62x9Ol@ST}@ z68(?~H6`wF`@|@C3L$DP=d=1_M}BripA`D@5p_XO&rU)7*zBwZ#8Y_4sK7T6#0)Bn zaF`5EZJC0`{scV)x8qR`96GFRbK*2q68rLfYOh@ zpd&T`il}|J6?-pX8@5mg%!(4NjN1*hY$M%i0>dTloJ5S>P5U{2G*&pp9X4!@PM9E& z;~3)&FbVA$#hrQ>sfOG{bHnQQf@79BRq6l}xP)a`DBO_#qLLbfOF zb+$;eUqX-X@?=pT=t>F#W>jAt73QX;uLQ5c96ZwDskk7;x0Dj*cKR6A3fDuweF>>b zGGVtKohb|Nd>zIb*EjGUS35;DYcv9dVE;0Mo}JJp^nsg=QXy5KyKGTEH;JKq~dlU#dKG0a|tq zH0q3sN;$*O;vA3J9RuSWP~IgX&e&Q3?1(1I@im$4&93vHzl?(>D8s{VIGU$xk9v5# z{j~%Ar;U>K1&;odJMeOoBvtjWH~Ae{$tpGqbBd_G^r%{SFw_jIS@K&t0dmg6AB3V} z-bV$0GD?U2RvMT*nLIsdROi=d$ec>2ecMjZxW5pCh{@VLzs~D($hXD2m6LOSe|m@E zFUN~05Z3&wT!8YD|q!6`-}SrRj9~y+SnTV!3nd5E}mL zJg_P0>OsQt4Xr{Qnz72`j~_21gmk`rul`6=373wzRtlSAX&Rdvr(%mtp0p3zD&AoE z+OvAbW=CGcD!qZk^XKkkieIs3QMRRrN?OXLUdEHAT~?&p>{v;gb|(K7vM8$t0Y@841o z=P*~rl#&_)kGxsv9RDOsL{HKwmyn6N3YVB_*ZImkvq?;?H+gUrey^J3!-4XK%)^xF zEVgYKN8sDakCP@FUBlc%PEo!QpX4)AVP26#q~RJw7+XJ{*LcB$8AG)V(kPl_`!xWF z7ib@0uLMwx0dnly**0+xAn1_yZY!s*BrLD$zP|$aGh#2VRg(;WqOX)fzN&Be=>*mh z#mSI(uA~P|^X8#EO_fYPn&4H&M8N~@IF>LzG%S9&yC{PDn=X<>p;*!0+@4#XjGmHF z2~it}>omp8PX2;jtXXsLdm;GCce^V-gU2zW<^H%OZl({v<)?!lavq3222nizF*kwY z-=On%U}md5Uhj#c-cMtY>QE>O+0w}k6&r|zYkSHt7BPKhb;T8l58#wy5LU-E)N~}{ zS{ppe|FW*I-pG*tvDg{Htc%s>$Zi|wpu5hm_u>BX6a$Dq z5bqPC(IRG-EKogwcKOscYE>GDzXyB}S`v(qnA|95j}!w|#~aDtzY;fdm3XL^4LIFa z5LPTT`#c}X102zcjClUDGvv$i5{$6mlE3-A+u@*pS@ z;^j=jk8isei?uek@dhI9x5ne|N-=u4RdXsoF;4OaCmEWH^@h#&TBdtSPODb0?xuXP zH+_&AQgaEaW65H{o<|?gj-mtHDw1ys9_VAN)i9K-2tzRB@%XlvF@CYtr z2pEM;ewyrIaVIEr!})l7MSctF;>_o>Zm4ko(-=qC7su#hj4jo>w;be6uNJz(x#jPt z&4V?#>^-BzG{X8x8nU zD)DCAipNBY+Beqwxq=KtXBP?82))v=*c)a`oAx{MVp&GhF z_^TJk7{!*){2S@JajG3>JhSz7zY&4?<2LMjuAOS`r4+w_&=iFA592%y%G?U}JGxzx zMAxhUzaoiOg6J+|8cPXx?%zL z+4LA0I{rh^0{WjDsySO&JN?HAQ;|_XQF_cM&UVeiTWTQwfxdkft*!(HBP={#^ccb^ z#BtOP;eKsuj}PGoL!+@95}ip+A7$ki;DzEBEOfGvFA2k$&b77RG_uAM`}1P!(Fkc) zfsKW)5TZsk7^xmJ34IO%ghLCFgQvp~!LS8mt_G66Ar0CVlor<#423fSY$ zK4+`axA}qe&NP5%TF}NLggTf*Vi`uX!R4I5n>4j!ASdQcG+IK5GE`b4sZJ4E7H8eT zk~~DiagD*n!6u88mgJMV?DT1X(oj{ZTSLS|5j9tettyu1Fz6=U&}xhYQ*cFw3L#CZ z2DEQ3HjR#RR$)cId9O2kpQn%K>~hL5yfjLM!~7QURXY{aC{#mXsB@S@U8x-%qAv0wqJ-%xfy+!HgSf zvtPv`%F0HXBW8z$O$;u_`hndDf`~AT`Iq7fXQqjCpYgO@hik04G@M;6bu!?=FbRFv zzVcZm%-$m#mof8vz|OwyeY3_r)u<`4yc0F~17anKfp&@rBe9%Y3sK%zIyA>wvRsRo zu`(DPlZdepN{I|9s*oU&RBmhpOAMR3Bt9=%W;~|&eK1^#1=h?Cq@VBrK#C(vol#iH z6A6k+XoI8GM5pi)vwN_zE;k{Znx=dV-2l4g`S_2?1VL%wP)*&Skk_XyV4AB69|0=Qyk~bG;a#lzI`}((Qj%|8f;MT_- zI{vpE8W;o>=+F7}k6-;pPZgSfraww9pXxOgW&YgtWx3>2edaUqJwE=?^+mPj69*We zzh0$JWtGp=|M>U^hZjYbf0p271>;khk(k2B*h$)3Ls^RgiCsbcV%^d8R^|JN|T7IOW{ z{bixtQ&HbDVLbxt|Kk2vS8KnH@Un>Qso?IJzW<96{_<4xG{oOw^3Thm`0 z@9|U}_e_2N>0$a?t=yln`?BPP__@pD)4_{gzrOP4yT)H%&CBd_(m(MNeq3<>t=M~x zF8mjXf6wt{((zN)`ZGZyK6Cubm-@u?Z*tgwmHTCqpy2Zmk55KO&!arc{R_hXJJSC& z_H zfc8w7bkB_cBAoWC)-O-5PZ5-7GGKUS^!Fftj;H*}`K5FEboza!d!~QE`5C`|XPut> w+Gp}$|AXo8UhbdG%}XEP$ Date: Thu, 18 Oct 2018 11:23:54 +0200 Subject: [PATCH 52/66] 8212595: Remove unused size_helper() in oop_oop_iterate* in instanceKlass.inline.hpp Reviewed-by: shade, pliden --- src/hotspot/share/oops/instanceKlass.hpp | 6 +++--- src/hotspot/share/oops/instanceKlass.inline.hpp | 12 +++--------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/hotspot/share/oops/instanceKlass.hpp b/src/hotspot/share/oops/instanceKlass.hpp index f207d4b7728..aac519f3576 100644 --- a/src/hotspot/share/oops/instanceKlass.hpp +++ b/src/hotspot/share/oops/instanceKlass.hpp @@ -1195,7 +1195,7 @@ public: // Iterate over all oop fields and metadata. template - inline int oop_oop_iterate(oop obj, OopClosureType* closure); + inline void oop_oop_iterate(oop obj, OopClosureType* closure); // Iterate over all oop fields in one oop map. template @@ -1205,7 +1205,7 @@ public: // Reverse iteration // Iterate over all oop fields and metadata. template - inline int oop_oop_iterate_reverse(oop obj, OopClosureType* closure); + inline void oop_oop_iterate_reverse(oop obj, OopClosureType* closure); private: // Iterate over all oop fields in the oop maps. @@ -1225,7 +1225,7 @@ public: // Iterate over all oop fields and metadata. template - inline int oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr); + inline void oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr); private: // Iterate over all oop fields in one oop map. diff --git a/src/hotspot/share/oops/instanceKlass.inline.hpp b/src/hotspot/share/oops/instanceKlass.inline.hpp index 7a9223daeb9..771ae9a9494 100644 --- a/src/hotspot/share/oops/instanceKlass.inline.hpp +++ b/src/hotspot/share/oops/instanceKlass.inline.hpp @@ -130,28 +130,24 @@ ALWAYSINLINE void InstanceKlass::oop_oop_iterate_oop_maps_bounded(oop obj, OopCl } template -ALWAYSINLINE int InstanceKlass::oop_oop_iterate(oop obj, OopClosureType* closure) { +ALWAYSINLINE void InstanceKlass::oop_oop_iterate(oop obj, OopClosureType* closure) { if (Devirtualizer::do_metadata(closure)) { Devirtualizer::do_klass(closure, this); } oop_oop_iterate_oop_maps(obj, closure); - - return size_helper(); } template -ALWAYSINLINE int InstanceKlass::oop_oop_iterate_reverse(oop obj, OopClosureType* closure) { +ALWAYSINLINE void InstanceKlass::oop_oop_iterate_reverse(oop obj, OopClosureType* closure) { assert(!Devirtualizer::do_metadata(closure), "Code to handle metadata is not implemented"); oop_oop_iterate_oop_maps_reverse(obj, closure); - - return size_helper(); } template -ALWAYSINLINE int InstanceKlass::oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr) { +ALWAYSINLINE void InstanceKlass::oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr) { if (Devirtualizer::do_metadata(closure)) { if (mr.contains(obj)) { Devirtualizer::do_klass(closure, this); @@ -159,8 +155,6 @@ ALWAYSINLINE int InstanceKlass::oop_oop_iterate_bounded(oop obj, OopClosureType* } oop_oop_iterate_oop_maps_bounded(obj, closure, mr); - - return size_helper(); } #endif // SHARE_VM_OOPS_INSTANCEKLASS_INLINE_HPP From 417d396b542c9c775a7965d392e3b3998be7eb95 Mon Sep 17 00:00:00 2001 From: Sean Mullan Date: Thu, 18 Oct 2018 10:08:35 -0400 Subject: [PATCH 53/66] 8210448: Copy Java XML Digital Signature API Specification into java.xml.crypto javadocs Reviewed-by: weijun --- .../javax/xml/crypto/dom/package-info.java | 47 +++++ .../classes/javax/xml/crypto/dom/package.html | 50 ------ .../xml/crypto/dsig/TransformService.java | 12 +- .../xml/crypto/dsig/XMLSignatureFactory.java | 29 +-- .../xml/crypto/dsig/dom/package-info.java | 47 +++++ .../javax/xml/crypto/dsig/dom/package.html | 50 ------ .../crypto/dsig/keyinfo/KeyInfoFactory.java | 31 ++-- .../xml/crypto/dsig/keyinfo/package-info.java | 59 ++++++ .../xml/crypto/dsig/keyinfo/package.html | 61 ------- .../javax/xml/crypto/dsig/package-info.java | 169 ++++++++++++++++++ .../javax/xml/crypto/dsig/package.html | 71 -------- .../xml/crypto/dsig/spec/package-info.java | 52 ++++++ .../javax/xml/crypto/dsig/spec/package.html | 55 ------ .../javax/xml/crypto/package-info.java | 45 +++++ .../classes/javax/xml/crypto/package.html | 48 ----- 15 files changed, 460 insertions(+), 366 deletions(-) create mode 100644 src/java.xml.crypto/share/classes/javax/xml/crypto/dom/package-info.java delete mode 100644 src/java.xml.crypto/share/classes/javax/xml/crypto/dom/package.html create mode 100644 src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/dom/package-info.java delete mode 100644 src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/dom/package.html create mode 100644 src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/package-info.java delete mode 100644 src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/package.html create mode 100644 src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/package-info.java delete mode 100644 src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/package.html create mode 100644 src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/package-info.java delete mode 100644 src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/package.html create mode 100644 src/java.xml.crypto/share/classes/javax/xml/crypto/package-info.java delete mode 100644 src/java.xml.crypto/share/classes/javax/xml/crypto/package.html diff --git a/src/java.xml.crypto/share/classes/javax/xml/crypto/dom/package-info.java b/src/java.xml.crypto/share/classes/javax/xml/crypto/dom/package-info.java new file mode 100644 index 00000000000..adb721bcc56 --- /dev/null +++ b/src/java.xml.crypto/share/classes/javax/xml/crypto/dom/package-info.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * DOM-specific classes for the {@link javax.xml.crypto} package. + * Only users who are using DOM-based XML cryptographic implementations (ex: + * {@link javax.xml.crypto.dsig.XMLSignatureFactory XMLSignatureFactory} or + * {@link javax.xml.crypto.dsig.keyinfo.KeyInfoFactory}) + * should need to make direct use of this package. + * + *

Package Specification

+ * + * + * + * @since 1.6 + */ + +package javax.xml.crypto.dom; diff --git a/src/java.xml.crypto/share/classes/javax/xml/crypto/dom/package.html b/src/java.xml.crypto/share/classes/javax/xml/crypto/dom/package.html deleted file mode 100644 index 7ee201a8dea..00000000000 --- a/src/java.xml.crypto/share/classes/javax/xml/crypto/dom/package.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - -DOM-specific classes for the {@link javax.xml.crypto} package. -Only users who are using a DOM-based XML cryptographic implementations (ex: -{@link javax.xml.crypto.dsig.XMLSignatureFactory XMLSignatureFactory} or -{@link javax.xml.crypto.dsig.keyinfo.KeyInfoFactory}) -should need to make direct use of this package. - -

Package Specification

- - - -@since 1.6 - - - diff --git a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/TransformService.java b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/TransformService.java index d6d16299c91..6012897f9bf 100644 --- a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/TransformService.java +++ b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/TransformService.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -68,11 +68,11 @@ import javax.xml.crypto.dsig.spec.TransformParameterSpec; * * TransformService implementations that support the DOM * mechanism type must abide by the DOM interoperability requirements defined - * in the - * {@extLink security_guide_xmldsig_rqmts DOM Mechanism Requirements} section - * of the API overview. See the - * {@extLink security_guide_xmldsig_provider Service Providers} section of - * the API overview for a list of standard mechanism types. + * in the DOM Mechanism + * Requirements. See the {@code TransformService} section in the + * Java Security Standard Algorithm Names Specification for a list of + * standard algorithm URIs and mechanism types. *

* Once a TransformService has been created, it can be used * to process Transform or CanonicalizationMethod diff --git a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java index 085c5560639..07fb9a271f2 100644 --- a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java +++ b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -66,10 +66,11 @@ import java.util.List; * *

The objects that this factory produces will be based * on DOM and abide by the DOM interoperability requirements as defined in the - * {@extLink security_guide_xmldsig_rqmts DOM Mechanism Requirements} section - * of the API overview. See the - * {@extLink security_guide_xmldsig_provider Service Providers} section of - * the API overview for a list of standard mechanism types. + * DOM Mechanism Requirements. + * See the {@code XMLSignatureFactory} section in the + * Java Security Standard Algorithm Names Specification for a list of + * standard mechanism types. * *

XMLSignatureFactory implementations are registered and loaded * using the {@link java.security.Provider} mechanism. @@ -180,8 +181,10 @@ public abstract class XMLSignatureFactory { * {@link Security#getProviders() Security.getProviders()}. * * @param mechanismType the type of the XML processing mechanism and - * representation. See the {@extLink security_guide_xmldsig_provider - * Service Providers} section of the API overview for a list of + * representation. See the {@code XMLSignatureFactory} section in the + * + * Java Security Standard Algorithm Names Specification for a list of * standard mechanism types. * @return a new XMLSignatureFactory * @throws NullPointerException if mechanismType is @@ -225,8 +228,10 @@ public abstract class XMLSignatureFactory { * provider list. * * @param mechanismType the type of the XML processing mechanism and - * representation. See the {@extLink security_guide_xmldsig_provider - * Service Providers} section of the API overview for a list of + * representation. See the {@code XMLSignatureFactory} section in the + * + * Java Security Standard Algorithm Names Specification for a list of * standard mechanism types. * @param provider the Provider object * @return a new XMLSignatureFactory @@ -276,8 +281,10 @@ public abstract class XMLSignatureFactory { * the {@link Security#getProviders() Security.getProviders()} method. * * @param mechanismType the type of the XML processing mechanism and - * representation. See the {@extLink security_guide_xmldsig_provider - * Service Providers} section of the API overview for a list of + * representation. See the {@code XMLSignatureFactory} section in the + * + * Java Security Standard Algorithm Names Specification for a list of * standard mechanism types. * @param provider the string name of the provider * @return a new XMLSignatureFactory diff --git a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/dom/package-info.java b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/dom/package-info.java new file mode 100644 index 00000000000..0a0c9413823 --- /dev/null +++ b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/dom/package-info.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * DOM-specific classes for the {@link javax.xml.crypto.dsig} package. + * Only users who are using a DOM-based {@link + * javax.xml.crypto.dsig.XMLSignatureFactory XMLSignatureFactory} or + * {@link javax.xml.crypto.dsig.keyinfo.KeyInfoFactory} + * should need to make direct use of this package. + * + *

Package Specification

+ * + * + * + * @since 1.6 + */ + +package javax.xml.crypto.dsig.dom; diff --git a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/dom/package.html b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/dom/package.html deleted file mode 100644 index b8f6d68155a..00000000000 --- a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/dom/package.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - -DOM-specific classes for the {@link javax.xml.crypto.dsig} package. -Only users who are using a DOM-based {@link -javax.xml.crypto.dsig.XMLSignatureFactory XMLSignatureFactory} or -{@link javax.xml.crypto.dsig.keyinfo.KeyInfoFactory} -should need to make direct use of this package. - -

Package Specification

- - - -@since 1.6 - - - diff --git a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java index 51979099ade..be5e4cef367 100644 --- a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java +++ b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,11 +61,11 @@ import javax.xml.crypto.dsig.*; * *

The objects that this factory produces will be based * on DOM and abide by the DOM interoperability requirements as defined in the - * {@extLink security_guide_xmldsig_rqmts DOM Mechanism Requirements} section - * of the API overview. See the DOM Mechanism Requirements. + * See the {@code KeyInfoFactory} section in the - * Java Security Standard Algorithm Names document - * for more information. + * Java Security Standard Algorithm Names Specification for a list of + * standard mechanism types. * *

KeyInfoFactory implementations are registered and loaded * using the {@link java.security.Provider} mechanism. @@ -137,10 +137,11 @@ public abstract class KeyInfoFactory { * {@link Security#getProviders() Security.getProviders()}. * * @param mechanismType the type of the XML processing mechanism and - * representation. See the - * Java Security Standard Algorithm Names document - * for more information. + * Java Security Standard Algorithm Names Specification for a list + * of standard mechanism types. * @return a new KeyInfoFactory * @throws NullPointerException if mechanismType is * null @@ -182,10 +183,11 @@ public abstract class KeyInfoFactory { * provider list. * * @param mechanismType the type of the XML processing mechanism and - * representation. See the - * Java Security Standard Algorithm Names document - * for more information. + * Java Security Standard Algorithm Names Specification for a list + * of standard mechanism types. * @param provider the Provider object * @return a new KeyInfoFactory * @throws NullPointerException if mechanismType or @@ -233,10 +235,11 @@ public abstract class KeyInfoFactory { * the {@link Security#getProviders() Security.getProviders()} method. * * @param mechanismType the type of the XML processing mechanism and - * representation. See the - * Java Security Standard Algorithm Names document - * for more information. + * Java Security Standard Algorithm Names Specification for a list + * of standard mechanism types. * @param provider the string name of the provider * @return a new KeyInfoFactory * @throws NoSuchProviderException if the specified provider is not diff --git a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/package-info.java b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/package-info.java new file mode 100644 index 00000000000..e68a9f0637e --- /dev/null +++ b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/package-info.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * Classes for parsing and processing {@link + * javax.xml.crypto.dsig.keyinfo.KeyInfo KeyInfo} elements and structures. + * KeyInfo is an optional element that enables the recipient(s) to + * obtain the key needed to validate an {@link + * javax.xml.crypto.dsig.XMLSignature XMLSignature}. KeyInfo may + * contain keys, names, certificates and other public key management + * information, such as in-band key distribution or key agreement data. This + * package contains classes representing types defined in the W3C specification + * for XML Signatures, such as + * {@link javax.xml.crypto.dsig.keyinfo.KeyName KeyName}, + * {@link javax.xml.crypto.dsig.keyinfo.KeyValue KeyValue}, + * {@link javax.xml.crypto.dsig.keyinfo.RetrievalMethod RetrievalMethod}, + * {@link javax.xml.crypto.dsig.keyinfo.X509Data X509Data}, + * {@link javax.xml.crypto.dsig.keyinfo.X509IssuerSerial X509IssuerSerial}, and + * {@link javax.xml.crypto.dsig.keyinfo.PGPData PGPData}. + * {@link javax.xml.crypto.dsig.keyinfo.KeyInfoFactory KeyInfoFactory} is an + * abstract factory that creates KeyInfo objects from scratch. + * + *

Package Specification

+ * + * + * + * @since 1.6 + */ + +package javax.xml.crypto.dsig.keyinfo; diff --git a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/package.html b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/package.html deleted file mode 100644 index 21f985b5785..00000000000 --- a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/package.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - -Classes for parsing and processing {@link javax.xml.crypto.dsig.keyinfo.KeyInfo -KeyInfo} elements and structures. KeyInfo is an optional element -that enables the recipient(s) to obtain the key needed to validate an -{@link javax.xml.crypto.dsig.XMLSignature XMLSignature}. KeyInfo -may contain keys, names, certificates and other public key management -information, such as in-band key distribution or key agreement data. This -package contains classes representing types defined in the W3C specification -for XML Signatures, such as -{@link javax.xml.crypto.dsig.keyinfo.KeyName KeyName}, -{@link javax.xml.crypto.dsig.keyinfo.KeyValue KeyValue}, -{@link javax.xml.crypto.dsig.keyinfo.RetrievalMethod RetrievalMethod}, -{@link javax.xml.crypto.dsig.keyinfo.X509Data X509Data}, -{@link javax.xml.crypto.dsig.keyinfo.X509IssuerSerial X509IssuerSerial}, and -{@link javax.xml.crypto.dsig.keyinfo.PGPData PGPData}. -{@link javax.xml.crypto.dsig.keyinfo.KeyInfoFactory KeyInfoFactory} -is an abstract factory that creates KeyInfo objects from scratch. - -

Package Specification

- - - -@since 1.6 - - - diff --git a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/package-info.java b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/package-info.java new file mode 100644 index 00000000000..0c4684ca7ba --- /dev/null +++ b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/package-info.java @@ -0,0 +1,169 @@ +/* + * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * Classes for generating and validating XML digital + * signatures. This package includes classes that represent the core elements + * defined in the W3C XML digital signature specification: + * {@link javax.xml.crypto.dsig.XMLSignature XMLSignature}, + * {@link javax.xml.crypto.dsig.SignedInfo SignedInfo}, + * {@link javax.xml.crypto.dsig.CanonicalizationMethod CanonicalizationMethod}, + * {@link javax.xml.crypto.dsig.SignatureMethod SignatureMethod}, + * {@link javax.xml.crypto.dsig.Reference Reference}, + * {@link javax.xml.crypto.dsig.DigestMethod DigestMethod}, + * {@link javax.xml.crypto.dsig.XMLObject XMLObject}, + * {@link javax.xml.crypto.dsig.Manifest Manifest}, + * {@link javax.xml.crypto.dsig.SignatureProperties SignatureProperties}, and + * {@link javax.xml.crypto.dsig.SignatureProperty SignatureProperty}. + * {@code KeyInfo} types are defined in the + * {@link javax.xml.crypto.dsig.keyinfo} subpackage. + * {@link javax.xml.crypto.dsig.XMLSignatureFactory XMLSignatureFactory} + * is an abstract factory that creates + * {@link javax.xml.crypto.dsig.XMLSignature XMLSignature} objects from scratch + * or from a pre-existing XML representation, such as a DOM node. + * {@link javax.xml.crypto.dsig.TransformService} is a service provider + * interface for creating and plugging in implementations of + * transform and canonicalization algorithms. + * + *

Of primary significance in this package is the + * {@link javax.xml.crypto.dsig.XMLSignature XMLSignature} class, + * which allows you to sign and validate an XML digital signature. + * + *

Service Providers

+ * A service provider is a concrete implementation of the abstract + * {@link javax.xml.crypto.dsig.XMLSignatureFactory XMLSignatureFactory} and + * {@link javax.xml.crypto.dsig.keyinfo.KeyInfoFactory KeyInfoFactory} classes + * and is responsible for creating objects and algorithms that parse, generate + * and validate XML Signatures and KeyInfo structures. A concrete implementation + * of {@code XMLSignatureFactory} MUST provide support for each of the REQUIRED + * algorithms as specified by the W3C recommendation for XML Signatures. It MAY + * support other algorithms as defined by the W3C recommendation or other + * specifications. + * + *

The API leverages the JCA provider model (see + * {@link java.security.Provider the Provider class}) for registering and + * loading {@code XMLSignatureFactory} and {@code KeyInfoFactory} + * implementations. + * + *

Each concrete {@code XMLSignatureFactory} or {@code KeyInfoFactory} + * implementation supports a specific XML mechanism type that identifies the XML + * processing mechanism that an implementation uses internally to parse and + * generate XML signature and KeyInfo structures. + * + *

A service provider implementation SHOULD use underlying JCA engine + * classes, such as {@link java.security.Signature} and + * {@link java.security.MessageDigest} to perform cryptographic operations. + * + *

In addition to the {@code XMLSignatureFactory} and {@code KeyInfoFactory} + * classes, the API supports a service provider interface for transform and + * canonicalization algorithms. The {@link + * javax.xml.crypto.dsig.TransformService TransformService} class allows you to + * develop and plug in an implementation of a specific transform or + * canonicalization algorithm for a particular XML mechanism type. The {@code + * TransformService} class uses the standard JCA provider model for registering + * and loading implementations. Each service provider implementation SHOULD use + * the {@code TransformService} class to find a provider that supports transform + * and canonicalization algorithms in XML Signatures that it is generating or + * validating. + * + *

DOM Mechanism Requirements

+ * The following requirements MUST be abided by when implementing a DOM-based + * {@code XMLSignatureFactory}, {@code KeyInfoFactory} or {@code + * TransformService} in order to minimize interoperability problems: + *
    + *
  1. The {@code unmarshalXMLSignature} method of {@code XMLSignatureFactory} + * MUST support {@code DOMValidateContext} types. If the type is + * {@code DOMValidateContext}, it SHOULD contain an {@code Element} of type + * Signature. Additionally, the {@code unmarshalXMLSignature} method MAY + * populate the Id/Element mappings of the passed-in {@code DOMValidateContext}. + *
  2. + * + *
  3. The {@code sign} method of {@code XMLSignature}s produced by + * {@code XMLSignatureFactory} MUST support {@code DOMSignContext} types and the + * {@code validate} method MUST support {@code DOMValidateContext} types. This + * requirement also applies to the {@code validate} method of {@code + * SignatureValue} and the {@code validate} method of {@code Reference}.
  4. + * + *
  5. The implementation MUST support {@code DOMStructure}s as the mechanism + * for the application to specify extensible content (any elements or mixed + * content).
  6. + * + *
  7. If the {@code dereference} method of user-specified {@code + * URIDereferencer}s returns {@code NodeSetData} objects, the {@code iterator} + * method MUST return an iteration over objects of type {@code + * org.w3c.dom.Node}.
  8. + * + *
  9. {@code URIReference} objects passed to the {@code dereference} method of + * user-specified {@code URIDereferencer}s MUST be of type {@code + * DOMURIReference} and {@code XMLCryptoContext} objects MUST implement {@code + * DOMCryptoContext}.
  10. + * + *
  11. The previous 2 requirements also apply to {@code URIDereferencer}s + * returned by the {@code getURIDereferencer} method of {@code + * XMLSignatureFactory} and {@code KeyInfoFactory}.
  12. + * + *
  13. The {@code unmarshalKeyInfo} method of {@code KeyInfoFactory} MUST + * support {@code DOMStructure} types. If the type is {@code DOMStructure}, it + * SHOULD contain an {@code Element} of type {@code KeyInfo}.
  14. + * + *
  15. The {@code transform} method of {@code Transform} MUST support + * {@code DOMCryptoContext} context parameter types.
  16. + * + *
  17. The {@code newtransform} and {@code newCanonicalizationMethod} methods of + * {@code XMLSignatureFactory} MUST support {@code DOMStructure} parameter + * types.
  18. + * + *
  19. The {@code init}, and {@code marshalParams} methods of + * {@code TransformService} MUST support {@code DOMStructure} and + * {@code DOMCryptoContext} types.
  20. + * + *
  21. The {@code unmarshalXMLSignature} method of {@code XMLSignatureFactory} + * MUST support {@code DOMStructure} types. If the type is {@code DOMStructure}, + * it SHOULD contain an {@code Element} of type {@code Signature}.
  22. + * + *
  23. The {@code marshal} method of {@code KeyInfo} MUST support + * {@code DOMStructure} and {@code DOMCryptoContext} parameter types.
  24. + *
+ * + *

Note that a DOM implementation MAY internally use other XML parsing APIs + * other than DOM as long as it doesn't affect interoperability. For example, a + * DOM implementation of {@code XMLSignatureFactory} might use a SAX parser + * internally to canonicalize data. + * + *

Package Specification

+ * + * + * + * @since 1.6 + */ + +package javax.xml.crypto.dsig; diff --git a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/package.html b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/package.html deleted file mode 100644 index 9cb8e1610e0..00000000000 --- a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/package.html +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - -Classes for generating and validating XML digital -signatures. This package includes classes that represent the core elements -defined in the W3C XML digital signature specification: -{@link javax.xml.crypto.dsig.XMLSignature XMLSignature}, -{@link javax.xml.crypto.dsig.SignedInfo SignedInfo}, -{@link javax.xml.crypto.dsig.CanonicalizationMethod CanonicalizationMethod}, -{@link javax.xml.crypto.dsig.SignatureMethod SignatureMethod}, -{@link javax.xml.crypto.dsig.Reference Reference}, -{@link javax.xml.crypto.dsig.DigestMethod DigestMethod}, -{@link javax.xml.crypto.dsig.XMLObject XMLObject}, -{@link javax.xml.crypto.dsig.Manifest Manifest}, -{@link javax.xml.crypto.dsig.SignatureProperties SignatureProperties}, and -{@link javax.xml.crypto.dsig.SignatureProperty SignatureProperty}. -KeyInfo types -are defined in the {@link javax.xml.crypto.dsig.keyinfo} subpackage. -{@link javax.xml.crypto.dsig.XMLSignatureFactory XMLSignatureFactory} -is an abstract factory that creates -{@link javax.xml.crypto.dsig.XMLSignature XMLSignature} objects from scratch -or from a pre-existing XML representation, such as a DOM node. -{@link javax.xml.crypto.dsig.TransformService} is a service provider -interface for creating and plugging in implementations of -transform and canonicalization algorithms. - -

Of primary significance in this package is the -{@link javax.xml.crypto.dsig.XMLSignature XMLSignature} class, -which allows you to sign and validate an XML digital signature. - -

Package Specification

- - - -@since 1.6 - - - diff --git a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/package-info.java b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/package-info.java new file mode 100644 index 00000000000..e6b6db3b915 --- /dev/null +++ b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/package-info.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * Parameter classes for XML digital signatures. This package + * contains interfaces and classes representing input parameters for the + * digest, signature, transform, or canonicalization algorithms used in + * the processing of XML signatures. + * + *

Package Specification

+ * + * + * + * @since 1.6 + */ + +package javax.xml.crypto.dsig.spec; diff --git a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/package.html b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/package.html deleted file mode 100644 index 0a3b3faa7fd..00000000000 --- a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/package.html +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - -Parameter classes for XML digital signatures. This package -contains interfaces and classes representing input parameters for the -digest, signature, transform, or canonicalization algorithms used in -the processing of XML signatures. - -

Package Specification

- - - -@since 1.6 - - - diff --git a/src/java.xml.crypto/share/classes/javax/xml/crypto/package-info.java b/src/java.xml.crypto/share/classes/javax/xml/crypto/package-info.java new file mode 100644 index 00000000000..12aa6dd3cb3 --- /dev/null +++ b/src/java.xml.crypto/share/classes/javax/xml/crypto/package-info.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * Common classes for XML cryptography. This package includes common classes + * that are used to perform XML cryptographic operations, such as generating + * an XML signature or encrypting XML data. + * + *

Package Specification

+ * + * + * + * @since 1.6 + */ + +package javax.xml.crypto; diff --git a/src/java.xml.crypto/share/classes/javax/xml/crypto/package.html b/src/java.xml.crypto/share/classes/javax/xml/crypto/package.html deleted file mode 100644 index 05610a235ec..00000000000 --- a/src/java.xml.crypto/share/classes/javax/xml/crypto/package.html +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - -Common classes for XML cryptography. This package includes common classes that -are used to perform XML cryptographic operations, such as generating -an XML signature or encrypting XML data. - -

Package Specification

- - - -@since 1.6 - - - From ef3c0a2458782f38f4a94b00a597c08e199dffd1 Mon Sep 17 00:00:00 2001 From: Harold Seigel Date: Thu, 18 Oct 2018 10:35:58 -0400 Subject: [PATCH 54/66] 8209087: Clean up runtime code that compares 'this' to NULL Remove 'this' to NULL comparisons from methods and check if calling objects of these methods could be NULL. Reviewed-by: lfoltan, gziemski --- .../share/classfile/verificationType.cpp | 6 ++++- src/hotspot/share/oops/symbol.cpp | 24 +++++++------------ src/hotspot/share/runtime/perfData.cpp | 11 +++++---- src/hotspot/share/runtime/perfData.inline.hpp | 8 +++++-- 4 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/hotspot/share/classfile/verificationType.cpp b/src/hotspot/share/classfile/verificationType.cpp index cb3c5a1775f..99e9a9d4385 100644 --- a/src/hotspot/share/classfile/verificationType.cpp +++ b/src/hotspot/share/classfile/verificationType.cpp @@ -172,7 +172,11 @@ void VerificationType::print_on(outputStream* st) const { } else if (is_uninitialized()) { st->print("uninitialized %d", bci()); } else { - name()->print_value_on(st); + if (name() != NULL) { + name()->print_value_on(st); + } else { + st->print_cr("NULL"); + } } } } diff --git a/src/hotspot/share/oops/symbol.cpp b/src/hotspot/share/oops/symbol.cpp index fae165e36bb..800a652712c 100644 --- a/src/hotspot/share/oops/symbol.cpp +++ b/src/hotspot/share/oops/symbol.cpp @@ -294,28 +294,20 @@ void Symbol::metaspace_pointers_do(MetaspaceClosure* it) { } void Symbol::print_on(outputStream* st) const { - if (this == NULL) { - st->print_cr("NULL"); - } else { - st->print("Symbol: '"); - print_symbol_on(st); - st->print("'"); - st->print(" count %d", refcount()); - } + st->print("Symbol: '"); + print_symbol_on(st); + st->print("'"); + st->print(" count %d", refcount()); } // The print_value functions are present in all builds, to support the // disassembler and error reporting. void Symbol::print_value_on(outputStream* st) const { - if (this == NULL) { - st->print("NULL"); - } else { - st->print("'"); - for (int i = 0; i < utf8_length(); i++) { - st->print("%c", char_at(i)); - } - st->print("'"); + st->print("'"); + for (int i = 0; i < utf8_length(); i++) { + st->print("%c", char_at(i)); } + st->print("'"); } bool Symbol::is_valid(Symbol* s) { diff --git a/src/hotspot/share/runtime/perfData.cpp b/src/hotspot/share/runtime/perfData.cpp index 4a34df0687f..38e085cff74 100644 --- a/src/hotspot/share/runtime/perfData.cpp +++ b/src/hotspot/share/runtime/perfData.cpp @@ -323,7 +323,12 @@ void PerfDataManager::add_item(PerfData* p, bool sampled) { } PerfData* PerfDataManager::find_by_name(const char* name) { - return _all->find_by_name(name); + // if add_item hasn't been called the list won't be initialized + if (_all != NULL) { + return _all->find_by_name(name); + } else { + return NULL; + } } PerfDataList* PerfDataManager::all() { @@ -591,10 +596,6 @@ bool PerfDataList::by_name(void* name, PerfData* pd) { PerfData* PerfDataList::find_by_name(const char* name) { - // if add_item hasn't been called the list won't be initialized - if (this == NULL) - return NULL; - int i = _set->find((void*)name, PerfDataList::by_name); if (i >= 0 && i <= _set->length()) diff --git a/src/hotspot/share/runtime/perfData.inline.hpp b/src/hotspot/share/runtime/perfData.inline.hpp index b867bbdbb4e..b8d89a9c2bf 100644 --- a/src/hotspot/share/runtime/perfData.inline.hpp +++ b/src/hotspot/share/runtime/perfData.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,7 +58,11 @@ inline int PerfDataManager::constants_count() { } inline bool PerfDataManager::exists(const char* name) { - return _all->contains(name); + if (_all != NULL) { + return _all->contains(name); + } else { + return false; + } } #endif // SHARE_VM_RUNTIME_PERFDATA_INLINE_HPP From d54fa9e93d786eb264d431621f7065cf4a4970e5 Mon Sep 17 00:00:00 2001 From: Andrew Luo Date: Thu, 18 Oct 2018 10:45:05 -0400 Subject: [PATCH 55/66] 8212662: Fix javadoc typo in java.lang.ref.Cleaner Reviewed-by: lancea, rriggs --- src/java.base/share/classes/java/lang/ref/Cleaner.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/java.base/share/classes/java/lang/ref/Cleaner.java b/src/java.base/share/classes/java/lang/ref/Cleaner.java index 04e2101e2cc..a736f23ad2f 100644 --- a/src/java.base/share/classes/java/lang/ref/Cleaner.java +++ b/src/java.base/share/classes/java/lang/ref/Cleaner.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -100,8 +100,8 @@ import java.util.function.Function; * } * } * - * private final State; - * private final Cleaner.Cleanable cleanable + * private final State state; + * private final Cleaner.Cleanable cleanable; * * public CleaningExample() { * this.state = new State(...); From 21f57051c4a2306ba3709d993d5aab8cd0a5496b Mon Sep 17 00:00:00 2001 From: Tobias Hartmann Date: Thu, 18 Oct 2018 17:50:49 +0200 Subject: [PATCH 56/66] 8212553: [TESTBUG] TestTrichotomyExpressions.java times out with Graal as JIT Removed -Xcomp and increased timeout. Reviewed-by: kvn --- .../jtreg/compiler/codegen/TestTrichotomyExpressions.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/test/hotspot/jtreg/compiler/codegen/TestTrichotomyExpressions.java b/test/hotspot/jtreg/compiler/codegen/TestTrichotomyExpressions.java index d3aa36cc037..11f3c6c3972 100644 --- a/test/hotspot/jtreg/compiler/codegen/TestTrichotomyExpressions.java +++ b/test/hotspot/jtreg/compiler/codegen/TestTrichotomyExpressions.java @@ -26,10 +26,7 @@ * @bug 8210215 * @summary Test that C2 correctly optimizes trichotomy expressions. * @library /test/lib - * @run main/othervm -XX:-TieredCompilation -Xbatch - * -XX:CompileCommand=dontinline,compiler.codegen.TestTrichotomyExpressions::test* - * compiler.codegen.TestTrichotomyExpressions - * @run main/othervm -XX:-TieredCompilation -Xcomp + * @run main/othervm/timeout=240 -XX:-TieredCompilation -Xbatch * -XX:CompileCommand=dontinline,compiler.codegen.TestTrichotomyExpressions::test* * compiler.codegen.TestTrichotomyExpressions */ From f7393a59d130a3aef6488faf00106cf96c7f4a4a Mon Sep 17 00:00:00 2001 From: Ivan Gerasimov Date: Thu, 18 Oct 2018 09:46:46 -0700 Subject: [PATCH 57/66] 8201355: Avoid native memory allocation in sun.security.mscapi.PRNG.generateSeed Reviewed-by: weijun --- .../windows/native/libsunmscapi/security.cpp | 34 +++++-------------- 1 file changed, 8 insertions(+), 26 deletions(-) diff --git a/src/jdk.crypto.mscapi/windows/native/libsunmscapi/security.cpp b/src/jdk.crypto.mscapi/windows/native/libsunmscapi/security.cpp index 1497a554456..c0c49b6cb5c 100644 --- a/src/jdk.crypto.mscapi/windows/native/libsunmscapi/security.cpp +++ b/src/jdk.crypto.mscapi/windows/native/libsunmscapi/security.cpp @@ -250,7 +250,6 @@ JNIEXPORT jbyteArray JNICALL Java_sun_security_mscapi_PRNG_generateSeed { HCRYPTPROV hCryptProv = NULL; - BYTE* pbData = NULL; jbyte* reseedBytes = NULL; jbyte* seedBytes = NULL; jbyteArray result = NULL; @@ -294,31 +293,17 @@ JNIEXPORT jbyteArray JNICALL Java_sun_security_mscapi_PRNG_generateSeed result = NULL; - } else if (length > 0) { + } else { - pbData = new (env) BYTE[length]; - if (pbData == NULL) { - __leave; + if (length > 0) { + seed = env->NewByteArray(length); + if (seed == NULL) { + __leave; + } + } else { + length = env->GetArrayLength(seed); } - if (::CryptGenRandom( - hCryptProv, - length, - pbData) == FALSE) { - - ThrowException(env, PROVIDER_EXCEPTION, GetLastError()); - __leave; - } - - result = env->NewByteArray(length); - if (result == NULL) { - __leave; - } - env->SetByteArrayRegion(result, 0, length, (jbyte*) pbData); - - } else { // length == 0 - - length = env->GetArrayLength(seed); if ((seedBytes = env->GetByteArrayElements(seed, 0)) == NULL) { __leave; } @@ -343,9 +328,6 @@ JNIEXPORT jbyteArray JNICALL Java_sun_security_mscapi_PRNG_generateSeed if (reseedBytes) env->ReleaseByteArrayElements(seed, reseedBytes, JNI_ABORT); - if (pbData) - delete [] pbData; - if (seedBytes) env->ReleaseByteArrayElements(seed, seedBytes, 0); // update orig From cb17e450b322c19304ab6bb68c04d52dc988f534 Mon Sep 17 00:00:00 2001 From: Roman Kennke Date: Thu, 18 Oct 2018 21:14:49 +0200 Subject: [PATCH 58/66] 8212603: Need to step over GC barriers in Node::eqv_uncast() Reviewed-by: shade, kvn, eosterlund --- src/hotspot/share/opto/node.cpp | 7 +++++++ src/hotspot/share/opto/node.hpp | 7 +++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/hotspot/share/opto/node.cpp b/src/hotspot/share/opto/node.cpp index 1252f50ce5a..acbc68a2fc8 100644 --- a/src/hotspot/share/opto/node.cpp +++ b/src/hotspot/share/opto/node.cpp @@ -899,6 +899,13 @@ Node* Node::uncast() const { return (Node*) this; } +bool Node::eqv_uncast(const Node* n) const { + BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2(); + Node* obj1 = bs->step_over_gc_barrier(const_cast(this)); + Node* obj2 = bs->step_over_gc_barrier(const_cast(n)); + return (obj1->uncast() == obj2->uncast()); +} + // Find out of current node that matches opcode. Node* Node::find_out_with(int opcode) { for (DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++) { diff --git a/src/hotspot/share/opto/node.hpp b/src/hotspot/share/opto/node.hpp index f5717d78f95..7b5b96ad33e 100644 --- a/src/hotspot/share/opto/node.hpp +++ b/src/hotspot/share/opto/node.hpp @@ -457,10 +457,9 @@ protected: // Strip away casting. (It is depth-limited.) Node* uncast() const; - // Return whether two Nodes are equivalent, after stripping casting. - bool eqv_uncast(const Node* n) const { - return (this->uncast() == n->uncast()); - } + // Return whether two Nodes are equivalent, after stripping casting + // and GC barriers. + bool eqv_uncast(const Node* n) const; // Find out of current node that matches opcode. Node* find_out_with(int opcode); From 4abb6861ecb7aaf3e139ea7a084f04f61e03efbd Mon Sep 17 00:00:00 2001 From: Ioi Lam Date: Thu, 18 Oct 2018 23:05:01 -0700 Subject: [PATCH 59/66] 8212642: Remove SystemDictionary::InitOption enum Reviewed-by: dholmes, kvn, redestad --- src/hotspot/share/ci/ciEnv.cpp | 2 +- src/hotspot/share/ci/ciEnv.hpp | 4 +- src/hotspot/share/ci/ciObjectFactory.cpp | 4 +- .../share/classfile/systemDictionary.cpp | 39 +-- .../share/classfile/systemDictionary.hpp | 269 ++++++++---------- src/hotspot/share/jvmci/jvmciJavaClasses.hpp | 2 +- .../share/jvmci/systemDictionary_jvmci.hpp | 126 ++++---- src/hotspot/share/runtime/reflection.cpp | 3 +- 8 files changed, 208 insertions(+), 241 deletions(-) diff --git a/src/hotspot/share/ci/ciEnv.cpp b/src/hotspot/share/ci/ciEnv.cpp index da98c50deeb..d3f100b2629 100644 --- a/src/hotspot/share/ci/ciEnv.cpp +++ b/src/hotspot/share/ci/ciEnv.cpp @@ -77,7 +77,7 @@ ciObject* ciEnv::_null_object_instance; -#define WK_KLASS_DEFN(name, ignore_s, ignore_o) ciInstanceKlass* ciEnv::_##name = NULL; +#define WK_KLASS_DEFN(name, ignore_s) ciInstanceKlass* ciEnv::_##name = NULL; WK_KLASSES_DO(WK_KLASS_DEFN) #undef WK_KLASS_DEFN diff --git a/src/hotspot/share/ci/ciEnv.hpp b/src/hotspot/share/ci/ciEnv.hpp index ee3114b8346..7397c9ecef1 100644 --- a/src/hotspot/share/ci/ciEnv.hpp +++ b/src/hotspot/share/ci/ciEnv.hpp @@ -82,7 +82,7 @@ private: // Distinguished instances of certain ciObjects.. static ciObject* _null_object_instance; -#define WK_KLASS_DECL(name, ignore_s, ignore_o) static ciInstanceKlass* _##name; +#define WK_KLASS_DECL(name, ignore_s) static ciInstanceKlass* _##name; WK_KLASSES_DO(WK_KLASS_DECL) #undef WK_KLASS_DECL @@ -374,7 +374,7 @@ public: // Access to certain well known ciObjects. -#define WK_KLASS_FUNC(name, ignore_s, ignore_o) \ +#define WK_KLASS_FUNC(name, ignore_s) \ ciInstanceKlass* name() { \ return _##name;\ } diff --git a/src/hotspot/share/ci/ciObjectFactory.cpp b/src/hotspot/share/ci/ciObjectFactory.cpp index c698788cc8a..6d42e84863c 100644 --- a/src/hotspot/share/ci/ciObjectFactory.cpp +++ b/src/hotspot/share/ci/ciObjectFactory.cpp @@ -157,8 +157,8 @@ void ciObjectFactory::init_shared_objects() { ciEnv::_null_object_instance = new (_arena) ciNullObject(); init_ident_of(ciEnv::_null_object_instance); -#define WK_KLASS_DEFN(name, ignore_s, opt) \ - if (SystemDictionary::name() != NULL) \ +#define WK_KLASS_DEFN(name, ignore_s) \ + if (SystemDictionary::name##_is_loaded()) \ ciEnv::_##name = get_metadata(SystemDictionary::name())->as_instance_klass(); WK_KLASSES_DO(WK_KLASS_DEFN) diff --git a/src/hotspot/share/classfile/systemDictionary.cpp b/src/hotspot/share/classfile/systemDictionary.cpp index 194cc9320f2..05262b1f572 100644 --- a/src/hotspot/share/classfile/systemDictionary.cpp +++ b/src/hotspot/share/classfile/systemDictionary.cpp @@ -1963,41 +1963,30 @@ void SystemDictionary::initialize(TRAPS) { // Compact table of directions on the initialization of klasses: static const short wk_init_info[] = { - #define WK_KLASS_INIT_INFO(name, symbol, option) \ - ( ((int)vmSymbols::VM_SYMBOL_ENUM_NAME(symbol) \ - << SystemDictionary::CEIL_LG_OPTION_LIMIT) \ - | (int)SystemDictionary::option ), + #define WK_KLASS_INIT_INFO(name, symbol) \ + ((short)vmSymbols::VM_SYMBOL_ENUM_NAME(symbol)), + WK_KLASSES_DO(WK_KLASS_INIT_INFO) #undef WK_KLASS_INIT_INFO 0 }; -bool SystemDictionary::resolve_wk_klass(WKID id, int init_opt, TRAPS) { +bool SystemDictionary::resolve_wk_klass(WKID id, TRAPS) { assert(id >= (int)FIRST_WKID && id < (int)WKID_LIMIT, "oob"); - int info = wk_init_info[id - FIRST_WKID]; - int sid = (info >> CEIL_LG_OPTION_LIMIT); + int sid = wk_init_info[id - FIRST_WKID]; Symbol* symbol = vmSymbols::symbol_at((vmSymbols::SID)sid); InstanceKlass** klassp = &_well_known_klasses[id]; - bool must_load; + #if INCLUDE_JVMCI - if (EnableJVMCI) { - // If JVMCI is enabled we require its classes to be found. - must_load = (init_opt < SystemDictionary::Opt) || (init_opt == SystemDictionary::Jvmci); - } else -#endif - { - must_load = (init_opt < SystemDictionary::Opt); + if (id >= FIRST_JVMCI_WKID) { + assert(EnableJVMCI, "resolve JVMCI classes only when EnableJVMCI is true"); } +#endif if ((*klassp) == NULL) { - Klass* k; - if (must_load) { - k = resolve_or_fail(symbol, true, CHECK_0); // load required class - } else { - k = resolve_or_null(symbol, CHECK_0); // load optional klass - } - (*klassp) = (k == NULL) ? NULL : InstanceKlass::cast(k); + Klass* k = resolve_or_fail(symbol, true, CHECK_0); + (*klassp) = InstanceKlass::cast(k); } return ((*klassp) != NULL); } @@ -2006,11 +1995,7 @@ void SystemDictionary::resolve_wk_klasses_until(WKID limit_id, WKID &start_id, T assert((int)start_id <= (int)limit_id, "IDs are out of order!"); for (int id = (int)start_id; id < (int)limit_id; id++) { assert(id >= (int)FIRST_WKID && id < (int)WKID_LIMIT, "oob"); - int info = wk_init_info[id - FIRST_WKID]; - int sid = (info >> CEIL_LG_OPTION_LIMIT); - int opt = (info & right_n_bits(CEIL_LG_OPTION_LIMIT)); - - resolve_wk_klass((WKID)id, opt, CHECK); + resolve_wk_klass((WKID)id, CHECK); } // move the starting value forward to the limit: diff --git a/src/hotspot/share/classfile/systemDictionary.hpp b/src/hotspot/share/classfile/systemDictionary.hpp index c0ad10f4370..d34240701b1 100644 --- a/src/hotspot/share/classfile/systemDictionary.hpp +++ b/src/hotspot/share/classfile/systemDictionary.hpp @@ -94,127 +94,125 @@ class OopStorage; #define WK_KLASS_ENUM_NAME(kname) kname##_knum // Each well-known class has a short klass name (like object_klass), -// a vmSymbol name (like java_lang_Object), and a flag word -// that makes some minor distinctions, like whether the klass -// is preloaded, optional, release-specific, etc. +// and a vmSymbol name (like java_lang_Object). // The order of these definitions is significant; it is the order in which // preloading is actually performed by resolve_preloaded_classes. -#define WK_KLASSES_DO(do_klass) \ - /* well-known classes */ \ - do_klass(Object_klass, java_lang_Object, Pre ) \ - do_klass(String_klass, java_lang_String, Pre ) \ - do_klass(Class_klass, java_lang_Class, Pre ) \ - do_klass(Cloneable_klass, java_lang_Cloneable, Pre ) \ - do_klass(ClassLoader_klass, java_lang_ClassLoader, Pre ) \ - do_klass(Serializable_klass, java_io_Serializable, Pre ) \ - do_klass(System_klass, java_lang_System, Pre ) \ - do_klass(Throwable_klass, java_lang_Throwable, Pre ) \ - do_klass(Error_klass, java_lang_Error, Pre ) \ - do_klass(ThreadDeath_klass, java_lang_ThreadDeath, Pre ) \ - do_klass(Exception_klass, java_lang_Exception, Pre ) \ - do_klass(RuntimeException_klass, java_lang_RuntimeException, Pre ) \ - do_klass(SecurityManager_klass, java_lang_SecurityManager, Pre ) \ - do_klass(ProtectionDomain_klass, java_security_ProtectionDomain, Pre ) \ - do_klass(AccessControlContext_klass, java_security_AccessControlContext, Pre ) \ - do_klass(SecureClassLoader_klass, java_security_SecureClassLoader, Pre ) \ - do_klass(ClassNotFoundException_klass, java_lang_ClassNotFoundException, Pre ) \ - do_klass(NoClassDefFoundError_klass, java_lang_NoClassDefFoundError, Pre ) \ - do_klass(LinkageError_klass, java_lang_LinkageError, Pre ) \ - do_klass(ClassCastException_klass, java_lang_ClassCastException, Pre ) \ - do_klass(ArrayStoreException_klass, java_lang_ArrayStoreException, Pre ) \ - do_klass(VirtualMachineError_klass, java_lang_VirtualMachineError, Pre ) \ - do_klass(OutOfMemoryError_klass, java_lang_OutOfMemoryError, Pre ) \ - do_klass(StackOverflowError_klass, java_lang_StackOverflowError, Pre ) \ - do_klass(IllegalMonitorStateException_klass, java_lang_IllegalMonitorStateException, Pre ) \ - do_klass(Reference_klass, java_lang_ref_Reference, Pre ) \ - \ - /* Preload ref klasses and set reference types */ \ - do_klass(SoftReference_klass, java_lang_ref_SoftReference, Pre ) \ - do_klass(WeakReference_klass, java_lang_ref_WeakReference, Pre ) \ - do_klass(FinalReference_klass, java_lang_ref_FinalReference, Pre ) \ - do_klass(PhantomReference_klass, java_lang_ref_PhantomReference, Pre ) \ - do_klass(Finalizer_klass, java_lang_ref_Finalizer, Pre ) \ - \ - do_klass(Thread_klass, java_lang_Thread, Pre ) \ - do_klass(ThreadGroup_klass, java_lang_ThreadGroup, Pre ) \ - do_klass(Properties_klass, java_util_Properties, Pre ) \ - do_klass(Module_klass, java_lang_Module, Pre ) \ - do_klass(reflect_AccessibleObject_klass, java_lang_reflect_AccessibleObject, Pre ) \ - do_klass(reflect_Field_klass, java_lang_reflect_Field, Pre ) \ - do_klass(reflect_Parameter_klass, java_lang_reflect_Parameter, Opt ) \ - do_klass(reflect_Method_klass, java_lang_reflect_Method, Pre ) \ - do_klass(reflect_Constructor_klass, java_lang_reflect_Constructor, Pre ) \ - \ - /* NOTE: needed too early in bootstrapping process to have checks based on JDK version */ \ - /* It's okay if this turns out to be NULL in non-1.4 JDKs. */ \ - do_klass(reflect_MagicAccessorImpl_klass, reflect_MagicAccessorImpl, Opt ) \ - do_klass(reflect_MethodAccessorImpl_klass, reflect_MethodAccessorImpl, Pre ) \ - do_klass(reflect_ConstructorAccessorImpl_klass, reflect_ConstructorAccessorImpl, Pre ) \ - do_klass(reflect_DelegatingClassLoader_klass, reflect_DelegatingClassLoader, Opt ) \ - do_klass(reflect_ConstantPool_klass, reflect_ConstantPool, Opt ) \ - do_klass(reflect_UnsafeStaticFieldAccessorImpl_klass, reflect_UnsafeStaticFieldAccessorImpl, Opt ) \ - do_klass(reflect_CallerSensitive_klass, reflect_CallerSensitive, Opt ) \ - \ - /* support for dynamic typing; it's OK if these are NULL in earlier JDKs */ \ - do_klass(DirectMethodHandle_klass, java_lang_invoke_DirectMethodHandle, Opt ) \ - do_klass(MethodHandle_klass, java_lang_invoke_MethodHandle, Pre ) \ - do_klass(VarHandle_klass, java_lang_invoke_VarHandle, Pre ) \ - do_klass(MemberName_klass, java_lang_invoke_MemberName, Pre ) \ - do_klass(ResolvedMethodName_klass, java_lang_invoke_ResolvedMethodName, Pre ) \ - do_klass(MethodHandleNatives_klass, java_lang_invoke_MethodHandleNatives, Pre ) \ - do_klass(LambdaForm_klass, java_lang_invoke_LambdaForm, Opt ) \ - do_klass(MethodType_klass, java_lang_invoke_MethodType, Pre ) \ - do_klass(BootstrapMethodError_klass, java_lang_BootstrapMethodError, Pre ) \ - do_klass(CallSite_klass, java_lang_invoke_CallSite, Pre ) \ - do_klass(Context_klass, java_lang_invoke_MethodHandleNatives_CallSiteContext, Pre ) \ - do_klass(ConstantCallSite_klass, java_lang_invoke_ConstantCallSite, Pre ) \ - do_klass(MutableCallSite_klass, java_lang_invoke_MutableCallSite, Pre ) \ - do_klass(VolatileCallSite_klass, java_lang_invoke_VolatileCallSite, Pre ) \ - /* Note: MethodHandle must be first, and VolatileCallSite last in group */ \ - \ - do_klass(AssertionStatusDirectives_klass, java_lang_AssertionStatusDirectives, Pre ) \ - do_klass(StringBuffer_klass, java_lang_StringBuffer, Pre ) \ - do_klass(StringBuilder_klass, java_lang_StringBuilder, Pre ) \ - do_klass(internal_Unsafe_klass, jdk_internal_misc_Unsafe, Pre ) \ - do_klass(module_Modules_klass, jdk_internal_module_Modules, Pre ) \ - \ - /* support for CDS */ \ - do_klass(ByteArrayInputStream_klass, java_io_ByteArrayInputStream, Pre ) \ - do_klass(URL_klass, java_net_URL, Pre ) \ - do_klass(Jar_Manifest_klass, java_util_jar_Manifest, Pre ) \ - do_klass(jdk_internal_loader_ClassLoaders_klass, jdk_internal_loader_ClassLoaders, Pre ) \ - do_klass(jdk_internal_loader_ClassLoaders_AppClassLoader_klass, jdk_internal_loader_ClassLoaders_AppClassLoader, Pre ) \ - do_klass(jdk_internal_loader_ClassLoaders_PlatformClassLoader_klass, jdk_internal_loader_ClassLoaders_PlatformClassLoader, Pre ) \ - do_klass(CodeSource_klass, java_security_CodeSource, Pre ) \ - \ - do_klass(StackTraceElement_klass, java_lang_StackTraceElement, Opt ) \ - \ - /* It's okay if this turns out to be NULL in non-1.4 JDKs. */ \ - do_klass(nio_Buffer_klass, java_nio_Buffer, Opt ) \ - \ - /* Stack Walking */ \ - do_klass(StackWalker_klass, java_lang_StackWalker, Opt ) \ - do_klass(AbstractStackWalker_klass, java_lang_StackStreamFactory_AbstractStackWalker, Opt ) \ - do_klass(StackFrameInfo_klass, java_lang_StackFrameInfo, Opt ) \ - do_klass(LiveStackFrameInfo_klass, java_lang_LiveStackFrameInfo, Opt ) \ - \ - /* support for stack dump lock analysis */ \ - do_klass(java_util_concurrent_locks_AbstractOwnableSynchronizer_klass, java_util_concurrent_locks_AbstractOwnableSynchronizer, Pre ) \ - \ - /* Preload boxing klasses */ \ - do_klass(Boolean_klass, java_lang_Boolean, Pre ) \ - do_klass(Character_klass, java_lang_Character, Pre ) \ - do_klass(Float_klass, java_lang_Float, Pre ) \ - do_klass(Double_klass, java_lang_Double, Pre ) \ - do_klass(Byte_klass, java_lang_Byte, Pre ) \ - do_klass(Short_klass, java_lang_Short, Pre ) \ - do_klass(Integer_klass, java_lang_Integer, Pre ) \ - do_klass(Long_klass, java_lang_Long, Pre ) \ - \ - /* JVMCI classes. These are loaded on-demand. */ \ - JVMCI_WK_KLASSES_DO(do_klass) \ - \ +#define WK_KLASSES_DO(do_klass) \ + /* well-known classes */ \ + do_klass(Object_klass, java_lang_Object ) \ + do_klass(String_klass, java_lang_String ) \ + do_klass(Class_klass, java_lang_Class ) \ + do_klass(Cloneable_klass, java_lang_Cloneable ) \ + do_klass(ClassLoader_klass, java_lang_ClassLoader ) \ + do_klass(Serializable_klass, java_io_Serializable ) \ + do_klass(System_klass, java_lang_System ) \ + do_klass(Throwable_klass, java_lang_Throwable ) \ + do_klass(Error_klass, java_lang_Error ) \ + do_klass(ThreadDeath_klass, java_lang_ThreadDeath ) \ + do_klass(Exception_klass, java_lang_Exception ) \ + do_klass(RuntimeException_klass, java_lang_RuntimeException ) \ + do_klass(SecurityManager_klass, java_lang_SecurityManager ) \ + do_klass(ProtectionDomain_klass, java_security_ProtectionDomain ) \ + do_klass(AccessControlContext_klass, java_security_AccessControlContext ) \ + do_klass(SecureClassLoader_klass, java_security_SecureClassLoader ) \ + do_klass(ClassNotFoundException_klass, java_lang_ClassNotFoundException ) \ + do_klass(NoClassDefFoundError_klass, java_lang_NoClassDefFoundError ) \ + do_klass(LinkageError_klass, java_lang_LinkageError ) \ + do_klass(ClassCastException_klass, java_lang_ClassCastException ) \ + do_klass(ArrayStoreException_klass, java_lang_ArrayStoreException ) \ + do_klass(VirtualMachineError_klass, java_lang_VirtualMachineError ) \ + do_klass(OutOfMemoryError_klass, java_lang_OutOfMemoryError ) \ + do_klass(StackOverflowError_klass, java_lang_StackOverflowError ) \ + do_klass(IllegalMonitorStateException_klass, java_lang_IllegalMonitorStateException ) \ + do_klass(Reference_klass, java_lang_ref_Reference ) \ + \ + /* Preload ref klasses and set reference types */ \ + do_klass(SoftReference_klass, java_lang_ref_SoftReference ) \ + do_klass(WeakReference_klass, java_lang_ref_WeakReference ) \ + do_klass(FinalReference_klass, java_lang_ref_FinalReference ) \ + do_klass(PhantomReference_klass, java_lang_ref_PhantomReference ) \ + do_klass(Finalizer_klass, java_lang_ref_Finalizer ) \ + \ + do_klass(Thread_klass, java_lang_Thread ) \ + do_klass(ThreadGroup_klass, java_lang_ThreadGroup ) \ + do_klass(Properties_klass, java_util_Properties ) \ + do_klass(Module_klass, java_lang_Module ) \ + do_klass(reflect_AccessibleObject_klass, java_lang_reflect_AccessibleObject ) \ + do_klass(reflect_Field_klass, java_lang_reflect_Field ) \ + do_klass(reflect_Parameter_klass, java_lang_reflect_Parameter ) \ + do_klass(reflect_Method_klass, java_lang_reflect_Method ) \ + do_klass(reflect_Constructor_klass, java_lang_reflect_Constructor ) \ + \ + /* NOTE: needed too early in bootstrapping process to have checks based on JDK version */ \ + /* It's okay if this turns out to be NULL in non-1.4 JDKs. */ \ + do_klass(reflect_MagicAccessorImpl_klass, reflect_MagicAccessorImpl ) \ + do_klass(reflect_MethodAccessorImpl_klass, reflect_MethodAccessorImpl ) \ + do_klass(reflect_ConstructorAccessorImpl_klass, reflect_ConstructorAccessorImpl ) \ + do_klass(reflect_DelegatingClassLoader_klass, reflect_DelegatingClassLoader ) \ + do_klass(reflect_ConstantPool_klass, reflect_ConstantPool ) \ + do_klass(reflect_UnsafeStaticFieldAccessorImpl_klass, reflect_UnsafeStaticFieldAccessorImpl ) \ + do_klass(reflect_CallerSensitive_klass, reflect_CallerSensitive ) \ + \ + /* support for dynamic typing; it's OK if these are NULL in earlier JDKs */ \ + do_klass(DirectMethodHandle_klass, java_lang_invoke_DirectMethodHandle ) \ + do_klass(MethodHandle_klass, java_lang_invoke_MethodHandle ) \ + do_klass(VarHandle_klass, java_lang_invoke_VarHandle ) \ + do_klass(MemberName_klass, java_lang_invoke_MemberName ) \ + do_klass(ResolvedMethodName_klass, java_lang_invoke_ResolvedMethodName ) \ + do_klass(MethodHandleNatives_klass, java_lang_invoke_MethodHandleNatives ) \ + do_klass(LambdaForm_klass, java_lang_invoke_LambdaForm ) \ + do_klass(MethodType_klass, java_lang_invoke_MethodType ) \ + do_klass(BootstrapMethodError_klass, java_lang_BootstrapMethodError ) \ + do_klass(CallSite_klass, java_lang_invoke_CallSite ) \ + do_klass(Context_klass, java_lang_invoke_MethodHandleNatives_CallSiteContext ) \ + do_klass(ConstantCallSite_klass, java_lang_invoke_ConstantCallSite ) \ + do_klass(MutableCallSite_klass, java_lang_invoke_MutableCallSite ) \ + do_klass(VolatileCallSite_klass, java_lang_invoke_VolatileCallSite ) \ + /* Note: MethodHandle must be first, and VolatileCallSite last in group */ \ + \ + do_klass(AssertionStatusDirectives_klass, java_lang_AssertionStatusDirectives ) \ + do_klass(StringBuffer_klass, java_lang_StringBuffer ) \ + do_klass(StringBuilder_klass, java_lang_StringBuilder ) \ + do_klass(internal_Unsafe_klass, jdk_internal_misc_Unsafe ) \ + do_klass(module_Modules_klass, jdk_internal_module_Modules ) \ + \ + /* support for CDS */ \ + do_klass(ByteArrayInputStream_klass, java_io_ByteArrayInputStream ) \ + do_klass(URL_klass, java_net_URL ) \ + do_klass(Jar_Manifest_klass, java_util_jar_Manifest ) \ + do_klass(jdk_internal_loader_ClassLoaders_klass, jdk_internal_loader_ClassLoaders ) \ + do_klass(jdk_internal_loader_ClassLoaders_AppClassLoader_klass, jdk_internal_loader_ClassLoaders_AppClassLoader) \ + do_klass(jdk_internal_loader_ClassLoaders_PlatformClassLoader_klass, jdk_internal_loader_ClassLoaders_PlatformClassLoader) \ + do_klass(CodeSource_klass, java_security_CodeSource ) \ + \ + do_klass(StackTraceElement_klass, java_lang_StackTraceElement ) \ + \ + /* It's okay if this turns out to be NULL in non-1.4 JDKs. */ \ + do_klass(nio_Buffer_klass, java_nio_Buffer ) \ + \ + /* Stack Walking */ \ + do_klass(StackWalker_klass, java_lang_StackWalker ) \ + do_klass(AbstractStackWalker_klass, java_lang_StackStreamFactory_AbstractStackWalker ) \ + do_klass(StackFrameInfo_klass, java_lang_StackFrameInfo ) \ + do_klass(LiveStackFrameInfo_klass, java_lang_LiveStackFrameInfo ) \ + \ + /* support for stack dump lock analysis */ \ + do_klass(java_util_concurrent_locks_AbstractOwnableSynchronizer_klass, java_util_concurrent_locks_AbstractOwnableSynchronizer) \ + \ + /* Preload boxing klasses */ \ + do_klass(Boolean_klass, java_lang_Boolean ) \ + do_klass(Character_klass, java_lang_Character ) \ + do_klass(Float_klass, java_lang_Float ) \ + do_klass(Double_klass, java_lang_Double ) \ + do_klass(Byte_klass, java_lang_Byte ) \ + do_klass(Short_klass, java_lang_Short ) \ + do_klass(Integer_klass, java_lang_Integer ) \ + do_klass(Long_klass, java_lang_Long ) \ + \ + /* JVMCI classes. These are loaded on-demand. */ \ + JVMCI_WK_KLASSES_DO(do_klass) \ + \ /*end*/ @@ -226,7 +224,7 @@ class SystemDictionary : AllStatic { enum WKID { NO_WKID = 0, - #define WK_KLASS_ENUM(name, symbol, ignore_o) WK_KLASS_ENUM_NAME(name), WK_KLASS_ENUM_NAME(symbol) = WK_KLASS_ENUM_NAME(name), + #define WK_KLASS_ENUM(name, symbol) WK_KLASS_ENUM_NAME(name), WK_KLASS_ENUM_NAME(symbol) = WK_KLASS_ENUM_NAME(name), WK_KLASSES_DO(WK_KLASS_ENUM) #undef WK_KLASS_ENUM @@ -240,21 +238,6 @@ class SystemDictionary : AllStatic { FIRST_WKID = NO_WKID + 1 }; - enum InitOption { - Pre, // preloaded; error if not present - - // Order is significant. Options before this point require resolve_or_fail. - // Options after this point will use resolve_or_null instead. - - Opt, // preload tried; NULL if not present -#if INCLUDE_JVMCI - Jvmci, // preload tried; error if not present if JVMCI enabled -#endif - OPTION_LIMIT, - CEIL_LG_OPTION_LIMIT = 2 // OPTION_LIMIT <= (1<is_subclass_of(SystemDictionary::reflect_MagicAccessorImpl_klass())) { + if (SystemDictionary::reflect_MagicAccessorImpl_klass_is_loaded() && + current_class->is_subclass_of(SystemDictionary::reflect_MagicAccessorImpl_klass())) { return ACCESS_OK; } From b9279ef850114b2b0e5ddde43d01a2bf5491822b Mon Sep 17 00:00:00 2001 From: Michael McMahon Date: Fri, 19 Oct 2018 14:23:43 +0100 Subject: [PATCH 60/66] 8211437: java.net.http.HttpClient hangs on 204 reply without Content-length 0 Reviewed-by: chegar, dfuchs --- .../jdk/internal/net/http/MultiExchange.java | 64 +++++ .../sun/net/httpserver/ExchangeImpl.java | 4 +- test/jdk/java/net/httpclient/Response204.java | 109 +++++++++ .../java/net/httpclient/http2/NoBodyTest.java | 221 ++++++++++++++++++ .../http2/server/Http2TestExchangeImpl.java | 2 +- 5 files changed, 396 insertions(+), 4 deletions(-) create mode 100644 test/jdk/java/net/httpclient/Response204.java create mode 100644 test/jdk/java/net/httpclient/http2/NoBodyTest.java diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java b/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java index 4510902577e..4dcf3be0c88 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java @@ -26,21 +26,26 @@ package jdk.internal.net.http; import java.io.IOException; +import java.io.UncheckedIOException; import java.net.ConnectException; import java.net.http.HttpConnectTimeoutException; import java.util.Iterator; import java.util.LinkedList; import java.security.AccessControlContext; import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletionStage; import java.util.concurrent.CompletionException; import java.util.concurrent.ExecutionException; import java.util.concurrent.Executor; +import java.util.concurrent.Flow; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Function; import java.net.http.HttpClient; +import java.net.http.HttpHeaders; import java.net.http.HttpRequest; import java.net.http.HttpResponse; +import java.net.http.HttpResponse.BodySubscriber; import java.net.http.HttpResponse.PushPromiseHandler; import java.net.http.HttpTimeoutException; import jdk.internal.net.http.common.Log; @@ -200,11 +205,60 @@ class MultiExchange { return cf; } + // return true if the response is a type where a response body is never possible + // and therefore doesn't have to include header information which indicates no + // body is present. This is distinct from responses that also do not contain + // response bodies (possibly ever) but which are required to have content length + // info in the header (eg 205). Those cases do not have to be handled specially + + private static boolean bodyNotPermitted(Response r) { + return r.statusCode == 204; + } + + private boolean bodyIsPresent(Response r) { + HttpHeaders headers = r.headers(); + if (headers.firstValue("Content-length").isPresent()) + return true; + if (headers.firstValue("Transfer-encoding").isPresent()) + return true; + return false; + } + + // Call the user's body handler to get an empty body object + + private CompletableFuture> handleNoBody(Response r, Exchange exch) { + BodySubscriber bs = responseHandler.apply(new ResponseInfoImpl(r.statusCode(), + r.headers(), r.version())); + CompletionStage cs = bs.getBody(); + bs.onSubscribe(new NullSubscription()); + bs.onComplete(); + MinimalFuture> result = new MinimalFuture<>(); + cs.whenComplete((nullBody, exception) -> { + if (exception != null) + result.completeExceptionally(exception); + else { + this.response = + new HttpResponseImpl<>(r.request(), r, this.response, nullBody, exch); + result.complete(this.response); + } + }); + return result; + } + private CompletableFuture> responseAsync0(CompletableFuture start) { return start.thenCompose( v -> responseAsyncImpl()) .thenCompose((Response r) -> { Exchange exch = getExchange(); + if (bodyNotPermitted(r)) { + if (bodyIsPresent(r)) { + IOException ioe = new IOException( + "unexpected content length header with 204 response"); + exch.cancel(ioe); + return MinimalFuture.failedFuture(ioe); + } else + return handleNoBody(r, exch); + } return exch.readBodyAsync(responseHandler) .thenApply((T body) -> { this.response = @@ -214,6 +268,16 @@ class MultiExchange { }); } + static class NullSubscription implements Flow.Subscription { + @Override + public void request(long n) { + } + + @Override + public void cancel() { + } + } + private CompletableFuture responseAsyncImpl() { CompletableFuture cf; if (attempts.incrementAndGet() > max_attempts) { diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java index 6d1230a54e0..13b0326a150 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java @@ -255,9 +255,7 @@ class ExchangeImpl { noContentToSend = true; contentLen = 0; } - if (noContentLengthHeader) { - rspHdrs.remove("Content-length"); - } else { + if (!noContentLengthHeader) { rspHdrs.set("Content-length", Long.toString(contentLen)); } o.setWrappedStream (new FixedLengthOutputStream (this, ros, contentLen)); diff --git a/test/jdk/java/net/httpclient/Response204.java b/test/jdk/java/net/httpclient/Response204.java new file mode 100644 index 00000000000..61d54ce7031 --- /dev/null +++ b/test/jdk/java/net/httpclient/Response204.java @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test + * @bug 8211437 + * @run main/othervm -Djdk.httpclient.HttpClient.log=headers,requests Response204 + * @summary + */ + +import com.sun.net.httpserver.*; + +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.*; +import java.util.concurrent.*; +import java.util.logging.*; +import java.io.*; +import java.net.*; + +/** + * Verify that a 204 response code with no content-length is handled correctly + */ +public class Response204 { + + public static void main (String[] args) throws Exception { + Logger logger = Logger.getLogger ("com.sun.net.httpserver"); + ConsoleHandler c = new ConsoleHandler(); + c.setLevel (Level.WARNING); + logger.addHandler (c); + logger.setLevel (Level.WARNING); + Handler handler = new Handler(); + InetSocketAddress addr = new InetSocketAddress (0); + HttpServer server = HttpServer.create (addr, 0); + HttpContext ctx = server.createContext ("/test", handler); + ExecutorService executor = Executors.newCachedThreadPool(); + server.setExecutor (executor); + server.start (); + + URI uri = new URI("http://localhost:"+server.getAddress().getPort()+"/test/foo.html"); + + try { + HttpClient client = HttpClient.newHttpClient(); + HttpRequest request = HttpRequest.newBuilder(uri) + .GET() + .build(); + HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); + if (response.statusCode() != 204) + throw new RuntimeException("wrong response code"); + if (response.body() != null && !response.body().equals("")) + throw new RuntimeException("should have received empty response"); + System.out.println(response.headers().firstValue("content-length").orElse("nichts")); + System.out.println ("OK 1"); + // Send a second time. This time we should get exception because the server + // is going to send an invalid 204 with a Content-length + try { + response = client.send(request, HttpResponse.BodyHandlers.ofString()); + throw new RuntimeException("send should have thrown exception"); + } catch (IOException ioe) { + System.out.println("OK 2"); + } + } finally { + server.stop(2); + executor.shutdown(); + } + } + + public static boolean error = false; + + static class Handler implements HttpHandler { + volatile int counter = 0; + + public void handle(HttpExchange t) + throws IOException { + InputStream is = t.getRequestBody(); + Headers map = t.getRequestHeaders(); + Headers rmap = t.getResponseHeaders(); + while (is.read() != -1) ; + is.close(); + if (counter++ == 1) { + // pretend there is a body + rmap.set("Content-length", "10"); + } + t.sendResponseHeaders(204, -1); + t.close(); + } + } +} diff --git a/test/jdk/java/net/httpclient/http2/NoBodyTest.java b/test/jdk/java/net/httpclient/http2/NoBodyTest.java new file mode 100644 index 00000000000..95629d79d16 --- /dev/null +++ b/test/jdk/java/net/httpclient/http2/NoBodyTest.java @@ -0,0 +1,221 @@ +/* + * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8087112 + * @library /test/lib server + * @build jdk.test.lib.net.SimpleSSLContext + * @modules java.base/sun.net.www.http + * java.net.http/jdk.internal.net.http.common + * java.net.http/jdk.internal.net.http.frame + * java.net.http/jdk.internal.net.http.hpack + * @run testng/othervm -Djdk.httpclient.HttpClient.log=ssl,requests,responses,errors NoBodyTest + */ + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.*; +import javax.net.ssl.*; +import java.net.http.HttpClient; +import java.net.http.HttpHeaders; +import java.net.http.HttpRequest; +import java.net.http.HttpRequest.BodyPublishers; +import java.net.http.HttpResponse; +import java.net.http.HttpResponse.BodyHandlers; +import java.util.concurrent.*; +import jdk.test.lib.net.SimpleSSLContext; +import org.testng.annotations.Test; +import static java.net.http.HttpClient.Version.HTTP_2; + +@Test +public class NoBodyTest { + static int httpPort, httpsPort; + static Http2TestServer httpServer, httpsServer; + static HttpClient client = null; + static ExecutorService clientExec; + static ExecutorService serverExec; + static SSLContext sslContext; + static String TEST_STRING = "The quick brown fox jumps over the lazy dog "; + + static String httpURIString, httpsURIString; + + static void initialize() throws Exception { + try { + SimpleSSLContext sslct = new SimpleSSLContext(); + sslContext = sslct.get(); + client = getClient(); + httpServer = new Http2TestServer(false, 0, serverExec, sslContext); + httpServer.addHandler(new Handler(), "/"); + httpPort = httpServer.getAddress().getPort(); + + httpsServer = new Http2TestServer(true, 0, serverExec, sslContext); + httpsServer.addHandler(new Handler(), "/"); + + httpsPort = httpsServer.getAddress().getPort(); + httpURIString = "http://localhost:" + httpPort + "/foo/"; + httpsURIString = "https://localhost:" + httpsPort + "/bar/"; + + httpServer.start(); + httpsServer.start(); + } catch (Throwable e) { + System.err.println("Throwing now"); + e.printStackTrace(System.err); + throw e; + } + } + + @Test + public static void runtest() throws Exception { + try { + initialize(); + warmup(false); + warmup(true); + test(false); + test(true); + } catch (Throwable tt) { + System.err.println("tt caught"); + tt.printStackTrace(System.err); + throw tt; + } finally { + httpServer.stop(); + httpsServer.stop(); + } + } + + static HttpClient getClient() { + if (client == null) { + serverExec = Executors.newCachedThreadPool(); + clientExec = Executors.newCachedThreadPool(); + client = HttpClient.newBuilder() + .executor(clientExec) + .sslContext(sslContext) + .version(HTTP_2) + .build(); + } + return client; + } + + static URI getURI(boolean secure) { + if (secure) + return URI.create(httpsURIString); + else + return URI.create(httpURIString); + } + + static void checkStatus(int expected, int found) throws Exception { + if (expected != found) { + System.err.printf ("Test failed: wrong status code %d/%d\n", + expected, found); + throw new RuntimeException("Test failed"); + } + } + + static void checkStrings(String expected, String found) throws Exception { + if (!expected.equals(found)) { + System.err.printf ("Test failed: wrong string %s/%s\n", + expected, found); + throw new RuntimeException("Test failed"); + } + } + + static final int LOOPS = 13; + + static void warmup(boolean secure) throws Exception { + URI uri = getURI(secure); + String type = secure ? "https" : "http"; + System.err.println("Request to " + uri); + + // Do a simple warmup request + + HttpClient client = getClient(); + HttpRequest req = HttpRequest.newBuilder(uri) + .POST(BodyPublishers.ofString("Random text")) + .build(); + HttpResponse response = client.send(req, BodyHandlers.ofString()); + checkStatus(200, response.statusCode()); + String responseBody = response.body(); + HttpHeaders h = response.headers(); + checkStrings(TEST_STRING + type, responseBody); + } + + static void test(boolean secure) throws Exception { + URI uri = getURI(secure); + String type = secure ? "https" : "http"; + System.err.println("Request to " + uri); + + HttpRequest request = HttpRequest.newBuilder(uri) + .POST(BodyPublishers.ofString(TEST_STRING)) + .build(); + for (int i = 0; i < LOOPS; i++) { + System.out.println("Loop " + i); + HttpResponse response = client.send(request, BodyHandlers.ofString()); + int expectedResponse = (i % 2) == 0 ? 204 : 200; + if (response.statusCode() != expectedResponse) + throw new RuntimeException("wrong response code " + Integer.toString(response.statusCode())); + if (expectedResponse == 200 && !response.body().equals(TEST_STRING + type)) { + System.err.printf("response received/expected %s/%s\n", response.body(), TEST_STRING + type); + throw new RuntimeException("wrong response body"); + } + } + System.err.println("test: DONE"); + } + + static class Handler implements Http2Handler { + + public Handler() {} + + volatile int invocation = 0; + + @Override + public void handle(Http2TestExchange t) + throws IOException { + try { + URI uri = t.getRequestURI(); + System.err.printf("Handler received request to %s from %s\n", + uri, t.getRemoteAddress()); + String type = uri.getScheme().toLowerCase(); + InputStream is = t.getRequestBody(); + while (is.read() != -1); + is.close(); + + // every second response is 204. + + if ((invocation++ % 2) == 1) { + System.err.println("Server sending 204"); + t.sendResponseHeaders(204, -1); + } else { + String body = TEST_STRING + type; + t.sendResponseHeaders(200, body.length()); + OutputStream os = t.getResponseBody(); + os.write(body.getBytes()); + os.close(); + } + } catch (Throwable e) { + e.printStackTrace(System.err); + throw new IOException(e); + } + } + } +} diff --git a/test/jdk/java/net/httpclient/http2/server/Http2TestExchangeImpl.java b/test/jdk/java/net/httpclient/http2/server/Http2TestExchangeImpl.java index 8f8b1fe5b61..e592564e758 100644 --- a/test/jdk/java/net/httpclient/http2/server/Http2TestExchangeImpl.java +++ b/test/jdk/java/net/httpclient/http2/server/Http2TestExchangeImpl.java @@ -129,7 +129,7 @@ public class Http2TestExchangeImpl implements Http2TestExchange { @Override public void sendResponseHeaders(int rCode, long responseLength) throws IOException { this.responseLength = responseLength; - if (responseLength > 0 || responseLength < 0) { + if (responseLength !=0 && rCode != 204) { long clen = responseLength > 0 ? responseLength : 0; rspheadersBuilder.setHeader("Content-length", Long.toString(clen)); } From a675a4894038da9036a18dff277bce87397dcc6e Mon Sep 17 00:00:00 2001 From: Sean Mullan Date: Fri, 19 Oct 2018 09:31:57 -0400 Subject: [PATCH 61/66] 8195793: Remove GTE CyberTrust Global Root Reviewed-by: rhalade --- src/java.base/share/lib/security/cacerts | Bin 102883 -> 102225 bytes .../security/lib/cacerts/VerifyCACerts.java | 13 ++++--------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/java.base/share/lib/security/cacerts b/src/java.base/share/lib/security/cacerts index f7415b812ea95c15aa3207df13bbcf9dc826c8f6..02181bef7e3609e171bb050699d620610c055d5b 100644 GIT binary patch delta 157 zcmV;O0Al~+qXyBQ1`Ph~{_Ow&00IC209>&Qke9PAnpU2-g+2jG1h<4Z0RaZL&_V%a z4Yxa10T%?fHBbQu2DejM0Wt}bG>{OtNNfQ=1h+(J0rUg6g<}D~1h zO`Jg!Q8XI`?Np|XJ@ z8$VDbv#=CgQpRb7rv z@I!Nr;)ME5(}UUP2mj2Cm~v@-Z*E6=!?U-Wrk*b{JhfD&Xjcr=^AxA&KUeBpv*KOT z>$FOR(el|Gd&bsq-iUVBAD3HKP0mznE%0ct7ZN>Qxka8;-#V#&CKEFw10!0@FgG?b zMB$@OHXV;u0+zkMhS0YL?wAUL?ZYYWsUNpTW^)G2=#Ij(OE4e)kg4yQrKa4NCqFl)HTU?cb^h{7ThC5iyKDKGpR2j6>NiiH9zAcntra69+xAbUjNUBU z?Hm|WdAIKhWMpUCzQmVNjAi?Qa7JU!?Pi&b`&qU-r80hDo@_EfU^{anqdm*^ueprU zT-(#C7|U6<3sf+MF>Sxw#Hh_O*>RP`_OEq}FPOK#>tgh0nH-=Xv0b{I@f@?rvq!?p W3(h>>^W^OMHByWVc8l~R>Hz?GiV#)+ diff --git a/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java b/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java index 815755b3054..c227f023895 100644 --- a/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java +++ b/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java @@ -24,8 +24,8 @@ /** * @test - * @bug 8189131 8198240 8191844 8189949 8191031 8196141 8204923 8195774 8199779 8209452 - * 8209506 8210432 + * @bug 8189131 8198240 8191844 8189949 8191031 8196141 8204923 8195774 8199779 + * 8209452 8209506 8210432 8195793 * @summary Check root CA entries in cacerts file */ import java.io.File; @@ -42,7 +42,7 @@ public class VerifyCACerts { + File.separator + "security" + File.separator + "cacerts"; // The numbers of certs now. - private static final int COUNT = 93; + private static final int COUNT = 92; // map of cert alias to SHA-256 fingerprint private static final Map FINGERPRINT_MAP @@ -116,8 +116,6 @@ public class VerifyCACerts { "B4:78:B8:12:25:0D:F8:78:63:5C:2A:A7:EC:7D:15:5E:AA:62:5E:E8:29:16:E2:CD:29:43:61:88:6C:D1:FB:D4"); put("geotrustuniversalca [jdk]", "A0:45:9B:9F:63:B2:25:59:F5:FA:5D:4C:6D:B3:F9:F7:2F:F1:93:42:03:35:78:F0:73:BF:1D:1B:46:CB:B9:12"); - put("gtecybertrustglobalca [jdk]", - "A5:31:25:18:8D:21:10:AA:96:4B:02:C7:B7:C6:DA:32:03:17:08:94:E5:FB:71:FF:FB:66:67:D5:E6:81:0A:36"); put("thawteprimaryrootca [jdk]", "8D:72:2F:81:A9:C1:13:C0:79:1D:F1:36:A2:96:6D:B2:6C:95:0A:97:1D:B4:6B:41:99:F4:EA:54:B7:8B:FB:9F"); put("thawteprimaryrootcag2 [jdk]", @@ -239,10 +237,7 @@ public class VerifyCACerts { // Exception list to 90 days expiry policy // No error will be reported if certificate in this list expires - private static final HashSet EXPIRY_EXC_ENTRIES - = new HashSet(Arrays.asList( - "gtecybertrustglobalca [jdk]" - )); + private static final HashSet EXPIRY_EXC_ENTRIES = new HashSet<>(); // Ninety days in milliseconds private static final long NINETY_DAYS = 7776000000L; From 7fcee43b13d24954a582f65fdf900c27039ecbee Mon Sep 17 00:00:00 2001 From: Alex Menkov Date: Fri, 19 Oct 2018 09:31:52 -0700 Subject: [PATCH 62/66] 8212629: [TEST] wrong breakpoint in test/jdk/com/sun/jdi/DeferredStepTest Reviewed-by: cjplummer, jcbeyler --- test/jdk/com/sun/jdi/DeferredStepTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/jdk/com/sun/jdi/DeferredStepTest.java b/test/jdk/com/sun/jdi/DeferredStepTest.java index a78f7ee8686..6ff90797ac0 100644 --- a/test/jdk/com/sun/jdi/DeferredStepTest.java +++ b/test/jdk/com/sun/jdi/DeferredStepTest.java @@ -114,7 +114,7 @@ public class DeferredStepTest extends JdbTest { * Each "next" produces something like ("Breakpoint hit" line only if the line has BP) * Step completed: * Breakpoint hit: "thread=jj2", DeferredStepTestTarg$jj2.run(), line=74 bci=12 - * 74 ++count2; // @2 breakpoint + * 74 ++count2; // @ 2 breakpoint * * jj2[1] */ From 6beba541cd3608c6279928cc091e3ed36fc46bfa Mon Sep 17 00:00:00 2001 From: Paul Hohensee Date: Fri, 19 Oct 2018 17:54:21 -0400 Subject: [PATCH 63/66] 8212698: Minor g1 #include changes and memoryService.hpp copyright date update Fix #includes in g1FullGCOopClosures.inline.hpp, g1HeapVerifier.hpp + memoryService.hpp copyright date Reviewed-by: tschatzl, jcbeyler --- src/hotspot/share/gc/g1/g1FullGCOopClosures.inline.hpp | 2 +- src/hotspot/share/gc/g1/g1HeapVerifier.cpp | 2 -- src/hotspot/share/services/memoryService.hpp | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1FullGCOopClosures.inline.hpp b/src/hotspot/share/gc/g1/g1FullGCOopClosures.inline.hpp index 4e32b6f5cbf..bc60f26c9b9 100644 --- a/src/hotspot/share/gc/g1/g1FullGCOopClosures.inline.hpp +++ b/src/hotspot/share/gc/g1/g1FullGCOopClosures.inline.hpp @@ -25,7 +25,7 @@ #ifndef SHARE_VM_GC_G1_G1FULLGCOOPCLOSURES_INLINE_HPP #define SHARE_VM_GC_G1_G1FULLGCOOPCLOSURES_INLINE_HPP -#include "gc/g1/g1Allocator.hpp" +#include "gc/g1/g1Allocator.inline.hpp" #include "gc/g1/g1ConcurrentMarkBitMap.inline.hpp" #include "gc/g1/g1FullGCMarker.inline.hpp" #include "gc/g1/g1FullGCOopClosures.hpp" diff --git a/src/hotspot/share/gc/g1/g1HeapVerifier.cpp b/src/hotspot/share/gc/g1/g1HeapVerifier.cpp index 78cbd73e5be..a055c09f25b 100644 --- a/src/hotspot/share/gc/g1/g1HeapVerifier.cpp +++ b/src/hotspot/share/gc/g1/g1HeapVerifier.cpp @@ -24,14 +24,12 @@ #include "precompiled.hpp" #include "gc/g1/g1Allocator.inline.hpp" -#include "gc/g1/g1CollectedHeap.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1ConcurrentMarkThread.hpp" #include "gc/g1/g1HeapVerifier.hpp" #include "gc/g1/g1Policy.hpp" #include "gc/g1/g1RemSet.hpp" #include "gc/g1/g1RootProcessor.hpp" -#include "gc/g1/heapRegion.hpp" #include "gc/g1/heapRegion.inline.hpp" #include "gc/g1/heapRegionRemSet.hpp" #include "gc/g1/g1StringDedup.hpp" diff --git a/src/hotspot/share/services/memoryService.hpp b/src/hotspot/share/services/memoryService.hpp index 222918df4b2..35b913975cf 100644 --- a/src/hotspot/share/services/memoryService.hpp +++ b/src/hotspot/share/services/memoryService.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. * 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 137e3161c49b3ec700611739460ac62da52eba45 Mon Sep 17 00:00:00 2001 From: Jamil Nimeh Date: Fri, 19 Oct 2018 18:05:50 -0700 Subject: [PATCH 64/66] 8211806: TLS 1.3 handshake server name indication is missing on a session resume Reviewed-by: xuelei, wetmore --- .../security/ssl/PostHandshakeContext.java | 3 + .../ssl/SSLSession/ResumeTLS13withSNI.java | 586 ++++++++++++++++++ 2 files changed, 589 insertions(+) create mode 100644 test/jdk/javax/net/ssl/SSLSession/ResumeTLS13withSNI.java diff --git a/src/java.base/share/classes/sun/security/ssl/PostHandshakeContext.java b/src/java.base/share/classes/sun/security/ssl/PostHandshakeContext.java index 1c899751a09..1ae480e893a 100644 --- a/src/java.base/share/classes/sun/security/ssl/PostHandshakeContext.java +++ b/src/java.base/share/classes/sun/security/ssl/PostHandshakeContext.java @@ -50,6 +50,9 @@ final class PostHandshakeContext extends HandshakeContext { this.localSupportedSignAlgs = new ArrayList( context.conSession.getLocalSupportedSignatureSchemes()); + this.requestedServerNames = + context.conSession.getRequestedServerNames(); + handshakeConsumers = new LinkedHashMap<>(consumers); handshakeFinished = true; } diff --git a/test/jdk/javax/net/ssl/SSLSession/ResumeTLS13withSNI.java b/test/jdk/javax/net/ssl/SSLSession/ResumeTLS13withSNI.java new file mode 100644 index 00000000000..f5455cc918e --- /dev/null +++ b/test/jdk/javax/net/ssl/SSLSession/ResumeTLS13withSNI.java @@ -0,0 +1,586 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +// SunJSSE does not support dynamic system properties, no way to re-use +// system properties in samevm/agentvm mode. + +/* + * @test + * @bug 8211806 + * @summary TLS 1.3 handshake server name indication is missing on a session resume + * @run main/othervm ResumeTLS13withSNI + */ + +import javax.net.ssl.*; +import javax.net.ssl.SSLEngineResult.*; +import java.io.*; +import java.security.*; +import java.nio.*; +import java.util.List; + +public class ResumeTLS13withSNI { + + /* + * Enables logging of the SSLEngine operations. + */ + private static final boolean logging = false; + + /* + * Enables the JSSE system debugging system property: + * + * -Djavax.net.debug=ssl:handshake + * + * This gives a lot of low-level information about operations underway, + * including specific handshake messages, and might be best examined + * after gaining some familiarity with this application. + */ + private static final boolean debug = true; + + private static final ByteBuffer clientOut = + ByteBuffer.wrap("Hi Server, I'm Client".getBytes()); + private static final ByteBuffer serverOut = + ByteBuffer.wrap("Hello Client, I'm Server".getBytes()); + + /* + * The following is to set up the keystores. + */ + private static final String pathToStores = "../etc"; + private static final String keyStoreFile = "keystore"; + private static final String trustStoreFile = "truststore"; + private static final char[] passphrase = "passphrase".toCharArray(); + + private static final String keyFilename = + System.getProperty("test.src", ".") + "/" + pathToStores + + "/" + keyStoreFile; + private static final String trustFilename = + System.getProperty("test.src", ".") + "/" + pathToStores + + "/" + trustStoreFile; + + private static final String HOST_NAME = "arf.yak.foo"; + private static final SNIHostName SNI_NAME = new SNIHostName(HOST_NAME); + private static final SNIMatcher SNI_MATCHER = + SNIHostName.createSNIMatcher("arf\\.yak\\.foo"); + + /* + * Main entry point for this test. + */ + public static void main(String args[]) throws Exception { + if (debug) { + System.setProperty("javax.net.debug", "ssl:handshake"); + } + + KeyManagerFactory kmf = makeKeyManagerFactory(keyFilename, + passphrase); + TrustManagerFactory tmf = makeTrustManagerFactory(trustFilename, + passphrase); + + SSLContext sslCtx = SSLContext.getInstance("TLS"); + sslCtx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null); + + // Make client and server engines, then customize as needed + SSLEngine clientEngine = makeEngine(sslCtx, kmf, tmf, true); + SSLParameters cliSSLParams = clientEngine.getSSLParameters(); + cliSSLParams.setServerNames(List.of(SNI_NAME)); + clientEngine.setSSLParameters(cliSSLParams); + clientEngine.setEnabledProtocols(new String[] { "TLSv1.3" }); + + SSLEngine serverEngine = makeEngine(sslCtx, kmf, tmf, false); + SSLParameters servSSLParams = serverEngine.getSSLParameters(); + servSSLParams.setSNIMatchers(List.of(SNI_MATCHER)); + serverEngine.setSSLParameters(servSSLParams); + + initialHandshake(clientEngine, serverEngine); + + // Create a new client-side engine which can initiate TLS session + // resumption + SSLEngine newCliEngine = makeEngine(sslCtx, kmf, tmf, true); + newCliEngine.setEnabledProtocols(new String[] { "TLSv1.3" }); + ByteBuffer resCliHello = getResumptionClientHello(newCliEngine); + + dumpBuffer("Resumed ClientHello Data", resCliHello); + + // Parse the client hello message and make sure it is a resumption + // hello and has SNI in it. + checkResumedClientHelloSNI(resCliHello); + } + + /* + * Run the test. + * + * Sit in a tight loop, both engines calling wrap/unwrap regardless + * of whether data is available or not. We do this until both engines + * report back they are closed. + * + * The main loop handles all of the I/O phases of the SSLEngine's + * lifetime: + * + * initial handshaking + * application data transfer + * engine closing + * + * One could easily separate these phases into separate + * sections of code. + */ + private static void initialHandshake(SSLEngine clientEngine, + SSLEngine serverEngine) throws Exception { + boolean dataDone = false; + + // Create all the buffers + SSLSession session = clientEngine.getSession(); + int appBufferMax = session.getApplicationBufferSize(); + int netBufferMax = session.getPacketBufferSize(); + ByteBuffer clientIn = ByteBuffer.allocate(appBufferMax + 50); + ByteBuffer serverIn = ByteBuffer.allocate(appBufferMax + 50); + ByteBuffer cTOs = ByteBuffer.allocateDirect(netBufferMax); + ByteBuffer sTOc = ByteBuffer.allocateDirect(netBufferMax); + + // results from client's last operation + SSLEngineResult clientResult; + + // results from server's last operation + SSLEngineResult serverResult; + + /* + * Examining the SSLEngineResults could be much more involved, + * and may alter the overall flow of the application. + * + * For example, if we received a BUFFER_OVERFLOW when trying + * to write to the output pipe, we could reallocate a larger + * pipe, but instead we wait for the peer to drain it. + */ + Exception clientException = null; + Exception serverException = null; + + while (!dataDone) { + log("================"); + + try { + clientResult = clientEngine.wrap(clientOut, cTOs); + log("client wrap: ", clientResult); + } catch (Exception e) { + clientException = e; + System.err.println("Client wrap() threw: " + e.getMessage()); + } + logEngineStatus(clientEngine); + runDelegatedTasks(clientEngine); + + log("----"); + + try { + serverResult = serverEngine.wrap(serverOut, sTOc); + log("server wrap: ", serverResult); + } catch (Exception e) { + serverException = e; + System.err.println("Server wrap() threw: " + e.getMessage()); + } + logEngineStatus(serverEngine); + runDelegatedTasks(serverEngine); + + cTOs.flip(); + sTOc.flip(); + + log("--------"); + + try { + clientResult = clientEngine.unwrap(sTOc, clientIn); + log("client unwrap: ", clientResult); + } catch (Exception e) { + clientException = e; + System.err.println("Client unwrap() threw: " + e.getMessage()); + } + logEngineStatus(clientEngine); + runDelegatedTasks(clientEngine); + + log("----"); + + try { + serverResult = serverEngine.unwrap(cTOs, serverIn); + log("server unwrap: ", serverResult); + } catch (Exception e) { + serverException = e; + System.err.println("Server unwrap() threw: " + e.getMessage()); + } + logEngineStatus(serverEngine); + runDelegatedTasks(serverEngine); + + cTOs.compact(); + sTOc.compact(); + + /* + * After we've transfered all application data between the client + * and server, we close the clientEngine's outbound stream. + * This generates a close_notify handshake message, which the + * server engine receives and responds by closing itself. + */ + if (!dataDone && (clientOut.limit() == serverIn.position()) && + (serverOut.limit() == clientIn.position())) { + + /* + * A sanity check to ensure we got what was sent. + */ + checkTransfer(serverOut, clientIn); + checkTransfer(clientOut, serverIn); + + dataDone = true; + } + } + } + + /** + * The goal of this function is to start a simple TLS session resumption + * and get the client hello message data back so it can be inspected. + * + * @param clientEngine + * + * @return a ByteBuffer consisting of the ClientHello TLS record. + * + * @throws Exception if any processing goes wrong. + */ + private static ByteBuffer getResumptionClientHello(SSLEngine clientEngine) + throws Exception { + // Create all the buffers + SSLSession session = clientEngine.getSession(); + int appBufferMax = session.getApplicationBufferSize(); + int netBufferMax = session.getPacketBufferSize(); + ByteBuffer cTOs = ByteBuffer.allocateDirect(netBufferMax); + Exception clientException = null; + + // results from client's last operation + SSLEngineResult clientResult; + + // results from server's last operation + SSLEngineResult serverResult; + + log("================"); + + // Start by having the client create a new ClientHello. It should + // contain PSK info that allows it to attempt session resumption. + try { + clientResult = clientEngine.wrap(clientOut, cTOs); + log("client wrap: ", clientResult); + } catch (Exception e) { + clientException = e; + System.err.println("Client wrap() threw: " + e.getMessage()); + } + logEngineStatus(clientEngine); + runDelegatedTasks(clientEngine); + + log("----"); + + cTOs.flip(); + return cTOs; + } + + /** + * This method walks a ClientHello TLS record, looking for a matching + * server_name hostname value from the original handshake and a PSK + * extension, which indicates (in the context of this test) that this + * is a resumed handshake. + * + * @param resCliHello a ByteBuffer consisting of a complete TLS handshake + * record that is a ClientHello message. The position of the buffer + * must be at the beginning of the TLS record header. + * + * @throws Exception if any of the consistency checks for the TLS record, + * or handshake message fails. It will also throw an exception if + * either the server_name extension doesn't have a matching hostname + * field or the pre_shared_key extension is not present. + */ + private static void checkResumedClientHelloSNI(ByteBuffer resCliHello) + throws Exception { + boolean foundMatchingSNI = false; + boolean foundPSK = false; + + // Advance past the following fields: + // TLS Record header (5 bytes) + resCliHello.position(resCliHello.position() + 5); + + // Get the next byte and make sure it is a Client Hello + byte hsMsgType = resCliHello.get(); + if (hsMsgType != 0x01) { + throw new Exception("Message is not a ClientHello, MsgType = " + + hsMsgType); + } + + // Skip past the length (3 bytes) + resCliHello.position(resCliHello.position() + 3); + + // Protocol version should be TLSv1.2 (0x03, 0x03) + short chProto = resCliHello.getShort(); + if (chProto != 0x0303) { + throw new Exception( + "Client Hello protocol version is not TLSv1.2: Got " + + String.format("0x%04X", chProto)); + } + + // Skip 32-bytes of random data + resCliHello.position(resCliHello.position() + 32); + + // Get the legacy session length and skip that many bytes + int sessIdLen = Byte.toUnsignedInt(resCliHello.get()); + resCliHello.position(resCliHello.position() + sessIdLen); + + // Skip over all the cipher suites + int csLen = Short.toUnsignedInt(resCliHello.getShort()); + resCliHello.position(resCliHello.position() + csLen); + + // Skip compression methods + int compLen = Byte.toUnsignedInt(resCliHello.get()); + resCliHello.position(resCliHello.position() + compLen); + + // Parse the extensions. Get length first, then walk the extensions + // List and look for the presence of the PSK extension and server_name. + // For server_name, make sure it is the same as what was provided + // in the original handshake. + System.err.println("ClientHello Extensions Check"); + int extListLen = Short.toUnsignedInt(resCliHello.getShort()); + while (extListLen > 0) { + // Get the Extension type and length + int extType = Short.toUnsignedInt(resCliHello.getShort()); + int extLen = Short.toUnsignedInt(resCliHello.getShort()); + switch (extType) { + case 0: // server_name + System.err.println("* Found server_name Extension"); + int snListLen = Short.toUnsignedInt(resCliHello.getShort()); + while (snListLen > 0) { + int nameType = Byte.toUnsignedInt(resCliHello.get()); + if (nameType == 0) { // host_name + int hostNameLen = + Short.toUnsignedInt(resCliHello.getShort()); + byte[] hostNameData = new byte[hostNameLen]; + resCliHello.get(hostNameData); + String hostNameStr = new String(hostNameData); + System.err.println("\tHostname: " + hostNameStr); + if (hostNameStr.equals(HOST_NAME)) { + foundMatchingSNI = true; + } + snListLen -= 3 + hostNameLen; // type, len, data + } else { // something else + // We don't support anything else and cannot + // know how to advance. Throw an exception + throw new Exception("Unknown server name type: " + + nameType); + } + } + break; + case 41: // pre_shared_key + // We're not going to bother checking the value. The + // presence of the extension in the context of this test + // is good enough to tell us this is a resumed ClientHello. + foundPSK = true; + System.err.println("* Found pre_shared_key Extension"); + resCliHello.position(resCliHello.position() + extLen); + break; + default: + System.err.format("* Found extension %d (%d bytes)\n", + extType, extLen); + resCliHello.position(resCliHello.position() + extLen); + break; + } + extListLen -= extLen + 4; // Ext type(2), length(2), data(var.) + } + + // At the end of all the extension processing, either we've found + // both extensions and the server_name matches our expected value + // or we throw an exception. + if (!foundMatchingSNI) { + throw new Exception("Could not find a matching server_name"); + } else if (!foundPSK) { + throw new Exception("Missing PSK extension, not a resumption?"); + } + } + + /** + * Create a TrustManagerFactory from a given keystore. + * + * @param tsPath the path to the trust store file. + * @param pass the password for the trust store. + * + * @return a new TrustManagerFactory built from the trust store provided. + * + * @throws GeneralSecurityException if any processing errors occur + * with the Keystore instantiation or TrustManagerFactory creation. + * @throws IOException if any loading error with the trust store occurs. + */ + private static TrustManagerFactory makeTrustManagerFactory(String tsPath, + char[] pass) throws GeneralSecurityException, IOException { + TrustManagerFactory tmf; + KeyStore ts = KeyStore.getInstance("JKS"); + + try (FileInputStream fsIn = new FileInputStream(tsPath)) { + ts.load(fsIn, pass); + tmf = TrustManagerFactory.getInstance("SunX509"); + tmf.init(ts); + } + return tmf; + } + + /** + * Create a KeyManagerFactory from a given keystore. + * + * @param ksPath the path to the keystore file. + * @param pass the password for the keystore. + * + * @return a new TrustManagerFactory built from the keystore provided. + * + * @throws GeneralSecurityException if any processing errors occur + * with the Keystore instantiation or KeyManagerFactory creation. + * @throws IOException if any loading error with the keystore occurs + */ + private static KeyManagerFactory makeKeyManagerFactory(String ksPath, + char[] pass) throws GeneralSecurityException, IOException { + KeyManagerFactory kmf; + KeyStore ks = KeyStore.getInstance("JKS"); + + try (FileInputStream fsIn = new FileInputStream(ksPath)) { + ks.load(fsIn, pass); + kmf = KeyManagerFactory.getInstance("SunX509"); + kmf.init(ks, pass); + } + return kmf; + } + + /** + * Create an SSLEngine instance from a given protocol specifier, + * KeyManagerFactory and TrustManagerFactory. + * + * @param ctx the SSLContext used to create the SSLEngine + * @param kmf an initialized KeyManagerFactory. May be null. + * @param tmf an initialized TrustManagerFactory. May be null. + * @param isClient true if it intended to create a client engine, false + * for a server engine. + * + * @return an SSLEngine instance configured as a server and with client + * authentication disabled. + * + * @throws GeneralSecurityException if any errors occur during the + * creation of the SSLEngine. + */ + private static SSLEngine makeEngine(SSLContext ctx, + KeyManagerFactory kmf, TrustManagerFactory tmf, boolean isClient) + throws GeneralSecurityException { + ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null); + SSLEngine ssle = ctx.createSSLEngine("localhost", 8443); + ssle.setUseClientMode(isClient); + ssle.setNeedClientAuth(false); + return ssle; + } + + private static void logEngineStatus(SSLEngine engine) { + log("\tCurrent HS State " + engine.getHandshakeStatus().toString()); + log("\tisInboundDone(): " + engine.isInboundDone()); + log("\tisOutboundDone(): " + engine.isOutboundDone()); + } + + /* + * If the result indicates that we have outstanding tasks to do, + * go ahead and run them in this thread. + */ + private static void runDelegatedTasks(SSLEngine engine) throws Exception { + + if (engine.getHandshakeStatus() == HandshakeStatus.NEED_TASK) { + Runnable runnable; + while ((runnable = engine.getDelegatedTask()) != null) { + log(" running delegated task..."); + runnable.run(); + } + HandshakeStatus hsStatus = engine.getHandshakeStatus(); + if (hsStatus == HandshakeStatus.NEED_TASK) { + throw new Exception( + "handshake shouldn't need additional tasks"); + } + logEngineStatus(engine); + } + } + + private static boolean isEngineClosed(SSLEngine engine) { + return (engine.isOutboundDone() && engine.isInboundDone()); + } + + /* + * Simple check to make sure everything came across as expected. + */ + private static void checkTransfer(ByteBuffer a, ByteBuffer b) + throws Exception { + a.flip(); + b.flip(); + + if (!a.equals(b)) { + throw new Exception("Data didn't transfer cleanly"); + } else { + log("\tData transferred cleanly"); + } + + a.position(a.limit()); + b.position(b.limit()); + a.limit(a.capacity()); + b.limit(b.capacity()); + } + + /* + * Logging code + */ + private static boolean resultOnce = true; + + private static void log(String str, SSLEngineResult result) { + if (!logging) { + return; + } + if (resultOnce) { + resultOnce = false; + System.err.println("The format of the SSLEngineResult is: \n" + + "\t\"getStatus() / getHandshakeStatus()\" +\n" + + "\t\"bytesConsumed() / bytesProduced()\"\n"); + } + HandshakeStatus hsStatus = result.getHandshakeStatus(); + log(str + + result.getStatus() + "/" + hsStatus + ", " + + result.bytesConsumed() + "/" + result.bytesProduced() + + " bytes"); + if (hsStatus == HandshakeStatus.FINISHED) { + log("\t...ready for application data"); + } + } + + private static void log(String str) { + if (logging) { + System.err.println(str); + } + } + + private static void dumpBuffer(String header, ByteBuffer data) { + data.mark(); + System.err.format("========== %s ==========\n", header); + int i = 0; + while (data.remaining() > 0) { + if (i != 0 && i % 16 == 0) { + System.err.print("\n"); + } + System.err.format("%02X ", data.get()); + i++; + } + System.err.println(); + data.reset(); + } + +} From 4c8b5f840c77608fc4d9de612d5ef35252afd702 Mon Sep 17 00:00:00 2001 From: Kirill Zhaldybin Date: Fri, 19 Oct 2018 16:29:43 -0700 Subject: [PATCH 65/66] 8171097: Convert TestReservedSpace_test to Gtest Reviewed-by: stuefe, jcbeyler, iignatyev --- .../share/utilities/internalVMTests.cpp | 1 - .../gtest/memory/test_virtualspace.cpp | 192 ++++++++++++++++++ 2 files changed, 192 insertions(+), 1 deletion(-) create mode 100644 test/hotspot/gtest/memory/test_virtualspace.cpp diff --git a/src/hotspot/share/utilities/internalVMTests.cpp b/src/hotspot/share/utilities/internalVMTests.cpp index ff33dc0606d..70df72e917e 100644 --- a/src/hotspot/share/utilities/internalVMTests.cpp +++ b/src/hotspot/share/utilities/internalVMTests.cpp @@ -42,7 +42,6 @@ void InternalVMTests::run_test(const char* name, void (*test)()) { void InternalVMTests::run() { tty->print_cr("Running internal VM tests"); - run_unit_test(TestReservedSpace_test); run_unit_test(TestReserveMemorySpecial_test); run_unit_test(TestVirtualSpace_test); run_unit_test(TestMetaspaceUtils_test); diff --git a/test/hotspot/gtest/memory/test_virtualspace.cpp b/test/hotspot/gtest/memory/test_virtualspace.cpp new file mode 100644 index 00000000000..697897b86b3 --- /dev/null +++ b/test/hotspot/gtest/memory/test_virtualspace.cpp @@ -0,0 +1,192 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +#include "precompiled.hpp" +#include "memory/virtualspace.hpp" +#include "runtime/os.hpp" +#include "oops/oop.hpp" +#include "utilities/align.hpp" +#include "unittest.hpp" + +namespace { + class MemoryReleaser { + ReservedSpace* const _rs; + public: + MemoryReleaser(ReservedSpace* rs) : _rs(rs) { } + ~MemoryReleaser() { + if (_rs->special()) { + EXPECT_TRUE(os::release_memory_special(_rs->base(), _rs->size())); + } else { + EXPECT_TRUE(os::release_memory(_rs->base(), _rs->size())); + } + } + }; + + static void small_page_write(void* addr, size_t size) { + size_t page_size = os::vm_page_size(); + + char* end = (char*) addr + size; + for (char* p = (char*) addr; p < end; p += page_size) { + *p = 1; + } + } + + // have to use these functions, as gtest's _PRED macros don't like is_aligned + // nor (is_aligned) + static bool is_size_aligned(size_t size, size_t alignment) { + return is_aligned(size, alignment); + } + static bool is_ptr_aligned(void* ptr, size_t alignment) { + return is_aligned(ptr, alignment); + } + + static void test_reserved_size(size_t size) { + ASSERT_PRED2(is_size_aligned, size, os::vm_allocation_granularity()); + + ReservedSpace rs(size); + MemoryReleaser releaser(&rs); + + EXPECT_TRUE(rs.base() != NULL) << "rs.special: " << rs.special(); + EXPECT_EQ(size, rs.size()) << "rs.special: " << rs.special(); + + if (rs.special()) { + small_page_write(rs.base(), size); + } + } + + static void test_reserved_size_alignment(size_t size, size_t alignment) { + ASSERT_PRED2(is_size_aligned, size, alignment) << "Incorrect input parameters"; + + ReservedSpace rs(size, alignment, UseLargePages, (char *) NULL); + + ASSERT_TRUE(rs.base() != NULL) << "rs.special = " << rs.special(); + ASSERT_EQ(size, rs.size()) << "rs.special = " << rs.special(); + + EXPECT_PRED2(is_ptr_aligned, rs.base(), alignment) + << "aligned sizes should always give aligned addresses"; + EXPECT_PRED2(is_ptr_aligned, (void*) rs.size(), alignment) + << "aligned sizes should always give aligned addresses"; + + if (rs.special()) { + small_page_write(rs.base(), size); + } + } + + static void test_reserved_size_alignment_page_type(size_t size, size_t alignment, bool maybe_large) { + if (size < alignment) { + // Tests might set -XX:LargePageSizeInBytes= and cause unexpected input arguments for this test. + ASSERT_EQ((size_t) os::vm_page_size(), os::large_page_size()) << "Test needs further refinement"; + return; + } + + ASSERT_PRED2(is_size_aligned, size, os::vm_allocation_granularity()) << "Must be at least AG aligned"; + ASSERT_PRED2(is_size_aligned, size, alignment) << "Must be at least AG aligned"; + + bool large = maybe_large && UseLargePages && size >= os::large_page_size(); + + ReservedSpace rs(size, alignment, large, false); + MemoryReleaser releaser(&rs); + + EXPECT_TRUE(rs.base() != NULL) << "rs.special: " << rs.special(); + EXPECT_EQ(size, rs.size()) << "rs.special: " << rs.special(); + + if (rs.special()) { + small_page_write(rs.base(), size); + } + } +} + +TEST_VM(ReservedSpace, size_alignment) { + size_t size = 2 * 1024 * 1024; + size_t ag = os::vm_allocation_granularity(); + + EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment(size, ag)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment(size * 2, ag)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment(size * 10, ag)); +} + +TEST_VM(ReservedSpace, size) { + size_t size = 2 * 1024 * 1024; + size_t ag = os::vm_allocation_granularity(); + + EXPECT_NO_FATAL_FAILURE(test_reserved_size(size * 1)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size(size * 2)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size(size * 10)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size(ag)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size(size - ag)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size(size)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size(size + ag)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size(size * 2)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size(size * 2 - ag)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size(size * 2 + ag)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size(size * 3)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size(size * 3 - ag)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size(size * 3 + ag)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size(size * 10)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size(size * 10 + size / 2)); +} + +TEST_VM(ReservedSpace, size_alignment_page_type) { + size_t ag = os::vm_allocation_granularity(); + + EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(ag, ag , false)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(ag * 2, ag , false)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(ag * 3, ag , false)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(ag * 2, ag * 2, false)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(ag * 4, ag * 2, false)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(ag * 8, ag * 2, false)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(ag * 4, ag * 4, false)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(ag * 8, ag * 4, false)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(ag * 16, ag * 4, false)); +} + +TEST_VM(ReservedSpace, size_alignment_page_type_large_page) { + if (!UseLargePages) { + return; + } + + size_t ag = os::vm_allocation_granularity(); + size_t lp = os::large_page_size(); + + // Without large pages + EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp, ag * 4, false)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 2, ag * 4, false)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 4, ag * 4, false)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp, lp , false)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 2, lp , false)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 3, lp , false)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 2, lp * 2, false)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 4, lp * 2, false)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 8, lp * 2, false)); + + // With large pages + EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp, ag * 4 , true)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 2, ag * 4, true)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 4, ag * 4, true)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp, lp , true)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 2, lp , true)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 3, lp , true)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 2, lp * 2, true)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 4, lp * 2, true)); + EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 8, lp * 2, true)); +} From f1e1e1fe6f788c875c128b1094c6d460fc6f8c33 Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Fri, 19 Oct 2018 16:29:45 -0700 Subject: [PATCH 66/66] 8177709: Convert TestVirtualSpace_test to GTest Reviewed-by: stuefe, jcbeyler --- .../share/utilities/internalVMTests.cpp | 1 - .../gtest/memory/test_virtualspace.cpp | 147 ++++++++++++++++++ 2 files changed, 147 insertions(+), 1 deletion(-) diff --git a/src/hotspot/share/utilities/internalVMTests.cpp b/src/hotspot/share/utilities/internalVMTests.cpp index 70df72e917e..3351bf2f62f 100644 --- a/src/hotspot/share/utilities/internalVMTests.cpp +++ b/src/hotspot/share/utilities/internalVMTests.cpp @@ -43,7 +43,6 @@ void InternalVMTests::run_test(const char* name, void (*test)()) { void InternalVMTests::run() { tty->print_cr("Running internal VM tests"); run_unit_test(TestReserveMemorySpecial_test); - run_unit_test(TestVirtualSpace_test); run_unit_test(TestMetaspaceUtils_test); run_unit_test(GCTimer_test); // These tests require the "C" locale to correctly parse decimal values diff --git a/test/hotspot/gtest/memory/test_virtualspace.cpp b/test/hotspot/gtest/memory/test_virtualspace.cpp index 697897b86b3..9dc2a62d21b 100644 --- a/test/hotspot/gtest/memory/test_virtualspace.cpp +++ b/test/hotspot/gtest/memory/test_virtualspace.cpp @@ -190,3 +190,150 @@ TEST_VM(ReservedSpace, size_alignment_page_type_large_page) { EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 4, lp * 2, true)); EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 8, lp * 2, true)); } + +namespace { + enum TestLargePages { + Default, + Disable, + Reserve, + Commit + }; + + class ReservedSpaceReleaser { + ReservedSpace* const _rs; + public: + ReservedSpaceReleaser(ReservedSpace* rs) : _rs(rs) { } + ~ReservedSpaceReleaser() { + _rs->release(); + } + }; + + ReservedSpace reserve_memory(size_t reserve_size_aligned, TestLargePages mode) { + switch(mode) { + default: + case Default: + case Reserve: + return ReservedSpace(reserve_size_aligned); + case Disable: + case Commit: + return ReservedSpace(reserve_size_aligned, + os::vm_allocation_granularity(), + /* large */ false, /* exec */ false); + } + } + + bool initialize_virtual_space(VirtualSpace& vs, ReservedSpace rs, TestLargePages mode) { + switch(mode) { + default: + case Default: + case Reserve: + return vs.initialize(rs, 0); + case Disable: + return vs.initialize_with_granularity(rs, 0, os::vm_page_size()); + case Commit: + return vs.initialize_with_granularity(rs, 0, os::page_size_for_region_unaligned(rs.size(), 1)); + } + } + + void test_virtual_space_actual_committed_space(size_t reserve_size, size_t commit_size, + TestLargePages mode = Default) { + size_t granularity = os::vm_allocation_granularity(); + size_t reserve_size_aligned = align_up(reserve_size, granularity); + + ReservedSpace reserved = reserve_memory(reserve_size_aligned, mode); + ReservedSpaceReleaser releaser(&reserved); + + ASSERT_TRUE(reserved.is_reserved()); + + VirtualSpace vs; + ASSERT_TRUE(initialize_virtual_space(vs, reserved, mode)) << "Failed to initialize VirtualSpace"; + vs.expand_by(commit_size, false); + + if (vs.special()) { + EXPECT_EQ(reserve_size_aligned, vs.actual_committed_size()); + } else { + EXPECT_GE(vs.actual_committed_size(), commit_size); + // Approximate the commit granularity. + // Make sure that we don't commit using large pages + // if large pages has been disabled for this VirtualSpace. + size_t commit_granularity = (mode == Disable || !UseLargePages) ? + os::vm_page_size() : os::large_page_size(); + EXPECT_LT(vs.actual_committed_size(), commit_size + commit_granularity); + } + } +} + +TEST_VM(VirtualSpace, actual_committed_space) { + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(4 * K, 0)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(4 * K, 4 * K)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(8 * K, 0)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(8 * K, 4 * K)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(8 * K, 8 * K)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(12 * K, 0)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(12 * K, 4 * K)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(12 * K, 8 * K)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(12 * K, 12 * K)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(64 * K, 0)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(64 * K, 32 * K)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(64 * K, 64 * K)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(2 * M, 0)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(2 * M, 4 * K)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(2 * M, 64 * K)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(2 * M, 1 * M)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(2 * M, 2 * M)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 0)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 4 * K)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 8 * K)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 1 * M)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 2 * M)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 5 * M)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 10 * M)); +} + +TEST_VM(VirtualSpace, actual_committed_space_one_large_page) { + if (!UseLargePages) { + return; + } + + size_t large_page_size = os::large_page_size(); + + ReservedSpace reserved(large_page_size, large_page_size, true, false); + ReservedSpaceReleaser releaser(&reserved); + ASSERT_TRUE(reserved.is_reserved()); + + VirtualSpace vs; + ASSERT_TRUE(vs.initialize(reserved, 0)) << "Failed to initialize VirtualSpace"; + vs.expand_by(large_page_size, false); + + EXPECT_EQ(large_page_size, vs.actual_committed_size()); +} + +TEST_VM(VirtualSpace, disable_large_pages) { + if (!UseLargePages) { + return; + } + // These test cases verify that if we force VirtualSpace to disable large pages + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 0, Disable)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 4 * K, Disable)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 8 * K, Disable)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 1 * M, Disable)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 2 * M, Disable)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 5 * M, Disable)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 10 * M, Disable)); + + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 0, Reserve)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 4 * K, Reserve)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 8 * K, Reserve)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 1 * M, Reserve)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 2 * M, Reserve)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 5 * M, Reserve)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 10 * M, Reserve)); + + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 0, Commit)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 4 * K, Commit)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 8 * K, Commit)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 1 * M, Commit)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 2 * M, Commit)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 5 * M, Commit)); + EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 10 * M, Commit)); +}