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 Dec 5, 2024
2 parents f282333 + 643e28d commit 56ce091
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@
*/
package com.oracle.svm.core.graal.llvm.lowering;

import jdk.graal.compiler.core.common.type.StampFactory;
import com.oracle.svm.core.graal.nodes.ReadExceptionObjectNode;
import com.oracle.svm.core.graal.snippets.NodeLoweringProvider;
import com.oracle.svm.core.nodes.CFunctionEpilogueNode;
import com.oracle.svm.core.thread.VMThreads;

import jdk.graal.compiler.debug.GraalError;
import jdk.graal.compiler.nodes.FixedWithNextNode;
import jdk.graal.compiler.nodes.FrameState;
import jdk.graal.compiler.nodes.NodeView;
import jdk.graal.compiler.nodes.StructuredGraph;
import jdk.graal.compiler.nodes.java.LoadExceptionObjectNode;
import jdk.graal.compiler.nodes.spi.LoweringTool;

import com.oracle.svm.core.graal.nodes.ReadExceptionObjectNode;
import com.oracle.svm.core.graal.snippets.NodeLoweringProvider;
import com.oracle.svm.core.nodes.CFunctionEpilogueNode;
import com.oracle.svm.core.thread.VMThreads;

public class LLVMLoadExceptionObjectLowering implements NodeLoweringProvider<LoadExceptionObjectNode> {

@Override
Expand All @@ -46,7 +46,7 @@ public void lower(LoadExceptionObjectNode node, LoweringTool tool) {

StructuredGraph graph = node.graph();
GraalError.guarantee(graph.getGuardsStage().areFrameStatesAtDeopts(), "Should be after FSA %s", node);
FixedWithNextNode readRegNode = graph.add(new ReadExceptionObjectNode(StampFactory.objectNonNull()));
FixedWithNextNode readRegNode = graph.add(new ReadExceptionObjectNode(node.stamp(NodeView.DEFAULT)));
graph.replaceFixedWithFixed(node, readRegNode);

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@

import jdk.graal.compiler.api.replacements.Snippet;
import jdk.graal.compiler.api.replacements.Snippet.ConstantParameter;
import jdk.graal.compiler.core.common.type.StampFactory;
import jdk.graal.compiler.graph.Node;
import jdk.graal.compiler.nodes.FixedWithNextNode;
import jdk.graal.compiler.nodes.NodeView;
import jdk.graal.compiler.nodes.StructuredGraph;
import jdk.graal.compiler.nodes.UnwindNode;
import jdk.graal.compiler.nodes.java.LoadExceptionObjectNode;
Expand Down Expand Up @@ -111,7 +111,7 @@ public static class LoadExceptionObjectLowering implements NodeLoweringProvider<
@Override
public void lower(LoadExceptionObjectNode node, LoweringTool tool) {
StructuredGraph graph = node.graph();
FixedWithNextNode readRegNode = graph.add(new ReadExceptionObjectNode(StampFactory.objectNonNull()));
FixedWithNextNode readRegNode = graph.add(new ReadExceptionObjectNode(node.stamp(NodeView.DEFAULT)));
graph.replaceFixedWithFixed(node, readRegNode);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import com.oracle.svm.core.SubstrateUtil;
import com.oracle.svm.core.annotate.Alias;
import com.oracle.svm.core.annotate.Inject;
import com.oracle.svm.core.annotate.InjectAccessors;
import com.oracle.svm.core.annotate.RecomputeFieldValue;
import com.oracle.svm.core.annotate.RecomputeFieldValue.Kind;
import com.oracle.svm.core.annotate.Substitute;
Expand Down Expand Up @@ -150,6 +151,46 @@ final class Target_java_util_concurrent_ConcurrentHashMap {
@Alias @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.Reset)//
Target_java_util_concurrent_ConcurrentHashMap_EntrySetView entrySet;

@Alias @InjectAccessors(NCPUAccessor.class) //
private static int NCPU;
}

final class NCPUAccessor {
private static int cachedNCPU = -1;

static int get() {
if (cachedNCPU != -1) {
return cachedNCPU;
}
return initializeNCPU();
}

private static synchronized int initializeNCPU() {
if (cachedNCPU != -1) {
return cachedNCPU;
}

cachedNCPU = Runtime.getRuntime().availableProcessors();
return cachedNCPU;
}

static synchronized void set(int value) {
cachedNCPU = value;
}
}

@TargetClass(java.util.concurrent.Phaser.class)
final class Target_java_util_concurrent_Phaser {

@Alias @InjectAccessors(NCPUAccessor.class) //
private static int NCPU;
}

@TargetClass(className = "java.util.concurrent.atomic.Striped64")
final class Target_java_util_concurrent_atomic_Striped64 {

@Alias @InjectAccessors(NCPUAccessor.class) //
private static int NCPU;
}

@TargetClass(value = java.util.concurrent.ConcurrentHashMap.class, innerClass = "KeySetView")
Expand Down Expand Up @@ -289,6 +330,37 @@ public boolean getAsBoolean() {
}
}

@TargetClass(className = "java.util.concurrent.LinkedTransferQueue", innerClass = "DualNode")
final class Target_java_util_concurrent_LinkedTransferQueue_DualNode {

@Alias @InjectAccessors(LinkedTransferQueueDualNodeIsUniprocessorAccessor.class) //
private static boolean isUniprocessor;
}

final class LinkedTransferQueueDualNodeIsUniprocessorAccessor {
private static Boolean cachedIsUniprocessor = null;

static boolean get() {
if (cachedIsUniprocessor != null) {
return cachedIsUniprocessor;
}
return initializeIsUniprocessor();
}

static void set(boolean value) {
cachedIsUniprocessor = value;
}

private static synchronized boolean initializeIsUniprocessor() {
if (cachedIsUniprocessor != null) {
return cachedIsUniprocessor;
}

cachedIsUniprocessor = Runtime.getRuntime().availableProcessors() == 1;
return cachedIsUniprocessor;
}
}

/** Dummy class to have a class with the file's name. */
public final class JavaUtilSubstitutions {
}

0 comments on commit 56ce091

Please sign in to comment.