# HG changeset patch # User andrew # Date 1581931772 0 # Node ID 2e972804450764c9ec3b7e548b07be869948ecca # Parent fc8a3d56cd0c40f6511eb4991b167994351422d4# Parent d975dfffada67a4641bc24e3fc1daea4b7055c60 Merge diff -r fc8a3d56cd0c -r 2e9728044507 .hgtags --- a/.hgtags Mon Feb 17 08:53:34 2020 +0000 +++ b/.hgtags Mon Feb 17 09:29:32 2020 +0000 @@ -1289,6 +1289,11 @@ 775e2bf92114e41365cc6baf1480c818454256a4 jdk8u242-b02 ee19c358e3b8deeda2f64d660a0870df7b1abd49 jdk8u242-b03 20258ba5a788da55485c0648bcc073f8ad2c26ef jdk8u242-b04 +2c1e9fab6964647f4eeffe55fe5592da6399a3ce jdk8u242-b05 +81ddc1072b923330f84c0ace3124226f63877582 jdk8u242-b06 +8b80409d5840142a27e274d33948f483a6406a50 jdk8u242-b07 +7c9f6b5f8d119dc1ba3c5536595ce3ae7414599d jdk8u242-b08 +7c9f6b5f8d119dc1ba3c5536595ce3ae7414599d jdk8u242-ga 8c0733543544bbcd32c4404630d764d280299056 jdk8u252-b00 a67e9c6edcdd73cb860a16990f0905e102c282d7 jdk8u252-b01 5bd3b8c0555292a967ea3b4c39a220d0c2cf40ad jdk8u252-b02 diff -r fc8a3d56cd0c -r 2e9728044507 THIRD_PARTY_README --- a/THIRD_PARTY_README Mon Feb 17 08:53:34 2020 +0000 +++ b/THIRD_PARTY_README Mon Feb 17 09:29:32 2020 +0000 @@ -1334,11 +1334,13 @@ -------------------------------------------------------------------------------- -%% This notice is provided with respect to Joni v1.1.9, which may be +%% This notice is provided with respect to Joni v2.1.16, which may be included with JRE 8, JDK 8, and OpenJDK 8. --- begin of LICENSE --- +Copyright (c) 2017 JRuby Team + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights diff -r fc8a3d56cd0c -r 2e9728044507 src/cpu/sparc/vm/vm_version_sparc.cpp --- a/src/cpu/sparc/vm/vm_version_sparc.cpp Mon Feb 17 08:53:34 2020 +0000 +++ b/src/cpu/sparc/vm/vm_version_sparc.cpp Mon Feb 17 09:29:32 2020 +0000 @@ -286,35 +286,35 @@ // SPARC T4 and above should have support for AES instructions if (has_aes()) { - if (UseVIS > 2) { // AES intrinsics use MOVxTOd/MOVdTOx which are VIS3 - if (FLAG_IS_DEFAULT(UseAES)) { - FLAG_SET_DEFAULT(UseAES, true); + if (FLAG_IS_DEFAULT(UseAES)) { + FLAG_SET_DEFAULT(UseAES, true); + } + if (!UseAES) { + if (UseAESIntrinsics && !FLAG_IS_DEFAULT(UseAESIntrinsics)) { + warning("AES intrinsics require UseAES flag to be enabled. Intrinsics will be disabled."); } - if (FLAG_IS_DEFAULT(UseAESIntrinsics)) { - FLAG_SET_DEFAULT(UseAESIntrinsics, true); - } - // we disable both the AES flags if either of them is disabled on the command line - if (!UseAES || !UseAESIntrinsics) { - FLAG_SET_DEFAULT(UseAES, false); + FLAG_SET_DEFAULT(UseAESIntrinsics, false); + } else { + // The AES intrinsic stubs require AES instruction support (of course) + // but also require VIS3 mode or higher for instructions it use. + if (UseVIS > 2) { + if (FLAG_IS_DEFAULT(UseAESIntrinsics)) { + FLAG_SET_DEFAULT(UseAESIntrinsics, true); + } + } else { + if (UseAESIntrinsics && !FLAG_IS_DEFAULT(UseAESIntrinsics)) { + warning("SPARC AES intrinsics require VIS3 instructions. Intrinsics will be disabled."); + } FLAG_SET_DEFAULT(UseAESIntrinsics, false); } - } else { - if (UseAES || UseAESIntrinsics) { - warning("SPARC AES intrinsics require VIS3 instruction support. Intrinsics will be disabled."); - if (UseAES) { - FLAG_SET_DEFAULT(UseAES, false); - } - if (UseAESIntrinsics) { - FLAG_SET_DEFAULT(UseAESIntrinsics, false); - } - } } } else if (UseAES || UseAESIntrinsics) { - warning("AES instructions are not available on this CPU"); - if (UseAES) { + if (UseAES && !FLAG_IS_DEFAULT(UseAES)) { + warning("AES instructions are not available on this CPU"); FLAG_SET_DEFAULT(UseAES, false); } - if (UseAESIntrinsics) { + if (UseAESIntrinsics && !FLAG_IS_DEFAULT(UseAESIntrinsics)) { + warning("AES intrinsics are not available on this CPU"); FLAG_SET_DEFAULT(UseAESIntrinsics, false); } } diff -r fc8a3d56cd0c -r 2e9728044507 src/cpu/x86/vm/vm_version_x86.cpp --- a/src/cpu/x86/vm/vm_version_x86.cpp Mon Feb 17 08:53:34 2020 +0000 +++ b/src/cpu/x86/vm/vm_version_x86.cpp Mon Feb 17 09:29:32 2020 +0000 @@ -553,12 +553,36 @@ // Use AES instructions if available. if (supports_aes()) { if (FLAG_IS_DEFAULT(UseAES)) { - UseAES = true; + FLAG_SET_DEFAULT(UseAES, true); } - } else if (UseAES) { - if (!FLAG_IS_DEFAULT(UseAES)) + if (!UseAES) { + if (UseAESIntrinsics && !FLAG_IS_DEFAULT(UseAESIntrinsics)) { + warning("AES intrinsics require UseAES flag to be enabled. Intrinsics will be disabled."); + } + FLAG_SET_DEFAULT(UseAESIntrinsics, false); + } else { + if (UseSSE > 2) { + if (FLAG_IS_DEFAULT(UseAESIntrinsics)) { + FLAG_SET_DEFAULT(UseAESIntrinsics, true); + } + } else { + // The AES intrinsic stubs require AES instruction support (of course) + // but also require sse3 mode or higher for instructions it use. + if (UseAESIntrinsics && !FLAG_IS_DEFAULT(UseAESIntrinsics)) { + warning("X86 AES intrinsics require SSE3 instructions or higher. Intrinsics will be disabled."); + } + FLAG_SET_DEFAULT(UseAESIntrinsics, false); + } + } + } else if (UseAES || UseAESIntrinsics) { + if (UseAES && !FLAG_IS_DEFAULT(UseAES)) { warning("AES instructions are not available on this CPU"); - FLAG_SET_DEFAULT(UseAES, false); + FLAG_SET_DEFAULT(UseAES, false); + } + if (UseAESIntrinsics && !FLAG_IS_DEFAULT(UseAESIntrinsics)) { + warning("AES intrinsics are not available on this CPU"); + FLAG_SET_DEFAULT(UseAESIntrinsics, false); + } } // Use CLMUL instructions if available. @@ -582,18 +606,6 @@ FLAG_SET_DEFAULT(UseCRC32Intrinsics, false); } - // The AES intrinsic stubs require AES instruction support (of course) - // but also require sse3 mode for instructions it use. - if (UseAES && (UseSSE > 2)) { - if (FLAG_IS_DEFAULT(UseAESIntrinsics)) { - UseAESIntrinsics = true; - } - } else if (UseAESIntrinsics) { - if (!FLAG_IS_DEFAULT(UseAESIntrinsics)) - warning("AES intrinsics are not available on this CPU"); - FLAG_SET_DEFAULT(UseAESIntrinsics, false); - } - // GHASH/GCM intrinsics if (UseCLMUL && (UseSSE > 2)) { if (FLAG_IS_DEFAULT(UseGHASHIntrinsics)) { diff -r fc8a3d56cd0c -r 2e9728044507 src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp --- a/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp Mon Feb 17 08:53:34 2020 +0000 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp Mon Feb 17 09:29:32 2020 +0000 @@ -161,6 +161,8 @@ } _dictionary->set_par_lock(&_parDictionaryAllocLock); } + + _used_stable = 0; } // Like CompactibleSpace forward() but always calls cross_threshold() to @@ -377,6 +379,14 @@ return capacity() - free(); } +size_t CompactibleFreeListSpace::used_stable() const { + return _used_stable; +} + +void CompactibleFreeListSpace::recalculate_used_stable() { + _used_stable = used(); +} + size_t CompactibleFreeListSpace::free() const { // "MT-safe, but not MT-precise"(TM), if you will: i.e. // if you do this while the structures are in flux you @@ -1218,6 +1228,13 @@ debug_only(fc->mangleAllocated(size)); } + // During GC we do not need to recalculate the stable used value for + // every allocation in old gen. It is done once at the end of GC instead + // for performance reasons. + if (!Universe::heap()->is_gc_active()) { + recalculate_used_stable(); + } + return res; } diff -r fc8a3d56cd0c -r 2e9728044507 src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp --- a/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp Mon Feb 17 08:53:34 2020 +0000 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp Mon Feb 17 09:29:32 2020 +0000 @@ -148,6 +148,9 @@ // Used to keep track of limit of sweep for the space HeapWord* _sweep_limit; + // Stable value of used(). + size_t _used_stable; + // Support for compacting cms HeapWord* cross_threshold(HeapWord* start, HeapWord* end); HeapWord* forward(oop q, size_t size, CompactPoint* cp, HeapWord* compact_top); @@ -343,6 +346,17 @@ // which overestimates the region by returning the entire // committed region (this is safe, but inefficient). + // Returns monotonically increasing stable used space bytes for CMS. + // This is required for jstat and other memory monitoring tools + // that might otherwise see inconsistent used space values during a garbage + // collection, promotion or allocation into compactibleFreeListSpace. + // The value returned by this function might be smaller than the + // actual value. + size_t used_stable() const; + // Recalculate and cache the current stable used() value. Only to be called + // in places where we can be sure that the result is stable. + void recalculate_used_stable(); + // Returns a subregion of the space containing all the objects in // the space. MemRegion used_region() const { diff -r fc8a3d56cd0c -r 2e9728044507 src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp --- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Mon Feb 17 08:53:34 2020 +0000 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Mon Feb 17 09:29:32 2020 +0000 @@ -869,6 +869,10 @@ return _cmsSpace->max_alloc_in_words() * HeapWordSize; } +size_t ConcurrentMarkSweepGeneration::used_stable() const { + return cmsSpace()->used_stable(); +} + size_t ConcurrentMarkSweepGeneration::max_available() const { return free() + _virtual_space.uncommitted_size(); } @@ -1955,6 +1959,8 @@ FreelistLocker z(this); MetaspaceGC::compute_new_size(); _cmsGen->compute_new_size_free_list(); + // recalculate CMS used space after CMS collection + _cmsGen->cmsSpace()->recalculate_used_stable(); } // A work method used by foreground collection to determine @@ -2768,6 +2774,7 @@ _capacity_at_prologue = capacity(); _used_at_prologue = used(); + _cmsSpace->recalculate_used_stable(); // Delegate to CMScollector which knows how to coordinate between // this and any other CMS generations that it is responsible for @@ -2837,6 +2844,7 @@ _eden_chunk_index = 0; size_t cms_used = _cmsGen->cmsSpace()->used(); + _cmsGen->cmsSpace()->recalculate_used_stable(); // update performance counters - this uses a special version of // update_counters() that allows the utilization to be passed as a @@ -3672,6 +3680,7 @@ _collectorState = Marking; } SpecializationStats::print(); + _cmsGen->cmsSpace()->recalculate_used_stable(); } void CMSCollector::checkpointRootsInitialWork(bool asynch) { @@ -5066,10 +5075,12 @@ Mutex::_no_safepoint_check_flag); assert(!init_mark_was_synchronous, "but that's impossible!"); checkpointRootsFinalWork(asynch, clear_all_soft_refs, false); + _cmsGen->cmsSpace()->recalculate_used_stable(); } else { // already have all the locks checkpointRootsFinalWork(asynch, clear_all_soft_refs, init_mark_was_synchronous); + _cmsGen->cmsSpace()->recalculate_used_stable(); } verify_work_stacks_empty(); verify_overflow_empty(); @@ -6368,6 +6379,10 @@ // Update heap occupancy information which is used as // input to soft ref clearing policy at the next gc. Universe::update_heap_info_at_gc(); + + // recalculate CMS used space after CMS collection + _cmsGen->cmsSpace()->recalculate_used_stable(); + _collectorState = Resizing; } } else { @@ -6467,6 +6482,7 @@ // Gather statistics on the young generation collection. collector()->stats().record_gc0_end(used()); } + _cmsSpace->recalculate_used_stable(); } CMSAdaptiveSizePolicy* ConcurrentMarkSweepGeneration::size_policy() { diff -r fc8a3d56cd0c -r 2e9728044507 src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp --- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp Mon Feb 17 08:53:34 2020 +0000 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp Mon Feb 17 09:29:32 2020 +0000 @@ -1190,6 +1190,7 @@ double occupancy() const { return ((double)used())/((double)capacity()); } size_t contiguous_available() const; size_t unsafe_max_alloc_nogc() const; + size_t used_stable() const; // over-rides MemRegion used_region() const; diff -r fc8a3d56cd0c -r 2e9728044507 src/share/vm/gc_implementation/shared/gSpaceCounters.hpp --- a/src/share/vm/gc_implementation/shared/gSpaceCounters.hpp Mon Feb 17 08:53:34 2020 +0000 +++ b/src/share/vm/gc_implementation/shared/gSpaceCounters.hpp Mon Feb 17 09:29:32 2020 +0000 @@ -63,7 +63,7 @@ } inline void update_used() { - _used->set_value(_gen->used()); + _used->set_value(_gen->used_stable()); } // special version of update_used() to allow the used value to be @@ -107,7 +107,7 @@ GenerationUsedHelper(Generation* g) : _gen(g) { } inline jlong take_sample() { - return _gen->used(); + return _gen->used_stable(); } }; diff -r fc8a3d56cd0c -r 2e9728044507 src/share/vm/memory/generation.cpp --- a/src/share/vm/memory/generation.cpp Mon Feb 17 08:53:34 2020 +0000 +++ b/src/share/vm/memory/generation.cpp Mon Feb 17 09:29:32 2020 +0000 @@ -68,6 +68,12 @@ return gch->_gen_specs[level()]; } +// This is for CMS. It returns stable monotonic used space size. +// Remove this when CMS is removed. +size_t Generation::used_stable() const { + return used(); +} + size_t Generation::max_capacity() const { return reserved().byte_size(); } diff -r fc8a3d56cd0c -r 2e9728044507 src/share/vm/memory/generation.hpp --- a/src/share/vm/memory/generation.hpp Mon Feb 17 08:53:34 2020 +0000 +++ b/src/share/vm/memory/generation.hpp Mon Feb 17 09:29:32 2020 +0000 @@ -168,6 +168,7 @@ virtual size_t capacity() const = 0; // The maximum number of object bytes the // generation can currently hold. virtual size_t used() const = 0; // The number of used bytes in the gen. + virtual size_t used_stable() const; // The number of used bytes for memory monitoring tools. virtual size_t free() const = 0; // The number of free bytes in the gen. // Support for java.lang.Runtime.maxMemory(); see CollectedHeap. diff -r fc8a3d56cd0c -r 2e9728044507 src/share/vm/oops/instanceKlass.cpp --- a/src/share/vm/oops/instanceKlass.cpp Mon Feb 17 08:53:34 2020 +0000 +++ b/src/share/vm/oops/instanceKlass.cpp Mon Feb 17 09:29:32 2020 +0000 @@ -294,6 +294,7 @@ set_has_unloaded_dependent(false); set_init_state(InstanceKlass::allocated); set_init_thread(NULL); + set_init_state(allocated); set_reference_type(rt); set_oop_map_cache(NULL); set_jni_ids(NULL); @@ -978,11 +979,13 @@ oop init_lock = this_oop->init_lock(); if (init_lock != NULL) { ObjectLocker ol(init_lock, THREAD); + this_oop->set_init_thread(NULL); // reset _init_thread before changing _init_state this_oop->set_init_state(state); this_oop->fence_and_clear_init_lock(); ol.notify_all(CHECK); } else { assert(init_lock != NULL, "The initialization state should never be set twice"); + this_oop->set_init_thread(NULL); // reset _init_thread before changing _init_state this_oop->set_init_state(state); } } @@ -3602,6 +3605,7 @@ bool good_state = is_shared() ? (_init_state <= state) : (_init_state < state); assert(good_state || state == allocated, "illegal state transition"); + assert(_init_thread == NULL, "should be cleared before state change"); _init_state = (u1)state; } #endif diff -r fc8a3d56cd0c -r 2e9728044507 src/share/vm/oops/instanceKlass.hpp --- a/src/share/vm/oops/instanceKlass.hpp Mon Feb 17 08:53:34 2020 +0000 +++ b/src/share/vm/oops/instanceKlass.hpp Mon Feb 17 09:29:32 2020 +0000 @@ -241,7 +241,7 @@ u2 _misc_flags; u2 _minor_version; // minor version number of class file u2 _major_version; // major version number of class file - Thread* _init_thread; // Pointer to current thread doing initialization (to handle recusive initialization) + Thread* _init_thread; // Pointer to current thread doing initialization (to handle recursive initialization) int _vtable_len; // length of Java vtable (in words) int _itable_len; // length of Java itable (in words) OopMapCache* volatile _oop_map_cache; // OopMapCache for all methods in the klass (allocated lazily) diff -r fc8a3d56cd0c -r 2e9728044507 src/share/vm/oops/klassVtable.cpp --- a/src/share/vm/oops/klassVtable.cpp Mon Feb 17 08:53:34 2020 +0000 +++ b/src/share/vm/oops/klassVtable.cpp Mon Feb 17 09:29:32 2020 +0000 @@ -289,22 +289,25 @@ int vtable_index, Handle target_loader, Symbol* target_classname, Thread * THREAD) { InstanceKlass* superk = initialsuper; while (superk != NULL && superk->super() != NULL) { - InstanceKlass* supersuperklass = InstanceKlass::cast(superk->super()); - klassVtable* ssVtable = supersuperklass->vtable(); + klassVtable* ssVtable = (superk->super())->vtable(); if (vtable_index < ssVtable->length()) { Method* super_method = ssVtable->method_at(vtable_index); + // get the class holding the matching method + // make sure you use that class for is_override + InstanceKlass* supermethodholder = super_method->method_holder(); #ifndef PRODUCT Symbol* name= target_method()->name(); Symbol* signature = target_method()->signature(); assert(super_method->name() == name && super_method->signature() == signature, "vtable entry name/sig mismatch"); #endif - if (supersuperklass->is_override(super_method, target_loader, target_classname, THREAD)) { + + if (supermethodholder->is_override(super_method, target_loader, target_classname, THREAD)) { #ifndef PRODUCT if (PrintVtables && Verbose) { ResourceMark rm(THREAD); char* sig = target_method()->name_and_sig_as_C_string(); tty->print("transitive overriding superclass %s with %s::%s index %d, original flags: ", - supersuperklass->internal_name(), + supermethodholder->internal_name(), _klass->internal_name(), sig, vtable_index); super_method->access_flags().print_on(tty); if (super_method->is_default_method()) { @@ -656,7 +659,7 @@ // search through the super class hierarchy to see if we need // a new entry - ResourceMark rm; + ResourceMark rm(THREAD); Symbol* name = target_method()->name(); Symbol* signature = target_method()->signature(); Klass* k = super; diff -r fc8a3d56cd0c -r 2e9728044507 src/share/vm/services/memoryPool.hpp --- a/src/share/vm/services/memoryPool.hpp Mon Feb 17 08:53:34 2020 +0000 +++ b/src/share/vm/services/memoryPool.hpp Mon Feb 17 09:29:32 2020 +0000 @@ -198,7 +198,7 @@ bool support_usage_threshold); MemoryUsage get_memory_usage(); - size_t used_in_bytes() { return _space->used(); } + size_t used_in_bytes() { return _space->used_stable(); } }; #endif // INCLUDE_ALL_GCS diff -r fc8a3d56cd0c -r 2e9728044507 test/compiler/classUnloading/anonymousClass/TestAnonymousClassUnloading.java --- a/test/compiler/classUnloading/anonymousClass/TestAnonymousClassUnloading.java Mon Feb 17 08:53:34 2020 +0000 +++ b/test/compiler/classUnloading/anonymousClass/TestAnonymousClassUnloading.java Mon Feb 17 09:29:32 2020 +0000 @@ -22,9 +22,10 @@ */ import sun.hotspot.WhiteBox; +import sun.misc.IOUtils; import sun.misc.Unsafe; -import sun.misc.IOUtils; +import java.io.IOException; import java.lang.reflect.Method; import java.net.URL; import java.net.URLConnection; @@ -108,7 +109,13 @@ // (1) Load an anonymous version of this class using the corresponding Unsafe method URL classUrl = TestAnonymousClassUnloading.class.getResource("TestAnonymousClassUnloading.class"); URLConnection connection = classUrl.openConnection(); - byte[] classBytes = IOUtils.readFully(connection.getInputStream(), connection.getContentLength(), true); + + int length = connection.getContentLength(); + byte[] classBytes = IOUtils.readAllBytes(connection.getInputStream()); + if (length != -1 && classBytes.length != length) { + throw new IOException("Expected:" + length + ", actual: " + classBytes.length); + } + Class anonymousClass = UNSAFE.defineAnonymousClass(TestAnonymousClassUnloading.class, classBytes, null); // (2) Make sure all paths of doWork are profiled and compiled diff -r fc8a3d56cd0c -r 2e9728044507 test/runtime/8003720/VictimClassLoader.java --- a/test/runtime/8003720/VictimClassLoader.java Mon Feb 17 08:53:34 2020 +0000 +++ b/test/runtime/8003720/VictimClassLoader.java Mon Feb 17 09:29:32 2020 +0000 @@ -22,6 +22,8 @@ * */ +import sun.misc.IOUtils; + public class VictimClassLoader extends ClassLoader { public static long counter = 0; @@ -72,8 +74,10 @@ } static byte[] readFully(java.io.InputStream in, int len) throws java.io.IOException { - // Warning here: - return sun.misc.IOUtils.readFully(in, len, true); + byte[] b = IOUtils.readAllBytes(in); + if (len != -1 && b.length != len) + throw new java.io.IOException("Expected:" + len + ", actual:" + b.length); + return b; } public void finalize() { diff -r fc8a3d56cd0c -r 2e9728044507 test/runtime/RedefineTests/test8178870.sh --- a/test/runtime/RedefineTests/test8178870.sh Mon Feb 17 08:53:34 2020 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -#!/bin/sh - -# -# Copyright (c) 2019, Red Hat, Inc. All rights reserved. -# -# This code is free software; you can redistribute 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 test.sh -## @bug 8178870 -## @summary test instrumentation.retransformClasses -## @run shell test.sh - -if [ "${TESTSRC}" = "" ] -then - TESTSRC=${PWD} - echo "TESTSRC not set. Using "${TESTSRC}" as default" -fi -echo "TESTSRC=${TESTSRC}" -## Adding common setup Variables for running shell tests. -. ${TESTSRC}/../../test_env.sh - -LIB_SRC=${TESTSRC}/../../testlibrary/ - -# set platform-dependent variables -OS=`uname -s` -echo "Testing on " $OS -case "$OS" in - Linux) - cc_cmd=`which gcc` - if [ "x$cc_cmd" == "x" ]; then - echo "WARNING: gcc not found. Cannot execute test." 2>&1 - exit 0; - fi - ;; - Solaris) - cc_cmd=`which cc` - if [ "x$cc_cmd" == "x" ]; then - echo "WARNING: cc not found. Cannot execute test." 2>&1 - exit 0; - fi - ;; - *) - echo "Test passed. Only on Linux and Solaris" - exit 0; - ;; -esac - -THIS_DIR=. - -cp ${TESTSRC}/RedefineDoubleDelete.java ${THIS_DIR} -mkdir -p ${THIS_DIR}/classes -${TESTJAVA}/bin/javac -sourcepath ${LIB_SRC} -d ${THIS_DIR}/classes ${LIB_SRC}RedefineClassHelper.java -${TESTJAVA}/bin/javac -cp .:${THIS_DIR}/classes:${TESTJAVA}/lib/tools.jar -d ${THIS_DIR} RedefineDoubleDelete.java - -$cc_cmd -fPIC -shared -o ${THIS_DIR}${FS}libRedefineDoubleDelete.so \ - -I${TESTJAVA}/include -I${TESTJAVA}/include/linux \ - ${TESTSRC}/libRedefineDoubleDelete.c - -LD_LIBRARY_PATH=${THIS_DIR} -echo LD_LIBRARY_PATH = ${LD_LIBRARY_PATH} -export LD_LIBRARY_PATH - -# Install redefineagent.jar -${TESTJAVA}/bin${FS}java -cp ${THIS_DIR}/classes RedefineClassHelper - -echo -echo ${TESTJAVA}/bin/java -agentlib:RedefineDoubleDelete RedefineDoubleDelete -${TESTJAVA}/bin/java -cp .:${THIS_DIR}${FS}classes -javaagent:redefineagent.jar -agentlib:RedefineDoubleDelete RedefineDoubleDelete -