Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
JesperIRL committed Jun 27, 2021
2 parents 8bed353 + d9cb068 commit a29953d
Show file tree
Hide file tree
Showing 90 changed files with 1,698 additions and 473 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/submit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install gcc-10=10.2.0-5ubuntu1~20.04 g++-10=10.2.0-5ubuntu1~20.04 libxrandr-dev libxtst-dev libcups2-dev libasound2-dev
sudo apt-get install gcc-10=10.3.0-1ubuntu1~20.04 g++-10=10.3.0-1ubuntu1~20.04 libxrandr-dev libxtst-dev libcups2-dev libasound2-dev
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10
- name: Configure
Expand Down Expand Up @@ -487,12 +487,12 @@ jobs:

- name: Install native host dependencies
run: |
sudo apt-get install gcc-10=10.2.0-5ubuntu1~20.04 g++-10=10.2.0-5ubuntu1~20.04 libxrandr-dev libxtst-dev libcups2-dev libasound2-dev
sudo apt-get install gcc-10=10.3.0-1ubuntu1~20.04 g++-10=10.3.0-1ubuntu1~20.04 libxrandr-dev libxtst-dev libcups2-dev libasound2-dev
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10
if: matrix.debian-arch == ''

- name: Install cross-compilation host dependencies
run: sudo apt-get install gcc-10-${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-flavor}}=10.2.0-5ubuntu1~20.04cross1 g++-10-${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-flavor}}=10.2.0-5ubuntu1~20.04cross1
run: sudo apt-get install gcc-10-${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-flavor}}=10.3.0-1ubuntu1~20.04cross1 g++-10-${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-flavor}}=10.3.0-1ubuntu1~20.04cross1
if: matrix.debian-arch != ''

- name: Cache sysroot
Expand Down
6 changes: 5 additions & 1 deletion src/hotspot/cpu/x86/stubGenerator_x86_64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "oops/objArrayKlass.hpp"
#include "oops/oop.inline.hpp"
#include "prims/methodHandles.hpp"
#include "runtime/arguments.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/sharedRuntime.hpp"
Expand Down Expand Up @@ -7657,7 +7658,10 @@ address generate_avx_ghash_processBlocks() {
// Get svml stub routine addresses
void *libsvml = NULL;
char ebuf[1024];
libsvml = os::dll_load(JNI_LIB_PREFIX "svml" JNI_LIB_SUFFIX, ebuf, sizeof ebuf);
char dll_name[JVM_MAXPATHLEN];
if (os::dll_locate_lib(dll_name, sizeof(dll_name), Arguments::get_dll_dir(), "svml")) {
libsvml = os::dll_load(dll_name, ebuf, sizeof ebuf);
}
if (libsvml != NULL) {
// SVML method naming convention
// All the methods are named as __svml_op<T><N>_ha_<VV>
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/x86/x86.ad
Original file line number Diff line number Diff line change
Expand Up @@ -8062,7 +8062,7 @@ instruct vpternlog(vec dst, vec src2, vec src3, immU8 func) %{
%}

instruct vpternlog_mem(vec dst, vec src2, memory src3, immU8 func) %{
predicate(vector_length_in_bytes(n->in(1)) > 8);
predicate(vector_length_in_bytes(n->in(1)->in(1)) > 8);
match(Set dst (MacroLogicV (Binary dst src2) (Binary (LoadVector src3) func)));
effect(TEMP dst);
format %{ "vpternlogd $dst,$src2,$src3,$func\t! vector ternary logic" %}
Expand Down
16 changes: 13 additions & 3 deletions src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,21 @@ int ZBarrierSetC2::estimate_stub_size() const {

static void set_barrier_data(C2Access& access) {
if (ZBarrierSet::barrier_needed(access.decorators(), access.type())) {
if (access.decorators() & ON_WEAK_OOP_REF) {
access.set_barrier_data(ZLoadBarrierWeak);
uint8_t barrier_data = 0;

if (access.decorators() & ON_PHANTOM_OOP_REF) {
barrier_data |= ZLoadBarrierPhantom;
} else if (access.decorators() & ON_WEAK_OOP_REF) {
barrier_data |= ZLoadBarrierWeak;
} else {
access.set_barrier_data(ZLoadBarrierStrong);
barrier_data |= ZLoadBarrierStrong;
}

if (access.decorators() & AS_NO_KEEPALIVE) {
barrier_data |= ZLoadBarrierNoKeepalive;
}

access.set_barrier_data(barrier_data);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ static const size_t ELEMENT_SIZE = sizeof(JfrEpochQueueKlassElement);
static const size_t NARROW_ELEMENT_SIZE = sizeof(JfrEpochQueueNarrowKlassElement);
static const size_t THRESHOLD_SHIFT = 30;

// If the upshifted traceid value is less than this threshold (1 073 741 824),
// If the traceid value is less than this threshold (1 073 741 824),
// compress the element for more effective queue storage.
static const traceid uncompressed_threshold = ((traceid)1) << THRESHOLD_SHIFT;

Expand Down Expand Up @@ -121,30 +121,36 @@ static traceid read_element(const u1* pos, const Klass** klass, bool compressed)
return compressed ? read_compressed_element(pos, klass) : read_uncompressed_element(pos, klass);
}

template <typename T>
static inline void store_traceid(T* element, traceid id, bool uncompressed) {
#ifdef VM_LITTLE_ENDIAN
id <<= METADATA_SHIFT;
#endif
element->id = uncompressed ? id | UNCOMPRESSED : id;
}

static void store_compressed_element(traceid id, const Klass* klass, u1* pos) {
assert(can_compress_element(id), "invariant");
JfrEpochQueueNarrowKlassElement* const element = new (pos) JfrEpochQueueNarrowKlassElement();
element->id = id;
store_traceid(element, id, false);
element->compressed_klass = encode(klass);
}

static void store_uncompressed_element(traceid id, const Klass* klass, u1* pos) {
JfrEpochQueueKlassElement* const element = new (pos) JfrEpochQueueKlassElement();
element->id = id | UNCOMPRESSED;
store_traceid(element, id, true);
element->klass = klass;
}

static void store_element(const Klass* klass, u1* pos) {
assert(pos != NULL, "invariant");
assert(klass != NULL, "invariant");
traceid id = JfrTraceId::load_raw(klass);
#ifdef VM_LITTLE_ENDIAN
id <<= METADATA_SHIFT;
#endif
const traceid id = JfrTraceId::load_raw(klass);
if (can_compress_element(id)) {
store_compressed_element(id, klass, pos);
} else {
store_uncompressed_element(id, klass, pos);
return;
}
store_uncompressed_element(id, klass, pos);
}

static void set_unloaded(const u1* pos) {
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/jfr/utilities/jfrEpochQueue.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ JfrEpochQueue<ElementPolicy>::storage_for_element(JfrEpochQueue<ElementPolicy>::
template <template <typename> class ElementPolicy>
void JfrEpochQueue<ElementPolicy>::enqueue(JfrEpochQueue<ElementPolicy>::TypePtr t) {
assert(t != NULL, "invariant");
static size_t element_size = _policy.element_size(t);
size_t element_size = _policy.element_size(t);
BufferPtr buffer = storage_for_element(t, element_size);
assert(buffer != NULL, "invariant");
_policy.store_element(t, buffer);
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/logging/logAsyncWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ void AsyncLogWriter::enqueue_locked(const AsyncLogMessage& msg) {
uint32_t* counter = _stats.add_if_absent(msg.output(), 0, &p_created);
*counter = *counter + 1;
// drop the enqueueing message.
os::free(msg.message());
return;
}

Expand Down
15 changes: 8 additions & 7 deletions src/hotspot/share/opto/library_call.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1032,17 +1032,18 @@ bool LibraryCallKit::inline_preconditions_checkIndex(BasicType bt) {
Deoptimization::Action_make_not_entrant);
}

if (stopped()) {
// Length is known to be always negative during compilation and the IR graph so far constructed is good so return success
return true;
}

// length is now known postive, add a cast node to make this explicit
jlong upper_bound = _gvn.type(length)->is_integer(bt)->hi_as_long();
Node* casted_length = ConstraintCastNode::make(control(), length, TypeInteger::make(0, upper_bound, Type::WidenMax, bt), bt);
casted_length = _gvn.transform(casted_length);
replace_in_map(length, casted_length);
length = casted_length;

if (stopped()) {
return false;
}

// Use an unsigned comparison for the range check itself
Node* rc_cmp = _gvn.transform(CmpNode::make(index, length, bt, true));
BoolTest::mask btest = BoolTest::lt;
Expand All @@ -1061,7 +1062,8 @@ bool LibraryCallKit::inline_preconditions_checkIndex(BasicType bt) {
}

if (stopped()) {
return false;
// Range check is known to always fail during compilation and the IR graph so far constructed is good so return success
return true;
}

// index is now known to be >= 0 and < length, cast it
Expand Down Expand Up @@ -5343,12 +5345,11 @@ bool LibraryCallKit::inline_vectorizedMismatch() {
if (do_partial_inline) {
assert(elem_bt != T_ILLEGAL, "sanity");

const TypeVect* vt = TypeVect::make(elem_bt, inline_limit);

if (Matcher::match_rule_supported_vector(Op_VectorMaskGen, inline_limit, elem_bt) &&
Matcher::match_rule_supported_vector(Op_LoadVectorMasked, inline_limit, elem_bt) &&
Matcher::match_rule_supported_vector(Op_VectorCmpMasked, inline_limit, elem_bt)) {

const TypeVect* vt = TypeVect::make(elem_bt, inline_limit);
Node* cmp_length = _gvn.transform(new CmpINode(length, intcon(inline_limit)));
Node* bol_gt = _gvn.transform(new BoolNode(cmp_length, BoolTest::gt));

Expand Down
16 changes: 11 additions & 5 deletions src/hotspot/share/runtime/thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1197,11 +1197,6 @@ JavaThread::~JavaThread() {

#if INCLUDE_JVMCI
if (JVMCICounterSize > 0) {
if (jvmci_counters_include(this)) {
for (int i = 0; i < JVMCICounterSize; i++) {
_jvmci_old_thread_counters[i] += _jvmci_counters[i];
}
}
FREE_C_HEAP_ARRAY(jlong, _jvmci_counters);
}
#endif // INCLUDE_JVMCI
Expand Down Expand Up @@ -1457,6 +1452,17 @@ void JavaThread::exit(bool destroy_vm, ExitType exit_type) {
_timer_exit_phase3.stop();
_timer_exit_phase4.start();
}

#if INCLUDE_JVMCI
if (JVMCICounterSize > 0) {
if (jvmci_counters_include(this)) {
for (int i = 0; i < JVMCICounterSize; i++) {
_jvmci_old_thread_counters[i] += _jvmci_counters[i];
}
}
}
#endif // INCLUDE_JVMCI

// Remove from list of active threads list, and notify VM thread if we are the last non-daemon thread
Threads::remove(this, daemon);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ ByteBuffer overlapDetection(ByteBuffer src, ByteBuffer dst) {
// if src is read only, then we need a copy
if (!src.isReadOnly()) {
// If using the heap, check underlying byte[] address.
if (!src.array().equals(dst.array()) ) {
if (src.array() != dst.array()) {
return dst;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ private MethodHandleProxies() { } // do not instantiate
* even though it re-declares the {@code Object.equals} method and also
* declares default methods, such as {@code Comparator.reverse}.
* <p>
* The interface must be public. No additional access checks are performed.
* The interface must be public and not {@linkplain Class#isSealed() sealed}.
* No additional access checks are performed.
* <p>
* The resulting instance of the required type will respond to
* invocation of the type's uniquely named method by calling
Expand Down Expand Up @@ -156,6 +157,8 @@ private MethodHandleProxies() { } // do not instantiate
public static <T> T asInterfaceInstance(final Class<T> intfc, final MethodHandle target) {
if (!intfc.isInterface() || !Modifier.isPublic(intfc.getModifiers()))
throw newIllegalArgumentException("not a public interface", intfc.getName());
if (intfc.isSealed())
throw newIllegalArgumentException("a sealed interface", intfc.getName());
final MethodHandle mh;
if (System.getSecurityManager() != null) {
final Class<?> caller = Reflection.getCallerClass();
Expand Down
22 changes: 16 additions & 6 deletions src/java.base/share/classes/java/lang/invoke/MethodHandles.java
Original file line number Diff line number Diff line change
Expand Up @@ -2768,6 +2768,7 @@ public MethodHandle findConstructor(Class<?> refc, MethodType type) throws NoSuc
* @throws ClassNotFoundException if the class cannot be loaded by the lookup class' loader.
* @throws IllegalAccessException if the class is not accessible, using the allowed access
* modes.
* @throws NullPointerException if {@code targetName} is null
* @since 9
* @jvms 5.4.3.1 Class and Interface Resolution
*/
Expand Down Expand Up @@ -2837,8 +2838,12 @@ private IllegalAccessException makeAccessException(Class<?> targetClass) {
/**
* Determines if a class can be accessed from the lookup context defined by
* this {@code Lookup} object. The static initializer of the class is not run.
* If {@code targetClass} is an array class, {@code targetClass} is accessible
* if the element type of the array class is accessible. Otherwise,
* {@code targetClass} is determined as accessible as follows.
*
* <p>
* If the {@code targetClass} is in the same module as the lookup class,
* If {@code targetClass} is in the same module as the lookup class,
* the lookup class is {@code LC} in module {@code M1} and
* the previous lookup class is in module {@code M0} or
* {@code null} if not present,
Expand All @@ -2861,7 +2866,7 @@ private IllegalAccessException makeAccessException(Class<?> targetClass) {
* can access public types in all modules when the type is in a package
* that is exported unconditionally.
* <p>
* Otherwise, the target class is in a different module from {@code lookupClass},
* Otherwise, {@code targetClass} is in a different module from {@code lookupClass},
* and if this lookup does not have {@code PUBLIC} access, {@code lookupClass}
* is inaccessible.
* <p>
Expand Down Expand Up @@ -2897,13 +2902,14 @@ private IllegalAccessException makeAccessException(Class<?> targetClass) {
* @return the class that has been access-checked
* @throws IllegalAccessException if the class is not accessible from the lookup class
* and previous lookup class, if present, using the allowed access modes.
* @throws SecurityException if a security manager is present and it
* <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
* @throws SecurityException if a security manager is present and it
* <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
* @throws NullPointerException if {@code targetClass} is {@code null}
* @since 9
* @see <a href="#cross-module-lookup">Cross-module lookups</a>
*/
public Class<?> accessClass(Class<?> targetClass) throws IllegalAccessException {
if (!VerifyAccess.isClassAccessible(targetClass, lookupClass, prevLookupClass, allowedModes)) {
if (!isClassAccessible(targetClass)) {
throw makeAccessException(targetClass);
}
checkSecurityManager(targetClass);
Expand Down Expand Up @@ -3684,7 +3690,11 @@ void checkSymbolicClass(Class<?> refc) throws IllegalAccessException {
boolean isClassAccessible(Class<?> refc) {
Objects.requireNonNull(refc);
Class<?> caller = lookupClassOrNull();
return caller == null || VerifyAccess.isClassAccessible(refc, caller, prevLookupClass, allowedModes);
Class<?> type = refc;
while (type.isArray()) {
type = type.getComponentType();
}
return caller == null || VerifyAccess.isClassAccessible(type, caller, prevLookupClass, allowedModes);
}

/** Check name for an illegal leading "&lt;" character. */
Expand Down
7 changes: 6 additions & 1 deletion src/java.base/share/classes/java/lang/reflect/Proxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,10 @@ private static void validateProxyInterfaces(ClassLoader loader,
throw new IllegalArgumentException(intf.getName() + " is a hidden interface");
}

if (intf.isSealed()) {
throw new IllegalArgumentException(intf.getName() + " is a sealed interface");
}

/*
* Verify that the class loader resolves the name of this
* interface to the same Class object.
Expand Down Expand Up @@ -930,7 +934,8 @@ private static Module getDynamicModule(ClassLoader loader) {
* if any of the following restrictions is violated:</a>
* <ul>
* <li>All of {@code Class} objects in the given {@code interfaces} array
* must represent {@linkplain Class#isHidden() non-hidden} interfaces,
* must represent {@linkplain Class#isHidden() non-hidden} and
* {@linkplain Class#isSealed() non-sealed} interfaces,
* not classes or primitive types.
*
* <li>No two elements in the {@code interfaces} array may
Expand Down
Loading

0 comments on commit a29953d

Please sign in to comment.