Mercurial > hg > release > icedtea7-forest-2.6 > hotspot
changeset 6707:071172c39b0e
Merge jdk7u211-b01
author | andrew |
---|---|
date | Fri, 22 Feb 2019 06:16:04 +0000 |
parents | f3820315a79d (current diff) e1b1da173e19 (diff) |
children | d47e668978c8 |
files | .hgtags make/bsd/makefiles/gcc.make make/linux/makefiles/gcc.make make/solaris/makefiles/gcc.make src/share/vm/classfile/classLoaderDependencies.cpp src/share/vm/classfile/classLoaderDependencies.hpp src/share/vm/classfile/systemDictionary.cpp src/share/vm/classfile/verifier.cpp src/share/vm/oops/cpCacheOop.cpp src/share/vm/opto/compile.cpp src/share/vm/prims/jvm.cpp src/share/vm/prims/jvm.h src/share/vm/runtime/interfaceSupport.hpp src/share/vm/runtime/sharedRuntime.cpp src/share/vm/utilities/copy.cpp src/share/vm/utilities/copy.hpp |
diffstat | 25 files changed, 161 insertions(+), 82 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgtags Thu Feb 21 04:50:25 2019 +0000 +++ b/.hgtags Fri Feb 22 06:16:04 2019 +0000 @@ -934,3 +934,5 @@ a04d398041938b47a3eed225c71f298a3e9410f9 jdk7u201-b00 ae6068b02261bc413ccc934b2260f1d6277e18ee icedtea-2.6.16 65b809089544d0723a33745d91265999afa08aeb icedtea-2.6.17pre01 +58964d7eef111a6c1b361e32daeae41cbe9e7f7c jdk7u211-b00 +87b0534bbec2c217e7c4574e962b93b3c5a61193 jdk7u211-b01
--- a/make/aix/makefiles/mapfile-vers-debug Thu Feb 21 04:50:25 2019 +0000 +++ b/make/aix/makefiles/mapfile-vers-debug Fri Feb 22 06:16:04 2019 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 2002, 2011, 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 @@ -63,6 +63,7 @@ JVM_ConstantPoolGetSize; JVM_ConstantPoolGetStringAt; JVM_ConstantPoolGetUTF8At; + JVM_CopySwapMemory; JVM_CountStackFrames; JVM_CurrentClassLoader; JVM_CurrentLoadedClass;
--- a/make/aix/makefiles/mapfile-vers-product Thu Feb 21 04:50:25 2019 +0000 +++ b/make/aix/makefiles/mapfile-vers-product Fri Feb 22 06:16:04 2019 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 2002, 2011, 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 @@ -63,6 +63,7 @@ JVM_ConstantPoolGetSize; JVM_ConstantPoolGetStringAt; JVM_ConstantPoolGetUTF8At; + JVM_CopySwapMemory; JVM_CountStackFrames; JVM_CurrentClassLoader; JVM_CurrentLoadedClass;
--- a/make/bsd/makefiles/gcc.make Thu Feb 21 04:50:25 2019 +0000 +++ b/make/bsd/makefiles/gcc.make Fri Feb 22 06:16:04 2019 +0000 @@ -118,6 +118,7 @@ CFLAGS += -fno-exceptions CFLAGS += -pthread CFLAGS += -fcheck-new +CFLAGS += -fstack-protector # version 4 and above support fvisibility=hidden (matches jni_x86.h file) # except 4.1.2 gives pointless warnings that can't be disabled (afaik) ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
--- a/make/bsd/makefiles/mapfile-vers-debug Thu Feb 21 04:50:25 2019 +0000 +++ b/make/bsd/makefiles/mapfile-vers-debug Fri Feb 22 06:16:04 2019 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 2002, 2014, 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 @@ -61,6 +61,7 @@ _JVM_ConstantPoolGetSize _JVM_ConstantPoolGetStringAt _JVM_ConstantPoolGetUTF8At + _JVM_CopySwapMemory _JVM_CountStackFrames _JVM_CurrentClassLoader _JVM_CurrentLoadedClass
--- a/make/bsd/makefiles/mapfile-vers-product Thu Feb 21 04:50:25 2019 +0000 +++ b/make/bsd/makefiles/mapfile-vers-product Fri Feb 22 06:16:04 2019 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 2002, 2014, 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 @@ -61,6 +61,7 @@ _JVM_ConstantPoolGetSize _JVM_ConstantPoolGetStringAt _JVM_ConstantPoolGetUTF8At + _JVM_CopySwapMemory _JVM_CountStackFrames _JVM_CurrentClassLoader _JVM_CurrentLoadedClass
--- a/make/linux/makefiles/gcc.make Thu Feb 21 04:50:25 2019 +0000 +++ b/make/linux/makefiles/gcc.make Fri Feb 22 06:16:04 2019 +0000 @@ -89,6 +89,7 @@ CFLAGS += -fno-exceptions CFLAGS += -D_REENTRANT CFLAGS += -fcheck-new +CFLAGS += -fstack-protector # version 4 and above support fvisibility=hidden (matches jni_x86.h file) # except 4.1.2 gives pointless warnings that can't be disabled (afaik) ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
--- a/make/linux/makefiles/mapfile-vers-debug Thu Feb 21 04:50:25 2019 +0000 +++ b/make/linux/makefiles/mapfile-vers-debug Fri Feb 22 06:16:04 2019 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 2002, 2014, 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 @@ -63,6 +63,7 @@ JVM_ConstantPoolGetSize; JVM_ConstantPoolGetStringAt; JVM_ConstantPoolGetUTF8At; + JVM_CopySwapMemory; JVM_CountStackFrames; JVM_CurrentClassLoader; JVM_CurrentLoadedClass;
--- a/make/linux/makefiles/mapfile-vers-product Thu Feb 21 04:50:25 2019 +0000 +++ b/make/linux/makefiles/mapfile-vers-product Fri Feb 22 06:16:04 2019 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 2002, 2014, 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 @@ -63,6 +63,7 @@ JVM_ConstantPoolGetSize; JVM_ConstantPoolGetStringAt; JVM_ConstantPoolGetUTF8At; + JVM_CopySwapMemory; JVM_CountStackFrames; JVM_CurrentClassLoader; JVM_CurrentLoadedClass;
--- a/make/solaris/makefiles/gcc.make Thu Feb 21 04:50:25 2019 +0000 +++ b/make/solaris/makefiles/gcc.make Fri Feb 22 06:16:04 2019 +0000 @@ -75,6 +75,7 @@ CFLAGS += -fno-exceptions CFLAGS += -D_REENTRANT CFLAGS += -fcheck-new +CFLAGS += -fstack-protector ARCHFLAG = $(ARCHFLAG/$(BUILDARCH))
--- a/make/solaris/makefiles/mapfile-vers Thu Feb 21 04:50:25 2019 +0000 +++ b/make/solaris/makefiles/mapfile-vers Fri Feb 22 06:16:04 2019 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 2000, 2014, 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 @@ -64,6 +64,7 @@ JVM_ConstantPoolGetStringAt; JVM_ConstantPoolGetUTF8At; JVM_CountStackFrames; + JVM_CopySwapMemory; JVM_CurrentClassLoader; JVM_CurrentLoadedClass; JVM_CurrentThread;
--- a/src/share/vm/classfile/classLoaderDependencies.cpp Thu Feb 21 04:50:25 2019 +0000 +++ b/src/share/vm/classfile/classLoaderDependencies.cpp Fri Feb 22 06:16:04 2019 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Red Hat, Inc. and/or its affiliates. + * Copyright (c) 2018, 2019, Red Hat, Inc. and/or its affiliates. * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -28,35 +28,30 @@ #include "memory/oopFactory.hpp" #include "utilities/debug.hpp" -void ClassLoaderDependencies::record_dependency(KlassHandle from_klass, - KlassHandle to_klass, +void ClassLoaderDependencies::record_dependency(oop from_class_loader, + oop to_class_loader, TRAPS) { - - oop to_class_loader_oop = to_klass->class_loader(); - // Dependency to the Null Class Loader doesn't // need to be recorded because it never goes away. - if (to_class_loader_oop == NULL) { + if (to_class_loader == NULL) { return; } - oop from_class_loader_oop = from_klass->class_loader(); - // The Null Class Loader does not generate dependencies to record. - if (from_class_loader_oop == NULL) { + if (from_class_loader == NULL) { return; } - oop current_class_loader_oop = from_class_loader_oop; + oop current_class_loader_oop = from_class_loader; do { - if (current_class_loader_oop == to_class_loader_oop) { + if (current_class_loader_oop == to_class_loader) { return; // This class loader is in the parent list, no need to add it. } current_class_loader_oop = java_lang_ClassLoader::parent(current_class_loader_oop); } while (current_class_loader_oop != NULL); - ClassLoaderDependencies::add(Handle(THREAD, from_class_loader_oop), - Handle(THREAD, to_class_loader_oop), + ClassLoaderDependencies::add(Handle(THREAD, from_class_loader), + Handle(THREAD, to_class_loader), CHECK); }
--- a/src/share/vm/classfile/classLoaderDependencies.hpp Thu Feb 21 04:50:25 2019 +0000 +++ b/src/share/vm/classfile/classLoaderDependencies.hpp Fri Feb 22 06:16:04 2019 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Red Hat, Inc. and/or its affiliates. + * Copyright (c) 2018, 2019, Red Hat, Inc. and/or its affiliates. * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -30,7 +30,7 @@ class ClassLoaderDependencies { public: - static void record_dependency(KlassHandle from_klass, KlassHandle to_klass, TRAPS); + static void record_dependency(oop from_class_loader, oop to_class_loader, TRAPS); private: static void add(Handle from_class_loader_h, Handle dependency, TRAPS); static void locked_add(objArrayHandle list_head, objArrayHandle last_handle, objArrayHandle new_dependency, TRAPS);
--- a/src/share/vm/classfile/dictionary.cpp Thu Feb 21 04:50:25 2019 +0000 +++ b/src/share/vm/classfile/dictionary.cpp Fri Feb 22 06:16:04 2019 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, 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 @@ -230,9 +230,6 @@ oop k_def_class_loader = ik->class_loader(); // Do we need to delete this system dictionary entry? - bool purge_entry = false; - - // Do we need to delete this system dictionary entry? if (!is_alive->do_object_b(class_loader)) { // If the loader is not live this entry should always be // removed (will never be looked up again). Note that this is @@ -255,28 +252,7 @@ // Clean up C heap ik->release_C_heap_structures(); } - // Also remove this system dictionary entry. - purge_entry = true; - - } else { - // The loader in this entry is alive. If the klass is dead, - // the loader must be an initiating loader (rather than the - // defining loader). Remove this entry. - if (!is_alive->do_object_b(e)) { - guarantee(!is_alive->do_object_b(k_def_class_loader), - "defining loader should not be live if klass is not"); - // If we get here, the class_loader must not be the defining - // loader, it must be an initiating one. - assert(k_def_class_loader != class_loader, - "cannot have live defining loader and unreachable klass"); - - // Loader is live, but class and its defining loader are dead. - // Remove the entry. The class is going away. - purge_entry = true; - } - } - - if (purge_entry) { + // Remove this system dictionary entry. *p = probe->next(); if (probe == _current_class_entry) { _current_class_entry = NULL;
--- a/src/share/vm/classfile/systemDictionary.cpp Thu Feb 21 04:50:25 2019 +0000 +++ b/src/share/vm/classfile/systemDictionary.cpp Fri Feb 22 06:16:04 2019 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2019, 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,6 +23,7 @@ */ #include "precompiled.hpp" +#include "classfile/classLoaderDependencies.hpp" #include "classfile/dictionary.hpp" #include "classfile/javaClasses.hpp" #include "classfile/loaderConstraints.hpp" @@ -813,7 +814,17 @@ check_constraints(d_index, d_hash, k, class_loader, false, THREAD); // Need to check for a PENDING_EXCEPTION again; check_constraints - // can throw and doesn't use the CHECK macro. + // can throw but we may have to remove entry from the placeholder table below. + if (!HAS_PENDING_EXCEPTION) { + // Record dependency for non-parent delegation. + // This recording keeps the defining class loader of the klass (k) found + // from being unloaded while the initiating class loader is loaded + // even if the reference to the defining class loader is dropped + // before references to the initiating class loader. + ClassLoaderDependencies::record_dependency(class_loader(), + k->class_loader(), THREAD); + } + if (!HAS_PENDING_EXCEPTION) { { // Grabbing the Compile_lock prevents systemDictionary updates // during compilations.
--- a/src/share/vm/classfile/verificationType.cpp Thu Feb 21 04:50:25 2019 +0000 +++ b/src/share/vm/classfile/verificationType.cpp Fri Feb 22 06:16:04 2019 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, 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,6 @@ */ #include "precompiled.hpp" -#include "classfile/classLoaderDependencies.hpp" #include "classfile/symbolTable.hpp" #include "classfile/verificationType.hpp" #include "classfile/verifier.hpp" @@ -63,8 +62,6 @@ Handle(THREAD, klass->protection_domain()), true, CHECK_false); KlassHandle this_class(THREAD, obj); - ClassLoaderDependencies::record_dependency(klass, this_class, CHECK_false); - if (this_class->is_interface()) { // We treat interfaces as java.lang.Object, including // java.lang.Cloneable and java.io.Serializable @@ -74,7 +71,6 @@ from.name(), Handle(THREAD, klass->class_loader()), Handle(THREAD, klass->protection_domain()), true, CHECK_false); KlassHandle from_class_handle(THREAD, from_class); - ClassLoaderDependencies::record_dependency(klass, from_class_handle, CHECK_false); return instanceKlass::cast(from_class_handle())->is_subclass_of(this_class()); } } else if (is_array() && from.is_array()) {
--- a/src/share/vm/classfile/verifier.cpp Thu Feb 21 04:50:25 2019 +0000 +++ b/src/share/vm/classfile/verifier.cpp Fri Feb 22 06:16:04 2019 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2019, 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 @@ -24,7 +24,6 @@ #include "precompiled.hpp" #include "classfile/classFileStream.hpp" -#include "classfile/classLoaderDependencies.hpp" #include "classfile/javaClasses.hpp" #include "classfile/stackMapTable.hpp" #include "classfile/stackMapFrame.hpp" @@ -1947,11 +1946,9 @@ oop loader = current_class()->class_loader(); oop protection_domain = current_class()->protection_domain(); - klassOop kls = SystemDictionary::resolve_or_fail( + return SystemDictionary::resolve_or_fail( name, Handle(THREAD, loader), Handle(THREAD, protection_domain), true, CHECK_NULL); - ClassLoaderDependencies::record_dependency(current_class(), kls, CHECK_NULL); - return kls; } bool ClassVerifier::is_protected_access(instanceKlassHandle this_class,
--- a/src/share/vm/oops/cpCacheOop.cpp Thu Feb 21 04:50:25 2019 +0000 +++ b/src/share/vm/oops/cpCacheOop.cpp Fri Feb 22 06:16:04 2019 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -220,7 +220,17 @@ if (byte_no == 1) { assert(invoke_code != Bytecodes::_invokevirtual && invoke_code != Bytecodes::_invokeinterface, ""); - set_bytecode_1(invoke_code); + bool do_resolve = true; + // Don't mark invokestatic to method as resolved if the holder class has not yet completed + // initialization. An invokestatic must only proceed if the class is initialized, but if + // we resolve it before then that class initialization check is skipped. + if (invoke_code == Bytecodes::_invokestatic && + !instanceKlass::cast(method->method_holder())->is_initialized()) { + do_resolve = false; + } + if (do_resolve) { + set_bytecode_1(invoke_code); + } } else if (byte_no == 2) { if (change_to_virtual) { assert(invoke_code == Bytecodes::_invokeinterface, "");
--- a/src/share/vm/opto/compile.cpp Thu Feb 21 04:50:25 2019 +0000 +++ b/src/share/vm/opto/compile.cpp Fri Feb 22 06:16:04 2019 +0000 @@ -3363,7 +3363,7 @@ _root->verify_edges(visited); if (no_dead_code) { // Now make sure that no visited node is used by an unvisited node. - bool dead_nodes = 0; + bool dead_nodes = false; Unique_Node_List checked(area); while (visited.size() > 0) { Node* n = visited.pop(); @@ -3374,14 +3374,16 @@ if (visited.member(use)) continue; // already in the graph if (use->is_Con()) continue; // a dead ConNode is OK // At this point, we have found a dead node which is DU-reachable. - if (dead_nodes++ == 0) + if (!dead_nodes) { tty->print_cr("*** Dead nodes reachable via DU edges:"); + dead_nodes = true; + } use->dump(2); tty->print_cr("---"); checked.push(use); // No repeats; pretend it is now checked. } } - assert(dead_nodes == 0, "using nodes must be reachable from root"); + assert(!dead_nodes, "using nodes must be reachable from root"); } } }
--- a/src/share/vm/prims/jvm.cpp Thu Feb 21 04:50:25 2019 +0000 +++ b/src/share/vm/prims/jvm.cpp Fri Feb 22 06:16:04 2019 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2019, 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 @@ -24,7 +24,6 @@ #include "precompiled.hpp" #include "classfile/classLoader.hpp" -#include "classfile/classLoaderDependencies.hpp" #include "classfile/javaAssertions.hpp" #include "classfile/javaClasses.hpp" #include "classfile/symbolTable.hpp" @@ -753,6 +752,79 @@ JVM_END +// java.nio.Bits /////////////////////////////////////////////////////////////// + +#define MAX_OBJECT_SIZE \ + ( arrayOopDesc::header_size(T_DOUBLE) * HeapWordSize \ + + ((julong)max_jint * sizeof(double)) ) + +static inline jlong field_offset_to_byte_offset(jlong field_offset) { + return field_offset; +} + +static inline void assert_field_offset_sane(oop p, jlong field_offset) { +#ifdef ASSERT + jlong byte_offset = field_offset_to_byte_offset(field_offset); + + if (p != NULL) { + assert(byte_offset >= 0 && byte_offset <= (jlong)MAX_OBJECT_SIZE, "sane offset"); + if (byte_offset == (jint)byte_offset) { + void* ptr_plus_disp = (address)p + byte_offset; + assert((void*)p->obj_field_addr<oop>((jint)byte_offset) == ptr_plus_disp, + "raw [ptr+disp] must be consistent with oop::field_base"); + } + jlong p_size = HeapWordSize * (jlong)(p->size()); + assert(byte_offset < p_size, err_msg("Unsafe access: offset " INT64_FORMAT + " > object's size " INT64_FORMAT, + (int64_t)byte_offset, (int64_t)p_size)); + } +#endif +} + +static inline void* index_oop_from_field_offset_long(oop p, jlong field_offset) { + assert_field_offset_sane(p, field_offset); + jlong byte_offset = field_offset_to_byte_offset(field_offset); + + if (sizeof(char*) == sizeof(jint)) { // (this constant folds!) + return (address)p + (jint) byte_offset; + } else { + return (address)p + byte_offset; + } +} + +// This function is a leaf since if the source and destination are both in native memory +// the copy may potentially be very large, and we don't want to disable GC if we can avoid it. +// If either source or destination (or both) are on the heap, the function will enter VM using +// JVM_ENTRY_FROM_LEAF +JVM_LEAF(void, JVM_CopySwapMemory(JNIEnv *env, jobject srcObj, jlong srcOffset, + jobject dstObj, jlong dstOffset, jlong size, + jlong elemSize)) { + + size_t sz = (size_t)size; + size_t esz = (size_t)elemSize; + + if (srcObj == NULL && dstObj == NULL) { + // Both src & dst are in native memory + address src = (address)srcOffset; + address dst = (address)dstOffset; + + Copy::conjoint_swap(src, dst, sz, esz); + } else { + // At least one of src/dst are on heap, transition to VM to access raw pointers + + JVM_ENTRY_FROM_LEAF(env, void, JVM_CopySwapMemory) { + oop srcp = JNIHandles::resolve(srcObj); + oop dstp = JNIHandles::resolve(dstObj); + + address src = (address)index_oop_from_field_offset_long(srcp, srcOffset); + address dst = (address)index_oop_from_field_offset_long(dstp, dstOffset); + + Copy::conjoint_swap(src, dst, sz, esz); + } JVM_END + } +} JVM_END + + // Misc. class handling /////////////////////////////////////////////////////////// @@ -914,14 +986,6 @@ jclass result = find_class_from_class_loader(env, h_name, init, h_loader, h_prot, true, thread); - if (result != NULL) { - from_class_oop = JNIHandles::resolve(from); - from_class = java_lang_Class::as_klassOop(from_class_oop); - oop mirror = JNIHandles::resolve_non_null(result); - klassOop to_class = java_lang_Class::as_klassOop(mirror); - ClassLoaderDependencies::record_dependency(from_class, to_class, CHECK_NULL); - } - if (TraceClassResolution && result != NULL) { // this function is generally only used for class loading during verification. ResourceMark rm;
--- a/src/share/vm/prims/jvm.h Thu Feb 21 04:50:25 2019 +0000 +++ b/src/share/vm/prims/jvm.h Fri Feb 22 06:16:04 2019 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, 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 @@ -143,6 +143,14 @@ JVM_OnExit(void (*func)(void)); /* + * java.nio.Bits + */ +JNIEXPORT void JNICALL +JVM_CopySwapMemory(JNIEnv *env, jobject srcObj, jlong srcOffset, + jobject dstObj, jlong dstOffset, jlong size, + jlong elemSize); + +/* * java.lang.Runtime */ JNIEXPORT void JNICALL
--- a/src/share/vm/runtime/interfaceSupport.hpp Thu Feb 21 04:50:25 2019 +0000 +++ b/src/share/vm/runtime/interfaceSupport.hpp Fri Feb 22 06:16:04 2019 +0000 @@ -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
--- a/src/share/vm/runtime/sharedRuntime.cpp Thu Feb 21 04:50:25 2019 +0000 +++ b/src/share/vm/runtime/sharedRuntime.cpp Fri Feb 22 06:16:04 2019 +0000 @@ -1215,6 +1215,14 @@ } #endif + // Do not patch call site for static call when the class is not + // fully initialized. + if (invoke_code == Bytecodes::_invokestatic && + !instanceKlass::cast(callee_method->method_holder())->is_initialized()) { + assert(instanceKlass::cast(callee_method->method_holder())->is_linked(), "must be"); + return callee_method; + } + // JSR 292 key invariant: // If the resolved method is a MethodHandle invoke target the call // site must be a MethodHandle call site, because the lambda form might tail-call
--- a/src/share/vm/utilities/copy.cpp Thu Feb 21 04:50:25 2019 +0000 +++ b/src/share/vm/utilities/copy.cpp Fri Feb 22 06:16:04 2019 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 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 @@ -64,8 +64,8 @@ * @param elem_size size of the elements to copy-swap */ static void conjoint_swap(address src, address dst, size_t byte_count, size_t elem_size) { - assert(src != NULL, err_msg("address must not be NULL")); - assert(dst != NULL, err_msg("address must not be NULL")); + assert(src != NULL, "address must not be NULL"); + assert(dst != NULL, "address must not be NULL"); assert(elem_size == 2 || elem_size == 4 || elem_size == 8, err_msg("incorrect element size: " SIZE_FORMAT, elem_size)); assert(is_size_aligned(byte_count, elem_size),
--- a/src/share/vm/utilities/copy.hpp Thu Feb 21 04:50:25 2019 +0000 +++ b/src/share/vm/utilities/copy.hpp Fri Feb 22 06:16:04 2019 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, 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