Skip to content

Commit

Permalink
Merge branch 'upstream-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Datadog Syncup Service committed Aug 27, 2024
2 parents dc4a6b8 + aefdbdc commit e2a9d96
Show file tree
Hide file tree
Showing 28 changed files with 314 additions and 218 deletions.
36 changes: 20 additions & 16 deletions make/common/JavaCompilation.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,26 @@ define SetupJavaCompilationBody
$1_FLAGS += -Xlint:$$(call CommaList, $$(addprefix -, $$($1_DISABLED_WARNINGS)))
endif

ifneq ($$($1_CLASSPATH), )
$1_FLAGS += -cp $$(call PathList, $$($1_CLASSPATH))
$1_AUGMENTED_CLASSPATH := $$($1_CLASSPATH)
$1_API_TARGET := $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_pubapi
$1_API_INTERNAL := $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_internalapi

ifeq ($$($1_CREATE_API_DIGEST), true)
$1_API_DIGEST_FLAGS := \
-Xplugin:"depend $$($1_API_TARGET)" \
"-XDinternalAPIPath=$$($1_API_INTERNAL)" \
"-XDLOG_LEVEL=$(LOG_LEVEL)" \
#

$1_EXTRA_DEPS := $$(BUILDTOOLS_OUTPUTDIR)/depend/_the.COMPILE_DEPEND_batch
# including the compilation output on the classpath, so that incremental
# compilations in unnamed module can refer to other classes from the same
# source root, which are not being recompiled in this compilation:
$1_AUGMENTED_CLASSPATH += $$(BUILDTOOLS_OUTPUTDIR)/depend $$($1_BIN)
endif

ifneq ($$($1_AUGMENTED_CLASSPATH), )
$1_FLAGS += -cp $$(call PathList, $$($1_AUGMENTED_CLASSPATH))
endif

# Make sure the dirs exist, or that one of the EXTRA_FILES, that may not
Expand Down Expand Up @@ -411,9 +429,6 @@ define SetupJavaCompilationBody
$1_MODFILELIST := $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_batch.modfiles
$1_MODFILELIST_FIXED := $$($1_MODFILELIST).fixed

$1_API_TARGET := $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_pubapi
$1_API_INTERNAL := $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_internalapi

# Put headers in a temp dir to filter out those that actually
# changed before copying them to the real header dir.
ifneq (,$$($1_HEADERS))
Expand Down Expand Up @@ -442,17 +457,6 @@ define SetupJavaCompilationBody
$1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \
$$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1.vardeps)

ifeq ($$($1_CREATE_API_DIGEST), true)
$1_API_DIGEST_FLAGS := \
-classpath $$(BUILDTOOLS_OUTPUTDIR)/depend \
-Xplugin:"depend $$($1_API_TARGET)" \
"-XDinternalAPIPath=$$($1_API_INTERNAL)" \
"-XDLOG_LEVEL=$(LOG_LEVEL)" \
#

$1_EXTRA_DEPS := $$(BUILDTOOLS_OUTPUTDIR)/depend/_the.COMPILE_DEPEND_batch
endif

# Create a file with all sources, to pass to javac in an @file.
# $$($1_VARDEPS_FILE) is used as dependency to track changes in set of
# list of files.
Expand Down
1 change: 1 addition & 0 deletions make/test/BuildMicrobenchmark.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ $(eval $(call SetupJavaCompilation, BUILD_JDK_MICROBENCHMARK, \
TARGET_RELEASE := $(TARGET_RELEASE_NEWJDK_UPGRADED), \
SMALL_JAVA := false, \
CLASSPATH := $(JMH_COMPILE_JARS), \
CREATE_API_DIGEST := true, \
DISABLED_WARNINGS := restricted this-escape processing rawtypes removal cast \
serial preview dangling-doc-comments, \
SRC := $(MICROBENCHMARK_SRC), \
Expand Down
Binary file modified src/demo/share/jfc/SwingSet2/resources/images/About.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 13 additions & 5 deletions src/hotspot/cpu/riscv/gc/shared/barrierSetAssembler_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,19 +265,27 @@ void BarrierSetAssembler::nmethod_entry_barrier(MacroAssembler* masm, Label* slo
}
case NMethodPatchingType::conc_instruction_and_data_patch:
{
// If we patch code we need both a code patching and a loadload
// If we patch code we need both a cmodx fence and a loadload
// fence. It's not super cheap, so we use a global epoch mechanism
// to hide them in a slow path.
// The high level idea of the global epoch mechanism is to detect
// when any thread has performed the required fencing, after the
// last nmethod was disarmed. This implies that the required
// fencing has been performed for all preceding nmethod disarms
// as well. Therefore, we do not need any further fencing.

__ la(t1, ExternalAddress((address)&_patching_epoch));
// Embed an artificial data dependency to order the guard load
// before the epoch load.
__ srli(ra, t0, 32);
__ orr(t1, t1, ra);
if (!UseZtso) {
// Embed a synthetic data dependency between the load of the guard and
// the load of the epoch. This guarantees that these loads occur in
// order, while allowing other independent instructions to be reordered.
// Note: This may be slower than using a membar(load|load) (fence r,r).
// Because processors will not start the second load until the first comes back.
// This means you can’t overlap the two loads,
// which is stronger than needed for ordering (stronger than TSO).
__ srli(ra, t0, 32);
__ orr(t1, t1, ra);
}
// Read the global epoch value.
__ lwu(t1, t1);
// Combine the guard value (low order) with the epoch value (high order).
Expand Down
4 changes: 1 addition & 3 deletions src/hotspot/os/linux/globals_linux.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,8 @@
product(bool, UseOprofile, false, \
"enable support for Oprofile profiler") \
\
/* NB: The default value of UseLinuxPosixThreadCPUClocks may be */ \
/* overridden in Arguments::parse_each_vm_init_arg. */ \
product(bool, UseLinuxPosixThreadCPUClocks, true, \
"enable fast Linux Posix clocks where available") \
"(Deprecated) enable fast Linux Posix clocks where available") \
\
product(bool, UseTransparentHugePages, false, \
"Use MADV_HUGEPAGE for large pages") \
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/os/windows/attachListener_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ void Win32AttachOperation::complete(jint result, bufferedStream* result_stream)
BOOL fSuccess;

char msg[32];
_snprintf(msg, sizeof(msg), "%d\n", result);
os::snprintf(msg, sizeof(msg), "%d\n", result);
msg[sizeof(msg) - 1] = '\0';

fSuccess = write_pipe(hPipe, msg, (int)strlen(msg));
Expand Down
12 changes: 6 additions & 6 deletions src/hotspot/os/windows/os_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1776,14 +1776,14 @@ void * os::dll_load(const char *name, char *ebuf, int ebuflen) {
}

if (lib_arch_str != nullptr) {
::_snprintf(ebuf, ebuflen - 1,
"Can't load %s-bit .dll on a %s-bit platform",
lib_arch_str, running_arch_str);
os::snprintf(ebuf, ebuflen - 1,
"Can't load %s-bit .dll on a %s-bit platform",
lib_arch_str, running_arch_str);
} else {
// don't know what architecture this dll was build for
::_snprintf(ebuf, ebuflen - 1,
"Can't load this .dll (machine code=0x%x) on a %s-bit platform",
lib_arch, running_arch_str);
os::snprintf(ebuf, ebuflen - 1,
"Can't load this .dll (machine code=0x%x) on a %s-bit platform",
lib_arch, running_arch_str);
}
JFR_ONLY(load_event.set_error_msg(ebuf);)
return nullptr;
Expand Down
8 changes: 4 additions & 4 deletions src/hotspot/os/windows/perfMemory_windows.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2024, 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
Expand Down Expand Up @@ -165,7 +165,7 @@ static char* get_user_tmp_dir(const char* user) {
char* dirname = NEW_C_HEAP_ARRAY(char, nbytes, mtInternal);

// construct the path name to user specific tmp directory
_snprintf(dirname, nbytes, "%s\\%s_%s", tmpdir, perfdir, user);
os::snprintf(dirname, nbytes, "%s\\%s_%s", tmpdir, perfdir, user);

return dirname;
}
Expand Down Expand Up @@ -455,7 +455,7 @@ static char *get_sharedmem_objectname(const char* user, int vmid) {
//
nbytes += UINT_CHARS;
char* name = NEW_C_HEAP_ARRAY(char, nbytes, mtInternal);
_snprintf(name, nbytes, "%s_%s_%u", PERFDATA_NAME, user, vmid);
os::snprintf(name, nbytes, "%s_%s_%u", PERFDATA_NAME, user, vmid);

return name;
}
Expand All @@ -471,7 +471,7 @@ static char* get_sharedmem_filename(const char* dirname, int vmid) {
size_t nbytes = strlen(dirname) + UINT_CHARS + 2;

char* name = NEW_C_HEAP_ARRAY(char, nbytes, mtInternal);
_snprintf(name, nbytes, "%s\\%d", dirname, vmid);
os::snprintf(name, nbytes, "%s\\%d", dirname, vmid);

return name;
}
Expand Down
6 changes: 4 additions & 2 deletions src/hotspot/share/jvmci/jvmciCompilerToVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -710,8 +710,10 @@ C2V_END

C2V_VMENTRY_0(jlong, getJObjectValue, (JNIEnv* env, jobject, jobject constant_jobject))
requireNotInHotSpot("getJObjectValue", JVMCI_CHECK_0);
if (!THREAD->has_last_Java_frame()) {
JVMCI_THROW_MSG_0(IllegalStateException, err_msg("Cannot call getJObjectValue without Java frame anchor"));
// Ensure that current JNI handle scope is not the top-most JNIHandleBlock as handles
// in that scope are only released when the thread exits.
if (!THREAD->has_last_Java_frame() && THREAD->active_handles()->pop_frame_link() == nullptr) {
JVMCI_THROW_MSG_0(IllegalStateException, err_msg("Cannot call getJObjectValue without Java frame anchor or a pushed JNI handle block"));
}
JVMCIObject constant = JVMCIENV->wrap(constant_jobject);
Handle constant_value = JVMCIENV->asConstant(constant, JVMCI_CHECK_0);
Expand Down
3 changes: 3 additions & 0 deletions src/hotspot/share/runtime/arguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,9 @@ static SpecialFlag const special_jvm_flags[] = {
{ "RequireSharedSpaces", JDK_Version::jdk(18), JDK_Version::jdk(19), JDK_Version::undefined() },
{ "UseSharedSpaces", JDK_Version::jdk(18), JDK_Version::jdk(19), JDK_Version::undefined() },
{ "DontYieldALot", JDK_Version::jdk(23), JDK_Version::jdk(24), JDK_Version::jdk(25) },
#ifdef LINUX
{ "UseLinuxPosixThreadCPUClocks", JDK_Version::jdk(24), JDK_Version::jdk(25), JDK_Version::jdk(26) },
#endif
{ "LockingMode", JDK_Version::jdk(24), JDK_Version::jdk(26), JDK_Version::jdk(27) },
// --- Deprecated alias flags (see also aliased_jvm_flags) - sorted by obsolete_in then expired_in:
{ "CreateMinidumpOnCrash", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::undefined() },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import jdk.internal.access.JavaLangAccess;
import jdk.internal.access.SharedSecrets;
import jdk.internal.constant.ConstantUtils;
import jdk.internal.constant.MethodTypeDescImpl;
import jdk.internal.constant.ReferenceClassDescImpl;
import jdk.internal.misc.VM;
import jdk.internal.util.ClassFileDumper;
import jdk.internal.util.ReferenceKey;
Expand Down Expand Up @@ -1085,32 +1087,32 @@ private static final class InlineHiddenClassStrategy {
static final MethodHandles.Lookup STR_LOOKUP = new MethodHandles.Lookup(String.class);

static final ClassDesc CD_CONCAT = ConstantUtils.binaryNameToDesc(CLASS_NAME);
static final ClassDesc CD_StringConcatHelper = ClassDesc.ofDescriptor("Ljava/lang/StringConcatHelper;");
static final ClassDesc CD_StringConcatBase = ClassDesc.ofDescriptor("Ljava/lang/StringConcatHelper$StringConcatBase;");
static final ClassDesc CD_Array_byte = ClassDesc.ofDescriptor("[B");
static final ClassDesc CD_Array_String = ClassDesc.ofDescriptor("[Ljava/lang/String;");

static final MethodTypeDesc MTD_byte_char = MethodTypeDesc.of(CD_byte, CD_char);
static final MethodTypeDesc MTD_byte = MethodTypeDesc.of(CD_byte);
static final MethodTypeDesc MTD_int = MethodTypeDesc.of(CD_int);
static final MethodTypeDesc MTD_int_int_boolean = MethodTypeDesc.of(CD_int, CD_int, CD_boolean);
static final MethodTypeDesc MTD_int_int_char = MethodTypeDesc.of(CD_int, CD_int, CD_char);
static final MethodTypeDesc MTD_int_int_int = MethodTypeDesc.of(CD_int, CD_int, CD_int);
static final MethodTypeDesc MTD_int_int_long = MethodTypeDesc.of(CD_int, CD_int, CD_long);
static final MethodTypeDesc MTD_int_int_String = MethodTypeDesc.of(CD_int, CD_int, CD_String);
static final MethodTypeDesc MTD_String_float = MethodTypeDesc.of(CD_String, CD_float);
static final MethodTypeDesc MTD_String_double = MethodTypeDesc.of(CD_String, CD_double);
static final MethodTypeDesc MTD_String_Object = MethodTypeDesc.of(CD_String, CD_Object);

static final MethodTypeDesc MTD_INIT = MethodTypeDesc.of(CD_void, CD_Array_String);
static final MethodTypeDesc MTD_NEW_ARRAY_SUFFIX = MethodTypeDesc.of(CD_Array_byte, CD_String, CD_int, CD_byte);
static final MethodTypeDesc MTD_STRING_INIT = MethodTypeDesc.of(CD_void, CD_Array_byte, CD_byte);

static final MethodTypeDesc PREPEND_int = MethodTypeDesc.of(CD_int, CD_int, CD_byte, CD_Array_byte, CD_int, CD_String);
static final MethodTypeDesc PREPEND_long = MethodTypeDesc.of(CD_int, CD_int, CD_byte, CD_Array_byte, CD_long, CD_String);
static final MethodTypeDesc PREPEND_boolean = MethodTypeDesc.of(CD_int, CD_int, CD_byte, CD_Array_byte, CD_boolean, CD_String);
static final MethodTypeDesc PREPEND_char = MethodTypeDesc.of(CD_int, CD_int, CD_byte, CD_Array_byte, CD_char, CD_String);
static final MethodTypeDesc PREPEND_String = MethodTypeDesc.of(CD_int, CD_int, CD_byte, CD_Array_byte, CD_String, CD_String);
static final ClassDesc CD_StringConcatHelper = ReferenceClassDescImpl.ofValidated("Ljava/lang/StringConcatHelper;");
static final ClassDesc CD_StringConcatBase = ReferenceClassDescImpl.ofValidated("Ljava/lang/StringConcatHelper$StringConcatBase;");
static final ClassDesc CD_Array_byte = ReferenceClassDescImpl.ofValidated("[B");
static final ClassDesc CD_Array_String = ReferenceClassDescImpl.ofValidated("[Ljava/lang/String;");

static final MethodTypeDesc MTD_byte_char = MethodTypeDescImpl.ofValidated(CD_byte, CD_char);
static final MethodTypeDesc MTD_byte = MethodTypeDescImpl.ofValidated(CD_byte);
static final MethodTypeDesc MTD_int = MethodTypeDescImpl.ofValidated(CD_int);
static final MethodTypeDesc MTD_int_int_boolean = MethodTypeDescImpl.ofValidated(CD_int, CD_int, CD_boolean);
static final MethodTypeDesc MTD_int_int_char = MethodTypeDescImpl.ofValidated(CD_int, CD_int, CD_char);
static final MethodTypeDesc MTD_int_int_int = MethodTypeDescImpl.ofValidated(CD_int, CD_int, CD_int);
static final MethodTypeDesc MTD_int_int_long = MethodTypeDescImpl.ofValidated(CD_int, CD_int, CD_long);
static final MethodTypeDesc MTD_int_int_String = MethodTypeDescImpl.ofValidated(CD_int, CD_int, CD_String);
static final MethodTypeDesc MTD_String_float = MethodTypeDescImpl.ofValidated(CD_String, CD_float);
static final MethodTypeDesc MTD_String_double = MethodTypeDescImpl.ofValidated(CD_String, CD_double);
static final MethodTypeDesc MTD_String_Object = MethodTypeDescImpl.ofValidated(CD_String, CD_Object);

static final MethodTypeDesc MTD_INIT = MethodTypeDescImpl.ofValidated(CD_void, CD_Array_String);
static final MethodTypeDesc MTD_NEW_ARRAY_SUFFIX = MethodTypeDescImpl.ofValidated(CD_Array_byte, CD_String, CD_int, CD_byte);
static final MethodTypeDesc MTD_STRING_INIT = MethodTypeDescImpl.ofValidated(CD_void, CD_Array_byte, CD_byte);

static final MethodTypeDesc PREPEND_int = MethodTypeDescImpl.ofValidated(CD_int, CD_int, CD_byte, CD_Array_byte, CD_int, CD_String);
static final MethodTypeDesc PREPEND_long = MethodTypeDescImpl.ofValidated(CD_int, CD_int, CD_byte, CD_Array_byte, CD_long, CD_String);
static final MethodTypeDesc PREPEND_boolean = MethodTypeDescImpl.ofValidated(CD_int, CD_int, CD_byte, CD_Array_byte, CD_boolean, CD_String);
static final MethodTypeDesc PREPEND_char = MethodTypeDescImpl.ofValidated(CD_int, CD_int, CD_byte, CD_Array_byte, CD_char, CD_String);
static final MethodTypeDesc PREPEND_String = MethodTypeDescImpl.ofValidated(CD_int, CD_int, CD_byte, CD_Array_byte, CD_String, CD_String);

static final RuntimeVisibleAnnotationsAttribute FORCE_INLINE = RuntimeVisibleAnnotationsAttribute.of(Annotation.of(ClassDesc.ofDescriptor("Ljdk/internal/vm/annotation/ForceInline;")));

Expand Down Expand Up @@ -1166,7 +1168,7 @@ private static MethodType erasedArgs(MethodType args) {
}
paramTypes[i] = cl;
}
return changed ? MethodType.methodType(args.returnType(), paramTypes) : args;
return changed ? MethodType.methodType(args.returnType(), paramTypes, true) : args;
}

/**
Expand All @@ -1191,24 +1193,36 @@ private static MethodTypeDesc prependArgs(MethodType concatArgs) {
var cl = concatArgs.parameterType(i);
paramTypes[i + 4] = needStringOf(cl) ? CD_String : ConstantUtils.classDesc(cl);
}
return MethodTypeDesc.of(CD_int, paramTypes);
return MethodTypeDescImpl.ofValidated(CD_int, paramTypes);
}

/**
* Construct the MethodType of the coder method,
* The first parameter is the initialized coder, Only parameter types that can be UTF16 are added.
* Construct the MethodType of the coder method. The first parameter is the initialized coder.
* Only parameter types which can be UTF16 are added. Returns null if no such parameter exists.
*/
private static MethodTypeDesc coderArgs(MethodType concatArgs) {
private static MethodTypeDesc coderArgsIfMaybeUTF16(MethodType concatArgs) {
int parameterCount = concatArgs.parameterCount();
List<ClassDesc> paramTypes = new ArrayList<>();
paramTypes.add(CD_int); // init coder

int maybeUTF16Count = 0;
for (int i = 0; i < parameterCount; i++) {
if (maybeUTF16(concatArgs.parameterType(i))) {
maybeUTF16Count++;
}
}

if (maybeUTF16Count == 0) {
return null;
}

var paramTypes = new ClassDesc[maybeUTF16Count + 1];
paramTypes[0] = CD_int; // init coder
for (int i = 0, paramIndex = 1; i < parameterCount; i++) {
var cl = concatArgs.parameterType(i);
if (maybeUTF16(cl)) {
paramTypes.add(cl == char.class ? CD_char : CD_String);
paramTypes[paramIndex++] = cl == char.class ? CD_char : CD_String;
}
}
return MethodTypeDesc.of(CD_int, paramTypes);
return MethodTypeDescImpl.ofValidated(CD_int, paramTypes);
}

/**
Expand All @@ -1223,7 +1237,7 @@ private static MethodTypeDesc lengthArgs(MethodType concatArgs) {
var cl = concatArgs.parameterType(i);
paramTypes[i + 1] = needStringOf(cl) ? CD_String : ConstantUtils.classDesc(cl);
}
return MethodTypeDesc.of(CD_int, paramTypes);
return MethodTypeDescImpl.ofValidated(CD_int, paramTypes);
}

private static MethodHandle generate(Lookup lookup, MethodType args, String[] constants) throws Exception {
Expand All @@ -1250,7 +1264,7 @@ private static MethodHandle generate(Lookup lookup, MethodType args, String[] co
}
}
MethodTypeDesc lengthArgs = lengthArgs(concatArgs),
coderArgs = parameterMaybeUTF16(concatArgs) ? coderArgs(concatArgs) : null,
coderArgs = coderArgsIfMaybeUTF16(concatArgs),
prependArgs = prependArgs(concatArgs);

byte[] classBytes = ClassFile.of().build(CD_CONCAT,
Expand Down Expand Up @@ -1478,7 +1492,7 @@ public void accept(CodeBuilder cb) {

/*
* String[] constants = this.constants;
* suffix = constants[paranCount];
* suffix = constants[paramCount];
* length -= suffix.length();
*/
cb.aload(thisSlot)
Expand Down Expand Up @@ -1692,14 +1706,5 @@ static boolean needStringOf(Class<?> cl) {
static boolean maybeUTF16(Class<?> cl) {
return cl == char.class || !cl.isPrimitive();
}

static boolean parameterMaybeUTF16(MethodType args) {
for (int i = 0; i < args.parameterCount(); i++) {
if (maybeUTF16(args.parameterType(i))) {
return true;
}
}
return false;
}
}
}
Loading

0 comments on commit e2a9d96

Please sign in to comment.