Skip to content

Commit

Permalink
Merge branch 'master' into feature/GR-4740
Browse files Browse the repository at this point in the history
  • Loading branch information
tzezula committed Dec 11, 2017
2 parents 25d2af6 + ef98649 commit 9ac9834
Show file tree
Hide file tree
Showing 160 changed files with 6,146 additions and 1,614 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jdk:

env:
global:
- JVMCI_VERSION="jvmci-0.38"
- JVMCI_VERSION="jvmci-0.39"
- JVMCI_BASE_JDK8="openjdk1.8.0_141"
matrix:
- JDK="jdk8" GATE="style,fullbuild"
Expand Down
6 changes: 3 additions & 3 deletions common.hocon
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# overlay version
overlay = e2bd133045fa760a959f96fc488b86f6bc522603
overlay = f2554316d2af2c35dbfb95cc17a9cf5bdf35b3a7

# labsjdk* are JDKs based on OracleJDK binaries
# openjdk* are JDKs based on OpenJDK binaries
jdks: {
labsjdk8 : {name : labsjdk, version : "8u151-jvmci-0.38", platformspecific: true}
labsjdk8 : {name : labsjdk, version : "8u151-jvmci-0.39", platformspecific: true}
labsjdk9 : {name : labsjdk, version : "9+181", platformspecific: true}
labsjdk8Debug : {name : labsjdk, version : "8u151-jvmci-0.38-fastdebug", platformspecific: true}
labsjdk8Debug : {name : labsjdk, version : "8u151-jvmci-0.39-fastdebug", platformspecific: true}
}

# Overlay placeholder for pinning mx to a specific revision
Expand Down
3 changes: 2 additions & 1 deletion compiler/mx.compiler/mx_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ def compiler_gate_runner(suites, unit_test_runs, bootstrap_tests, tasks, extraVM
xcompTests = [
'BlackholeDirectiveTest',
'OpaqueDirectiveTest',
'CompiledMethodTest',
'ControlFlowAnchorDirectiveTest',
'ConditionalElimination',
'MarkUnsafeAccessTest',
Expand Down Expand Up @@ -581,7 +582,7 @@ def compiler_gate_runner(suites, unit_test_runs, bootstrap_tests, tasks, extraVM
_registers = 'o0,o1,o2,o3,f8,f9,d32,d34' if mx.get_arch() == 'sparcv9' else 'rbx,r11,r10,r14,xmm3,xmm11,xmm14'

_defaultFlags = ['-Dgraal.CompilationWatchDogStartDelay=60.0D']
_assertionFlags = ['-esa']
_assertionFlags = ['-esa', '-Dgraal.DetailedAsserts=true']
_graalErrorFlags = ['-Dgraal.CompilationFailureAction=ExitVM']
_graalEconomyFlags = ['-Dgraal.CompilerConfiguration=economy']
_verificationFlags = ['-Dgraal.VerifyGraalGraphs=true', '-Dgraal.VerifyGraalGraphEdges=true', '-Dgraal.VerifyGraalPhasesSize=true', '-Dgraal.VerifyPhases=true']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public LIRKind getWordKind() {

@Override
public LIRKind getNarrowOopKind() {
return LIRKind.reference(AArch64Kind.DWORD);
return LIRKind.compressedReference(AArch64Kind.DWORD);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@

/**
* Represents the type of values in the LIR. It is composed of a {@link PlatformKind} that gives the
* low level representation of the value, and a {@link #referenceMask} that describes the location
* of object references in the value, and optionally a {@link #derivedReferenceBase}.
* low level representation of the value, a {@link #referenceMask} that describes the location of
* object references in the value, a {@link #referenceCompressionMask} that indicates which of these
* references are compressed references, and for derived references a {@link #derivedReferenceBase}.
*
* <h2>Constructing {@link LIRKind} instances</h2>
*
Expand All @@ -52,7 +53,7 @@
* compare-and-swap. For convert operations, {@link LIRKind#combine} should be used.
* <p>
* If it is known that the result will be a reference (e.g. pointer arithmetic where the end result
* is a valid oop), {@link LIRKind#reference} should be used.
* is a valid oop), {@link #reference} or {@link LIRKind#compressedReference} should be used.
* <p>
* If it is known that the result will neither be a reference nor be derived from a reference,
* {@link LIRKind#value} can be used. If the operation producing this value has inputs, this is very
Expand All @@ -64,19 +65,28 @@
*/
public final class LIRKind extends ValueKind<LIRKind> {

/**
* The location of object references in the value. If the value is a vector type, each bit
* represents one component of the vector.
*/
private final int referenceMask;

/** Mask with 1-bits indicating which references in {@link #referenceMask} are compressed. */
private final int referenceCompressionMask;

private AllocatableValue derivedReferenceBase;

private static final int UNKNOWN_REFERENCE = -1;

public static final LIRKind Illegal = unknownReference(ValueKind.Illegal.getPlatformKind());

private LIRKind(PlatformKind platformKind, int referenceMask, AllocatableValue derivedReferenceBase) {
private LIRKind(PlatformKind platformKind, int referenceMask, int referenceCompressionMask, AllocatableValue derivedReferenceBase) {
super(platformKind);
this.referenceMask = referenceMask;
this.referenceCompressionMask = referenceCompressionMask;
this.derivedReferenceBase = derivedReferenceBase;

assert this.referenceCompressionMask == 0 || this.referenceMask == this.referenceCompressionMask : "mixing compressed and uncompressed references is untested";
assert derivedReferenceBase == null || !derivedReferenceBase.getValueKind(LIRKind.class).isDerivedReference() : "derived reference can't have another derived reference as base";
}

Expand All @@ -86,15 +96,23 @@ private LIRKind(PlatformKind platformKind, int referenceMask, AllocatableValue d
* reference. Otherwise, {@link #combine(Value...)} should be used instead.
*/
public static LIRKind value(PlatformKind platformKind) {
return new LIRKind(platformKind, 0, null);
return new LIRKind(platformKind, 0, 0, null);
}

/**
* Create a {@link LIRKind} of type {@code platformKind} that contains a single tracked oop
* reference.
* Create a {@link LIRKind} of type {@code platformKind} that contains a single, tracked,
* uncompressed oop reference.
*/
public static LIRKind reference(PlatformKind platformKind) {
return derivedReference(platformKind, null);
return derivedReference(platformKind, null, false);
}

/**
* Create a {@link LIRKind} of type {@code platformKind} that contains a single, tracked,
* compressed oop reference.
*/
public static LIRKind compressedReference(PlatformKind platformKind) {
return derivedReference(platformKind, null, true);
}

/**
Expand All @@ -112,10 +130,12 @@ public static LIRKind fromJavaKind(Architecture arch, JavaKind javaKind) {
/**
* Create a {@link LIRKind} of type {@code platformKind} that contains a derived reference.
*/
public static LIRKind derivedReference(PlatformKind platformKind, AllocatableValue base) {
public static LIRKind derivedReference(PlatformKind platformKind, AllocatableValue base, boolean compressed) {
int length = platformKind.getVectorLength();
assert 0 < length && length < 32 : "vector of " + length + " references not supported";
return new LIRKind(platformKind, (1 << length) - 1, base);
int referenceMask = (1 << length) - 1;
int referenceCompressionMask = (compressed ? referenceMask : 0);
return new LIRKind(platformKind, referenceMask, referenceCompressionMask, base);
}

/**
Expand All @@ -125,7 +145,7 @@ public static LIRKind derivedReference(PlatformKind platformKind, AllocatableVal
* used instead to automatically propagate this information.
*/
public static LIRKind unknownReference(PlatformKind platformKind) {
return new LIRKind(platformKind, UNKNOWN_REFERENCE, null);
return new LIRKind(platformKind, UNKNOWN_REFERENCE, UNKNOWN_REFERENCE, null);
}

/**
Expand All @@ -139,9 +159,9 @@ public LIRKind makeDerivedReference(AllocatableValue base) {
return makeUnknownReference();
} else {
if (isValue()) {
return derivedReference(getPlatformKind(), base);
return derivedReference(getPlatformKind(), base, false);
} else {
return new LIRKind(getPlatformKind(), referenceMask, base);
return new LIRKind(getPlatformKind(), referenceMask, referenceCompressionMask, base);
}
}
}
Expand Down Expand Up @@ -240,7 +260,7 @@ public static LIRKind mergeReferenceInformation(LIRKind mergeKind, LIRKind input
return mergeKind;
}
/* {@code mergeKind} is a reference. */
if (mergeKind.referenceMask != inputKind.referenceMask) {
if (mergeKind.referenceMask != inputKind.referenceMask || mergeKind.referenceCompressionMask != inputKind.referenceCompressionMask) {
/*
* Reference masks do not match so the result can only be an unknown reference.
*/
Expand Down Expand Up @@ -284,9 +304,11 @@ public LIRKind changeType(PlatformKind newPlatformKind) {
} else {
// reference type
int newLength = Math.min(32, newPlatformKind.getVectorLength());
int newReferenceMask = referenceMask & (0xFFFFFFFF >>> (32 - newLength));
int lengthMask = 0xFFFFFFFF >>> (32 - newLength);
int newReferenceMask = referenceMask & lengthMask;
int newReferenceCompressionMask = referenceCompressionMask & lengthMask;
assert newReferenceMask != UNKNOWN_REFERENCE;
return new LIRKind(newPlatformKind, newReferenceMask, derivedReferenceBase);
return new LIRKind(newPlatformKind, newReferenceMask, newReferenceCompressionMask, derivedReferenceBase);
}
}

Expand All @@ -308,12 +330,14 @@ public LIRKind repeat(PlatformKind newPlatformKind) {

// repeat reference mask to fill new kind
int newReferenceMask = 0;
int newReferenceCompressionMask = 0;
for (int i = 0; i < newLength; i += getPlatformKind().getVectorLength()) {
newReferenceMask |= referenceMask << i;
newReferenceCompressionMask |= referenceCompressionMask << i;
}

assert newReferenceMask != UNKNOWN_REFERENCE;
return new LIRKind(newPlatformKind, newReferenceMask, derivedReferenceBase);
return new LIRKind(newPlatformKind, newReferenceMask, newReferenceCompressionMask, derivedReferenceBase);
}
}

Expand All @@ -322,7 +346,7 @@ public LIRKind repeat(PlatformKind newPlatformKind) {
* {@link LIRKind#unknownReference}.
*/
public LIRKind makeUnknownReference() {
return new LIRKind(getPlatformKind(), UNKNOWN_REFERENCE, null);
return new LIRKind(getPlatformKind(), UNKNOWN_REFERENCE, UNKNOWN_REFERENCE, null);
}

/**
Expand Down Expand Up @@ -384,6 +408,17 @@ public boolean isReference(int idx) {
return !isUnknownReference() && (referenceMask & 1 << idx) != 0;
}

/**
* Check whether the {@code idx}th part of this value is a <b>compressed</b> reference.
*
* @param idx The index into the vector if this is a vector kind. Must be 0 if this is a scalar
* kind.
*/
public boolean isCompressedReference(int idx) {
assert 0 <= idx && idx < getPlatformKind().getVectorLength() : "invalid index " + idx + " in " + this;
return !isUnknownReference() && (referenceCompressionMask & (1 << idx)) != 0;
}

/**
* Check whether this kind is a value type that doesn't need to be tracked at safepoints.
*/
Expand Down Expand Up @@ -432,6 +467,7 @@ public int hashCode() {
result = prime * result + ((getPlatformKind() == null) ? 0 : getPlatformKind().hashCode());
result = prime * result + ((getDerivedReferenceBase() == null) ? 0 : getDerivedReferenceBase().hashCode());
result = prime * result + referenceMask;
result = prime * result + referenceCompressionMask;
return result;
}

Expand All @@ -445,7 +481,7 @@ public boolean equals(Object obj) {
}

LIRKind other = (LIRKind) obj;
if (getPlatformKind() != other.getPlatformKind() || referenceMask != other.referenceMask) {
if (getPlatformKind() != other.getPlatformKind() || referenceMask != other.referenceMask || referenceCompressionMask != other.referenceCompressionMask) {
return false;
}
if (isDerivedReference()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,16 +296,28 @@ public static StampPair forDeclaredType(Assumptions assumptions, JavaType return
if (returnType.getJavaKind() == JavaKind.Object && returnType instanceof ResolvedJavaType) {
ResolvedJavaType resolvedJavaType = (ResolvedJavaType) returnType;
TypeReference reference = TypeReference.create(assumptions, resolvedJavaType);
if (resolvedJavaType.isInterface()) {
ResolvedJavaType implementor = resolvedJavaType.getSingleImplementor();
if (implementor != null && !resolvedJavaType.equals(implementor)) {
TypeReference uncheckedType = TypeReference.createTrusted(assumptions, implementor);
return StampPair.create(StampFactory.object(reference, nonNull), StampFactory.object(uncheckedType, nonNull));
ResolvedJavaType elementalType = resolvedJavaType.getElementalType();
if (elementalType.isInterface()) {
assert reference == null || !reference.getType().equals(resolvedJavaType);
TypeReference uncheckedType;
ResolvedJavaType elementalImplementor = elementalType.getSingleImplementor();
if (elementalImplementor != null && !elementalType.equals(elementalImplementor)) {
ResolvedJavaType implementor = elementalImplementor;
ResolvedJavaType t = resolvedJavaType;
while (t.isArray()) {
implementor = implementor.getArrayClass();
t = t.getComponentType();
}
uncheckedType = TypeReference.createTrusted(assumptions, implementor);
} else {
uncheckedType = TypeReference.createTrusted(assumptions, resolvedJavaType);
}
return StampPair.create(StampFactory.object(reference, nonNull), StampFactory.object(uncheckedType, nonNull));
}
return StampPair.createSingle(StampFactory.object(reference, nonNull));
} else {
return StampPair.createSingle(StampFactory.forKind(returnType.getJavaKind()));
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
*/
package org.graalvm.compiler.core.common.util;

import org.graalvm.compiler.debug.Assertions;
import org.graalvm.compiler.options.Option;
import org.graalvm.compiler.options.OptionKey;
import org.graalvm.compiler.options.OptionType;
Expand All @@ -34,7 +35,8 @@ public final class CompilationAlarm implements AutoCloseable {

public static class Options {
// @formatter:off
@Option(help = "Time limit in seconds before a compilation expires (0 to disable the limit).", type = OptionType.Debug)
@Option(help = "Time limit in seconds before a compilation expires (0 to disable the limit). " +
"The compilation alarm will be implicitly disabled if assertions are enabled.", type = OptionType.Debug)
public static final OptionKey<Integer> CompilationExpirationPeriod = new OptionKey<>(300);
// @formatter:on
}
Expand Down Expand Up @@ -85,15 +87,16 @@ public void close() {

/**
* Starts an alarm for setting a time limit on a compilation if there isn't already an active
* alarm and {@link CompilationAlarm.Options#CompilationExpirationPeriod}{@code > 0}. The
* returned value can be used in a try-with-resource statement to disable the alarm once the
* compilation is finished.
* alarm, if assertions are disabled and
* {@link CompilationAlarm.Options#CompilationExpirationPeriod}{@code > 0}. The returned value
* can be used in a try-with-resource statement to disable the alarm once the compilation is
* finished.
*
* @return a {@link CompilationAlarm} if there was no current alarm for the calling thread
* before this call otherwise {@code null}
*/
public static CompilationAlarm trackCompilationPeriod(OptionValues options) {
int period = Options.CompilationExpirationPeriod.getValue(options);
int period = Assertions.assertionsEnabled() ? 0 : Options.CompilationExpirationPeriod.getValue(options);
if (period > 0) {
CompilationAlarm current = currentAlarm.get();
if (current == null) {
Expand All @@ -105,4 +108,5 @@ public static CompilationAlarm trackCompilationPeriod(OptionValues options) {
}
return null;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public LIRKind getWordKind() {

@Override
public LIRKind getNarrowOopKind() {
return LIRKind.reference(SPARCKind.WORD);
return LIRKind.compressedReference(SPARCKind.WORD);
}

@Override
Expand Down
Loading

0 comments on commit 9ac9834

Please sign in to comment.