Skip to content
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 compiler/mx.compiler/mx_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1116,7 +1116,7 @@ def collate_metrics(args):
def run_java(args, out=None, err=None, addDefaultArgs=True, command_mapper_hooks=None, jdk=None, **kw_args):
graaljdk = jdk or get_graaljdk()
vm_args = _parseVmArgs(args, addDefaultArgs=addDefaultArgs)
args = ['-XX:+UnlockExperimentalVMOptions', '-XX:+EnableJVMCI'] + vm_args
args = ['-XX:+UnlockExperimentalVMOptions', '-XX:+EnableJVMCI', '--add-exports=java.base/jdk.internal.misc=jdk.graal.compiler'] + vm_args
_check_bootstrap_config(args)
cmd = get_vm_prefix() + [graaljdk.java] + ['-server'] + args
map_file = join(graaljdk.home, 'proguard.map')
Expand Down
3 changes: 3 additions & 0 deletions compiler/mx.compiler/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@
"java.logging",
],
"requiresConcealed" : {
"java.base" : [
"jdk.internal.misc",
],
"jdk.internal.vm.ci" : [
"jdk.vm.ci.meta",
"jdk.vm.ci.code",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public final class IntegerPolynomialTest extends HotSpotGraalCompilerTest {

@Test
public void testIntegerPolynomial() {
IntegerPolynomial testFields[] = new IntegerPolynomial[]{
IntegerPolynomial[] testFields = {
IntegerPolynomial1305.ONE,
IntegerPolynomial25519.ONE,
IntegerPolynomial448.ONE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@
import java.lang.foreign.Arena;
import java.lang.foreign.MemorySegment;

import org.junit.Assume;
import org.junit.Test;

import jdk.graal.compiler.core.test.GraalCompilerTest;
import jdk.graal.compiler.serviceprovider.JavaVersionUtil;
import jdk.graal.compiler.test.AddExports;
import jdk.internal.misc.Unsafe;
import jdk.vm.ci.code.InstalledCode;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 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
Expand All @@ -24,23 +24,20 @@
*/
package jdk.graal.compiler.core.common;

import static jdk.graal.compiler.serviceprovider.GraalUnsafeAccess.getUnsafe;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import jdk.graal.compiler.debug.GraalError;

import sun.misc.Unsafe;
import jdk.internal.misc.Unsafe;

/**
* Describes fields in a class, primarily for access via {@link Unsafe}.
*/
public class Fields {

private static final Unsafe UNSAFE = getUnsafe();
private static final Unsafe UNSAFE = Unsafe.getUnsafe();
private static final Fields EMPTY_FIELDS = new Fields(Collections.emptyList());

/**
Expand Down Expand Up @@ -149,15 +146,15 @@ public void copy(Object from, Object to, ObjectTransformer trans) {
assert false : "unhandled property type: " + type;
}
} else {
Object obj = UNSAFE.getObject(from, offset);
Object obj = UNSAFE.getReference(from, offset);
if (obj != null && type.isArray()) {
if (type.getComponentType().isPrimitive()) {
obj = copyObjectAsArray(obj);
} else {
obj = ((Object[]) obj).clone();
}
}
UNSAFE.putObject(to, offset, trans == null ? obj : trans.apply(index, obj));
UNSAFE.putReference(to, offset, trans == null ? obj : trans.apply(index, obj));
}
}
}
Expand Down Expand Up @@ -218,7 +215,7 @@ public Object get(Object object, int index) {
assert false : "unhandled property type: " + type;
}
} else {
value = UNSAFE.getObject(object, offset);
value = UNSAFE.getReference(object, offset);
}
return value;
}
Expand Down Expand Up @@ -382,16 +379,16 @@ public double getDouble(Object n, int i) {

public Object getObject(Object object, int i) {
assert !types[i].isPrimitive();
return UNSAFE.getObject(object, offsets[i]);
return UNSAFE.getReference(object, offsets[i]);
}

public void putObject(Object object, int i, Object value) {
assert checkAssignableFrom(object, i, value);
UNSAFE.putObject(object, offsets[i], value);
UNSAFE.putReference(object, offsets[i], value);
}

public void putObjectChecked(Object object, int i, Object value) {
checkAssignableFrom(object, i, value);
UNSAFE.putObject(object, offsets[i], value);
UNSAFE.putReference(object, offsets[i], value);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 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
Expand All @@ -24,13 +24,11 @@
*/
package jdk.graal.compiler.core.common;

import static jdk.graal.compiler.serviceprovider.GraalUnsafeAccess.getUnsafe;

import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.ArrayList;

import sun.misc.Unsafe;
import jdk.internal.misc.Unsafe;

/**
* Scans the fields in a class hierarchy.
Expand All @@ -50,9 +48,8 @@ public interface CalcOffset {
*/
public static class DefaultCalcOffset implements CalcOffset {

private static final Unsafe UNSAFE = getUnsafe();
private static final Unsafe UNSAFE = Unsafe.getUnsafe();

@SuppressWarnings("deprecation"/* JDK-8277863 */)
@Override
public long getOffset(Field field) {
return UNSAFE.objectFieldOffset(field);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 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
Expand All @@ -24,9 +24,7 @@
*/
package jdk.graal.compiler.core.common.util;

import static jdk.graal.compiler.serviceprovider.GraalUnsafeAccess.getUnsafe;

import sun.misc.Unsafe;
import jdk.internal.misc.Unsafe;

/**
* Provides low-level read access from a byte[] array for signed and unsigned values of size 1, 2,
Expand All @@ -42,7 +40,7 @@
*/
public abstract class UnsafeArrayTypeReader extends AbstractTypeReader {

private static final Unsafe UNSAFE = getUnsafe();
private static final Unsafe UNSAFE = Unsafe.getUnsafe();

public static int getS1(byte[] data, long byteIndex) {
return UNSAFE.getByte(data, readOffset(data, byteIndex, Byte.BYTES));
Expand Down Expand Up @@ -145,7 +143,7 @@ public final long getU4() {
}

final class UnalignedUnsafeArrayTypeReader extends UnsafeArrayTypeReader {
private static final Unsafe UNSAFE = getUnsafe();
private static final Unsafe UNSAFE = Unsafe.getUnsafe();

protected static int getS2(byte[] data, long byteIndex) {
return UNSAFE.getShort(data, readOffset(data, byteIndex, Short.BYTES));
Expand Down Expand Up @@ -186,7 +184,7 @@ public long getS8() {
}

class AlignedUnsafeArrayTypeReader extends UnsafeArrayTypeReader {
private static final Unsafe UNSAFE = getUnsafe();
private static final Unsafe UNSAFE = Unsafe.getUnsafe();

protected static int getS2(byte[] data, long byteIndex) {
long offset = readOffset(data, byteIndex, Short.BYTES);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 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
Expand Down Expand Up @@ -30,13 +30,12 @@
import static jdk.graal.compiler.core.common.util.TypeConversion.asU1;
import static jdk.graal.compiler.core.common.util.TypeConversion.asU2;
import static jdk.graal.compiler.core.common.util.TypeConversion.asU4;
import static jdk.graal.compiler.serviceprovider.GraalUnsafeAccess.getUnsafe;

import java.nio.ByteBuffer;

import jdk.graal.compiler.core.common.calc.UnsignedMath;
import jdk.graal.compiler.debug.Assertions;
import sun.misc.Unsafe;
import jdk.internal.misc.Unsafe;

/**
* Provides low-level sequential write access to a byte[] array for signed and unsigned values of
Expand All @@ -49,7 +48,7 @@
* fallback that works on every hardware.
*/
public abstract class UnsafeArrayTypeWriter implements TypeWriter {
private static final Unsafe UNSAFE = getUnsafe();
private static final Unsafe UNSAFE = Unsafe.getUnsafe();
private static final int MIN_CHUNK_LENGTH = 200;
private static final int MAX_CHUNK_LENGTH = 16000;

Expand Down Expand Up @@ -246,7 +245,7 @@ private void writePacked(long value) {
}

final class UnalignedUnsafeArrayTypeWriter extends UnsafeArrayTypeWriter {
private static final Unsafe UNSAFE = getUnsafe();
private static final Unsafe UNSAFE = Unsafe.getUnsafe();

@Override
protected void putS2(long value, Chunk chunk, long offset) {
Expand All @@ -265,7 +264,7 @@ protected void putS8(long value, Chunk chunk, long offset) {
}

final class AlignedUnsafeArrayTypeWriter extends UnsafeArrayTypeWriter {
private static final Unsafe UNSAFE = getUnsafe();
private static final Unsafe UNSAFE = Unsafe.getUnsafe();

@Override
protected void putS2(long value, Chunk chunk, long offset) {
Expand Down Expand Up @@ -297,7 +296,7 @@ protected void putS8(long value, Chunk chunk, long offset) {
}

final class BigEndianUnsafeArrayTypeWriter extends UnsafeArrayTypeWriter {
private static final Unsafe UNSAFE = getUnsafe();
private static final Unsafe UNSAFE = Unsafe.getUnsafe();

@Override
protected void putS2(long value, Chunk chunk, long offset) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 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
Expand Down Expand Up @@ -33,17 +33,15 @@
import jdk.graal.compiler.core.common.Fields;
import jdk.graal.compiler.core.common.FieldsScanner;
import jdk.graal.compiler.graph.NodeClass.EdgeInfo;
import jdk.graal.compiler.serviceprovider.GraalUnsafeAccess;

import sun.misc.Unsafe;
import jdk.internal.misc.Unsafe;

/**
* Describes {@link Node} fields representing the set of inputs for the node or the set of the
* node's successors.
*/
public abstract class Edges extends Fields {

private static final Unsafe UNSAFE = GraalUnsafeAccess.getUnsafe();
private static final Unsafe UNSAFE = Unsafe.getUnsafe();

/**
* Constants denoting whether a set of edges are inputs or successors.
Expand All @@ -69,12 +67,12 @@ public static void translateInto(Edges edges, ArrayList<EdgeInfo> infos) {
}

public static Node getNodeUnsafe(Node node, long offset) {
return (Node) UNSAFE.getObject(node, offset);
return (Node) UNSAFE.getReference(node, offset);
}

@SuppressWarnings("unchecked")
public static NodeList<Node> getNodeListUnsafe(Node node, long offset) {
return (NodeList<Node>) UNSAFE.getObject(node, offset);
return (NodeList<Node>) UNSAFE.getReference(node, offset);
}

public void putNodeUnsafeChecked(Node node, long offset, Node value, int index) {
Expand All @@ -83,11 +81,11 @@ public void putNodeUnsafeChecked(Node node, long offset, Node value, int index)
}

public static void putNodeUnsafe(Node node, long offset, Node value) {
UNSAFE.putObject(node, offset, value);
UNSAFE.putReference(node, offset, value);
}

public static void putNodeListUnsafe(Node node, long offset, NodeList<?> value) {
UNSAFE.putObject(node, offset, value);
UNSAFE.putReference(node, offset, value);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 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
Expand All @@ -25,7 +25,6 @@
package jdk.graal.compiler.graph;

import static jdk.graal.compiler.graph.Graph.isNodeModificationCountsEnabled;
import static jdk.graal.compiler.serviceprovider.GraalUnsafeAccess.getUnsafe;

import java.lang.annotation.ElementType;
import java.lang.annotation.RetentionPolicy;
Expand Down Expand Up @@ -62,8 +61,8 @@
import jdk.graal.compiler.nodeinfo.Verbosity;
import jdk.graal.compiler.nodes.spi.Simplifiable;
import jdk.graal.compiler.options.OptionValues;
import jdk.internal.misc.Unsafe;
import jdk.vm.ci.services.Services;
import sun.misc.Unsafe;

/**
* This class is the base class for all nodes. It represents a node that can be inserted in a
Expand Down Expand Up @@ -94,7 +93,7 @@
@NodeInfo
public abstract class Node implements Cloneable, Formattable {

private static final Unsafe UNSAFE = getUnsafe();
private static final Unsafe UNSAFE = Unsafe.getUnsafe();

public static final NodeClass<?> TYPE = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@
import jdk.graal.compiler.nodeinfo.NodeInfo;
import jdk.graal.compiler.nodeinfo.NodeSize;
import jdk.graal.compiler.nodeinfo.Verbosity;
import jdk.graal.compiler.serviceprovider.GraalUnsafeAccess;
import sun.misc.Unsafe;
import jdk.internal.misc.Unsafe;

/**
* Metadata for every {@link Node} type. The metadata includes:
Expand All @@ -83,7 +82,7 @@
*/
public final class NodeClass<T> extends FieldIntrospection<T> {

private static final Unsafe UNSAFE = GraalUnsafeAccess.getUnsafe();
private static final Unsafe UNSAFE = Unsafe.getUnsafe();
// Timers for creation of a NodeClass instance
private static final TimerKey Init_FieldScanning = DebugContext.timer("NodeClass.Init.FieldScanning");
private static final TimerKey Init_FieldScanningInner = DebugContext.timer("NodeClass.Init.FieldScanning.Inner");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
import jdk.graal.compiler.phases.tiers.HighTierContext;
import jdk.graal.compiler.phases.tiers.Suites;
import jdk.graal.compiler.printer.GraalDebugHandlersFactory;
import jdk.graal.compiler.serviceprovider.GraalUnsafeAccess;
import jdk.internal.misc.Unsafe;
import jdk.vm.ci.code.CompilationRequest;
import jdk.vm.ci.code.CompilationRequestResult;
import jdk.vm.ci.hotspot.HotSpotCompilationRequest;
Expand All @@ -72,11 +72,10 @@
import jdk.vm.ci.meta.TriState;
import jdk.vm.ci.runtime.JVMCICompiler;
import jdk.vm.ci.services.Services;
import sun.misc.Unsafe;

public class HotSpotGraalCompiler implements GraalJVMCICompiler, Cancellable, JVMCICompilerShadow {

private static final Unsafe UNSAFE = GraalUnsafeAccess.getUnsafe();
private static final Unsafe UNSAFE = Unsafe.getUnsafe();
private final HotSpotJVMCIRuntime jvmciRuntime;
private final HotSpotGraalRuntimeProvider graalRuntime;
private final CompilationCounters compilationCounters;
Expand Down
Loading