Skip to content
This repository has been archived by the owner on Aug 27, 2022. It is now read-only.
/ lanai Public archive

Commit

Permalink
8243380: Update Graal
Browse files Browse the repository at this point in the history
Reviewed-by: kvn
  • Loading branch information
dean-long committed Jun 5, 2020
1 parent 0963050 commit 6c3bc71
Show file tree
Hide file tree
Showing 513 changed files with 14,057 additions and 6,329 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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<>();
Expand Down Expand Up @@ -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";
}
Expand Down Expand Up @@ -508,6 +512,7 @@ private void addGlobalSymbols() {
createGotSymbol(getHeapEndAddressSymbolName());
createGotSymbol(getNarrowKlassBaseAddressSymbolName());
createGotSymbol(getNarrowOopBaseAddressSymbolName());
createGotSymbol(getPollingPageSymbolName());
createGotSymbol(getLogOfHeapRegionGrainBytesSymbolName());
createGotSymbol(getInlineContiguousAllocationSupportedSymbolName());

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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;

Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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);
}

Expand Down

This file was deleted.

Loading

0 comments on commit 6c3bc71

Please sign in to comment.