Skip to content

Commit

Permalink
Automatic merge of master into galahad
Browse files Browse the repository at this point in the history
  • Loading branch information
OracleLabsAutomation committed Jun 7, 2024
2 parents adb937a + 5b5a135 commit edfedf3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* questions.
*/

package com.oracle.svm.core.posix.darwin;
package com.oracle.svm.core.posix;

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

Expand All @@ -34,18 +34,16 @@

import com.oracle.svm.core.Uninterruptible;
import com.oracle.svm.core.graal.stackvalue.UnsafeStackValue;
import com.oracle.svm.core.posix.PosixSubstrateSigprofHandler;
import com.oracle.svm.core.posix.PosixUtils;
import com.oracle.svm.core.posix.headers.Time;
import com.oracle.svm.core.util.TimeUtils;

/**
* Darwin supports only global timer from POSIX (see {@link PosixSubstrateSigprofHandler}).
* Support for POSIX global timer (see {@link PosixSubstrateSigprofHandler}).
*/
public final class DarwinSubstrateSigprofHandler extends PosixSubstrateSigprofHandler {
public final class PosixSubstrateGlobalSigprofHandler extends PosixSubstrateSigprofHandler {

@Platforms(Platform.HOSTED_ONLY.class)
public DarwinSubstrateSigprofHandler() {
public PosixSubstrateGlobalSigprofHandler() {
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@
import com.oracle.svm.core.feature.AutomaticallyRegisteredFeature;
import com.oracle.svm.core.feature.InternalFeature;
import com.oracle.svm.core.heap.RestrictHeapAccess;
import com.oracle.svm.core.jfr.HasJfrSupport;
import com.oracle.svm.core.jfr.JfrExecutionSamplerSupported;
import com.oracle.svm.core.jfr.JfrFeature;
import com.oracle.svm.core.jfr.sampler.JfrExecutionSampler;
import com.oracle.svm.core.option.HostedOptionKey;
import com.oracle.svm.core.option.SubstrateOptionsParser;
import com.oracle.svm.core.posix.darwin.DarwinSubstrateSigprofHandler;
import com.oracle.svm.core.posix.headers.Signal;
import com.oracle.svm.core.posix.linux.LinuxSubstrateSigprofHandler;
import com.oracle.svm.core.sampler.SubstrateSigprofHandler;
Expand Down Expand Up @@ -152,10 +152,14 @@ public void afterRegistration(AfterRegistrationAccess access) {
}

private static SubstrateSigprofHandler makeNewSigprofHandler() {
if (Platform.includedIn(Platform.LINUX.class)) {
/*
* For JFR, we should employ a global timer instead of a per-thread timer to adhere to the
* sampling frequency specified in .jfc.
*/
if (Platform.includedIn(Platform.DARWIN.class) || HasJfrSupport.get()) {
return new PosixSubstrateGlobalSigprofHandler();
} else if (Platform.includedIn(Platform.LINUX.class)) {
return new LinuxSubstrateSigprofHandler();
} else if (Platform.includedIn(Platform.DARWIN.class)) {
return new DarwinSubstrateSigprofHandler();
} else {
throw VMError.shouldNotReachHere("The JFR-based sampler is not supported on this platform.");
}
Expand Down

0 comments on commit edfedf3

Please sign in to comment.