# HG changeset patch # User Roland Schatz # Date 1441732036 -7200 # Node ID dc1aeef79e7e7387aceebb84ae677a55ce626b82 # Parent ca418f35d728634b8fdb494df9817849128bfcc3 Refactoring: Rename Kind to JavaKind. diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.amd64/src/jdk/internal/jvmci/amd64/AMD64.java --- a/jvmci/jdk.internal.jvmci.amd64/src/jdk/internal/jvmci/amd64/AMD64.java Tue Sep 08 17:43:41 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.amd64/src/jdk/internal/jvmci/amd64/AMD64.java Tue Sep 08 19:07:16 2015 +0200 @@ -149,7 +149,7 @@ private final EnumSet flags; public AMD64(EnumSet features, EnumSet flags) { - super("AMD64", Kind.Long, ByteOrder.LITTLE_ENDIAN, true, allRegisters, LOAD_STORE | STORE_STORE, 1, cpuRegisters.length + (xmmRegisters.length << XMM_REFERENCE_MAP_SHIFT), 8); + super("AMD64", JavaKind.Long, ByteOrder.LITTLE_ENDIAN, true, allRegisters, LOAD_STORE | STORE_STORE, 1, cpuRegisters.length + (xmmRegisters.length << XMM_REFERENCE_MAP_SHIFT), 8); this.features = features; this.flags = flags; assert features.contains(CPUFeature.SSE2) : "minimum config for x64"; @@ -164,7 +164,7 @@ } @Override - public PlatformKind getPlatformKind(Kind javaKind) { + public PlatformKind getPlatformKind(JavaKind javaKind) { if (javaKind.isObject()) { return getWordKind(); } else { @@ -174,11 +174,11 @@ @Override public boolean canStoreValue(RegisterCategory category, PlatformKind platformKind) { - if (!(platformKind instanceof Kind)) { + if (!(platformKind instanceof JavaKind)) { return false; } - Kind kind = (Kind) platformKind; + JavaKind kind = (JavaKind) platformKind; if (category.equals(CPU)) { switch (kind) { case Boolean: @@ -203,11 +203,11 @@ @Override public PlatformKind getLargestStorableKind(RegisterCategory category) { if (category.equals(CPU)) { - return Kind.Long; + return JavaKind.Long; } else if (category.equals(XMM)) { - return Kind.Double; + return JavaKind.Double; } else { - return Kind.Illegal; + return JavaKind.Illegal; } } } diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/Architecture.java --- a/jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/Architecture.java Tue Sep 08 17:43:41 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/Architecture.java Tue Sep 08 19:07:16 2015 +0200 @@ -192,9 +192,9 @@ public abstract PlatformKind getLargestStorableKind(RegisterCategory category); /** - * Return the {@link PlatformKind} that is used to store Java values of a given {@link Kind}. + * Return the {@link PlatformKind} that is used to store values of a given {@link JavaKind}. */ - public abstract PlatformKind getPlatformKind(Kind javaKind); + public abstract PlatformKind getPlatformKind(JavaKind javaKind); @Override public final boolean equals(Object obj) { diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/BytecodeFrame.java --- a/jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/BytecodeFrame.java Tue Sep 08 17:43:41 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/BytecodeFrame.java Tue Sep 08 19:07:16 2015 +0200 @@ -69,7 +69,7 @@ * An array describing the Java kind of the {@link #values}. It records a kind for the locals * and the operand stack. */ - public final Kind[] slotKinds; + public final JavaKind[] slotKinds; /** * The number of locals in the values array. @@ -175,7 +175,7 @@ * @param numStack the depth of the stack * @param numLocks the number of locked objects */ - public BytecodeFrame(BytecodeFrame caller, ResolvedJavaMethod method, int bci, boolean rethrowException, boolean duringCall, JavaValue[] values, Kind[] slotKinds, int numLocals, int numStack, + public BytecodeFrame(BytecodeFrame caller, ResolvedJavaMethod method, int bci, boolean rethrowException, boolean duringCall, JavaValue[] values, JavaKind[] slotKinds, int numLocals, int numStack, int numLocks) { super(caller, method, bci); assert values != null; @@ -200,10 +200,10 @@ } for (int i = 0; i < numLocals + numStack; i++) { if (values[i] != null) { - Kind kind = slotKinds[i]; + JavaKind kind = slotKinds[i]; if (kind.needsTwoSlots()) { assert slotKinds.length > i + 1 : String.format("missing second word %s", this); - assert slotKinds[i + 1] == Kind.Illegal : this; + assert slotKinds[i + 1] == JavaKind.Illegal : this; } } } diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/Register.java --- a/jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/Register.java Tue Sep 08 17:43:41 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/Register.java Tue Sep 08 19:07:16 2015 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2015, 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 @@ -157,7 +157,7 @@ /** * Gets this register as a {@linkplain RegisterValue value} with no particular kind. * - * @return a {@link RegisterValue} with {@link Kind#Illegal} kind. + * @return a {@link RegisterValue} with {@link JavaKind#Illegal} kind. */ public RegisterValue asValue() { return asValue(LIRKind.Illegal); diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/RegisterConfig.java --- a/jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/RegisterConfig.java Tue Sep 08 17:43:41 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/RegisterConfig.java Tue Sep 08 19:07:16 2015 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2015, 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 @@ -34,7 +34,7 @@ /** * Gets the register to be used for returning a value of a given kind. */ - Register getReturnRegister(Kind kind); + Register getReturnRegister(JavaKind kind); /** * Gets the maximum allowed size of the frame. @@ -68,7 +68,7 @@ * @return the ordered set of registers that may be used to pass parameters in a call conforming * to {@code type} */ - Register[] getCallingConventionRegisters(Type type, Kind kind); + Register[] getCallingConventionRegisters(Type type, JavaKind kind); /** * Gets the set of all registers that might be used by the register allocator. diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/RegisterValue.java --- a/jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/RegisterValue.java Tue Sep 08 17:43:41 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/RegisterValue.java Tue Sep 08 19:07:16 2015 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2015, 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 @@ -26,7 +26,7 @@ /** * Denotes a register that stores a value of a fixed kind. There is exactly one (canonical) instance - * of {@link RegisterValue} for each ({@link Register}, {@link Kind}) pair. Use + * of {@link RegisterValue} for each ({@link Register}, {@link JavaKind}) pair. Use * {@link Register#asValue(LIRKind)} to retrieve the canonical {@link RegisterValue} instance for a * given (register,kind) pair. */ diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/TargetDescription.java --- a/jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/TargetDescription.java Tue Sep 08 17:43:41 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.code/src/jdk/internal/jvmci/code/TargetDescription.java Tue Sep 08 19:07:16 2015 +0200 @@ -51,7 +51,7 @@ /** * The kind to be used for representing raw pointers and CPU registers. */ - public final Kind wordKind; + public final JavaKind wordKind; /** * The stack alignment requirement of the platform. For example, from Appendix D of javaClass) { if (javaClass.isPrimitive()) { - Kind kind = Kind.fromJavaClass(javaClass); + JavaKind kind = JavaKind.fromJavaClass(javaClass); return new HotSpotResolvedPrimitiveType(kind); } else { return new HotSpotResolvedObjectTypeImpl(javaClass, this); diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotJVMCIRuntime.java --- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotJVMCIRuntime.java Tue Sep 08 17:43:41 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotJVMCIRuntime.java Tue Sep 08 19:07:16 2015 +0200 @@ -118,7 +118,7 @@ /** * Gets the kind of a word value on the {@linkplain #getHostJVMCIBackend() host} backend. */ - public static Kind getHostWordKind() { + public static JavaKind getHostWordKind() { return runtime().getHostJVMCIBackend().getCodeCache().getTarget().wordKind; } @@ -200,7 +200,7 @@ Objects.requireNonNull(accessingType, "cannot resolve type without an accessing class"); // If the name represents a primitive type we can short-circuit the lookup. if (name.length() == 1) { - Kind kind = Kind.fromPrimitiveOrVoidTypeChar(name.charAt(0)); + JavaKind kind = JavaKind.fromPrimitiveOrVoidTypeChar(name.charAt(0)); return fromClass(kind.toJavaClass()); } diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotJVMCIRuntimeProvider.java --- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotJVMCIRuntimeProvider.java Tue Sep 08 17:43:41 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotJVMCIRuntimeProvider.java Tue Sep 08 19:07:16 2015 +0200 @@ -70,7 +70,7 @@ * * @return the offset in bytes */ - default int getArrayBaseOffset(Kind kind) { + default int getArrayBaseOffset(JavaKind kind) { switch (kind) { case Boolean: return Unsafe.ARRAY_BOOLEAN_BASE_OFFSET; @@ -100,7 +100,7 @@ * * @return the scale in order to convert the index into a byte offset */ - default int getArrayIndexScale(Kind kind) { + default int getArrayIndexScale(JavaKind kind) { switch (kind) { case Boolean: return Unsafe.ARRAY_BOOLEAN_INDEX_SCALE; diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotMemoryAccessProviderImpl.java --- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotMemoryAccessProviderImpl.java Tue Sep 08 17:43:41 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotMemoryAccessProviderImpl.java Tue Sep 08 19:07:16 2015 +0200 @@ -70,7 +70,7 @@ return ((HotSpotMetaspaceConstant) base).rawValue(); } else if (base instanceof PrimitiveConstant) { PrimitiveConstant prim = (PrimitiveConstant) base; - if (prim.getKind().isNumericInteger()) { + if (prim.getJavaKind().isNumericInteger()) { return prim.asLong(); } } @@ -147,8 +147,8 @@ } @Override - public JavaConstant readUnsafeConstant(Kind kind, JavaConstant baseConstant, long displacement) { - if (kind == Kind.Object) { + public JavaConstant readUnsafeConstant(JavaKind kind, JavaConstant baseConstant, long displacement) { + if (kind == JavaKind.Object) { Object o = readRawObject(baseConstant, displacement, runtime.getConfig().useCompressedOops); return HotSpotObjectConstantImpl.forObject(o); } else { @@ -157,7 +157,7 @@ } @Override - public JavaConstant readPrimitiveConstant(Kind kind, Constant baseConstant, long initialDisplacement, int bits) { + public JavaConstant readPrimitiveConstant(JavaKind kind, Constant baseConstant, long initialDisplacement, int bits) { try { long rawValue = readRawValue(baseConstant, initialDisplacement, bits); switch (kind) { @@ -221,7 +221,7 @@ if (klass == null) { return HotSpotCompressedNullConstant.COMPRESSED_NULL; } - return HotSpotMetaspaceConstantImpl.forMetaspaceObject(Kind.Int, encoding.compress(klass.getMetaspaceKlass()), klass, true); + return HotSpotMetaspaceConstantImpl.forMetaspaceObject(JavaKind.Int, encoding.compress(klass.getMetaspaceKlass()), klass, true); } @Override diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotMetaAccessProvider.java --- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotMetaAccessProvider.java Tue Sep 08 17:43:41 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotMetaAccessProvider.java Tue Sep 08 19:07:16 2015 +0200 @@ -281,7 +281,7 @@ @Override public long getMemorySize(JavaConstant constant) { - if (constant.getKind() == Kind.Object) { + if (constant.getJavaKind() == JavaKind.Object) { HotSpotResolvedObjectType lookupJavaType = lookupJavaType(constant); if (lookupJavaType == null) { @@ -291,7 +291,7 @@ // TODO(tw): Add compressed pointer support. int length = Array.getLength(((HotSpotObjectConstantImpl) constant).object()); ResolvedJavaType elementType = lookupJavaType.getComponentType(); - Kind elementKind = elementType.getKind(); + JavaKind elementKind = elementType.getJavaKind(); final int headerSize = runtime.getArrayBaseOffset(elementKind); TargetDescription target = runtime.getHostJVMCIBackend().getTarget(); int sizeOfElement = target.getSizeInBytes(elementKind); @@ -302,7 +302,7 @@ return lookupJavaType.instanceSize(); } } else { - return constant.getKind().getByteCount(); + return constant.getJavaKind().getByteCount(); } } diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotMetaspaceConstantImpl.java --- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotMetaspaceConstantImpl.java Tue Sep 08 17:43:41 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotMetaspaceConstantImpl.java Tue Sep 08 19:07:16 2015 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, 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 @@ -29,7 +29,7 @@ public final class HotSpotMetaspaceConstantImpl extends PrimitiveConstant implements HotSpotMetaspaceConstant, VMConstant, HotSpotProxified { - static HotSpotMetaspaceConstantImpl forMetaspaceObject(Kind kind, long primitive, Object metaspaceObject, boolean compressed) { + static HotSpotMetaspaceConstantImpl forMetaspaceObject(JavaKind kind, long primitive, Object metaspaceObject, boolean compressed) { return new HotSpotMetaspaceConstantImpl(kind, primitive, metaspaceObject, compressed); } @@ -40,7 +40,7 @@ private final Object metaspaceObject; private final boolean compressed; - private HotSpotMetaspaceConstantImpl(Kind kind, long primitive, Object metaspaceObject, boolean compressed) { + private HotSpotMetaspaceConstantImpl(JavaKind kind, long primitive, Object metaspaceObject, boolean compressed) { super(kind, primitive); this.metaspaceObject = metaspaceObject; this.compressed = compressed; @@ -67,14 +67,14 @@ public JavaConstant compress(CompressEncoding encoding) { assert !isCompressed(); - HotSpotMetaspaceConstantImpl res = HotSpotMetaspaceConstantImpl.forMetaspaceObject(Kind.Int, encoding.compress(asLong()), metaspaceObject, true); + HotSpotMetaspaceConstantImpl res = HotSpotMetaspaceConstantImpl.forMetaspaceObject(JavaKind.Int, encoding.compress(asLong()), metaspaceObject, true); assert res.isCompressed(); return res; } public JavaConstant uncompress(CompressEncoding encoding) { assert isCompressed(); - HotSpotMetaspaceConstantImpl res = HotSpotMetaspaceConstantImpl.forMetaspaceObject(Kind.Long, encoding.uncompress(asInt()), metaspaceObject, false); + HotSpotMetaspaceConstantImpl res = HotSpotMetaspaceConstantImpl.forMetaspaceObject(JavaKind.Long, encoding.uncompress(asInt()), metaspaceObject, false); assert !res.isCompressed(); return res; } diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotNmethod.java --- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotNmethod.java Tue Sep 08 17:43:41 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotNmethod.java Tue Sep 08 19:07:16 2015 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -81,9 +81,9 @@ protected boolean checkThreeObjectArgs() { assert method.getSignature().getParameterCount(!method.isStatic()) == 3; - assert method.getSignature().getParameterKind(0) == Kind.Object; - assert method.getSignature().getParameterKind(1) == Kind.Object; - assert !method.isStatic() || method.getSignature().getParameterKind(2) == Kind.Object; + assert method.getSignature().getParameterKind(0) == JavaKind.Object; + assert method.getSignature().getParameterKind(1) == JavaKind.Object; + assert !method.isStatic() || method.getSignature().getParameterKind(2) == JavaKind.Object; return true; } @@ -93,9 +93,9 @@ for (int i = 0; i < sig.length; i++) { Object arg = args[i]; if (arg == null) { - assert sig[i].getKind() == Kind.Object : method.format("%H.%n(%p): expected arg ") + i + " to be Object, not " + sig[i]; - } else if (sig[i].getKind() != Kind.Object) { - assert sig[i].getKind().toBoxedJavaClass() == arg.getClass() : method.format("%H.%n(%p): expected arg ") + i + " to be " + sig[i] + ", not " + arg.getClass(); + assert sig[i].getJavaKind() == JavaKind.Object : method.format("%H.%n(%p): expected arg ") + i + " to be Object, not " + sig[i]; + } else if (sig[i].getJavaKind() != JavaKind.Object) { + assert sig[i].getJavaKind().toBoxedJavaClass() == arg.getClass() : method.format("%H.%n(%p): expected arg ") + i + " to be " + sig[i] + ", not " + arg.getClass(); } } return true; diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotObjectConstantImpl.java --- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotObjectConstantImpl.java Tue Sep 08 17:43:41 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotObjectConstantImpl.java Tue Sep 08 19:07:16 2015 +0200 @@ -56,8 +56,8 @@ } } - public static JavaConstant forBoxedValue(Kind kind, Object value) { - if (kind == Kind.Object) { + public static JavaConstant forBoxedValue(JavaKind kind, Object value) { + if (kind == JavaKind.Object) { return HotSpotObjectConstantImpl.forObject(value); } else { return JavaConstant.forBoxedPrimitive(value); @@ -95,8 +95,8 @@ } @Override - public Kind getKind() { - return Kind.Object; + public JavaKind getJavaKind() { + return JavaKind.Object; } /** @@ -267,13 +267,13 @@ if (object instanceof String) { return "\"" + (String) object + "\""; } else { - return Kind.Object.format(object); + return JavaKind.Object.format(object); } } @Override public String toString() { - return (compressed ? "NarrowOop" : getKind().getJavaName()) + "[" + Kind.Object.format(object) + "]"; + return (compressed ? "NarrowOop" : getJavaKind().getJavaName()) + "[" + JavaKind.Object.format(object) + "]"; } /** diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotResolvedObjectType.java --- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotResolvedObjectType.java Tue Sep 08 17:43:41 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotResolvedObjectType.java Tue Sep 08 19:07:16 2015 +0200 @@ -50,8 +50,8 @@ return false; } - default Kind getKind() { - return Kind.Object; + default JavaKind getJavaKind() { + return JavaKind.Object; } ConstantPool getConstantPool(); diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotResolvedObjectTypeImpl.java --- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotResolvedObjectTypeImpl.java Tue Sep 08 17:43:41 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotResolvedObjectTypeImpl.java Tue Sep 08 19:07:16 2015 +0200 @@ -109,7 +109,7 @@ * Gets the metaspace Klass for this type. */ public long getMetaspaceKlass() { - if (HotSpotJVMCIRuntime.getHostWordKind() == Kind.Long) { + if (HotSpotJVMCIRuntime.getHostWordKind() == JavaKind.Long) { return unsafe.getLong(javaClass, (long) runtime().getConfig().klassOffset); } return unsafe.getInt(javaClass, (long) runtime().getConfig().klassOffset) & 0xFFFFFFFFL; @@ -349,7 +349,7 @@ @Override public boolean isInstance(JavaConstant obj) { - if (obj.getKind() == Kind.Object && !obj.isNull()) { + if (obj.getJavaKind() == JavaKind.Object && !obj.isNull()) { return mirror().isInstance(((HotSpotObjectConstantImpl) obj).object()); } return false; @@ -381,8 +381,8 @@ } @Override - public Kind getKind() { - return Kind.Object; + public JavaKind getJavaKind() { + return JavaKind.Object; } @Override @@ -807,7 +807,7 @@ } @Override - public ResolvedJavaField findInstanceFieldWithOffset(long offset, Kind expectedEntryKind) { + public ResolvedJavaField findInstanceFieldWithOffset(long offset, JavaKind expectedEntryKind) { ResolvedJavaField[] declaredFields = getInstanceFields(true); for (ResolvedJavaField field : declaredFields) { HotSpotResolvedJavaField resolvedField = (HotSpotResolvedJavaField) field; @@ -815,11 +815,11 @@ // @formatter:off if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN && expectedEntryKind.isPrimitive() && - !expectedEntryKind.equals(Kind.Void) && - resolvedField.getKind().isPrimitive()) { + !expectedEntryKind.equals(JavaKind.Void) && + resolvedField.getJavaKind().isPrimitive()) { resolvedFieldOffset += - resolvedField.getKind().getByteCount() - - Math.min(resolvedField.getKind().getByteCount(), 4 + expectedEntryKind.getByteCount()); + resolvedField.getJavaKind().getByteCount() - + Math.min(resolvedField.getJavaKind().getByteCount(), 4 + expectedEntryKind.getByteCount()); } if (resolvedFieldOffset == offset) { return field; diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotResolvedPrimitiveType.java --- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotResolvedPrimitiveType.java Tue Sep 08 17:43:41 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotResolvedPrimitiveType.java Tue Sep 08 19:07:16 2015 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2015, 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 @@ -37,10 +37,10 @@ */ public final class HotSpotResolvedPrimitiveType extends HotSpotResolvedJavaType implements HotSpotProxified { - private final Kind kind; + private final JavaKind kind; /** - * Creates the JVMCI mirror for a primitive {@link Kind}. + * Creates the JVMCI mirror for a primitive {@link JavaKind}. * *

* NOTE: Creating an instance of this class does not install the mirror for the @@ -49,7 +49,7 @@ * * @param kind the Kind to create the mirror for */ - public HotSpotResolvedPrimitiveType(Kind kind) { + public HotSpotResolvedPrimitiveType(JavaKind kind) { super(String.valueOf(Character.toUpperCase(kind.getTypeChar()))); this.kind = kind; assert mirror().isPrimitive() : mirror() + " not a primitive type"; @@ -62,7 +62,7 @@ @Override public HotSpotResolvedObjectTypeImpl getArrayClass() { - if (kind == Kind.Void) { + if (kind == JavaKind.Void) { return null; } Class javaArrayMirror = Array.newInstance(mirror(), 0).getClass(); @@ -164,7 +164,7 @@ } @Override - public Kind getKind() { + public JavaKind getJavaKind() { return kind; } @@ -229,7 +229,7 @@ } @Override - public ResolvedJavaField findInstanceFieldWithOffset(long offset, Kind expectedType) { + public ResolvedJavaField findInstanceFieldWithOffset(long offset, JavaKind expectedType) { return null; } diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotSignature.java --- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotSignature.java Tue Sep 08 17:43:41 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotSignature.java Tue Sep 08 19:07:16 2015 +0200 @@ -112,8 +112,8 @@ } @Override - public Kind getParameterKind(int index) { - return Kind.fromTypeString(parameters.get(index)); + public JavaKind getParameterKind(int index) { + return JavaKind.fromTypeString(parameters.get(index)); } private static boolean checkValidCache(ResolvedJavaType type, ResolvedJavaType accessingClass) { @@ -128,7 +128,7 @@ private static JavaType getUnresolvedOrPrimitiveType(HotSpotJVMCIRuntimeProvider runtime, String name) { if (name.length() == 1) { - Kind kind = Kind.fromPrimitiveOrVoidTypeChar(name.charAt(0)); + JavaKind kind = JavaKind.fromPrimitiveOrVoidTypeChar(name.charAt(0)); return runtime.getHostJVMCIBackend().getMetaAccess().lookupJavaType(kind.toJavaClass()); } return new HotSpotUnresolvedJavaType(name, runtime); @@ -165,8 +165,8 @@ } @Override - public Kind getReturnKind() { - return Kind.fromTypeString(returnType); + public JavaKind getReturnKind() { + return JavaKind.fromTypeString(returnType); } @Override diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotUnresolvedJavaType.java --- a/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotUnresolvedJavaType.java Tue Sep 08 17:43:41 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.hotspot/src/jdk/internal/jvmci/hotspot/HotSpotUnresolvedJavaType.java Tue Sep 08 19:07:16 2015 +0200 @@ -56,8 +56,8 @@ } @Override - public Kind getKind() { - return Kind.Object; + public JavaKind getJavaKind() { + return JavaKind.Object; } @Override diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/ConstantReflectionProvider.java --- a/jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/ConstantReflectionProvider.java Tue Sep 08 17:43:41 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/ConstantReflectionProvider.java Tue Sep 08 19:07:16 2015 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, 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 @@ -26,11 +26,11 @@ /** * Reflection operations on values represented as {@linkplain JavaConstant constants}. All methods - * in this interface require the VM to access the actual object encapsulated in {@link Kind#Object - * object} constants. This access is not always possible, depending on kind of VM and the state that - * the VM is in. Therefore, all methods can return {@code null} at any time, to indicate that the - * result is not available at this point. The caller is responsible to check for {@code null} - * results and handle them properly, e.g., not perform an optimization. + * in this interface require the VM to access the actual object encapsulated in + * {@link JavaKind#Object object} constants. This access is not always possible, depending on kind + * of VM and the state that the VM is in. Therefore, all methods can return {@code null} at any + * time, to indicate that the result is not available at this point. The caller is responsible to + * check for {@code null} results and handle them properly, e.g., not perform an optimization. */ public interface ConstantReflectionProvider { @@ -113,18 +113,18 @@ JavaConstant readStableFieldValue(JavaField field, JavaConstant receiver, boolean isDefaultStable); /** - * Converts the given {@link Kind#isPrimitive() primitive} constant to a boxed - * {@link Kind#Object object} constant, according to the Java boxing rules. Returns {@code null} - * if the source is is not a primitive constant, or the boxed value is not available at this - * point. + * Converts the given {@link JavaKind#isPrimitive() primitive} constant to a boxed + * {@link JavaKind#Object object} constant, according to the Java boxing rules. Returns + * {@code null} if the source is is not a primitive constant, or the boxed value is not + * available at this point. */ JavaConstant boxPrimitive(JavaConstant source); /** - * Converts the given {@link Kind#Object object} constant to a {@link Kind#isPrimitive() - * primitive} constant, according to the Java unboxing rules. Returns {@code null} if the source - * is is not an object constant that can be unboxed, or the unboxed value is not available at - * this point. + * Converts the given {@link JavaKind#Object object} constant to a + * {@link JavaKind#isPrimitive() primitive} constant, according to the Java unboxing rules. + * Returns {@code null} if the source is is not an object constant that can be unboxed, or the + * unboxed value is not available at this point. */ JavaConstant unboxPrimitive(JavaConstant source); diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/JavaConstant.java --- a/jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/JavaConstant.java Tue Sep 08 17:43:41 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/JavaConstant.java Tue Sep 08 19:07:16 2015 +0200 @@ -34,23 +34,23 @@ * not enough to justify the impact on startup time. */ JavaConstant NULL_POINTER = new NullConstant(); - PrimitiveConstant INT_MINUS_1 = new PrimitiveConstant(Kind.Int, -1); - PrimitiveConstant INT_0 = new PrimitiveConstant(Kind.Int, 0); - PrimitiveConstant INT_1 = new PrimitiveConstant(Kind.Int, 1); - PrimitiveConstant INT_2 = new PrimitiveConstant(Kind.Int, 2); - PrimitiveConstant LONG_0 = new PrimitiveConstant(Kind.Long, 0L); - PrimitiveConstant LONG_1 = new PrimitiveConstant(Kind.Long, 1L); - PrimitiveConstant FLOAT_0 = new PrimitiveConstant(Kind.Float, Float.floatToRawIntBits(0.0F)); - PrimitiveConstant FLOAT_1 = new PrimitiveConstant(Kind.Float, Float.floatToRawIntBits(1.0F)); - PrimitiveConstant DOUBLE_0 = new PrimitiveConstant(Kind.Double, Double.doubleToRawLongBits(0.0D)); - PrimitiveConstant DOUBLE_1 = new PrimitiveConstant(Kind.Double, Double.doubleToRawLongBits(1.0D)); - PrimitiveConstant TRUE = new PrimitiveConstant(Kind.Boolean, 1L); - PrimitiveConstant FALSE = new PrimitiveConstant(Kind.Boolean, 0L); + PrimitiveConstant INT_MINUS_1 = new PrimitiveConstant(JavaKind.Int, -1); + PrimitiveConstant INT_0 = new PrimitiveConstant(JavaKind.Int, 0); + PrimitiveConstant INT_1 = new PrimitiveConstant(JavaKind.Int, 1); + PrimitiveConstant INT_2 = new PrimitiveConstant(JavaKind.Int, 2); + PrimitiveConstant LONG_0 = new PrimitiveConstant(JavaKind.Long, 0L); + PrimitiveConstant LONG_1 = new PrimitiveConstant(JavaKind.Long, 1L); + PrimitiveConstant FLOAT_0 = new PrimitiveConstant(JavaKind.Float, Float.floatToRawIntBits(0.0F)); + PrimitiveConstant FLOAT_1 = new PrimitiveConstant(JavaKind.Float, Float.floatToRawIntBits(1.0F)); + PrimitiveConstant DOUBLE_0 = new PrimitiveConstant(JavaKind.Double, Double.doubleToRawLongBits(0.0D)); + PrimitiveConstant DOUBLE_1 = new PrimitiveConstant(JavaKind.Double, Double.doubleToRawLongBits(1.0D)); + PrimitiveConstant TRUE = new PrimitiveConstant(JavaKind.Boolean, 1L); + PrimitiveConstant FALSE = new PrimitiveConstant(JavaKind.Boolean, 0L); /** * Returns the Java kind of this constant. */ - Kind getKind(); + JavaKind getJavaKind(); /** * Checks whether this constant is null. @@ -92,7 +92,7 @@ /** * Returns the primitive int value this constant represents. The constant must have a - * {@link Kind#getStackKind()} of {@link Kind#Int}. + * {@link JavaKind#getStackKind()} of {@link JavaKind#Int}. * * @return the constant value */ @@ -100,7 +100,7 @@ /** * Returns the primitive boolean value this constant represents. The constant must have kind - * {@link Kind#Boolean}. + * {@link JavaKind#Boolean}. * * @return the constant value */ @@ -108,7 +108,7 @@ /** * Returns the primitive long value this constant represents. The constant must have kind - * {@link Kind#Long}, a {@link Kind#getStackKind()} of {@link Kind#Int}. + * {@link JavaKind#Long}, a {@link JavaKind#getStackKind()} of {@link JavaKind#Int}. * * @return the constant value */ @@ -116,7 +116,7 @@ /** * Returns the primitive float value this constant represents. The constant must have kind - * {@link Kind#Float}. + * {@link JavaKind#Float}. * * @return the constant value */ @@ -124,25 +124,25 @@ /** * Returns the primitive double value this constant represents. The constant must have kind - * {@link Kind#Double}. + * {@link JavaKind#Double}. * * @return the constant value */ double asDouble(); default String toValueString() { - if (getKind() == Kind.Illegal) { + if (getJavaKind() == JavaKind.Illegal) { return "illegal"; } else { - return getKind().format(asBoxedPrimitive()); + return getJavaKind().format(asBoxedPrimitive()); } } static String toString(JavaConstant constant) { - if (constant.getKind() == Kind.Illegal) { + if (constant.getJavaKind() == JavaKind.Illegal) { return "illegal"; } else { - return constant.getKind().getJavaName() + "[" + constant.toValueString() + "]"; + return constant.getJavaKind().getJavaName() + "[" + constant.toValueString() + "]"; } } @@ -159,7 +159,7 @@ if (Double.compare(d, 1.0D) == 0) { return DOUBLE_1; } - return new PrimitiveConstant(Kind.Double, Double.doubleToRawLongBits(d)); + return new PrimitiveConstant(JavaKind.Double, Double.doubleToRawLongBits(d)); } /** @@ -175,7 +175,7 @@ if (Float.compare(f, 1.0F) == 0) { return FLOAT_1; } - return new PrimitiveConstant(Kind.Float, Float.floatToRawIntBits(f)); + return new PrimitiveConstant(JavaKind.Float, Float.floatToRawIntBits(f)); } /** @@ -190,7 +190,7 @@ } else if (i == 1) { return LONG_1; } else { - return new PrimitiveConstant(Kind.Long, i); + return new PrimitiveConstant(JavaKind.Long, i); } } @@ -211,7 +211,7 @@ case 2: return INT_2; default: - return new PrimitiveConstant(Kind.Int, i); + return new PrimitiveConstant(JavaKind.Int, i); } } @@ -222,7 +222,7 @@ * @return a boxed copy of {@code value} */ static PrimitiveConstant forByte(byte i) { - return new PrimitiveConstant(Kind.Byte, i); + return new PrimitiveConstant(JavaKind.Byte, i); } /** @@ -242,7 +242,7 @@ * @return a boxed copy of {@code value} */ static PrimitiveConstant forChar(char i) { - return new PrimitiveConstant(Kind.Char, i); + return new PrimitiveConstant(JavaKind.Char, i); } /** @@ -252,13 +252,13 @@ * @return a boxed copy of {@code value} */ static PrimitiveConstant forShort(short i) { - return new PrimitiveConstant(Kind.Short, i); + return new PrimitiveConstant(JavaKind.Short, i); } /** * Creates a {@link JavaConstant} from a primitive integer of a certain kind. */ - static PrimitiveConstant forIntegerKind(Kind kind, long i) { + static PrimitiveConstant forIntegerKind(JavaKind kind, long i) { switch (kind) { case Boolean: return forBoolean(i != 0); @@ -327,13 +327,13 @@ } static PrimitiveConstant forIllegal() { - return new PrimitiveConstant(Kind.Illegal, 0); + return new PrimitiveConstant(JavaKind.Illegal, 0); } /** * Returns a constant with the default value for the given kind. */ - static JavaConstant defaultForKind(Kind kind) { + static JavaConstant defaultForKind(JavaKind kind) { switch (kind) { case Boolean: return FALSE; @@ -361,7 +361,7 @@ /** * Returns the zero value for a given numeric kind. */ - static JavaConstant zero(Kind kind) { + static JavaConstant zero(JavaKind kind) { switch (kind) { case Boolean: return FALSE; @@ -387,7 +387,7 @@ /** * Returns the one value for a given numeric kind. */ - static JavaConstant one(Kind kind) { + static JavaConstant one(JavaKind kind) { switch (kind) { case Boolean: return TRUE; @@ -414,8 +414,8 @@ * Adds two numeric constants. */ static JavaConstant add(JavaConstant x, JavaConstant y) { - assert x.getKind() == y.getKind(); - switch (x.getKind()) { + assert x.getJavaKind() == y.getJavaKind(); + switch (x.getJavaKind()) { case Byte: return forByte((byte) (x.asInt() + y.asInt())); case Char: @@ -431,7 +431,7 @@ case Short: return forShort((short) (x.asInt() + y.asInt())); default: - throw new IllegalArgumentException(x.getKind().toString()); + throw new IllegalArgumentException(x.getJavaKind().toString()); } } @@ -439,8 +439,8 @@ * Multiplies two numeric constants. */ static PrimitiveConstant mul(JavaConstant x, JavaConstant y) { - assert x.getKind() == y.getKind(); - switch (x.getKind()) { + assert x.getJavaKind() == y.getJavaKind(); + switch (x.getJavaKind()) { case Byte: return forByte((byte) (x.asInt() * y.asInt())); case Char: @@ -456,7 +456,7 @@ case Short: return forShort((short) (x.asInt() * y.asInt())); default: - throw new IllegalArgumentException(x.getKind().toString()); + throw new IllegalArgumentException(x.getJavaKind().toString()); } } } diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/JavaField.java --- a/jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/JavaField.java Tue Sep 08 17:43:41 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/JavaField.java Tue Sep 08 19:07:16 2015 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2015, 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 @@ -42,10 +42,10 @@ /** * Returns the kind of this field. This is the same as calling {@link #getType}. - * {@link JavaType#getKind getKind}. + * {@link JavaType#getJavaKind getJavaKind}. */ - default Kind getKind() { - return getType().getKind(); + default JavaKind getJavaKind() { + return getType().getJavaKind(); } /** diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/JavaKind.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/JavaKind.java Tue Sep 08 19:07:16 2015 +0200 @@ -0,0 +1,496 @@ +/* + * Copyright (c) 2009, 2015, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.internal.jvmci.meta; + +import java.lang.reflect.*; + +//JaCoCo Exclude + +/** + * Denotes the basic kinds of types in CRI, including the all the Java primitive types, for example, + * {@link JavaKind#Int} for {@code int} and {@link JavaKind#Object} for all object types. A kind has + * a single character short name, a Java name, and a set of flags further describing its behavior. + */ +public enum JavaKind implements PlatformKind { + /** The primitive boolean kind, represented as an int on the stack. */ + Boolean('z', "boolean", 1, true, java.lang.Boolean.TYPE, java.lang.Boolean.class), + + /** The primitive byte kind, represented as an int on the stack. */ + Byte('b', "byte", 1, true, java.lang.Byte.TYPE, java.lang.Byte.class), + + /** The primitive short kind, represented as an int on the stack. */ + Short('s', "short", 1, true, java.lang.Short.TYPE, java.lang.Short.class), + + /** The primitive char kind, represented as an int on the stack. */ + Char('c', "char", 1, true, java.lang.Character.TYPE, java.lang.Character.class), + + /** The primitive int kind, represented as an int on the stack. */ + Int('i', "int", 1, true, java.lang.Integer.TYPE, java.lang.Integer.class), + + /** The primitive float kind. */ + Float('f', "float", 1, false, java.lang.Float.TYPE, java.lang.Float.class), + + /** The primitive long kind. */ + Long('j', "long", 2, false, java.lang.Long.TYPE, java.lang.Long.class), + + /** The primitive double kind. */ + Double('d', "double", 2, false, java.lang.Double.TYPE, java.lang.Double.class), + + /** The Object kind, also used for arrays. */ + Object('a', "Object", 1, false, null, null), + + /** The void float kind. */ + Void('v', "void", 0, false, java.lang.Void.TYPE, java.lang.Void.class), + + /** The non-type. */ + Illegal('-', "illegal", 0, false, null, null); + + private final char typeChar; + private final String javaName; + private final boolean isStackInt; + private final Class primitiveJavaClass; + private final Class boxedJavaClass; + private final EnumKey key = new EnumKey<>(this); + private final int slotCount; + + private JavaKind(char typeChar, String javaName, int slotCount, boolean isStackInt, Class primitiveJavaClass, Class boxedJavaClass) { + this.typeChar = typeChar; + this.javaName = javaName; + this.slotCount = slotCount; + this.isStackInt = isStackInt; + this.primitiveJavaClass = primitiveJavaClass; + this.boxedJavaClass = boxedJavaClass; + assert primitiveJavaClass == null || javaName.equals(primitiveJavaClass.getName()); + } + + /** + * Returns the number of stack slots occupied by this kind according to the Java bytecodes + * specification. + */ + public int getSlotCount() { + return this.slotCount; + } + + /** + * Returns whether this kind occupied two stack slots. + */ + public boolean needsTwoSlots() { + return this.slotCount == 2; + } + + /** + * Returns the name of the kind as a single character. + */ + public char getTypeChar() { + return typeChar; + } + + /** + * Returns the name of this kind which will also be it Java programming language name if it is + * {@linkplain #isPrimitive() primitive} or {@code void}. + */ + public String getJavaName() { + return javaName; + } + + public Key getKey() { + return key; + } + + /** + * Checks whether this type is a Java primitive type. + * + * @return {@code true} if this is {@link #Boolean}, {@link #Byte}, {@link #Char}, + * {@link #Short}, {@link #Int}, {@link #Long}, {@link #Float}, {@link #Double}, or + * {@link #Void}. + */ + public boolean isPrimitive() { + return primitiveJavaClass != null; + } + + /** + * Returns the kind that represents this kind when on the Java operand stack. + * + * @return the kind used on the operand stack + */ + public JavaKind getStackKind() { + if (isStackInt) { + return Int; + } + return this; + } + + /** + * Checks whether this type is a Java primitive type representing an integer number. + * + * @return {@code true} if the stack kind is {@link #Int} or {@link #Long}. + */ + public boolean isNumericInteger() { + return isStackInt || this == JavaKind.Long; + } + + /** + * Checks whether this type is a Java primitive type representing an unsigned number. + * + * @return {@code true} if the kind is {@link #Boolean} or {@link #Char}. + */ + public boolean isUnsigned() { + return this == JavaKind.Boolean || this == JavaKind.Char; + } + + /** + * Checks whether this type is a Java primitive type representing a floating point number. + * + * @return {@code true} if this is {@link #Float} or {@link #Double}. + */ + public boolean isNumericFloat() { + return this == JavaKind.Float || this == JavaKind.Double; + } + + /** + * Checks whether this represent an Object of some sort. + * + * @return {@code true} if this is {@link #Object}. + */ + public boolean isObject() { + return this == JavaKind.Object; + } + + /** + * Returns the kind corresponding to the Java type string. + * + * @param typeString the Java type string + * @return the kind + */ + public static JavaKind fromTypeString(String typeString) { + assert typeString.length() > 0; + final char first = typeString.charAt(0); + if (first == '[' || first == 'L') { + return JavaKind.Object; + } + return JavaKind.fromPrimitiveOrVoidTypeChar(first); + } + + /** + * Returns the kind of a word given the size of a word in bytes. + * + * @param wordSizeInBytes the size of a word in bytes + * @return the kind representing a word value + */ + public static JavaKind fromWordSize(int wordSizeInBytes) { + if (wordSizeInBytes == 8) { + return JavaKind.Long; + } else { + assert wordSizeInBytes == 4 : "Unsupported word size!"; + return JavaKind.Int; + } + } + + /** + * Returns the kind from the character describing a primitive or void. + * + * @param ch the character + * @return the kind + */ + public static JavaKind fromPrimitiveOrVoidTypeChar(char ch) { + switch (ch) { + case 'Z': + return Boolean; + case 'C': + return Char; + case 'F': + return Float; + case 'D': + return Double; + case 'B': + return Byte; + case 'S': + return Short; + case 'I': + return Int; + case 'J': + return Long; + case 'V': + return Void; + } + throw new IllegalArgumentException("unknown primitive or void type character: " + ch); + } + + /** + * Returns the Kind representing the given Java class. + * + * @param klass the class + * @return the kind + */ + public static JavaKind fromJavaClass(Class klass) { + if (klass == Boolean.primitiveJavaClass) { + return Boolean; + } else if (klass == Byte.primitiveJavaClass) { + return Byte; + } else if (klass == Short.primitiveJavaClass) { + return Short; + } else if (klass == Char.primitiveJavaClass) { + return Char; + } else if (klass == Int.primitiveJavaClass) { + return Int; + } else if (klass == Long.primitiveJavaClass) { + return Long; + } else if (klass == Float.primitiveJavaClass) { + return Float; + } else if (klass == Double.primitiveJavaClass) { + return Double; + } else if (klass == Void.primitiveJavaClass) { + return Void; + } else { + return Object; + } + } + + /** + * Returns the Java class representing this kind. + * + * @return the Java class + */ + public Class toJavaClass() { + return primitiveJavaClass; + } + + /** + * Returns the Java class for instances of boxed values of this kind. + * + * @return the Java class + */ + public Class toBoxedJavaClass() { + return boxedJavaClass; + } + + /** + * Converts this value type to a string. + */ + @Override + public String toString() { + return javaName; + } + + /** + * Marker interface for types that should be {@linkplain JavaKind#format(Object) formatted} with + * their {@link Object#toString()} value. Calling {@link Object#toString()} on other objects + * poses a security risk because it can potentially call user code. + */ + public interface FormatWithToString { + } + + /** + * Classes for which invoking {@link Object#toString()} does not run user code. + */ + private static boolean isToStringSafe(Class c) { + return c == Boolean.class || c == Byte.class || c == Character.class || c == Short.class || c == Integer.class || c == Float.class || c == Long.class || c == Double.class; + } + + /** + * Gets a formatted string for a given value of this kind. + * + * @param value a value of this kind + * @return a formatted string for {@code value} based on this kind + */ + public String format(Object value) { + if (isPrimitive()) { + assert isToStringSafe(value.getClass()); + return value.toString(); + } else { + if (value == null) { + return "null"; + } else { + if (value instanceof String) { + String s = (String) value; + if (s.length() > 50) { + return "String:\"" + s.substring(0, 30) + "...\""; + } else { + return "String:\"" + s + '"'; + } + } else if (value instanceof JavaType) { + return "JavaType:" + ((JavaType) value).toJavaName(); + } else if (value instanceof Enum) { + return MetaUtil.getSimpleName(value.getClass(), true) + ":" + ((Enum) value).name(); + } else if (value instanceof FormatWithToString) { + return MetaUtil.getSimpleName(value.getClass(), true) + ":" + String.valueOf(value); + } else if (value instanceof Class) { + return "Class:" + ((Class) value).getName(); + } else if (isToStringSafe(value.getClass())) { + return value.toString(); + } else if (value.getClass().isArray()) { + return formatArray(value); + } else { + return MetaUtil.getSimpleName(value.getClass(), true) + "@" + System.identityHashCode(value); + } + } + } + } + + private static final int MAX_FORMAT_ARRAY_LENGTH = 5; + + private static String formatArray(Object array) { + Class componentType = array.getClass().getComponentType(); + assert componentType != null; + int arrayLength = Array.getLength(array); + StringBuilder buf = new StringBuilder(MetaUtil.getSimpleName(componentType, true)).append('[').append(arrayLength).append("]{"); + int length = Math.min(MAX_FORMAT_ARRAY_LENGTH, arrayLength); + boolean primitive = componentType.isPrimitive(); + for (int i = 0; i < length; i++) { + if (primitive) { + buf.append(Array.get(array, i)); + } else { + Object o = ((Object[]) array)[i]; + buf.append(JavaKind.Object.format(o)); + } + if (i != length - 1) { + buf.append(", "); + } + } + if (arrayLength != length) { + buf.append(", ..."); + } + return buf.append('}').toString(); + } + + /** + * The minimum value that can be represented as a value of this kind. + * + * @return the minimum value + */ + public long getMinValue() { + switch (this) { + case Boolean: + return 0; + case Byte: + return java.lang.Byte.MIN_VALUE; + case Char: + return java.lang.Character.MIN_VALUE; + case Short: + return java.lang.Short.MIN_VALUE; + case Int: + return java.lang.Integer.MIN_VALUE; + case Long: + return java.lang.Long.MIN_VALUE; + default: + throw new IllegalArgumentException("illegal call to minValue on " + this); + } + } + + /** + * The maximum value that can be represented as a value of this kind. + * + * @return the maximum value + */ + public long getMaxValue() { + switch (this) { + case Boolean: + return 1; + case Byte: + return java.lang.Byte.MAX_VALUE; + case Char: + return java.lang.Character.MAX_VALUE; + case Short: + return java.lang.Short.MAX_VALUE; + case Int: + return java.lang.Integer.MAX_VALUE; + case Long: + return java.lang.Long.MAX_VALUE; + default: + throw new IllegalArgumentException("illegal call to maxValue on " + this); + } + } + + /** + * Number of bytes that are necessary to represent a value of this kind. + * + * @return the number of bytes + */ + public int getByteCount() { + if (this == Boolean) { + return 1; + } else { + return getBitCount() >> 3; + } + } + + /** + * Number of bits that are necessary to represent a value of this kind. + * + * @return the number of bits + */ + public int getBitCount() { + switch (this) { + case Boolean: + return 1; + case Byte: + return 8; + case Char: + case Short: + return 16; + case Float: + return 32; + case Int: + return 32; + case Double: + return 64; + case Long: + return 64; + default: + throw new IllegalArgumentException("illegal call to bits on " + this); + } + } + + public JavaConstant getDefaultValue() { + switch (this) { + case Boolean: + return JavaConstant.FALSE; + case Int: + return JavaConstant.INT_0; + case Long: + return JavaConstant.LONG_0; + case Float: + return JavaConstant.FLOAT_0; + case Double: + return JavaConstant.DOUBLE_0; + case Object: + return JavaConstant.NULL_POINTER; + case Byte: + case Char: + case Short: + return new PrimitiveConstant(this, 0); + default: + throw new IllegalArgumentException("illegal call to getDefaultValue on " + this); + } + } + + @Override + public int getSizeInBytes() { + return getByteCount(); + } + + @Override + public int getVectorLength() { + return 1; + } +} diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/JavaType.java --- a/jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/JavaType.java Tue Sep 08 17:43:41 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/JavaType.java Tue Sep 08 19:07:16 2015 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2015, 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 @@ -86,9 +86,9 @@ JavaType getArrayClass(); /** - * Gets the kind of this type. + * Gets the {@link JavaKind} of this type. */ - Kind getKind(); + JavaKind getJavaKind(); /** * Resolves this type to a {@link ResolvedJavaType}. @@ -136,11 +136,11 @@ * @return the Java name corresponding to this type */ default String toJavaName(boolean qualified) { - Kind kind = getKind(); - if (kind == Kind.Object) { + JavaKind kind = getJavaKind(); + if (kind == JavaKind.Object) { return internalNameToJava(getName(), qualified, false); } - return getKind().getJavaName(); + return getJavaKind().getJavaName(); } /** diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/Kind.java --- a/jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/Kind.java Tue Sep 08 17:43:41 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,496 +0,0 @@ -/* - * Copyright (c) 2009, 2015, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package jdk.internal.jvmci.meta; - -import java.lang.reflect.*; - -//JaCoCo Exclude - -/** - * Denotes the basic kinds of types in CRI, including the all the Java primitive types, for example, - * {@link Kind#Int} for {@code int} and {@link Kind#Object} for all object types. A kind has a - * single character short name, a Java name, and a set of flags further describing its behavior. - */ -public enum Kind implements PlatformKind { - /** The primitive boolean kind, represented as an int on the stack. */ - Boolean('z', "boolean", 1, true, java.lang.Boolean.TYPE, java.lang.Boolean.class), - - /** The primitive byte kind, represented as an int on the stack. */ - Byte('b', "byte", 1, true, java.lang.Byte.TYPE, java.lang.Byte.class), - - /** The primitive short kind, represented as an int on the stack. */ - Short('s', "short", 1, true, java.lang.Short.TYPE, java.lang.Short.class), - - /** The primitive char kind, represented as an int on the stack. */ - Char('c', "char", 1, true, java.lang.Character.TYPE, java.lang.Character.class), - - /** The primitive int kind, represented as an int on the stack. */ - Int('i', "int", 1, true, java.lang.Integer.TYPE, java.lang.Integer.class), - - /** The primitive float kind. */ - Float('f', "float", 1, false, java.lang.Float.TYPE, java.lang.Float.class), - - /** The primitive long kind. */ - Long('j', "long", 2, false, java.lang.Long.TYPE, java.lang.Long.class), - - /** The primitive double kind. */ - Double('d', "double", 2, false, java.lang.Double.TYPE, java.lang.Double.class), - - /** The Object kind, also used for arrays. */ - Object('a', "Object", 1, false, null, null), - - /** The void float kind. */ - Void('v', "void", 0, false, java.lang.Void.TYPE, java.lang.Void.class), - - /** The non-type. */ - Illegal('-', "illegal", 0, false, null, null); - - private final char typeChar; - private final String javaName; - private final boolean isStackInt; - private final Class primitiveJavaClass; - private final Class boxedJavaClass; - private final EnumKey key = new EnumKey<>(this); - private final int slotCount; - - private Kind(char typeChar, String javaName, int slotCount, boolean isStackInt, Class primitiveJavaClass, Class boxedJavaClass) { - this.typeChar = typeChar; - this.javaName = javaName; - this.slotCount = slotCount; - this.isStackInt = isStackInt; - this.primitiveJavaClass = primitiveJavaClass; - this.boxedJavaClass = boxedJavaClass; - assert primitiveJavaClass == null || javaName.equals(primitiveJavaClass.getName()); - } - - /** - * Returns the number of stack slots occupied by this kind according to the Java bytecodes - * specification. - */ - public int getSlotCount() { - return this.slotCount; - } - - /** - * Returns whether this kind occupied two stack slots. - */ - public boolean needsTwoSlots() { - return this.slotCount == 2; - } - - /** - * Returns the name of the kind as a single character. - */ - public char getTypeChar() { - return typeChar; - } - - /** - * Returns the name of this kind which will also be it Java programming language name if it is - * {@linkplain #isPrimitive() primitive} or {@code void}. - */ - public String getJavaName() { - return javaName; - } - - public Key getKey() { - return key; - } - - /** - * Checks whether this type is a Java primitive type. - * - * @return {@code true} if this is {@link #Boolean}, {@link #Byte}, {@link #Char}, - * {@link #Short}, {@link #Int}, {@link #Long}, {@link #Float}, {@link #Double}, or - * {@link #Void}. - */ - public boolean isPrimitive() { - return primitiveJavaClass != null; - } - - /** - * Returns the kind that represents this kind when on the Java operand stack. - * - * @return the kind used on the operand stack - */ - public Kind getStackKind() { - if (isStackInt) { - return Int; - } - return this; - } - - /** - * Checks whether this type is a Java primitive type representing an integer number. - * - * @return {@code true} if the stack kind is {@link #Int} or {@link #Long}. - */ - public boolean isNumericInteger() { - return isStackInt || this == Kind.Long; - } - - /** - * Checks whether this type is a Java primitive type representing an unsigned number. - * - * @return {@code true} if the kind is {@link #Boolean} or {@link #Char}. - */ - public boolean isUnsigned() { - return this == Kind.Boolean || this == Kind.Char; - } - - /** - * Checks whether this type is a Java primitive type representing a floating point number. - * - * @return {@code true} if this is {@link #Float} or {@link #Double}. - */ - public boolean isNumericFloat() { - return this == Kind.Float || this == Kind.Double; - } - - /** - * Checks whether this represent an Object of some sort. - * - * @return {@code true} if this is {@link #Object}. - */ - public boolean isObject() { - return this == Kind.Object; - } - - /** - * Returns the kind corresponding to the Java type string. - * - * @param typeString the Java type string - * @return the kind - */ - public static Kind fromTypeString(String typeString) { - assert typeString.length() > 0; - final char first = typeString.charAt(0); - if (first == '[' || first == 'L') { - return Kind.Object; - } - return Kind.fromPrimitiveOrVoidTypeChar(first); - } - - /** - * Returns the kind of a word given the size of a word in bytes. - * - * @param wordSizeInBytes the size of a word in bytes - * @return the kind representing a word value - */ - public static Kind fromWordSize(int wordSizeInBytes) { - if (wordSizeInBytes == 8) { - return Kind.Long; - } else { - assert wordSizeInBytes == 4 : "Unsupported word size!"; - return Kind.Int; - } - } - - /** - * Returns the kind from the character describing a primitive or void. - * - * @param ch the character - * @return the kind - */ - public static Kind fromPrimitiveOrVoidTypeChar(char ch) { - switch (ch) { - case 'Z': - return Boolean; - case 'C': - return Char; - case 'F': - return Float; - case 'D': - return Double; - case 'B': - return Byte; - case 'S': - return Short; - case 'I': - return Int; - case 'J': - return Long; - case 'V': - return Void; - } - throw new IllegalArgumentException("unknown primitive or void type character: " + ch); - } - - /** - * Returns the Kind representing the given Java class. - * - * @param klass the class - * @return the kind - */ - public static Kind fromJavaClass(Class klass) { - if (klass == Boolean.primitiveJavaClass) { - return Boolean; - } else if (klass == Byte.primitiveJavaClass) { - return Byte; - } else if (klass == Short.primitiveJavaClass) { - return Short; - } else if (klass == Char.primitiveJavaClass) { - return Char; - } else if (klass == Int.primitiveJavaClass) { - return Int; - } else if (klass == Long.primitiveJavaClass) { - return Long; - } else if (klass == Float.primitiveJavaClass) { - return Float; - } else if (klass == Double.primitiveJavaClass) { - return Double; - } else if (klass == Void.primitiveJavaClass) { - return Void; - } else { - return Object; - } - } - - /** - * Returns the Java class representing this kind. - * - * @return the Java class - */ - public Class toJavaClass() { - return primitiveJavaClass; - } - - /** - * Returns the Java class for instances of boxed values of this kind. - * - * @return the Java class - */ - public Class toBoxedJavaClass() { - return boxedJavaClass; - } - - /** - * Converts this value type to a string. - */ - @Override - public String toString() { - return javaName; - } - - /** - * Marker interface for types that should be {@linkplain Kind#format(Object) formatted} with - * their {@link Object#toString()} value. Calling {@link Object#toString()} on other objects - * poses a security risk because it can potentially call user code. - */ - public interface FormatWithToString { - } - - /** - * Classes for which invoking {@link Object#toString()} does not run user code. - */ - private static boolean isToStringSafe(Class c) { - return c == Boolean.class || c == Byte.class || c == Character.class || c == Short.class || c == Integer.class || c == Float.class || c == Long.class || c == Double.class; - } - - /** - * Gets a formatted string for a given value of this kind. - * - * @param value a value of this kind - * @return a formatted string for {@code value} based on this kind - */ - public String format(Object value) { - if (isPrimitive()) { - assert isToStringSafe(value.getClass()); - return value.toString(); - } else { - if (value == null) { - return "null"; - } else { - if (value instanceof String) { - String s = (String) value; - if (s.length() > 50) { - return "String:\"" + s.substring(0, 30) + "...\""; - } else { - return "String:\"" + s + '"'; - } - } else if (value instanceof JavaType) { - return "JavaType:" + ((JavaType) value).toJavaName(); - } else if (value instanceof Enum) { - return MetaUtil.getSimpleName(value.getClass(), true) + ":" + ((Enum) value).name(); - } else if (value instanceof FormatWithToString) { - return MetaUtil.getSimpleName(value.getClass(), true) + ":" + String.valueOf(value); - } else if (value instanceof Class) { - return "Class:" + ((Class) value).getName(); - } else if (isToStringSafe(value.getClass())) { - return value.toString(); - } else if (value.getClass().isArray()) { - return formatArray(value); - } else { - return MetaUtil.getSimpleName(value.getClass(), true) + "@" + System.identityHashCode(value); - } - } - } - } - - private static final int MAX_FORMAT_ARRAY_LENGTH = 5; - - private static String formatArray(Object array) { - Class componentType = array.getClass().getComponentType(); - assert componentType != null; - int arrayLength = Array.getLength(array); - StringBuilder buf = new StringBuilder(MetaUtil.getSimpleName(componentType, true)).append('[').append(arrayLength).append("]{"); - int length = Math.min(MAX_FORMAT_ARRAY_LENGTH, arrayLength); - boolean primitive = componentType.isPrimitive(); - for (int i = 0; i < length; i++) { - if (primitive) { - buf.append(Array.get(array, i)); - } else { - Object o = ((Object[]) array)[i]; - buf.append(Kind.Object.format(o)); - } - if (i != length - 1) { - buf.append(", "); - } - } - if (arrayLength != length) { - buf.append(", ..."); - } - return buf.append('}').toString(); - } - - /** - * The minimum value that can be represented as a value of this kind. - * - * @return the minimum value - */ - public long getMinValue() { - switch (this) { - case Boolean: - return 0; - case Byte: - return java.lang.Byte.MIN_VALUE; - case Char: - return java.lang.Character.MIN_VALUE; - case Short: - return java.lang.Short.MIN_VALUE; - case Int: - return java.lang.Integer.MIN_VALUE; - case Long: - return java.lang.Long.MIN_VALUE; - default: - throw new IllegalArgumentException("illegal call to minValue on " + this); - } - } - - /** - * The maximum value that can be represented as a value of this kind. - * - * @return the maximum value - */ - public long getMaxValue() { - switch (this) { - case Boolean: - return 1; - case Byte: - return java.lang.Byte.MAX_VALUE; - case Char: - return java.lang.Character.MAX_VALUE; - case Short: - return java.lang.Short.MAX_VALUE; - case Int: - return java.lang.Integer.MAX_VALUE; - case Long: - return java.lang.Long.MAX_VALUE; - default: - throw new IllegalArgumentException("illegal call to maxValue on " + this); - } - } - - /** - * Number of bytes that are necessary to represent a value of this kind. - * - * @return the number of bytes - */ - public int getByteCount() { - if (this == Boolean) { - return 1; - } else { - return getBitCount() >> 3; - } - } - - /** - * Number of bits that are necessary to represent a value of this kind. - * - * @return the number of bits - */ - public int getBitCount() { - switch (this) { - case Boolean: - return 1; - case Byte: - return 8; - case Char: - case Short: - return 16; - case Float: - return 32; - case Int: - return 32; - case Double: - return 64; - case Long: - return 64; - default: - throw new IllegalArgumentException("illegal call to bits on " + this); - } - } - - public JavaConstant getDefaultValue() { - switch (this) { - case Boolean: - return JavaConstant.FALSE; - case Int: - return JavaConstant.INT_0; - case Long: - return JavaConstant.LONG_0; - case Float: - return JavaConstant.FLOAT_0; - case Double: - return JavaConstant.DOUBLE_0; - case Object: - return JavaConstant.NULL_POINTER; - case Byte: - case Char: - case Short: - return new PrimitiveConstant(this, 0); - default: - throw new IllegalArgumentException("illegal call to getDefaultValue on " + this); - } - } - - @Override - public int getSizeInBytes() { - return getByteCount(); - } - - @Override - public int getVectorLength() { - return 1; - } -} diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/LIRKind.java --- a/jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/LIRKind.java Tue Sep 08 17:43:41 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/LIRKind.java Tue Sep 08 19:07:16 2015 +0200 @@ -60,7 +60,7 @@ /** * The non-type. This uses {@link #unknownReference}, so it can never be part of an oop map. */ - public static final LIRKind Illegal = unknownReference(Kind.Illegal); + public static final LIRKind Illegal = unknownReference(JavaKind.Illegal); private final PlatformKind platformKind; private final int referenceMask; @@ -70,7 +70,7 @@ private static final int UNKNOWN_REFERENCE = -1; private LIRKind(PlatformKind platformKind, int referenceMask, AllocatableValue derivedReferenceBase) { - assert platformKind != Kind.Object : "Kind.Object shouldn't be used in the backend"; + assert platformKind != JavaKind.Object : "Kind.Object shouldn't be used in the backend"; this.platformKind = platformKind; this.referenceMask = referenceMask; this.derivedReferenceBase = derivedReferenceBase; @@ -443,8 +443,8 @@ } private static PlatformKind toStackKind(PlatformKind platformKind) { - if (platformKind instanceof Kind) { - return ((Kind) platformKind).getStackKind(); + if (platformKind instanceof JavaKind) { + return ((JavaKind) platformKind).getStackKind(); } return platformKind; } diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/MemoryAccessProvider.java --- a/jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/MemoryAccessProvider.java Tue Sep 08 17:43:41 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/MemoryAccessProvider.java Tue Sep 08 19:07:16 2015 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, 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 @@ -36,18 +36,18 @@ * @return the read value encapsulated in a {@link JavaConstant} object, or {@code null} if the * value cannot be read. */ - JavaConstant readUnsafeConstant(Kind kind, JavaConstant base, long displacement); + JavaConstant readUnsafeConstant(JavaKind kind, JavaConstant base, long displacement); /** * Reads a primitive value using a base address and a displacement. * - * @param kind the {@link Kind} of the returned {@link JavaConstant} object + * @param kind the {@link JavaKind} of the returned {@link JavaConstant} object * @param base the base address from which the value is read * @param displacement the displacement within the object in bytes * @param bits the number of bits to read from memory - * @return the read value encapsulated in a {@link JavaConstant} object of {@link Kind} kind + * @return the read value encapsulated in a {@link JavaConstant} object of {@link JavaKind} kind */ - JavaConstant readPrimitiveConstant(Kind kind, Constant base, long displacement, int bits); + JavaConstant readPrimitiveConstant(JavaKind kind, Constant base, long displacement, int bits); /** * Reads a Java {@link Object} value using a base address and a displacement. diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/MetaUtil.java --- a/jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/MetaUtil.java Tue Sep 08 17:43:41 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/MetaUtil.java Tue Sep 08 19:07:16 2015 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, 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 @@ -53,7 +53,7 @@ public static long getMemorySizeRecursive(MetaAccessProvider access, ConstantReflectionProvider constantReflection, JavaConstant constant, PrintStream out, int printTopN) { Set marked = new HashSet<>(); Deque stack = new ArrayDeque<>(); - if (constant.getKind() == Kind.Object && constant.isNonNull()) { + if (constant.getJavaKind() == JavaKind.Object && constant.isNonNull()) { marked.add(constant); } final HashMap histogram = new HashMap<>(); @@ -63,7 +63,7 @@ JavaConstant c = stack.pop(); long memorySize = access.getMemorySize(constant); sum += memorySize; - if (c.getKind() == Kind.Object && c.isNonNull()) { + if (c.getJavaKind() == JavaKind.Object && c.isNonNull()) { ResolvedJavaType clazz = access.lookupJavaType(c); if (!histogram.containsKey(clazz)) { histogram.put(clazz, new ClassInfo()); @@ -83,7 +83,7 @@ } else { ResolvedJavaField[] instanceFields = type.getInstanceFields(true); for (ResolvedJavaField f : instanceFields) { - if (f.getKind() == Kind.Object) { + if (f.getJavaKind() == JavaKind.Object) { JavaConstant value = constantReflection.readFieldValue(f, c); pushConstant(marked, stack, value); } @@ -195,7 +195,7 @@ if (name.length() != 1) { throw new IllegalArgumentException("Illegal internal name: " + name); } - return Kind.fromPrimitiveOrVoidTypeChar(name.charAt(0)).getJavaName(); + return JavaKind.fromPrimitiveOrVoidTypeChar(name.charAt(0)).getJavaName(); } } @@ -203,7 +203,7 @@ * Turns an class name in internal format into a resolved Java type. */ public static ResolvedJavaType classForName(String internal, MetaAccessProvider metaAccess, ClassLoader cl) { - Kind k = Kind.fromTypeString(internal); + JavaKind k = JavaKind.fromTypeString(internal); try { String n = internalNameToJava(internal, true, true); return metaAccess.lookupJavaType(k.isPrimitive() ? k.toJavaClass() : Class.forName(n, true, cl)); diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/NullConstant.java --- a/jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/NullConstant.java Tue Sep 08 17:43:41 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/NullConstant.java Tue Sep 08 19:07:16 2015 +0200 @@ -31,8 +31,8 @@ } @Override - public Kind getKind() { - return Kind.Object; + public JavaKind getJavaKind() { + return JavaKind.Object; } @Override diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/PrimitiveConstant.java --- a/jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/PrimitiveConstant.java Tue Sep 08 17:43:41 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/PrimitiveConstant.java Tue Sep 08 19:07:16 2015 +0200 @@ -30,7 +30,7 @@ */ public class PrimitiveConstant implements JavaConstant, SerializableConstant { - private final Kind kind; + private final JavaKind kind; /** * The boxed primitive value as a {@code long}. For {@code float} and {@code double} values, @@ -39,15 +39,15 @@ */ private final long primitive; - protected PrimitiveConstant(Kind kind, long primitive) { + protected PrimitiveConstant(JavaKind kind, long primitive) { this.primitive = primitive; this.kind = kind; - assert kind.isPrimitive() || kind == Kind.Illegal; + assert kind.isPrimitive() || kind == JavaKind.Illegal; } @Override - public Kind getKind() { + public JavaKind getJavaKind() { return kind; } @@ -63,37 +63,37 @@ @Override public boolean asBoolean() { - assert getKind() == Kind.Boolean; + assert getJavaKind() == JavaKind.Boolean; return primitive != 0L; } @Override public int asInt() { - assert getKind().getStackKind() == Kind.Int : getKind().getStackKind(); + assert getJavaKind().getStackKind() == JavaKind.Int : getJavaKind().getStackKind(); return (int) primitive; } @Override public long asLong() { - assert getKind().isNumericInteger(); + assert getJavaKind().isNumericInteger(); return primitive; } @Override public float asFloat() { - assert getKind() == Kind.Float; + assert getJavaKind() == JavaKind.Float; return Float.intBitsToFloat((int) primitive); } @Override public double asDouble() { - assert getKind() == Kind.Double; + assert getJavaKind() == JavaKind.Double; return Double.longBitsToDouble(primitive); } @Override public Object asBoxedPrimitive() { - switch (getKind()) { + switch (getJavaKind()) { case Byte: return Byte.valueOf((byte) primitive); case Boolean: @@ -111,18 +111,18 @@ case Double: return Double.valueOf(asDouble()); default: - throw new IllegalArgumentException("unexpected kind " + getKind()); + throw new IllegalArgumentException("unexpected kind " + getJavaKind()); } } @Override public int getSerializedSize() { - return getKind().getByteCount(); + return getJavaKind().getByteCount(); } @Override public void serialize(ByteBuffer buffer) { - switch (getKind()) { + switch (getJavaKind()) { case Byte: case Boolean: buffer.put((byte) primitive); @@ -146,13 +146,13 @@ buffer.putDouble(asDouble()); break; default: - throw new IllegalArgumentException("unexpected kind " + getKind()); + throw new IllegalArgumentException("unexpected kind " + getJavaKind()); } } @Override public int hashCode() { - return (int) (primitive ^ (primitive >>> 32)) * (getKind().ordinal() + 31); + return (int) (primitive ^ (primitive >>> 32)) * (getJavaKind().ordinal() + 31); } @Override @@ -169,10 +169,10 @@ @Override public String toString() { - if (getKind() == Kind.Illegal) { + if (getJavaKind() == JavaKind.Illegal) { return "illegal"; } else { - return getKind().getJavaName() + "[" + asBoxedPrimitive() + "|0x" + Long.toHexString(primitive) + "]"; + return getJavaKind().getJavaName() + "[" + asBoxedPrimitive() + "|0x" + Long.toHexString(primitive) + "]"; } } } diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/RawConstant.java --- a/jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/RawConstant.java Tue Sep 08 17:43:41 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/RawConstant.java Tue Sep 08 19:07:16 2015 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2015, 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,6 @@ public class RawConstant extends PrimitiveConstant { public RawConstant(long rawValue) { - super(Kind.Int, rawValue); + super(JavaKind.Int, rawValue); } } diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/ResolvedJavaType.java --- a/jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/ResolvedJavaType.java Tue Sep 08 17:43:41 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/ResolvedJavaType.java Tue Sep 08 19:07:16 2015 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2015, 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 @@ -137,7 +137,7 @@ */ default boolean isJavaLangObject() { // Removed assertion due to https://bugs.eclipse.org/bugs/show_bug.cgi?id=434442 - return getSuperclass() == null && !isInterface() && getKind() == Kind.Object; + return getSuperclass() == null && !isInterface() && getJavaKind() == JavaKind.Object; } /** @@ -311,7 +311,7 @@ * @param offset the offset of the field to look for * @return the field with the given offset, or {@code null} if there is no such field. */ - ResolvedJavaField findInstanceFieldWithOffset(long offset, Kind expectedKind); + ResolvedJavaField findInstanceFieldWithOffset(long offset, JavaKind expectedKind); /** * Returns name of source file of this type. diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/Signature.java --- a/jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/Signature.java Tue Sep 08 17:43:41 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.meta/src/jdk/internal/jvmci/meta/Signature.java Tue Sep 08 19:07:16 2015 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2015, 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 @@ -54,13 +54,13 @@ /** * Gets the parameter kind at the specified position. This is the same as calling - * {@link #getParameterType}. {@link JavaType#getKind getKind}. + * {@link #getParameterType}. {@link JavaType#getJavaKind getJavaKind}. * * @param index the index into the parameters, with {@code 0} indicating the first parameter * @return the kind of the parameter at the specified position */ - default Kind getParameterKind(int index) { - return getParameterType(index, null).getKind(); + default JavaKind getParameterKind(int index) { + return getParameterType(index, null).getJavaKind(); } /** @@ -77,10 +77,10 @@ /** * Gets the return kind of this signature. This is the same as calling {@link #getReturnType}. - * {@link JavaType#getKind getKind}. + * {@link JavaType#getJavaKind getJavaKind}. */ - default Kind getReturnKind() { - return getReturnType(null).getKind(); + default JavaKind getReturnKind() { + return getReturnType(null).getJavaKind(); } /** @@ -120,16 +120,16 @@ return result; } - default Kind[] toParameterKinds(boolean receiver) { + default JavaKind[] toParameterKinds(boolean receiver) { int args = getParameterCount(false); - Kind[] result; + JavaKind[] result; int i = 0; if (receiver) { - result = new Kind[args + 1]; - result[0] = Kind.Object; + result = new JavaKind[args + 1]; + result[0] = JavaKind.Object; i = 1; } else { - result = new Kind[args]; + result = new JavaKind[args]; } for (int j = 0; j < args; j++) { result[i + j] = getParameterKind(j); diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.runtime.test/src/jdk/internal/jvmci/runtime/test/ConstantTest.java --- a/jvmci/jdk.internal.jvmci.runtime.test/src/jdk/internal/jvmci/runtime/test/ConstantTest.java Tue Sep 08 17:43:41 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.runtime.test/src/jdk/internal/jvmci/runtime/test/ConstantTest.java Tue Sep 08 19:07:16 2015 +0200 @@ -48,27 +48,27 @@ @Test public void testOne() { - for (Kind kind : Kind.values()) { + for (JavaKind kind : JavaKind.values()) { if (kind.isNumericInteger() || kind.isNumericFloat()) { - Assert.assertTrue(JavaConstant.one(kind).getKind() == kind); + Assert.assertTrue(JavaConstant.one(kind).getJavaKind() == kind); } } - Assert.assertEquals(1, JavaConstant.one(Kind.Int).asInt()); - Assert.assertEquals(1L, JavaConstant.one(Kind.Long).asLong()); - Assert.assertEquals(1, JavaConstant.one(Kind.Byte).asInt()); - Assert.assertEquals(1, JavaConstant.one(Kind.Short).asInt()); - Assert.assertEquals(1, JavaConstant.one(Kind.Char).asInt()); - Assert.assertTrue(1F == JavaConstant.one(Kind.Float).asFloat()); - Assert.assertTrue(1D == JavaConstant.one(Kind.Double).asDouble()); + Assert.assertEquals(1, JavaConstant.one(JavaKind.Int).asInt()); + Assert.assertEquals(1L, JavaConstant.one(JavaKind.Long).asLong()); + Assert.assertEquals(1, JavaConstant.one(JavaKind.Byte).asInt()); + Assert.assertEquals(1, JavaConstant.one(JavaKind.Short).asInt()); + Assert.assertEquals(1, JavaConstant.one(JavaKind.Char).asInt()); + Assert.assertTrue(1F == JavaConstant.one(JavaKind.Float).asFloat()); + Assert.assertTrue(1D == JavaConstant.one(JavaKind.Double).asDouble()); } @Test(expected = IllegalArgumentException.class) public void testIllegalOne() { - JavaConstant.one(Kind.Illegal); + JavaConstant.one(JavaKind.Illegal); } @Test(expected = IllegalArgumentException.class) public void testVoidOne() { - JavaConstant.one(Kind.Void); + JavaConstant.one(JavaKind.Void); } } diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.runtime.test/src/jdk/internal/jvmci/runtime/test/TestConstantReflectionProvider.java --- a/jvmci/jdk.internal.jvmci.runtime.test/src/jdk/internal/jvmci/runtime/test/TestConstantReflectionProvider.java Tue Sep 08 17:43:41 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.runtime.test/src/jdk/internal/jvmci/runtime/test/TestConstantReflectionProvider.java Tue Sep 08 19:07:16 2015 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, 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 @@ -44,7 +44,7 @@ for (ConstantValue c2 : constants()) { // test symmetry assertEquals(constantReflection.constantEquals(c1.value, c2.value), constantReflection.constantEquals(c2.value, c1.value)); - if (c1.value.getKind() != Kind.Object && c2.value.getKind() != Kind.Object) { + if (c1.value.getJavaKind() != JavaKind.Object && c2.value.getJavaKind() != JavaKind.Object) { assertEquals(c1.value.equals(c2.value), constantReflection.constantEquals(c2.value, c1.value)); } } @@ -56,7 +56,7 @@ for (ConstantValue cv : constants()) { JavaConstant c = cv.value; Integer actual = constantReflection.readArrayLength(c); - if (c.getKind() != Kind.Object || c.isNull() || !cv.boxed.getClass().isArray()) { + if (c.getJavaKind() != JavaKind.Object || c.isNull() || !cv.boxed.getClass().isArray()) { assertNull(actual); } else { assertNotNull(actual); @@ -85,8 +85,8 @@ for (ConstantValue cv : constants()) { JavaConstant c = cv.value; JavaConstant boxed = constantReflection.boxPrimitive(c); - if (boxed != null && c.getKind().isPrimitive()) { - assertTrue(boxed.getKind().isObject()); + if (boxed != null && c.getJavaKind().isPrimitive()) { + assertTrue(boxed.getJavaKind().isObject()); assertFalse(boxed.isNull()); } } @@ -108,7 +108,7 @@ JavaConstant c = cv.value; JavaConstant unboxed = c.isNull() ? null : constantReflection.unboxPrimitive(c); if (unboxed != null) { - assertFalse(unboxed.getKind().isObject()); + assertFalse(unboxed.getJavaKind().isObject()); } } List primitiveConstants = readConstants(PrimitiveConstants.class); diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.runtime.test/src/jdk/internal/jvmci/runtime/test/TestJavaField.java --- a/jvmci/jdk.internal.jvmci.runtime.test/src/jdk/internal/jvmci/runtime/test/TestJavaField.java Tue Sep 08 17:43:41 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.runtime.test/src/jdk/internal/jvmci/runtime/test/TestJavaField.java Tue Sep 08 19:07:16 2015 +0200 @@ -64,10 +64,10 @@ } @Test - public void getKindTest() { + public void getJavaKindTest() { for (Map.Entry e : fields.entrySet()) { - Kind expected = metaAccess.lookupJavaType(e.getKey().getType()).getKind(); - Kind actual = e.getValue().getKind(); + JavaKind expected = metaAccess.lookupJavaType(e.getKey().getType()).getJavaKind(); + JavaKind actual = e.getValue().getJavaKind(); assertEquals(expected, actual); } } diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.runtime.test/src/jdk/internal/jvmci/runtime/test/TestJavaType.java --- a/jvmci/jdk.internal.jvmci.runtime.test/src/jdk/internal/jvmci/runtime/test/TestJavaType.java Tue Sep 08 17:43:41 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.runtime.test/src/jdk/internal/jvmci/runtime/test/TestJavaType.java Tue Sep 08 19:07:16 2015 +0200 @@ -43,11 +43,11 @@ } @Test - public void getKindTest() { + public void getJavaKindTest() { for (Class c : classes) { JavaType type = metaAccess.lookupJavaType(c); - Kind expected = Kind.fromJavaClass(c); - Kind actual = type.getKind(); + JavaKind expected = JavaKind.fromJavaClass(c); + JavaKind actual = type.getJavaKind(); assertEquals(expected, actual); } } diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.runtime.test/src/jdk/internal/jvmci/runtime/test/TestMetaAccessProvider.java --- a/jvmci/jdk.internal.jvmci.runtime.test/src/jdk/internal/jvmci/runtime/test/TestMetaAccessProvider.java Tue Sep 08 17:43:41 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.runtime.test/src/jdk/internal/jvmci/runtime/test/TestMetaAccessProvider.java Tue Sep 08 19:07:16 2015 +0200 @@ -83,7 +83,7 @@ public void lookupJavaTypeConstantTest() { for (ConstantValue cv : constants()) { JavaConstant c = cv.value; - if (c.getKind() == Kind.Object && !c.isNull()) { + if (c.getJavaKind() == JavaKind.Object && !c.isNull()) { Object o = cv.boxed; ResolvedJavaType type = metaAccess.lookupJavaType(c); assertNotNull(type); diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.runtime.test/src/jdk/internal/jvmci/runtime/test/TestResolvedJavaType.java --- a/jvmci/jdk.internal.jvmci.runtime.test/src/jdk/internal/jvmci/runtime/test/TestResolvedJavaType.java Tue Sep 08 17:43:41 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.runtime.test/src/jdk/internal/jvmci/runtime/test/TestResolvedJavaType.java Tue Sep 08 19:07:16 2015 +0200 @@ -62,7 +62,7 @@ ResolvedJavaField rf = lookupField(type.getInstanceFields(true), f); assertNotNull(rf); long offset = isStatic(f.getModifiers()) ? unsafe.staticFieldOffset(f) : unsafe.objectFieldOffset(f); - ResolvedJavaField result = type.findInstanceFieldWithOffset(offset, rf.getKind()); + ResolvedJavaField result = type.findInstanceFieldWithOffset(offset, rf.getJavaKind()); assertNotNull(result); assertTrue(fieldsEqual(f, result)); } @@ -142,7 +142,7 @@ public void isInstanceTest() { for (ConstantValue cv : constants()) { JavaConstant c = cv.value; - if (c.getKind() == Kind.Object && !c.isNull()) { + if (c.getJavaKind() == JavaKind.Object && !c.isNull()) { ResolvedJavaType cType = metaAccess.lookupJavaType(c); for (ResolvedJavaType t : javaTypes) { if (t.isAssignableFrom(cType)) { diff -r ca418f35d728 -r dc1aeef79e7e jvmci/jdk.internal.jvmci.sparc/src/jdk/internal/jvmci/sparc/SPARC.java --- a/jvmci/jdk.internal.jvmci.sparc/src/jdk/internal/jvmci/sparc/SPARC.java Tue Sep 08 17:43:41 2015 +0200 +++ b/jvmci/jdk.internal.jvmci.sparc/src/jdk/internal/jvmci/sparc/SPARC.java Tue Sep 08 19:07:16 2015 +0200 @@ -252,17 +252,17 @@ public final Set features; public SPARC(Set features) { - super("SPARC", Kind.Long, BIG_ENDIAN, false, allRegisters, LOAD_LOAD | LOAD_STORE | STORE_STORE, 1, r31.encoding + FLOAT_REGISTER_COUNT + 1, 8); + super("SPARC", JavaKind.Long, BIG_ENDIAN, false, allRegisters, LOAD_LOAD | LOAD_STORE | STORE_STORE, 1, r31.encoding + FLOAT_REGISTER_COUNT + 1, 8); this.features = features; } @Override public boolean canStoreValue(RegisterCategory category, PlatformKind lirKind) { - if (!(lirKind instanceof Kind)) { + if (!(lirKind instanceof JavaKind)) { return false; } - Kind kind = (Kind) lirKind; + JavaKind kind = (JavaKind) lirKind; if (category.equals(CPU)) { switch (kind) { case Boolean: @@ -273,9 +273,9 @@ case Long: return true; } - } else if (category.equals(FPUs) && kind.equals(Kind.Float)) { + } else if (category.equals(FPUs) && kind.equals(JavaKind.Float)) { return true; - } else if (category.equals(FPUd) && kind.equals(Kind.Double)) { + } else if (category.equals(FPUd) && kind.equals(JavaKind.Double)) { return true; } return false; @@ -284,20 +284,20 @@ @Override public PlatformKind getLargestStorableKind(RegisterCategory category) { if (category.equals(CPU)) { - return Kind.Long; + return JavaKind.Long; } else if (category.equals(FPUd)) { - return Kind.Double; + return JavaKind.Double; } else if (category.equals(FPUs)) { - return Kind.Float; + return JavaKind.Float; } else { - return Kind.Illegal; + return JavaKind.Illegal; } } @Override - public PlatformKind getPlatformKind(Kind javaKind) { + public PlatformKind getPlatformKind(JavaKind javaKind) { if (javaKind.isObject()) { - return Kind.Long; + return JavaKind.Long; } else { return javaKind; } diff -r ca418f35d728 -r dc1aeef79e7e src/share/vm/jvmci/jvmciCodeInstaller.cpp --- a/src/share/vm/jvmci/jvmciCodeInstaller.cpp Tue Sep 08 17:43:41 2015 +0200 +++ b/src/share/vm/jvmci/jvmciCodeInstaller.cpp Tue Sep 08 19:07:16 2015 +0200 @@ -257,7 +257,7 @@ jlong prim = PrimitiveConstant::primitive(value); return new ConstantLongValue(prim); } else { - assert(type == JVMCIRuntime::kindToBasicType(Kind::typeChar(PrimitiveConstant::kind(value))), "primitive constant type doesn't match"); + assert(type == JVMCIRuntime::kindToBasicType(JavaKind::typeChar(PrimitiveConstant::kind(value))), "primitive constant type doesn't match"); if (type == T_INT || type == T_FLOAT) { jint prim = (jint)PrimitiveConstant::primitive(value); switch (prim) { @@ -312,7 +312,7 @@ ScopeValue* cur_second = NULL; oop object = values->obj_at(i); oop kind = slotKinds->obj_at(i); - BasicType type = JVMCIRuntime::kindToBasicType(Kind::typeChar(kind)); + BasicType type = JVMCIRuntime::kindToBasicType(JavaKind::typeChar(kind)); ScopeValue* value = get_scope_value(object, type, objects, cur_second); if (isLongArray && cur_second == NULL) { @@ -794,7 +794,7 @@ oop value = values->obj_at(i); if (i < local_count) { oop kind = slotKinds->obj_at(i); - BasicType type = JVMCIRuntime::kindToBasicType(Kind::typeChar(kind)); + BasicType type = JVMCIRuntime::kindToBasicType(JavaKind::typeChar(kind)); ScopeValue* first = get_scope_value(value, type, objects, second); if (second != NULL) { locals->append(second); @@ -802,7 +802,7 @@ locals->append(first); } else if (i < local_count + expression_count) { oop kind = slotKinds->obj_at(i); - BasicType type = JVMCIRuntime::kindToBasicType(Kind::typeChar(kind)); + BasicType type = JVMCIRuntime::kindToBasicType(JavaKind::typeChar(kind)); ScopeValue* first = get_scope_value(value, type, objects, second); if (second != NULL) { expressions->append(second); diff -r ca418f35d728 -r dc1aeef79e7e src/share/vm/jvmci/jvmciJavaAccess.hpp --- a/src/share/vm/jvmci/jvmciJavaAccess.hpp Tue Sep 08 17:43:41 2015 +0200 +++ b/src/share/vm/jvmci/jvmciJavaAccess.hpp Tue Sep 08 19:07:16 2015 +0200 @@ -179,7 +179,7 @@ end_class \ start_class(BytecodeFrame) \ objArrayOop_field(BytecodeFrame, values, "[Ljdk/internal/jvmci/meta/JavaValue;") \ - objArrayOop_field(BytecodeFrame, slotKinds, "[Ljdk/internal/jvmci/meta/Kind;") \ + objArrayOop_field(BytecodeFrame, slotKinds, "[Ljdk/internal/jvmci/meta/JavaKind;") \ int_field(BytecodeFrame, numLocals) \ int_field(BytecodeFrame, numStack) \ int_field(BytecodeFrame, numLocks) \ @@ -195,7 +195,7 @@ start_class(JavaConstant) \ end_class \ start_class(PrimitiveConstant) \ - oop_field(PrimitiveConstant, kind, "Ljdk/internal/jvmci/meta/Kind;") \ + oop_field(PrimitiveConstant, kind, "Ljdk/internal/jvmci/meta/JavaKind;") \ long_field(PrimitiveConstant, primitive) \ end_class \ start_class(RawConstant) \ @@ -214,14 +214,14 @@ oop_field(HotSpotMetaspaceConstantImpl, metaspaceObject, "Ljava/lang/Object;") \ boolean_field(HotSpotMetaspaceConstantImpl, compressed) \ end_class \ - start_class(Kind) \ - char_field(Kind, typeChar) \ - static_oop_field(Kind, Boolean, "Ljdk/internal/jvmci/meta/Kind;"); \ - static_oop_field(Kind, Byte, "Ljdk/internal/jvmci/meta/Kind;"); \ - static_oop_field(Kind, Char, "Ljdk/internal/jvmci/meta/Kind;"); \ - static_oop_field(Kind, Short, "Ljdk/internal/jvmci/meta/Kind;"); \ - static_oop_field(Kind, Int, "Ljdk/internal/jvmci/meta/Kind;"); \ - static_oop_field(Kind, Long, "Ljdk/internal/jvmci/meta/Kind;"); \ + start_class(JavaKind) \ + char_field(JavaKind, typeChar) \ + static_oop_field(JavaKind, Boolean, "Ljdk/internal/jvmci/meta/JavaKind;"); \ + static_oop_field(JavaKind, Byte, "Ljdk/internal/jvmci/meta/JavaKind;"); \ + static_oop_field(JavaKind, Char, "Ljdk/internal/jvmci/meta/JavaKind;"); \ + static_oop_field(JavaKind, Short, "Ljdk/internal/jvmci/meta/JavaKind;"); \ + static_oop_field(JavaKind, Int, "Ljdk/internal/jvmci/meta/JavaKind;"); \ + static_oop_field(JavaKind, Long, "Ljdk/internal/jvmci/meta/JavaKind;"); \ end_class \ start_class(LIRKind) \ oop_field(LIRKind, platformKind, "Ljdk/internal/jvmci/meta/PlatformKind;") \ @@ -250,7 +250,7 @@ int_field(VirtualObject, id) \ oop_field(VirtualObject, type, "Ljdk/internal/jvmci/meta/ResolvedJavaType;") \ objArrayOop_field(VirtualObject, values, "[Ljdk/internal/jvmci/meta/JavaValue;") \ - objArrayOop_field(VirtualObject, slotKinds, "[Ljdk/internal/jvmci/meta/Kind;") \ + objArrayOop_field(VirtualObject, slotKinds, "[Ljdk/internal/jvmci/meta/JavaKind;") \ end_class \ start_class(StackLockValue) \ oop_field(StackLockValue, owner, "Ljdk/internal/jvmci/meta/JavaValue;") \ diff -r ca418f35d728 -r dc1aeef79e7e src/share/vm/jvmci/systemDictionary_jvmci.hpp --- a/src/share/vm/jvmci/systemDictionary_jvmci.hpp Tue Sep 08 17:43:41 2015 +0200 +++ b/src/share/vm/jvmci/systemDictionary_jvmci.hpp Tue Sep 08 19:07:16 2015 +0200 @@ -77,7 +77,7 @@ do_klass(RawConstant_klass, jdk_internal_jvmci_meta_RawConstant, Jvmci) \ do_klass(NullConstant_klass, jdk_internal_jvmci_meta_NullConstant, Jvmci) \ do_klass(ExceptionHandler_klass, jdk_internal_jvmci_meta_ExceptionHandler, Jvmci) \ - do_klass(Kind_klass, jdk_internal_jvmci_meta_Kind, Jvmci) \ + do_klass(JavaKind_klass, jdk_internal_jvmci_meta_JavaKind, Jvmci) \ do_klass(LIRKind_klass, jdk_internal_jvmci_meta_LIRKind, Jvmci) \ do_klass(Value_klass, jdk_internal_jvmci_meta_Value, Jvmci) #endif diff -r ca418f35d728 -r dc1aeef79e7e src/share/vm/jvmci/vmSymbols_jvmci.hpp --- a/src/share/vm/jvmci/vmSymbols_jvmci.hpp Tue Sep 08 17:43:41 2015 +0200 +++ b/src/share/vm/jvmci/vmSymbols_jvmci.hpp Tue Sep 08 19:07:16 2015 +0200 @@ -50,7 +50,7 @@ template(jdk_internal_jvmci_meta_RawConstant, "jdk/internal/jvmci/meta/RawConstant") \ template(jdk_internal_jvmci_meta_NullConstant, "jdk/internal/jvmci/meta/NullConstant") \ template(jdk_internal_jvmci_meta_ExceptionHandler, "jdk/internal/jvmci/meta/ExceptionHandler") \ - template(jdk_internal_jvmci_meta_Kind, "jdk/internal/jvmci/meta/Kind") \ + template(jdk_internal_jvmci_meta_JavaKind, "jdk/internal/jvmci/meta/JavaKind") \ template(jdk_internal_jvmci_meta_LIRKind, "jdk/internal/jvmci/meta/LIRKind") \ template(jdk_internal_jvmci_meta_Value, "jdk/internal/jvmci/meta/Value") \ template(jdk_internal_jvmci_meta_Assumptions_ConcreteSubtype, "jdk/internal/jvmci/meta/Assumptions$ConcreteSubtype") \