Skip to content

Commit

Permalink
[GR-24080] [GR-57399] [GR-57642] [GR-57990] Bugfixes, refactorings, a…
Browse files Browse the repository at this point in the history
…nd cleanups for the Posix signal handling.

PullRequest: graal/18677
  • Loading branch information
christianhaeubl committed Oct 8, 2024
2 parents a574e41 + a1296ae commit 7131e5a
Show file tree
Hide file tree
Showing 31 changed files with 1,329 additions and 979 deletions.
19 changes: 10 additions & 9 deletions sdk/src/org.graalvm.nativeimage/snapshot.sigtest
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ meth public void printStackTrace(java.io.PrintStream)
meth public void printStackTrace(java.io.PrintWriter)
meth public void setStackTrace(java.lang.StackTraceElement[])
supr java.lang.Object
hfds CAUSE_CAPTION,EMPTY_THROWABLE_ARRAY,NULL_CAUSE_MESSAGE,SELF_SUPPRESSION_MESSAGE,SUPPRESSED_CAPTION,SUPPRESSED_SENTINEL,UNASSIGNED_STACK,backtrace,cause,depth,detailMessage,serialVersionUID,stackTrace,suppressedExceptions
hfds CAUSE_CAPTION,EMPTY_THROWABLE_ARRAY,NULL_CAUSE_MESSAGE,SELF_SUPPRESSION_MESSAGE,SUPPRESSED_CAPTION,SUPPRESSED_SENTINEL,UNASSIGNED_STACK,backtrace,cause,depth,detailMessage,jfrTracing,serialVersionUID,stackTrace,suppressedExceptions
hcls PrintStreamOrWriter,SentinelHolder,WrappedPrintStream,WrappedPrintWriter

CLSS public abstract interface java.lang.annotation.Annotation
Expand Down Expand Up @@ -224,23 +224,23 @@ meth public abstract void fatalError()
meth public abstract void flush()
meth public abstract void log(org.graalvm.nativeimage.c.type.CCharPointer,org.graalvm.word.UnsignedWord)

CLSS public final org.graalvm.nativeimage.MissingReflectionRegistrationError
cons public init(java.lang.String,java.lang.Class<?>,java.lang.Class<?>,java.lang.String,java.lang.Class<?>[])
CLSS public final org.graalvm.nativeimage.MissingJNIRegistrationError
cons public init(java.lang.String,java.lang.Class<?>,java.lang.Class<?>,java.lang.String,java.lang.String)
meth public java.lang.Class<?> getDeclaringClass()
meth public java.lang.Class<?> getElementType()
meth public java.lang.Class<?>[] getParameterTypes()
meth public java.lang.String getElementName()
meth public java.lang.String getSignature()
supr java.lang.Error
hfds declaringClass,elementName,elementType,parameterTypes,serialVersionUID
hfds declaringClass,elementName,elementType,serialVersionUID,signature

CLSS public final org.graalvm.nativeimage.MissingJNIRegistrationError
cons public init(java.lang.String,java.lang.Class<?>,java.lang.Class<?>,java.lang.String,java.lang.String)
CLSS public final org.graalvm.nativeimage.MissingReflectionRegistrationError
cons public init(java.lang.String,java.lang.Class<?>,java.lang.Class<?>,java.lang.String,java.lang.Class<?>[])
meth public java.lang.Class<?> getDeclaringClass()
meth public java.lang.Class<?> getElementType()
meth public java.lang.String getSignature()
meth public java.lang.Class<?>[] getParameterTypes()
meth public java.lang.String getElementName()
supr java.lang.Error
hfds declaringClass,elementName,elementType,signature,serialVersionUID
hfds declaringClass,elementName,elementType,parameterTypes,serialVersionUID

CLSS public abstract interface org.graalvm.nativeimage.ObjectHandle
intf org.graalvm.word.ComparableWord
Expand Down Expand Up @@ -552,6 +552,7 @@ meth public abstract !hasdefault java.lang.String value()
CLSS public final static org.graalvm.nativeimage.c.constant.CConstant$ValueAccess
outer org.graalvm.nativeimage.c.constant.CConstant
meth public static <%0 extends java.lang.Object> {%%0} get(java.lang.Class<?>,java.lang.String,java.lang.Class<{%%0}>)
meth public static <%0 extends java.lang.Object> {%%0} get(java.lang.Enum<?>,java.lang.String)
supr java.lang.Object

CLSS public abstract interface !annotation org.graalvm.nativeimage.c.constant.CEnum
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,11 @@ private ValueAccess() {
* @param declaringClass The class that contains the method.
* @param methodName The name of the method annotated with {@link CConstant}.
* @param returnType The desired type of the returned value. For integer-kind constants, the
* supported types are {@link Long}, {@link Integer}, and {@link Boolean}. For
* floating point constants, the only supported type is {@link Double}. For
* string constants, the only supported type is {@link String}.
* supported types are {@link Boolean}, {@link Byte}, {@link Short},
* {@link Character}, {@link Integer}, and {@link Long}. For floating point
* constants, the supported types are {@link Double} and {@link Float}. For
* string constants, the only supported types are {@link String} and
* {@code byte[]}.
* @return The value of the C constant.
*
* @since 19.0
Expand All @@ -103,5 +105,24 @@ private ValueAccess() {
public static <T> T get(Class<?> declaringClass, String methodName, Class<T> returnType) {
return ImageSingletons.lookup(CConstantValueSupport.class).getCConstantValue(declaringClass, methodName, returnType);
}

/**
* Returns the value of a {@link CEnum}, i.e., the same value that calling the method
* annotated with {@link CEnumValue} would return.
* <p>
* This method is useful during native image generation, when the annotated method cannot be
* called.
*
* @param cEnum The enum value for which the C value should be returned. The enum type must
* be annotated with {@link CEnum}.
* @param methodName The name of the method annotated with {@link CEnumValue}.
* @return The value of the C constant.
*
* @since 24.2
*/
@Platforms(Platform.HOSTED_ONLY.class)
public static <T> T get(Enum<?> cEnum, String methodName) {
return ImageSingletons.lookup(CConstantValueSupport.class).getCEnumValue(cEnum, methodName);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* The Universal Permissive License (UPL), Version 1.0
Expand Down Expand Up @@ -46,4 +46,6 @@
@Platforms(Platform.HOSTED_ONLY.class)
public interface CConstantValueSupport {
<T> T getCConstantValue(Class<?> declaringClass, String methodName, Class<T> returnType);

<T> T getCEnumValue(Enum<?> cEnum, String methodName);
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public final class PosixPlatformTimeUtils extends PlatformTimeUtils {

@Override
@BasedOnJDKFile("https://github.com/openjdk/jdk/blob/jdk-24+3/src/hotspot/os/posix/os_posix.cpp#L1409-L1415")
protected SecondsNanos javaTimeSystemUTC() {
public SecondsNanos javaTimeSystemUTC() {
Time.timespec ts = StackValue.get(Time.timespec.class);
int status = PosixUtils.clock_gettime(Time.CLOCK_REALTIME(), ts);
PosixUtils.checkStatusIs0(status, "javaTimeSystemUTC: clock_gettime(CLOCK_REALTIME) failed.");
Expand Down
Loading

0 comments on commit 7131e5a

Please sign in to comment.