Skip to content

[GR-66294] Fix master-to-galahad merge conflict 19.06.2025 #11448

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Jun 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"Jsonnet files should not include this file directly but use ci/common.jsonnet instead."
],

"mx_version": "7.55.6",
"mx_version": "7.55.7",

"COMMENT.jdks": "When adding or removing JDKs keep in sync with JDKs in ci/common.jsonnet",
"jdks": {
Expand Down
4 changes: 2 additions & 2 deletions espresso/mx.espresso/mx_espresso.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,8 +569,8 @@ def mx_register_dynamic_suite_constituents(register_project, register_distributi
register_espresso_runtime_resources(register_project, register_distribution, _suite)
register_distribution(DeliverableStandaloneArchive(_suite,
standalone_dist='ESPRESSO_NATIVE_STANDALONE',
community_archive_name="espresso-community",
enterprise_archive_name="espresso",
community_archive_name=f"espresso-community-java{java_home_dep.major_version}",
enterprise_archive_name=f"espresso-java{java_home_dep.major_version}",
community_dist_name=f'GRAALVM_ESPRESSO_COMMUNITY_JAVA{java_home_dep.major_version}',
enterprise_dist_name=f'GRAALVM_ESPRESSO_JAVA{java_home_dep.major_version}'))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ void parsePolyglotOption(String group, String key, String value, String arg, boo

private OptionDescriptor findOptionDescriptor(String group, String key) {
OptionDescriptors descriptors = null;
if (group.equals("engine")) {
if ("engine".equals(group) || "compiler".equals(group)) {
descriptors = getTempEngine().getOptions();
} else {
Engine engine = getTempEngine();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ enum {
JMM_VERSION_4 = 0x20040000, // JDK 21
};

typedef struct {
typedef struct jmmOptionalSupport {
unsigned int isLowMemoryDetectionSupported : 1;
unsigned int isCompilationTimeMonitoringSupported : 1;
unsigned int isThreadContentionMonitoringSupported : 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
#include <stddef.h>

typedef struct member_info {
char* id;
size_t offset;
struct member_info *next;
char* id;
size_t offset;
struct member_info *next;
} member_info;

JNIEXPORT size_t JNICALL lookupMemberOffset(void* info, char* id);
Expand Down
118 changes: 88 additions & 30 deletions espresso/src/com.oracle.truffle.espresso.mokapot/src/structs.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include "jvm.h"
#include "jvmti.h"
#include "jmm_common.h"
#include "structs.h"

#include <jni.h>
Expand All @@ -31,9 +32,9 @@
#include <string.h>

#define JNI_STRUCT_MEMBER_LIST(V) \
V(JavaVMAttachArgs, version) \
V(JavaVMAttachArgs, name) \
V(JavaVMAttachArgs, group) \
V(JavaVMAttachArgs, version) \
V(JavaVMAttachArgs, name) \
V(JavaVMAttachArgs, group)

#define JVM_STRUCT_MEMBER_LIST(V) \
V(jdk_version_info, jdk_version)
Expand Down Expand Up @@ -171,20 +172,29 @@
V(_jvmtiEventCallbacks, VMObjectAlloc) \
V(_jvmtiEventCallbacks, reserved85) \
V(_jvmtiEventCallbacks, SampledObjectAlloc)


#define JMM_STRUCT_BITFIELD_MEMBER_LIST(V) \
V(jmmOptionalSupport, isLowMemoryDetectionSupported) \
V(jmmOptionalSupport, isCompilationTimeMonitoringSupported) \
V(jmmOptionalSupport, isThreadContentionMonitoringSupported) \
V(jmmOptionalSupport, isCurrentThreadCpuTimeSupported) \
V(jmmOptionalSupport, isOtherThreadCpuTimeSupported) \
V(jmmOptionalSupport, isObjectMonitorUsageSupported) \
V(jmmOptionalSupport, isSynchronizerUsageSupported) \
V(jmmOptionalSupport, isThreadAllocatedMemorySupported) \
V(jmmOptionalSupport, isRemoteDiagnosticCommandsSupported)

#define MEMBER_INFO_STRUCT_MEMBER_LIST(V) \
V(member_info, id) \
V(member_info, offset) \
V(member_info, next)

#define JNI_STRUCT_LIST(V) \
V(JavaVMAttachArgs) \
V(JavaVMAttachArgs) \
V(JavaVMAttachArgs) \
V(JavaVMAttachArgs)

#define JVM_STRUCT_LIST(V) \
V(jdk_version_info)

#define JVMTI_STRUCT_LIST(V) \
V(_jvmtiThreadInfo) \
V(_jvmtiMonitorStackDepthInfo) \
Expand All @@ -208,37 +218,44 @@
V(_jvmtiTimerInfo) \
V(_jvmtiAddrLocationMap) \
V(_jvmtiEventCallbacks)


#define JMM_STRUCT_LIST(V) \
V(jmmOptionalSupport)

#define MEMBER_INFO_STRUCT_LIST(V) \
V(member_info)

#define STRUCT_LIST_LIST(V) \
JNI_STRUCT_LIST(V) \
JVM_STRUCT_LIST(V) \
JNI_STRUCT_LIST(V) \
JVM_STRUCT_LIST(V) \
JVMTI_STRUCT_LIST(V) \
JMM_STRUCT_LIST(V) \
MEMBER_INFO_STRUCT_LIST(V)

#define STRUCT_MEMBER_LIST_LIST(V) \
JNI_STRUCT_MEMBER_LIST(V) \
JVM_STRUCT_MEMBER_LIST(V) \
JNI_STRUCT_MEMBER_LIST(V) \
JVM_STRUCT_MEMBER_LIST(V) \
JVMTI_STRUCT_MEMBER_LIST(V) \
MEMBER_INFO_STRUCT_MEMBER_LIST(V)

#define STRUCT_BITFIELD_MEMBER_LIST_LIST(V) \
JMM_STRUCT_BITFIELD_MEMBER_LIST(V)

void add_member_info(member_info** info, char* id, size_t offset) {
member_info* current = malloc(sizeof(struct member_info));
current->id = id;
current->offset = offset;
current->next = (*info);
*info = current;
member_info* current = malloc(sizeof(struct member_info));
current->id = id;
current->offset = offset;
current->next = (*info);
*info = current;
}

size_t lookup_member_info(member_info** info, char* id) {
for (member_info* current = *info; current != NULL; current = current->next) {
if (strcmp(id, current->id) == 0) {
return current->offset;
}
}
return -1;
for (member_info* current = *info; current != NULL; current = current->next) {
if (strcmp(id, current->id) == 0) {
return current->offset;
}
}
return -1;
}

void free_member_info(member_info** info) {
Expand All @@ -256,21 +273,62 @@ void free_member_info(member_info** info) {
JNIEXPORT void JNICALL initializeStructs(void (*notify_member_offset_init)(void *)) {
member_info** info = malloc(sizeof(struct member_info*));
(*info) = NULL;

#define MEMBER_INFO__(STRUCT_NAME, MEMBER_NAME) \
add_member_info(info, #STRUCT_NAME "." #MEMBER_NAME, offsetof(struct STRUCT_NAME, MEMBER_NAME));

STRUCT_MEMBER_LIST_LIST(MEMBER_INFO__)
#undef MEMBER_INFO__

// from com.oracle.svm.hosted.c.codegen.QueryCodeWriter#visitStructBitfieldInfo
#define MEMBER_INFO__(STRUCT_NAME, MEMBER_NAME) \
{ \
struct _w { \
STRUCT_NAME s; \
jlong pad; \
} w; \
char *p; \
size_t byte_offset; \
unsigned char start_bit = 0, end_bit = 0; \
jlong v; \
jlong all_bits_set = -1; \
memset(&w, 0x0, sizeof(w)); \
w.s.MEMBER_NAME = all_bits_set; \
p = (char*)&w.s; \
byte_offset = 0; \
while (byte_offset < sizeof(w.s) && *(p + byte_offset) == 0) { \
byte_offset++; \
} \
if (byte_offset >= sizeof(w.s)) { \
start_bit = end_bit = -1;\
} else { \
v = *((jlong*) (p + byte_offset)); \
while ((v & 0x1) == 0) { \
start_bit++; \
v = v >> 1; \
} \
end_bit = start_bit; \
while (v != 1) { \
end_bit++; \
v = v >> 1; \
} \
} \
add_member_info(info, #STRUCT_NAME "." #MEMBER_NAME, byte_offset); \
add_member_info(info, #STRUCT_NAME "." #MEMBER_NAME ".StartBit", start_bit); \
add_member_info(info, #STRUCT_NAME "." #MEMBER_NAME ".EndBit", end_bit + 1); \
}

STRUCT_BITFIELD_MEMBER_LIST_LIST(MEMBER_INFO__)
#undef MEMBER_INFO__

#define STRUCT_INFO__(STRUCT_NAME) \
add_member_info(info, #STRUCT_NAME, sizeof(struct STRUCT_NAME));

STRUCT_LIST_LIST(STRUCT_INFO__)
#undef STRUCT_INFO__

notify_member_offset_init(info);

free_member_info(info);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@ public enum NativeType {

OBJECT, // word-sized handle
POINTER,
BITFIELD_INT,
}
Loading