Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
f3f4d51
rebase with master. basic. Not uninterruptible. No stack traces
roberttoyonaga Jan 10, 2023
6aeef6b
add weight
roberttoyonaga Jan 17, 2023
b72be8a
evenly space out samples based on previous window
roberttoyonaga Jan 18, 2023
bdc75f2
debt. tests. EWMA.
roberttoyonaga Jan 25, 2023
59b19f4
normalize and set low rate. tests pass
roberttoyonaga Jan 30, 2023
26ab73c
minor updates, comments, text adjustment
roberttoyonaga May 5, 2023
f4ce168
improve tests
roberttoyonaga May 9, 2023
1d6f2f4
use VMMutex instead of spinlock. Minor tweaks
roberttoyonaga Jun 19, 2023
0c1736d
fix computeAccumulatedDebtCarryLimit. Add zeroRate test. Add partial …
roberttoyonaga Jun 19, 2023
929debd
distribution tests and fix adjustedProjectedpop
roberttoyonaga Jun 22, 2023
d1386ea
cleanup. Fix EWMA test case
roberttoyonaga Jun 23, 2023
dc8f2d0
use geometric sampling distribution. Adjust debt testcase
roberttoyonaga Jun 23, 2023
ecc2da1
Clean up. Group allocation events. Add testing back door static class.
roberttoyonaga Jun 23, 2023
26b20bd
gate fixes
roberttoyonaga Jun 27, 2023
2f3ff73
throttle
roberttoyonaga Jun 27, 2023
e9bb9ac
clean up volatile vars
roberttoyonaga Jul 5, 2023
9a20073
update changelog
roberttoyonaga Jul 7, 2023
07dfc05
Merge branch 'master' into throttle
roberttoyonaga Jul 7, 2023
1990018
clean up missed comments
roberttoyonaga Jul 10, 2023
2d94e69
Merge branch 'throttle' of github.com:roberttoyonaga/graal into throttle
roberttoyonaga Jul 10, 2023
db05846
merge master
roberttoyonaga Sep 19, 2023
f585631
minor review feedback resolution
roberttoyonaga Sep 20, 2023
1823f09
remove JfrThrottlerSupport. Add field to JfrEvent. Order JfrThrottler…
roberttoyonaga Sep 21, 2023
750cf4b
make uninterruptible. JfrRandom
roberttoyonaga Sep 25, 2023
f68763a
add read-write lock
roberttoyonaga Sep 25, 2023
34ceac8
cleanup. comments. javadoc. error handling. reset lastAllocationSize.
roberttoyonaga Sep 26, 2023
d4eb401
dedicated test class in test code
roberttoyonaga Sep 26, 2023
1093ee6
merge master
roberttoyonaga Sep 27, 2023
48ac440
gate fixes and cleaning
roberttoyonaga Sep 27, 2023
f5fa957
gate fixes. Math.ceil and style
roberttoyonaga Sep 27, 2023
41811ee
fix some concurrency issues
roberttoyonaga Oct 11, 2023
47928ae
fix conflicts
roberttoyonaga Nov 1, 2023
7e2cb91
minor clean up. Use jdk.graal.compiler
roberttoyonaga Nov 1, 2023
63c89ed
Merge branch 'master' of github.com:roberttoyonaga/graal into throttle
roberttoyonaga Nov 13, 2023
1c021bd
Merge branch 'master' into throttle
roberttoyonaga Nov 13, 2023
b0960fe
fix conflicts
roberttoyonaga Nov 13, 2023
4e77a8d
Merge branch 'master' of github.com:roberttoyonaga/graal into throttle
roberttoyonaga Dec 4, 2023
8a64fd6
comment
roberttoyonaga Dec 4, 2023
6db1df2
style
roberttoyonaga Dec 4, 2023
54aa15f
Merge with master.
christianhaeubl Jan 31, 2024
8db8411
Cleanups and fixes.
christianhaeubl Feb 5, 2024
a7f26c7
Add option ImplicitExceptionWithoutStacktraceIsFatal.
christianhaeubl Feb 5, 2024
d721c1b
Use log function from libm.
christianhaeubl Feb 7, 2024
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
1 change: 1 addition & 0 deletions substratevm/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This changelog summarizes major changes to GraalVM Native Image.
* (GR-51106) Fields that are accessed via a `VarHandle` or `MethodHandle` are no longer marked as "unsafe accessed" when the `VarHandle`/`MethodHandle` can be fully intrinsified.
* (GR-49996) Ensure explicitly set image name (e.g., via `-o imagename`) is not accidentally overwritten by `-jar jarfile` option.
* (GR-48683) Together with Red Hat, we added partial support for the JFR event `OldObjectSample`.
* (GR-47109) Together with Red Hat, we added support for JFR event throttling and the event `ObjectAllocationSample`.

## GraalVM for JDK 22 (Internal Version 24.0.0)
* (GR-48304) Red Hat added support for the JFR event ThreadAllocationStatistics.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
import com.oracle.svm.core.jfr.HasJfrSupport;
import com.oracle.svm.core.jfr.JfrTicks;
import com.oracle.svm.core.jfr.SubstrateJVM;
import com.oracle.svm.core.jfr.events.ObjectAllocationInNewTLABEvent;
import com.oracle.svm.core.jfr.events.JfrAllocationEvents;
import com.oracle.svm.core.log.Log;
import com.oracle.svm.core.snippets.KnownIntrinsics;
import com.oracle.svm.core.snippets.SubstrateForeignCallTarget;
Expand Down Expand Up @@ -243,7 +243,7 @@ private static Object slowPathNewInstanceWithoutAllocating(DynamicHub hub, Unsig
AlignedHeader newTlab = HeapImpl.getChunkProvider().produceAlignedChunk();
return allocateInstanceInNewTlab(hub, size, newTlab);
} finally {
ObjectAllocationInNewTLABEvent.emit(startTicks, hub, size, HeapParameters.getAlignedHeapChunkSize());
JfrAllocationEvents.emit(startTicks, hub, size, HeapParameters.getAlignedHeapChunkSize());
DeoptTester.enableDeoptTesting();
}
}
Expand Down Expand Up @@ -327,7 +327,7 @@ private static Object slowPathNewArrayLikeObject0(DynamicHub hub, int length, Un
}
return array;
} finally {
ObjectAllocationInNewTLABEvent.emit(startTicks, hub, size, tlabSize);
JfrAllocationEvents.emit(startTicks, hub, size, tlabSize);
DeoptTester.enableDeoptTesting();
}
}
Expand Down Expand Up @@ -532,7 +532,7 @@ private static Descriptor retireCurrentAllocationChunk(IsolateThread thread) {

private static void sampleSlowPathAllocation(Object obj, UnsignedWord allocatedSize, int arrayLength) {
if (HasJfrSupport.get()) {
SubstrateJVM.getJfrOldObjectProfiler().sample(obj, allocatedSize, arrayLength);
SubstrateJVM.getOldObjectProfiler().sample(obj, allocatedSize, arrayLength);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright (c) 2024, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.oracle.svm.core.posix;

import com.oracle.svm.core.Uninterruptible;
import com.oracle.svm.core.feature.AutomaticallyRegisteredImageSingleton;
import com.oracle.svm.core.headers.LibMSupport;
import com.oracle.svm.core.posix.headers.PosixLibM;

@AutomaticallyRegisteredImageSingleton(LibMSupport.class)
public class PosixLibMSupport implements LibMSupport {
@Override
@Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
public double log(double value) {
return PosixLibM.log(value);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* Copyright (c) 2024, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.oracle.svm.core.posix.headers;

import java.util.Collections;
import java.util.List;

import org.graalvm.nativeimage.c.CContext;
import org.graalvm.nativeimage.c.function.CFunction;

import com.oracle.svm.core.jfr.HasJfrSupport;

@CContext(value = LibMDependencies.class)
public class PosixLibM {
@CFunction(transition = CFunction.Transition.NO_TRANSITION)
public static native double log(double value);
}

class LibMDependencies implements CContext.Directives {
@Override
public boolean isInConfiguration() {
return HasJfrSupport.get();
}

@Override
public List<String> getHeaderFiles() {
return Collections.singletonList("<math.h>");
}

@Override
public List<String> getLibraries() {
return Collections.singletonList("m");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright (c) 2024, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.oracle.svm.core.windows;

import com.oracle.svm.core.Uninterruptible;
import com.oracle.svm.core.feature.AutomaticallyRegisteredImageSingleton;
import com.oracle.svm.core.headers.LibMSupport;
import com.oracle.svm.core.windows.headers.WindowsLibC;

@AutomaticallyRegisteredImageSingleton(LibMSupport.class)
public class WindowsLibMSupport implements LibMSupport {
@Override
@Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
public double log(double value) {
return WindowsLibC.log(value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ public class WindowsDirectives implements CContext.Directives {
"<stdio.h>",
"<stdlib.h>",
"<string.h>",
"<io.h>"
"<io.h>",
"<math.h>"
};

@Override
Expand All @@ -55,8 +56,7 @@ public boolean isInConfiguration() {
@Override
public List<String> getHeaderFiles() {
if (Platform.includedIn(Platform.WINDOWS.class)) {
List<String> result = new ArrayList<>(Arrays.asList(windowsLibs));
return result;
return new ArrayList<>(Arrays.asList(windowsLibs));
} else {
throw VMError.shouldNotReachHere("Unsupported OS");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,7 @@ public interface WCharPointer extends PointerBase {

@CFunction(transition = CFunction.Transition.NO_TRANSITION)
public static native UnsignedWord strtoull(CCharPointer string, CCharPointerPointer endPtr, int base);

@CFunction(transition = CFunction.Transition.NO_TRANSITION)
public static native double log(double value);
}
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,9 @@ protected void onValueUpdate(EconomicMap<OptionKey<?>, Object> values, String ol
@Option(help = "Specifies the number of entries that diagnostic buffers have.", type = OptionType.Debug)//
public static final HostedOptionKey<Integer> DiagnosticBufferSize = new HostedOptionKey<>(30);

@Option(help = "Determines if implicit exceptions are fatal if they don't have a stack trace.", type = OptionType.Debug)//
public static final RuntimeOptionKey<Boolean> ImplicitExceptionWithoutStacktraceIsFatal = new RuntimeOptionKey<>(false);

@SuppressWarnings("unused")//
@APIOption(name = "configure-reflection-metadata")//
@Option(help = "Enable runtime instantiation of reflection objects for non-invoked methods.", type = OptionType.Expert, deprecated = true)//
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Copyright (c) 2024, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.oracle.svm.core.collections;

import static com.oracle.svm.core.Uninterruptible.CALLED_FROM_UNINTERRUPTIBLE_CODE;

import com.oracle.svm.core.Uninterruptible;

public final class EnumBitmask {
private EnumBitmask() {
}

public static int computeBitmask(Enum<?>[] flags) {
int result = 0;
for (Enum<?> flag : flags) {
assert flag.ordinal() <= Integer.SIZE - 1;
result |= flagBit(flag);
}
return result;
}

@Uninterruptible(reason = CALLED_FROM_UNINTERRUPTIBLE_CODE, mayBeInlined = true)
public static boolean hasBit(int bitmask, Enum<?> flag) {
return (bitmask & flagBit(flag)) != 0;
}

@Uninterruptible(reason = CALLED_FROM_UNINTERRUPTIBLE_CODE, mayBeInlined = true)
private static int flagBit(Enum<?> flag) {
assert flag.ordinal() < 32;
return 1 << flag.ordinal();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
*/
package com.oracle.svm.core.headers;

import jdk.graal.compiler.api.replacements.Fold;
import org.graalvm.nativeimage.ImageSingletons;
import org.graalvm.nativeimage.c.type.CCharPointer;
import org.graalvm.nativeimage.c.type.CCharPointerPointer;
Expand All @@ -34,6 +33,8 @@

import com.oracle.svm.core.Uninterruptible;

import jdk.graal.compiler.api.replacements.Fold;

public class LibC {
public static final int EXIT_CODE_ABORT = 99;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (c) 2024, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.oracle.svm.core.headers;

import static com.oracle.svm.core.Uninterruptible.CALLED_FROM_UNINTERRUPTIBLE_CODE;

import org.graalvm.nativeimage.ImageSingletons;

import com.oracle.svm.core.Uninterruptible;

import jdk.graal.compiler.api.replacements.Fold;

public class LibM {
@Uninterruptible(reason = CALLED_FROM_UNINTERRUPTIBLE_CODE, mayBeInlined = true)
public static double log(double value) {
return libm().log(value);
}

@Fold
static LibMSupport libm() {
return ImageSingletons.lookup(LibMSupport.class);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright (c) 2024, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.oracle.svm.core.headers;

import com.oracle.svm.core.Uninterruptible;

public interface LibMSupport {
@Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
double log(double value);
}
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,18 @@ public static int abs(int a) {
public static long abs(long a) {
return (a < 0) ? -a : a;
}

@Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
public static long floorToLong(double value) {
assert value == value : "must not be NaN";
return (long) value;
}

@Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
public static long ceilToLong(double a) {
long floor = floorToLong(a);
return a > floor ? floor + 1 : floor;
}
}

public static class Byte {
Expand Down
Loading