Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8243380: Update Graal
Reviewed-by: kvn
  • Loading branch information
dean-long committed Jun 5, 2020
1 parent 0963050 commit 6c3bc71079bd9f4de005d005ded5a7cc3b7e373a
Showing 513 changed files with 14,057 additions and 6,329 deletions.
@@ -52,8 +52,8 @@
*
* <p>
* This class holds information necessary to create platform-specific binary containers such as
* ELFContainer for Linux or MachOContainer for Mac OS or PEContainer
* for MS Windows operating systems.
* ELFContainer for Linux or MachOContainer for Mac OS or PEContainer for MS Windows operating
* systems.
*
* <p>
* Method APIs provided by this class are used to construct and populate platform-independent
@@ -300,7 +300,7 @@ public BinaryContainer(OptionValues graalOptions, GraalHotSpotVMConfig graalHotS

this.codeEntryAlignment = graalHotSpotVMConfig.codeEntryAlignment;

this.threadLocalHandshakes = graalHotSpotVMConfig.threadLocalHandshakes;
this.threadLocalHandshakes = graalHotSpotVMConfig.useThreadLocalPolling;

// Section unique name is limited to 8 characters due to limitation on Windows.
// Name could be longer but only first 8 characters are stored on Windows.
@@ -354,7 +354,7 @@ private void recordConfiguration(GraalHotSpotVMConfig graalHotSpotVMConfig, Grap
graphBuilderConfig.omitAssertions()));
if (JavaVersionUtil.JAVA_SPEC < 14) {
// See JDK-8220049. Thread local handshakes are on by default since JDK14, the command line option has been removed.
booleanFlagsList.add(graalHotSpotVMConfig.threadLocalHandshakes);
booleanFlagsList.add(graalHotSpotVMConfig.useThreadLocalPolling);
}

ArrayList<Integer> intFlagsList = new ArrayList<>();
@@ -432,6 +432,10 @@ public static String getCrcTableAddressSymbolName() {
return "_aot_stub_routines_crc_table_adr";
}

public static String getPollingPageSymbolName() {
return "_aot_polling_page";
}

public static String getResolveStaticEntrySymbolName() {
return "_resolve_static_entry";
}
@@ -508,6 +512,7 @@ private void addGlobalSymbols() {
createGotSymbol(getHeapEndAddressSymbolName());
createGotSymbol(getNarrowKlassBaseAddressSymbolName());
createGotSymbol(getNarrowOopBaseAddressSymbolName());
createGotSymbol(getPollingPageSymbolName());
createGotSymbol(getLogOfHeapRegionGrainBytesSymbolName());
createGotSymbol(getInlineContiguousAllocationSupportedSymbolName());

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2020, 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
@@ -33,6 +33,7 @@
import org.graalvm.compiler.core.GraalCompilerOptions;
import org.graalvm.compiler.debug.DebugContext;
import org.graalvm.compiler.debug.DebugContext.Activation;
import org.graalvm.compiler.debug.DebugContext.Builder;
import org.graalvm.compiler.debug.TTY;
import org.graalvm.compiler.options.OptionValues;
import org.graalvm.compiler.printer.GraalDebugHandlersFactory;
@@ -118,7 +119,7 @@ public void run() {
CompilationResult compResult = null;
final long startTime = System.currentTimeMillis();
SnippetReflectionProvider snippetReflection = aotBackend.getProviders().getSnippetReflection();
try (DebugContext debug = DebugContext.create(graalOptions, new GraalDebugHandlersFactory(snippetReflection)); Activation a = debug.activate()) {
try (DebugContext debug = new Builder(graalOptions, new GraalDebugHandlersFactory(snippetReflection)).build(); Activation a = debug.activate()) {
compResult = aotBackend.compileMethod(method, debug);
}
final long endTime = System.currentTimeMillis();
@@ -26,6 +26,7 @@
package jdk.tools.jaotc;

import org.graalvm.compiler.bytecode.Bytecodes;
import org.graalvm.compiler.hotspot.HotSpotMarkId;

import jdk.vm.ci.code.BytecodePosition;
import jdk.vm.ci.code.site.Call;
@@ -67,11 +68,11 @@ private static boolean isInvokeVirtual(Call call) {
}

static boolean isVirtualCall(CompiledMethodInfo methodInfo, Call call) {
return isInvokeVirtual(call) && !methodInfo.hasMark(call, MarkId.INVOKESPECIAL) && !isStaticTarget(call);
return isInvokeVirtual(call) && !methodInfo.hasMark(call, HotSpotMarkId.INVOKESPECIAL) && !isStaticTarget(call);
}

static boolean isOptVirtualCall(CompiledMethodInfo methodInfo, Call call) {
return isInvokeVirtual(call) && methodInfo.hasMark(call, MarkId.INVOKESPECIAL);
return isInvokeVirtual(call) && methodInfo.hasMark(call, HotSpotMarkId.INVOKESPECIAL);
}

private static boolean isJavaCall(Call call) {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2020, 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
@@ -27,7 +27,8 @@

import java.util.List;

import jdk.vm.ci.code.site.Mark;
import org.graalvm.compiler.code.CompilationResult;
import org.graalvm.compiler.hotspot.HotSpotMarkId;

final class CodeOffsets {
private final int entry;
@@ -42,34 +43,32 @@ private CodeOffsets(int entry, int verifiedEntry, int exceptionHandler, int deop
this.deoptHandler = deoptHandler;
}

static CodeOffsets buildFrom(List<Mark> marks) {
static CodeOffsets buildFrom(List<CompilationResult.CodeMark> marks) {
int entry = 0;
int verifiedEntry = 0;
int exceptionHandler = -1;
int deoptHandler = -1;

for (Mark mark : marks) {
if (mark.id instanceof Integer) {
MarkId markId = MarkId.getEnum((int) mark.id);
switch (markId) {
case UNVERIFIED_ENTRY:
entry = mark.pcOffset;
break;
case VERIFIED_ENTRY:
verifiedEntry = mark.pcOffset;
break;
case OSR_ENTRY:
// Unhandled
break;
case EXCEPTION_HANDLER_ENTRY:
exceptionHandler = mark.pcOffset;
break;
case DEOPT_HANDLER_ENTRY:
deoptHandler = mark.pcOffset;
break;
default:
break; // Ignore others
}
for (CompilationResult.CodeMark mark : marks) {
HotSpotMarkId markId = (HotSpotMarkId) mark.id;
switch (markId) {
case UNVERIFIED_ENTRY:
entry = mark.pcOffset;
break;
case VERIFIED_ENTRY:
verifiedEntry = mark.pcOffset;
break;
case OSR_ENTRY:
// Unhandled
break;
case EXCEPTION_HANDLER_ENTRY:
exceptionHandler = mark.pcOffset;
break;
case DEOPT_HANDLER_ENTRY:
deoptHandler = mark.pcOffset;
break;
default:
break; // Ignore others
}
}
return new CodeOffsets(entry, verifiedEntry, exceptionHandler, deoptHandler);
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2020, 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
@@ -25,17 +25,17 @@

package jdk.tools.jaotc;

import java.util.concurrent.atomic.AtomicInteger;
import java.util.HashMap;
import java.util.HashSet;
import java.util.concurrent.atomic.AtomicInteger;

import jdk.tools.jaotc.binformat.BinaryContainer;
import jdk.tools.jaotc.binformat.ReadOnlyDataContainer;
import jdk.tools.jaotc.AOTCompiledClass.AOTKlassData;
import org.graalvm.compiler.code.CompilationResult;
import org.graalvm.compiler.hotspot.HotSpotMarkId;

import jdk.vm.ci.code.site.Mark;
import jdk.vm.ci.code.site.Site;
import jdk.tools.jaotc.AOTCompiledClass.AOTKlassData;
import jdk.tools.jaotc.binformat.BinaryContainer;
import jdk.tools.jaotc.binformat.ReadOnlyDataContainer;
import jdk.vm.ci.code.site.Call;
import jdk.vm.ci.hotspot.HotSpotCompiledCode;
import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;

@@ -306,23 +306,11 @@ AOTKlassData getDependentKlassData(HotSpotResolvedObjectType type) {
return null;
}

boolean hasMark(Site call, MarkId id) {
for (Mark m : compilationResult.getMarks()) {
int adjOffset = m.pcOffset;
if (archStr.equals("aarch64")) {
// The mark is at the end of a group of three instructions:
// adrp; add; ldr
adjOffset += 12;
} else {
// X64-specific code.
// Call instructions are aligned to 8
// bytes - 1 on x86 to patch address atomically,
adjOffset = (adjOffset & (-8)) + 7;
}
// Mark points before aligning nops.
if ((call.pcOffset == adjOffset) && MarkId.getEnum((int) m.id) == id) {
return true;
}
boolean hasMark(Call call, HotSpotMarkId id) {
assert id == HotSpotMarkId.INVOKESTATIC || id == HotSpotMarkId.INVOKESPECIAL;
CompilationResult.CodeMark mark = compilationResult.getAssociatedMark(call);
if (mark != null) {
return mark.id == id;
}
return false;
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2020, 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
@@ -25,6 +25,8 @@

package jdk.tools.jaotc;

import org.graalvm.compiler.hotspot.HotSpotMarkId;

import jdk.tools.jaotc.binformat.BinaryContainer;
import jdk.tools.jaotc.binformat.Symbol;
import jdk.vm.ci.code.site.Call;
@@ -136,7 +138,7 @@ private static void addRelocations(CompiledMethodInfo mi, StubInformation stub,
private static String getResolveSymbolName(CompiledMethodInfo mi, Call call) {
String resolveSymbolName;
if (CallInfo.isStaticCall(call)) {
assert mi.hasMark(call, MarkId.INVOKESTATIC);
assert mi.hasMark(call, HotSpotMarkId.INVOKESTATIC);
resolveSymbolName = BinaryContainer.getResolveStaticEntrySymbolName();
} else if (CallInfo.isSpecialCall(call)) {
resolveSymbolName = BinaryContainer.getResolveOptVirtualEntrySymbolName();
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2020, 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
@@ -31,6 +31,8 @@

import java.io.IOException;
import java.io.PrintWriter;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collections;
@@ -39,13 +41,12 @@
import java.util.Set;
import java.util.StringTokenizer;
import java.util.stream.Stream;
import java.nio.file.Files;
import java.nio.file.Paths;

import org.graalvm.compiler.api.replacements.SnippetReflectionProvider;
import org.graalvm.compiler.api.runtime.GraalJVMCICompiler;
import org.graalvm.compiler.debug.DebugContext;
import org.graalvm.compiler.debug.DebugContext.Activation;
import org.graalvm.compiler.debug.DebugContext.Builder;
import org.graalvm.compiler.hotspot.CompilerConfigurationFactory;
import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig;
import org.graalvm.compiler.hotspot.HotSpotGraalCompilerFactory;
@@ -232,12 +233,12 @@ public boolean supportsDynamicInvoke(GraphBuilderContext builder, int index, int
// The GC names are spelled the same in both enums, so no clever remapping is needed
// here.
String name = "CollectedHeap::" + graalGC.name();
int gc = graalHotSpotVMConfig.getConstant(name, Integer.class, def);
int gc = graalHotSpotVMConfig.getConstant(name, Integer.class, def, true);

BinaryContainer binaryContainer = new BinaryContainer(graalOptions, graalHotSpotVMConfig, graphBuilderConfig, gc, JVM_VERSION);
DataBuilder dataBuilder = new DataBuilder(this, backend, classes, binaryContainer);

try (DebugContext debug = DebugContext.create(graalOptions, new GraalDebugHandlersFactory(snippetReflection)); Activation a = debug.activate()) {
try (DebugContext debug = new Builder(graalOptions, new GraalDebugHandlersFactory(snippetReflection)).build(); Activation a = debug.activate()) {
dataBuilder.prepareData(debug);
}

This file was deleted.

0 comments on commit 6c3bc71

Please sign in to comment.